| | |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.eam.constant.AssetStatusEnum; |
| | | import org.jeecg.modules.eam.constant.EquipmentLeanOutStatusEnum; |
| | | import org.jeecg.modules.eam.constant.EquipmentMaintenanceStatus; |
| | | import org.jeecg.modules.eam.entity.EamEquipment; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentLeanOut; |
| | | import org.jeecg.modules.eam.mapper.EamEquipmentLeanOutMapper; |
| | |
| | | import org.jeecg.modules.flowable.apithird.service.FlowCommonService; |
| | | import org.jeecg.modules.flowable.service.IFlowDefinitionService; |
| | | import org.jeecg.modules.flowable.service.IFlowTaskService; |
| | | import org.jeecg.modules.system.service.IMdcProductionService; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public EamEquipmentLeanOut approval(EamEquipmentLeanOut request) { |
| | | // TODO |
| | | return null; |
| | | public EamEquipmentLeanOut approval(EamEquipmentLeanOut eamEquipmentLeanOut) { |
| | | try { |
| | | // æ£æ¥è¯·æ±åæ° |
| | | if (!isValidRequest(eamEquipmentLeanOut)) { |
| | | throw new JeecgBootException("鿳忰"); |
| | | } |
| | | if (EquipmentLeanOutStatusEnum.WAIT_APPROVAL.name().equals(eamEquipmentLeanOut.getLeanStatus())) { |
| | | eamEquipmentLeanOut.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_RETURN.name()); |
| | | // å¾
å½è¿ |
| | | } else if (EquipmentLeanOutStatusEnum.WAIT_RETURN.name().equals(eamEquipmentLeanOut.getLeanStatus())) { |
| | | // å¾
确认 |
| | | eamEquipmentLeanOut.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_CONFIRM.name()); |
| | | } else if (EquipmentLeanOutStatusEnum.WAIT_CONFIRM.name().equals(eamEquipmentLeanOut.getLeanStatus())) { |
| | | // 已宿 |
| | | eamEquipmentLeanOut.setLeanStatus(EquipmentLeanOutStatusEnum.COMPLETE.name()); |
| | | } |
| | | // è·åå½åç»å½ç¨æ· |
| | | LoginUser sysUser = getCurrentUser(); |
| | | if (sysUser == null || StrUtil.isBlank(sysUser.getId())) { |
| | | throw new JeecgBootException("è´¦å·ä¸åå¨"); |
| | | } |
| | | // 审æ¹äºº |
| | | eamEquipmentLeanOut.setApprovalUser(sysUser.getUsername()); |
| | | //æ£æ¥è®¾å¤ |
| | | EamEquipment equipment = eamEquipmentService.getById(eamEquipmentLeanOut.getEquipmentId()); |
| | | if (equipment == null) { |
| | | throw new JeecgBootException("设å¤ä¸åå¨ï¼"); |
| | | } |
| | | eamEquipmentLeanOut.setLeanPerson(sysUser.getUsername()); |
| | | this.updateById(eamEquipmentLeanOut); |
| | | // è·åæµç¨ä¸å¡è®°å½ |
| | | return eamEquipmentLeanOut; |
| | | } catch (Exception e) { |
| | | throw new JeecgBootException("æä½å¤±è´¥ï¼" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void afterFlowHandle(FlowMyBusiness business) { |
| | |
| | | business.getActStatus(); |
| | | } |
| | | |
| | | |
| | | private boolean isValidRequest(EamEquipmentLeanOut request) { |
| | | return StrUtil.isNotBlank(request.getCode()) && StrUtil.isNotBlank(request.getEquipmentId()); |
| | | } |
| | | |
| | | private LoginUser getCurrentUser() { |
| | | try { |
| | | return (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | } catch (Exception e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Object getBusinessDataById(String dataId) { |
| | | return this.getById(dataId); |