From 2ab42edae9d271f5f464b7be475e217752dacb38 Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期三, 22 四月 2026 09:24:47 +0800
Subject: [PATCH] 代码生成

---
 server/services/src/main/java/com/doumee/service/business/impl/OrdersServiceImpl.java |  100 +++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 87 insertions(+), 13 deletions(-)

diff --git a/server/services/src/main/java/com/doumee/service/business/impl/OrdersServiceImpl.java b/server/services/src/main/java/com/doumee/service/business/impl/OrdersServiceImpl.java
index e4f0227..01df4f5 100644
--- a/server/services/src/main/java/com/doumee/service/business/impl/OrdersServiceImpl.java
+++ b/server/services/src/main/java/com/doumee/service/business/impl/OrdersServiceImpl.java
@@ -294,7 +294,7 @@
             return BigDecimal.ZERO;
         }
         String rateStr = systemDictDataBiz.queryByCode(Constants.OPERATION_CONFIG, Constants.OP_INSURANCE_RATE).getCode();
-        BigDecimal rate = new BigDecimal(rateStr);
+        BigDecimal rate = new BigDecimal(rateStr).divide(new BigDecimal("100"), 4, BigDecimal.ROUND_HALF_UP);
         return declaredValue.multiply(rate).setScale(2, BigDecimal.ROUND_HALF_UP);
     }
 
@@ -342,9 +342,11 @@
         List<Category> categories = categoryMapper.selectBatchIds(categoryIds);
         Map<Integer, String> categoryNameMap = new HashMap<>();
         Map<Integer, String> categoryDetailMap = new HashMap<>();
+        Map<Integer, String> categoryOtherFieldMap = new HashMap<>();
         for (Category c : categories) {
             categoryNameMap.put(c.getId(), c.getName());
             categoryDetailMap.put(c.getId(), c.getDetail());
+            categoryOtherFieldMap.put(c.getId(),c.getOtherField());
         }
 
         // 璁$畻姣忛」鐗╁搧璐圭敤锛氬皬璁� = 鍗曚环 脳 鏁伴噺 脳 澶╂暟
@@ -364,7 +366,7 @@
             ItemPriceVO vo = new ItemPriceVO();
             vo.setCategoryId(item.getCategoryId());
             vo.setCategoryName(categoryNameMap.getOrDefault(item.getCategoryId(), ""));
-            vo.setDetail(categoryDetailMap.get(item.getCategoryId()));
+            vo.setDetail(categoryOtherFieldMap.get(item.getCategoryId()));
             vo.setQuantity(item.getQuantity());
             vo.setUnitPrice(unitPrice);
             vo.setLocallyPrice(unitPrice);
@@ -462,9 +464,11 @@
         List<Category> categories = categoryMapper.selectBatchIds(categoryIds);
         Map<Integer, String> categoryNameMap = new HashMap<>();
         Map<Integer, String> categoryDetailMap = new HashMap<>();
+        Map<Integer, String> categoryOtherFieldMap = new HashMap<>();
         for (Category c : categories) {
             categoryNameMap.put(c.getId(), c.getName());
             categoryDetailMap.put(c.getId(), c.getDetail());
+            categoryOtherFieldMap.put(c.getId(),c.getOtherField());
         }
 
         // 3. 閫愰」璁$畻杩愯垂锛氳捣姝ヤ环 + 瓒呭嚭閮ㄥ垎闃舵浠�
@@ -503,7 +507,7 @@
             ItemPriceVO vo = new ItemPriceVO();
             vo.setCategoryId(item.getCategoryId());
             vo.setCategoryName(categoryNameMap.getOrDefault(item.getCategoryId(), ""));
-            vo.setDetail(categoryDetailMap.get(item.getCategoryId()));
+            vo.setDetail(categoryOtherFieldMap.get(item.getCategoryId()));
             vo.setQuantity(item.getQuantity());
             vo.setUnitPrice(unitPrice);
             vo.setLocallyPrice(locallyPrice);
@@ -1189,9 +1193,9 @@
                 item.setLuggageName(d.getLuggageName());
                 item.setLuggageDetail(d.getLuggageDetail());
                 item.setNum(d.getNum());
-                double unitPriceYuan = d.getUnitPrice() != null ? Constants.getFormatMoney(d.getUnitPrice()) : 0;
-                item.setUnitPriceYuan(unitPriceYuan);
-                item.setSubtotal(unitPriceYuan * (d.getNum() != null ? d.getNum() : 0));
+                long unitPriceFen = d.getUnitPrice() != null ? d.getUnitPrice() : 0L;
+                item.setUnitPrice(unitPriceFen);
+                item.setSubtotal(unitPriceFen * (d.getNum() != null ? d.getNum() : 0));
                 items.add(item);
             }
         }
@@ -1375,16 +1379,22 @@
                 vo.setCode(o.getCode());
                 vo.setType(o.getType());
                 vo.setStatus(o.getStatus());
