Просмотр исходного кода

Merge branch 'master' into test

# Conflicts:
#	.claude/homunculus/observations.jsonl
#	ruoyi-admin/src/main/java/com/ruoyi/app/order/OrderService.java
#	ruoyi-admin/src/main/resources/application-druid.yml
qmj 1 неделя назад
Родитель
Сommit
1d826c9830

Разница между файлами не показана из-за своего большого размера
+ 0 - 16
.claude/homunculus/observations.jsonl


+ 1 - 0
.superpowers/brainstorm/1605-1777340961/state/server-stopped

@@ -0,0 +1 @@
+{"reason":"idle timeout","timestamp":1777342762408}

+ 1 - 0
.superpowers/brainstorm/1605-1777340961/state/server.pid

@@ -0,0 +1 @@
+1605

+ 33 - 24
ruoyi-admin/src/main/java/com/ruoyi/app/order/OrderService.java

@@ -1,19 +1,17 @@
 package com.ruoyi.app.order;
 package com.ruoyi.app.order;
 
 
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.StrUtil;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ruoyi.app.service.WalletService;
 import com.ruoyi.app.service.WalletService;
 import com.ruoyi.common.core.domain.entity.SysDictData;
 import com.ruoyi.common.core.domain.entity.SysDictData;
 import com.ruoyi.common.utils.DictUtils;
 import com.ruoyi.common.utils.DictUtils;
 import com.ruoyi.common.utils.MessageUtils;
 import com.ruoyi.common.utils.MessageUtils;
+import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.system.domain.*;
 import com.ruoyi.system.domain.*;
 import com.ruoyi.system.mapper.PosOrderPromotionMapper;
 import com.ruoyi.system.mapper.PosOrderPromotionMapper;
 import com.ruoyi.system.service.IInfoUserService;
 import com.ruoyi.system.service.IInfoUserService;
 import com.ruoyi.system.service.IPosStoreService;
 import com.ruoyi.system.service.IPosStoreService;
 import com.ruoyi.system.service.IUserBillingService;
 import com.ruoyi.system.service.IUserBillingService;
-import com.ruoyi.system.service.IVipUserQuanyiService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
@@ -37,8 +35,6 @@ public class OrderService {
     private WalletService walletService;
     private WalletService walletService;
     @Autowired
     @Autowired
     private IVipUserQuanyiService userQuanyiService;
     private IVipUserQuanyiService userQuanyiService;
-    @Autowired
-    private PosOrderPromotionMapper posOrderPromotionMapper;
 
 
     /**
     /**
      * 执行商户分成
      * 执行商户分成
@@ -63,27 +59,39 @@ public class OrderService {
                 user = infoUserService.getById(posOrder.getShId());
                 user = infoUserService.getById(posOrder.getShId());
             }
             }
             Double fcbili = user.getCommission() == null ? 0.00 : user.getCommission();
             Double fcbili = user.getCommission() == null ? 0.00 : user.getCommission();
-            // 分成基数 = 商品总金额(元) - 优惠促销减免(元)
-            // 优惠促销统一从 pos_order_promotion 明细表取(算价快照,单位元),
-            // 不再用 pos_order 摘要字段(单位为分,且 mdYhId 已指向 promotion_user_coupon)
-            Double fenc = posOrder.getFoodAmount() != null ? posOrder.getFoodAmount().doubleValue() : 0.00;
-            StringBuilder remark = new StringBuilder();
-            List<PosOrderPromotion> promotions = posOrderPromotionMapper.selectByOrderId(posOrder.getId());
-            if (promotions != null) {
-                for (PosOrderPromotion promo : promotions) {
-                    BigDecimal reduce = promo.getReduceAmount();
-                    if (reduce == null || reduce.compareTo(BigDecimal.ZERO) <= 0) {
-                        continue;
-                    }
-                    fenc -= reduce.doubleValue();
-                    boolean isCoupon = promo.getPromoType() != null && promo.getPromoType() == 2;
-                    String nameLabel = MessageUtils.message(isCoupon ? "no.posorder.md.yh.mc.messag" : "no.posorder.md.cx.mc.messag");
-                    String amountLabel = MessageUtils.message(isCoupon ? "no.posorder.md.yh.jiner.messag" : "no.posorder.md.cx.jiner.messag");
-                    remark.append(StrUtil.format(nameLabel, promo.getPromoName()))
-                            .append(StrUtil.format(amountLabel, df.format(reduce)));
+            JSONArray list = JSONArray.parseArray(posOrder.getFood());
+            int fenc = 0;
+            for (int i = 0; i < list.size(); i++) {
+                JSONObject foods = list.getJSONObject(i);
+                int price = foods.getInteger("price");
+                int otherPrice = foods.getInteger("otherPrice");
+                int num = foods.getInteger("number");
+                int age = (price + otherPrice) * num;
+                fenc += age;
+            }
+            String remark = "";
+            if (posOrder.getMdYhId() != null && posOrder.getMdDiscountAmount() != null) {
+                VipUserQuanyi userQuanyi = userQuanyiService.getById(posOrder.getMdYhId());
+                if (userQuanyi != null && "1".equals(userQuanyi.getType())) {
+                    fenc = fenc - posOrder.getMdDiscountAmount();
+                    String yhmcMessage = MessageUtils.message("no.posorder.md.yh.mc.messag");
+                    yhmcMessage = StrUtil.format(yhmcMessage, posOrder.getMdYhName());
+                    remark += yhmcMessage;
+                    String yhAmount = MessageUtils.message("no.posorder.md.yh.jiner.messag");
+                    yhAmount = StrUtil.format(yhAmount, posOrder.getMdDiscountAmount());
+                    remark += yhAmount;
                 }
                 }
             }
             }
-            billing.setIllustrate(remark.toString());
+            if (posOrder.getMdSalesName() != null && posOrder.getMdSalesReduction() != null) {
+                fenc = fenc - posOrder.getMdSalesReduction();
+                String cxNameMessage = MessageUtils.message("no.posorder.md.cx.mc.messag");
+                cxNameMessage = StrUtil.format(cxNameMessage, posOrder.getMdSalesName());
+                remark += cxNameMessage;
+                String cxAmount = MessageUtils.message("no.posorder.md.cx.jiner.messag");
+                cxAmount = StrUtil.format(cxAmount, posOrder.getMdSalesReduction());
+                remark += cxAmount;
+            }
+            billing.setIllustrate(remark);
             Double chouc = fenc * fcbili;
             Double chouc = fenc * fcbili;
             Double shfc = fenc - chouc;
             Double shfc = fenc - chouc;
             billing.setUserId(posOrder.getShId());
             billing.setUserId(posOrder.getShId());
@@ -103,6 +111,7 @@ public class OrderService {
             }
             }
         }
         }
     }
     }
+
     /**
     /**
      * 执行骑手分成
      * 执行骑手分成
      */
      */

+ 1 - 0
ruoyi-admin/src/main/java/com/ruoyi/app/order/PosOrderShOprateController.java

@@ -287,6 +287,7 @@ public class PosOrderShOprateController extends BaseController {
      */
      */
     @Anonymous
     @Anonymous
     @Auth
     @Auth
+    @Transactional(rollbackFor = Exception.class)
     @GetMapping("/completeOrder")
     @GetMapping("/completeOrder")
     public AjaxResult completeOrder(@RequestHeader String token, @RequestParam Long id) {
     public AjaxResult completeOrder(@RequestHeader String token, @RequestParam Long id) {
         PosOrder order = posOrderService.getOne(new LambdaQueryWrapper<PosOrder>().eq(PosOrder::getId, id));
         PosOrder order = posOrderService.getOne(new LambdaQueryWrapper<PosOrder>().eq(PosOrder::getId, id));

+ 2 - 0
ruoyi-admin/src/main/java/com/ruoyi/app/order/UserOrderController.java

@@ -479,6 +479,7 @@ public class UserOrderController extends BaseController {
     /**
     /**
      * 确认取餐(自取类型订单,state=2 → state=3)
      * 确认取餐(自取类型订单,state=2 → state=3)
      */
      */
+    @Transactional(rollbackFor = Exception.class)
     @GetMapping("/confirmPickup")
     @GetMapping("/confirmPickup")
     @Auth
     @Auth
     @Anonymous
     @Anonymous
@@ -520,6 +521,7 @@ public class UserOrderController extends BaseController {
     /**
     /**
      * 用户确认完成外送订单(骑手已送达后,state=2 → state=3)
      * 用户确认完成外送订单(骑手已送达后,state=2 → state=3)
      */
      */
+    @Transactional(rollbackFor = Exception.class)
     @GetMapping("/confirmDelivery")
     @GetMapping("/confirmDelivery")
     @Auth
     @Auth
     @Anonymous
     @Anonymous

+ 3 - 3
ruoyi-admin/src/main/resources/application.yml

@@ -10,7 +10,7 @@ ruoyi:
   demoEnabled: true
   demoEnabled: true
 
 
 #  profile: D:/ruoyi/uploadPath
 #  profile: D:/ruoyi/uploadPath
-  profile: /www/wwwroot/foodieapi.waimai-paotui.com/uploadPath
+  profile: /www/wwwroot/foodie-server/uploadPath
 
 
   # 获取ip地址开关
   # 获取ip地址开关
   addressEnabled: false
   addressEnabled: false
@@ -38,7 +38,7 @@ newebpay:
 # IM 即时沟通配置
 # IM 即时沟通配置
 im:
 im:
   # IM 平台根地址(测试环境 test-im.abtim-my.com;正式环境另行配置)
   # IM 平台根地址(测试环境 test-im.abtim-my.com;正式环境另行配置)
-  base-url: https://test-im.abtim-my.com
+  base-url: https://im.abtim-my.com
   # 平台级鉴权令牌(extToken)
   # 平台级鉴权令牌(extToken)
   ext-token: 92a88467-6eca-11f1-9dd5-00163e1eec55
   ext-token: 92a88467-6eca-11f1-9dd5-00163e1eec55
   # 创建用户接口路径
   # 创建用户接口路径
@@ -49,7 +49,7 @@ im:
 # 开发环境配置
 # 开发环境配置
 server:
 server:
   # 服务器的HTTP端口,默认为8080
   # 服务器的HTTP端口,默认为8080
-  port: 8082
+  port: 8080
   servlet:
   servlet:
     # 应用的访问路径
     # 应用的访问路径
     context-path: /
     context-path: /

Некоторые файлы не были показаны из-за большого количества измененных файлов