|
|
@ -64,43 +64,51 @@ namespace WebStarter.Controllers.Ammeter
|
|
|
|
|
|
|
|
|
|
|
|
EmeterEnergyResp resp = new EmeterEnergyResp();
|
|
|
|
EmeterEnergyResp resp = new EmeterEnergyResp();
|
|
|
|
|
|
|
|
|
|
|
|
var config = new MapperConfiguration(cfg =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cfg.CreateMap<EmeterResp, EmeterEnergy>().ReverseMap();
|
|
|
|
|
|
|
|
cfg.CreateMap<EmeterResp, EmeterEnergyChange>().ReverseMap();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
IMapper mapper = config.CreateMapper();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<EmeterResp> emeterEnergyList = mapper.Map<List<EmeterResp>>(sevenDaysElectrical);
|
|
|
|
ChargeAssignment(sevenDaysElectrical, emeterEnergyChanges, resp);
|
|
|
|
List<EmeterResp> sevenEmeterResps = mapper.Map<List<EmeterResp>>(emeterEnergyChanges);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resp.emeterEnergy = emeterEnergyList;
|
|
|
|
|
|
|
|
resp.emeterEnergyChange = sevenEmeterResps;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Result<EmeterEnergyResp>.Success(resp,"成功");
|
|
|
|
return Result<EmeterEnergyResp>.Success(resp,"成功");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#region 统计分析/电能表累计值信息
|
|
|
|
#region 统计分析/电能表累计值信息
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 直流电能表累计值
|
|
|
|
/// 30天累计能耗
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpGet("GetAllElectricalData")]
|
|
|
|
[HttpGet("GetAllElectricalData")]
|
|
|
|
public async Task<Result<List<EmeterEnergy>>> GetAllElectricalData()
|
|
|
|
public async Task<Result<EmeterEnergyResp>> GetAllElectricalData()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// 直流表数据
|
|
|
|
List<EmeterEnergy> emeterEnergy = await _emeterEnergyService.GetAllElectricalData();
|
|
|
|
return Result<List<EmeterEnergy>>.Success(await _emeterEnergyService.GetAllElectricalData(),"成功");
|
|
|
|
List<EmeterEnergyChange> emeterEnergyChanges = await _emeterEnergyChangeService.GetAllElectricalData();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EmeterEnergyResp resp = new EmeterEnergyResp();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ChargeAssignment(emeterEnergy, emeterEnergyChanges, resp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Result<EmeterEnergyResp>.Success(resp,"成功");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 交流电能表累计值
|
|
|
|
/// 最近一天电表数据
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpGet("GetAllEmeterEnergyChange")]
|
|
|
|
[HttpGet("GetLastDayMeterData")]
|
|
|
|
public async Task<Result<List<EmeterEnergyChange>>> GetAllEmeterEnergyChange()
|
|
|
|
public async Task<Result<EmeterEnergyResp>> GetLastDayMeterData()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// 交流表数据
|
|
|
|
// 获取最近一天直流和交流表数据
|
|
|
|
return Result<List<EmeterEnergyChange>>.Success(await _emeterEnergyChangeService.GetAllElectricalData(),"成功");
|
|
|
|
List<EmeterEnergy> daysElectrical = await _emeterEnergyService.GetTodayHourlyElectricalData();
|
|
|
|
|
|
|
|
List<EmeterEnergyChange> daysElectricalChange = await _emeterEnergyChangeService.GetTodayHourlyElectricalData();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EmeterEnergyResp resp = new EmeterEnergyResp();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ChargeAssignment(daysElectrical, daysElectricalChange, resp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Result<EmeterEnergyResp>.Success(resp,"成功");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -134,11 +142,20 @@ namespace WebStarter.Controllers.Ammeter
|
|
|
|
public async Task<Result<EmeterEnergyResp>> GetTodayMinutelyElectricalData()
|
|
|
|
public async Task<Result<EmeterEnergyResp>> GetTodayMinutelyElectricalData()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// 获取最近一个小时直流和交流表数据
|
|
|
|
// 获取最近一个小时直流和交流表数据
|
|
|
|
List<EmeterEnergy> sevenDaysElectrical = await _emeterEnergyService.GetTodayMinutelyElectricalData();
|
|
|
|
List<EmeterEnergy> minutesElectrical = await _emeterEnergyService.GetTodayMinutelyElectricalData();
|
|
|
|
List<EmeterEnergyChange> emeterEnergyChanges = await _emeterEnergyChangeService.GetTodayMinutelyElectricalData();
|
|
|
|
List<EmeterEnergyChange> minutesElectricalChange = await _emeterEnergyChangeService.GetTodayMinutelyElectricalData();
|
|
|
|
|
|
|
|
|
|
|
|
EmeterEnergyResp resp = new EmeterEnergyResp();
|
|
|
|
EmeterEnergyResp resp = new EmeterEnergyResp();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ChargeAssignment(minutesElectrical, minutesElectricalChange, resp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Result<EmeterEnergyResp>.Success(resp,"成功");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void ChargeAssignment(List<EmeterEnergy> emeterEnergy, List<EmeterEnergyChange> emeterEnergyChanges, EmeterEnergyResp resp)
|
|
|
|
|
|
|
|
{
|
|
|
|
var config = new MapperConfiguration(cfg =>
|
|
|
|
var config = new MapperConfiguration(cfg =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cfg.CreateMap<EmeterResp, EmeterEnergy>().ReverseMap();
|
|
|
|
cfg.CreateMap<EmeterResp, EmeterEnergy>().ReverseMap();
|
|
|
@ -146,13 +163,16 @@ namespace WebStarter.Controllers.Ammeter
|
|
|
|
});
|
|
|
|
});
|
|
|
|
IMapper mapper = config.CreateMapper();
|
|
|
|
IMapper mapper = config.CreateMapper();
|
|
|
|
|
|
|
|
|
|
|
|
List<EmeterResp> emeterEnergyList = mapper.Map<List<EmeterResp>>(sevenDaysElectrical);
|
|
|
|
List<EmeterResp> EnergyList = mapper.Map<List<EmeterResp>>(emeterEnergy);
|
|
|
|
List<EmeterResp> sevenEmeterResps = mapper.Map<List<EmeterResp>>(emeterEnergyChanges);
|
|
|
|
// 类型赋值直流
|
|
|
|
|
|
|
|
EnergyList?.ForEach(emeterResp => emeterResp.Type = 0);
|
|
|
|
|
|
|
|
|
|
|
|
resp.emeterEnergy = emeterEnergyList;
|
|
|
|
List<EmeterResp> EnergyChangeList = mapper.Map<List<EmeterResp>>(emeterEnergyChanges);
|
|
|
|
resp.emeterEnergyChange = sevenEmeterResps;
|
|
|
|
// 类型赋值交流
|
|
|
|
|
|
|
|
EnergyChangeList?.ForEach(emeterResp => emeterResp.Type = 1);
|
|
|
|
|
|
|
|
|
|
|
|
return Result<EmeterEnergyResp>.Success(resp,"成功");
|
|
|
|
resp.emeterEnergy = EnergyList;
|
|
|
|
|
|
|
|
resp.emeterEnergyChange = EnergyChangeList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|