电表统计接口修改

master
tq 6 months ago
parent bbcf2e19a0
commit b1c3f421e7

@ -49,6 +49,7 @@ namespace WebStarter.Controllers.Ammeter
_emeterEnergyService = emeterEnergyService;
_emeterEnergyChangeService = emeterEnergyChangeService;
}
/// <summary>
/// 七天电表用量
/// </summary>
@ -78,63 +79,54 @@ namespace WebStarter.Controllers.Ammeter
return Result<EmeterEnergyResp>.Success(resp,"成功");
}
#region 统计分析/电能表累计值信息
/// <summary>
/// 电能表累计值
/// 直流电能表累计值
/// </summary>
/// <returns></returns>
[HttpGet("GetAllElectricalData")]
public async Task<Result<EmeterEnergyResp>> GetAllElectricalData()
public async Task<Result<List<EmeterEnergy>>> GetAllElectricalData()
{
EmeterEnergyResp resp = new EmeterEnergyResp();
// 获取直流和交流表数据
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,"成功");
// 直流表数据
return Result<List<EmeterEnergy>>.Success(await _emeterEnergyService.GetAllElectricalData(),"成功");
}
/// <summary>
/// 电能根据小时统计
/// 交流电能表累计值
/// </summary>
/// <returns></returns>
[HttpGet("GetTodayHourlyElectricalData")]
public async Task<Result<EmeterEnergyResp>> GetTodayHourlyElectricalData()
[HttpGet("GetAllEmeterEnergyChange")]
public async Task<Result<List<EmeterEnergyChange>>> GetAllEmeterEnergyChange()
{
EmeterEnergyResp resp = new EmeterEnergyResp();
// 获取直流和交流表数据
List<EmeterEnergy> Electrical = await _emeterEnergyService.GetTodayHourlyElectricalData();
List<EmeterEnergyChange> EnergyChanges = await _emeterEnergyChangeService.GetTodayHourlyElectricalData();
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,"成功");
// 交流表数据
return Result<List<EmeterEnergyChange>>.Success(await _emeterEnergyChangeService.GetAllElectricalData(),"成功");
}
/// <summary>
/// 直流电能表小时统计
/// </summary>
/// <returns></returns>
[HttpGet("GetTodayHourlyEnergy")]
public async Task<Result<List<EmeterEnergy>>> GetTodayHourlyElectricalData()
{
// 直流表数据
return Result<List<EmeterEnergy>>.Success(await _emeterEnergyService.GetTodayHourlyElectricalData(),"成功");
}
/// <summary>
/// 交流电能表小时统计
/// </summary>
/// <returns></returns>
[HttpGet("GetTodayHourlyEnergyChange")]
public async Task<Result<List<EmeterEnergyChange>>> GetTodayHourlyElectricalChangeData()
{
// 交流表数据
return Result<List<EmeterEnergyChange>>.Success(await _emeterEnergyChangeService.GetTodayHourlyElectricalData(),"成功");
}
/// <summary>
/// 统计分析/电能表累计值信息
/// </summary>

Loading…
Cancel
Save