|
@@ -28,11 +28,9 @@ import org.activiti.engine.HistoryService;
|
|
|
import org.activiti.engine.RepositoryService;
|
|
|
import org.activiti.engine.RuntimeService;
|
|
|
import org.activiti.engine.TaskService;
|
|
|
-import org.activiti.engine.impl.RepositoryServiceImpl;
|
|
|
import org.activiti.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior;
|
|
|
import org.activiti.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior;
|
|
|
import org.activiti.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior;
|
|
|
-import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
|
|
|
import org.activiti.engine.repository.Deployment;
|
|
|
import org.activiti.engine.repository.DeploymentBuilder;
|
|
|
import org.activiti.engine.runtime.ProcessInstance;
|
|
@@ -263,14 +261,11 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
throw ExceptionResultEnum.ERROR.exception("正在终止中,请稍候再试!");
|
|
|
}
|
|
|
try {
|
|
|
- Task task = taskService.createTaskQuery().processInstanceId(flowId).singleResult();
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
-// runtimeService.deleteProcessInstance(flowId, FlowApproveSetupEnum.END.getTitle());
|
|
|
ExamTask examTask = examTaskService.findByFlowId(SystemConstant.convertIdToLong(flowId));
|
|
|
//流程审批
|
|
|
TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(SystemConstant.convertIdToLong(flowId), examTask.getSchoolId());
|
|
|
if (Objects.isNull(tfFlowApprove)) {
|
|
|
- int count = sysUserService.countByTeachingRoomId(examTask.getTeachingRoomId());
|
|
|
tfFlowApprove = new TFFlowApprove(sysUser.getSchoolId(), sysUser.getOrgId(), SystemConstant.convertIdToLong(flowId), sysUser.getId(), FlowStatusEnum.END, sysUser.getId());
|
|
|
} else {
|
|
|
tfFlowApprove.setStatus(FlowStatusEnum.END);
|
|
@@ -285,18 +280,6 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
tfFlowLog.setApproveSetup(FlowApproveSetupEnum.END.getSetup());
|
|
|
tfFlowLogService.save(tfFlowLog);
|
|
|
|
|
|
- if (Objects.nonNull(task)) {
|
|
|
- String processDefinitionId = historyService.createHistoricProcessInstanceQuery().processInstanceId(flowId).singleResult().getProcessDefinitionId();
|
|
|
- ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processDefinitionId);
|
|
|
- //获取当前流程节点
|
|
|
- String currActivityId = task.getTaskDefinitionKey();
|
|
|
- BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId());
|
|
|
- FlowNode currFlow = (FlowNode) bpmnModel.getMainProcess().getFlowElement(currActivityId);
|
|
|
- if (currFlow instanceof UserTask) {
|
|
|
- UserTask userTask = (UserTask) currFlow;
|
|
|
- //流程审批记录
|
|
|
- }
|
|
|
- }
|
|
|
//命题任务修改
|
|
|
// examTask.setFlowId(null);
|
|
|
examTask.setStatus(ExamStatusEnum.STAGE);
|
|
@@ -773,44 +756,15 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
*/
|
|
|
@Override
|
|
|
public List<FlowTaskResult> getTaskAll(String flowId) {
|
|
|
- ExamTask examTask = examTaskService.findByFlowId(SystemConstant.convertIdToLong(flowId));
|
|
|
- if (examTask.getFlowId().longValue() != SystemConstant.convertIdToLong(flowId).longValue()) {
|
|
|
- TExamTaskFlow tExamTaskFlow = tExamTaskFlowService.findByRootLevel(SystemConstant.convertIdToLong(flowId));
|
|
|
- Optional.ofNullable(tExamTaskFlow).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未找到任何流程信息"));
|
|
|
- flowId = String.valueOf(tExamTaskFlow.getFlowId());
|
|
|
- }
|
|
|
- String processDefinitionId = historyService.createHistoricProcessInstanceQuery().processInstanceId(flowId).singleResult().getProcessDefinitionId();
|
|
|
- ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processDefinitionId);
|
|
|
- BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
|
|
|
- Process process = bpmnModel.getProcessById(processDefinitionEntity.getKey());
|
|
|
- Collection<FlowElement> flowElements = process.getFlowElements();
|
|
|
- List<FlowTaskResult> flowTaskResultList = new ArrayList<>();
|
|
|
- for (FlowElement flowElement : flowElements) {
|
|
|
- //假设是任务节点
|
|
|
- if (flowElement instanceof UserTask) {
|
|
|
- UserTask userTask = (UserTask) flowElement;
|
|
|
- if (Objects.nonNull(userTask)) {
|
|
|
- FlowApproveSetupEnum flowApproveSetupEnum = FlowApproveSetupEnum.convertToInstance(userTask.getId());
|
|
|
- flowTaskResultList.add(new FlowTaskResult(Long.parseLong(flowId), userTask.getName(), flowApproveSetupEnum.getId(), flowApproveSetupEnum.getSetup()));
|
|
|
- }
|
|
|
- } else if (flowElement instanceof CallActivity) {
|
|
|
- CallActivity callActivity = (CallActivity) flowElement;
|
|
|
- String processDefinitionIdSub = examTaskService.getProcessDefinitionIdByMaxVersion(callActivity.getCalledElement());
|
|
|
- ProcessDefinitionEntity processDefinitionEntitySub = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processDefinitionIdSub);
|
|
|
- BpmnModel bpmnModelSub = repositoryService.getBpmnModel(processDefinitionIdSub);
|
|
|
- Process processSub = bpmnModelSub.getProcessById(processDefinitionEntitySub.getKey());
|
|
|
- Collection<FlowElement> flowElementsSubs = processSub.getFlowElements();
|
|
|
- for (FlowElement flowElementSub : flowElementsSubs) {
|
|
|
- //假设是任务节点
|
|
|
- if (flowElementSub instanceof UserTask) {
|
|
|
- UserTask userTask = (UserTask) flowElementSub;
|
|
|
- if (Objects.nonNull(userTask)) {
|
|
|
- FlowApproveSetupEnum flowApproveSetupEnum = FlowApproveSetupEnum.convertToInstance(userTask.getId());
|
|
|
- flowTaskResultList.add(new FlowTaskResult(Long.parseLong(flowId), userTask.getName(), flowApproveSetupEnum.getId(), flowApproveSetupEnum.getSetup()));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByFlowId(SystemConstant.convertIdToLong(flowId));
|
|
|
+ Map<String, Object> flowProcessVarMap = this.getFlowProcessVarMap(tfCustomFlowEntity);
|
|
|
+ Map<String, FlowTaskResult> setupMap = (Map<String, FlowTaskResult>) flowProcessVarMap.get(SystemConstant.SETUP_MAP);
|
|
|
+ List<FlowTaskResult> flowTaskResultList = new ArrayList<>(setupMap.size());
|
|
|
+ Gson gson = new Gson();
|
|
|
+ for (Map.Entry<String, FlowTaskResult> entry : setupMap.entrySet()) {
|
|
|
+ FlowTaskResult FlowTaskResult = gson.fromJson(gson.toJson(entry.getValue()), FlowTaskResult.class);
|
|
|
+ FlowTaskResult.setFlowId(SystemConstant.convertIdToLong(flowId));
|
|
|
+ flowTaskResultList.add(FlowTaskResult);
|
|
|
}
|
|
|
return flowTaskResultList;
|
|
|
}
|