wujianwei
2025-08-27 74432331d7130a2d2798d0217ee9b688de55d811
新增前后端
8个文件已修改
4个文件已添加
268 ■■■■■ 已修改文件
admin/src/main/resources/application-custom.yml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/pom.xml 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/src/main/java/com/ruoyi/api/controller/LockerApiController.java 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/src/main/java/com/ruoyi/cwgl/domain/KeyCollectionInfo.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/src/main/java/com/ruoyi/cwgl/domain/RequestLog.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/src/main/java/com/ruoyi/cwgl/domain/dto/ReturnReportDto.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/src/main/java/com/ruoyi/cwgl/domain/dto/TakeReviewDto.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/src/main/java/com/ruoyi/cwgl/mapper/KeyCollectionInfoMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/src/main/java/com/ruoyi/cwgl/service/IKeyCollectionInfoService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/src/main/java/com/ruoyi/cwgl/service/impl/KeyCollectionInfoServiceImpl.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/src/main/resources/mapper/cwgl/KeyCollectionInfoMapper.xml 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/main/resources/application-custom.yml
@@ -83,6 +83,7 @@
      /captchaImage
      /actuator/**
      /*/api-docs
      /api/**
      /druid/**
      /webjars/**
      /swagger-resources/**
api/pom.xml
New file
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>manage</artifactId>
        <groupId>com.ruoyi</groupId>
        <version>master</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>api</artifactId>
    <dependencies>
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>api-remote</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>service</artifactId>
            <version>master</version>
        </dependency>
    </dependencies>
</project>
api/src/main/java/com/ruoyi/api/controller/LockerApiController.java
New file
@@ -0,0 +1,73 @@
package com.ruoyi.api.controller;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * 储物柜接口
 * @author wjw
 */
@RestController
@RequestMapping("/api/third/locker/")
public class LockerApiController {
    @Autowired
    private IKeyCollectionInfoService keyCollectionInfoService;
    @Autowired
    private IRequestLogService logService;
    /**
     * 上报取出审核
     */
    @PostMapping("takeReview")
    public AjaxResult takeReview(@RequestBody TakeReviewDto takeReviewDto){
        KeyCollectionInfo keyCollectionInfo = keyCollectionInfoService.selectCwData(takeReviewDto);
        //添加请求日志
        RequestLog requestLog = new RequestLog();
        requestLog.setDriverCode(takeReviewDto.getDriverCode());
        requestLog.setDriverName(takeReviewDto.getDriverName());
        requestLog.setReqTime(DateUtils.parseDate(takeReviewDto.getHandleTime()));
        requestLog.setType(0);
        logService.insertRequestLog(requestLog);
        return keyCollectionInfoService.takeReview(keyCollectionInfo);
    }
    /**
     * 归还上报
     */
    @PostMapping("returnReport")
    public AjaxResult returnReport(@RequestBody ReturnReportDto returnReportDto){
        //添加请求日志
        RequestLog requestLog = new RequestLog();
        requestLog.setDriverCode(returnReportDto.getDriverCode());
        requestLog.setBoxNum(returnReportDto.getBoxNum());
        requestLog.setReqTime(DateUtils.parseDate(returnReportDto.getSaveTime()));
        requestLog.setType(1);
        logService.insertRequestLog(requestLog);
        return AjaxResult.success();
    }
}
pom.xml
@@ -18,6 +18,7 @@
        <module>quartz</module>
        <module>common</module>
        <module>service</module>
        <module>api</module>
    </modules>
    <packaging>pom</packaging>
service/src/main/java/com/ruoyi/cwgl/domain/KeyCollectionInfo.java
@@ -161,5 +161,16 @@
    @TableField("remark")
    private String remark;
    /**
     * 调度超时下单,超时?个小时
     */
    @TableField(exist = false)
    private Integer schedulingTimeout;
    /**
     * '预计出发时间 & ord.ESTIMATED_DEPARTURE_TIME ,领取钥匙超时N个小时'
     */
    @TableField(exist = false)
    private Integer keyTimeout;
}
service/src/main/java/com/ruoyi/cwgl/domain/RequestLog.java
@@ -55,7 +55,7 @@
    /** 请求时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "请求时间", width = 30, dateFormat = "yyyy-MM-dd")
    @Excel(name = "请求时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @TableField("req_time")
    private Date reqTime;
service/src/main/java/com/ruoyi/cwgl/domain/dto/ReturnReportDto.java
New file
@@ -0,0 +1,24 @@
package com.ruoyi.cwgl.domain.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
 * 上报取出审核dto
 */
@Data
public class ReturnReportDto {
    /**柜门编号*/
    @NotBlank(message = "柜门编号不能为空")
    private  String boxNum ;
    /**司机唯一编号*/
    @NotBlank(message = "司机唯一编号不能为空")
    private  String driverCode ;
    /**司机唯一编号*/
    @NotBlank(message = "存入时间不能为空")
    private  String saveTime ;
}
service/src/main/java/com/ruoyi/cwgl/domain/dto/TakeReviewDto.java
New file
@@ -0,0 +1,24 @@
package com.ruoyi.cwgl.domain.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
 * 上报取出审核dto
 */
