From b1c3f421e7cca93f74e6601e9e9e39a4ca741bae Mon Sep 17 00:00:00 2001
From: tq <1916474859@qq,com>
Date: Tue, 11 Jun 2024 10:21:45 +0800
Subject: [PATCH] =?UTF-8?q?=E7=94=B5=E8=A1=A8=E7=BB=9F=E8=AE=A1=E6=8E=A5?=
=?UTF-8?q?=E5=8F=A3=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/Ammeter/AmmeterController.cs | 84 +++++++++----------
1 file changed, 38 insertions(+), 46 deletions(-)
diff --git a/WebStarter/Controllers/Ammeter/AmmeterController.cs b/WebStarter/Controllers/Ammeter/AmmeterController.cs
index e919ea8..ce7d9ab 100644
--- a/WebStarter/Controllers/Ammeter/AmmeterController.cs
+++ b/WebStarter/Controllers/Ammeter/AmmeterController.cs
@@ -49,6 +49,7 @@ namespace WebStarter.Controllers.Ammeter
_emeterEnergyService = emeterEnergyService;
_emeterEnergyChangeService = emeterEnergyChangeService;
}
+
///
/// 七天电表用量
///
@@ -78,63 +79,54 @@ namespace WebStarter.Controllers.Ammeter
return Result.Success(resp,"成功");
}
#region 统计分析/电能表累计值信息
-
+
///
- /// 电能表累计值
+ /// 直流电能表累计值
///
///
[HttpGet("GetAllElectricalData")]
- public async Task> GetAllElectricalData()
+ public async Task>> GetAllElectricalData()
{
- EmeterEnergyResp resp = new EmeterEnergyResp();
- // 获取直流和交流表数据
- List Electrical = await _emeterEnergyService.GetAllElectricalData();
- List EnergyChanges = await _emeterEnergyChangeService.GetAllElectricalData();
-
- var config = new MapperConfiguration(cfg =>
- {
- cfg.CreateMap().ReverseMap();
- cfg.CreateMap().ReverseMap();
- });
- IMapper mapper = config.CreateMapper();
-
- List EnergyList = mapper.Map>(Electrical);
- List EmeterResps = mapper.Map>(EnergyChanges);
-
- resp.emeterEnergy = EnergyList;
- resp.emeterEnergyChange = EmeterResps;
-
- return Result.Success(resp,"成功");
+ // 直流表数据
+ return Result>.Success(await _emeterEnergyService.GetAllElectricalData(),"成功");
}
-
+
///
- /// 电能根据小时统计
+ /// 交流电能表累计值
///
///
- [HttpGet("GetTodayHourlyElectricalData")]
- public async Task> GetTodayHourlyElectricalData()
+ [HttpGet("GetAllEmeterEnergyChange")]
+ public async Task>> GetAllEmeterEnergyChange()
{
- EmeterEnergyResp resp = new EmeterEnergyResp();
- // 获取直流和交流表数据
-
- List Electrical = await _emeterEnergyService.GetTodayHourlyElectricalData();
- List EnergyChanges = await _emeterEnergyChangeService.GetTodayHourlyElectricalData();
-
- var config = new MapperConfiguration(cfg =>
- {
- cfg.CreateMap().ReverseMap();
- cfg.CreateMap().ReverseMap();
- });
- IMapper mapper = config.CreateMapper();
-
- List EnergyList = mapper.Map>(Electrical);
- List EmeterResps = mapper.Map>(EnergyChanges);
-
- resp.emeterEnergy = EnergyList;
- resp.emeterEnergyChange = EmeterResps;
-
- return Result.Success(resp,"成功");
+ // 交流表数据
+ return Result>.Success(await _emeterEnergyChangeService.GetAllElectricalData(),"成功");
+ }
+
+ ///
+ /// 直流电能表小时统计
+ ///
+ ///
+ [HttpGet("GetTodayHourlyEnergy")]
+ public async Task>> GetTodayHourlyElectricalData()
+ {
+ // 直流表数据
+ return Result>.Success(await _emeterEnergyService.GetTodayHourlyElectricalData(),"成功");
+ }
+
+
+ ///
+ /// 交流电能表小时统计
+ ///
+ ///
+ [HttpGet("GetTodayHourlyEnergyChange")]
+ public async Task>> GetTodayHourlyElectricalChangeData()
+ {
+ // 交流表数据
+ return Result>.Success(await _emeterEnergyChangeService.GetTodayHourlyElectricalData(),"成功");
}
+
+
+
///
/// 统计分析/电能表累计值信息
///