From 44a7e1614ac9894d65ff1159fd7d7747b0f19922 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期五, 11 七月 2025 20:16:18 +0800 Subject: [PATCH] art: 技术状态鉴定工单-审批接口 --- db/430设备管理数据库设计.pdma.json | 6 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java | 16 + lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamTechnicalStatusEvaluationOrderRequest.java | 43 ++++++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamTechnicalStatusEvaluationOrder.java | 4 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamTechnicalStatusEvaluationOrderController.java | 24 +++ lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java | 28 ++++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java | 240 +++++++++++++++++++++++++++++++-- lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/TechnicalStatusEvaluationOrderStatusEnum.java | 10 + lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamTechnicalStatusEvaluationOrderService.java | 7 + lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/IFlowMyBusinessService.java | 18 ++ 10 files changed, 367 insertions(+), 29 deletions(-) diff --git "a/db/430\350\256\276\345\244\207\347\256\241\347\220\206\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.pdma.json" "b/db/430\350\256\276\345\244\207\347\256\241\347\220\206\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.pdma.json" index 3c07a00..23b1618 100644 --- "a/db/430\350\256\276\345\244\207\347\256\241\347\220\206\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.pdma.json" +++ "b/db/430\350\256\276\345\244\207\347\256\241\347\220\206\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.pdma.json" @@ -4,7 +4,7 @@ "avatar": "", "version": "4.9.2", "createdTime": "2025-3-10 16:38:19", - "updatedTime": "2025-7-10 20:07:59", + "updatedTime": "2025-7-11 19:36:02", "dbConns": [], "profile": { "default": { @@ -24869,7 +24869,7 @@ "id": "7C33F96F-F828-4A60-AA98-8847020EF388" }, { - "defKey": "safety_check_result", + "defKey": "safety_check_confirm_result", "defName": "瀹夊叏瑁呯疆妫�鏌ョ‘璁ょ粨鏋�", "comment": "", "type": "", @@ -24887,7 +24887,7 @@ "id": "699E6979-B91F-4471-8DE7-A527AD2C82B7" }, { - "defKey": "safety_check_comment", + "defKey": "safety_check_confirm_comment", "defName": "瀹夊叏瑁呯疆妫�鏌ョ‘璁ゆ剰瑙�", "comment": "", "type": "", diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java index c75dbbb..f69118d 100644 --- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java @@ -62,18 +62,24 @@ String PCR0001 = "PCR0001"; //缁翠慨宸� String PCR0002 = "PCR0002"; - //鐝粍闀� + //璁惧妫�楠屽憳 String PCR0003 = "PCR0003"; - //璁惧绠$悊鍛� + //杞﹂棿璁惧绠$悊鍛� String PCR0004 = "PCR0004"; //璁惧鑳芥簮閮� String PCR0005 = "PCR0005"; - //鏈哄姩鍔炵鐞嗗憳 + //鐢熶骇淇濋殰閮� String PCR0006 = "PCR0006"; - //澶囦欢绠$悊鍛� + //宸ヨ壓鍛� String PCR0007 = "PCR0007"; //缁翠慨瀹や富浠� String PCR0008 = "PCR0008"; - //鎶�鏈富绠� + //鐢熶骇璁惧鎶�鏈富绠� String PCR0009 = "PCR0009"; + //浣跨敤杞﹂棿鎶�鏈富绠� + String PCR0010 = "PCR0010"; + + //閫氳繃銆侀┏鍥� + String APPROVED = "1"; + String REJECTED = "2"; } diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/TechnicalStatusEvaluationOrderStatusEnum.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/TechnicalStatusEvaluationOrderStatusEnum.java index 483d514..0f4e6ad 100644 --- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/TechnicalStatusEvaluationOrderStatusEnum.java +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/TechnicalStatusEvaluationOrderStatusEnum.java @@ -13,4 +13,14 @@ CHANGING, //鍙樻洿涓� EXPIRED, //宸茶繃鏈� ; + + public static TechnicalStatusEvaluationOrderStatusEnum getInstance(String code) { + TechnicalStatusEvaluationOrderStatusEnum[] values = TechnicalStatusEvaluationOrderStatusEnum.values(); + for (TechnicalStatusEvaluationOrderStatusEnum value : values) { + if (value.name().equals(code)) { + return value; + } + } + return null; + } } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamTechnicalStatusEvaluationOrderController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamTechnicalStatusEvaluationOrderController.java index 8a8f39e..24948b2 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamTechnicalStatusEvaluationOrderController.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamTechnicalStatusEvaluationOrderController.java @@ -1,6 +1,7 @@ package org.jeecg.modules.eam.controller; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; @@ -88,6 +89,29 @@ return Result.OK("棰嗗彇鎴愬姛!"); } + /** + * 鎴戠殑寰呭姙锛屽鎵瑰姩浣� + * + * @param request + * @return + */ + @ApiOperation(value = "鎶�鏈姸鎬侀壌瀹氬伐鍗�-鎵ц鎿嶄綔", notes = "鎶�鏈姸鎬侀壌瀹氬伐鍗�-鎵ц鎿嶄綔") + @PutMapping(value = "/approval") + public Result<?> approval(@RequestBody EamTechnicalStatusEvaluationOrderRequest request) { + if (request == null) { + return Result.error("瀹℃壒鐨勫璞′笉鑳戒负绌猴紒"); + } + // 妫�鏌ヨ姹傚弬鏁� + if (StrUtil.isBlank(request.getTaskId()) || StrUtil.isBlank(request.getDataId()) || StrUtil.isBlank(request.getInstanceId())) { + return Result.error("瀹℃壒浠诲姟閿欒鎴栦笉瀛樺湪锛�"); + } + EamTechnicalStatusEvaluationOrder entity = eamTechnicalStatusEvaluationOrderService.approval(request); + if (entity == null) { + return Result.error("鎿嶄綔澶辫触锛�"); + } + return Result.ok("鎿嶄綔鎴愬姛锛�"); + } + /** * 閫氳繃id鏌ヨ diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamTechnicalStatusEvaluationOrder.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamTechnicalStatusEvaluationOrder.java index 9243597..922c144 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamTechnicalStatusEvaluationOrder.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamTechnicalStatusEvaluationOrder.java @@ -113,10 +113,10 @@ /**瀹夊叏瑁呯疆妫�鏌ョ‘璁ょ粨鏋�*/ @ApiModelProperty(value = "瀹夊叏瑁呯疆妫�鏌ョ‘璁ょ粨鏋�") @Dict(dicCode = "approved_rejected") - private String safetyCheckResult; + private String safetyCheckConfirmResult; /**瀹夊叏瑁呯疆妫�鏌ョ‘璁ゆ剰瑙�*/ @ApiModelProperty(value = "瀹夊叏瑁呯疆妫�鏌ョ‘璁ゆ剰瑙�") - private String safetyCheckComment; + private String safetyCheckConfirmComment; /**璁惧绮惧害妫�鏌ョ‘璁や汉*/ @ApiModelProperty(value = "璁惧绮惧害妫�鏌ョ‘璁や汉") @Dict(dicCode = "sys_user, realname, username") diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamTechnicalStatusEvaluationOrderRequest.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamTechnicalStatusEvaluationOrderRequest.java index b4f75fe..f5b319d 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamTechnicalStatusEvaluationOrderRequest.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamTechnicalStatusEvaluationOrderRequest.java @@ -6,6 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; +import org.jeecg.common.aspect.annotation.Dict; import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationOrderDetail; import org.jeecg.modules.flowable.domain.vo.FlowTaskVo; import org.springframework.format.annotation.DateTimeFormat; @@ -50,6 +51,26 @@ private List<EamTechnicalStatusEvaluationOrderDetail> tableDetailList; //瀹℃壒鎿嶄綔 + //缁翠慨瀹や富浠荤‘璁� + /**瀹夊叏瑁呯疆妫�鏌ョ‘璁ょ粨鏋�*/ + @ApiModelProperty(value = "瀹夊叏瑁呯疆妫�鏌ョ‘璁ょ粨鏋�") + private String safetyCheckConfirmResult; + /**瀹夊叏瑁呯疆妫�鏌ョ‘璁ゆ剰瑙�*/ + @ApiModelProperty(value = "瀹夊叏瑁呯疆妫�鏌ョ‘璁ゆ剰瑙�") + private String safetyCheckConfirmComment; + /**璁惧绮惧害妫�鏌ョ‘璁ょ粨鏋�*/ + @ApiModelProperty(value = "璁惧绮惧害妫�鏌ョ‘璁ょ粨鏋�") + private String precisionCheckConfirmResult; + /**璁惧绮惧害妫�鏌ョ‘璁ゆ剰瑙�*/ + @ApiModelProperty(value = "璁惧绮惧害妫�鏌ョ‘璁ゆ剰瑙�") + private String precisionCheckConfirmComment; + /**鍏朵粬妫�鏌ョ‘璁ょ粨鏋�*/ + @ApiModelProperty(value = "鍏朵粬妫�鏌ョ‘璁ょ粨鏋�") + private String otherCheckConfirmResult; + /**鍏朵粬妫�鏌ョ‘璁ゆ剰瑙�*/ + @ApiModelProperty(value = "鍏朵粬妫�鏌ョ‘璁ゆ剰瑙�") + private String otherCheckConfirmComment; + //缁翠慨宸ョ瀛� /**瀹夊叏瑁呯疆妫�鏌ョ粨鏋�;鏄�佸惁*/ @ApiModelProperty(value = "瀹夊叏瑁呯疆妫�鏌ョ粨鏋�;鏄�佸惁") private String safetyEquipmentCheckResult; @@ -62,13 +83,35 @@ /**鍏朵粬妫�鏌ョ粨鏋�;鏄�佸惁銆佹棤*/ @ApiModelProperty(value = "鍏朵粬妫�鏌ョ粨鏋�;鏄�佸惁銆佹棤") private String otherCheckResult; + //缁翠慨瀹や富浠荤瀛� + /**缁翠慨瀹や富浠荤瀛楃粨鏋�*/ + @ApiModelProperty(value = "缁翠慨瀹や富浠荤瀛楃粨鏋�") + private String repairManagerSignatureResult; + /**缁翠慨瀹や富浠绘剰瑙�*/ + @ApiModelProperty(value = "缁翠慨瀹や富浠绘剰瑙�") + private String repairManagerComment; + //宸ヨ壓鍛樼瀛� /**璇曚欢妫�鏌ョ粨鏋�;鍚堟牸銆佷笉鍚堟牸*/ @ApiModelProperty(value = "璇曚欢妫�鏌ョ粨鏋�;鍚堟牸銆佷笉鍚堟牸") private String sampleCheckResult; + /**宸ヨ壓鍛樻剰瑙�*/ + @ApiModelProperty(value = "宸ヨ壓鍛樻剰瑙�") + private String processTechnicianComment; + //浣跨敤鍗曚綅鎶�鏈富绠$瀛� + /**浣跨敤鍗曚綅鎶�鏈富绠$瀛楃粨鏋�*/ + @ApiModelProperty(value = "浣跨敤鍗曚綅鎶�鏈富绠$瀛楃粨鏋�") + private String departTechnicalLeaderSignatureResult; + /**浣跨敤鍗曚綅鎶�鏈富绠℃剰瑙�*/ + @ApiModelProperty(value = "浣跨敤鍗曚綅鎶�鏈富绠℃剰瑙�") + private String departTechnicalLeaderComment; + //璁惧妫�楠屽憳绛惧瓧 /**閴村畾缁撴灉;鍚堟牸銆侀檺鐢ㄣ�佺鐢�*/ @ApiModelProperty(value = "閴村畾缁撴灉;鍚堟牸銆侀檺鐢ㄣ�佺鐢�") private String evaluationResult; /**闄怽绂佺敤鍘熷洜(澶氶��);瀹夊叏瑁呯疆銆佽澶囧姛鑳姐�佺簿搴︺�佽瘯浠躲�佸叾浠�*/ @ApiModelProperty(value = "闄�/绂佺敤鍘熷洜(澶氶��);瀹夊叏瑁呯疆銆佽澶囧姛鑳姐�佺簿搴︺�佽瘯浠躲�佸叾浠�") private String evaluationReason; + /**璁惧妫�鏌ヤ汉鎰忚*/ + @ApiModelProperty(value = "璁惧妫�鏌ヤ汉鎰忚") + private String inspectorComment; } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamTechnicalStatusEvaluationOrderService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamTechnicalStatusEvaluationOrderService.java index a589666..4cc68d2 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamTechnicalStatusEvaluationOrderService.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamTechnicalStatusEvaluationOrderService.java @@ -36,4 +36,11 @@ * @return */ boolean collect(String id); + + /** + * 瀹℃壒娴佺▼ + * @param request + * @return + */ + EamTechnicalStatusEvaluationOrder approval(EamTechnicalStatusEvaluationOrderRequest request); } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java index 7125c4e..0e594d7 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java @@ -21,10 +21,7 @@ import org.jeecg.modules.eam.constant.HfTemplateCategoryEnum; import org.jeecg.modules.eam.constant.OrderCreationMethodEnum; import org.jeecg.modules.eam.constant.TechnicalStatusEvaluationOrderStatusEnum; -import org.jeecg.modules.eam.entity.EamBaseHFCode; -import org.jeecg.modules.eam.entity.EamEquipment; -import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationOrder; -import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandard; +import org.jeecg.modules.eam.entity.*; import org.jeecg.modules.eam.mapper.EamTechnicalStatusEvaluationOrderMapper; import org.jeecg.modules.eam.request.EamTechnicalStatusEvaluationOrderQuery; import org.jeecg.modules.eam.request.EamTechnicalStatusEvaluationOrderRequest; @@ -147,7 +144,6 @@ } else { queryWrapper.orderByDesc("ems.create_time"); } - queryWrapper.orderByDesc("ems.create_time"); return this.getBaseMapper().queryPageList(page, queryWrapper); } @@ -159,7 +155,7 @@ throw new JeecgBootException("璁惧涓嶅瓨鍦紝娣诲姞澶辫触锛�"); } EamTechnicalStatusEvaluationStandard standard = standardService.getById(request.getStandardId()); - if(standard == null) { + if (standard == null) { throw new JeecgBootException("鎶�鏈姸鎬侀壌瀹氳鑼冧笉瀛樺湪锛屾坊鍔犲け璐ワ紒"); } EamTechnicalStatusEvaluationOrder order = new EamTechnicalStatusEvaluationOrder(); @@ -169,34 +165,33 @@ order.setEvaluationDate(request.getEvaluationDate()); order.setRemark(request.getRemark()); String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.TECHNICAL_STATUS_EVALUATION_ORDER_CODE_RULE); - request.setOrderNum(codeSeq); - request.setCreationMethod(OrderCreationMethodEnum.MANUAL.name()); + order.setOrderNum(codeSeq); + order.setCreationMethod(OrderCreationMethodEnum.MANUAL.name()); //鐘舵�佸垵濮嬪寲 order.setEvaluationStatus(TechnicalStatusEvaluationOrderStatusEnum.WAIT_EVALUATION.name()); - order.setCreationMethod(request.getCreationMethod()); //鍒犻櫎鏍囪 order.setDelFlag(CommonConstant.DEL_FLAG_0); //鎶�鏈姸鎬侀壌瀹氳〃 EamBaseHFCode eamBaseHFCode = hfCodeService.selectByCategory(HfTemplateCategoryEnum.TECHNICAL_STATUS_EVALUATION.name()); - if(eamBaseHFCode == null) { + if (eamBaseHFCode == null) { throw new JeecgBootException("鏈厤缃妧鏈姸鎬侀壌瀹氳〃鐨凥F缂栫爜锛屾坊鍔犲け璐ワ紒"); } order.setHfCodeA(eamBaseHFCode.getHfCode()); //鎶�鏈姸鎬侀壌瀹氬畨鍏ㄨ缃鏌ヨ〃 eamBaseHFCode = hfCodeService.selectByCategory(HfTemplateCategoryEnum.TECHNICAL_STATUS_EVALUATION_SAFETY_CHECK.name()); - if(eamBaseHFCode == null) { + if (eamBaseHFCode == null) { throw new JeecgBootException("鏈厤缃畨鍏ㄨ缃鏌ヨ〃鐨凥F缂栫爜锛屾坊鍔犲け璐ワ紒"); } order.setHfCodeB(eamBaseHFCode.getHfCode()); //鎶�鏈姸鎬侀壌瀹氬叾浠栨鏌ヨ〃 eamBaseHFCode = hfCodeService.selectByCategory(HfTemplateCategoryEnum.TECHNICAL_STATUS_EVALUATION_OTHER_CHECK.name()); - if(eamBaseHFCode == null) { + if (eamBaseHFCode == null) { throw new JeecgBootException("鏈厤缃叾浠栨鏌ヨ〃鐨凥F缂栫爜锛屾坊鍔犲け璐ワ紒"); } order.setHfCodeD(eamBaseHFCode.getHfCode()); //鎶�鏈姸鎬侀壌瀹氳澶囩簿搴︽鏌ヨ〃 eamBaseHFCode = hfCodeService.selectByCategory(HfTemplateCategoryEnum.TECHNICAL_STATUS_EVALUATION_PRECISION_CHECK.name()); - if(eamBaseHFCode == null) { + if (eamBaseHFCode == null) { throw new JeecgBootException("鏈厤缃澶囩簿搴︽鏌ヨ〃鐨凥F缂栫爜锛屾坊鍔犲け璐ワ紒"); } order.setHfCodeC(eamBaseHFCode.getHfCode()); @@ -205,6 +200,10 @@ if (CollectionUtil.isNotEmpty(request.getTableDetailList())) { request.getTableDetailList().forEach(tableDetail -> { tableDetail.setId(null); + tableDetail.setCreateBy(null); + tableDetail.setCreateTime(null); + tableDetail.setUpdateBy(null); + tableDetail.setUpdateTime(null); tableDetail.setOrderId(order.getId()); }); orderDetailService.saveBatch(request.getTableDetailList()); @@ -223,7 +222,7 @@ throw new JeecgBootException("璇ュ伐鍗曞凡杩涜杩囬鍙栵紒"); } EamTechnicalStatusEvaluationStandard standard = standardService.getById(entity.getStandardId()); - if(standard == null) { + if (standard == null) { throw new JeecgBootException("璁惧淇濆吇鏍囧噯涓嶅瓨鍦紝璇锋鏌ワ紒"); } EamEquipment equipment = equipmentService.getById(entity.getEquipmentId()); @@ -231,7 +230,7 @@ throw new JeecgBootException("璁惧涓嶅瓨鍦紝娣诲姞澶辫触锛�"); } LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - if(sysUser == null) { + if (sysUser == null) { throw new JeecgBootException("涓嶆槸缁翠慨宸ワ紝鏃犳硶棰嗗彇姝ゅ伐鍗曪紒"); } List<UserSelector> userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0002); @@ -239,6 +238,9 @@ throw new JeecgBootException("璁惧鏈垎閰嶇粰缁翠慨宸ワ紝鏃犳硶棰嗗彇锛�"); } List<String> userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList()); + if (!userApprovalList.contains(sysUser.getUsername())) { + throw new JeecgBootException("鎮ㄦ病鏈夐鍙栨宸ュ崟鐨勬潈闄愶紒"); + } entity.setEvaluator(sysUser.getUsername()); entity.setEvaluationStatus(TechnicalStatusEvaluationOrderStatusEnum.UNDER_EVALUATION.name()); entity.setActualStartTime(new Date()); @@ -257,7 +259,7 @@ variables.put("comment", entity.getRemark()); } variables.put("proofreading", true); - if(CommonConstant.STATUS_1.equals(standard.getHasSafetyEquipmentCheck())) { + if (CommonConstant.STATUS_1.equals(standard.getHasSafetyEquipmentCheck())) { variables.put("hasSafetyEquipmentCheck", CommonConstant.STATUS_1); variables.put("safety_equipment_check", userApprovalList); entity.setSafetyCheckCompleted(CommonConstant.STATUS_0); @@ -265,7 +267,7 @@ variables.put("hasSafetyEquipmentCheck", CommonConstant.STATUS_0); variables.put("safety_equipment_check", userApprovalList); } - if(CommonConstant.STATUS_1.equals(standard.getHasPrecisionCheck())) { + if (CommonConstant.STATUS_1.equals(standard.getHasPrecisionCheck())) { variables.put("hasPrecisionCheck", CommonConstant.STATUS_1); variables.put("equipment_precision_check", userApprovalList); entity.setPrecisionCheckCompleted(CommonConstant.STATUS_0); @@ -273,7 +275,7 @@ variables.put("hasPrecisionCheck", CommonConstant.STATUS_0); variables.put("equipment_precision_check", userApprovalList); } - if(CommonConstant.STATUS_1.equals(standard.getHasOtherCheck())) { + if (CommonConstant.STATUS_1.equals(standard.getHasOtherCheck())) { variables.put("hasOtherCheck", CommonConstant.STATUS_1); variables.put("other_check", userApprovalList); entity.setOtherCheckCompleted(CommonConstant.STATUS_0); @@ -282,13 +284,213 @@ variables.put("other_check", userApprovalList); } Result<?> result = flowDefinitionService.startProcessInstanceByKey("technical_status_evaluation_process", variables); - if(result == null || !result.isSuccess()) { + if (result == null || !result.isSuccess()) { throw new JeecgBootException("鍚姩娴佺▼澶辫触锛岄鍙栧け璐�"); } return true; } @Override + @Transactional(rollbackFor = Exception.class) + public EamTechnicalStatusEvaluationOrder approval(EamTechnicalStatusEvaluationOrderRequest request) { + EamTechnicalStatusEvaluationOrder entity = this.getBaseMapper().selectById(request.getId()); + if (entity == null) { + throw new JeecgBootException("瀹℃壒鐨勬暟鎹凡鍒犻櫎锛岃鍒锋柊閲嶈瘯锛�"); + } + // 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛 + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if (user == null || StrUtil.isBlank(user.getId())) { + throw new JeecgBootException("鏈幏鍙栧埌鐧诲綍鐢ㄦ埛锛岃閲嶆柊鐧诲綍鍚庡啀璇曪紒"); + } + request.setAssignee(user.getUsername()); + // 鑾峰彇娴佺▼涓氬姟璁板綍 + FlowMyBusiness flowMyBusiness = flowMyBusinessService.getFlowMyBusiness(request.getInstanceId(), request.getTaskId()); + if (flowMyBusiness == null) { + throw new JeecgBootException("娴佺▼瀹炰緥涓嶅瓨鍦紝璇峰埛鏂板悗閲嶈瘯锛�"); + } + + boolean userAuthorized = flowMyBusinessService.isUserAuthorized(flowMyBusiness, user); + if (!userAuthorized) { + throw new JeecgBootException("鐢ㄦ埛鏃犳潈鎿嶄綔姝や换鍔★紝璇峰埛鏂板悗閲嶈瘯锛�"); + } + // 璁ら浠诲姟 + if (!flowMyBusinessService.claimTask(flowMyBusiness.getTaskId(), user)) { + throw new JeecgBootException("浠诲姟涓嶅瓨鍦ㄣ�佸凡瀹屾垚鎴栧凡琚粬浜鸿棰嗭紒"); + } + + EamEquipment equipment = equipmentService.getById(entity.getEquipmentId()); + if (equipment == null) { + throw new JeecgBootException("璁惧涓嶅瓨鍦紝璇锋鏌ワ紒"); + } + + TechnicalStatusEvaluationOrderStatusEnum status = TechnicalStatusEvaluationOrderStatusEnum.getInstance(entity.getEvaluationStatus()); + if (status == null) { + return null; + } + //娴佺▼鍙橀噺 + Map<String, Object> values = new HashMap<>(); + List<String> userApprovalList; + List<UserSelector> userSelectors; + switch (status) { + case UNDER_EVALUATION: + boolean parallelCompletion = flowTaskService.checkParallelCompletion(flowMyBusiness.getTaskId()); + //鎵ц瀹屾垚 + userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0008); + if (CollectionUtil.isEmpty(userSelectors)) { + throw new JeecgBootException("璁惧鏈垎閰嶇粰缁翠慨瀹や富浠伙紝鏃犳硶杩涘叆涓嬬骇瀹℃壒锛�"); + } + userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList()); + values.put("dataId", entity.getId()); + values.put("organization", "鎶�鏈姸鎬侀壌瀹氭墽琛岀粨鏉�"); + values.put("comment", "鎶�鏈姸鎬侀壌瀹氭墽琛岀粨鏉�"); + request.setComment("鎶�鏈姸鎬侀壌瀹氭墽琛岀粨鏉�"); + //璁剧疆entity + if (parallelCompletion) { + //澶氫釜浠诲姟閮藉凡瀹屾垚涓旂淮淇涓讳换閮藉凡瀹℃壒閫氳繃,浼氱瀹屾垚锛岃繘琛岀淮淇伐绛惧瓧 + userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0002); + userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList()); + values.put("NextAssignee", userApprovalList); + entity.setEvaluationStatus(TechnicalStatusEvaluationOrderStatusEnum.REPAIRER_SIGNING.name()); + entity.setActualEndTime(new Date()); + } + if ("safety_equipment_check".equals(flowMyBusiness.getTaskNameId())) { + //鎵ц瀹夊叏妫�鏌� + if(CommonConstant.STATUS_1.equals(entity.getSafetyCheckCompleted())) { + values.put("safetyEquipmentCheckFlag", request.getSafetyCheckConfirmResult()); + entity.setSafetyCheckConfirmResult(request.getSafetyCheckConfirmResult()); + entity.setSafetyCheckConfirm(user.getUsername()); + entity.setSafetyCheckConfirmTime(new Date()); + entity.setSafetyCheckConfirmComment(request.getSafetyCheckConfirmComment()); + //缁翠慨瀹や富浠诲鎵� + if(!CommonConstant.STATUS_1.equals(request.getSafetyCheckConfirmResult())) { + //椹冲洖 缁欑洃瀵熶汉 + userApprovalList = Collections.singletonList(request.getTableDetailList().get(0).getRepairmanSignature()); + values.put("NextAssignee", userApprovalList); + entity.setSafetyCheckCompleted(CommonConstant.STATUS_0); + } + }else { + //瀹夊叏瑁呯疆妫�鏌ョ粨鏋滃~鎶� + if(CollectionUtil.isNotEmpty(request.getTableDetailList())) { + for (EamTechnicalStatusEvaluationOrderDetail detail : request.getTableDetailList()) { + detail.setRepairmanSignature(user.getUsername()); + detail.setRepairmanSignatureTime(new Date()); + } + orderDetailService.updateBatchById(request.getTableDetailList()); + } + values.put("NextAssignee", userApprovalList); + entity.setSafetyCheckCompleted(CommonConstant.STATUS_1); + } + } else if ("equipment_precision_check".equals(flowMyBusiness.getTaskNameId())) { + //澶勭悊绮惧害妫�楠� + if(CommonConstant.STATUS_1.equals(entity.getPrecisionCheckCompleted())) { + values.put("precisionCheckFlag", request.getPrecisionCheckConfirmResult()); + entity.setPrecisionCheckConfirmResult(request.getPrecisionCheckConfirmResult()); + entity.setPrecisionCheckConfirm(user.getUsername()); + entity.setPrecisionCheckConfirmTime(new Date()); + entity.setPrecisionCheckConfirmComment(request.getPrecisionCheckConfirmComment()); + //缁翠慨瀹や富浠诲鎵� + if(!CommonConstant.STATUS_1.equals(request.getPrecisionCheckConfirmResult())) { + //椹冲洖 缁欑洃瀵熶汉 + userApprovalList = Collections.singletonList(request.getTableDetailList().get(0).getRepairmanSignature()); + values.put("NextAssignee", userApprovalList); + entity.setPrecisionCheckCompleted(CommonConstant.STATUS_0); + } + }else { + //璁惧绮惧害妫�鏌ョ粨鏋滃~鎶� + if(CollectionUtil.isNotEmpty(request.getTableDetailList())) { + for (EamTechnicalStatusEvaluationOrderDetail detail : request.getTableDetailList()) { + detail.setRepairmanSignature(user.getUsername()); + detail.setRepairmanSignatureTime(new Date()); + } + orderDetailService.updateBatchById(request.getTableDetailList()); + } + values.put("NextAssignee", userApprovalList); + entity.setPrecisionCheckCompleted(CommonConstant.STATUS_1); + } + + } else if("other_check".equals(flowMyBusiness.getTaskNameId())) { + //澶勭悊鍏朵粬妫�鏌� + if(CommonConstant.STATUS_1.equals(entity.getOtherCheckCompleted())) { + values.put("otherCheckFlag", request.getOtherCheckResult()); + entity.setOtherCheckResult(request.getOtherCheckConfirmResult()); + entity.setOtherCheckConfirm(user.getUsername()); + entity.setOtherCheckConfirmTime(new Date()); + entity.setOtherCheckConfirmComment(request.getOtherCheckConfirmComment()); + //缁翠慨瀹や富浠诲鎵� + if(!CommonConstant.STATUS_1.equals(request.getOtherCheckConfirmResult())) { + //椹冲洖 缁欑洃瀵熶汉 + userApprovalList = Collections.singletonList(request.getTableDetailList().get(0).getRepairmanSignature()); + values.put("NextAssignee", userApprovalList); + entity.setOtherCheckCompleted(CommonConstant.STATUS_0); + } + }else { + //鍏朵粬妫�鏌ョ粨鏋滃~鎶� + if(CollectionUtil.isNotEmpty(request.getTableDetailList())) { + for (EamTechnicalStatusEvaluationOrderDetail detail : request.getTableDetailList()) { + detail.setRepairmanSignature(user.getUsername()); + detail.setRepairmanSignatureTime(new Date()); + } + orderDetailService.updateBatchById(request.getTableDetailList()); + } + values.put("NextAssignee", userApprovalList); + entity.setOtherCheckCompleted(CommonConstant.STATUS_1); + } + } + break; + case REPAIRER_SIGNING: + userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(),equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0008); + if (CollectionUtil.isEmpty(userSelectors)) { + throw new JeecgBootException("璁惧鏈垎閰嶇粰缁翠慨瀹や富浠伙紝鏃犳硶杩涘叆涓嬬骇瀹℃壒锛�"); + } + //缁翠慨宸ョ瀛� + userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList()); + values.put("dataId", entity.getId()); + values.put("organization", "缁翠慨宸ョ瀛楀畬鎴�"); + values.put("comment", "缁翠慨宸ョ瀛楀畬鎴�"); + values.put("NextAssignee", userApprovalList); + request.setComment("缁翠慨宸ョ瀛楀畬鎴�"); + //璁剧疆entity + entity.setEvaluationStatus(TechnicalStatusEvaluationOrderStatusEnum.REPAIR_MANAGER_SIGNING.name()); + entity.setRepairerSignature(user.getUsername()); + entity.setRepairerSignatureTime(new Date()); + entity.setSafetyEquipmentCheckResult(request.getSafetyEquipmentCheckResult()); + entity.setPrecisionCheckResult(request.getPrecisionCheckResult()); + entity.setFunctionalCheckResult(request.getFunctionalCheckResult()); + entity.setOtherCheckResult(request.getOtherCheckResult()); + break; + case REPAIR_MANAGER_SIGNING: +// values.put("dataId", entity.getId()); +// values.put("organization", request.getLeaderConfirmComment()); +// values.put("comment", request.getLeaderConfirmComment()); +// request.setComment(request.getLeaderConfirmComment()); +// //璁剧疆entity +// entity.setMaintenanceStatus(ThirdMaintenanceStatusEnum.COMPLETE.name()); +// entity.setConfirmLeader(user.getUsername()); +// entity.setLeaderConfirmComment(request.getLeaderConfirmComment()); +// entity.setLeaderConfirmTime(new Date()); +// //鏇存柊璁惧淇濆吇鐘舵�� +// eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.NORMAL.name()); + break; + case PROCESS_TECHNICIAN_SIGNING: + break; + case DEPART_TECHNICAL_LEADER_SIGNING: + break; + case INSPECTOR_SIGNING: + break; + } + request.setValues(values); + + // 瀹屾垚娴佺▼浠诲姟 + Result<?> result = flowTaskService.complete(request); + if (!result.isSuccess()) { + throw new JeecgBootException("瀹℃壒澶辫触锛岃鍒锋柊鏌ョ湅锛�"); + } + //淇濆瓨宸ュ崟 + this.getBaseMapper().updateById(entity); + return entity; + } + + @Override public void afterFlowHandle(FlowMyBusiness business) { business.getTaskNameId();//鎺ヤ笅鏉ュ鎵圭殑鑺傜偣 business.getValues();//鍓嶇浼犺繘鏉ョ殑鍙傛暟 diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/IFlowMyBusinessService.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/IFlowMyBusinessService.java index 2e89d35..b31d941 100644 --- a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/IFlowMyBusinessService.java +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/IFlowMyBusinessService.java @@ -1,6 +1,8 @@ package org.jeecg.modules.flowable.apithird.business.service; import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; +import org.jeecg.modules.flowable.apithird.entity.SysUser; import java.util.List; @@ -38,4 +40,20 @@ * @return */ List<FlowMyBusiness> selectListByDataId(String dataId); + + /** + * 鏍¢獙鐢ㄦ埛鏄惁鍙畬鎴愭浠诲姟 + * @param flowMyBusiness + * @param user + * @return + */ + boolean isUserAuthorized(FlowMyBusiness flowMyBusiness, LoginUser user); + + /** + * 棰嗗彇浠诲姟 + * @param taskId + * @param user + * @return + */ + boolean claimTask(String taskId, LoginUser user); } diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java index 99720f2..f0810ff 100644 --- a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java @@ -1,5 +1,6 @@ package org.jeecg.modules.flowable.apithird.business.service.impl; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -7,11 +8,15 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.collections4.CollectionUtils; import org.flowable.engine.HistoryService; +import org.flowable.engine.TaskService; import org.flowable.engine.history.HistoricActivityInstance; +import org.flowable.task.api.Task; +import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.flowable.apithird.business.dto.FlowMyBusinessDto; import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; import org.jeecg.modules.flowable.apithird.business.mapper.FlowMyBusinessMapper; import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService; +import org.jeecg.modules.flowable.apithird.entity.SysUser; import org.jeecg.modules.flowable.domain.dto.FlowTaskDto; import org.jeecg.modules.flowable.util.TimeUtil; import org.springframework.beans.factory.annotation.Autowired; @@ -36,6 +41,8 @@ @Autowired private HistoryService historyService; + @Autowired + private TaskService taskService; public HistoricActivityInstance getPreviousNode(String taskId) { // 鑾峰彇褰撳墠浠诲姟鐨勬墽琛屽疄渚� ID @@ -161,4 +168,25 @@ } return list; } + + @Override + public boolean isUserAuthorized(FlowMyBusiness flowMyBusiness, LoginUser user) { + List<String> todoUsers = JSON.parseArray(flowMyBusiness.getTodoUsers(), String.class); + return todoUsers != null && todoUsers.contains(user.getUsername()); + } + + @Override + public boolean claimTask(String taskId, LoginUser user) { + Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); + if (task == null) { + return false; + } + if (task.getAssignee() != null && !task.getAssignee().equals(user.getUsername())) { + return false; + } + taskService.claim(taskId, user.getUsername()); + return true; + } + + } -- Gitblit v1.9.3