From c9eea9f24aa52ea59dbb8dcf1cb6cf513ddc74a9 Mon Sep 17 00:00:00 2001 From: Lius <Lius2225@163.com> Date: 星期五, 25 四月 2025 11:37:32 +0800 Subject: [PATCH] 待机停机维护 --- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamWeekMaintenanceOrderServiceImpl.java | 32 ++++++++++++++++++++++++-------- 1 files changed, 24 insertions(+), 8 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 31fa8f9..659b1fe 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 @@ -84,6 +84,10 @@ @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()); @@ -108,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()); @@ -129,10 +133,10 @@ order.setMaintenanceStatus(WeekMaintenanceStatusEnum.UNDER_MAINTENANCE.name()); order.setActualStartTime(new Date()); eamWeekMaintenanceOrderMapper.updateById(order); + //鏇存柊璁惧淇濆吇鐘舵�� + eamEquipmentExtendService.updateEquipmentMaintenanceStatus(order.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_MAINTENANCE.name()); return result.isSuccess(); } - //鏇存柊璁惧淇濆吇鐘舵�� - eamEquipmentExtendService.updateEquipmentMaintenanceStatus(order.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_MAINTENANCE.name()); } return true; @@ -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,10 +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(); } - //鏇存柊璁惧淇濆吇鐘舵�� - eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_MAINTENANCE.name()); + } return true; } @@ -269,14 +278,21 @@ 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(); + if(sysUser == null || !BusinessCodeConst.PCR0001.equals(sysUser.getPost())) { + throw new JeecgBootException("涓嶆槸鎿嶄綔宸ワ紝鏃犳硶棰嗗彇姝ゅ伐鍗曪紒"); + } entity.setOperator(sysUser.getUsername()); entity.setMaintenanceStatus(WeekMaintenanceStatusEnum.UNDER_MAINTENANCE.name()); entity.setActualStartTime(new Date()); 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()); @@ -375,7 +391,7 @@ 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("璁惧鏈垎閰嶈澶囩鐞嗗憳锛屾棤娉曡繘鍏ヤ笅绾у鎵癸紒"); } //鐝粍闀跨‘璁� -- Gitblit v1.9.3