diff --git a/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/entity/ProcessStandardInterpret.java b/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/entity/ProcessStandardInterpret.java index 0be28f7b..44f4aab4 100644 --- a/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/entity/ProcessStandardInterpret.java +++ b/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/entity/ProcessStandardInterpret.java @@ -2,6 +2,7 @@ package com.jero.modules.activiti.process.standardinterpret.entity; import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import com.jero.common.aspect.annotation.Dict; import com.jero.modules.laws.documenttool.entity.BaseEntity; @@ -18,6 +19,7 @@ import org.springframework.format.annotation.DateTimeFormat; */ @EqualsAndHashCode(callSuper = true) @Data +@TableName(value = "process_standard_interpret") public class ProcessStandardInterpret extends BaseEntity { /**主解读人*/ @ApiModelProperty(value = "主解读人") @@ -68,16 +70,16 @@ public class ProcessStandardInterpret extends BaseEntity { private String projectId; /**分解单来源(字典)*/ @ApiModelProperty(value = "分解单来源(字典)") - @Dict(dicCode = "process_manuscript") + @Dict(dicCode = "decomposition_source") private String decompositionSource; /**发起时是否选择了条款(字典:1:是,2:否)*/ @ApiModelProperty(value = "发起时是否选择了条款(字典:1:是,0:否)") @Dict(dicCode = "yn") - private String isChooseClause; + private String chooseClause; /**是否下发(字典:1:是,2:否)*/ @ApiModelProperty(value = "是否下发(字典:1:是,2:否)") @Dict(dicCode = "is_distribute") - private String isDistribute; + private String distribute; /**会签人员*/ @ApiModelProperty(value = "会签人员") @Dict(dictTable = "sys_user", dicCode = "id", dicText = "CONCAT(realname, '(', username, ')')") diff --git a/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/entity/ProcessStandardInterpretClause.java b/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/entity/ProcessStandardInterpretClause.java index 0da21848..4e0b4124 100644 --- a/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/entity/ProcessStandardInterpretClause.java +++ b/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/entity/ProcessStandardInterpretClause.java @@ -2,6 +2,7 @@ package com.jero.modules.activiti.process.standardinterpret.entity; import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; import com.jero.common.aspect.annotation.Dict; import com.jero.modules.laws.documenttool.entity.BaseEntity; import io.swagger.annotations.ApiModelProperty; @@ -17,6 +18,7 @@ import org.jeecgframework.poi.excel.annotation.Excel; */ @EqualsAndHashCode(callSuper = true) @Data +@TableName("process_standard_interpret_clause") public class ProcessStandardInterpretClause extends BaseEntity { /**标准解读流程id*/ @ApiModelProperty(value = "标准解读流程id") diff --git a/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/entity/ProcessStandardInterpretClauseSublist.java b/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/entity/ProcessStandardInterpretClauseSublist.java index 506228ba..a59449e4 100644 --- a/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/entity/ProcessStandardInterpretClauseSublist.java +++ b/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/entity/ProcessStandardInterpretClauseSublist.java @@ -2,9 +2,12 @@ package com.jero.modules.activiti.process.standardinterpret.entity; import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.jero.common.aspect.annotation.Dict; import com.jero.modules.laws.documenttool.entity.BaseEntity; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; import org.jeecgframework.poi.excel.annotation.Excel; /** @@ -13,7 +16,9 @@ import org.jeecgframework.poi.excel.annotation.Excel; * @author makejava * @since 2024-06-24 14:47:59 */ +@EqualsAndHashCode(callSuper = true) @Data +@TableName("process_standard_interpret_clause_sublist") public class ProcessStandardInterpretClauseSublist extends BaseEntity { /**标准解读流程_条款中间表id*/ @ApiModelProperty(value = "标准解读流程_条款中间表id") @@ -49,6 +54,7 @@ public class ProcessStandardInterpretClauseSublist extends BaseEntity { /**是否与上一版相同(字典:1:是,0:否)*/ @ApiModelProperty(value = "是否与上一版相同(字典:1:是,0:否)") @Excel(name = "是否与上一版相同", width = 15, dicCode = "yn") + @Dict(dicCode = "yn") private String isSameAsPrevVersion; /**变化点说明*/ @ApiModelProperty(value = "相对上一版变化点说明") @@ -61,39 +67,49 @@ public class ProcessStandardInterpretClauseSublist extends BaseEntity { /**涉及系统/部件)*/ @ApiModelProperty(value = "涉及系统/部件)") @Excel(name = "涉及系统/部件", width = 15) + @Dict(dictTable = "laws_part_name", dicCode = "code", dicText = "name") private String keywords; /**涉及系统/部件)*/ @ApiModelProperty(value = "关键控制器)") @Excel(name = "关键控制器", width = 15, dicCode = "key_controller") + @Dict(dicCode = "key_controller") private String keyController; /**责任部门*/ @ApiModelProperty(value = "责任部门") @Excel(name = "责任部门", width = 15, dictTable = "sys_depart", dicCode = "id", dicText = "depart_name") + @Dict(dictTable = "sys_depart", dicCode = "id", dicText = "depart_name") private String responsibleDepartment; /**责任部门专业模块*/ @ApiModelProperty(value = "责任部门专业模块") + @Dict(dicCode = "responsible_module") private String responsibleModule; /**关联部门*/ @ApiModelProperty(value = "关联部门") @Excel(name = "关联部门", width = 15, dictTable = "sys_depart", dicCode = "id", dicText = "depart_name") + @Dict(dictTable = "sys_depart", dicCode = "id", dicText = "depart_name") private String relatedDepartment; /**关联部门专业模块*/ @ApiModelProperty(value = "关联部门专业模块") + @Dict(dicCode = "related_module") private String relatedModule; /**适用车型*/ @ApiModelProperty(value = "适用车型") @Excel(name = "适用车型", width = 15, dicCode = "applicable_vehicle_type") + @Dict(dicCode = "applicable_vehicle_type") private String applications; /**动力类型*/ @ApiModelProperty(value = "动力类型") @Excel(name = "动力类型", width = 15, dicCode = "dynamic_type") + @Dict(dicCode = "dynamic_type") private String powerType; /**专业领域*/ @ApiModelProperty(value = "专业领域") @Excel(name = "专业领域", width = 15, dicCode = "professional_field") + @Dict(dicCode = "professional_field") private String domainArea; /**配置需求*/ @ApiModelProperty(value = "配置需求") + @Dict(dicCode = "configuration_requirements") private String configurationRequirements; /**新认证实施日期*/ @ApiModelProperty(value = "新认证实施日期") @@ -146,6 +162,7 @@ public class ProcessStandardInterpretClauseSublist extends BaseEntity { /**排查阶段*/ @ApiModelProperty(value = "排查阶段") @Excel(name = "排查阶段", width = 15, dicCode = "investigation_stage") + @Dict(dicCode = "investigation_stage") private java.lang.String investigationStage; /**p3*/ @ApiModelProperty(value = "p3") diff --git a/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/mapper/xml/ProcessStandardInterpretClauseSublistMapper.xml b/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/mapper/xml/ProcessStandardInterpretClauseSublistMapper.xml index f25df735..d2f8d02b 100644 --- a/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/mapper/xml/ProcessStandardInterpretClauseSublistMapper.xml +++ b/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/mapper/xml/ProcessStandardInterpretClauseSublistMapper.xml @@ -14,6 +14,7 @@ change_description, regulatory_notes, keywords, + key_controller, applicable_components, responsible_department, responsible_module, @@ -35,6 +36,7 @@ dfema, key_technology_decomposition_table, other_documents_templates, + investigation_stage, p3, p5, remarks, diff --git a/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/mapper/xml/ProcessStandardInterpretMapper.xml b/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/mapper/xml/ProcessStandardInterpretMapper.xml index 19912bdb..41a38bcc 100644 --- a/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/mapper/xml/ProcessStandardInterpretMapper.xml +++ b/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/mapper/xml/ProcessStandardInterpretMapper.xml @@ -17,8 +17,8 @@ split_info_id, project_id, decomposition_source, - is_distribute, - is_choose_clause, + distribute, + choose_clause, countersign_person_ids, uploader, approve_person_id, diff --git a/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/service/impl/StandardInterpretFlowServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/service/impl/StandardInterpretFlowServiceImpl.java index f52edee7..c1c0847d 100644 --- a/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/service/impl/StandardInterpretFlowServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/activiti/process/standardinterpret/service/impl/StandardInterpretFlowServiceImpl.java @@ -567,7 +567,8 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe processStandardInterpretClauseList = processStandardInterpretClauseService.queryList(processStandardInterpretClause); // 主控部门联络人分发 - if (StandardInterpretCommon.CONTACT_PERSON_DISTRIBUTE.equals(node)){ + if (StandardInterpretCommon.CONTACT_PERSON_DISTRIBUTE.equals(node) + && YesOrNoEnum.NO.getValue().equals(processStandardInterpret.getChooseClause())){ processStandardInterpretClauseList = new ArrayList<>(); } } @@ -630,9 +631,10 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe LambdaUpdateWrapper queryWrapper = new LambdaUpdateWrapper<>(); queryWrapper.eq(SarFileSplitInfoEO::getStandardId, standardId); List list = sarFileSplitInfoService.list(queryWrapper); - List dictItems = sysDictService.getDictItems("process_manuscript"); + List dictItems = sysDictService.getDictItems("decomposition_source"); for (DictModel dictItem : dictItems) { - if (list.stream().anyMatch(sarFileSplitInfoEO -> sarFileSplitInfoEO.getFileType().equals(dictItem.getValue()))){ + if (list.stream().anyMatch(v -> v.getFileType().equals(dictItem.getValue()) + || dictItem.getValue().equals("noncarry"))){ dictItem.setIsDisabled(YesOrNoEnum.NO.getValue()); }else { dictItem.setIsDisabled(YesOrNoEnum.YES.getValue()); @@ -968,23 +970,16 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe if (StringUtils.isNotBlank(keywords)){ boolean flag = true; List list = new ArrayList<>(); - List partNames = lawsPartNameService.list(new LambdaQueryWrapper() - .ne(PartName::getCode, "Part")); - List partNameList = partNameGetLevelPath(partNames); + List partNames = lawsPartNameService.list(); for (String str : keywords.split(",")) { - List path = - partNameList.stream().filter(o -> str.equals(o.getLevelPath())) - .collect(Collectors.toList()); - if (path.size() > 1){ - errorList.add("涉及系统/部件 中 !" + str + "存在多个!"); - flag = false; - break; - }else if (path.size() == 1){ - list.add(path.get(0).getId()); - }else { + Optional optionalPartName = + partNames.stream().filter(o -> str.equals(o.getCode())).findFirst(); + if (!optionalPartName.isPresent()){ errorList.add("涉及系统/部件不存在!"); flag = false; break; + }else { + data.setKeywords(optionalPartName.get().getCode()); } } if (flag){ @@ -1024,10 +1019,10 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe errorList.add("标准编号/条款号不能为空!"); exist = false; } - if (StringUtils.isBlank(itemTitle)){ - errorList.add("标准名称/条款标题不能为空!"); - exist = false; - } +// if (StringUtils.isBlank(itemTitle)){ +// errorList.add("标准名称/条款标题不能为空!"); +// exist = false; +// } if (i == 0 && exist){ // 第一行校验 String standardNumber = lawsDomesticStandard.getStandardNumber(); @@ -1042,10 +1037,9 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe LawsDocumentSplit lawsDocumentSplits = documentSplitMapper.selectOne( new LambdaQueryWrapper() .eq(LawsDocumentSplit::getInfoId, splitInfoId) - .eq(LawsDocumentSplit::getItemNum, itemNum) - .eq(LawsDocumentSplit::getItemTitle, itemTitle)); + .eq(LawsDocumentSplit::getItemNum, itemNum)); if (Objects.isNull(lawsDocumentSplits)){ - errorList.add("不存在条号为:" + itemNum + ",条款标题为:" + itemTitle + "的条款!"); + errorList.add("不存在条号为:" + itemNum + "的条款!"); }else { data.setClauseId(lawsDocumentSplits.getId()); data.setItemContent(lawsDocumentSplits.getItemContent()); @@ -1131,12 +1125,106 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe @Override public void flowSave(StandardInterpretFlowDTO standardInterpretFlowDTO) { // 处理业务数据 - handleBusinessData(standardInterpretFlowDTO); + handleBusinessDataSave(standardInterpretFlowDTO); // 保存流程信息 flowUtility.flowSaveUpdate(standardInterpretFlowDTO.getProcessAll(), standardInterpretFlowDTO.getProcessApprovalRecord()); } + private void handleBusinessDataSave(StandardInterpretFlowDTO standardInterpretFlowDTO) { + // map(参数) + Map map = standardInterpretFlowDTO.getMap(); + // 流程全局删除ids + List processAllDelIds = standardInterpretFlowDTO.getProcessAllDelIds(); + StandardInterpretDTO data = standardInterpretFlowDTO.getData(); + // 标准解读流程 + ProcessStandardInterpret processStandardInterpret = data.getProcessStandardInterpret(); + String standardInterpretId = StringUtils.isBlank(processStandardInterpret.getId()) ? + String.valueOf(SnowflakeUtils.snowflake()) : processStandardInterpret.getId(); + processStandardInterpret.setId(standardInterpretId); + // 标准解读流程_条款中间表 + List processStandardInterpretClauseList = + data.getProcessStandardInterpretClauseList(); + // 标准解读流程_条款中间表_子表 + List processStandardInterpretClauseSublistList = + data.getProcessStandardInterpretClauseSublistList(); + // 当前任务节点 + String node = StringUtils.isBlank(standardInterpretFlowDTO.getProcessApprovalRecord().getNodeId()) ? + StandardInterpretCommon.REGULATORY_ENGINEER_START + : standardInterpretFlowDTO.getProcessApprovalRecord().getNodeId(); + + // 删除旧数据 + processStandardInterpretService.removeByIds(processAllDelIds); + processStandardInterpretClauseService.removeByIds(processAllDelIds); + processStandardInterpretClauseSublistService.removeByIds(processAllDelIds); + + switch (node){ + // 主控部门联络人分发 + case StandardInterpretCommon.CONTACT_PERSON_DISTRIBUTE: + processStandardInterpretService.updateById(processStandardInterpret); + processStandardInterpretClauseService.removeByIds(processAllDelIds); + break; + // 标准主解读人分发 + case StandardInterpretCommon.MASTER_INTERPRET_DISTRIBUTE: + // 标准主解读人重新分发(分发) + case StandardInterpretCommon.MASTER_INTERPRET_AGAIN_DISTRIBUTE: + if (YesOrNoEnum.YES.getValue().equals(processStandardInterpret.getDistribute())){ + // 分发 + // 更新 标准解读流程_条款中间表 + processStandardInterpretClauseService.saveOrUpdateBatch(processStandardInterpretClauseList); + }else { + // 不分发 + // 保存标准解读流程_条款中间表_子表 + processStandardInterpretClauseSublistService + .saveOrUpdateBatch(processStandardInterpretClauseSublistList); + + // 判断是否有导入的数据,有则补齐对应中间表数据 + List newProcessStandardInterpretClauseList = new ArrayList<>(); + for (ProcessStandardInterpretClauseSublist standardInterpretClauseSublist : + processStandardInterpretClauseSublistList) { + int count = processStandardInterpretClauseService.count( + new LambdaQueryWrapper() + .eq(ProcessStandardInterpretClause::getId, + standardInterpretClauseSublist.getStandardInterpretClauseId()) + .eq(ProcessStandardInterpretClause::getClauseId, + standardInterpretClauseSublist.getClauseId())); + if (count <= 0){ + ProcessStandardInterpretClause newProcessStandardInterpretClause = + new ProcessStandardInterpretClause(); + String snowflake = String.valueOf(SnowflakeUtils.snowflake()); + newProcessStandardInterpretClause.setId(snowflake); + newProcessStandardInterpretClause.setStandardInterpretId(standardInterpretId); + newProcessStandardInterpretClause.setClauseId(standardInterpretClauseSublist.getClauseId()); + newProcessStandardInterpretClause.setDecompositionSource( + processStandardInterpret.getDecompositionSource()); + newProcessStandardInterpretClauseList.add(newProcessStandardInterpretClause); + // 更新 标准解读流程_条款中间表_子表关联关系 + processStandardInterpretClauseSublistService.update( + new LambdaUpdateWrapper() + .eq(ProcessStandardInterpretClauseSublist::getId, + standardInterpretClauseSublist.getId()) + .set(ProcessStandardInterpretClauseSublist::getStandardInterpretClauseId + , snowflake)); + } + } + processStandardInterpretClauseService.saveOrUpdateBatch(newProcessStandardInterpretClauseList); + } + + processStandardInterpretService.updateById(processStandardInterpret); + break; + // 标准主解读汇总(分发) + case StandardInterpretCommon.MASTER_INTERPRET_SUMMARY: + processStandardInterpretService.updateById(processStandardInterpret); + processStandardInterpretClauseSublistService + .saveOrUpdateBatch(processStandardInterpretClauseSublistList); + break; + default: + processStandardInterpretClauseSublistService + .saveOrUpdateBatch(processStandardInterpretClauseSublistList); + break; + } + } + @Override public void flowTransfer(String taskId, String userId) { processHandleService.transfer(taskId, userId); @@ -1176,7 +1264,7 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe processStandardInterpretService.saveOrUpdate(processStandardInterpret); // 如果没选择条款 if (CollectionUtils.isEmpty(processStandardInterpretClauseList)){ - processStandardInterpret.setIsChooseClause(YesOrNoEnum.NO.getValue()); + processStandardInterpret.setChooseClause(YesOrNoEnum.NO.getValue()); // 自动保存所有条款 processStandardInterpretClauseList = getClauseList(processStandardInterpret.getStandardId(), @@ -1201,7 +1289,7 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe case StandardInterpretCommon.MASTER_INTERPRET_DISTRIBUTE: // 标准主解读人重新分发(分发) case StandardInterpretCommon.MASTER_INTERPRET_AGAIN_DISTRIBUTE: - if (YesOrNoEnum.YES.getValue().equals(processStandardInterpret.getIsDistribute())){ + if (YesOrNoEnum.YES.getValue().equals(processStandardInterpret.getDistribute())){ // 分发 // 删除旧数据 processStandardInterpretClauseService.removeByIds(processAllDelIds); @@ -1297,8 +1385,10 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe processStandardInterpretClauseService.saveOrUpdateBatch(newProcessStandardInterpretClauseList); } - map.put(StandardInterpretCommon.PASS_FIRST, - Integer.parseInt(processStandardInterpret.getIsDistribute())); + if (StringUtils.isNotBlank(processStandardInterpret.getDistribute())){ + map.put(StandardInterpretCommon.PASS_FIRST, + Integer.parseInt(processStandardInterpret.getDistribute())); + } processStandardInterpretService.updateById(processStandardInterpret); break; // 标准主解读汇总(分发)