|
|
@@ -1,5 +1,6 @@ |
|
|
|
package com.ningdatech.pmapi.todocenter.manage; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
@@ -43,21 +44,24 @@ import com.wflow.contants.WflowContant; |
|
|
|
import com.wflow.workflow.bean.process.ProgressNode; |
|
|
|
import com.wflow.workflow.bean.process.enums.NodeTypeEnum; |
|
|
|
import com.wflow.workflow.bean.vo.ProcessProgressVo; |
|
|
|
import com.wflow.workflow.enums.ProcessHandlerEnum; |
|
|
|
import com.wflow.workflow.service.ProcessInstanceService; |
|
|
|
import com.wflow.workflow.service.ProcessTaskService; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.flowable.engine.HistoryService; |
|
|
|
import org.flowable.engine.RuntimeService; |
|
|
|
import org.flowable.engine.TaskService; |
|
|
|
import org.flowable.engine.history.HistoricProcessInstance; |
|
|
|
import org.flowable.engine.task.Comment; |
|
|
|
import org.flowable.variable.api.history.HistoricVariableInstance; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import static com.ningdatech.pmapi.todocenter.constant.WorkNoticeContant.*; |
|
|
@@ -73,26 +77,20 @@ import static com.ningdatech.pmapi.todocenter.constant.WorkNoticeContant.*; |
|
|
|
@Slf4j |
|
|
|
public class HandlerManage { |
|
|
|
|
|
|
|
private final ProcessTaskService processTaskService; |
|
|
|
private final RuntimeService runtimeService; |
|
|
|
|
|
|
|
private final TaskService taskService; |
|
|
|
private final HistoryService historyService; |
|
|
|
private final IUserInfoService userInfoService; |
|
|
|
private final IProjectService projectService; |
|
|
|
private final ProjectLibManage projectLibManage; |
|
|
|
private final StateMachineUtils stateMachineUtils; |
|
|
|
private final IDingEmployeeInfoService dingEmployeeInfoService; |
|
|
|
private final IDingOrganizationService dingOrganizationService; |
|
|
|
private final ProcessInstanceService processInstanceService; |
|
|
|
private final INdWorkNoticeStagingService workNoticeStagingService; |
|
|
|
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; |
|
|
|
private final IProjectApplicationService projectApplicationService; |
|
|
|
private final UserInfoHelper userInfoHelper; |
|
|
|
private final BuildUserUtils buildUserUtils; |
|
|
|
private final IProjectStagingService projectStagingService; |
|
|
|
private final IProjectInstService projectInstService; |
|
|
|
private final PdfUtils pdfUtils; |
|
|
|
private final FileService fileService; |
|
|
|
private final ICompanySignatureService companySignatureService; |
|
|
|
private final StatisticsService statisticsService; |
|
|
|
private final INotifyService notifyService; |
|
|
|
private final DeclaredProjectManage declaredProjectManage; |
|
|
|
|
|
|
@@ -401,4 +399,28 @@ public class HandlerManage { |
|
|
|
workNoticeInfo.setReceiverUserId(receiverUserId); |
|
|
|
return workNoticeInfo; |
|
|
|
} |
|
|
|
|
|
|
|
public void deleteBackComments(List<HistoricVariableInstance> approves) { |
|
|
|
if(CollUtil.isNotEmpty(approves)){ |
|
|
|
for(HistoricVariableInstance approve : approves){ |
|
|
|
if(approve.getValue() instanceof ProcessHandlerEnum){ |
|
|
|
if(ProcessHandlerEnum.BACK.equals(ProcessHandlerEnum.getEnumByName(String.valueOf(approve.getValue())))){ |
|
|
|
runtimeService.removeVariable(approve.getProcessInstanceId(),approve.getVariableName()); |
|
|
|
|
|
|
|
Comment comment; |
|
|
|
Optional<Comment> first = taskService.getProcessInstanceComments(approve.getProcessInstanceId()) |
|
|
|
.stream() |
|
|
|
.filter(c -> c.getTaskId().equals(approve.getVariableName().replace("approve_", StringUtils.EMPTY))) |
|
|
|
.findFirst(); |
|
|
|
if (first.isPresent()){ |
|
|
|
comment = first.get(); |
|
|
|
taskService.deleteComment(comment.getId()); |
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |