From 3ed8156b12d445bb4e374a7ee43696c60c10c58c Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期二, 20 五月 2025 15:50:53 +0800
Subject: [PATCH] 修改bug

---
 UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java |   34 +++++++++++++++++++++++++++++-----
 1 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java b/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
index f92e95e..1961dbb 100644
--- a/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
+++ b/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
@@ -10,10 +10,7 @@
 import com.stylefeng.guns.modular.smallLogistics.model.OrderLogisticsSpread;
 import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService;
 import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsSpreadService;
-import com.stylefeng.guns.modular.system.dao.RegionMapper;
-import com.stylefeng.guns.modular.system.dao.SensitiveWordsMapper;
-import com.stylefeng.guns.modular.system.dao.SysIntegralMapper;
-import com.stylefeng.guns.modular.system.dao.SystemPriceMapper;
+import com.stylefeng.guns.modular.system.dao.*;
 import com.stylefeng.guns.modular.system.model.*;
 import com.stylefeng.guns.modular.system.service.*;
 import com.stylefeng.guns.modular.system.util.*;
@@ -66,6 +63,12 @@
 
     @Autowired
     private IUserInfoService userInfoService;
+    
+    @Autowired
+    private IUserRedPacketRecordService userRedPacketRecordService;
+    
+    @Resource
+    private UserActivityDiscount1Mapper userActivityDiscount1Mapper;
 
     @Autowired
     private IPaymentRecordService paymentRecordService;
@@ -342,6 +345,12 @@
             if(dist.compareTo(jsonObject.getDouble("num20")) >= 0 && dist.compareTo(jsonObject.getDouble("num21")) < 0){
                 price2 = jsonObject.getDouble("num22");
             }
+            if(dist.compareTo(jsonObject.getDouble("num10")) >= 0){
+                price1 = jsonObject.getDouble("num11");
+            }
+            if(dist.compareTo(jsonObject.getDouble("num21")) >= 0){
+                price2 = jsonObject.getDouble("num22");
+            }
         }else{
             Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null);
             String content = String.valueOf(query1.get("content"));
@@ -435,6 +444,21 @@
         Double orderMoney = orderLogistics.getOrderMoney();
         UserInfo userInfo = userInfoService.selectById(uid);
         ResultUtil resultUtil = ResultUtil.success();
+        orderLogistics.setCouponMoney(0D);//初始化历史数据
+        orderLogistics.setCouponId(null);
+    
+        //计算折扣
+        UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(orderLogistics.getCompanyId());
+        if(null != query2){
+            Double special = query2.getLogistics();
+            orderLogistics.setDiscount(special);
+            double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+            if(orderMoney.compareTo(v) > 0){
+                orderLogistics.setDiscountMoney(orderMoney - v);
+                orderLogistics.setActivityId(query2.getId());
+                orderMoney = v;
+            }
+        }
 
         if(payType == 1){//微信支付
             String app = type == 1 ? "APP" : "JSAPI";
@@ -812,7 +836,7 @@
         if(null == orderLogistics){
             return ResultUtil.error("取消订单失败,订单信息有误");
         }
-        if(orderLogistics.getState() > 5 && orderLogistics.getState() != 7 && orderLogistics.getState() != 8  && orderLogistics.getState() != 11){
+        if(orderLogistics.getState() >= 5 && orderLogistics.getState() != 7 && orderLogistics.getState() != 8  && orderLogistics.getState() != 11){
             return ResultUtil.error("取消订单失败,不合法的操作");
         }
 

--
Gitblit v1.7.1