From 8086d86a908690bbefc6c0e715389265f3bb8d07 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期五, 01 十一月 2024 19:49:58 +0800
Subject: [PATCH] bug修改

---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java                |    6 +++---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java                 |    4 ++++
 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/AccountListVO.java                                  |    3 +++
 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java |   25 ++++++++++++++++++++++++-
 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrder.java                              |    6 ++++++
 ruoyi-service/ruoyi-chargingPile/src/main/resources/template/账户结算账单.xlsx                                           |    0 
 6 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrder.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrder.java
index 5c6b7a4..e350f71 100644
--- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrder.java
+++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrder.java
@@ -232,6 +232,9 @@
     @ApiModelProperty(value = "支付方式")
     @TableField(exist = false)
     private String rechargePaymentType1;
+    @ApiModelProperty(value = "支付平台")
+    @TableField(exist = false)
+    private String payPlatform;
     @ApiModelProperty(value = "充电启动方式")
     @TableField(exist = false)
     private String chargingType;
@@ -244,6 +247,9 @@
     @ApiModelProperty(value = "充电费用")
     @TableField(exist = false)
     private String totalAmount;
+    @ApiModelProperty(value = "合计")
+    @TableField(exist = false)
+    private BigDecimal total;
     @ApiModelProperty(value = "优惠抵扣")
     @TableField(exist = false)
     private String discount;
diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/AccountListVO.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/AccountListVO.java
index f2ea33c..b4913d0 100644
--- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/AccountListVO.java
+++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/AccountListVO.java
@@ -2,6 +2,7 @@
 
 import com.ruoyi.common.core.web.page.PageInfo;
 import com.ruoyi.order.api.model.TChargingBill;
+import com.ruoyi.order.api.model.TChargingOrder;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -27,5 +28,7 @@
     private BigDecimal sharingAmount;
     @ApiModelProperty(value = "列表数据")
     private PageInfo<ChargingBillListVO> list;
+    @ApiModelProperty(value = "导出数据")
+    private List<TChargingOrder> orderList;
 
 }
diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java
index aba788a..49cbd46 100644
--- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java
+++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java
@@ -101,6 +101,7 @@
     @Resource
     private AppUserCarClient appUserCarClient;
 
+
     @Autowired
     public TApplyChargingPileController(TApplyChargingPileService applyChargingPileService, TokenService tokenService, RedisService redisService) {
         this.applyChargingPileService = applyChargingPileService;
@@ -314,6 +315,28 @@
     {   dto.setPageCurr(1);
         dto.setPageSize(99999999);
         AccountListVO data = orderClient.accountBillList(dto).getData();
+        List<TChargingOrder> collect = data.getOrderList().stream().distinct().collect(Collectors.toList());
+        int i = 1;
+        BigDecimal bigDecimal = new BigDecimal("0");
+
+        for (TChargingOrder chargingOrder : collect) {
+            bigDecimal = bigDecimal.add(chargingOrder.getPaymentAmount());
+            if (chargingOrder.getRechargePaymentType()!=null){
+                switch (chargingOrder.getRechargePaymentType()){
+                    case 1:
+                        chargingOrder.setPayPlatform("微信");
+                        chargingOrder.setRechargePaymentType1("微信小程序支付");
+                        break;
+                    case 2:
+                        chargingOrder.setPayPlatform("支付宝");
+                        chargingOrder.setRechargePaymentType1("支付宝小程序支付");
+                        break;
+                }
+            }
+            chargingOrder.setXuhao(i);
+            i++;
+        }
+        collect.get(0).setTotal(bigDecimal);
         try {
             response.setCharacterEncoding(Constants.UTF8);
             response.setContentType("application/vnd.ms-excel");
@@ -331,7 +354,7 @@
             try (ExcelWriter excelWriter = excelWriterBuilder.withTemplate(stream).build()) {
                 WriteSheet writeSheet = EasyExcel.writerSheet().build();
                 FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.VERTICAL).build();
-                excelWriter.fill(new FillWrapper("data1", data.getList().getRecords()), fillConfig, writeSheet);
+                excelWriter.fill(new FillWrapper("data1", collect), fillConfig, writeSheet);
                 excelWriter.finish();
             } catch (Exception e) {
                 return R.fail("excel导出失败!");
diff --git "a/ruoyi-service/ruoyi-chargingPile/src/main/resources/template/\350\264\246\346\210\267\347\273\223\347\256\227\350\264\246\345\215\225.xlsx" "b/ruoyi-service/ruoyi-chargingPile/src/main/resources/template/\350\264\246\346\210\267\347\273\223\347\256\227\350\264\246\345\215\225.xlsx"
index 296d45b..9fa8ac0 100644
--- "a/ruoyi-service/ruoyi-chargingPile/src/main/resources/template/\350\264\246\346\210\267\347\273\223\347\256\227\350\264\246\345\215\225.xlsx"
+++ "b/ruoyi-service/ruoyi-chargingPile/src/main/resources/template/\350\264\246\346\210\267\347\273\223\347\256\227\350\264\246\345\215\225.xlsx"
Binary files differ
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java
index debf036..2d0a858 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java
@@ -37,6 +37,7 @@
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.temporal.TemporalAdjusters;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
@@ -77,6 +78,8 @@
             }
         }
         ChargingBillVO chargingBillVO = new ChargingBillVO();
+        List<TChargingOrder> exports = new ArrayList<>();
+
         String startTime1 = null;
         String startTime2 = null;
         if (StringUtils.hasLength(dto.getStartTime())){
@@ -299,6 +302,7 @@
                 }
 
             }
+            exports.addAll(tChargingOrders);
             // 将chargingSecond 这是以秒为单位存放的总秒数 将其转化为xx小时xx分钟xx秒
             int hours = chargingSecond / 3600;
             int minutes = (chargingSecond % 3600) / 60;
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
index 4850a89..5af2e1e 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -1441,7 +1441,6 @@
 			if (chargingOrderListVO.getCode()!=null){
 				List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrderListVO.getCode()).getData();
 			if (data6!=null && !data6.isEmpty()){
-					// 第一条数据soc为开始 最后一条数据soc为结束soc
 					chargingOrderListVO.setEndSoc(data6.get(0).getSoc().toString());
 					chargingOrderListVO.setStartSoc(data6.get(data6.size()-1).getSoc().toString());
 				}
@@ -2624,8 +2623,9 @@
 			tSettlementConfirm.setDistribution(dto.getDistribution());
 			tSettlementConfirm.setIncome(dto.getElectrovalence().add(dto.getServiceCharge()));
 			tSettlementConfirm.setCost(dto.getVenue().add(dto.getClean()).add(dto.getMaintain()).add(dto.getSupplyElectronic()));
-			tSettlementConfirm.setProfitMoney(tSettlementConfirm.getElectrovalence().add(tSettlementConfirm.getServiceCharge())
-					.subtract(tSettlementConfirm.getCost()));
+			BigDecimal divide1 = tSettlementConfirm.getProportionMoney().divide(tSettlementConfirm.getProportionPartner(), 2, RoundingMode.HALF_DOWN);
+			tSettlementConfirm.setProfitMoney(tSettlementConfirm.getServiceCharge().multiply(tSettlementConfirm.getServicePartner())
+					.subtract(divide1));
 			tSettlementConfirm.setNewSettlement(subtract2.subtract(tSettlementConfirm.getCost()));
 
 			tSettlementConfirmMapper.insert(tSettlementConfirm);

--
Gitblit v1.7.1