From c44180428497cacf0ad6c3703453fb8996df98f0 Mon Sep 17 00:00:00 2001 From: lxw Date: Sat, 29 Jun 2024 16:49:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=B0=E5=9C=BA=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/Ammeter/EmeterDayEnergy.cs | 21 +- Entity/Ammeter/EmeterEnergy.cs | 2 +- Entity/Ammeter/EmeterHourEnergy.cs | 19 +- Entity/Ammeter/EmeterMinutesEnergy.cs | 20 +- Entity/Ammeter/EmeterMinutesEnergyChange.cs | 39 --- .../EmeterMinutesEnergyChangeRepository.cs | 21 -- Repository/BaseRepository.cs | 2 + .../EmeterMinutesEnergyChangeService.cs | 33 --- Service/Execute/Invoker.cs | 16 +- Service/MyJob/EmeterMinuteJob.cs | 67 +++++ Service/Service.csproj | 2 + .../Controllers/Ammeter/AmmeterController.cs | 277 +++--------------- 12 files changed, 181 insertions(+), 338 deletions(-) delete mode 100644 Entity/Ammeter/EmeterMinutesEnergyChange.cs delete mode 100644 Repository/Ammeter/EmeterMinutesEnergyChangeRepository.cs delete mode 100644 Service/Ammeter/EmeterMinutesEnergyChangeService.cs create mode 100644 Service/MyJob/EmeterMinuteJob.cs diff --git a/Entity/Ammeter/EmeterDayEnergy.cs b/Entity/Ammeter/EmeterDayEnergy.cs index c6933d0..b5c9be2 100644 --- a/Entity/Ammeter/EmeterDayEnergy.cs +++ b/Entity/Ammeter/EmeterDayEnergy.cs @@ -15,25 +15,34 @@ namespace Entity.Ammeter { [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "id")] public long Id { get; set; } + /// /// 电表编码 /// [SugarColumn(ColumnName = "code")] public string Code { get; set; } + /// - /// 天变化值 千瓦时 + /// 累计值 /// [SugarColumn(ColumnName = "value")] public float Value { get; set; } + /// /// 时间 /// [SugarColumn(ColumnName = "st")] - public DateTime St { get; set; } + public string Time { get; set; } + /// - /// 时间 + /// 实时值(取末端) + /// + [SugarColumn(ColumnName = "real_time_value")] + public float RealTimeValue { get; set; } + /// + /// 1:直流表 2:j交流表 /// - [SugarColumn(ColumnName = "et")] - public DateTime Et { get; set; } + [SugarColumn(ColumnName = "type")] + public int Type { get; set; } } -} +} \ No newline at end of file diff --git a/Entity/Ammeter/EmeterEnergy.cs b/Entity/Ammeter/EmeterEnergy.cs index 63b2d5b..b72b39c 100644 --- a/Entity/Ammeter/EmeterEnergy.cs +++ b/Entity/Ammeter/EmeterEnergy.cs @@ -27,7 +27,7 @@ public class EmeterEnergy /// 充电机上报时间 /// [SugarColumn(ColumnName = "upload_time")] - public virtual string UploadTime { get; set; } + public virtual DateTime UploadTime { get; set; } /// /// 上报标识:0未上传 1上传 diff --git a/Entity/Ammeter/EmeterHourEnergy.cs b/Entity/Ammeter/EmeterHourEnergy.cs index ba25130..0b4e5b0 100644 --- a/Entity/Ammeter/EmeterHourEnergy.cs +++ b/Entity/Ammeter/EmeterHourEnergy.cs @@ -15,25 +15,34 @@ namespace Entity.Ammeter { [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "id")] public long Id { get; set; } + /// /// 电表编码 /// [SugarColumn(ColumnName = "code")] public string Code { get; set; } + /// - /// 小时变化值 千瓦时 + /// 累计值 /// [SugarColumn(ColumnName = "value")] public float Value { get; set; } + /// /// 时间 /// [SugarColumn(ColumnName = "st")] - public DateTime St { get; set; } + public float Time { get; set; } + /// - /// 时间 + /// 实时值(取末端) + /// + [SugarColumn(ColumnName = "real_time_value")] + public float RealTimeValue { get; set; } + /// + /// 1:直流表 2:j交流表 /// - [SugarColumn(ColumnName = "et")] - public DateTime Et { get; set; } + [SugarColumn(ColumnName = "type")] + public int Type { get; set; } } } diff --git a/Entity/Ammeter/EmeterMinutesEnergy.cs b/Entity/Ammeter/EmeterMinutesEnergy.cs index 0d63601..6bc518a 100644 --- a/Entity/Ammeter/EmeterMinutesEnergy.cs +++ b/Entity/Ammeter/EmeterMinutesEnergy.cs @@ -16,21 +16,35 @@ namespace Entity.Ammeter { [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "id")] public long Id { get; set; } + /// /// 电表编码 /// [SugarColumn(ColumnName = "code")] public string Code { get; set; } + /// - /// 千瓦时 + /// 累计值 /// [SugarColumn(ColumnName = "value")] public float Value { get; set; } + /// /// 时间 /// - [SugarColumn(ColumnName = "time")] - public DateTime Time { get; set; } + [SugarColumn(ColumnName = "st")] + public string Time { get; set; } + + /// + /// 实时值(取末端) + /// + [SugarColumn(ColumnName = "real_time_value")] + public float RealTimeValue { get; set; } + /// + /// 1:直流表 2:j交流表 + /// + [SugarColumn(ColumnName = "type")] + public int Type { get; set; } } diff --git a/Entity/Ammeter/EmeterMinutesEnergyChange.cs b/Entity/Ammeter/EmeterMinutesEnergyChange.cs deleted file mode 100644 index 2f1ca8b..0000000 --- a/Entity/Ammeter/EmeterMinutesEnergyChange.cs +++ /dev/null @@ -1,39 +0,0 @@ -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Entity.Ammeter -{ - /// - /// 点表15分钟数据 - /// - [SugarTable("emeter_minutes_energy_change")] - public class EmeterMinutesEnergyChange - { - [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "id")] - public long Id { get; set; } - /// - /// 电表编码 - /// - [SugarColumn(ColumnName = "code")] - public string Code { get; set; } - /// - /// 小时变化值 千瓦时 - /// - [SugarColumn(ColumnName = "value")] - public float Hv { get; set; } - /// - /// 时间 - /// - [SugarColumn(ColumnName = "st")] - public DateTime St { get; set; } - /// - /// 时间 - /// - [SugarColumn(ColumnName = "et")] - public DateTime Et { get; set; } - } -} diff --git a/Repository/Ammeter/EmeterMinutesEnergyChangeRepository.cs b/Repository/Ammeter/EmeterMinutesEnergyChangeRepository.cs deleted file mode 100644 index e141d9a..0000000 --- a/Repository/Ammeter/EmeterMinutesEnergyChangeRepository.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Entity.Ammeter; -using HybirdFrameworkCore.Autofac.Attribute; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Repository.Ammeter -{ - [Scope("SingleInstance")] - public class EmeterMinutesEnergyChangeRepository : BaseRepository - { - private ISqlSugarClient DbBaseClient; - public EmeterMinutesEnergyChangeRepository(ISqlSugarClient sqlSugar) : base(sqlSugar) - { - DbBaseClient = sqlSugar; - } - } -} diff --git a/Repository/BaseRepository.cs b/Repository/BaseRepository.cs index 97f2c93..dd7bdc4 100644 --- a/Repository/BaseRepository.cs +++ b/Repository/BaseRepository.cs @@ -614,6 +614,8 @@ public abstract class BaseRepository where T : class, new() .Select(expression2) .ToListAsync(); } + + public async Task> QueryByClauseAsync(Expression> predicate, Expression> selectExpression, bool blUseNoLock = false) { return await DbBaseClient diff --git a/Service/Ammeter/EmeterMinutesEnergyChangeService.cs b/Service/Ammeter/EmeterMinutesEnergyChangeService.cs deleted file mode 100644 index c6792e9..0000000 --- a/Service/Ammeter/EmeterMinutesEnergyChangeService.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Entity.Ammeter; -using Entity.Dto.Req; -using HybirdFrameworkCore.Autofac.Attribute; -using HybirdFrameworkCore.Entity; -using Repository.Ammeter; - -namespace Service.Ammeter -{ - [Scope("SingleInstance")] - public class EmeterMinutesEnergyChangeService : BaseServices - { - EmeterMinutesEnergyChangeRepository _emeterMinutesEnergyChangeRepository; - public EmeterMinutesEnergyChangeService(EmeterMinutesEnergyChangeRepository emeterMinutesEnergyChangeRepository) - { - this.BaseDal = emeterMinutesEnergyChangeRepository; - _emeterMinutesEnergyChangeRepository = emeterMinutesEnergyChangeRepository; - } - - - public async Task> Page(PageAmmeterReq queryPageModel) - { - QueryPageModel queryPageModel1 = new QueryPageModel - { - PageNum = queryPageModel.PageNum, - PageSize = queryPageModel.PageSize, - }; - if (!string.IsNullOrEmpty(queryPageModel.Code)) - return PageResult.ConvertPage(_emeterMinutesEnergyChangeRepository.QueryIPageByCause(queryPageModel1, u => u.Code == queryPageModel.Code)); - else - return PageResult.ConvertPage(_emeterMinutesEnergyChangeRepository.QueryIPageByCause(queryPageModel1, null)); - } - } -} diff --git a/Service/Execute/Invoker.cs b/Service/Execute/Invoker.cs index 81b659e..30a04b7 100644 --- a/Service/Execute/Invoker.cs +++ b/Service/Execute/Invoker.cs @@ -1,4 +1,4 @@ -using log4net; +using log4net; namespace Service.Execute; @@ -13,6 +13,7 @@ public class Invoker int hvPwrOffTimes = 0; while (!done()) { + Log.Info($"begin {name}"); Thread.Sleep(duration); if (cancel()) { @@ -40,6 +41,7 @@ public class Invoker } } + Log.Info($" {name} done"); return InvokeStatus.Done; } @@ -51,6 +53,7 @@ public class Invoker int count = 0; while (!done()) { + Log.Info($"begin {name}"); Thread.Sleep(duration); if (cancel()) { @@ -69,6 +72,7 @@ public class Invoker } } + Log.Info($" {name} done"); return InvokeStatus.Done; } @@ -80,6 +84,7 @@ public class Invoker int count = 0; while (!done()) { + Log.Info($"begin {name}"); Thread.Sleep(duration); if (cancel()) { @@ -111,6 +116,7 @@ public class Invoker } } + Log.Info($" {name} done"); return InvokeStatus.Done; } @@ -123,6 +129,7 @@ public class Invoker int count = 0; while (!done()) { + Log.Info($"begin {name}"); Thread.Sleep(duration); if (cancel()) { @@ -159,6 +166,7 @@ public class Invoker } } + Log.Info($" {name} done"); return InvokeStatus.Done; } @@ -176,6 +184,7 @@ public class Invoker int count = 0; while (!done()) { + Log.Info($"begin {name}"); Thread.Sleep(duration); try { @@ -201,6 +210,7 @@ public class Invoker } } + Log.Info($" {name} done"); return InvokeStatus.Done; } @@ -213,6 +223,7 @@ public class Invoker int count = 0; while (!done()) { + Log.Info($"begin {name}"); Thread.Sleep(duration); try { @@ -235,6 +246,7 @@ public class Invoker } } + Log.Info($" {name} done"); return InvokeStatus.Done; } @@ -244,6 +256,7 @@ public class Invoker int hvPwrOffTimes = 0; while (!done()) { + Log.Info($"begin {name}"); Thread.Sleep(duration); if (cancel()) { @@ -261,6 +274,7 @@ public class Invoker } } + Log.Info($" {name} done"); return InvokeStatus.Done; } } diff --git a/Service/MyJob/EmeterMinuteJob.cs b/Service/MyJob/EmeterMinuteJob.cs new file mode 100644 index 0000000..21cce42 --- /dev/null +++ b/Service/MyJob/EmeterMinuteJob.cs @@ -0,0 +1,67 @@ +using Autofac; +using Entity.Ammeter; +using HybirdFrameworkCore.Autofac; +using HybirdFrameworkCore.Autofac.Attribute; +using HybirdFrameworkCore.Job; +using log4net; +using Repository.Ammeter; +using Repository.System; + +namespace Service.Job; + +/// +/// 分钟统计 +/// +[Scope] +public class EmeterMinuteJob : AbstrackCronJob +{ + private static readonly ILog Log = LogManager.GetLogger(typeof(EmeterMinuteJob)); + + + public EmeterEnergyRepository EmeterEnergyRepository { get; set; } + + public EmeterEnergyChangeRepository EmeterEnergyChangeRepository { get; set; } + + public EmeterMinutesEnergyRepository EmeterMinutesEnergyRepository { get; set; } + + + protected override Task Handle() + { + /*var now = DateTime.Now; + Log.Info($"EmeterMinuteJob execute time={now}"); + //查询上一分钟的数据 + string dateTime = now.AddMinutes(-1).ToString("yyyy-MM-dd HH:mm"); + + List emeterEnergies = EmeterEnergyRepository.QueryListByClause(i => + dateTime.Equals(i.UploadTime.ToString("yyyy-MM-dd HH:mm")), "upload_time desc"); + + List emeterEnergiesChange = EmeterEnergyChangeRepository.QueryListByClause(i => + dateTime.Equals(i.UploadTime.ToString("yyyy-MM-dd HH:mm")), "upload_time desc"); + + if (emeterEnergies.Count > 0) + { + Dictionary> dictionary = + emeterEnergies.GroupBy(i => i.Code).ToDictionary(i => i.Key, i => i.ToList()); + + foreach (var keyValuePair in dictionary) + { + EmeterMinutesEnergy emeterMinutesEnergy = new EmeterMinutesEnergy(); + emeterMinutesEnergy.Code = keyValuePair.Key; + emeterMinutesEnergy.Time = dateTime; + } + } + + if (emeterEnergiesChange.Count > 0) + { + Dictionary> dictionaryChange = + emeterEnergiesChange.GroupBy(i => i.Code).ToDictionary(i => i.Key, i => i.ToList()); + }*/ + + return Task.CompletedTask; + } + + protected override string Cron() + { + return "0 0/1 * * * ?"; + } +} \ No newline at end of file diff --git a/Service/Service.csproj b/Service/Service.csproj index 4496171..29d24e4 100644 --- a/Service/Service.csproj +++ b/Service/Service.csproj @@ -19,6 +19,8 @@ + + diff --git a/WebStarter/Controllers/Ammeter/AmmeterController.cs b/WebStarter/Controllers/Ammeter/AmmeterController.cs index ac075ae..1e9fd7c 100644 --- a/WebStarter/Controllers/Ammeter/AmmeterController.cs +++ b/WebStarter/Controllers/Ammeter/AmmeterController.cs @@ -1,12 +1,10 @@ using AutoMapper; using Entity.Ammeter; using Entity.Api.Resp; -using Entity.Dto.Req; using HybirdFrameworkCore.Entity; using Microsoft.AspNetCore.Mvc; using Service.Ammeter; using Service.Station; -using SqlSugar; namespace WebStarter.Controllers.Ammeter { @@ -20,13 +18,15 @@ namespace WebStarter.Controllers.Ammeter private EmeterDayEnergyService _emeterDayEnergyService; private EmeterHourEnergyService _emeterHourEnergyService; private EmeterMinutesEnergyService _emeterMinutesEnergyService; - private EmeterMinutesEnergyChangeService _emeterMinutesEnergyChangeService; private EquipInfoService _equipInfoService; + /// /// 直流电 /// private EmeterEnergyService _emeterEnergyService; + private EmeterEnergyChangeService _emeterEnergyChangeService; + /// /// 查询电表信息 /// @@ -35,8 +35,9 @@ namespace WebStarter.Controllers.Ammeter /// /// /// - public AmmeterController(EmeterDayEnergyService emeterDayEnergyService, EmeterHourEnergyService emeterHourEnergyService, - EmeterMinutesEnergyService emeterMinutesEnergyService, EmeterMinutesEnergyChangeService emeterMinutesEnergyChangeService, + public AmmeterController(EmeterDayEnergyService emeterDayEnergyService, + EmeterHourEnergyService emeterHourEnergyService, + EmeterMinutesEnergyService emeterMinutesEnergyService, EquipInfoService equipInfoService, EmeterEnergyService emeterEnergyService, EmeterEnergyChangeService emeterEnergyChangeService) @@ -44,12 +45,11 @@ namespace WebStarter.Controllers.Ammeter _emeterDayEnergyService = emeterDayEnergyService; _emeterHourEnergyService = emeterHourEnergyService; _emeterMinutesEnergyService = emeterMinutesEnergyService; - _emeterMinutesEnergyChangeService = emeterMinutesEnergyChangeService; _equipInfoService = equipInfoService; _emeterEnergyService = emeterEnergyService; _emeterEnergyChangeService = emeterEnergyChangeService; } - + /// /// 七天电表用量 /// @@ -61,18 +61,17 @@ namespace WebStarter.Controllers.Ammeter // 获取直流和交流表数据 List sevenDaysElectrical = await _emeterEnergyService.SevenDaysElectrical(); List emeterEnergyChanges = await _emeterEnergyChangeService.SevenDaysElectrical(); - + EmeterEnergyResp resp = new EmeterEnergyResp(); - - + + ChargeAssignment(sevenDaysElectrical, emeterEnergyChanges, resp); - - return Result.Success(resp,"成功"); + + return Result.Success(resp, "成功"); } - #region 统计分析/电能表累计值信息 - - + + /// /// 30天累计能耗 /// @@ -82,15 +81,14 @@ namespace WebStarter.Controllers.Ammeter { List emeterEnergy = await _emeterEnergyService.GetAllElectricalData(); List emeterEnergyChanges = await _emeterEnergyChangeService.GetAllElectricalData(); - + EmeterEnergyResp resp = new EmeterEnergyResp(); ChargeAssignment(emeterEnergy, emeterEnergyChanges, resp); - return Result.Success(resp,"成功"); + return Result.Success(resp, "成功"); } - /// /// 最近一天电表数据 @@ -101,16 +99,17 @@ namespace WebStarter.Controllers.Ammeter { // 获取最近一天直流和交流表数据 List daysElectrical = await _emeterEnergyService.GetTodayHourlyElectricalData(); - List daysElectricalChange = await _emeterEnergyChangeService.GetTodayHourlyElectricalData(); - + List daysElectricalChange = + await _emeterEnergyChangeService.GetTodayHourlyElectricalData(); + EmeterEnergyResp resp = new EmeterEnergyResp(); ChargeAssignment(daysElectrical, daysElectricalChange, resp); - - return Result.Success(resp,"成功"); + + return Result.Success(resp, "成功"); } - + /// /// 直流电能表小时统计 /// @@ -119,10 +118,10 @@ namespace WebStarter.Controllers.Ammeter public async Task>> GetTodayHourlyElectricalData() { // 直流表数据 - return Result>.Success(await _emeterEnergyService.GetTodayHourlyElectricalData(),"成功"); + return Result>.Success(await _emeterEnergyService.GetTodayHourlyElectricalData(), "成功"); } - - + + /// /// 交流电能表小时统计 /// @@ -131,9 +130,10 @@ namespace WebStarter.Controllers.Ammeter public async Task>> GetTodayHourlyElectricalChangeData() { // 交流表数据 - return Result>.Success(await _emeterEnergyChangeService.GetTodayHourlyElectricalData(),"成功"); + return Result>.Success( + await _emeterEnergyChangeService.GetTodayHourlyElectricalData(), "成功"); } - + /// /// 最近一小时电表数据 /// @@ -143,16 +143,17 @@ namespace WebStarter.Controllers.Ammeter { // 获取最近一个小时直流和交流表数据 List minutesElectrical = await _emeterEnergyService.GetTodayMinutelyElectricalData(); - List minutesElectricalChange = await _emeterEnergyChangeService.GetTodayMinutelyElectricalData(); - + List minutesElectricalChange = + await _emeterEnergyChangeService.GetTodayMinutelyElectricalData(); + EmeterEnergyResp resp = new EmeterEnergyResp(); ChargeAssignment(minutesElectrical, minutesElectricalChange, resp); - - return Result.Success(resp,"成功"); + + return Result.Success(resp, "成功"); } - + /// /// 获取直流交流电表实时数据 /// @@ -165,23 +166,25 @@ namespace WebStarter.Controllers.Ammeter { parsedEndTime = DateTime.Now; } - + endTime = parsedEndTime.ToString("yyyy-MM-dd HH:mm:ss"); - + // 获取实时直流和交流表数据 List minutesElectrical = await _emeterEnergyService.GetEnergyMeterRealTime(endTime); - List minutesElectricalChange = await _emeterEnergyChangeService.GetEnergyMeterRealTime(endTime); - + List minutesElectricalChange = + await _emeterEnergyChangeService.GetEnergyMeterRealTime(endTime); + EmeterEnergyResp resp = new EmeterEnergyResp(); ChargeAssignment(minutesElectrical, minutesElectricalChange, resp); - - return Result.Success(resp,"成功"); + + return Result.Success(resp, "成功"); } - - - private static void ChargeAssignment(List emeterEnergy, List emeterEnergyChanges, EmeterEnergyResp resp) + + + private static void ChargeAssignment(List emeterEnergy, + List emeterEnergyChanges, EmeterEnergyResp resp) { var config = new MapperConfiguration(cfg => { @@ -197,193 +200,9 @@ namespace WebStarter.Controllers.Ammeter List EnergyChangeList = mapper.Map>(emeterEnergyChanges); // 类型赋值交流 EnergyChangeList?.ForEach(emeterResp => emeterResp.Type = 1); - - resp.emeterEnergy = EnergyList.OrderBy(i=>i.Code).ToList(); - resp.emeterEnergyChange = EnergyChangeList.OrderBy(i=>i.Code).ToList(); - } - - /// - /// 统计分析/电能表累计值信息 - /// - [HttpGet("TEgEmeterTotalEnergyValue/{Code}")] - public async Task>> GetNewEmeterMinutesEnergy(string Code) - { - var query = @" - SELECT t1.* - FROM - ( - SELECT code, MAX(time) AS latest_time - FROM emeter_minutes_energy - WHERE code = @Code - GROUP BY code - ) AS latest_records - JOIN emeter_minutes_energy t1 - ON latest_records.code = t1.code - AND latest_records.latest_time = t1.time;"; - - var parameters = new List - { - new SugarParameter("@Code", Code) - }; - var result = await Task.Run(() => _emeterMinutesEnergyService.SqlQuery(query, parameters)); - - return Result>.Success(result); - } - - /// - /// 删除电能表累计值信息 - /// - [HttpGet("delete/TEgEmeterTotalEnergyValue/{id}")] - public Result DeleteOneEmeterMinutesEnergy(long id) - { - return Result.Success(_emeterMinutesEnergyService.DeleteById(id)); - } - /// - /// 删除电能表累计值信息 - /// - [HttpPost("TEgEmeterTotalEnergyValue/BatchDelete")] - public Result DeleteMoreEmeterMinutesEnergy(int[] ids) - { - return Result.Success(_emeterMinutesEnergyService.DeleteByIds(ids)); - } - - #endregion - #region 统计分析/电能表变化值信息 - - /// - /// 统计分析/电能表变化值信息 - /// - [HttpPost("TEgEmeterRealEnergyValue")] - public async Task>> GetEmeterMinutesEnergyChange([FromBody] PageAmmeterReq queryPageModel) - { - return Result>.Success(await _emeterMinutesEnergyChangeService.Page(queryPageModel)); + resp.emeterEnergy = EnergyList.OrderBy(i => i.Code).ToList(); + resp.emeterEnergyChange = EnergyChangeList.OrderBy(i => i.Code).ToList(); } - - /// - /// 删除电能表变化值信息 - /// - [HttpGet("TEgEmeterRealEnergyValue/{id}")] - public Result DeleteEmeterMinutesEnergyChange(long id) - { - return Result.Success(_emeterMinutesEnergyChangeService.DeleteById(id)); - } - /// - /// 批量删除电能表变化值信息 - /// - [HttpPost("TEgEmeterRealEnergyValue/BatchDelete")] - public Result DeleteEmeterMinutesEnergyChange(int[] ids) - { - return Result.Success(_emeterMinutesEnergyChangeService.DeleteByIds(ids)); - } - - #endregion - - #region 统计分析/电能表小时能耗值 - /// - /// 统计分析/电能表小时能耗值 - /// - [HttpPost("TEgEmeterHourEnergyValue")] - public async Task>> GetEmeterHourEnergy([FromBody] PageAmmeterReq queryPageModel) - { - return await _emeterHourEnergyService.Page(queryPageModel); - } - - /// - /// 删除电能表小时能耗值 - /// - [HttpGet("TEgEmeterHourEnergyValue/{id}")] - public Result DeleteEmeterHourEnergy(long id) - { - return Result.Success(_emeterHourEnergyService.DeleteById(id)); - } - /// - /// 批量删除电能表小时能耗值 - /// - [HttpPost("TEgEmeterHourEnergyValue/BatchDelete")] - public Result DeleteListEmeterHourEnergy(int[] ids) - { - return Result.Success(_emeterHourEnergyService.DeleteByIds(ids)); - } - #endregion - - #region 统计分析/电能表每天能耗值 - /// - /// 统计分析/电能表每天能耗值 - /// - [HttpPost("TEgEmeterDayEnergyValue")] - public async Task>> GetEmeterDayEnergy([FromBody] PageAmmeterReq queryPageModel) - { - return Result>.Success(await _emeterDayEnergyService.Page(queryPageModel)); - } - - /// - /// 删除电能表每天能耗值 - /// - [HttpGet("TEgEmeterDayEnergyValue/{id}")] - public Result DeleteEmeterDayEnergy(long id) - { - return Result.Success(_emeterDayEnergyService.DeleteById(id)); - } - /// - /// 批量删除电能表每天能耗值 - /// - [HttpPost("TEgEmeterDayEnergyValue/BatchDelete")] - public Result DeleteListEmeterDayEnergy(int[] ids) - { - return Result.Success(_emeterDayEnergyService.DeleteByIds(ids)); - } - #endregion - - #region 统计分析/换电站分时用电统计信息 - //TODO:: - //小时计算总能耗值,小时计算充电能耗值,小时计算换电能耗值,小时计算其他能耗值,开始时间,结束时间 - - #endregion - - #region 统计分析/换电站每天用电统计信息 - //TODO:: - //每天计算总能耗值,每天计算充电能耗值,每天计算换电能耗值,每天计算其他能耗值,开始时间,结束时间 - - #endregion - - #region 电能监控/交流电能监控 - - /// - /// 电能监控/交流电能监控 - /// - [HttpGet("ElecMeterParam/GetElecMeterParamValue")] - public Result> GetElecMeterParamValue() - { - var EquipInfo = _equipInfoService.QueryListByClause(i => i.TypeCode == 0); - List strings = new List(); - foreach (var kvp in EquipInfo) - { - strings.Add(kvp.Code); - } - //TODO::过滤,确保编码相同只出现一次 - return Result>.Success(_emeterMinutesEnergyService.QueryListByClause(i => strings.Contains(i.Code)).ToList()); - } - - #endregion - - #region 电能监控/直流电能监控 - /// - /// 电能监控/直流电能监控 - /// - [HttpGet("ManualSwap/GetDcCurrentInfo")] - public Result> GetDcCurrentInfo() - { - var EquipInfo = _equipInfoService.QueryListByClause(i => i.TypeCode == 1); - List strings = new List(); - foreach (var kvp in EquipInfo) - { - strings.Add(kvp.Code); - } - //TODO::过滤,确保编码相同只出现一次 - return Result>.Success(_emeterMinutesEnergyService.QueryListByClause(i => strings.Contains(i.Code)).ToList()); - } - #endregion - } -} +} \ No newline at end of file