From 98d00448989d01cef0e714cfc528ff31011a86b3 Mon Sep 17 00:00:00 2001
From: wujianwei <wjw@11.com>
Date: 星期四, 11 十二月 2025 15:39:17 +0800
Subject: [PATCH] 修改归还上报查询司机名字

---
 api/src/main/java/com/ruoyi/api/third/controller/LockerApiController.java |   37 +++++++++++++++++++++++++++++--------
 1 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/api/src/main/java/com/ruoyi/api/third/controller/LockerApiController.java b/api/src/main/java/com/ruoyi/api/third/controller/LockerApiController.java
index 1e67639..aa6315f 100644
--- a/api/src/main/java/com/ruoyi/api/third/controller/LockerApiController.java
+++ b/api/src/main/java/com/ruoyi/api/third/controller/LockerApiController.java
@@ -1,20 +1,20 @@
 package com.ruoyi.api.third.controller;
 
 import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.cwgl.domain.KeyCollectionInfo;
 import com.ruoyi.cwgl.domain.RequestLog;
 import com.ruoyi.cwgl.domain.dto.ReturnReportDto;
 import com.ruoyi.cwgl.domain.dto.TakeReviewDto;
 import com.ruoyi.cwgl.service.IKeyCollectionInfoService;
 import com.ruoyi.cwgl.service.IRequestLogService;
+import com.ruoyi.tms.domain.TmsCarKeyDispatch;
+import com.ruoyi.tms.service.ITmsCarKeyDispatchService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
+import java.util.Random;
 
 
 /**
@@ -31,6 +31,8 @@
     private IKeyCollectionInfoService keyCollectionInfoService;
     @Autowired
     private IRequestLogService logService;
+    @Autowired
+    private ITmsCarKeyDispatchService tmsCarKeyDispatchService;
 
     /**
      * 涓婃姤鍙栧嚭瀹℃牳
@@ -44,21 +46,38 @@
     public AjaxResult takeReview(@Valid @RequestBody TakeReviewDto takeReviewDto){
 
         logger.info("璇锋眰涓婃姤鍙傛暟{}",takeReviewDto);
-        KeyCollectionInfo keyCollectionInfo = keyCollectionInfoService.selectCwData(takeReviewDto);
+        if ("test".equals(takeReviewDto.getDriverCode())){
+            Random random = new Random();
+
+            // 鐢熸垚 1-30 鐨勯殢鏈烘暣鏁�
+            int randomNumber = random.nextInt(30) + 1;
+            AjaxResult success = new AjaxResult(0, "鎴愬姛",1);
+            success.put("boxNumber",randomNumber);
+            logger.info("鎴愬姛杩斿洖{}",success);
+            return success;
+        }
+
+        TmsCarKeyDispatch tmsCarKeyDispatch = tmsCarKeyDispatchService.selectTmsCarKeyDispatchdriverMobile(takeReviewDto.getDriverCode());
         //娣诲姞璇锋眰鏃ュ織
         RequestLog requestLog = new RequestLog();
         requestLog.setDriverCode(takeReviewDto.getDriverCode());
         requestLog.setDriverName(takeReviewDto.getDriverName());
         requestLog.setReqTime(takeReviewDto.getHandleTime());
-        if (keyCollectionInfo!=null){
-        String boxNum = keyCollectionInfo.getBoxNum();
+        if (tmsCarKeyDispatch!=null){
+        String boxNum = tmsCarKeyDispatch.getVehicleCarKeyNo();
             requestLog.setBoxNum(boxNum);
+
 
         }
         requestLog.setType(0);
         logService.insertRequestLog(requestLog);
 
-        return keyCollectionInfoService.takeReview(keyCollectionInfo);
+        AjaxResult ajaxResult = tmsCarKeyDispatchService.takeReview(tmsCarKeyDispatch);
+        if (!ajaxResult.get("code").equals(0)){
+            ajaxResult =  keyCollectionInfoService.selectSmartLockerApplication(takeReviewDto);
+
+        }
+        return ajaxResult;
 
 
     }
@@ -69,10 +88,12 @@
 
     @PostMapping("/returnReport")
     public AjaxResult returnReport(@Valid @RequestBody ReturnReportDto returnReportDto){
-
+        logger.info("褰掕繕鍙傛暟{}",returnReportDto);
+        String name =keyCollectionInfoService.selectNameByMobile(returnReportDto.getDriverCode());
         //娣诲姞璇锋眰鏃ュ織
         RequestLog requestLog = new RequestLog();
         requestLog.setDriverCode(returnReportDto.getDriverCode());
+        requestLog.setDriverName(name);
         requestLog.setBoxNum(returnReportDto.getBoxNum());
         requestLog.setReqTime(returnReportDto.getSaveTime());
         requestLog.setType(1);

--
Gitblit v1.8.0