From 457fa2cb4cc7c78f1caace6ef34207ff785144f9 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期四, 17 七月 2025 17:14:00 +0800 Subject: [PATCH] art: 技术状态鉴定申请-工单生成 --- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationApplicationServiceImpl.java | 427 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 420 insertions(+), 7 deletions(-) diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationApplicationServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationApplicationServiceImpl.java index a33d873..865ab2e 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationApplicationServiceImpl.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationApplicationServiceImpl.java @@ -1,11 +1,49 @@ package org.jeecg.modules.eam.service.impl; -import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationApplication; -import org.jeecg.modules.eam.mapper.EamTechnicalStatusEvaluationApplicationMapper; -import org.jeecg.modules.eam.service.IEamTechnicalStatusEvaluationApplicationService; -import org.springframework.stereotype.Service; - +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.constant.CommonConstant; +import org.jeecg.common.constant.DataBaseConstant; +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.HfTemplateCategoryEnum; +import org.jeecg.modules.eam.constant.TechnicalStatusEvaluationApplicationStatusEnum; +import org.jeecg.modules.eam.entity.*; +import org.jeecg.modules.eam.mapper.EamTechnicalStatusEvaluationApplicationMapper; +import org.jeecg.modules.eam.request.EamTechnicalStatusEvaluationApplicationQuery; +import org.jeecg.modules.eam.request.EamTechnicalStatusEvaluationApplicationRequest; +import org.jeecg.modules.eam.request.EamTechnicalStatusEvaluationOrderRequest; +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; +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.entity.BaseFactory; +import org.jeecg.modules.system.entity.BaseFactoryUser; +import org.jeecg.modules.system.service.IBaseFactoryService; +import org.jeecg.modules.system.service.IBaseFactoryUserService; +import org.jeecg.modules.system.service.ISysBusinessCodeRuleService; +import org.jeecg.modules.system.service.ISysUserService; +import org.jeecg.modules.system.vo.UserSelector; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import java.util.stream.Collectors; /** * @Description: 鍔犲伐璁惧鎶�鏈壌瀹氱敵璇� @@ -13,7 +51,382 @@ * @Date: 2025-07-09 * @Version: V1.0 */ -@Service -public class EamTechnicalStatusEvaluationApplicationServiceImpl extends ServiceImpl<EamTechnicalStatusEvaluationApplicationMapper, EamTechnicalStatusEvaluationApplication> implements IEamTechnicalStatusEvaluationApplicationService { +@Service("IEamTechnicalStatusEvaluationApplicationService") +public class EamTechnicalStatusEvaluationApplicationServiceImpl extends ServiceImpl<EamTechnicalStatusEvaluationApplicationMapper, EamTechnicalStatusEvaluationApplication> implements IEamTechnicalStatusEvaluationApplicationService, FlowCallBackServiceI { + @Autowired + private IBaseFactoryUserService baseFactoryUserService; + @Autowired + private IBaseFactoryService baseFactoryService; + @Autowired + private IEamEquipmentService equipmentService; + @Autowired + private ISysBusinessCodeRuleService businessCodeRuleService; + @Autowired + private IEamBaseHFCodeService hfCodeService; + @Autowired + private FlowCommonService flowCommonService; + @Autowired + private IFlowDefinitionService flowDefinitionService; + @Autowired + private IFlowMyBusinessService flowMyBusinessService; + @Autowired + private IFlowTaskService flowTaskService; + @Autowired + private ISysUserService sysUserService; + @Autowired + private IEamTechnicalStatusEvaluationStandardService evaluationStandardService; + @Autowired + private IEamTechnicalStatusEvaluationStandardDetailService evaluationStandardDetailService; + @Autowired + private IEamTechnicalStatusEvaluationOrderService evaluationOrderService; + @Override + public IPage<EamTechnicalStatusEvaluationApplication> queryPageList(Page<EamTechnicalStatusEvaluationApplication> page, EamTechnicalStatusEvaluationApplicationQuery query) { + QueryWrapper<EamTechnicalStatusEvaluationOrderChange> queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("ems.del_flag", CommonConstant.DEL_FLAG_0); + //鐢ㄦ埛鏁版嵁鏉冮檺 + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if (sysUser == null) { + return page; + } + if (StringUtils.isNotBlank(sysUser.getEamEquipmentIds())) { + //閫夋嫨浜嗚澶囷紝鏍规嵁璁惧id杩囨护璁惧 + List<String> equipArr = Arrays.asList(sysUser.getEamEquipmentIds().split(",")); + queryWrapper.in("e.equipment_code", equipArr); + } else { + //娌℃湁閫夋嫨璁惧锛屾牴鎹腑蹇冭繃婊よ澶� + List<BaseFactoryUser> baseFactoryUserList = baseFactoryUserService. + list(new LambdaQueryWrapper<BaseFactoryUser>().eq(BaseFactoryUser::getUserId, sysUser.getId())); + if (!CollectionUtils.isEmpty(baseFactoryUserList)) { + Set<String> factoryIds = baseFactoryUserList.stream().map(BaseFactoryUser::getFactoryId).collect(Collectors.toSet()); + Set<String> factoryCodeList = baseFactoryService.listByIds(factoryIds).stream().map(BaseFactory::getOrgCode).collect(Collectors.toSet()); + queryWrapper.in("e.factory_org_code", factoryCodeList); + } else { + return page; + } + } + if (query != null) { + //缂栫爜 妯$硦鏌ヨ + if (StringUtils.isNotBlank(query.getApplicationOrderNum())) { + queryWrapper.like("ems.application_order_num", query.getApplicationOrderNum()); + } + //璁惧 + if (StringUtils.isNotBlank(query.getEquipmentId())) { + queryWrapper.eq("ems.equipment_id", query.getEquipmentId()); + } + //浣跨敤鍗曚綅 + if(StringUtils.isNotBlank(query.getFactoryOrgCode())) { + queryWrapper.eq("ems.factory_org_code", query.getFactoryOrgCode()); + } + //淇濆吇鍒嗙被 + if (StringUtils.isNotBlank(query.getApplicationStatus())) { + queryWrapper.eq("ems.application_status", query.getApplicationStatus()); + } + if (query.getDateBegin() != null && query.getDateEnd() != null) { + queryWrapper.between("ems.apply_date", query.getDateBegin(), query.getDateEnd()); + } + //鎺掑簭 + if (StringUtils.isNotBlank(query.getColumn()) && StringUtils.isNotBlank(query.getOrder())) { + String column = query.getColumn(); + if (column.endsWith(CommonConstant.DICT_TEXT_SUFFIX)) { + column = column.substring(0, column.lastIndexOf(CommonConstant.DICT_TEXT_SUFFIX)); + } + if (DataBaseConstant.SQL_ASC.equalsIgnoreCase(query.getOrder())) { + queryWrapper.orderByAsc("ems." + oConvertUtils.camelToUnderline(column)); + } else { + queryWrapper.orderByDesc("ems." + oConvertUtils.camelToUnderline(column)); + } + } else { + queryWrapper.orderByDesc("ems.create_time"); + } + } else { + queryWrapper.orderByDesc("ems.create_time"); + } + return this.getBaseMapper().queryPageList(page, queryWrapper); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean addEamTechnicalStatusEvaluationApplication(EamTechnicalStatusEvaluationApplication request) { + //鏌ヨ璁惧 + EamEquipment equipment = equipmentService.getById(request.getEquipmentId()); + if (equipment == null) { + throw new JeecgBootException("璁惧淇℃伅涓嶅瓨鍦紝鎿嶄綔澶辫触锛�"); + } + EamTechnicalStatusEvaluationStandard standard = evaluationStandardService.queryEnableStandard(request.getEquipmentId()); + if(standard == null) { + throw new JeecgBootException("璁惧鏈厤缃妧鏈姸鎬侀壌瀹氳鑼冿紝鎿嶄綔澶辫触锛�"); + } + List<EamTechnicalStatusEvaluationStandardDetail> standardDetailList = evaluationStandardDetailService.queryList(standard.getId()); + if(CollectionUtil.isEmpty(standardDetailList)) { + throw new JeecgBootException("璁惧鏈厤缃妧鏈姸鎬侀壌瀹氳鑼冿紝鎿嶄綔澶辫触锛�"); + } + //鐢ㄦ埛鏁版嵁鏉冮檺 + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if (sysUser == null) { + throw new JeecgBootException("鐧诲綍鐢ㄦ埛淇℃伅涓虹┖锛屾搷浣滃け璐ワ紒"); + } + String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.TECHNICAL_STATUS_EVALUATION_APPLY_CODE_RULE); + request.setApplicationOrderNum(codeSeq); + request.setId(null); + request.setApplicationStatus(TechnicalStatusEvaluationApplicationStatusEnum.WAIT_SUBMIT.name()); + request.setDelFlag(CommonConstant.DEL_FLAG_0); + request.setApplicant(sysUser.getUsername()); + request.setApplyDate(new Date()); + request.setFactoryOrgCode(equipment.getFactoryOrgCode()); + //鎶�鏈姸鎬侀壌瀹氳〃 + EamBaseHFCode eamBaseHFCode = hfCodeService.selectByCategory(HfTemplateCategoryEnum.TECHNICAL_STATUS_EVALUATION_APPLY.name()); + if (eamBaseHFCode == null) { + throw new JeecgBootException("鏈厤缃妧鏈姸鎬侀壌瀹氱敵璇风殑HF缂栫爜锛屾坊鍔犲け璐ワ紒"); + } + request.setHfCode(eamBaseHFCode.getHfCode()); + this.getBaseMapper().insert(request); + return true; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean editEamTechnicalStatusEvaluationApplication(EamTechnicalStatusEvaluationApplication request) { + EamTechnicalStatusEvaluationApplication entity = this.getBaseMapper().selectById(request.getId()); + if(entity == null) { + throw new JeecgBootException("缂栬緫鐨勬暟鎹凡鍒犻櫎锛岃鍒锋柊閲嶈瘯锛�"); + } + if(!TechnicalStatusEvaluationApplicationStatusEnum.WAIT_SUBMIT.name().equals(entity.getApplicationStatus())) { + throw new JeecgBootException("鍙湁寰呮彁浜ょ姸鎬佹墠鍙紪杈戯紒"); + } + entity.setRemark(request.getRemark()); + entity.setEvaluationDate(request.getEvaluationDate()); + this.getBaseMapper().updateById(entity); + return true; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean submit(String id) { + EamTechnicalStatusEvaluationApplication entity = this.getBaseMapper().selectById(id); + if (entity == null) { + throw new JeecgBootException("瑕佹彁浜ょ殑宸ュ崟涓嶅瓨鍦紝璇峰埛鏂伴噸璇曪紒"); + } + if (!TechnicalStatusEvaluationApplicationStatusEnum.WAIT_SUBMIT.name().equals(entity.getApplicationStatus())) { + throw new JeecgBootException("璇ュ伐鍗曞凡杩涜杩囨彁浜わ紒"); + } + EamEquipment equipment = equipmentService.getById(entity.getEquipmentId()); + if (equipment == null) { + throw new JeecgBootException("璁惧涓嶅瓨鍦紝娣诲姞澶辫触锛�"); + } + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if(sysUser == null || !sysUser.getUsername().equals(entity.getApplicant())) { + throw new JeecgBootException("涓嶆槸鏈汉锛屼笉鑳芥彁浜ゆ宸ュ崟锛�"); + } + entity.setApplicationStatus(TechnicalStatusEvaluationApplicationStatusEnum.DEPART_HEADER_SIGNING.name()); + //鏌ヨ涓嬬骇瀹℃壒浜哄憳 + List<UserSelector> userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0011); + if (CollectionUtil.isEmpty(userSelectors)) { + throw new JeecgBootException("璁惧鏈垎閰嶇粰浣跨敤鍗曚綅涓荤瀹ょ骇棰嗗锛屾棤娉曟彁浜わ紒"); + } + List<String> userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList()); + //鏇存柊瀹炰綋 + this.getBaseMapper().updateById(entity); + //鍚姩娴佺▼ + flowCommonService.initActBusiness("宸ュ崟鍙�: " + entity.getApplicationOrderNum() + ";璁惧缂栧彿: " + equipment.getEquipmentCode() + ";瀹夎浣嶇疆" + equipment.getInstallationPosition(), + entity.getId(), "IEamTechnicalStatusEvaluationApplicationService", "technical_status_evaluation_apply_process", null); + Map<String, Object> variables = new HashMap<>(); + variables.put("dataId", entity.getId()); + if (StrUtil.isEmpty(entity.getRemark())) { + variables.put("organization", "鏂板鎶�鏈姸鎬侀壌瀹氬伐鍗曞彉鏇撮粯璁ゅ惎鍔ㄦ祦绋�"); + variables.put("comment", "鏂板鎶�鏈姸鎬侀壌瀹氬伐鍗曞彉鏇撮粯璁ゅ惎鍔ㄦ祦绋�"); + } else { + variables.put("organization", entity.getRemark()); + variables.put("comment", entity.getRemark()); + } + variables.put("proofreading", true); + variables.put("NextAssignee", userApprovalList); + Result<?> result = flowDefinitionService.startProcessInstanceByKey("technical_status_evaluation_apply_process", variables); + if(result == null || !result.isSuccess()) { + throw new JeecgBootException("鍚姩娴佺▼澶辫触锛�"); + } + return true; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public EamTechnicalStatusEvaluationApplication approval(EamTechnicalStatusEvaluationApplicationRequest request) { + EamTechnicalStatusEvaluationApplication 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("璁惧涓嶅瓨鍦紝璇锋鏌ワ紒"); + } + + TechnicalStatusEvaluationApplicationStatusEnum status = TechnicalStatusEvaluationApplicationStatusEnum.getInstance(entity.getApplicationStatus()); + if (status == null) { + return null; + } + //娴佺▼鍙橀噺 + Map<String, Object> values = new HashMap<>(); + List<String> userApprovalList; + List<UserSelector> userSelectors; + switch (status) { + case DEPART_HEADER_SIGNING: + //浣跨敤鍗曚綅涓荤瀹ょ骇棰嗗 + userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0006); + if (CollectionUtil.isEmpty(userSelectors)) { + throw new JeecgBootException("璁惧鏈垎閰嶇粰鐢熶骇璁惧绠$悊涓荤锛屾棤娉曡繘鍏ヤ笅绾у鎵癸紒"); + } + userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList()); + values.put("dataId", entity.getId()); + if(StringUtils.isBlank(request.getDepartHeaderComment())) { + values.put("organization", "鎶�鏈姸鎬侀壌瀹氱敵璇蜂娇鐢ㄥ崟浣嶄富绠″绾ч瀵�"); + values.put("comment", "鎶�鏈姸鎬侀壌瀹氱敵璇蜂娇鐢ㄥ崟浣嶄富绠″绾ч瀵�"); + request.setComment("鎶�鏈姸鎬侀壌瀹氱敵璇蜂娇鐢ㄥ崟浣嶄富绠″绾ч瀵�"); + } else { + values.put("organization", request.getDepartHeaderComment()); + values.put("comment", request.getDepartHeaderComment()); + request.setComment(request.getDepartHeaderComment()); + } + //璁剧疆entity + entity.setDepartHeaderSignature(user.getUsername()); + entity.setDepartHeaderSignatureTime(new Date()); + entity.setDepartHeaderComment(request.getDepartHeaderComment()); + entity.setDepartHeaderSignatureResult(request.getDepartHeaderSignatureResult()); + values.put("departHeaderConfirmFlag", request.getDepartHeaderSignatureResult()); + if(BusinessCodeConst.APPROVED.equals(request.getDepartHeaderSignatureResult())) { + //閫氳繃 + entity.setApplicationStatus(TechnicalStatusEvaluationApplicationStatusEnum.PRODUCTION_HEADER_SIGNING.name()); + values.put("NextAssignee", userApprovalList); + }else { + //椹冲洖 + entity.setApplicationStatus(TechnicalStatusEvaluationApplicationStatusEnum.REJECTED.name()); + } + break; + case PRODUCTION_HEADER_SIGNING: + //閮ㄩ棬棰嗗瀹℃牳 + userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0017); + if (CollectionUtil.isEmpty(userSelectors)) { + throw new JeecgBootException("璁惧鏈垎閰嶇粰鐢熶骇淇濋殰閮ㄩ瀵硷紝鏃犳硶杩涘叆涓嬬骇瀹℃壒锛�"); + } + userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList()); + values.put("dataId", entity.getId()); + if(StringUtils.isBlank(request.getProductionHeaderComment())) { + values.put("organization", "鎶�鏈姸鎬侀壌瀹氱敵璇风敓浜ц澶囩鐞嗕富绠″鏍�"); + values.put("comment", "鎶�鏈姸鎬侀壌瀹氱敵璇风敓浜ц澶囩鐞嗕富绠″鏍�"); + request.setComment("鎶�鏈姸鎬侀壌瀹氱敵璇风敓浜ц澶囩鐞嗕富绠″鏍�"); + } else { + values.put("organization", request.getProductionHeaderComment()); + values.put("comment", request.getProductionHeaderComment()); + request.setComment(request.getProductionHeaderComment()); + } + //璁剧疆entity + entity.setProductionHeaderSignature(user.getUsername()); + entity.setProductionHeaderSignatureTime(new Date()); + entity.setProductionHeaderSignatureResult(request.getProductionHeaderSignatureResult()); + entity.setProductionHeaderComment(request.getProductionHeaderComment()); + if(BusinessCodeConst.APPROVED.equals(request.getProductionHeaderSignatureResult())) { + //閫氳繃 + entity.setApplicationStatus(TechnicalStatusEvaluationApplicationStatusEnum.PRODUCTION_SUPPORT_SIGNING.name()); + values.put("NextAssignee", userApprovalList); + }else { + //椹冲洖 + entity.setApplicationStatus(TechnicalStatusEvaluationApplicationStatusEnum.REJECTED.name()); + } + break; + case PRODUCTION_SUPPORT_SIGNING: + //缁翠慨瀹や富浠荤瀛� + values.put("dataId", entity.getId()); + if(StringUtils.isBlank(request.getProductionSupportComment())) { + values.put("organization", "鎶�鏈姸鎬侀壌瀹氬伐鍗曞彉鏇寸敓浜т繚闅滈儴瀹℃牳"); + values.put("comment", "鎶�鏈姸鎬侀壌瀹氬伐鍗曞彉鏇寸敓浜т繚闅滈儴瀹℃牳"); + request.setComment("鎶�鏈姸鎬侀壌瀹氬伐鍗曞彉鏇寸敓浜т繚闅滈儴瀹℃牳"); + } else { + values.put("organization", request.getProductionSupportComment()); + values.put("comment", request.getProductionSupportComment()); + request.setComment(request.getProductionSupportComment()); + } + //璁剧疆entity + entity.setProductionSupportSignature(user.getUsername()); + entity.setProductionSupportSignatureTime(new Date()); + entity.setProductionSupportSignatureResult(request.getProductionSupportSignatureResult()); + entity.setProductionSupportComment(request.getProductionSupportComment()); + if(BusinessCodeConst.APPROVED.equals(request.getProductionSupportSignatureResult())) { + //閫氳繃 + entity.setApplicationStatus(TechnicalStatusEvaluationApplicationStatusEnum.COMPLETED.name()); + //鐢熸垚宸ュ崟 + EamTechnicalStatusEvaluationStandard standard = evaluationStandardService.queryEnableStandard(request.getEquipmentId()); + if(standard == null) { + throw new JeecgBootException("璁惧鏈厤缃妧鏈姸鎬侀壌瀹氳鑼冿紝鎿嶄綔澶辫触锛�"); + } + EamTechnicalStatusEvaluationOrderRequest orderRequest = new EamTechnicalStatusEvaluationOrderRequest(); + orderRequest.setEquipmentId(equipment.getId()); + orderRequest.setEvaluationDate(entity.getEvaluationDate()); + orderRequest.setStandardId(standard.getId()); + orderRequest.setRemark(entity.getRemark()); + boolean b = evaluationOrderService.addTechnicalStatusEvaluationOrder(orderRequest); + if(!b) { + throw new JeecgBootException("鐢熸垚鎶�鏈姸鎬侀壌瀹氬伐鍗曞け璐ワ紒"); + } + }else { + //椹冲洖 + entity.setApplicationStatus(TechnicalStatusEvaluationApplicationStatusEnum.REJECTED.name()); + } + 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();//鍓嶇浼犺繘鏉ョ殑鍙傛暟 + business.getActStatus(); + } + + @Override + public Object getBusinessDataById(String dataId) { + return this.getById(dataId); + } + + @Override + public Map<String, Object> flowValuesOfTask(String taskNameId, Map<String, Object> values) { + return null; + } + + @Override + public List<String> flowCandidateUsernamesOfTask(String taskNameId, Map<String, Object> values) { + //涓氬姟鏄惁骞查娴佺▼锛屼笟鍔″共棰勶紝娴佺▼骞查锛屾寚瀹氫汉鍛樿繘琛屽鐞� + //鑾峰彇涓嬩竴姝ュ鐞嗕汉 + Object object = values.get("NextAssignee"); + return (List<String>) object; + } } -- Gitblit v1.9.3