| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | |
| | | import cn.lihu.jh.module.ecg.controller.admin.devrent.vo.*; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.devrent.DevRentDO; |
| | | import cn.lihu.jh.framework.common.pojo.PageResult; |
| | | import cn.lihu.jh.framework.common.pojo.PageParam; |
| | | import cn.lihu.jh.framework.common.util.object.BeanUtils; |
| | | |
| | | import cn.lihu.jh.module.ecg.dal.mysql.devrent.DevRentMapper; |
| | |
| | | public CommonResult<Long> installOperation(DevRentSaveReqVO createReqVO) { |
| | | 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) { |
| | |
| | | |
| | | private void validateDevRentExists(Long id) { |
| | | if (devRentMapper.selectById(id) == null) { |
| | | throw exception(DEV_RENT_NOT_EXISTS); |
| | | throw exception(DEV_INSTALL_NOT_EXISTS); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | 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() ); |
| | |
| | | |
| | | 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 ); |
| | |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |