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

---
 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java |   37 ++++++++++++++++++-------------------
 1 files changed, 18 insertions(+), 19 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 09cc925..eb6f176 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
@@ -1155,8 +1155,7 @@
                         userRedPacketRecordService.updateBatchById(userRedPacketRecords);
                     }
                     orderLogistics.setRedPacketId(jsonArray.toJSONString());
-                }
-                if(total > 0 && total.compareTo(multiply1.doubleValue()) < 0){
+                }else if(total > 0 && total.compareTo(multiply1.doubleValue()) < 0){
                     orderLogistics.setRedPacketMoney(total);
                     orderMoney = orderMoney.subtract(new BigDecimal(total)).setScale(2, RoundingMode.HALF_EVEN);
                     //获取红包id
@@ -1264,21 +1263,21 @@
                 userCouponRecord.setEndTime(new Date());
                 userCouponRecordService.updateById(userCouponRecord);
             }
-            if(null != orderLogistics.getRedPacketId()){
-                JSONArray jsonArray = JSON.parseArray(orderLogistics.getRedPacketId());
-                for (int i = 0; i < jsonArray.size(); i++) {
-                    JSONObject jsonObject = jsonArray.getJSONObject(i);
-                    Integer id1 = jsonObject.getInteger("id");
-                    Double money = jsonObject.getDouble("money");
-                    UserRedPacketRecord userRedPacketRecord = userRedPacketRecordService.selectById(id1);
-                    userRedPacketRecord.setRemainingAmount(userRedPacketRecord.getRemainingAmount() - money);
-                    if(0 == userRedPacketRecord.getRemainingAmount()){
-                        userRedPacketRecord.setState(2);
-                        userRedPacketRecord.setEndTime(new Date());
-                    }
-                    userRedPacketRecordService.updateById(userRedPacketRecord);
-                }
-            }
+//            if(null != orderLogistics.getRedPacketId()){
+//                JSONArray jsonArray = JSON.parseArray(orderLogistics.getRedPacketId());
+//                for (int i = 0; i < jsonArray.size(); i++) {
+//                    JSONObject jsonObject = jsonArray.getJSONObject(i);
+//                    Integer id1 = jsonObject.getInteger("id");
+//                    Double money = jsonObject.getDouble("money");
+//                    UserRedPacketRecord userRedPacketRecord = userRedPacketRecordService.selectById(id1);
+//                    userRedPacketRecord.setRemainingAmount(userRedPacketRecord.getRemainingAmount() - money);
+//                    if(0 == userRedPacketRecord.getRemainingAmount()){
+//                        userRedPacketRecord.setState(2);
+//                        userRedPacketRecord.setEndTime(new Date());
+//                    }
+//                    userRedPacketRecordService.updateById(userRedPacketRecord);
+//                }
+//            }
     
             //添加已收入明细
             Company company = companyService.selectById(orderLogistics.getCompanyId());
@@ -3261,10 +3260,10 @@
         if(orderLogistics.getState() == 10 || orderLogistics.getState() == 12){
             Car car = carService.selectById(orderLogistics.getCarId());
             //修改行程信息
-            boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null);
+            boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, orderLogistics.getTripId(), null, null, null, null);
             if(!updateTrip){
                 for (int i = 0; i < 5; i++) {
-                    updateTrip = fleetEngineUtil.updateTrip("CANCELED", car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null);
+                    updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, orderLogistics.getTripId(), null, null, null, null);
                     if(updateTrip){
                         break;
                     }

--
Gitblit v1.7.1