From 095210f9149c73e6e00d997b39fd6c44a65e4d38 Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期二, 28 四月 2026 22:04:17 +0800
Subject: [PATCH] 代码生成

---
 server/services/src/main/java/com/doumee/service/business/impl/DriverInfoServiceImpl.java |   68 +++++++++++++++++++--------------
 1 files changed, 39 insertions(+), 29 deletions(-)

diff --git a/server/services/src/main/java/com/doumee/service/business/impl/DriverInfoServiceImpl.java b/server/services/src/main/java/com/doumee/service/business/impl/DriverInfoServiceImpl.java
index 6617be5..7d642a5 100644
--- a/server/services/src/main/java/com/doumee/service/business/impl/DriverInfoServiceImpl.java
+++ b/server/services/src/main/java/com/doumee/service/business/impl/DriverInfoServiceImpl.java
@@ -34,6 +34,8 @@
 import com.doumee.dao.vo.DriverCancelLimitVO;
 import com.doumee.dao.vo.DriverCenterVO;
 import com.doumee.dao.vo.DriverGrabOrderVO;
+import com.doumee.dao.system.model.SystemUser;
+import com.doumee.service.system.SystemUserService;
 import com.doumee.dao.vo.DriverOrderDetailVO;
 import com.doumee.core.utils.aliyun.AliSmsService;
 import com.doumee.service.business.DriverInfoService;
@@ -115,6 +117,9 @@
 
     @Autowired
     private AreasBizImpl areasBiz;