+                vo.setStatusName(Constants.OrderStatus.getDescByKey(o.getStatus(),
+                        Constants.equalsInteger(o.getType(), Constants.ZERO)?o.getType():Objects.nonNull(o.getTakeShopId())?Constants.ONE:Constants.TWO)
+                );
                 vo.setCreateTime(o.getCreateTime());
                 vo.setExpectedTakeTime(o.getExpectedTakeTime());
+                vo.setMemberVerifyCode(o.getMemberVerifyCode());
 
                 // 瀛樹欢闂ㄥ簵锛堝叧鑱旀煡璇㈢洿鎺ュ彇鍊硷級
+                vo.setDepositShopId(o.getDepositShopId());
                 vo.setDepositShopName(o.getDepositShopName());
                 vo.setDepositShopLinkName(o.getDepositShopLinkName());
                 vo.setDepositShopPhone(o.getDepositShopLinkPhone());
 
                 // 鍙栦欢淇℃伅锛氭湁鍙栦欢闂ㄥ簵鍙栭棬搴楋紝鏃犲垯鍙栫敤鎴疯嚜閫夊彇浠剁偣
                 if (o.getTakeShopId() != null) {
+                    vo.setTakeShopId(o.getTakeShopId());
                     vo.setTakeShopName(o.getTakeShopName());
                     vo.setTakeShopAddress(o.getTakeShopAddress());
                 } else {
@@ -1399,6 +1409,9 @@
                 // 璐圭敤锛堝垎锛�
                 vo.setDeclaredFee(o.getDeclaredFee());
                 vo.setEstimatedAmount(o.getEstimatedAmount());
+
+                // 璇勪环鐘舵��
+                vo.setCommentStatus(o.getCommentStatus());
 
                 // 鏌ヨ鐗╁搧鏄庣粏锛堜竴娆℃煡璇紝鍚屾椂鐢ㄤ簬鐗╁搧鍒楄〃鍜岄�炬湡璁$畻锛�
                 List<OrdersDetail> details = ordersDetailMapper.selectList(
@@ -1472,6 +1485,9 @@
                 vo.setCode(o.getCode());
                 vo.setType(o.getType());
                 vo.setStatus(o.getStatus());
+                vo.setStatusName(Constants.OrderStatus.getDescByKey(o.getStatus(),
+                        Constants.equalsInteger(o.getType(), Constants.ZERO)?o.getType():Objects.nonNull(o.getTakeShopId())?Constants.ONE:Constants.TWO)
+                );
                 vo.setCreateTime(o.getCreateTime());
                 vo.setExpectedTakeTime(o.getExpectedTakeTime());
 
@@ -1687,11 +1703,6 @@
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
 
-        // 浠呭紓鍦板瘎瀛樺彲鍙栨秷
-        if (!Constants.equalsInteger(order.getType(), Constants.ONE)) {
-            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "浠呭紓鍦板瘎瀛樿鍗曞彲鍙栨秷");
-        }
-
         Integer status = order.getStatus();
         if (status == null) {
             throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "璁㈠崟鐘舵�佸紓甯�");
@@ -1699,7 +1710,7 @@
 
         Date now = new Date();
 
-        // 寰呮敮浠橈細鐩存帴鍙栨秷
+        // 寰呮敮浠橈細鐩存帴鍙栨秷锛堜笉闄愯鍗曠被鍨嬶級
         if (Constants.equalsInteger(status, Constants.OrderStatus.waitPay.getStatus())) {
             order.setStatus(Constants.OrderStatus.cancelled.getStatus());
             order.setCancelTime(now);
@@ -1708,7 +1719,7 @@
             return;
         }
 
-        // 寰呭瘎瀛橈細鐩存帴鍙栨秷锛屽叏棰濋��娆�
+        // 寰呭瘎瀛橈細鐩存帴鍙栨秷锛屽叏棰濋��娆撅紙涓嶉檺璁㈠崟绫诲瀷锛�
         if (Constants.equalsInteger(status, Constants.OrderStatus.waitDeposit.getStatus())) {
             // 璁板綍閫�娆句俊鎭�
             OrdersRefund refund = new OrdersRefund();
@@ -1737,6 +1748,11 @@
             return;
         }
 
+        // 宸插瘎瀛�/宸叉帴鍗曪細浠呭紓鍦板瘎瀛樺彲鍙栨秷
+        if (!Constants.equalsInteger(order.getType(), Constants.ONE)) {
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "浠呭紓鍦板瘎瀛樿鍗曞彲鍙栨秷");
+        }
+
         // 宸插瘎瀛�/宸叉帴鍗曪細杩涘叆鍙栨秷涓姸鎬�
         if (Constants.equalsInteger(status, Constants.OrderStatus.deposited.getStatus())
                 || Constants.equalsInteger(status, Constants.OrderStatus.accepted.getStatus())) {
@@ -1747,6 +1763,11 @@
             // 閫氱煡瀛樹欢闂ㄥ簵锛氶��娆剧敵璇�
             if (order.getDepositShopId() != null) {
                 sendShopNotice(order.getDepositShopId(), Constants.ShopOrderNotify.REFUNDING, orderId,
+                        "orderNo", order.getCode());
+            }
+            // 閫氱煡鍙告満锛氳鍗曢��娆句腑锛堝凡鎺ュ崟鎯呭喌涓嬪徃鏈洪渶鍋滄鏈嶅姟锛�
+            if (order.getAcceptDriver() != null && Constants.equalsInteger(order.getStatus(), Constants.OrderStatus.accepted.getStatus())) {
+                sendDriverNotice(order.getAcceptDriver(), Constants.DriverOrderNotify.REFUNDING, orderId,
                         "orderNo", order.getCode());
             }
             return;
@@ -1833,6 +1854,27 @@
         if (order.getTakeShopId() != null) {
             sendShopNotice(order.getTakeShopId(), notify, order.getId(), params);
         }
+    }
+
+    /**
+     * 鍙戦�佸徃鏈虹珯鍐呬俊閫氱煡
+     */
+    private void sendDriverNotice(Integer driverId, Constants.DriverOrderNotify notify, Integer orderId, String... params) {
+        DriverInfo driver = driverInfoMapper.selectById(driverId);
+        if (driver == null || driver.getMemberId() == null) {
+            return;
+        }
+        Notice notice = new Notice();
+        notice.setUserType(1); // 1=鍙告満
+        notice.setUserId(driver.getMemberId());
+        notice.setTitle(notify.getTitle());
+        notice.setContent(notify.format(params));
+        notice.setObjId(orderId);
+        notice.setObjType(0); // 0=璁㈠崟
+        notice.setStatus(0);  // 0=鏈
+        notice.setIsdeleted(Constants.ZERO);
+        notice.setCreateDate(new Date());
+        noticeService.create(notice);
     }
 
     @Override
