From 2ca1013333bb1f80d104e54ac2e7171bd8dffc77 Mon Sep 17 00:00:00 2001 From: wujianwei <wjw@11.com> Date: 星期四, 18 九月 2025 18:02:00 +0800 Subject: [PATCH] 新增要求出发时间 --- api/src/main/java/com/ruoyi/api/third/controller/LockerApiController.java | 31 +++++++++++++++++++++++++++++-- 1 files changed, 29 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..0967161 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,38 @@ @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); + + } + return ajaxResult; } @@ -62,6 +88,7 @@ @PostMapping("/returnReport") public AjaxResult returnReport(@Valid @RequestBody ReturnReportDto returnReportDto){ + logger.info("褰掕繕鍙傛暟{}",returnReportDto); //娣诲姞璇锋眰鏃ュ織 RequestLog requestLog = new RequestLog(); @@ -71,7 +98,7 @@ requestLog.setType(1); logService.insertRequestLog(requestLog); - return AjaxResult.success(); + return new AjaxResult(0, "",0); } -- Gitblit v1.8.0