From abb51ab390fa6cf9bf3747f57576c1507f89ae00 Mon Sep 17 00:00:00 2001 From: wujianwei <wjw@11.com> Date: 星期五, 05 九月 2025 17:59:19 +0800 Subject: [PATCH] 修改接口 --- api/src/main/java/com/ruoyi/api/third/controller/LockerApiController.java | 24 +++++++++++++++++++++++- 1 files changed, 23 insertions(+), 1 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..986cdb2 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,12 +46,29 @@ @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); @@ -62,6 +83,7 @@ @PostMapping("/returnReport") public AjaxResult returnReport(@Valid @RequestBody ReturnReportDto returnReportDto){ + logger.info("褰掕繕鍙傛暟{}",returnReportDto); //娣诲姞璇锋眰鏃ュ織 RequestLog requestLog = new RequestLog(); @@ -71,7 +93,7 @@ requestLog.setType(1); logService.insertRequestLog(requestLog); - return AjaxResult.success(); + return new AjaxResult(0, "",0); } -- Gitblit v1.8.0