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 47be8384..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,10 +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; /** @@ -14,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") 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 e52154fd..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()); @@ -1123,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); @@ -1168,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(), @@ -1193,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); @@ -1289,9 +1385,9 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe processStandardInterpretClauseService.saveOrUpdateBatch(newProcessStandardInterpretClauseList); } - if (StringUtils.isNotBlank(processStandardInterpret.getIsDistribute())){ + if (StringUtils.isNotBlank(processStandardInterpret.getDistribute())){ map.put(StandardInterpretCommon.PASS_FIRST, - Integer.parseInt(processStandardInterpret.getIsDistribute())); + Integer.parseInt(processStandardInterpret.getDistribute())); } processStandardInterpretService.updateById(processStandardInterpret); break;