feat(标准解读流程): 子解读多人分发完善

This commit is contained in:
yjz
2024-07-10 19:49:48 +08:00
parent 7071f7faf7
commit 9d87c551bd
6 changed files with 161 additions and 114 deletions
@@ -129,4 +129,9 @@ public class StandardInterpretCommon {
* 标准主解读人 未分发数量 网关节点
*/
public static final String UNALLOCATED_QUANTITY = "unallocatedQuantity";
/**
* 唯一标识
*/
public static final String SNOWFLAKE = "snowflake";
}
@@ -152,6 +152,7 @@ public class StandardInterpretFlowController {
@ApiOperation(value="标准解读流程-流程转办", notes="标准解读流程-流程转办")
@GetMapping(value = "/flowTransfer")
public Result<T> flowTransfer(@ApiParam("任务id") String taskId, @ApiParam("用户id") String userId) {
log.info("");
standardInterpretFlowService.flowTransfer(taskId, userId);
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
}
@@ -178,7 +179,8 @@ public class StandardInterpretFlowController {
@PostMapping(value = "/importExcelByUnDistribute")
@Translation
public Result<List<ProcessStandardInterpretClauseSublist>> importExcelByUnDistribute(HttpServletRequest request,
HttpServletResponse response) throws Exception {
HttpServletResponse response)
throws Exception {
return standardInterpretFlowService.importExcelByUnDistribute(request, response);
}
@@ -21,9 +21,9 @@ public class ProcessStandardInterpretClauseSublist extends BaseEntity {
/**条款id/标准id*/
@ApiModelProperty(value = "条款id/标准id")
private String clauseId;
/**父任务id*/
@ApiModelProperty(value = "父任务id")
private String parentTaskId;
/**唯一标识*/
@ApiModelProperty(value = "唯一标识")
private String snowFlake;
/**条款号/标准编号*/
@ApiModelProperty(value = "条款号/标准编号")
@TableField(exist = false)
@@ -5,7 +5,7 @@
<select id="queryList"
resultType="com.jero.modules.activiti.process.standardinterpret.entity.ProcessStandardInterpretClauseSublist">
select psic2.*,
psics.id,
psics.id id,
standard_interpret_clause_id,
clause_id,
interpret_person_id,
@@ -44,7 +44,7 @@
update_by,
update_time
from process_standard_interpret_clause_sublist psics
left join (select psic.id,
left join (select psic.id interpret_clause_id,
IF(lds.id is not null, lds.standard_number, lds2.item_num) itemNum,
IF(lds.id is not null, lds.standard_name, lds2.item_title) itemTitle,
IF(lds.id is not null, null, lds2.item_content) itemContent,
@@ -52,7 +52,7 @@
from laws_chery_dev.process_standard_interpret_clause psic
left join laws_domestic_standard lds on psic.clause_id = lds.id and lds.del_flag = 0
left join laws_document_split lds2 on psic.clause_id = lds2.id and lds2.del_flag = 0) psic2
on psics.standard_interpret_clause_id = psic2.id
on psics.standard_interpret_clause_id = psic2.interpret_clause_id
${ew.customSqlSegment}
</select>
</mapper>
@@ -42,9 +42,9 @@ public class ProcessStandardInterpretClauseSublistServiceImpl
queryWrapper.eq(StringUtils.isNotBlank(processStandardInterpretClauseSublist.getInterpretPersonId()),
"interpret_person_id",
processStandardInterpretClauseSublist.getInterpretPersonId());
queryWrapper.eq(StringUtils.isNotBlank(processStandardInterpretClauseSublist.getParentTaskId()),
"psics.parent_task_id",
processStandardInterpretClauseSublist.getParentTaskId());
queryWrapper.eq(StringUtils.isNotBlank(processStandardInterpretClauseSublist.getSnowFlake()),
"psics.snow_flake",
processStandardInterpretClauseSublist.getSnowFlake());
queryWrapper.eq("psics.del_flag", CommonConstant.DEL_FLAG_0);
queryWrapper.orderByAsc("psics.id");
return processStandardInterpretClauseSublistMapper.queryList(queryWrapper);
@@ -116,6 +116,7 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
private final LawsDocumentSplitMapper lawsDocumentSplitMapper;
private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
private final List<String> tempList = new ArrayList<>();
@Override
public void flowStart(StandardInterpretFlowDTO standardInterpretFlowDTO) {
@@ -191,9 +192,22 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
// 更新业务表
handleBusinessData(standardInterpretFlowDTO);
// 更新流程实例节点关联用户表
processNodeLinkService.saveNodeUserLink(processAll.getProcessDefinitionId(), processAll.getProcessInstanceId(),
flowUtility.listToString(map));
// 完成任务
taskService.complete(processAll.getTaskId(), map);
// 特殊节点
String nodeId = processApprovalRecord.getNodeId();
if (StandardInterpretCommon.MASTER_INTERPRET_APPROVE.equals(nodeId)){
// 更新流程总表状态
processAllService.update(new LambdaUpdateWrapper<ProcessAll>()
.eq(ProcessAll::getProjectId, processAll.getProjectId())
.set(ProcessAll::getPrcStatus, ProcessStatusEnum.INCOMPLETE.getValue()));
}
// 流程结束
if (flowUtility.isLastNode(processAll.getProcessInstanceId())){
// 查询业务信息
@@ -230,51 +244,53 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
variables.put(StandardInterpretCommon.MASTER_INTERPRET, masterInterpret);
if (StandardInterpretCommon.AUTO_TASK_1.equals(taskDefinitionKey)
|| StandardInterpretCommon.AUTO_TASK_3.equals(taskDefinitionKey)) {
// 获取子解读人
String interpretingPeoples = (String) delegateTask.getVariable(StandardInterpretCommon.INTERPRETING_PEOPLE);
List<String> interpretingPeopleList = Arrays.asList(interpretingPeoples.split(","));
for (String interpretingPeople : interpretingPeopleList) {
// 循环发起 标准解读流程(主解读重新分发子流程)
variables.put(StandardInterpretCommon.INTERPRETING_PEOPLE, interpretingPeople);
StandardInterpretFlowDTO standardInterpretFlowDTO = new StandardInterpretFlowDTO();
// 流程信息
ProcessAll processAll = new ProcessAll();
processAll.setProjectId(processAlls.getProjectId());
standardInterpretFlowDTO.setProcessAll(processAll);
ProcessApprovalRecord processApprovalRecord = new ProcessApprovalRecord();
processApprovalRecord.setParentTaskId(taskId);
processApprovalRecord.setUserId(interpretingPeople);
processApprovalRecord.setFinishFlag(FinishFlagEnum.INCOMPLETE.getValue());
standardInterpretFlowDTO.setProcessApprovalRecord(processApprovalRecord);
standardInterpretFlowDTO.setMap(variables);
// 更新 标准解读流程_条款中间表_子表 parentId
ProcessStandardInterpret processStandardInterpret = processStandardInterpretService.getOne(
new LambdaQueryWrapper<ProcessStandardInterpret>()
// 分发子流程数据
ProcessStandardInterpret processStandardInterpret = processStandardInterpretService.getOne(
new LambdaQueryWrapper<ProcessStandardInterpret>()
.eq(ProcessStandardInterpret::getProjectId, processAlls.getProjectId()));
if (!Objects.isNull(processStandardInterpret)){
String id = processStandardInterpret.getId();
List<ProcessStandardInterpretClause> processStandardInterpretClauseList =
processStandardInterpretClauseService.list(
new LambdaQueryWrapper<ProcessStandardInterpretClause>()
.eq(ProcessStandardInterpretClause::getStandardInterpretId, id));
if (!processStandardInterpretClauseList.isEmpty()){
List<String> standardInterpretClauseIdList = processStandardInterpretClauseList.stream()
.map(ProcessStandardInterpretClause::getId).collect(Collectors.toList());
if (!Objects.isNull(processStandardInterpret)){
String id = processStandardInterpret.getId();
List<ProcessStandardInterpretClause> processStandardInterpretClauseList =
processStandardInterpretClauseService.list(
new LambdaQueryWrapper<ProcessStandardInterpretClause>()
.eq(ProcessStandardInterpretClause::getStandardInterpretId, id));
for (ProcessStandardInterpretClause processStandardInterpretClause :
processStandardInterpretClauseList) {
List<ProcessStandardInterpretClauseSublist> list =
processStandardInterpretClauseSublistService.list(
new LambdaQueryWrapper<ProcessStandardInterpretClauseSublist>()
.eq(ProcessStandardInterpretClauseSublist::getStandardInterpretClauseId,
processStandardInterpretClause.getId()));
for (ProcessStandardInterpretClauseSublist processStandardInterpretClauseSublist : list) {
// 解读人
String interpretPersonId = processStandardInterpretClauseSublist.getInterpretPersonId();
variables.put(StandardInterpretCommon.INTERPRETING_PEOPLE, interpretPersonId);
StandardInterpretFlowDTO standardInterpretFlowDTO = new StandardInterpretFlowDTO();
// 流程信息
ProcessAll processAll = new ProcessAll();
processAll.setProjectId(processAlls.getProjectId());
standardInterpretFlowDTO.setProcessAll(processAll);
ProcessApprovalRecord processApprovalRecord = new ProcessApprovalRecord();
processApprovalRecord.setParentTaskId(taskId);
processApprovalRecord.setUserId(interpretPersonId);
processApprovalRecord.setFinishFlag(FinishFlagEnum.INCOMPLETE.getValue());
standardInterpretFlowDTO.setProcessApprovalRecord(processApprovalRecord);
standardInterpretFlowDTO.setMap(variables);
// 添加唯一标识,用于数据权限
String snowFlake = String.valueOf(SnowflakeUtils.snowflake());
variables.put(StandardInterpretCommon.SNOWFLAKE, snowFlake);
// 发起子流程
childrenFlowStart(standardInterpretFlowDTO);
processStandardInterpretClauseSublistService.update(
new LambdaUpdateWrapper<ProcessStandardInterpretClauseSublist>()
.in(ProcessStandardInterpretClauseSublist::getStandardInterpretClauseId
, standardInterpretClauseIdList)
.eq(ProcessStandardInterpretClauseSublist::getInterpretPersonId,
interpretingPeople)
.set(ProcessStandardInterpretClauseSublist::getParentTaskId, taskId));
.eq(ProcessStandardInterpretClauseSublist::getId,
processStandardInterpretClauseSublist.getId())
.set(ProcessStandardInterpretClauseSublist::getSnowFlake, snowFlake));
}
}
childrenFlowStart(standardInterpretFlowDTO);
log.info("循环发起 标准解读流程(主解读人重新分发子流程)");
}
log.info("子流程个数:{}",interpretingPeopleList.size());
}else if (StandardInterpretCommon.AUTO_TASK_2.equals(taskDefinitionKey)){
StandardInterpretFlowDTO standardInterpretFlowDTO = new StandardInterpretFlowDTO();
// 流程信息
@@ -306,76 +322,84 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
// 根据条款分组
Map<String, List<ProcessStandardInterpretClauseSublist>> listMap =
processStandardInterpretClauseSublistList.stream()
.collect(Collectors.groupingBy(ProcessStandardInterpretClauseSublist::getClauseId));
.collect(Collectors.groupingBy(ProcessStandardInterpretClauseSublist::getClauseId));
listMap.forEach((k, v) -> {
ProcessStandardInterpretClauseSublist first = v.get(0);
v.remove(0);
for (ProcessStandardInterpretClauseSublist standardInterpretClauseSublist : v) {
// 合并
first.setInterpretPersonId(first.getInterpretPersonId()
+ "," + standardInterpretClauseSublist.getInterpretPersonId());
first.setTranslation(first.getTranslation()
+ "," + standardInterpretClauseSublist.getTranslation());
first.setIsSameAsPrevVersion(first.getIsSameAsPrevVersion()
+ "," + standardInterpretClauseSublist.getIsSameAsPrevVersion());
first.setChangeDescription(first.getChangeDescription()
+ "," + standardInterpretClauseSublist.getChangeDescription());
first.setRegulatoryNotes(first.getRegulatoryNotes()
+ "," + standardInterpretClauseSublist.getRegulatoryNotes());
first.setKeywords(first.getKeywords()
+ "," + standardInterpretClauseSublist.getKeywords());
first.setKeyController(first.getKeyController()
+ "," + standardInterpretClauseSublist.getKeyController());
first.setRelatedDepartment(first.getRelatedDepartment()
+ "," + standardInterpretClauseSublist.getRelatedDepartment());
first.setResponsibleModule(first.getResponsibleModule()
+ "," + standardInterpretClauseSublist.getResponsibleModule());
first.setRelatedModule(first.getRelatedModule()
+ "," + standardInterpretClauseSublist.getRelatedModule());
first.setApplications(first.getApplications()
+ "," + standardInterpretClauseSublist.getApplications());
first.setPowerType(first.getPowerType()
+ "," + standardInterpretClauseSublist.getPowerType());
first.setDomainArea(first.getDomainArea()
+ "," + standardInterpretClauseSublist.getDomainArea());
first.setConfigurationRequirements(first.getConfigurationRequirements()
+ "," + standardInterpretClauseSublist.getConfigurationRequirements());
first.setNewCerImplementDate(first.getNewCerImplementDate()
+ "," + standardInterpretClauseSublist.getNewCerImplementDate());
first.setNewCerImplementDate(first.getNewCerImplementDate()
+ "," + standardInterpretClauseSublist.getNewCerImplementDate());
first.setEnterpriseStandard(first.getEnterpriseStandard()
+ "," + standardInterpretClauseSublist.getEnterpriseStandard());
first.setTechnicalSpecificationDesignGuide(first.getTechnicalSpecificationDesignGuide()
+ "," + standardInterpretClauseSublist.getTechnicalSpecificationDesignGuide());
first.setDrawingTemplate(first.getDrawingTemplate()
+ "," + standardInterpretClauseSublist.getDrawingTemplate());
first.setTechnicalAgreementTemplate(first.getTechnicalAgreementTemplate()
+ "," + standardInterpretClauseSublist.getTechnicalAgreementTemplate());
first.setVerificationReportTemplateChecklist(first.getVerificationReportTemplateChecklist()
+ "," + standardInterpretClauseSublist.getVerificationReportTemplateChecklist());
first.setDvpTemplate(first.getDvpTemplate()
+ "," + standardInterpretClauseSublist.getDvpTemplate());
first.setDfema(first.getDfema()
+ "," + standardInterpretClauseSublist.getDfema());
first.setKeyTechnologyDecompositionTable(first.getKeyTechnologyDecompositionTable()
+ "," + standardInterpretClauseSublist.getKeyTechnologyDecompositionTable());
first.setOtherDocumentsTemplates(first.getOtherDocumentsTemplates()
+ "," + standardInterpretClauseSublist.getOtherDocumentsTemplates());
first.setP3(first.getP3()
+ "," + standardInterpretClauseSublist.getP3());
first.setP5(first.getP5()
+ "," + standardInterpretClauseSublist.getP5());
first.setRemarks(first.getRemarks()
+ "," + standardInterpretClauseSublist.getRemarks());
first.setInterpretPersonId(mergeString(first.getInterpretPersonId(),
standardInterpretClauseSublist.getInterpretPersonId()));
first.setTranslation(mergeString(first.getTranslation(),
standardInterpretClauseSublist.getTranslation()));
first.setIsSameAsPrevVersion(mergeString(first.getIsSameAsPrevVersion(),
standardInterpretClauseSublist.getIsSameAsPrevVersion()));
first.setChangeDescription(mergeString(first.getChangeDescription(),
standardInterpretClauseSublist.getChangeDescription()));
first.setRegulatoryNotes(mergeString(first.getRegulatoryNotes(),
standardInterpretClauseSublist.getRegulatoryNotes()));
first.setKeywords(mergeString(first.getKeywords(),
standardInterpretClauseSublist.getKeywords()));
first.setKeyController(mergeString(first.getKeyController(),
standardInterpretClauseSublist.getKeyController()));
first.setRelatedDepartment(mergeString(first.getRelatedDepartment(),
standardInterpretClauseSublist.getRelatedDepartment()));
first.setResponsibleModule(mergeString(first.getResponsibleModule(),
standardInterpretClauseSublist.getResponsibleModule()));
first.setRelatedModule(mergeString(first.getRelatedModule(),
standardInterpretClauseSublist.getRelatedModule()));
first.setApplications(mergeString(first.getApplications(),
standardInterpretClauseSublist.getApplications()));
first.setPowerType(mergeString(first.getPowerType(),
standardInterpretClauseSublist.getPowerType()));
first.setDomainArea(mergeString(first.getDomainArea(),
standardInterpretClauseSublist.getDomainArea()));
first.setConfigurationRequirements(mergeString(first.getConfigurationRequirements(),
standardInterpretClauseSublist.getConfigurationRequirements()));
first.setNewCerImplementDate(mergeString(first.getNewCerImplementDate(),
standardInterpretClauseSublist.getNewCerImplementDate()));
first.setNewProductionImplementation(mergeString(first.getNewProductionImplementation(),
standardInterpretClauseSublist.getNewProductionImplementation()));
first.setEnterpriseStandard(mergeString(first.getEnterpriseStandard(),
standardInterpretClauseSublist.getEnterpriseStandard()));
first.setTechnicalSpecificationDesignGuide(
mergeString(first.getTechnicalSpecificationDesignGuide(),
standardInterpretClauseSublist.getTechnicalSpecificationDesignGuide()));
first.setDrawingTemplate(mergeString(first.getDrawingTemplate(),
standardInterpretClauseSublist.getDrawingTemplate()));
first.setTechnicalAgreementTemplate(mergeString(first.getTechnicalAgreementTemplate(),
standardInterpretClauseSublist.getTechnicalAgreementTemplate()));
first.setVerificationReportTemplateChecklist(
mergeString(first.getVerificationReportTemplateChecklist(),
standardInterpretClauseSublist.getVerificationReportTemplateChecklist()));
first.setDvpTemplate(mergeString(first.getDvpTemplate(),
standardInterpretClauseSublist.getDvpTemplate()));
first.setDfema(mergeString(first.getDfema(),
standardInterpretClauseSublist.getDfema()));
first.setKeyTechnologyDecompositionTable(
mergeString(first.getKeyTechnologyDecompositionTable(),
standardInterpretClauseSublist.getKeyTechnologyDecompositionTable()));
first.setOtherDocumentsTemplates(mergeString(first.getOtherDocumentsTemplates(),
standardInterpretClauseSublist.getOtherDocumentsTemplates()));
first.setP3(mergeString(first.getP3(),
standardInterpretClauseSublist.getP3()));
first.setP5(mergeString(first.getP5(),
standardInterpretClauseSublist.getP5()));
first.setRemarks(mergeString(first.getRemarks(),
standardInterpretClauseSublist.getRemarks()));
processStandardInterpretClauseSublistService
.removeById(standardInterpretClauseSublist.getId());
}
// 去重
distinct(first);
processStandardInterpretClauseSublistService.saveOrUpdate(first);
});
}
}
// 设置流程状态未完成
processAllService.update(new LambdaUpdateWrapper<ProcessAll>()
.set(ProcessAll::getPrcStatus, ProcessStatusEnum.INCOMPLETE.getValue())
.eq(ProcessAll::getProjectId, processAlls.getProjectId()));
}
log.info("标准解读流程-流程监听器 结束");
}
@@ -464,13 +488,18 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
ProcessStandardInterpretClauseSublist processStandardInterpretClauseSublist =
new ProcessStandardInterpretClauseSublist();
processStandardInterpretClauseSublist.setStandardInterpretId(processStandardInterpret.getId());
String taskId = processApprovalRecord.getTaskId();
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
// 解读人填写信息(分发)
if (StandardInterpretCommon.INTERPRETING_PEOPLE_FILLOUT.equals(node)){
Object variable = runtimeService.getVariable(task.getExecutionId(), StandardInterpretCommon.SNOWFLAKE);
processStandardInterpretClauseSublist.setSnowFlake(String.valueOf(variable));
processStandardInterpretClauseSublist.setInterpretPersonId(loginUser.getId());
}
// 标准主解读人审核(分发)
if (StandardInterpretCommon.MASTER_INTERPRET_APPROVE.equals(node)){
processStandardInterpretClauseSublist.setParentTaskId(processApprovalRecord.getParentTaskId());
Object variable = runtimeService.getVariable(task.getExecutionId(), StandardInterpretCommon.SNOWFLAKE);
processStandardInterpretClauseSublist.setSnowFlake(String.valueOf(variable));
}
processStandardInterpretClauseSublistList =
processStandardInterpretClauseSublistService.queryList(processStandardInterpretClauseSublist);
@@ -1012,16 +1041,15 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
++ unallocatedQuantity;
continue;
}
// 子解读人
interpretPersonIdList = Arrays.asList(
StandardInterpretClause.getInterpretPersonIds().split(","));
for (String interpretPersonId : interpretPersonIdList) {
for (String interpretPersonId : StandardInterpretClause.getInterpretPersonIds().split(",")) {
ProcessStandardInterpretClauseSublist clauseSublist =
new ProcessStandardInterpretClauseSublist();
clauseSublist.setStandardInterpretClauseId(StandardInterpretClause.getId());
clauseSublist.setClauseId(StandardInterpretClause.getClauseId());
clauseSublist.setInterpretPersonId(interpretPersonId);
processStandardInterpretClauseSublists.add(clauseSublist);
interpretPersonIdList.add(interpretPersonId);
}
}
// 设置未分配数量
@@ -1036,9 +1064,9 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
// 保存会签人员、审核人员、批准人员
processStandardInterpretService.updateById(processStandardInterpret);
map.put(StandardInterpretCommon.JOINTLY_SIGN_LIST,
processStandardInterpret.getCountersignPersonIds());
Arrays.asList(processStandardInterpret.getCountersignPersonIds().split(",")));
map.put(StandardInterpretCommon.DEPARTMENT_MANAGER,
Arrays.asList(processStandardInterpret.getUploader().split(",")));
processStandardInterpret.getUploader());
map.put(StandardInterpretCommon.TECHNICAL_OFFICER,
processStandardInterpret.getApprovePersonId());
// 不分发
@@ -1085,9 +1113,10 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
case StandardInterpretCommon.MASTER_INTERPRET_SUMMARY:
// 保存会签人员、审核人员、批准人员
processStandardInterpretService.updateById(processStandardInterpret);
map.put(StandardInterpretCommon.JOINTLY_SIGN_LIST, processStandardInterpret.getCountersignPersonIds());
map.put(StandardInterpretCommon.JOINTLY_SIGN_LIST,
Arrays.asList(processStandardInterpret.getCountersignPersonIds().split(",")));
map.put(StandardInterpretCommon.DEPARTMENT_MANAGER,
Arrays.asList(processStandardInterpret.getUploader().split(",")));
processStandardInterpret.getUploader());
map.put(StandardInterpretCommon.TECHNICAL_OFFICER,
processStandardInterpret.getApprovePersonId());
processStandardInterpretClauseSublistService
@@ -1181,4 +1210,15 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
}
}
}
private String mergeString (String str1, String str2){
tempList.clear();
if (StringUtils.isNotBlank(str1)){
tempList.add(str1);
}
if (StringUtils.isNotBlank(str2)){
tempList.add(str2);
}
return String.join(",", tempList);
}
}