fix(89311): 解读人驳回后,主解读人列表数据逻辑调整

This commit is contained in:
yjz
2024-08-22 18:56:57 +08:00
parent 3c9ade1ce5
commit c8decb108a
5 changed files with 57 additions and 27 deletions
@@ -430,12 +430,8 @@ public class MyGlobalEventListener implements ActivitiEventListener {
StandardInterpretCommon.KEY_3.equals(processDefinition)) {
if (i == 0) {
TaskService taskService = SpringContextUtil.getBean(TaskService.class);
if (StandardInterpretCommon.KEY_1.equals(processDefinition)) {
boolean b = isChildrenNodeAllComplete(processInstanceId, parentTaskId);
if (b) {
taskService.complete(parentTaskId);
}
}else {
boolean b = isChildrenNodeAllComplete(processInstanceId, parentTaskId);
if (b) {
taskService.complete(parentTaskId);
}
}
@@ -518,23 +514,25 @@ public class MyGlobalEventListener implements ActivitiEventListener {
* @return true:都完成 false:未都完成
*/
private boolean isChildrenNodeAllComplete(String processInstanceId, String parentTaskId) {
ProcessApprovalRecordService processApprovalRecordService =
SpringContextUtil.getBean(ProcessApprovalRecordService.class);
// 判断当前parentTaskId是否是第一个自动处理任务节点
ProcessApprovalRecordService processApprovalRecordService = SpringContextUtil.getBean(ProcessApprovalRecordService.class);
int count = processApprovalRecordService.count(
ProcessApprovalRecord firstNodeTask = processApprovalRecordService.getOne(
new LambdaQueryWrapper<ProcessApprovalRecord>()
.eq(ProcessApprovalRecord::getProcessInstanceId, processInstanceId)
.eq(ProcessApprovalRecord::getNodeId, StandardInterpretCommon.INTERPRETING_PEOPLE_FILLOUT)
.eq(ProcessApprovalRecord::getParentTaskId, parentTaskId));
if (count > 0) {
// 判断子流程是否还有未完成的节点
int childCount = processApprovalRecordService.count(
.orderByAsc(ProcessApprovalRecord::getCreateTime)
.last("limit 1"), false);
if (firstNodeTask.getParentTaskId().equals(parentTaskId)){
// 判断所有子流程是否都完成
int count = processApprovalRecordService.count(
new LambdaQueryWrapper<ProcessApprovalRecord>()
.eq(ProcessApprovalRecord::getProcessInstanceId, processInstanceId)
.isNotNull(ProcessApprovalRecord::getParentTaskId)
.eq(ProcessApprovalRecord::getFinishFlag, FinishFlagEnum.INCOMPLETE.getValue()));
return childCount == 0;
return count == 0;
}
return false;
return true;
}
/**
@@ -26,6 +26,9 @@ public class ProcessStandardInterpretClause extends BaseEntity {
/**条款id/标准id*/
@ApiModelProperty(value = "条款id/标准id")
private String clauseId;
/**唯一标识*/
@ApiModelProperty(value = "唯一标识")
private String snowFlake;
/**条款号/标准编号*/
@ApiModelProperty(value = "条款号/标准编号")
@TableField(exist = false)
@@ -13,7 +13,8 @@
psic.clause_id,
interpret_person_ids,
is_reject,
is_distribute
is_distribute,
snow_flake
from 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
@@ -42,6 +42,8 @@ public class ProcessStandardInterpretClauseServiceImpl
// 标准主解读人重新分发 节点查询驳回数据
queryWrapper.eq(StringUtils.isNotBlank(processStandardInterpretClause.getIsReject()),
"is_reject", processStandardInterpretClause.getIsReject());
queryWrapper.like(StringUtils.isNotBlank(processStandardInterpretClause.getSnowFlake()),
"snow_flake", processStandardInterpretClause.getSnowFlake());
queryWrapper.orderByAsc("id");
return processStandardInterpretClauseMapper.queryList(queryWrapper);
}
@@ -445,6 +445,8 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
}else if (StandardInterpretCommon.AUTO_TASK_2.equals(taskDefinitionKey)){
StandardInterpretFlowDTO standardInterpretFlowDTO = new StandardInterpretFlowDTO();
// 流程信息
String newSnowFlake = String.valueOf(SnowflakeUtils.snowflake());
variables.put(StandardInterpretCommon.SNOWFLAKE, newSnowFlake);
ProcessAll processAll = new ProcessAll();
processAll.setProjectId(processAlls.getProjectId());
standardInterpretFlowDTO.setProcessAll(processAll);
@@ -461,15 +463,26 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
processStandardInterpretClauseSublistService.list(
new LambdaQueryWrapper<ProcessStandardInterpretClauseSublist>()
.eq(ProcessStandardInterpretClauseSublist::getSnowFlake, snowflake));
// 清除中间表解读人,设置驳回标识
processStandardInterpretClauseService.update(
new LambdaUpdateWrapper<ProcessStandardInterpretClause>()
.in(ProcessStandardInterpretClause::getId,
processStandardInterpretClauseSublistList.stream()
.map(ProcessStandardInterpretClauseSublist::getStandardInterpretClauseId)
.collect(Collectors.toList()))
.set(ProcessStandardInterpretClause::getIsReject, YesOrNoEnum.YES.getValue())
.set(ProcessStandardInterpretClause::getInterpretPersonIds, null));
// 清除中间表解读人,设置驳回标识,设置唯一标识
List<String> standardInterpretClauseIdList = processStandardInterpretClauseSublistList.stream()
.map(ProcessStandardInterpretClauseSublist::getStandardInterpretClauseId)
.collect(Collectors.toList());
List<ProcessStandardInterpretClause> processStandardInterpretClauseList =
processStandardInterpretClauseService.listByIds(standardInterpretClauseIdList);
for (ProcessStandardInterpretClause processStandardInterpretClause : processStandardInterpretClauseList) {
LambdaUpdateWrapper<ProcessStandardInterpretClause> qw = new LambdaUpdateWrapper<>();
qw.eq(ProcessStandardInterpretClause::getId, processStandardInterpretClause.getId());
qw.set(ProcessStandardInterpretClause::getIsReject, YesOrNoEnum.YES.getValue());
qw.set(ProcessStandardInterpretClause::getInterpretPersonIds, null);
String snowFlake = processStandardInterpretClause.getSnowFlake();
if (StringUtils.isNotBlank(snowFlake)){
qw.set(ProcessStandardInterpretClause::getSnowFlake, snowFlake + "," + newSnowFlake);
}else {
qw.set(ProcessStandardInterpretClause::getSnowFlake, newSnowFlake);
}
processStandardInterpretClauseService.update(qw);
}
// 删除旧分发数据
processStandardInterpretClauseSublistService.remove(
@@ -706,7 +719,7 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
String node = StringUtils.isNotBlank(processApprovalRecord.getNodeId())
? processApprovalRecord.getNodeId() : StandardInterpretCommon.REGULATORY_ENGINEER_START;
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String taskId = processApprovalRecord.getTaskId();
// 通过 projectId 查询 标准解读流程
processStandardInterpret.setProjectId(projectId);
processStandardInterpret = processStandardInterpretService.queryOne(processStandardInterpret);
@@ -723,7 +736,10 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
}
// 标准主解读人重新分发(分发)
if (StandardInterpretCommon.MASTER_INTERPRET_AGAIN_DISTRIBUTE.equals(node)){
processStandardInterpretClause.setIsReject(YesOrNoEnum.YES.getValue());
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
Object variable = runtimeService.getVariable(task.getExecutionId(), StandardInterpretCommon.SNOWFLAKE);
processStandardInterpretClause.setSnowFlake(String.valueOf(variable));
// processStandardInterpretClause.setIsReject(YesOrNoEnum.YES.getValue());
}
processStandardInterpretClauseList =
processStandardInterpretClauseService.queryList(processStandardInterpretClause);
@@ -749,7 +765,6 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
ProcessStandardInterpretClauseSublist processStandardInterpretClauseSublist =
new ProcessStandardInterpretClauseSublist();
processStandardInterpretClauseSublist.setStandardInterpretId(processStandardInterpret.getId());
String taskId = processApprovalRecord.getTaskId();
// 解读人填写信息(分发)
if (StandardInterpretCommon.INTERPRETING_PEOPLE_FILLOUT.equals(node)){
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
@@ -1776,6 +1791,14 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
interpretPersonIdList.add(interpretPersonId);
distributeIdSubList.add(id);
}
// 重新分发节点特殊处理
if (StandardInterpretCommon.MASTER_INTERPRET_AGAIN_DISTRIBUTE.equals(node)){
// 重置 各涉及部门解读人
processStandardInterpretClauseService.update(
new LambdaUpdateWrapper<ProcessStandardInterpretClause>()
.eq(ProcessStandardInterpretClause::getId, StandardInterpretClause.getId())
.set(ProcessStandardInterpretClause::getInterpretPersonIds, null));
}
}
// 设置未分配数量
map.put(StandardInterpretCommon.UNALLOCATED_QUANTITY, unallocatedQuantity);
@@ -1869,6 +1892,9 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
if (pass){
processStandardInterpretClauseSublistService
.saveOrUpdateBatch(processStandardInterpretClauseSublistList);
}else {
// 驳回
}
break;
// 会签(分发)