电表统计接口修改

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

Loading…
Cancel
Save