@Data
public class TakeReviewDto {
    /**司机唯一编号*/
    @NotBlank(message = "司机唯一编号不能为空")
    private  String driverCode ;
    /**司机姓名*/
    @NotBlank(message = "司机姓名不能为空")
    private  String driverName ;
    /**司机唯一编号*/
    @NotBlank(message = "请求开门时间不能为空")
    private  String handleTime ;
}
service/src/main/java/com/ruoyi/cwgl/mapper/KeyCollectionInfoMapper.java
@@ -3,6 +3,7 @@
import java.util.List;
import com.ruoyi.cwgl.domain.KeyCollectionInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.cwgl.domain.dto.TakeReviewDto;
/**
@@ -84,4 +85,6 @@
     * @return 结果
     */
    public int deleteKeyCollectionInfoByIds(Integer[] ids);
    KeyCollectionInfo selectCwData(TakeReviewDto takeReviewDto);
}
service/src/main/java/com/ruoyi/cwgl/service/IKeyCollectionInfoService.java
@@ -1,8 +1,12 @@
package com.ruoyi.cwgl.service;
import java.util.List;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.cwgl.domain.KeyCollectionInfo;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.cwgl.domain.dto.TakeReviewDto;
/**
 * 钥匙领取信息Service接口
 * 
@@ -99,4 +103,14 @@
     * @return 结果
     */
    public int deleteKeyCollectionInfoById(Integer id);
    public KeyCollectionInfo selectCwData(TakeReviewDto takeReviewDto);
    /**
     *  上报取出审核
     * @param keyCollectionInfo
     * @return
     */
    AjaxResult takeReview(KeyCollectionInfo keyCollectionInfo);
}
service/src/main/java/com/ruoyi/cwgl/service/impl/KeyCollectionInfoServiceImpl.java
@@ -1,8 +1,16 @@
package com.ruoyi.cwgl.service.impl;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.cwgl.domain.RequestLog;
import com.ruoyi.cwgl.domain.dto.TakeReviewDto;
import com.ruoyi.cwgl.service.IRequestLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Service;
import org.springframework.scheduling.annotation.Async;
@@ -32,6 +40,7 @@
    protected final Logger logger = LoggerFactory.getLogger(getClass());
    @Resource
    private KeyCollectionInfoMapper keyCollectionInfoMapper;
    /**
@@ -176,4 +185,33 @@
    {
        return keyCollectionInfoMapper.deleteKeyCollectionInfoById(id);
    }
    @DataSource(DataSourceType.CWSJ)
    @Override
    public KeyCollectionInfo selectCwData(TakeReviewDto takeReviewDto) {
        return keyCollectionInfoMapper.selectCwData(takeReviewDto);
    }
    @Override
    public AjaxResult takeReview(KeyCollectionInfo keyCollectionInfo) {
        if (keyCollectionInfo == null) {
            return AjaxResult.error("查无符合要求的调度单,请联系调度人员",3);
        }
        keyCollectionInfoMapper.insertKeyCollectionInfo(keyCollectionInfo);
        //调度超时
        Integer schedulingTimeout = keyCollectionInfo.getSchedulingTimeout();
        if(schedulingTimeout>5){
            return AjaxResult.error("调度超时下单,超时"+schedulingTimeout+"个小时",3);
        }
        Integer keyTimeout = keyCollectionInfo.getKeyTimeout();
        if (keyTimeout!=null && keyTimeout>24){
            Date estimatedDepartureTime = keyCollectionInfo.getEstimatedDepartureTime();
            String dateToStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, estimatedDepartureTime);
            return AjaxResult.error("预计出发时间"+ dateToStr+",领取钥匙超时"+keyTimeout+"个小时");
        }
        return AjaxResult.success("成功",2);
    }
}
service/src/main/resources/mapper/cwgl/KeyCollectionInfoMapper.xml
@@ -79,6 +79,54 @@
        </where>
        order by thisTab.id desc
    </select>
    <select id="selectCwData" resultType="com.ruoyi.cwgl.domain.KeyCollectionInfo">
SELECT
    customer.`NAME` as customerName,
    bp.`NAME` as carrier,
    ts.DISPATCH_NO as dispatchNo,
    driver_m.`NAME` as driverName,
    driver_m.MOBILE as driverMobile,
    vhc.LICENSE_PLATE_NUMBER as licensePlateNumber,
    ord.ORDER_TIME as orderTime,
    ord.CREATED_TIME as orderCreatedTime,
    ts.CREATED_TIME as dispatchCreatedTime,
    now() as keyCollectionTime, -- 放请求查询到的时间
    ord.ESTIMATED_DEPARTURE_TIME as estimatedDepartureTime,
    ord.CONSIGNOR_ADDRESS_ADDR_INFO as consignorAddress,
    ord.CONSIGNEE_ADDRESS_ADDR_INFO as consigneeAddress,
    driver_m.`NAME` as mainDriver,
    ts.POINT_NUM as pointNum,
    ts.TRANSPORT_MODE as transportMode,
    driver_a.`NAME` as assistantDriver,
    ts.QUANTITY as quantity,
    ts.REQUIRED_ARRIVAL_TIME as ,
    ts.DISPATCH_QUANTITY as dispatchQuantity,
    ts.REMARK as remark,
    TIMESTAMPDIFF(HOUR, ord.ORDER_TIME, ord.CREATED_TIME) as schedulingTimeout,
    TIMESTAMPDIFF(HOUR, ord.ESTIMATED_DEPARTURE_TIME, NOW()) as keyTimeout
FROM
  tms_shipment ts
  left JOIN oms_order ord ON ts.DISPATCH_NO = ord.DISPATCH_CODE
  LEFT JOIN base_customer customer ON customer.ID = ord.CUSTOMER_ID
  LEFT JOIN tms_vehicle vhc ON ts.VEHICLE_ID = vhc.id
  LEFT JOIN base_provider bp ON bp.ID = ts.CARRIER_ID
  LEFT JOIN tms_driver driver_m ON driver_m.ID = ts.MAIN_DRIVER_ID
  LEFT JOIN tms_driver driver_a ON driver_a.ID = ts.ASSISTANT_DRIVER_ID
WHERE
  ts.`STATUS` = 'A'
  <if test="driverCode != null and driverCode != '' ">
      and driver_m.MOBILE = #{driverCode}
  </if>
  <if test="driverName != null and driverName != ''">
      and driver_m.NAME = #{driverName}
  </if>
ORDER BY ord.ESTIMATED_DEPARTURE_TIME asc
LIMIT 1
    </select>
    <!-- 新增 -->
    <insert id="insertKeyCollectionInfo" parameterType="com.ruoyi.cwgl.domain.KeyCollectionInfo"  useGeneratedKeys="true" keyProperty="id">