@@ -2178,6 +2220,14 @@
                     "orderNo", order.getCode(),
                     "amount", String.valueOf(Constants.getFormatMoney(
                             order.getTotalAmount() != null ? order.getTotalAmount() : 0L)));
+
+            // 閫氱煡鍙告満锛氳鍗曞凡缁撶畻
+            if (order.getAcceptDriver() != null) {
+                sendDriverNotice(order.getAcceptDriver(), Constants.DriverOrderNotify.SETTLED, order.getId(),
+                        "orderNo", order.getCode(),
+                        "amount", String.valueOf(Constants.getFormatMoney(
+                                order.getDriverFee() != null ? order.getDriverFee() : 0L)));
+            }
         }
     }
 
@@ -2282,6 +2332,12 @@
         // 閫氱煡瀛樹欢闂ㄥ簵鍜屽彇浠堕棬搴楋細璁㈠崟宸茶瘎浠�
         notifyBothShops(order, Constants.ShopOrderNotify.EVALUATED,
                 "orderNo", order.getCode());
+
+        // 閫氱煡鍙告満锛氳鍗曞凡璇勪环
+        if (order.getAcceptDriver() != null) {
+            sendDriverNotice(order.getAcceptDriver(), Constants.DriverOrderNotify.EVALUATED, order.getId(),
+                    "orderNo", order.getCode());
+        }
     }
 
     /**
@@ -2424,6 +2480,12 @@
             notifyBothShops(order, Constants.ShopOrderNotify.FINISHED,
                     "orderNo", order.getCode(),
                     "settleDays", settleDays != null ? settleDays : "7");
+            // 閫氱煡鍙告満锛氳鍗曞凡瀹屾垚
+            if (order.getAcceptDriver() != null) {
+                sendDriverNotice(order.getAcceptDriver(), Constants.DriverOrderNotify.FINISHED, order.getId(),
+                        "orderNo", order.getCode(),
+                        "settleDays", settleDays != null ? settleDays : "7");
+            }
         } else {
             throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "褰撳墠璁㈠崟鐘舵�佷笉鍏佽鏍搁攢");
         }
@@ -2529,6 +2591,12 @@
         notifyBothShops(order, Constants.ShopOrderNotify.FINISHED,
                 "orderNo", order.getCode(),
                 "settleDays", settleDays != null ? settleDays : "7");
+        // 閫氱煡鍙告満锛氳鍗曞凡瀹屾垚
+        if (order.getAcceptDriver() != null) {
+            sendDriverNotice(order.getAcceptDriver(), Constants.DriverOrderNotify.FINISHED, order.getId(),
+                    "orderNo", order.getCode(),
+                    "settleDays", settleDays != null ? settleDays : "7");
+        }
     }
 
     @Override
@@ -2575,6 +2643,12 @@
         notifyBothShops(order, Constants.ShopOrderNotify.FINISHED,
                 "orderNo", order.getCode(),
                 "settleDays", settleDays != null ? settleDays : "7");
+        // 閫氱煡鍙告満锛氳鍗曞凡瀹屾垚
+        if (order.getAcceptDriver() != null) {
+            sendDriverNotice(order.getAcceptDriver(), Constants.DriverOrderNotify.FINISHED, order.getId(),
+                    "orderNo", order.getCode(),
+                    "settleDays", settleDays != null ? settleDays : "7");
+        }
     }
 
     @Override

--
Gitblit v1.9.3