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] =?UTF-8?q?=E8=AE=A1=E8=B4=B9=E5=AD=97=E6=AE=B5=E6=94=B9?= =?UTF-8?q?=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(); // 查询车辆的部门