|
|
|
@ -1,4 +1,6 @@
|
|
|
|
|
using Entity.Ammeter;
|
|
|
|
|
using AutoMapper;
|
|
|
|
|
using Entity.Ammeter;
|
|
|
|
|
using Entity.Api.Resp;
|
|
|
|
|
using Entity.Dto.Req;
|
|
|
|
|
using HybirdFrameworkCore.Entity;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
@ -21,6 +23,11 @@ namespace WebStarter.Controllers.Ammeter
|
|
|
|
|
private EmeterMinutesEnergyChangeService _emeterMinutesEnergyChangeService;
|
|
|
|
|
private EquipInfoService _equipInfoService;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 直流电
|
|
|
|
|
/// </summary>
|
|
|
|
|
private EmeterEnergyService _emeterEnergyService;
|
|
|
|
|
private EmeterEnergyChangeService _emeterEnergyChangeService;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查询电表信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="emeterDayEnergyService"></param>
|
|
|
|
@ -30,27 +37,104 @@ namespace WebStarter.Controllers.Ammeter
|
|
|
|
|
/// <param name="equipInfoService"></param>
|
|
|
|
|
public AmmeterController(EmeterDayEnergyService emeterDayEnergyService, EmeterHourEnergyService emeterHourEnergyService,
|
|
|
|
|
EmeterMinutesEnergyService emeterMinutesEnergyService, EmeterMinutesEnergyChangeService emeterMinutesEnergyChangeService,
|
|
|
|
|
EquipInfoService equipInfoService)
|
|
|
|
|
EquipInfoService equipInfoService,
|
|
|
|
|
EmeterEnergyService emeterEnergyService,
|
|
|
|
|
EmeterEnergyChangeService emeterEnergyChangeService)
|
|
|
|
|
{
|
|
|
|
|
_emeterDayEnergyService = emeterDayEnergyService;
|
|
|
|
|
_emeterHourEnergyService = emeterHourEnergyService;
|
|
|
|
|
_emeterMinutesEnergyService = emeterMinutesEnergyService;
|
|
|
|
|
_emeterMinutesEnergyChangeService = emeterMinutesEnergyChangeService;
|
|
|
|
|
_equipInfoService = equipInfoService;
|
|
|
|
|
_emeterEnergyService = emeterEnergyService;
|
|
|
|
|
_emeterEnergyChangeService = emeterEnergyChangeService;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 七天电表用量
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Code"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("SevenDaysElectricalEnergy")]
|
|
|
|
|
public async Task<Result<List<EmeterDayEnergy>>> SevenDaysElectricalEnergy()
|
|
|
|
|
[HttpGet("SevenDaysElectrical")]
|
|
|
|
|
public async Task<Result<EmeterEnergyResp>> SevenDaysElectrical()
|
|
|
|
|
{
|
|
|
|
|
return Result<List<EmeterDayEnergy>>.Success(await _emeterDayEnergyService.SevenDaysElectricalEnergy());
|
|
|
|
|
}
|
|
|
|
|
EmeterEnergyResp resp = new EmeterEnergyResp();
|
|
|
|
|
// 获取直流和交流表数据
|
|
|
|
|
List<EmeterEnergy> sevenDaysElectrical = await _emeterEnergyService.SevenDaysElectrical();
|
|
|
|
|
List<EmeterEnergyChange> emeterEnergyChanges = await _emeterEnergyChangeService.SevenDaysElectrical();
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
List<EmeterResp> sevenEmeterResps = mapper.Map<List<EmeterResp>>(emeterEnergyChanges);
|
|
|
|
|
|
|
|
|
|
resp.emeterEnergy = emeterEnergyList;
|
|
|
|
|
resp.emeterEnergyChange = sevenEmeterResps;
|
|
|
|
|
|
|
|
|
|
return Result<EmeterEnergyResp>.Success(resp,"成功");
|
|
|
|
|
}
|
|
|
|
|
#region 统计分析/电能表累计值信息
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 电能表累计值
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("GetAllElectricalData")]
|
|
|
|
|
public async Task<Result<EmeterEnergyResp>> 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,"成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 电能根据小时统计
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("GetTodayHourlyElectricalData")]
|
|
|
|
|
public async Task<Result<EmeterEnergyResp>> GetTodayHourlyElectricalData()
|
|
|
|
|
{
|
|
|
|
|
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,"成功");
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 统计分析/电能表累计值信息
|
|
|
|
|
/// </summary>
|
|
|
|
|