From 78c79e4b589bcbdbc652f77cc85e6584d36a0420 Mon Sep 17 00:00:00 2001
From: tq <1916474859@qq,com>
Date: Tue, 24 Sep 2024 17:29:45 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E6=8D=A2=E7=94=B5=E8=AE=A2=E5=8D=95?=
=?UTF-8?q?=E8=AE=A1=E7=AE=97=E8=B4=B9=E7=94=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Entity/Api/Resp/SwapOrderResp.cs | 5 +
Entity/DbModel/Station/BinInfo.cs | 6 +
Entity/DbModel/Station/SwapOrder.cs | 6 +
Entity/DbModel/Station/SwapOrderBattery.cs | 19 +++-
Entity/Dto/SwapOrderDto.cs | 5 +
Service/Execute/Mgr/CommonMgr.cs | 1 +
.../MyTask/SwapOrderSettleAnAccountTask.cs | 107 ++++++++++++++++++
Service/MyTask/UpdateDownBatteryInfoTask.cs | 3 +-
.../db/换电订单新增计费字段.sql | 17 ++-
9 files changed, 160 insertions(+), 9 deletions(-)
create mode 100644 Service/MyTask/SwapOrderSettleAnAccountTask.cs
diff --git a/Entity/Api/Resp/SwapOrderResp.cs b/Entity/Api/Resp/SwapOrderResp.cs
index b36617f..5c9f521 100644
--- a/Entity/Api/Resp/SwapOrderResp.cs
+++ b/Entity/Api/Resp/SwapOrderResp.cs
@@ -159,6 +159,11 @@ namespace Entity.Api.Resp
///
public string? Departments {get;set;}
+ ///
+ /// 换电服务费用
+ ///
+ public int? ServiceTotalFee { get; set; }
+
///
/// 电费
///
diff --git a/Entity/DbModel/Station/BinInfo.cs b/Entity/DbModel/Station/BinInfo.cs
index a57d71c..285b213 100644
--- a/Entity/DbModel/Station/BinInfo.cs
+++ b/Entity/DbModel/Station/BinInfo.cs
@@ -199,5 +199,11 @@ namespace Entity.DbModel.Station
///
[SugarColumn(ColumnName = "in_time")]
public DateTime? InTime { get; set; }
+
+ ///
+ /// 电池标称能量
+ ///
+ [SugarColumn(ColumnName = "nominal_energy")]
+ public decimal? NominalEnergy { get; set; }
}
}
\ No newline at end of file
diff --git a/Entity/DbModel/Station/SwapOrder.cs b/Entity/DbModel/Station/SwapOrder.cs
index 64f7cf5..89881f9 100644
--- a/Entity/DbModel/Station/SwapOrder.cs
+++ b/Entity/DbModel/Station/SwapOrder.cs
@@ -125,6 +125,12 @@ namespace Entity.DbModel.Station
[SugarColumn(ColumnName = "swap_way")]
public int? SwapWay { get; set; }
+ ///
+ /// 换电服务费用(单位分)
+ ///
+ [SugarColumn(ColumnName = "service_total_fee")]
+ public int? ServiceTotalFee { get; set; }
+
///
/// 电费(单位分)
///
diff --git a/Entity/DbModel/Station/SwapOrderBattery.cs b/Entity/DbModel/Station/SwapOrderBattery.cs
index e3d824a..8ab984e 100644
--- a/Entity/DbModel/Station/SwapOrderBattery.cs
+++ b/Entity/DbModel/Station/SwapOrderBattery.cs
@@ -205,10 +205,21 @@ namespace Entity.DbModel.Station
public int? UpBatteryBinNo { get; set; }
///
- /// 标称能量
+ /// 放电池标称能量
///
- ///
- [SugarColumn(ColumnName = "nominal_energy")]
- public float? NominalEnergy { get; set; }
+ [SugarColumn(ColumnName = "down_nominal_energy")]
+ public decimal? DownNominalEnergy { get; set; }
+
+ ///
+ /// 取电池标称能量
+ ///
+ [SugarColumn(ColumnName = "up_nominal_energy")]
+ public decimal? UpNominalEnergy { get; set; }
+
+ ///
+ /// 是否算费;0未结算,1已结算
+ ///
+ [SugarColumn(ColumnName = "settle_an_account_flag")]
+ public int? SettleAnAccountFlag { get; set; }
}
}
diff --git a/Entity/Dto/SwapOrderDto.cs b/Entity/Dto/SwapOrderDto.cs
index c051ca0..5e7fd24 100644
--- a/Entity/Dto/SwapOrderDto.cs
+++ b/Entity/Dto/SwapOrderDto.cs
@@ -220,6 +220,11 @@ public class SwapOrderDto
public string Sn { get; set; }
+ ///
+ /// 换电服务费用
+ ///
+ [ExporterHeader(DisplayName = "换电服务费用", IsBold = true)]
+ public int? ServiceTotalFee { get; set; }
///
/// 电费
diff --git a/Service/Execute/Mgr/CommonMgr.cs b/Service/Execute/Mgr/CommonMgr.cs
index fe8cfd4..a3ce5ab 100644
--- a/Service/Execute/Mgr/CommonMgr.cs
+++ b/Service/Execute/Mgr/CommonMgr.cs
@@ -89,6 +89,7 @@ public class CommonMgr
UpBatteryNo = upBin.BatteryNo,
UpBatterySoe = upBin.Soe,
UpBatteryBinNo = int.Parse(upBin.No),
+ UpNominalEnergy = upBin.NominalEnergy,
DownBatteryBinNo = int.Parse(inBin.No),
DownBatteryNo = inBin.BatteryNo,
DownBatterySoc = inBin.Soc,
diff --git a/Service/MyTask/SwapOrderSettleAnAccountTask.cs b/Service/MyTask/SwapOrderSettleAnAccountTask.cs
new file mode 100644
index 0000000..1967f3a
--- /dev/null
+++ b/Service/MyTask/SwapOrderSettleAnAccountTask.cs
@@ -0,0 +1,107 @@
+using Entity.DbModel.Station;
+using HybirdFrameworkCore.Autofac.Attribute;
+using HybirdFrameworkCore.AutoTask;
+using log4net;
+using Repository.Station;
+using Service.Init;
+
+namespace Service.MyTask;
+
+///
+/// 换电订单算费用
+///
+[Scope]
+public class SwapOrderSettleAnAccountTask : ITask
+{
+ private static readonly ILog Log = LogManager.GetLogger(typeof(SwapOrderSettleAnAccountTask));
+
+ private volatile bool _stop;
+
+
+ private SwapOrderBatteryRepository SwapOrderBatteryRepository { get; set; }
+
+ private SwapOrderRepository SwapOrderRepository { get; set; }
+
+
+ public SwapOrderSettleAnAccountTask(SwapOrderBatteryRepository swapOrderBatteryRepository,
+ SwapOrderRepository swapOrderRepository)
+ {
+ SwapOrderBatteryRepository = swapOrderBatteryRepository;
+ SwapOrderRepository = swapOrderRepository;
+ }
+
+
+ public string Name()
+ {
+ return "SwapOrderSettleAnAccountTask";
+ }
+
+ public int Interval()
+ {
+ return 1000 * 2;
+ }
+
+ public void Handle()
+ {
+ Log.Info("Begin SwapOrderSettleAnAccountTask");
+
+ List listSwapOrderBattery = SwapOrderBatteryRepository.QueryListByClause(i =>
+ i.DownNominalEnergy != null && i.UpNominalEnergy != null && i.SettleAnAccountFlag == 0);
+
+ if (listSwapOrderBattery.Count > 0)
+ {
+ List list = listSwapOrderBattery.Select(resp => resp.SwapOrderSn).ToList();
+
+ List swapOrderList = SwapOrderRepository
+ .Queryable()
+ .In(swapOrder => swapOrder.Sn, list)
+ .ToList();
+ // 电费单价
+ int electricityTotalFee = StaticStationInfo.ElectricityTotalFee;
+ // 换电服务费用
+ int serviceTotalFee = StaticStationInfo.ServiceTotalFee;
+ // 附加费用
+ int appendTotalFee = StaticStationInfo.AppendTotalFee;
+ foreach (var swapOrderBattery in listSwapOrderBattery)
+ {
+ // 换上的满电包soc*满电包的电池标量
+ decimal? upNominalEnergy = swapOrderBattery.UpBatterySoc * swapOrderBattery.UpNominalEnergy;
+ // 换下的亏电包soc*亏电包的电池标量
+ decimal? downNominalEnergy = swapOrderBattery.DownBatterySoc * swapOrderBattery.DownNominalEnergy;
+
+ // 电量费用
+ decimal? electricCharge = (upNominalEnergy - downNominalEnergy) * electricityTotalFee;
+
+ var matchingOrder = swapOrderList.FirstOrDefault(order => order.Sn == swapOrderBattery.SwapOrderSn);
+ if (matchingOrder != null)
+ {
+ matchingOrder.ServiceTotalFee = serviceTotalFee;
+ matchingOrder.ElectricityTotalFee = (int?)electricCharge;
+ matchingOrder.AppendTotalFee = appendTotalFee;
+ matchingOrder.TotalFee = matchingOrder.ServiceTotalFee + matchingOrder.ElectricityTotalFee +
+ matchingOrder.AppendTotalFee;
+ // 标记换电订单已经算了订单价钱
+ swapOrderBattery.SettleAnAccountFlag = 1;
+ }
+ }
+
+ SwapOrderRepository.Update(swapOrderList);
+ SwapOrderBatteryRepository.Update(listSwapOrderBattery);
+ }
+ }
+
+ public bool Stoped()
+ {
+ return _stop;
+ }
+
+ public void Stop()
+ {
+ _stop = true;
+ }
+
+ public void ResetStop()
+ {
+ _stop = false;
+ }
+}
\ No newline at end of file
diff --git a/Service/MyTask/UpdateDownBatteryInfoTask.cs b/Service/MyTask/UpdateDownBatteryInfoTask.cs
index fee7d83..0ab5d58 100644
--- a/Service/MyTask/UpdateDownBatteryInfoTask.cs
+++ b/Service/MyTask/UpdateDownBatteryInfoTask.cs
@@ -17,7 +17,7 @@ public class UpdateDownBatteryInfoTask : ITask
private static readonly ILog Log = LogManager.GetLogger(typeof(UpdateDownBatteryInfoTask));
private volatile bool _stop;
-
+
public SwapOrderBatteryRepository _swapOrderBatteryRepository { get; set; }
@@ -55,6 +55,7 @@ public class UpdateDownBatteryInfoTask : ITask
_swapOrderBatteryRepository.Update(i => new SwapOrderBattery()
{
DownBatterySoc = lstBinInfo.Soc,
+ DownNominalEnergy = lstBinInfo.NominalEnergy,
DownBatteryNo = lstBinInfo.BatteryNo
},
i => i.SwapOrderSn.ToString() == UpSwapOrderBattery.SwapOrderSn
diff --git a/WebStarter/db/换电订单新增计费字段.sql b/WebStarter/db/换电订单新增计费字段.sql
index 10030e2..553b933 100644
--- a/WebStarter/db/换电订单新增计费字段.sql
+++ b/WebStarter/db/换电订单新增计费字段.sql
@@ -10,11 +10,20 @@ ADD COLUMN step_desc varchar(255) COMMENT '描述',
ADD COLUMN param text COMMENT '参数';
+INSERT INTO `sys_config` VALUES (1300000000180, 'Station.ServiceTotalFee', 'ServiceTotalFee', '10000', 2, 'Station', 100, NULL, NULL, NULL, NULL, NULL, NULL, NULL, b'0');
+INSERT INTO `sys_config` VALUES (1300000000181, 'Station.ElectricityTotalFee', 'ElectricityTotalFee', '100000', 2, 'Station', 100, NULL, NULL, NULL, NULL, NULL, NULL, NULL, b'0');
+INSERT INTO `sys_config` VALUES (1300000000182, 'Station.AppendTotalFee', 'AppendTotalFee', '10000', 2, 'Station', 100, NULL, NULL, NULL, NULL, NULL, NULL, NULL, b'0');
+
+
+ALTER TABLE swap_order_battery
+ DROP COLUMN nominal_energy;
ALTER TABLE swap_order_battery
- ADD COLUMN nominal_energy DECIMAL(24, 2) COMMENT '电池标称能量';
+ ADD COLUMN down_nominal_energy DECIMAL(24,2) COMMENT '放电池标称能量',
+ ADD COLUMN up_nominal_energy DECIMAL(24,2) COMMENT '取电池标称能量';
+ALTER TABLE bin_info
+ ADD COLUMN nominal_energy DECIMAL(24,2) COMMENT '电池标称能量';
-INSERT INTO `sys_config` VALUES (1300000000180, 'Station.ServiceTotalFee', 'ServiceTotalFee', '10000', 2, 'Station', 100, NULL, NULL, NULL, NULL, NULL, NULL, NULL, b'0');
-INSERT INTO `sys_config` VALUES (1300000000181, 'Station.ElectricityTotalFee', 'ElectricityTotalFee', '100000', 2, 'Station', 100, NULL, NULL, NULL, NULL, NULL, NULL, NULL, b'0');
-INSERT INTO `sys_config` VALUES (1300000000182, 'Station.AppendTotalFee', 'AppendTotalFee', '10000', 2, 'Station', 100, NULL, NULL, NULL, NULL, NULL, NULL, NULL, b'0');
\ No newline at end of file
+ALTER TABLE swap_order
+ ADD COLUMN service_total_fee INT COMMENT '换电服务费';
\ No newline at end of file
From 8faf0edb729d2123ad0cfde2f4bfb4e2b9f01cf9 Mon Sep 17 00:00:00 2001
From: tq <1916474859@qq,com>
Date: Tue, 24 Sep 2024 17:53:49 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E8=AE=A1=E8=B4=B9=E5=AD=97=E6=AE=B5?=
=?UTF-8?q?=E6=94=B9=E6=88=90decimal=E7=B1=BB=E5=9E=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Entity/Api/Req/AddSwapOrderReq.cs | 6 +++---
Entity/Api/Req/ModifySwapOrderReq.cs | 6 +++---
Entity/Api/Resp/StationConfigResp.cs | 6 +++---
Entity/Api/Resp/SwapOrderResp.cs | 8 ++++----
Entity/DbModel/Station/SwapOrder.cs | 8 ++++----
Entity/Dto/SwapOrderDto.cs | 8 ++++----
Entity/Dto/SwapOrderDto2.cs | 6 +++---
Service/Init/StaticStationInfo.cs | 12 +++++------
.../MyTask/SwapOrderSettleAnAccountTask.cs | 8 ++++----
WebStarter/Controllers/SwapOrderController.cs | 20 +++++++++++++++++++
10 files changed, 54 insertions(+), 34 deletions(-)
diff --git a/Entity/Api/Req/AddSwapOrderReq.cs b/Entity/Api/Req/AddSwapOrderReq.cs
index 1099440..b61e089 100644
--- a/Entity/Api/Req/AddSwapOrderReq.cs
+++ b/Entity/Api/Req/AddSwapOrderReq.cs
@@ -131,16 +131,16 @@
///
/// 电费
///
- public int? ElectricityTotalFee { get; set; }
+ public decimal? ElectricityTotalFee { get; set; }
///
/// 附加费
///
- public int? AppendTotalFee { get; set; }
+ public decimal? AppendTotalFee { get; set; }
///
/// 总费用(所有的总费用)
///
- public int? TotalFee { get; set; }
+ public decimal? TotalFee { get; set; }
}
}
diff --git a/Entity/Api/Req/ModifySwapOrderReq.cs b/Entity/Api/Req/ModifySwapOrderReq.cs
index 5df1928..82ad469 100644
--- a/Entity/Api/Req/ModifySwapOrderReq.cs
+++ b/Entity/Api/Req/ModifySwapOrderReq.cs
@@ -139,16 +139,16 @@ namespace Entity.Api.Req
///
/// 电费
///
- public int? ElectricityTotalFee { get; set; }
+ public decimal? ElectricityTotalFee { get; set; }
///
/// 附加费
///
- public int? AppendTotalFee { get; set; }
+ public decimal? AppendTotalFee { get; set; }
///
/// 总费用(所有的总费用)
///
- public int? TotalFee { get; set; }
+ public decimal? TotalFee { get; set; }
}
}
diff --git a/Entity/Api/Resp/StationConfigResp.cs b/Entity/Api/Resp/StationConfigResp.cs
index c0036f8..0235baf 100644
--- a/Entity/Api/Resp/StationConfigResp.cs
+++ b/Entity/Api/Resp/StationConfigResp.cs
@@ -54,15 +54,15 @@ public class StationConfigResp
///
/// 服务费
///
- public int? ServiceTotalFee { get; set; }
+ public decimal? ServiceTotalFee { get; set; }
///
/// 电费
///
- public int? ElectricityTotalFee { get; set; }
+ public decimal? ElectricityTotalFee { get; set; }
///
/// 附加费
///
- public int? AppendTotalFee { get; set; }
+ public decimal? AppendTotalFee { get; set; }
}
\ No newline at end of file
diff --git a/Entity/Api/Resp/SwapOrderResp.cs b/Entity/Api/Resp/SwapOrderResp.cs
index 5c9f521..ef22071 100644
--- a/Entity/Api/Resp/SwapOrderResp.cs
+++ b/Entity/Api/Resp/SwapOrderResp.cs
@@ -162,22 +162,22 @@ namespace Entity.Api.Resp
///
/// 换电服务费用
///
- public int? ServiceTotalFee { get; set; }
+ public decimal? ServiceTotalFee { get; set; }
///
/// 电费
///
- public int? ElectricityTotalFee { get; set; }
+ public decimal? ElectricityTotalFee { get; set; }
///
/// 附加费
///
- public int? AppendTotalFee { get; set; }
+ public decimal? AppendTotalFee { get; set; }
///
/// 总费用(所有的总费用)
///
- public int? TotalFee { get; set; }
+ public decimal? TotalFee { get; set; }
///
/// 手动操作
diff --git a/Entity/DbModel/Station/SwapOrder.cs b/Entity/DbModel/Station/SwapOrder.cs
index 89881f9..e441260 100644
--- a/Entity/DbModel/Station/SwapOrder.cs
+++ b/Entity/DbModel/Station/SwapOrder.cs
@@ -129,25 +129,25 @@ namespace Entity.DbModel.Station
/// 换电服务费用(单位分)
///
[SugarColumn(ColumnName = "service_total_fee")]
- public int? ServiceTotalFee { get; set; }
+ public decimal? ServiceTotalFee { get; set; }
///
/// 电费(单位分)
///
[SugarColumn(ColumnName = "electricity_total_fee")]
- public int? ElectricityTotalFee { get; set; }
+ public decimal? ElectricityTotalFee { get; set; }
///
/// 附加费(单位分)
///
[SugarColumn(ColumnName = "append_total_fee")]
- public int? AppendTotalFee { get; set; }
+ public decimal? AppendTotalFee { get; set; }
///
/// 总费用(所有的总费用-单位分)
///
[SugarColumn(ColumnName = "total_fee")]
- public int? TotalFee { get; set; }
+ public decimal? TotalFee { get; set; }
}
}
\ No newline at end of file
diff --git a/Entity/Dto/SwapOrderDto.cs b/Entity/Dto/SwapOrderDto.cs
index 5e7fd24..12b7a3e 100644
--- a/Entity/Dto/SwapOrderDto.cs
+++ b/Entity/Dto/SwapOrderDto.cs
@@ -224,23 +224,23 @@ public class SwapOrderDto
/// 换电服务费用
///
[ExporterHeader(DisplayName = "换电服务费用", IsBold = true)]
- public int? ServiceTotalFee { get; set; }
+ public decimal? ServiceTotalFee { get; set; }
///
/// 电费
///
[ExporterHeader(DisplayName = "电费", IsBold = true)]
- public int? ElectricityTotalFee { get; set; }
+ public decimal? ElectricityTotalFee { get; set; }
///
/// 附加费
///
[ExporterHeader(DisplayName = "附加费", IsBold = true)]
- public int? AppendTotalFee { get; set; }
+ public decimal? AppendTotalFee { get; set; }
///
/// 总费用(所有的总费用)
///
[ExporterHeader(DisplayName = "总费用(所有的总费用)", IsBold = true)]
- public int? TotalFee { get; set; }
+ public decimal? TotalFee { get; set; }
}
\ No newline at end of file
diff --git a/Entity/Dto/SwapOrderDto2.cs b/Entity/Dto/SwapOrderDto2.cs
index e009cc5..be57776 100644
--- a/Entity/Dto/SwapOrderDto2.cs
+++ b/Entity/Dto/SwapOrderDto2.cs
@@ -118,17 +118,17 @@ public class SwapOrderDto2
/// 电费
///
[ExporterHeader(DisplayName = "ELECTRIC CHARGE", IsBold = true)]
- public int? ElectricityTotalFee { get; set; }
+ public decimal? ElectricityTotalFee { get; set; }
///
/// 附加费
///
[ExporterHeader(DisplayName = "ADDITIONAL CHARGE", IsBold = true)]
- public int? AppendTotalFee { get; set; }
+ public decimal? AppendTotalFee { get; set; }
///
/// 总费用(所有的总费用)
///
[ExporterHeader(DisplayName = "TOTAL COST", IsBold = true)]
- public int? TotalFee { get; set; }
+ public decimal? TotalFee { get; set; }
}
\ No newline at end of file
diff --git a/Service/Init/StaticStationInfo.cs b/Service/Init/StaticStationInfo.cs
index 1b9ace9..fd465b3 100644
--- a/Service/Init/StaticStationInfo.cs
+++ b/Service/Init/StaticStationInfo.cs
@@ -316,21 +316,21 @@ public class StaticStationInfo
}
- public static int ServiceTotalFee
+ public static decimal ServiceTotalFee
{
- get => int.Parse(Resolve(StationParamConst.ServiceTotalFee));
+ get => decimal.Parse(Resolve(StationParamConst.ServiceTotalFee));
set => Set(StationParamConst.ServiceTotalFee, value);
}
- public static int ElectricityTotalFee
+ public static decimal ElectricityTotalFee
{
- get => int.Parse(Resolve(StationParamConst.ElectricityTotalFee));
+ get => decimal.Parse(Resolve(StationParamConst.ElectricityTotalFee));
set => Set(StationParamConst.ElectricityTotalFee, value);
}
- public static int AppendTotalFee
+ public static decimal AppendTotalFee
{
- get => int.Parse(Resolve(StationParamConst.AppendTotalFee));
+ get => decimal.Parse(Resolve(StationParamConst.AppendTotalFee));
set => Set(StationParamConst.AppendTotalFee, value);
}
diff --git a/Service/MyTask/SwapOrderSettleAnAccountTask.cs b/Service/MyTask/SwapOrderSettleAnAccountTask.cs
index 1967f3a..a8fa839 100644
--- a/Service/MyTask/SwapOrderSettleAnAccountTask.cs
+++ b/Service/MyTask/SwapOrderSettleAnAccountTask.cs
@@ -57,11 +57,11 @@ public class SwapOrderSettleAnAccountTask : ITask
.In(swapOrder => swapOrder.Sn, list)
.ToList();
// 电费单价
- int electricityTotalFee = StaticStationInfo.ElectricityTotalFee;
+ decimal electricityTotalFee = StaticStationInfo.ElectricityTotalFee;
// 换电服务费用
- int serviceTotalFee = StaticStationInfo.ServiceTotalFee;
+ decimal serviceTotalFee = StaticStationInfo.ServiceTotalFee;
// 附加费用
- int appendTotalFee = StaticStationInfo.AppendTotalFee;
+ decimal appendTotalFee = StaticStationInfo.AppendTotalFee;
foreach (var swapOrderBattery in listSwapOrderBattery)
{
// 换上的满电包soc*满电包的电池标量
@@ -76,7 +76,7 @@ public class SwapOrderSettleAnAccountTask : ITask
if (matchingOrder != null)
{
matchingOrder.ServiceTotalFee = serviceTotalFee;
- matchingOrder.ElectricityTotalFee = (int?)electricCharge;
+ matchingOrder.ElectricityTotalFee = electricCharge;
matchingOrder.AppendTotalFee = appendTotalFee;
matchingOrder.TotalFee = matchingOrder.ServiceTotalFee + matchingOrder.ElectricityTotalFee +
matchingOrder.AppendTotalFee;
diff --git a/WebStarter/Controllers/SwapOrderController.cs b/WebStarter/Controllers/SwapOrderController.cs
index 0507cb0..7e7fc22 100644
--- a/WebStarter/Controllers/SwapOrderController.cs
+++ b/WebStarter/Controllers/SwapOrderController.cs
@@ -401,6 +401,26 @@ public class SwapOrderController : ControllerBase
List swapOrderBattery = mapper.Map>(batteryList);
// 换电订单
List swapOrderResp = mapper.Map>(orderList);
+
+ foreach (var orderResp in swapOrderResp)
+ {
+ if (orderResp.ServiceTotalFee.HasValue)
+ {
+ orderResp.ServiceTotalFee = Math.Round(orderResp.ServiceTotalFee.Value / 100m, 2);
+ }
+ if (orderResp.ElectricityTotalFee.HasValue)
+ {
+ orderResp.ElectricityTotalFee = Math.Round(orderResp.ElectricityTotalFee.Value / 100m, 2);
+ }
+ if (orderResp.AppendTotalFee.HasValue)
+ {
+ orderResp.AppendTotalFee = Math.Round(orderResp.AppendTotalFee.Value / 100m, 2);
+ }
+ if (orderResp.TotalFee.HasValue)
+ {
+ orderResp.TotalFee = Math.Round(orderResp.TotalFee.Value / 100m, 2);
+ }
+ }
List vehicleNoList = swapOrderResp.Select(resp => resp.VehicleNo).ToList() ?? new List();
// 查询车辆的部门
From 8ff5567328dcf9fda3e63a0b63dbd60bfdf4e71a Mon Sep 17 00:00:00 2001
From: tq <1916474859@qq,com>
Date: Tue, 24 Sep 2024 17:56:44 +0800
Subject: [PATCH 3/4] =?UTF-8?q?sql=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
WebStarter/db/换电订单新增计费字段.sql | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/WebStarter/db/换电订单新增计费字段.sql b/WebStarter/db/换电订单新增计费字段.sql
index 553b933..6d8f1ef 100644
--- a/WebStarter/db/换电订单新增计费字段.sql
+++ b/WebStarter/db/换电订单新增计费字段.sql
@@ -1,7 +1,4 @@
-ALTER TABLE swap_order
-ADD COLUMN electricity_total_fee INT COMMENT '电费',
-ADD COLUMN append_total_fee INT COMMENT '附加费',
-ADD COLUMN total_fee INT COMMENT '总费用(所有的总费用)';
+
ALTER TABLE swap_order_step
@@ -26,4 +23,10 @@ ALTER TABLE bin_info
ADD COLUMN nominal_energy DECIMAL(24,2) COMMENT '电池标称能量';
ALTER TABLE swap_order
- ADD COLUMN service_total_fee INT COMMENT '换电服务费';
\ No newline at end of file
+ ADD COLUMN service_total_fee INT COMMENT '换电服务费';
+
+ALTER TABLE swap_order
+ MODIFY COLUMN electricity_total_fee DECIMAL(24,2) COMMENT '电费',
+ MODIFY COLUMN append_total_fee DECIMAL(24,2) COMMENT '附加费',
+ MODIFY COLUMN total_fee DECIMAL(24,2) COMMENT '总费用(所有的总费用)',
+ MODIFY COLUMN service_total_fee DECIMAL(24,2) COMMENT '换电服务费';
From 0777f188bf60b0190a242bb4358919d4aac703bb Mon Sep 17 00:00:00 2001
From: tq <1916474859@qq,com>
Date: Tue, 24 Sep 2024 18:49:23 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Entity/Dto/ChargeOrderDto.cs | 6 +++++-
Entity/Dto/ChargeOrderDto2.cs | 5 +++++
Entity/Dto/SwapLoseOrderDto.cs | 7 +++++++
Entity/Dto/SwapOrderDto.cs | 13 ++++++++-----
Service/Station/ChargeOrderService.cs | 14 ++++++++++++++
5 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/Entity/Dto/ChargeOrderDto.cs b/Entity/Dto/ChargeOrderDto.cs
index 9ff15ab..25cb6ce 100644
--- a/Entity/Dto/ChargeOrderDto.cs
+++ b/Entity/Dto/ChargeOrderDto.cs
@@ -25,6 +25,10 @@ public class ChargeOrderDto
[ExporterHeader(DisplayName = "充电桩编号", IsBold = true)]
public string ChargerNo { get; set; }
+
+ [ExporterHeader(DisplayName = "仓位号", IsBold = true)]
+ public string BinNO { get; set; }
+
///
/// Desc:电池编号
/// Default:
@@ -56,7 +60,7 @@ public class ChargeOrderDto
/// Default:
/// Nullable:True
///
- [ExporterHeader(DisplayName = "充电时长", IsBold = true)]
+ [ExporterHeader(DisplayName = "充电时长/min", IsBold = true)]
public int ChargeTimeCount { get; set; }
///
diff --git a/Entity/Dto/ChargeOrderDto2.cs b/Entity/Dto/ChargeOrderDto2.cs
index e45f7ae..2eda1b7 100644
--- a/Entity/Dto/ChargeOrderDto2.cs
+++ b/Entity/Dto/ChargeOrderDto2.cs
@@ -14,6 +14,8 @@ public class ChargeOrderDto2
[ExporterHeader(DisplayName = "Order Number", IsBold = true)]
public string Sn { get; set; }
+
+
[ExporterHeader(DisplayName = "Battery Number", IsBold = true)]
public string BatteryNo { get; set; }
@@ -21,6 +23,9 @@ public class ChargeOrderDto2
[ExporterHeader(DisplayName = "Charger Number", IsBold = true)]
public string ChargerNo { get; set; }
+ [ExporterHeader(DisplayName = "Location Number", IsBold = true)]
+ public string BinNO { get; set; }
+
[ExporterHeader(DisplayName = "Start Time", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss",
AutoCenterColumn = true)]
diff --git a/Entity/Dto/SwapLoseOrderDto.cs b/Entity/Dto/SwapLoseOrderDto.cs
index 9b07b0f..e6baf16 100644
--- a/Entity/Dto/SwapLoseOrderDto.cs
+++ b/Entity/Dto/SwapLoseOrderDto.cs
@@ -18,6 +18,10 @@ public class SwapLoseOrderDto
[ExporterHeader(DisplayName = "站号", IsBold = true)]
public string StationNumber { get; set; } = "2号站";
+ [ExporterHeader(DisplayName = "创建时间", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss",
+ AutoCenterColumn = true)]
+ public DateTime? CreatedTime { get; set; }
+
[ExporterHeader(DisplayName = "开始时间", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss",
AutoCenterColumn = true)]
@@ -68,4 +72,7 @@ public class SwapLoseOrderDto
///
[ExporterHeader(DisplayName = "失败原因", IsBold = true)]
public string FailReason { get; set; }
+
+ [ExporterHeader(DisplayName = "备注", IsBold = true)]
+ public decimal? Remark { get; set; }
}
\ No newline at end of file
diff --git a/Entity/Dto/SwapOrderDto.cs b/Entity/Dto/SwapOrderDto.cs
index 12b7a3e..fc68985 100644
--- a/Entity/Dto/SwapOrderDto.cs
+++ b/Entity/Dto/SwapOrderDto.cs
@@ -166,7 +166,7 @@ public class SwapOrderDto
/// Default:
/// Nullable:True
///
- [ExporterHeader(DisplayName = "soc(取)", IsBold = true)]
+ [ExporterHeader(DisplayName = "soc(取)%", IsBold = true)]
public decimal? UpBatterySoc { get; set; }
@@ -199,7 +199,7 @@ public class SwapOrderDto
/// Default:
/// Nullable:True
///
- [ExporterHeader(DisplayName = "soc(存)", IsBold = true)]
+ [ExporterHeader(DisplayName = "soc(存)%", IsBold = true)]
public decimal? DownBatterySoc { get; set; }
@@ -216,14 +216,14 @@ public class SwapOrderDto
/// Default:
/// Nullable:True
///
- [ExporterHeader(DisplayName = "订单编号", IsBold = true)]
+ [ExporterHeader(IsIgnore = true)]
public string Sn { get; set; }
///
/// 换电服务费用
///
- [ExporterHeader(DisplayName = "换电服务费用", IsBold = true)]
+ [ExporterHeader(DisplayName = "服务费", IsBold = true)]
public decimal? ServiceTotalFee { get; set; }
///
@@ -241,6 +241,9 @@ public class SwapOrderDto
///
/// 总费用(所有的总费用)
///
- [ExporterHeader(DisplayName = "总费用(所有的总费用)", IsBold = true)]
+ [ExporterHeader(DisplayName = "总费用", IsBold = true)]
public decimal? TotalFee { get; set; }
+
+ [ExporterHeader(DisplayName = "备注", IsBold = true)]
+ public decimal? Remark { get; set; }
}
\ No newline at end of file
diff --git a/Service/Station/ChargeOrderService.cs b/Service/Station/ChargeOrderService.cs
index 4a3f2fc..e9859f5 100644
--- a/Service/Station/ChargeOrderService.cs
+++ b/Service/Station/ChargeOrderService.cs
@@ -70,6 +70,13 @@ public class ChargeOrderService : BaseServices
if (language == "en")
{
List list2 = mapper.Map>(chargeOrders);
+ foreach (var chargeOrderDto in list2)
+ {
+ if (!string.IsNullOrEmpty(chargeOrderDto.ChargerNo))
+ {
+ chargeOrderDto.BinNO = chargeOrderDto.ChargerNo;
+ }
+ }
IExcelExporter excelExporter = new ExcelExporter();
var res = await excelExporter.ExportAsByteArray(list2);
return new FileStreamResult(new MemoryStream(res), "application/octet-stream")
@@ -78,6 +85,13 @@ public class ChargeOrderService : BaseServices
else
{
List list = mapper.Map>(chargeOrders);
+ foreach (var chargeOrderDto in list)
+ {
+ if (!string.IsNullOrEmpty(chargeOrderDto.ChargerNo))
+ {
+ chargeOrderDto.BinNO = chargeOrderDto.ChargerNo;
+ }
+ }
IExcelExporter excelExporter = new ExcelExporter();
var res = await excelExporter.ExportAsByteArray(list);
return new FileStreamResult(new MemoryStream(res), "application/octet-stream")