wujianwei
5 天以前 98d00448989d01cef0e714cfc528ff31011a86b3
api/src/main/java/com/ruoyi/api/third/controller/LockerApiController.java
@@ -1,15 +1,13 @@
package com.ruoyi.api.third.controller;
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;
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;
@@ -17,7 +15,6 @@
import javax.validation.Valid;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
/**
@@ -34,6 +31,8 @@
    private IKeyCollectionInfoService keyCollectionInfoService;
    @Autowired
    private IRequestLogService logService;
    @Autowired
    private ITmsCarKeyDispatchService tmsCarKeyDispatchService;
    /**
     * 上报取出审核
@@ -58,14 +57,14 @@
            return success;
        }
        KeyCollectionInfo keyCollectionInfo = keyCollectionInfoService.selectCwData(takeReviewDto);
        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);
@@ -73,19 +72,10 @@
        requestLog.setType(0);
        logService.insertRequestLog(requestLog);
        AjaxResult ajaxResult = keyCollectionInfoService.takeReview(keyCollectionInfo);
        AjaxResult ajaxResult = tmsCarKeyDispatchService.takeReview(tmsCarKeyDispatch);
        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;
@@ -99,10 +89,11 @@
    @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);