From 02757313b98376dec3823f03b2d954fc98115506 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期一, 21 四月 2025 15:10:54 +0800 Subject: [PATCH] art: 设备管理-周保工单-更新设备状态 --- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamWeekMaintenanceOrderServiceImpl.java | 52 +++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 37 insertions(+), 15 deletions(-) diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamWeekMaintenanceOrderServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamWeekMaintenanceOrderServiceImpl.java index 3b16ddb..6f1ef75 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamWeekMaintenanceOrderServiceImpl.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamWeekMaintenanceOrderServiceImpl.java @@ -21,19 +21,15 @@ import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.oConvertUtils; -import org.jeecg.modules.eam.constant.BusinessCodeConst; -import org.jeecg.modules.eam.constant.OrderCreationMethodEnum; -import org.jeecg.modules.eam.constant.WeekMaintenanceStatusEnum; +import org.jeecg.modules.eam.aspect.annotation.EquipmentHistoryLog; +import org.jeecg.modules.eam.constant.*; import org.jeecg.modules.eam.entity.EamEquipment; import org.jeecg.modules.eam.entity.EamWeekMaintenanceOrder; import org.jeecg.modules.eam.entity.EamWeekMaintenanceOrderDetail; import org.jeecg.modules.eam.mapper.EamWeekMaintenanceOrderMapper; import org.jeecg.modules.eam.request.EamWeekMaintenanceQuery; import org.jeecg.modules.eam.request.EamWeekMaintenanceRequest; -import org.jeecg.modules.eam.service.IEamEquipmentService; -import org.jeecg.modules.eam.service.IEamReportRepairService; -import org.jeecg.modules.eam.service.IEamWeekMaintenanceOrderDetailService; -import org.jeecg.modules.eam.service.IEamWeekMaintenanceOrderService; +import org.jeecg.modules.eam.service.*; import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService; import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI; @@ -82,10 +78,16 @@ private IEamEquipmentService eamEquipmentService; @Autowired private IEamReportRepairService eamReportRepairService; + @Autowired + private IEamEquipmentExtendService eamEquipmentExtendService; @Override @Transactional(rollbackFor = Exception.class) public boolean addWeekMaintenance(EamWeekMaintenanceRequest request) { + EamEquipment equipment = eamEquipmentService.getById(request.getEquipmentId()); + if (equipment == null) { + throw new JeecgBootException("璁惧涓嶅瓨鍦紝娣诲姞澶辫触锛�"); + } EamWeekMaintenanceOrder order = new EamWeekMaintenanceOrder(); order.setOrderNum(request.getOrderNum()); order.setEquipmentId(request.getEquipmentId()); @@ -95,7 +97,7 @@ order.setRemark(request.getRemark()); //鐘舵�佸垵濮嬪寲 order.setMaintenanceStatus(WeekMaintenanceStatusEnum.WAIT_MAINTENANCE.name()); - order.setCreationMethod(OrderCreationMethodEnum.MANUAL.name()); + order.setCreationMethod(request.getCreationMethod()); //鍒犻櫎鏍囪 order.setDelFlag(CommonConstant.DEL_FLAG_0); eamWeekMaintenanceOrderMapper.insert(order); @@ -110,7 +112,7 @@ //鍒ゆ柇鏄惁瀛樺湪淇濆吇浜� 濡傛灉瀛樺湪鍒欏惎鍔ㄦ祦绋� if (StringUtils.isNotBlank(order.getOperator())) { //鍚姩娴佺▼ - flowCommonService.initActBusiness("宸ュ崟鍙�:" + order.getOrderNum() + ";寮�濮嬭繘琛岃澶囧懆淇�", + flowCommonService.initActBusiness("宸ュ崟鍙�:" + order.getOrderNum() + ";璁惧缂栧彿: " + equipment.getEquipmentCode() + ";杩涜璁惧鍛ㄤ繚", order.getId(), "IEamWeekMaintenanceOrderService", "week_maintenance_process", null); Map<String, Object> variables = new HashMap<>(); variables.put("dataId", order.getId()); @@ -131,6 +133,8 @@ order.setMaintenanceStatus(WeekMaintenanceStatusEnum.UNDER_MAINTENANCE.name()); order.setActualStartTime(new Date()); eamWeekMaintenanceOrderMapper.updateById(order); + //鏇存柊璁惧淇濆吇鐘舵�� + eamEquipmentExtendService.updateEquipmentMaintenanceStatus(order.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_MAINTENANCE.name()); return result.isSuccess(); } } @@ -192,6 +196,10 @@ @Override @Transactional(rollbackFor = Exception.class) public boolean editWeekMaintenance(EamWeekMaintenanceRequest request) { + EamEquipment equipment = eamEquipmentService.getById(request.getEquipmentId()); + if (equipment == null) { + throw new JeecgBootException("璁惧涓嶅瓨鍦紝娣诲姞澶辫触锛�"); + } EamWeekMaintenanceOrder entity = eamWeekMaintenanceOrderMapper.selectById(request.getId()); if (entity == null) { throw new JeecgBootException("缂栬緫鐨勬暟鎹凡鍒犻櫎锛岃鍒锋柊閲嶈瘯锛�"); @@ -230,7 +238,7 @@ //鍒ゆ柇鏄惁瀛樺湪淇濆吇浜� 濡傛灉瀛樺湪鍒欏惎鍔ㄦ祦绋� if (StringUtils.isNotBlank(entity.getOperator())) { //鍚姩娴佺▼ - flowCommonService.initActBusiness("宸ュ崟鍙�:" + entity.getOrderNum() + ";寮�濮嬭繘琛岃澶囧懆淇�", + flowCommonService.initActBusiness("宸ュ崟鍙�:" + entity.getOrderNum() + ";璁惧缂栧彿: " + equipment.getEquipmentCode() + ";杩涜璁惧鍛ㄤ繚", entity.getId(), "IEamWeekMaintenanceOrderService", "week_maintenance_process", null); Map<String, Object> variables = new HashMap<>(); variables.put("dataId", entity.getId()); @@ -251,8 +259,11 @@ entity.setMaintenanceStatus(WeekMaintenanceStatusEnum.UNDER_MAINTENANCE.name()); entity.setActualStartTime(new Date()); eamWeekMaintenanceOrderMapper.updateById(entity); + //鏇存柊璁惧淇濆吇鐘舵�� + eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_MAINTENANCE.name()); return result.isSuccess(); } + } return true; } @@ -267,6 +278,10 @@ if (!WeekMaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())) { throw new JeecgBootException("璇ュ伐鍗曞凡杩涜杩囬鍙栵紒"); } + EamEquipment equipment = eamEquipmentService.getById(entity.getEquipmentId()); + if (equipment == null) { + throw new JeecgBootException("璁惧涓嶅瓨鍦紝娣诲姞澶辫触锛�"); + } LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); entity.setOperator(sysUser.getUsername()); entity.setMaintenanceStatus(WeekMaintenanceStatusEnum.UNDER_MAINTENANCE.name()); @@ -274,7 +289,7 @@ eamWeekMaintenanceOrderMapper.updateById(entity); //鍚姩娴佺▼ - flowCommonService.initActBusiness("宸ュ崟鍙�:" + entity.getOrderNum() + ";寮�濮嬭繘琛岃澶囧懆淇�", + flowCommonService.initActBusiness("宸ュ崟鍙�:" + entity.getOrderNum() + ";璁惧缂栧彿: " + equipment.getEquipmentCode() + ";杩涜璁惧鍛ㄤ繚", entity.getId(), "IEamWeekMaintenanceOrderService", "week_maintenance_process", null); Map<String, Object> variables = new HashMap<>(); variables.put("dataId", entity.getId()); @@ -291,6 +306,8 @@ variables.put("NextAssignee", usernames); Result result = flowDefinitionService.startProcessInstanceByKey("week_maintenance_process", variables); if (result != null) { + //鏇存柊璁惧淇濆吇鐘舵�� + eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_MAINTENANCE.name()); return result.isSuccess(); } return true; @@ -298,7 +315,8 @@ @Override @Transactional(rollbackFor = Exception.class) - public boolean approval(EamWeekMaintenanceRequest request) { + @EquipmentHistoryLog(operationTag = EquipmentOperationTagEnum.WEEK_MAINTENANCE, businessTable = "eam_week_maintenance_order") + public EamWeekMaintenanceOrder approval(EamWeekMaintenanceRequest request) { EamWeekMaintenanceOrder entity = eamWeekMaintenanceOrderMapper.selectById(request.getId()); if (entity == null) { throw new JeecgBootException("瀹℃壒鐨勬暟鎹凡鍒犻櫎锛岃鍒锋柊閲嶈瘯锛�"); @@ -331,7 +349,7 @@ WeekMaintenanceStatusEnum status = WeekMaintenanceStatusEnum.getInstance(entity.getMaintenanceStatus()); if (status == null) { - return false; + return null; } //娴佺▼鍙橀噺 Map<String, Object> values = new HashMap<>(); @@ -366,9 +384,11 @@ if (CollectionUtil.isNotEmpty(request.getTableDetailList())) { eamWeekMaintenanceOrderDetailService.updateBatchById(request.getTableDetailList()); } + //鏇存柊璁惧淇濆吇鐘舵�� + eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.WAIT_CONFIRM.name()); break; case WAIT_CONFIRM: - if(StringUtils.isBlank(equipment.getEquipmentManager())) { + if (StringUtils.isBlank(equipment.getEquipmentManager())) { throw new JeecgBootException("璁惧鏈垎閰嶈澶囩鐞嗗憳锛屾棤娉曡繘鍏ヤ笅绾у鎵癸紒"); } //鐝粍闀跨‘璁� @@ -448,6 +468,8 @@ log.error("JSON杞崲澶辫触锛�" + e.getMessage(), e); } } + //鏇存柊璁惧淇濆吇鐘舵�� + eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.NORMAL.name()); break; } request.setValues(values); @@ -459,7 +481,7 @@ } //淇濆瓨宸ュ崟 eamWeekMaintenanceOrderMapper.updateById(entity); - return true; + return entity; } @Override -- Gitblit v1.9.3