diff --git a/Entity/Ammeter/EmeterEnergy.cs b/Entity/Ammeter/EmeterEnergy.cs
index 1c7549a..63b2d5b 100644
--- a/Entity/Ammeter/EmeterEnergy.cs
+++ b/Entity/Ammeter/EmeterEnergy.cs
@@ -35,5 +35,12 @@ public class EmeterEnergy
[SugarColumn(ColumnName = "upload_flag")]
public virtual string UploadFlag { get; set; }
+ ///
+ /// 统计sql小时接收
+ ///
[SugarColumn(IsIgnore = true)] public virtual string Hour { get; set; }
+ ///
+ /// 统计sql分钟接收
+ ///
+ [SugarColumn(IsIgnore = true)] public virtual string Minute { get; set; }
}
\ No newline at end of file
diff --git a/Entity/Ammeter/EmeterEnergyChange.cs b/Entity/Ammeter/EmeterEnergyChange.cs
index 076daa0..95c519e 100644
--- a/Entity/Ammeter/EmeterEnergyChange.cs
+++ b/Entity/Ammeter/EmeterEnergyChange.cs
@@ -36,4 +36,8 @@ public class EmeterEnergyChange
public virtual int UploadFlag { get; set; }
[SugarColumn(IsIgnore = true)] public virtual string Hour { get; set; }
+ ///
+ /// 统计sql分钟接收
+ ///
+ [SugarColumn(IsIgnore = true)] public virtual string Minute { get; set; }
}
\ No newline at end of file
diff --git a/Entity/Api/Resp/EmeterResp.cs b/Entity/Api/Resp/EmeterResp.cs
index d1e0ba5..ac78f80 100644
--- a/Entity/Api/Resp/EmeterResp.cs
+++ b/Entity/Api/Resp/EmeterResp.cs
@@ -11,7 +11,16 @@ public class EmeterResp
/// 电表当前读数
///
public float Value { get; set; }
-
- public DateTime UploadTime { get; set; }
- public string Hour { get; set; }
+
+ public DateTime UploadTime { get; set; }
+
+ ///
+ /// 小时时间
+ ///
+ public string Hour { get; set; }
+
+ ///
+ ///分钟时间
+ ///
+ public string Minute { get; set; }
}
\ No newline at end of file
diff --git a/Entity/Dto/EquipAlarmProcessRecordDto.cs b/Entity/Dto/EquipAlarmProcessRecordDto.cs
new file mode 100644
index 0000000..937e1ca
--- /dev/null
+++ b/Entity/Dto/EquipAlarmProcessRecordDto.cs
@@ -0,0 +1,64 @@
+using Magicodes.ExporterAndImporter.Core;
+using Magicodes.ExporterAndImporter.Excel;
+
+namespace Entity.Dto;
+
+[ExcelExporter(Name = "已处理报警日志", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)]
+public class EquipAlarmProcessRecordDto
+{
+ ///
+ /// Desc:设备类型编码
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "设备类型编码", IsBold = true)]
+ public int EquipTypeCode { get; set; }
+
+ ///
+ /// Desc:设备编码
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "设备编码", IsBold = true)]
+ public string EquipCode { get; set; }
+
+ ///
+ /// Desc:报警编码
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "报警编码", IsBold = true)]
+ public string ErrorCode { get; set; }
+
+ ///
+ /// Desc:报警等级
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "报警等级", IsBold = true)]
+ public string ErrorLevel { get; set; }
+
+ ///
+ /// Desc:报警描述
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "报警描述", IsBold = true)]
+ public string ErrorMsg { get; set; }
+
+ ///
+ /// Desc:处理方法
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "处理方法", IsBold = true)]
+ public string ProcessMethod { get; set; }
+
+ ///
+ /// Desc:处理时间
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "处理时间", IsBold = true,Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)]
+ public DateTime? ProcessTime { get; set; }
+}
\ No newline at end of file
diff --git a/Entity/Dto/EquipAlarmRecordDto.cs b/Entity/Dto/EquipAlarmRecordDto.cs
new file mode 100644
index 0000000..3911a25
--- /dev/null
+++ b/Entity/Dto/EquipAlarmRecordDto.cs
@@ -0,0 +1,56 @@
+using Magicodes.ExporterAndImporter.Core;
+using Magicodes.ExporterAndImporter.Excel;
+
+namespace Entity.Dto;
+
+[ExcelExporter(Name = "未处理报警日志", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)]
+public class EquipAlarmRecordDto
+{
+ ///
+ /// Desc:设备类型编码
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "设备类型编码", IsBold = true)]
+ public int EquipTypeCode { get; set; }
+
+ ///
+ /// Desc:设备编码
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "设备编码", IsBold = true)]
+ public string EquipCode { get; set; }
+
+ ///
+ /// Desc:报警编码
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "报警编码", IsBold = true)]
+ public string ErrorCode { get; set; }
+
+ ///
+ /// Desc:报警等级
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "报警等级", IsBold = true)]
+ public string ErrorLevel { get; set; }
+
+ ///
+ /// Desc:报警描述
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "报警描述", IsBold = true)]
+ public string ErrorMsg { get; set; }
+
+ ///
+ /// Desc:处理方法
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "处理方法", IsBold = true)]
+ public string ProcessMethod { get; set; }
+}
\ No newline at end of file
diff --git a/Entity/Dto/ExchangeStationDayRunDto.cs b/Entity/Dto/ExchangeStationDayRunDto.cs
new file mode 100644
index 0000000..d8cf340
--- /dev/null
+++ b/Entity/Dto/ExchangeStationDayRunDto.cs
@@ -0,0 +1,100 @@
+using Magicodes.ExporterAndImporter.Core;
+using Magicodes.ExporterAndImporter.Excel;
+
+namespace Entity.Dto;
+
+[ExcelExporter(Name = "换电站日运行统计结果", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)]
+public class ExchangeStationDayRunDto
+{
+ ///
+ /// 平均充电时长
+ ///
+ [ExporterHeader(DisplayName = "平均充电时长", IsBold = true)]
+ public string AvgChgTime { get; set; }
+
+ ///
+ /// 平均换电时长
+ ///
+ [ExporterHeader(DisplayName = "平均换电时长", IsBold = true)]
+ public string AvgRepTime { get; set; }
+
+ ///
+ /// 换电日期
+ ///
+ [ExporterHeader(DisplayName = "换电日期", IsBold = true,Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)]
+ public string SwapDate { get; set; }
+
+ ///
+ /// 首次换电时间
+ ///
+ [ExporterHeader(DisplayName = "首次换电时间", IsBold = true,Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)]
+ public string FristSwapTime { get; set; }
+
+ ///
+ /// 结束换电时间
+ ///
+ [ExporterHeader(DisplayName = "结束换电时间", IsBold = true,Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)]
+ public string StopTime { get; set; }
+
+ ///
+ /// 运行开始时间
+ ///
+ [ExporterHeader(DisplayName = "运行开始时间", IsBold = true,Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)]
+ public string RunStartTime { get; set; }
+
+ ///
+ /// 运行结束时间
+ ///
+ [ExporterHeader(DisplayName = "运行结束时间", IsBold = true,Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)]
+ public string RunEndTime { get; set; }
+
+ ///
+ /// 充电总次数
+ ///
+ [ExporterHeader(DisplayName = "充电总次数", IsBold = true)]
+ public int ChgCount { get; set; }
+
+ ///
+ /// 运营状态1:营业状态 2:暂停营业状态 3:设备维护状态 4:歇业状态
+ ///
+ [ExporterHeader(DisplayName = "运营状态", IsBold = true)]
+ public string OperationalStatus
+ {
+ get
+ {
+ return State switch
+ {
+ 1 => "营业状态",
+ 2 => "暂停营业状态",
+ 3 => "设备维护状态",
+ 4 => "歇业状态",
+ _ => "未知"
+ };
+ }
+ }
+
+ ///
+ /// 运营状态
+ ///
+ [ExporterHeader(IsIgnore = true)]
+
+ public int State { get; set; }
+
+ ///
+ /// 换电总次数
+ ///
+ [ExporterHeader(DisplayName = "换电总次数", IsBold = true)]
+ public int ToltalSwapCount { get; set; }
+
+ ///
+ /// 换电总时长
+ ///
+ [ExporterHeader(DisplayName = "换电总时长", IsBold = true)]
+ public float ToltalSwapAllTime { get; set; }
+
+ ///
+ /// 站运行总时长
+ ///
+ [ExporterHeader(DisplayName = "站运行总时长", IsBold = true)]
+ public float ToltalTimeCount { get; set; }
+}
\ No newline at end of file
diff --git a/Service/Ammeter/EmeterEnergyChangeService.cs b/Service/Ammeter/EmeterEnergyChangeService.cs
index a8e09dd..02c2733 100644
--- a/Service/Ammeter/EmeterEnergyChangeService.cs
+++ b/Service/Ammeter/EmeterEnergyChangeService.cs
@@ -19,40 +19,52 @@ public class EmeterEnergyChangeService : BaseServices
// 根据code分组,取最近7天数据,每天最大值-最小值=当日用电量,如果当天目前只有一条数据,取当天最大值-前一天最大值=当天耗电量
string sql = @"
WITH daily_max_min AS (
- SELECT
- `code`,
- DATE(`upload_time`) AS `UploadTime`,
- MAX(`value`) AS `MaxValue`,
- MIN(`value`) AS `MinValue`
- FROM
- `emeter_energy_change`
- WHERE
- `upload_time` >= NOW() - INTERVAL 8 DAY
- GROUP BY
- `code`, DATE(`upload_time`)
- ), previous_day_max AS (
- SELECT
- `code`,
- `UploadTime`,
- LAG(`MaxValue`) OVER (PARTITION BY `code` ORDER BY `UploadTime`) AS `PreviousMaxValue`
- FROM
- daily_max_min
- )
+ SELECT
+ `code`,
+ DATE(`upload_time`) AS `UploadTime`,
+ MAX(`value`) AS `MaxValue`,
+ MIN(`value`) AS `MinValue`,
+ COUNT(*) AS `Count`
+ FROM
+ `emeter_energy_change`
+ WHERE
+ `upload_time` >= NOW() - INTERVAL 8 DAY
+ GROUP BY
+ `code`, DATE(`upload_time`)
+), previous_day_max AS (
+ SELECT
+ `code`,
+ `UploadTime`,
+ `MaxValue`,
+ `MinValue`,
+ `Count`,
+ LAG(`MaxValue`) OVER (PARTITION BY `code` ORDER BY `UploadTime`) AS `PreviousMaxValue`
+ FROM
+ daily_max_min
+), daily_consumption AS (
SELECT
d.`code`,
d.`UploadTime`,
CASE
- WHEN d.`MaxValue` = d.`MinValue` THEN COALESCE(d.`MaxValue` - p.`PreviousMaxValue`, d.`MaxValue`)
+ WHEN d.`Count` = 1 THEN d.`MaxValue` - d.`PreviousMaxValue`
ELSE d.`MaxValue` - d.`MinValue`
- END AS `Value`
+ END AS `DailyValue`
FROM
- daily_max_min d
- LEFT JOIN
- previous_day_max p ON d.`code` = p.`code` AND d.`UploadTime` = p.`UploadTime`
+ previous_day_max d
WHERE
d.`UploadTime` >= NOW() - INTERVAL 7 DAY
- ORDER BY
- d.`code`, d.`UploadTime`;
+)
+SELECT
+ `UploadTime`,
+ SUM(`DailyValue`) AS `Value`
+FROM
+ daily_consumption
+GROUP BY
+ `UploadTime`
+ORDER BY
+ `UploadTime`;
+
+
";
List emeterEnergies = await _emeterEnergyChangeRep.SqlQueryable(sql);
@@ -117,4 +129,51 @@ public class EmeterEnergyChangeService : BaseServices
List emeterEnergies = await _emeterEnergyChangeRep.SqlQueryable(sql);
return emeterEnergies;
}
+
+ ///
+ /// 根据分钟统计电量
+ ///
+ ///
+ public async Task> GetTodayMinutelyElectricalData()
+ {
+ string sql = @"
+ WITH minute_max_min AS (
+ SELECT
+ `code`,
+ DATE_FORMAT(`upload_time`, '%Y-%m-%d %H:%i:00') AS `Minute`,
+ MAX(`value`) AS `MaxValue`,
+ MIN(`value`) AS `MinValue`,
+ COUNT(*) AS `record_count`
+ FROM
+ `emeter_energy_change`
+ WHERE
+ `upload_time` >= NOW() - INTERVAL 1 HOUR
+ GROUP BY
+ `code`, DATE_FORMAT(`upload_time`, '%Y-%m-%d %H:%i:00')
+ ), previous_minute_max AS (
+ SELECT
+ `code`,
+ `Minute`,
+ LAG(`MaxValue`) OVER (PARTITION BY `code` ORDER BY `Minute`) AS `PreviousMaxValue`
+ FROM
+ `minute_max_min`
+ )
+ SELECT
+ m.`code`,
+ m.`Minute`,
+ CASE
+ WHEN p.`PreviousMaxValue` IS NULL THEN 0
+ WHEN m.`record_count` > 1 THEN m.`MaxValue` - m.`MinValue`
+ ELSE m.`MaxValue` - p.`PreviousMaxValue`
+ END AS `Value`
+ FROM
+ `minute_max_min` m
+ LEFT JOIN
+ `previous_minute_max` p ON m.`code` = p.`code` AND m.`Minute` = p.`Minute`
+ ORDER BY
+ m.`code`, m.`Minute`;";
+
+ List emeterEnergies = await _emeterEnergyChangeRep.SqlQueryable(sql);
+ return emeterEnergies;
+ }
}
\ No newline at end of file
diff --git a/Service/Ammeter/EmeterEnergyService.cs b/Service/Ammeter/EmeterEnergyService.cs
index 2dc786b..52e7cb1 100644
--- a/Service/Ammeter/EmeterEnergyService.cs
+++ b/Service/Ammeter/EmeterEnergyService.cs
@@ -23,40 +23,52 @@ public class EmeterEnergyService : BaseServices
// 根据code分组,取最近7天数据,每天最大值-最小值=当日用电量,如果当天目前只有一条数据,取当天最大值-前一天最大值=当天耗电量
string sql = @"
WITH daily_max_min AS (
- SELECT
- `code`,
- DATE(`upload_time`) AS `UploadTime`,
- MAX(`value`) AS `MaxValue`,
- MIN(`value`) AS `MinValue`
- FROM
- `emeter_energy`
- WHERE
- `upload_time` >= NOW() - INTERVAL 8 DAY
- GROUP BY
- `code`, DATE(`upload_time`)
- ), previous_day_max AS (
- SELECT
- `code`,
- `UploadTime`,
- LAG(`MaxValue`) OVER (PARTITION BY `code` ORDER BY `UploadTime`) AS `PreviousMaxValue`
- FROM
- daily_max_min
- )
+ SELECT
+ `code`,
+ DATE(`upload_time`) AS `UploadTime`,
+ MAX(`value`) AS `MaxValue`,
+ MIN(`value`) AS `MinValue`,
+ COUNT(*) AS `Count`
+ FROM
+ `emeter_energy`
+ WHERE
+ `upload_time` >= NOW() - INTERVAL 8 DAY
+ GROUP BY
+ `code`, DATE(`upload_time`)
+), previous_day_max AS (
+ SELECT
+ `code`,
+ `UploadTime`,
+ `MaxValue`,
+ `MinValue`,
+ `Count`,
+ LAG(`MaxValue`) OVER (PARTITION BY `code` ORDER BY `UploadTime`) AS `PreviousMaxValue`
+ FROM
+ daily_max_min
+), daily_consumption AS (
SELECT
d.`code`,
d.`UploadTime`,
CASE
- WHEN d.`MaxValue` = d.`MinValue` THEN COALESCE(d.`MaxValue` - p.`PreviousMaxValue`, d.`MaxValue`)
+ WHEN d.`Count` = 1 THEN d.`MaxValue` - d.`PreviousMaxValue`
ELSE d.`MaxValue` - d.`MinValue`
- END AS `Value`
+ END AS `DailyValue`
FROM
- daily_max_min d
- LEFT JOIN
- previous_day_max p ON d.`code` = p.`code` AND d.`UploadTime` = p.`UploadTime`
+ previous_day_max d
WHERE
d.`UploadTime` >= NOW() - INTERVAL 7 DAY
- ORDER BY
- d.`code`, d.`UploadTime`;
+)
+SELECT
+ `UploadTime`,
+ SUM(`DailyValue`) AS `Value`
+FROM
+ daily_consumption
+GROUP BY
+ `UploadTime`
+ORDER BY
+ `UploadTime`;
+
+
";
List emeterEnergies = await this.BaseDal.SqlQueryable(sql);
return emeterEnergies;
@@ -130,4 +142,51 @@ public class EmeterEnergyService : BaseServices
List emeterEnergies = await this.BaseDal.SqlQueryable(sql);
return emeterEnergies;
}
+
+ ///
+ /// 根据分钟统计电量
+ ///
+ ///
+ public async Task> GetTodayMinutelyElectricalData()
+ {
+ string sql = @"
+ WITH minute_max_min AS (
+ SELECT
+ `code`,
+ DATE_FORMAT(`upload_time`, '%Y-%m-%d %H:%i:00') AS `Minute`,
+ MAX(`value`) AS `MaxValue`,
+ MIN(`value`) AS `MinValue`,
+ COUNT(*) AS `record_count`
+ FROM
+ `emeter_energy`
+ WHERE
+ `upload_time` >= NOW() - INTERVAL 1 HOUR
+ GROUP BY
+ `code`, DATE_FORMAT(`upload_time`, '%Y-%m-%d %H:%i:00')
+ ), previous_minute_max AS (
+ SELECT
+ `code`,
+ `Minute`,
+ LAG(`MaxValue`) OVER (PARTITION BY `code` ORDER BY `Minute`) AS `PreviousMaxValue`
+ FROM
+ `minute_max_min`
+ )
+ SELECT
+ m.`code`,
+ m.`Minute`,
+ CASE
+ WHEN p.`PreviousMaxValue` IS NULL THEN 0
+ WHEN m.`record_count` > 1 THEN m.`MaxValue` - m.`MinValue`
+ ELSE m.`MaxValue` - p.`PreviousMaxValue`
+ END AS `Value`
+ FROM
+ `minute_max_min` m
+ LEFT JOIN
+ `previous_minute_max` p ON m.`code` = p.`code` AND m.`Minute` = p.`Minute`
+ ORDER BY
+ m.`code`, m.`Minute`;";
+
+ List emeterEnergies = await this.BaseDal.SqlQueryable(sql);
+ return emeterEnergies;
+ }
}
\ No newline at end of file
diff --git a/Service/Station/EquipAlarmRecordService.cs b/Service/Station/EquipAlarmRecordService.cs
index 80a606a..a03d1c0 100644
--- a/Service/Station/EquipAlarmRecordService.cs
+++ b/Service/Station/EquipAlarmRecordService.cs
@@ -1,8 +1,12 @@
+using AutoMapper;
using Entity.Api.Req;
using Entity.DbModel.Station;
+using Entity.Dto;
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.Entity;
using HybirdFrameworkCore.Utils;
+using Magicodes.ExporterAndImporter.Excel;
+using Microsoft.AspNetCore.Mvc;
using Repository.Station;
namespace Service.Station;
@@ -42,6 +46,31 @@ public class EquipAlarmRecordService : BaseServices
return Result>.Success(result);
}
+ ///
+ /// 导出未处理报警日志 🔖
+ ///
+ ///
+ public async Task ExportEquipAlarmRecord()
+ {
+ List equipAlarmRecords = await BaseDal.QueryAsync();
+
+ var config = new MapperConfiguration(cfg =>
+ {
+ cfg.CreateMap().ReverseMap();
+ });
+
+ IMapper mapper = config.CreateMapper();
+
+ List logExList = mapper.Map>(equipAlarmRecords);
+
+ IExcelExporter excelExporter = new ExcelExporter();
+
+ var res = await excelExporter.ExportAsByteArray(logExList);
+
+ return new FileStreamResult(new MemoryStream(res), "application/octet-stream")
+ { FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + "未处理报警日志.xlsx" };
+ }
+
///
/// 查询已处理报警列表
///
@@ -68,4 +97,29 @@ public class EquipAlarmRecordService : BaseServices
return Result>.Success(result);
}
+
+ ///
+ /// 导出已处理报警日志 🔖
+ ///
+ ///
+ public async Task ExportEquipAlarmProcessRecord()
+ {
+ List equipAlarmProcessRecords = await ProcessRecordRepository.QueryAsync();
+
+ var config = new MapperConfiguration(cfg =>
+ {
+ cfg.CreateMap().ReverseMap();
+ });
+
+ IMapper mapper = config.CreateMapper();
+
+ List logExList = mapper.Map>(equipAlarmProcessRecords);
+
+ IExcelExporter excelExporter = new ExcelExporter();
+
+ var res = await excelExporter.ExportAsByteArray(logExList);
+
+ return new FileStreamResult(new MemoryStream(res), "application/octet-stream")
+ { FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + "已处理报警日志.xlsx" };
+ }
}
diff --git a/Service/Station/ExStationDayRunResultService.cs b/Service/Station/ExStationDayRunResultService.cs
index 59e86a8..17e4764 100644
--- a/Service/Station/ExStationDayRunResultService.cs
+++ b/Service/Station/ExStationDayRunResultService.cs
@@ -12,6 +12,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using AutoMapper;
+using Entity.Dto;
+using Magicodes.ExporterAndImporter.Excel;
+using Microsoft.AspNetCore.Mvc;
namespace Service.Station
{
@@ -53,6 +57,32 @@ namespace Service.Station
{
return await _exStationDayRunResultRepository.DeleteByIdsAsync(ids);
}
+
+
+ ///
+ /// 导出换电站日运行统计结果 🔖
+ ///
+ ///
+ public async Task ExportExchangeStationDayRunResult()
+ {
+ List exchangeStationDayRunResults = await _exStationDayRunResultRepository.QueryAsync();
+
+ var config = new MapperConfiguration(cfg =>
+ {
+ cfg.CreateMap().ReverseMap();
+ });
+
+ IMapper mapper = config.CreateMapper();
+
+ List logExList = mapper.Map>(exchangeStationDayRunResults);
+
+ IExcelExporter excelExporter = new ExcelExporter();
+
+ var res = await excelExporter.ExportAsByteArray(logExList);
+
+ return new FileStreamResult(new MemoryStream(res), "application/octet-stream")
+ { FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + "换电站日运行统计.xlsx" };
+ }
}
}
diff --git a/WebStarter/Controllers/Ammeter/AmmeterController.cs b/WebStarter/Controllers/Ammeter/AmmeterController.cs
index ce7d9ab..c9cc1ac 100644
--- a/WebStarter/Controllers/Ammeter/AmmeterController.cs
+++ b/WebStarter/Controllers/Ammeter/AmmeterController.cs
@@ -58,10 +58,11 @@ namespace WebStarter.Controllers.Ammeter
[HttpGet("SevenDaysElectrical")]
public async Task> SevenDaysElectrical()
{
- EmeterEnergyResp resp = new EmeterEnergyResp();
// 获取直流和交流表数据
List sevenDaysElectrical = await _emeterEnergyService.SevenDaysElectrical();
List emeterEnergyChanges = await _emeterEnergyChangeService.SevenDaysElectrical();
+
+ EmeterEnergyResp resp = new EmeterEnergyResp();
var config = new MapperConfiguration(cfg =>
{
@@ -125,7 +126,34 @@ namespace WebStarter.Controllers.Ammeter
return Result>.Success(await _emeterEnergyChangeService.GetTodayHourlyElectricalData(),"成功");
}
-
+ ///
+ /// 最近一小时电表数据
+ ///
+ ///
+ [HttpGet("GetTodayMinutelyElectricalData")]
+ public async Task> GetTodayMinutelyElectricalData()
+ {
+ // 获取最近一个小时直流和交流表数据
+ List sevenDaysElectrical = await _emeterEnergyService.GetTodayMinutelyElectricalData();
+ List emeterEnergyChanges = await _emeterEnergyChangeService.GetTodayMinutelyElectricalData();
+
+ EmeterEnergyResp resp = new EmeterEnergyResp();
+
+ var config = new MapperConfiguration(cfg =>
+ {
+ cfg.CreateMap().ReverseMap();
+ cfg.CreateMap().ReverseMap();
+ });
+ IMapper mapper = config.CreateMapper();
+
+ List emeterEnergyList = mapper.Map>(sevenDaysElectrical);
+ List sevenEmeterResps = mapper.Map>(emeterEnergyChanges);
+
+ resp.emeterEnergy = emeterEnergyList;
+ resp.emeterEnergyChange = sevenEmeterResps;
+
+ return Result.Success(resp,"成功");
+ }
///
/// 统计分析/电能表累计值信息
diff --git a/WebStarter/Controllers/EquipAlarmRecordController.cs b/WebStarter/Controllers/EquipAlarmRecordController.cs
index 25e9ce5..2f4f0c3 100644
--- a/WebStarter/Controllers/EquipAlarmRecordController.cs
+++ b/WebStarter/Controllers/EquipAlarmRecordController.cs
@@ -32,6 +32,20 @@ public class EquipAlarmRecordController : ControllerBase
return equipAlarmRecordService.QueryEquipAlarmPage(req);
}
+ ///
+ /// 导出未处理报警
+ ///
+ ///
+ [HttpPost]
+ [Route("ExportEquipAlarmRecord")]
+ public async Task ExportEquipAlarmRecord()
+ {
+ return await equipAlarmRecordService.ExportEquipAlarmRecord();
+ }
+
+
+
+
///
/// 查询已处理报警列表
///
@@ -43,4 +57,15 @@ public class EquipAlarmRecordController : ControllerBase
{
return equipAlarmRecordService.QueryEquipAlarmProcessPage(req);
}
+
+ ///
+ /// 导出已处理报警
+ ///
+ ///
+ [HttpPost]
+ [Route("ExportEquipAlarmProcessRecord")]
+ public async Task ExportEquipAlarmProcessRecord()
+ {
+ return await equipAlarmRecordService.ExportEquipAlarmProcessRecord();
+ }
}
diff --git a/WebStarter/Controllers/ExStationDayRunResultController.cs b/WebStarter/Controllers/ExStationDayRunResultController.cs
index 74b3834..68e70a3 100644
--- a/WebStarter/Controllers/ExStationDayRunResultController.cs
+++ b/WebStarter/Controllers/ExStationDayRunResultController.cs
@@ -31,6 +31,19 @@ namespace WebStarter.Controllers
return Result>.Success(await _exStationDayRunResultService.ExStationDaySwapRunRes(queryPageModel));
}
+
+ ///
+ /// 导出换电站日运行统计结果
+ ///
+ ///
+ [HttpPost]
+ [Route("ExportExchangeStationDayRunResult")]
+ public async Task ExportExchangeStationDayRunResult()
+ {
+ return await _exStationDayRunResultService.ExportExchangeStationDayRunResult();
+ }
+
+
///
/// 删除换电站日运行统计结果
///