From be053a794115fc5fd4a21b13b387402f41705f1f Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期四, 12 十二月 2024 16:18:11 +0800
Subject: [PATCH] 修改bug

---
 DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/SettlementRecordServiceImpl.java |  152 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 140 insertions(+), 12 deletions(-)

diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/SettlementRecordServiceImpl.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/SettlementRecordServiceImpl.java
index bb4f2f8..284920a 100644
--- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/SettlementRecordServiceImpl.java
+++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/SettlementRecordServiceImpl.java
@@ -93,10 +93,16 @@
             JSONObject jsonObject = JSON.parseObject(settlementAllocation.getContent());
             Integer type = jsonObject.getInteger("type");
             querySettlementAmount.setType(type);
-            List<SettlementRecord> settlementRecords = this.selectList(new EntityWrapper<SettlementRecord>().eq("driverId", driverId).eq("paymentStatus", 1));
+            //所有未支付的主表数据
+            List<SettlementRecord> settlementRecords = this.selectList(new EntityWrapper<SettlementRecord>().eq("driverId", driverId)
+                    .eq("paymentStatus", 1));
             double sum = settlementRecords.stream().mapToDouble(SettlementRecord::getPayMoney).sum();
-            List<SettlementDetail> settlementDetailList = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", driverId).isNull("settlementRecordId"));
+            
+            //所有未生成主表数据的明细
+            List<SettlementDetail> settlementDetailList = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", driverId)
+                    .isNull("settlementRecordId"));
             double sum1 = settlementDetailList.stream().mapToDouble(SettlementDetail::getPrice).sum();
+            //显示的金额
             querySettlementAmount.setAmount(new BigDecimal(sum).add(new BigDecimal(sum1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue());
     
             List<Integer> collect = settlementRecords.stream().map(SettlementRecord::getId).collect(Collectors.toList());
@@ -148,7 +154,9 @@
             JSONObject jsonObject = JSON.parseObject(settlementAllocation.getContent());
             Integer type = jsonObject.getInteger("type");
     
-            List<SettlementDetail> settlementDetails = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", driverId).isNull("settlementRecordId"));
+            //所以未生成主表的明细数据
+            List<SettlementDetail> settlementDetails = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", driverId)
+                    .isNull("settlementRecordId"));
             double sum = settlementDetails.stream().mapToDouble(SettlementDetail::getPrice).sum();
             if(sum > 0){
                 SettlementRecord settlementRecord = new SettlementRecord();
@@ -402,10 +410,50 @@
                                 CarModel carModel = carModelMapper.selectById(car.getCarModelId());
                                 String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId());
                                 if(ToolUtil.isEmpty(vehicles)){
-                                    fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
-                                    fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                    boolean createVehicles = fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                    if(!createVehicles){
+                                        for (int i = 0; i < 5; i++) {
+                                            createVehicles = fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                            if(createVehicles){
+                                                break;
+                                            }
+                                            try {
+                                                Thread.sleep(5000L);
+                                            } catch (InterruptedException e) {
+                                                throw new RuntimeException(e);
+                                            }
+                                        }
+                                    }
+                                    
+                                    boolean updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                    if(!updateVehicles){
+                                        for (int i = 0; i < 5; i++) {
+                                            updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                            if(updateVehicles){
+                                                break;
+                                            }
+                                            try {
+                                                Thread.sleep(5000L);
+                                            } catch (InterruptedException e) {
+                                                throw new RuntimeException(e);
+                                            }
+                                        }
+                                    }
                                 }else{
-                                    fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                    boolean updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                    if(!updateVehicles){
+                                        for (int i = 0; i < 5; i++) {
+                                            updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                            if(updateVehicles){
+                                                break;
+                                            }
+                                            try {
+                                                Thread.sleep(5000L);
+                                            } catch (InterruptedException e) {
+                                                throw new RuntimeException(e);
+                                            }
+                                        }
+                                    }
                                 }
                             }catch (Exception e){
                                 e.printStackTrace();
@@ -460,10 +508,50 @@
                                 CarModel carModel = carModelMapper.selectById(car.getCarModelId());
                                 String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId());
                                 if(ToolUtil.isEmpty(vehicles)){
-                                    fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
-                                    fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                    boolean createVehicles = fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                    if(!createVehicles){
+                                        for (int i = 0; i < 5; i++) {
+                                            createVehicles = fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                            if(createVehicles){
+                                                break;
+                                            }
+                                            try {
+                                                Thread.sleep(5000L);
+                                            } catch (InterruptedException e) {
+                                                throw new RuntimeException(e);
+                                            }
+                                        }
+                                    }
+                                    
+                                    boolean updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                    if(!updateVehicles){
+                                        for (int i = 0; i < 5; i++) {
+                                            updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                            if(updateVehicles){
+                                                break;
+                                            }
+                                            try {
+                                                Thread.sleep(5000L);
+                                            } catch (InterruptedException e) {
+                                                throw new RuntimeException(e);
+                                            }
+                                        }
+                                    }
                                 }else{
-                                    fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                    boolean updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                    if(!updateVehicles){
+                                        for (int i = 0; i < 5; i++) {
+                                            updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                            if(updateVehicles){
+                                                break;
+                                            }
+                                            try {
+                                                Thread.sleep(5000L);
+                                            } catch (InterruptedException e) {
+                                                throw new RuntimeException(e);
+                                            }
+                                        }
+                                    }
                                 }
                             }catch (Exception e){
                                 e.printStackTrace();
@@ -517,10 +605,50 @@
                                 CarModel carModel = carModelMapper.selectById(car.getCarModelId());
                                 String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId());
                                 if(ToolUtil.isEmpty(vehicles)){
-                                    fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
-                                    fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                    boolean createVehicles = fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                    if(!createVehicles){
+                                        for (int i = 0; i < 5; i++) {
+                                            createVehicles = fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                            if(createVehicles){
+                                                break;
+                                            }
+                                            try {
+                                                Thread.sleep(5000L);
+                                            } catch (InterruptedException e) {
+                                                throw new RuntimeException(e);
+                                            }
+                                        }
+                                    }
+                                    
+                                    boolean updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                    if(!updateVehicles){
+                                        for (int i = 0; i < 5; i++) {
+                                            updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                            if(updateVehicles){
+                                                break;
+                                            }
+                                            try {
+                                                Thread.sleep(5000L);
+                                            } catch (InterruptedException e) {
+                                                throw new RuntimeException(e);
+                                            }
+                                        }
+                                    }
                                 }else{
-                                    fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                    boolean updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                    if(!updateVehicles){
+                                        for (int i = 0; i < 5; i++) {
+                                            updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
+                                            if(updateVehicles){
+                                                break;
+                                            }
+                                            try {
+                                                Thread.sleep(5000L);
+                                            } catch (InterruptedException e) {
+                                                throw new RuntimeException(e);
+                                            }
+                                        }
+                                    }
                                 }
                             }catch (Exception e){
                                 e.printStackTrace();

--
Gitblit v1.7.1