From b77c1869930d044db13a0d4a672bf98da1cab2c2 Mon Sep 17 00:00:00 2001
From: zhibing.pu <393733352@qq.com>
Date: 星期四, 22 八月 2024 12:00:07 +0800
Subject: [PATCH] 修改bug

---
 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
index 065d77b..6146c4a 100644
--- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
+++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
@@ -1743,21 +1743,22 @@
                     if(null != settlementAllocation){
                         JSONObject jsonObject = JSON.parseObject(settlementAllocation.getContent());
                         Double maxPrice = jsonObject.getDouble("maxPrice");
-                        Integer type1 = jsonObject.getInteger("type");
-                        if(1 == type1){
-                            List<SettlementDetail> settlementDetailList = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", driver.getId()).isNull("settlementRecordId").last(" and DATE_FORMAT(now(), '%Y-%m-%d') = DATE_FORMAT(createTime, '%Y-%m-%d')"));
+                        if(null != maxPrice){
+                            List<SettlementDetail> settlementDetailList = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", driver.getId())
+                                    .isNull("settlementRecordId").last(" and DATE_FORMAT(now(), '%Y-%m-%d') = DATE_FORMAT(createTime, '%Y-%m-%d')"));
                             BigDecimal total = new BigDecimal(0);
                             for (SettlementDetail detail : settlementDetailList) {
                                 total = total.add(new BigDecimal(detail.getPrice()));
                             }
+                            //日结算
                             if(maxPrice.compareTo(total.doubleValue()) <= 0){
                                 SettlementRecord settlementRecord = settlementRecordService.selectOne(new EntityWrapper<SettlementRecord>().eq("driverId", orderLogistics.getDriverId())
-                                        .eq("type", type1).eq("paymentStatus", 1).last(" and day = DATE_FORMAT(now(), '%Y-%m-%d')"));
+                                        .eq("type", 1).eq("paymentStatus", 1).last(" and day = DATE_FORMAT(now(), '%Y-%m-%d')"));
                                 if(null == settlementRecord){
                                     settlementRecord = new SettlementRecord();
                                     settlementRecord.setDay(new Date());
                                     settlementRecord.setDriverId(orderLogistics.getDriverId());
-                                    settlementRecord.setType(type1);
+                                    settlementRecord.setType(1);
                                     settlementRecord.setPaymentStatus(1);
                                     settlementRecord.setPayMoney(total.doubleValue());
                                     settlementRecord.setInsertTime(new Date());
@@ -2967,17 +2968,20 @@
             }
     
             OrderLogistics orderLogistics = this.selectById(orderId);
-            long timeOutCancel = 0L;
-            long driverTimeOut = 0L;
+            map.put("driverTimeOutTime", 0);
+            map.put("driverTimeOut", 0);
             if(null != orderLogistics.getEstimateArriveTime()){
                 CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", orderLogistics.getCompanyId()));
                 JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent());
-                int driverTimeout = jsonObject.getIntValue("driverTimeout") * 60000;
-                timeOutCancel = orderLogistics.getEstimateArriveTime().getTime() + driverTimeout;
-                driverTimeOut = orderLogistics.getEstimateArriveTime().getTime();
+                int driverTimeout1 = jsonObject.getIntValue("driverTimeout");
+                long time = orderLogistics.getEstimateArriveTime().getTime() + driverTimeout1 * 60000;
+                if(System.currentTimeMillis() > time){
+                    Integer driverTimeOutTime = Double.valueOf((System.currentTimeMillis() - time) / 60000).intValue();
+                    driverTimeOutTime = driverTimeOutTime == 0 ? 1 : driverTimeOutTime;
+                    map.put("driverTimeOutTime", driverTimeOutTime);
+                    map.put("driverTimeOut", 1);
+                }
             }
-            map.put("driverTimeOut", driverTimeOut);
-            map.put("timeOutCancel", timeOutCancel);
         }
         return maps;
     }

--
Gitblit v1.7.1