fix: 待办列表显示不正常
This commit is contained in:
+23
-11
@@ -19,6 +19,7 @@ import com.jero.modules.activiti.enums.CommitFlagEnum;
|
||||
import com.jero.modules.activiti.enums.FinishFlagEnum;
|
||||
import com.jero.modules.activiti.enums.ProcessStatusEnum;
|
||||
import com.jero.modules.activiti.enums.ProcessTypeEnum;
|
||||
import com.jero.modules.activiti.process.fb.common.ProcessDefinitionKey;
|
||||
import com.jero.modules.activiti.process.standardinterpret.common.StandardInterpretCommon;
|
||||
import com.jero.modules.activiti.service.ProcessAllService;
|
||||
import com.jero.modules.activiti.service.ProcessApprovalRecordService;
|
||||
@@ -229,8 +230,8 @@ public class MyGlobalEventListener implements ActivitiEventListener {
|
||||
|
||||
//更新转办任务id
|
||||
LambdaUpdateWrapper<ProcessApprovalRecord> update = new LambdaUpdateWrapper<>();
|
||||
update.eq(ProcessApprovalRecord::getTaskId,taskId);
|
||||
update.set(ProcessApprovalRecord::getTransferTaskId,taskId+"_"+System.currentTimeMillis());
|
||||
update.eq(ProcessApprovalRecord::getTaskId, taskId);
|
||||
update.set(ProcessApprovalRecord::getTransferTaskId, taskId + "_" + System.currentTimeMillis());
|
||||
recordService.update(update);
|
||||
// 生成被转办人的待办
|
||||
list.clear();
|
||||
@@ -420,14 +421,24 @@ public class MyGlobalEventListener implements ActivitiEventListener {
|
||||
String parentTaskId = (String) execution.getVariable(ActivitiCommon.PARENT_TASK_ID);
|
||||
if (StringUtils.isNotBlank(parentTaskId)) {
|
||||
int i = processAllService.countByParentTaskId(parentTaskId);
|
||||
if (i == 0) {
|
||||
TaskService taskService = SpringContextUtil.getBean(TaskService.class);
|
||||
if (StandardInterpretCommon.KEY_1.equals(processDefinitionId)){
|
||||
boolean b = isChildrenNodeAllComplete(processInstanceId, parentTaskId);
|
||||
if (b){
|
||||
taskService.complete(parentTaskId);
|
||||
if (StandardInterpretCommon.KEY_1.equals(processDefinitionId) ||
|
||||
StandardInterpretCommon.KEY_2.equals(processDefinitionId) ||
|
||||
StandardInterpretCommon.KEY_3.equals(processDefinitionId)) {
|
||||
if (i == 0) {
|
||||
if (StandardInterpretCommon.KEY_1.equals(processDefinitionId)) {
|
||||
TaskService taskService = SpringContextUtil.getBean(TaskService.class);
|
||||
boolean b = isChildrenNodeAllComplete(processInstanceId, parentTaskId);
|
||||
if (b) {
|
||||
taskService.complete(parentTaskId);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
}
|
||||
}
|
||||
if (ProcessDefinitionKey.STANDARD_COMPLIANCE_CHECK_MAIN.equals(processDefinitionId) ||
|
||||
ProcessDefinitionKey.STANDARD_COMPLIANCE_CHECK_DISTRIBUTE.equals(processDefinitionId) ||
|
||||
ProcessDefinitionKey.STANDARD_COMPLIANCE_CHECK_REDISTRIBUTE.equals(processDefinitionId)) {
|
||||
if (i == 0) {
|
||||
TaskService taskService = SpringContextUtil.getBean(TaskService.class);
|
||||
Object variable = taskService.getVariable(parentTaskId, UNALLOCATED_QUANTITY);
|
||||
if (variable != null) {
|
||||
int unallocatedQuantity = (int) variable;
|
||||
@@ -480,11 +491,12 @@ public class MyGlobalEventListener implements ActivitiEventListener {
|
||||
|
||||
/**
|
||||
* 判断所有子流程是否都完成
|
||||
*
|
||||
* @param processInstanceId
|
||||
* @param parentTaskId
|
||||
* @return true:都完成 false:未都完成
|
||||
*/
|
||||
private boolean isChildrenNodeAllComplete(String processInstanceId, String parentTaskId){
|
||||
private boolean isChildrenNodeAllComplete(String processInstanceId, String parentTaskId) {
|
||||
// 判断当前parentTaskId是否是第一个自动处理任务节点
|
||||
ProcessApprovalRecordService processApprovalRecordService = SpringContextUtil.getBean(ProcessApprovalRecordService.class);
|
||||
int count = processApprovalRecordService.count(
|
||||
@@ -492,7 +504,7 @@ public class MyGlobalEventListener implements ActivitiEventListener {
|
||||
.eq(ProcessApprovalRecord::getProcessInstanceId, processInstanceId)
|
||||
.eq(ProcessApprovalRecord::getNodeId, StandardInterpretCommon.INTERPRETING_PEOPLE_FILLOUT)
|
||||
.eq(ProcessApprovalRecord::getParentTaskId, parentTaskId));
|
||||
if (count > 0){
|
||||
if (count > 0) {
|
||||
// 判断子流程是否还有未完成的节点
|
||||
int childCount = processApprovalRecordService.count(
|
||||
new LambdaQueryWrapper<ProcessApprovalRecord>()
|
||||
|
||||
+1
-3
@@ -46,11 +46,9 @@
|
||||
pa.prc_status,
|
||||
pa.end_time,
|
||||
pa.over_time,
|
||||
pa.project_id,
|
||||
pn.countersign_flag
|
||||
pa.project_id
|
||||
from process_approval_record par
|
||||
left join process_all pa on pa.process_instance_id = par.process_instance_id
|
||||
left join process_node pn on pn.xml_node_id = par.node_id
|
||||
${ew.customSqlSegment}
|
||||
<include refid="order1"/>
|
||||
</select>
|
||||
|
||||
+10
-1
@@ -101,7 +101,16 @@ public class ProcessAllService extends ServiceImpl<ProcessAllMapper, ProcessAll>
|
||||
public IPage<ProcessAll> getTodoList(Page<ProcessAll> page, QueryWrapper<ProcessAll> queryWrapper, HttpServletRequest req) {
|
||||
String column = req.getParameter("column");
|
||||
String order = req.getParameter("order");
|
||||
return processAllMapper.getTodoList(page,queryWrapper,column,order);
|
||||
IPage<ProcessAll> todoList = processAllMapper.getTodoList(page, queryWrapper, column, order);
|
||||
Set<String> nodeIdSet = todoList.getRecords().stream().map(ProcessAll::getNodeId).collect(Collectors.toSet());
|
||||
List<ProcessNode> processNodeList = processNodeService.list(new LambdaQueryWrapper<ProcessNode>().in(ProcessNode::getId, nodeIdSet));
|
||||
todoList.getRecords().forEach(processAll -> {
|
||||
processNodeList.stream()
|
||||
.filter(processNode -> processNode.getId().equals(processAll.getNodeId()))
|
||||
.findFirst()
|
||||
.ifPresent(processNode -> processAll.setCountersignFlag(processNode.getCountersignFlag()));
|
||||
});
|
||||
return todoList;
|
||||
}
|
||||
|
||||
public IPage<ProcessAll> getCompletedList(Page<ProcessAll> page, QueryWrapper<ProcessAll> queryWrapper, HttpServletRequest req) {
|
||||
|
||||
Reference in New Issue
Block a user