api/src/main/java/com/ruoyi/api/third/controller/LockerApiController.java
@@ -10,6 +10,8 @@ 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; @@ -34,6 +36,8 @@ private IKeyCollectionInfoService keyCollectionInfoService; @Autowired private IRequestLogService logService; @Autowired private ITmsCarKeyDispatchService tmsCarKeyDispatchService; /** * 上报取出审核 @@ -58,14 +62,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 +77,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; service/src/main/java/com/ruoyi/cwgl/service/IKeyCollectionInfoService.java
@@ -121,4 +121,6 @@ AjaxResult selectSmartLockerApplication(TakeReviewDto takeReviewDto); String selectCwBoxNum(String licensePlateNumber); String selectBoxNum(String licensePlateNumber); } service/src/main/java/com/ruoyi/cwgl/service/impl/KeyCollectionInfoServiceImpl.java
@@ -44,6 +44,7 @@ /** * 查询钥匙领取信息 * @@ -241,4 +242,9 @@ public String selectCwBoxNum(String licensePlateNumber) { return keyCollectionInfoMapper.selectCwBoxNum(licensePlateNumber); } @Override public String selectBoxNum(String licensePlateNumber) { return null; } } tms/src/main/java/com/ruoyi/tms/mapper/TmsCarKeyDispatchMapper.java
@@ -84,4 +84,6 @@ * @return 结果 */ public int deleteTmsCarKeyDispatchByIds(Integer[] ids); TmsCarKeyDispatch selectTmsCarKeyDispatchdriverMobile(String driverCode); } tms/src/main/java/com/ruoyi/tms/service/ITmsCarKeyDispatchService.java
@@ -1,6 +1,8 @@ package com.ruoyi.tms.service; import java.util.List; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.tms.domain.TmsCarKeyDispatch; import com.baomidou.mybatisplus.extension.service.IService; /** @@ -99,4 +101,8 @@ * @return 结果 */ public int deleteTmsCarKeyDispatchById(Integer id); TmsCarKeyDispatch selectTmsCarKeyDispatchdriverMobile(String driverCode); AjaxResult takeReview(TmsCarKeyDispatch tmsCarKeyDispatch); } tms/src/main/java/com/ruoyi/tms/service/impl/TmsCarKeyDispatchServiceImpl.java
@@ -1,9 +1,13 @@ package com.ruoyi.tms.service.impl; import java.util.Date; import java.util.List; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.DateUtils; import javax.annotation.Resource; import com.ruoyi.common.utils.StringUtils; import org.springframework.transaction.annotation.Transactional; import org.springframework.stereotype.Service; import org.springframework.scheduling.annotation.Async; @@ -179,4 +183,30 @@ { return tmsCarKeyDispatchMapper.deleteTmsCarKeyDispatchById(id); } @Override public TmsCarKeyDispatch selectTmsCarKeyDispatchdriverMobile(String driverCode) { return tmsCarKeyDispatchMapper.selectTmsCarKeyDispatchdriverMobile(driverCode); } @Override public AjaxResult takeReview(TmsCarKeyDispatch tmsCarKeyDispatch) { if (tmsCarKeyDispatch == null) { return AjaxResult.error("查无符合要求的调度单,请联系调度人员",3); } if (StringUtils.isEmpty(tmsCarKeyDispatch.getVehicleCarKeyNo())){ return AjaxResult.error("车钥匙柜号为空,请联系调度人员",3); } tmsCarKeyDispatch.setStatus(1); tmsCarKeyDispatch.setCarKeyCollectionTime(new Date()); tmsCarKeyDispatchMapper.updateTmsCarKeyDispatch(tmsCarKeyDispatch); AjaxResult success = new AjaxResult(0, "成功",1); success.put("boxNumber",tmsCarKeyDispatch.getVehicleCarKeyNo()); logger.info("成功返回{}",success); return success; } } tms/src/main/resources/mapper/tms/TmsCarKeyDispatchMapper.xml
@@ -62,6 +62,15 @@ </where> order by thisTab.id desc </select> <select id="selectTmsCarKeyDispatchdriverMobile" resultMap="TmsCarKeyDispatchResult"> <include refid="selectTmsCarKeyDispatchVo"/> WHERE thisTab.driver_mobile = #{driverCode} AND thisTab.status = 0 AND thisTab.car_key_expiration_time <= NOW() limit 1 </select> <!-- 新增 --> <insert id="insertTmsCarKeyDispatch" parameterType="com.ruoyi.tms.domain.TmsCarKeyDispatch" useGeneratedKeys="true" keyProperty="id">