From 40fa536ac247b151655fe72128d6eecf0c10a56b Mon Sep 17 00:00:00 2001
From: lch <1627445470@qq.com>
Date: Thu, 30 May 2024 16:16:36 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=9F=A5=E8=AF=A2=E7=94=B5?=
=?UTF-8?q?=E4=BB=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Api/Req/ElecPriceModelVersionDetailReq.cs | 20 ++++++++++++++++
Entity/Api/Resp/BaseSetStationConfigInfo.cs | 2 +-
.../Resp/ElecPriceModelVersionDetailResp.cs | 24 +++++++++++++++++++
.../Station/ElecPriceModelVersionService.cs | 5 +++-
4 files changed, 49 insertions(+), 2 deletions(-)
create mode 100644 Entity/Api/Req/ElecPriceModelVersionDetailReq.cs
create mode 100644 Entity/Api/Resp/ElecPriceModelVersionDetailResp.cs
diff --git a/Entity/Api/Req/ElecPriceModelVersionDetailReq.cs b/Entity/Api/Req/ElecPriceModelVersionDetailReq.cs
new file mode 100644
index 0000000..cb1a620
--- /dev/null
+++ b/Entity/Api/Req/ElecPriceModelVersionDetailReq.cs
@@ -0,0 +1,20 @@
+namespace Entity.Api.Req;
+
+public partial class ElecPriceModelVersionDetailReq
+{
+ public DateTime StartTime { get; set; }
+ public DateTime EndTime { get; set; }
+ ///
+ /// 版本
+ ///
+ public int Version {get;set;}
+ ///
+ /// 价格
+ ///
+ public int? Price {get;set;}
+ ///
+ /// Desc:尖峰平谷类型;1-尖;2-峰;3-平;4-谷
+ ///
+ public int? Type {get;set;}
+
+ }
\ No newline at end of file
diff --git a/Entity/Api/Resp/BaseSetStationConfigInfo.cs b/Entity/Api/Resp/BaseSetStationConfigInfo.cs
index 971da49..6cbb07c 100644
--- a/Entity/Api/Resp/BaseSetStationConfigInfo.cs
+++ b/Entity/Api/Resp/BaseSetStationConfigInfo.cs
@@ -35,7 +35,7 @@ public class BaseSetStationConfigInfo
///
public int SwapType{ get; set; }
///
- /// 电价模型板 版本号
+ /// 电价模型板 版本号 0-数据库不存在 尖峰平谷版本
///
public int Version{ get; set; }
}
\ No newline at end of file
diff --git a/Entity/Api/Resp/ElecPriceModelVersionDetailResp.cs b/Entity/Api/Resp/ElecPriceModelVersionDetailResp.cs
new file mode 100644
index 0000000..07131c4
--- /dev/null
+++ b/Entity/Api/Resp/ElecPriceModelVersionDetailResp.cs
@@ -0,0 +1,24 @@
+namespace Entity.Api.Resp;
+
+///
+/// 电价模型详情
+///
+public class ElecPriceModelVersionDetailResp
+{
+ public int Version { get; set; }
+ public TimeSpan StartTime { get; set; }
+ public TimeSpan EndTime { get; set; }
+ ///
+ /// Desc:价格;以分为单位存储
+ /// Default:
+ /// Nullable:True
+ ///
+ public int? Price {get;set;}
+
+ ///
+ /// Desc:尖峰平谷类型;1-尖;2-峰;3-平;4-谷
+ /// Default:
+ /// Nullable:True
+ ///
+ public int? Type {get;set;}
+}
\ No newline at end of file
diff --git a/Service/Station/ElecPriceModelVersionService.cs b/Service/Station/ElecPriceModelVersionService.cs
index ae6e261..e70ba8e 100644
--- a/Service/Station/ElecPriceModelVersionService.cs
+++ b/Service/Station/ElecPriceModelVersionService.cs
@@ -20,6 +20,9 @@ public class ElecPriceModelVersionService : BaseServices
public async Task GetNowVersion()
{
ElecPriceModelVersion elecPriceModelVersion =await _elecPriceModelVersionRepository.QueryByClauseAsync(u => u.EndTime > DateTime.Now);
- return elecPriceModelVersion.Version;
+ if (elecPriceModelVersion != null)
+ return elecPriceModelVersion.Version;
+ else
+ return 0;
}
}
\ No newline at end of file