eight
2024-09-13 77ab08e5fc74c1756841b4c535b28f46d95b16f3
装机先检查设备是否存在
已修改2个文件
15 ■■■■ 文件已修改
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/devmanage/DeviceMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/devmanage/DeviceMapper.java
@@ -8,6 +8,8 @@
import cn.lihu.jh.module.ecg.dal.dataobject.devmanage.DeviceDO;
import org.apache.ibatis.annotations.Mapper;
import cn.lihu.jh.module.ecg.controller.admin.devmanage.vo.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
 * 设备 Mapper
@@ -28,4 +30,7 @@
                .orderByDesc(DeviceDO::getId));
    }
    @Select("select * from lihu.device where dev_id=#{devId}")
    DeviceDO getDeviceByDevId(@Param("devId") String devId);
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java
@@ -50,6 +50,12 @@
        Long userId = SecurityFrameworkUtils.getLoginUserId();
        String userNickname = SecurityFrameworkUtils.getLoginUserNickname();
        // 检查设备编号
        DeviceDO deviceDO = deviceMapper.getDeviceByDevId( createReqVO.getDevId() );
        if (null == deviceDO ) {
            return CommonResult.error(DEVICE_NOT_EXISTS);
        }
        Long rent_id = createReqVO.getId();
        if (null == rent_id) {
@@ -282,7 +288,7 @@
    private void markDevLost(DevRentSaveReqVO createReqVO) {
        // 设备标注遗失
        DeviceDO deviveDO = deviceMapper.selectById(createReqVO.getDevId());
        DeviceDO deviveDO = deviceMapper.getDeviceByDevId(createReqVO.getDevId());
        if (null != deviveDO) {
            deviveDO.setLost(1);
            deviveDO.setLoseDate( createReqVO.getReturnTime().toLocalDate() );
@@ -292,7 +298,7 @@
    private void resumeDevLost(DevRentSaveReqVO createReqVO) {
        // 设备标注遗失 恢复为正常
        DeviceDO deviveDO = deviceMapper.selectById(createReqVO.getDevId());
        DeviceDO deviveDO = deviceMapper.getDeviceByDevId(createReqVO.getDevId());
        if (null != deviveDO) {
            deviveDO.setLost(0);
            deviveDO.setLoseDate( null );