+
+    @Autowired
+    private SystemUserService systemUserService;
 
     /**
      * 鍙戦�佽鍗曠珯鍐呬俊閫氱煡
@@ -270,13 +275,7 @@
                 .select(" ( select ifnull(sum(r.OPT_TYPE * r.AMOUNT),0) from revenue r where r.MEMBER_TYPE = 1 and r.MEMBER_ID= t.id and r.VAILD_STATUS = 1 ) as memberAmount ")
                 .selectAs(Category::getName,DriverInfo::getCarTypeName)
                 .leftJoin(Category.class, Category::getId,DriverInfo::getCarType);
-        for (PageWrap.SortData sortData : pageWrap.getSorts()) {
-            if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
-                queryWrapper.orderByDesc(sortData.getProperty());
-            } else {
-                queryWrapper.orderByAsc(sortData.getProperty());
-            }
-        }
+        queryWrapper.orderByDesc(DriverInfo::getId);
         PageData<DriverInfo> pageData = PageData.from(driverInfoMapper.selectPage(page, queryWrapper));
         for (DriverInfo d : pageData.getRecords()) {
             d.setGender(Constants.getGenderByIdCard(d.getIdcard()));
@@ -301,7 +300,7 @@
         String code = RandomStringUtils.randomNumeric(6);
         // 鍙戦�佺煭淇�
         String templateParam = "{\"code\":\"" + code + "\"}";
-        AliSmsService.sendSms(telephone, "SMS_491325122", templateParam);
+        AliSmsService.sendSms(telephone, Constants.SmsNotify.VERIFY_CODE.getTemplateCode(), templateParam);
         // 淇濆瓨鐭俊璁板綍
         Smsrecord smsrecord = new Smsrecord();
         smsrecord.setDeleted(Constants.ZERO);
@@ -716,6 +715,17 @@
                 }
             }
         }
+        // 鏌ヨ瀹℃壒浜哄悕绉�
+        if (driverInfo.getAuditUser() != null) {
+            try {
+                SystemUser auditUser = systemUserService.findById(driverInfo.getAuditUser());
+                if (auditUser != null) {
+                    driverInfo.setAuditUserName(auditUser.getRealname());
+                }
+            } catch (Exception e) {
+                // 瀹℃壒浜哄凡鍒犻櫎绛夊紓甯稿拷鐣�
+            }
+        }
         return driverInfo;
     }
 
@@ -812,6 +822,7 @@
         vo.setCarCode(driver.getCarCode());
         vo.setScore(driver.getScore() != null ? driver.getScore().toPlainString() : "0");
         vo.setDriverLevel(driver.getDriverLevel());
+        vo.setDriverLevelName(Constants.getDriverLevelName(driver.getDriverLevel()));
         vo.setAuditStatus(driver.getAuditStatus());
         vo.setAuditRemark(driver.getAuditRemark());
         vo.setBalance(driver.getBalance() != null ? driver.getBalance() : 0L);
@@ -823,7 +834,7 @@
             vo.setFullImgUrl(imgPrefix + driver.getImgurl());
         }
 
-        // 浠婃棩棰勮浣i噾锛歳evenue琛ㄤ腑浠婂ぉ鐨勬敹鍏ヨ褰曢噾棰濅箣鍜�
+        // 浠婃棩棰勮浣i噾锛氫粖鏃ユ帴鍗曠殑鍙告満浣i噾 + 骞冲彴濂栧姳閲�
         Date now = new Date();
         Calendar cal = Calendar.getInstance();
         cal.setTime(now);
@@ -833,16 +844,16 @@
         cal.set(Calendar.MILLISECOND, 0);
         Date todayStart = cal.getTime();
 
-        QueryWrapper<Revenue> revenueWrapper = new QueryWrapper<>();
-        revenueWrapper.lambda()
-                .eq(Revenue::getMemberId, memberId)
-                .eq(Revenue::getMemberType, Constants.ONE)
-                .eq(Revenue::getOptType, Constants.ONE)
-                .eq(Revenue::getDeleted, Constants.ZERO)
-                .ge(Revenue::getCreateTime, todayStart);
-        revenueWrapper.select("IFNULL(SUM(AMOUNT),0) as amount");
-        Revenue sumResult = revenueMapper.selectOne(revenueWrapper);
-        vo.setTodayCommission(sumResult != null && sumResult.getAmount() != null ? sumResult.getAmount() : 0L);
+        QueryWrapper<Orders> commissionWrapper = new QueryWrapper<>();
+        commissionWrapper.lambda()
+                .eq(Orders::getAcceptDriver, driver.getId())
+                .eq(Orders::getDeleted, Constants.ZERO)
+                .ge(Orders::getAcceptTime, todayStart);
+        commissionWrapper.select("IFNULL(SUM(DRIVER_FEE),0) as driverFee", "IFNULL(SUM(PLATFORM_REWARD_AMOUNT),0) as platformRewardAmount");
+        Orders commissionResult = ordersMapper.selectOne(commissionWrapper);
+        long driverFee = commissionResult != null && commissionResult.getDriverFee() != null ? commissionResult.getDriverFee() : 0L;
+        long rewardAmount = commissionResult != null && commissionResult.getPlatformRewardAmount() != null ? commissionResult.getPlatformRewardAmount() : 0L;
+        vo.setTodayCommission(driverFee + rewardAmount);
 
         // 浠婃棩鎺ュ崟鏁帮細浠婂ぉ瀹屾垚鐨勮鍗曟暟锛坅cceptDriver=鍙告満涓婚敭锛岀姸鎬�=宸插畬鎴愶級
         Long todayOrderCount = ordersMapper.selectCount(new QueryWrapper<Orders>().lambda()
@@ -966,7 +977,7 @@
                 .select("c2.other_field as c2OtherField")
                 .select("c2.name as goodLevelName")
                 // 鏄惁瀛樺湪鐗瑰ぇ灏哄
-                .select("IF(EXISTS(SELECT 1 FROM orders_detail od JOIN category c3 ON c3.id = od.LUGGAGE_ID AND c3.TYPE = 4 AND c3.OTHER_FIELD = '1' WHERE od.ORDER_ID = t.ID AND od.DELETED = 0), 1, 0) as hasOversized")
+                .select("IF(EXISTS(SELECT 1 FROM orders_detail od JOIN category c3 ON c3.id = od.LUGGAGE_ID AND c3.TYPE = 4 AND c3.detail = '1' WHERE od.ORDER_ID = t.ID AND od.DELETED = 0), 1, 0) as hasOversized")
                 // JOIN
                 .leftJoin("shop_info s1 on s1.id = t.DEPOSIT_SHOP_ID and s1.DELETED = 0")
                 .leftJoin("shop_info s2 on s2.id = t.TAKE_SHOP_ID and s2.DELETED = 0")
@@ -1418,6 +1429,7 @@
 
         // 7. 閫氱煡浼氬憳锛氬徃鏈哄凡鎶㈠崟
         sendOrderNotice(order.getMemberId(), Constants.MemberOrderNotify.WAIT_PICKUP_GRABBED, orderId,
+                "orderNo", order.getCode(),
                 "driverName", driver.getName());
 
         // 閫氱煡瀛樹欢闂ㄥ簵锛氳鍗曞凡鎶㈠崟寰呭彇浠�
@@ -1804,19 +1816,16 @@
             for (int i = 0; i < paramPairs.length - 1; i += 2) {
                 templateParam.put(paramPairs[i], paramPairs[i + 1]);
             }
-            boolean result = AliSmsService.sendSms(phone, smsNotify.getTemplateCode(),
+            String error = AliSmsService.sendSms(phone, smsNotify.getTemplateCode(),
                     templateParam.toJSONString());
-            if (result) {
-                log.info("鐭俊鍙戦�佹垚鍔�: phone={}, template={}", phone, smsNotify.name());
-            } else {
-                log.warn("鐭俊鍙戦�佸け璐�: phone={}, template={}", phone, smsNotify.name());
-            }
-            // 瀛樺偍鐭俊璁板綍
             Smsrecord record = new Smsrecord();
             record.setPhone(phone);
             record.setContent(content);
-            record.setType(Constants.ONE); // 1=璁㈠崟閫氱煡
-            record.setStatus(result ? Constants.ONE : Constants.ZERO);
+            record.setType(Constants.ONE);
+            record.setStatus(error == null ? Constants.ONE : Constants.ZERO);
+            if (error != null) {
+                record.setRemark(error);
+            }
             record.setCreateTime(new Date());
             record.setDeleted(Constants.ZERO);
             smsrecordMapper.insert(record);
@@ -1828,6 +1837,7 @@
                 record.setContent(content);
                 record.setType(Constants.ONE);
                 record.setStatus(Constants.ZERO);
+                record.setRemark(e.getMessage());
                 record.setCreateTime(new Date());
                 record.setDeleted(Constants.ZERO);
                 smsrecordMapper.insert(record);

--
Gitblit v1.9.3