电表统计接口修改

zw
tq 6 months ago
parent bbcf2e19a0
commit b1c3f421e7

@ -49,6 +49,7 @@ namespace WebStarter.Controllers.Ammeter
_emeterEnergyService = emeterEnergyService; _emeterEnergyService = emeterEnergyService;
_emeterEnergyChangeService = emeterEnergyChangeService; _emeterEnergyChangeService = emeterEnergyChangeService;
} }
/// <summary> /// <summary>
/// 七天电表用量 /// 七天电表用量
/// </summary> /// </summary>
@ -80,61 +81,52 @@ namespace WebStarter.Controllers.Ammeter
#region 统计分析/电能表累计值信息 #region 统计分析/电能表累计值信息
/// <summary> /// <summary>
/// 电能表累计值 /// 直流电能表累计值
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpGet("GetAllElectricalData")] [HttpGet("GetAllElectricalData")]
public async Task<Result<EmeterEnergyResp>> GetAllElectricalData() public async Task<Result<List<EmeterEnergy>>> GetAllElectricalData()
{ {
EmeterEnergyResp resp = new EmeterEnergyResp(); // 直流表数据
// 获取直流和交流表数据 return Result<List<EmeterEnergy>>.Success(await _emeterEnergyService.GetAllElectricalData(),"成功");
List<EmeterEnergy> Electrical = await _emeterEnergyService.GetAllElectricalData(); }
List<EmeterEnergyChange> EnergyChanges = await _emeterEnergyChangeService.GetAllElectricalData();
var config = new MapperConfiguration(cfg =>
{
cfg.CreateMap<EmeterResp, EmeterEnergy>().ReverseMap();
cfg.CreateMap<EmeterResp, EmeterEnergyChange>().ReverseMap();
});
IMapper mapper = config.CreateMapper();
List<EmeterResp> EnergyList = mapper.Map<List<EmeterResp>>(Electrical);
List<EmeterResp> EmeterResps = mapper.Map<List<EmeterResp>>(EnergyChanges);
resp.emeterEnergy = EnergyList;
resp.emeterEnergyChange = EmeterResps;
return Result<EmeterEnergyResp>.Success(resp,"成功"); /// <summary>
/// 交流电能表累计值
/// </summary>
/// <returns></returns>
[HttpGet("GetAllEmeterEnergyChange")]
public async Task<Result<List<EmeterEnergyChange>>> GetAllEmeterEnergyChange()
{
// 交流表数据
return Result<List<EmeterEnergyChange>>.Success(await _emeterEnergyChangeService.GetAllElectricalData(),"成功");
} }
/// <summary> /// <summary>
/// 电能根据小时统计 /// 直流电能表小时统计
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpGet("GetTodayHourlyElectricalData")] [HttpGet("GetTodayHourlyEnergy")]
public async Task<Result<EmeterEnergyResp>> GetTodayHourlyElectricalData() public async Task<Result<List<EmeterEnergy>>> GetTodayHourlyElectricalData()
{ {
EmeterEnergyResp resp = new EmeterEnergyResp(); // 直流表数据
// 获取直流和交流表数据 return Result<List<EmeterEnergy>>.Success(await _emeterEnergyService.GetTodayHourlyElectricalData(),"成功");
}
List<EmeterEnergy> Electrical = await _emeterEnergyService.GetTodayHourlyElectricalData();
List<EmeterEnergyChange> EnergyChanges = await _emeterEnergyChangeService.GetTodayHourlyElectricalData();
var config = new MapperConfiguration(cfg => /// <summary>
{ /// 交流电能表小时统计
cfg.CreateMap<EmeterResp, EmeterEnergy>().ReverseMap(); /// </summary>
cfg.CreateMap<EmeterResp, EmeterEnergyChange>().ReverseMap(); /// <returns></returns>
}); [HttpGet("GetTodayHourlyEnergyChange")]
IMapper mapper = config.CreateMapper(); public async Task<Result<List<EmeterEnergyChange>>> GetTodayHourlyElectricalChangeData()
{
// 交流表数据
return Result<List<EmeterEnergyChange>>.Success(await _emeterEnergyChangeService.GetTodayHourlyElectricalData(),"成功");
}
List<EmeterResp> EnergyList = mapper.Map<List<EmeterResp>>(Electrical);
List<EmeterResp> EmeterResps = mapper.Map<List<EmeterResp>>(EnergyChanges);
resp.emeterEnergy = EnergyList;
resp.emeterEnergyChange = EmeterResps;
return Result<EmeterEnergyResp>.Success(resp,"成功");
}
/// <summary> /// <summary>
/// 统计分析/电能表累计值信息 /// 统计分析/电能表累计值信息
/// </summary> /// </summary>

Loading…
Cancel
Save