From 51362eaa0c01b885dbd8fe5a14cb910f5275ddb1 Mon Sep 17 00:00:00 2001
From: lch <1627445470@qq.com>
Date: Thu, 30 May 2024 11:28:50 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=94=B5=E4=BB=B7=E6=A8=A1?=
=?UTF-8?q?=E5=9E=8BVersion=E6=9F=A5=E8=AF=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Entity/Api/Resp/BaseSetStationConfigInfo.cs | 4 +++
.../Station/ElecPriceModelVersionService.cs | 25 +++++++++++++++++++
.../BasicConfig/BaseConfigController.cs | 6 +++++
3 files changed, 35 insertions(+)
create mode 100644 Service/Station/ElecPriceModelVersionService.cs
diff --git a/Entity/Api/Resp/BaseSetStationConfigInfo.cs b/Entity/Api/Resp/BaseSetStationConfigInfo.cs
index 2c8c7e4..971da49 100644
--- a/Entity/Api/Resp/BaseSetStationConfigInfo.cs
+++ b/Entity/Api/Resp/BaseSetStationConfigInfo.cs
@@ -34,4 +34,8 @@ public class BaseSetStationConfigInfo
/// 换电运营模式:1-自动 2-手动
///
public int SwapType{ get; set; }
+ ///
+ /// 电价模型板 版本号
+ ///
+ public int Version{ get; set; }
}
\ No newline at end of file
diff --git a/Service/Station/ElecPriceModelVersionService.cs b/Service/Station/ElecPriceModelVersionService.cs
new file mode 100644
index 0000000..ae6e261
--- /dev/null
+++ b/Service/Station/ElecPriceModelVersionService.cs
@@ -0,0 +1,25 @@
+using Entity.DbModel.Station;
+using HybirdFrameworkCore.Autofac.Attribute;
+using Repository.Station;
+namespace Service.Station;
+
+[Scope("SingleInstance")]
+public class ElecPriceModelVersionService : BaseServices
+{
+ ElecPriceModelVersionRepository _elecPriceModelVersionRepository;
+ public ElecPriceModelVersionService(ElecPriceModelVersionRepository dal)
+ {
+ _elecPriceModelVersionRepository = dal;
+ BaseDal = dal;
+ }
+
+ ///
+ /// 返回当前版本号
+ ///
+ ///
+ public async Task GetNowVersion()
+ {
+ ElecPriceModelVersion elecPriceModelVersion =await _elecPriceModelVersionRepository.QueryByClauseAsync(u => u.EndTime > DateTime.Now);
+ return elecPriceModelVersion.Version;
+ }
+}
\ No newline at end of file
diff --git a/WebStarter/Controllers/BasicConfig/BaseConfigController.cs b/WebStarter/Controllers/BasicConfig/BaseConfigController.cs
index b61af8d..801db85 100644
--- a/WebStarter/Controllers/BasicConfig/BaseConfigController.cs
+++ b/WebStarter/Controllers/BasicConfig/BaseConfigController.cs
@@ -24,6 +24,7 @@ namespace WebStarter.Controllers.BasicConfig
{
private readonly SysConfigService _sysConfigService;
private readonly ElecPriceModelVersionDetailServices _elecPriceModelVersionDetailServices;
+ private readonly ElecPriceModelVersionService _elecPriceModelVersionService;
public BaseConfigController(SysConfigService sysConfigService, ElecPriceModelVersionDetailServices elecPriceModelVersionDetailServices)
{
_sysConfigService = sysConfigService;
@@ -145,9 +146,13 @@ namespace WebStarter.Controllers.BasicConfig
case "BusinessEndHours": stationBaseInfoResp.BusinessEndHours = item.Value; break;
}
}
+ stationBaseInfoResp.Version=await _elecPriceModelVersionService.GetNowVersion();
return Result.Success(stationBaseInfoResp);
}
+
+
+
///
/// 提交换电策略设置
///
@@ -273,6 +278,7 @@ namespace WebStarter.Controllers.BasicConfig
///
///
///
+ [ApiExplorerSettings(IgnoreApi = true)]
public bool TimeListIfContains(List timePeriods)
{
bool hasOverlap = false;