| | |
| | | import org.jeecg.common.exception.JeecgBootException; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.eam.aspect.annotation.EquipmentHistoryLog; |
| | | import org.jeecg.modules.eam.constant.AssetStatusEnum; |
| | | import org.jeecg.modules.eam.constant.BusinessCodeConst; |
| | | import org.jeecg.modules.eam.constant.EquipmentLeanOutStatusEnum; |
| | | import org.jeecg.modules.eam.constant.EquipmentOperationTagEnum; |
| | | import org.jeecg.modules.eam.constant.EquipmentSealUpStatusEnum; |
| | | import org.jeecg.modules.eam.entity.EamEquipment; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentLeanOut; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentSealUp; |
| | | import org.jeecg.modules.eam.mapper.EamEquipmentSealUpMapper; |
| | | import org.jeecg.modules.eam.request.EamEquipmentSealUpQuery; |
| | |
| | | } else { |
| | | queryWrapper.orderByDesc("wmo.create_time"); |
| | | } |
| | | |
| | | return equipmentSealUpMapper.queryPageList(page, queryWrapper); |
| | | } |
| | | |
| | |
| | | throw new JeecgBootException("设备不存在!"); |
| | | } |
| | | if (!AssetStatusEnum.NORMAL.name().equals(equipment.getAssetStatus())) { |
| | | throw new JeecgBootException("此设备当前资产状态不允许借出!"); |
| | | throw new JeecgBootException("此设备当前资产状态不允许封存!"); |
| | | } |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (sysUser == null) { |
| | | throw new JeecgBootException("当前用户无法添加借用记录!"); |
| | | throw new JeecgBootException("当前用户无法添加封存记录!"); |
| | | } |
| | | request.setReportUser(sysUser.getUsername()); |
| | | return equipmentSealUpMapper.insert(request) > 0; |
| | |
| | | if (equipment == null) { |
| | | throw new JeecgBootException("设备不存在!"); |
| | | } |
| | | if (!AssetStatusEnum.NORMAL.name().equals(equipment.getAssetStatus())) { |
| | | throw new JeecgBootException("此设备当前资产状态不允许封存!"); |
| | | } |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (sysUser == null) { |
| | | throw new JeecgBootException("当前用户无法编辑借用记录!"); |
| | | throw new JeecgBootException("当前用户无法编辑封存记录!"); |
| | | } |
| | | UpdateWrapper<EamEquipmentSealUp> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.set("equipment_id", request.getEquipmentId()); |
| | |
| | | if (result != null) { |
| | | entity.setSealEndTime(new Date()); |
| | | entity.setSealStatus(EquipmentSealUpStatusEnum.WAIT_UNSEALING_AUDIT.name()); |
| | | //保存工单 |
| | | //保存工单 |
| | | equipmentSealUpMapper.updateById(entity); |
| | | return result.isSuccess(); |
| | | } |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @EquipmentHistoryLog(operationTag = EquipmentOperationTagEnum.SEAL_UP, businessTable = "eam_equipment_seal_up") |
| | | public EamEquipmentSealUp approval(EamEquipmentSealUpRequest request) { |
| | | EamEquipmentSealUp entity = equipmentSealUpMapper.selectById(request.getId()); |
| | | if (entity == null) { |
| | |
| | | Map<String, Object> values = new HashMap<>(); |
| | | switch (status) { |
| | | // 审批 |
| | | case WAIT_UNSEALING_AUDIT: |
| | | case WAIT_CHECK: |
| | | //执行完成 |
| | | values.put("dataId", entity.getId()); |
| | | values.put("organization", request.getApprovalComment()); |
| | |
| | | values.put("NextAssignee", userApprovalList); |
| | | } else { |
| | | //设置entity |
| | | entity.setSealStatus(EquipmentSealUpStatusEnum.WAIT_SUBMIT.name()); |
| | | entity.setSealStatus(EquipmentSealUpStatusEnum.COMPLETE.name()); |
| | | // 修改设备状态 |
| | | equipment.setAssetStatus(AssetStatusEnum.NORMAL.name()); |
| | | eamEquipmentService.updateById(equipment); |
| | | } |
| | | break; |
| | | // 已封存 |
| | | case SEALED: |
| | | case WAIT_UNSEALING_AUDIT: |
| | | values.put("dataId", entity.getId()); |
| | | values.put("organization", request.getUnsealApprovalComment()); |
| | | values.put("comment", request.getUnsealApprovalComment()); |
| | |
| | | } else { |
| | | //设置entity |
| | | entity.setSealStatus(EquipmentSealUpStatusEnum.SEALED.name()); |
| | | entity.setSealEndTime(null); |
| | | } |
| | | entity.setUnsealApprovalUser(user.getUsername()); |
| | | entity.setUnsealApprovalComment(request.getUnsealApprovalComment()); |
| | | entity.setUnsealApprovalTime(new Date()); |
| | | |
| | | // 修改设备状态 |
| | | equipment.setAssetStatus(AssetStatusEnum.NORMAL.name()); |
| | | eamEquipmentService.updateById(equipment); |