From 6b2911c978031864d047f49a8c363cde85bfd206 Mon Sep 17 00:00:00 2001
From: wujianwei <wjw@11.com>
Date: 星期一, 29 九月 2025 10:42:40 +0800
Subject: [PATCH] 新增时间范围查询

---
 api/src/main/java/com/ruoyi/api/third/controller/LockerApiController.java |   41 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 39 insertions(+), 2 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 e924d06..88c6763 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
@@ -2,6 +2,8 @@
 
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.RandomUtils;
+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;
@@ -14,6 +16,8 @@
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
+import java.util.Random;
+import java.util.concurrent.ThreadLocalRandom;
 
 
 /**
@@ -42,16 +46,48 @@
     @PostMapping("/takeReview")
     public AjaxResult takeReview(@Valid @RequestBody TakeReviewDto takeReviewDto){
 
+        logger.info("璇锋眰涓婃姤鍙傛暟{}",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;
+        }
+
         KeyCollectionInfo keyCollectionInfo = keyCollectionInfoService.selectCwData(takeReviewDto);
         //娣诲姞璇锋眰鏃ュ織
         RequestLog requestLog = new RequestLog();
         requestLog.setDriverCode(takeReviewDto.getDriverCode());
         requestLog.setDriverName(takeReviewDto.getDriverName());
         requestLog.setReqTime(takeReviewDto.getHandleTime());
+        if (keyCollectionInfo!=null){
+        String boxNum = keyCollectionInfo.getBoxNum();
+            requestLog.setBoxNum(boxNum);
+
+
+        }
         requestLog.setType(0);
         logService.insertRequestLog(requestLog);
 
-        return keyCollectionInfoService.takeReview(keyCollectionInfo);
+        AjaxResult ajaxResult = keyCollectionInfoService.takeReview(keyCollectionInfo);
+        if (!ajaxResult.get("code").equals(0)){
+            ajaxResult =  keyCollectionInfoService.selectSmartLockerApplication(takeReviewDto);
+
+        }else {
+            if (keyCollectionInfo != null) {
+                String boxNum = (String) ajaxResult.get("boxNumber");
+                if (StringUtils.isEmpty(boxNum) || (Integer.parseInt(boxNum) < 1 && Integer.parseInt(boxNum) > 60)) {
+                    boxNum = keyCollectionInfoService.selectCwBoxNum(keyCollectionInfo.getLicensePlateNumber());
+                    ajaxResult.put("boxNumber",boxNum);
+                }
+
+            }
+        }
+        return ajaxResult;
 
 
     }
@@ -62,6 +98,7 @@
 
     @PostMapping("/returnReport")
     public AjaxResult returnReport(@Valid @RequestBody ReturnReportDto returnReportDto){
+        logger.info("褰掕繕鍙傛暟{}",returnReportDto);
 
         //娣诲姞璇锋眰鏃ュ織
         RequestLog requestLog = new RequestLog();
@@ -71,7 +108,7 @@
         requestLog.setType(1);
         logService.insertRequestLog(requestLog);
 
-        return AjaxResult.success();
+        return new AjaxResult(0, "",0);
 
 
     }

--
Gitblit v1.8.0