提交 5005736e authored 作者: zhoushaopan's avatar zhoushaopan

[工作流模块]去除了hutool

上级 9f9acd61
...@@ -64,11 +64,7 @@ ...@@ -64,11 +64,7 @@
<version>6.6.0</version> <version>6.6.0</version>
</dependency> </dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.5.8</version>
</dependency>
<!--fastjson--> <!--fastjson-->
<dependency> <dependency>
......
package com.tykj.workflowcore.model_layer.entity.vo; package com.tykj.workflowcore.model_layer.entity.vo;
import cn.hutool.core.bean.BeanUtil;
import com.tykj.workflowcore.model_layer.entity.Aggregation; import com.tykj.workflowcore.model_layer.entity.Aggregation;
import com.tykj.workflowcore.model_layer.entity.TableInfoEx; import com.tykj.workflowcore.model_layer.entity.TableInfoEx;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.beans.BeanUtils;
import java.util.List; import java.util.List;
...@@ -38,7 +39,7 @@ public class AggregationVO { ...@@ -38,7 +39,7 @@ public class AggregationVO {
public TableInfoEx getTableInfoEx(){ public TableInfoEx getTableInfoEx(){
TableInfoEx tableInfoEx = new TableInfoEx(); TableInfoEx tableInfoEx = new TableInfoEx();
BeanUtil.copyProperties(this,tableInfoEx); BeanUtils.copyProperties(this,tableInfoEx);
return tableInfoEx; return tableInfoEx;
} }
} }
package com.tykj.workflowcore.workflow_editer.entity.vo; package com.tykj.workflowcore.workflow_editer.entity.vo;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.tykj.workflowcore.workflow_editer.entity.FlowsInfo; import com.tykj.workflowcore.workflow_editer.entity.FlowsInfo;
import com.tykj.workflowcore.workflow_editer.entity.NodeInfo; import com.tykj.workflowcore.workflow_editer.entity.NodeInfo;
...@@ -9,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -9,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import java.util.Date; import java.util.Date;
...@@ -51,10 +51,10 @@ public class FlowsInfoVo { ...@@ -51,10 +51,10 @@ public class FlowsInfoVo {
} }
public FlowsInfo toEntity(FlowsInfo oldFlowsInfo){ public FlowsInfo toEntity(FlowsInfo oldFlowsInfo){
if (!StrUtil.isEmpty(flowName)){ if (!StringUtils.isEmpty(flowName)){
oldFlowsInfo.setFlowName(flowName); oldFlowsInfo.setFlowName(flowName);
} }
if (!StrUtil.isEmpty(flowDescribe)){ if (!StringUtils.isEmpty(flowDescribe)){
oldFlowsInfo.setFlowDescribe(flowDescribe); oldFlowsInfo.setFlowDescribe(flowDescribe);
} }
return oldFlowsInfo; return oldFlowsInfo;
......
...@@ -53,6 +53,9 @@ public class ProcessEndListener extends AbstractFlowableEngineEventListener { ...@@ -53,6 +53,9 @@ public class ProcessEndListener extends AbstractFlowableEngineEventListener {
@Autowired @Autowired
RepositoryService repositoryService; RepositoryService repositoryService;
@Autowired
FormService formService;
@Autowired @Autowired
VariableStorageService variableStorageService; VariableStorageService variableStorageService;
...@@ -128,26 +131,31 @@ public class ProcessEndListener extends AbstractFlowableEngineEventListener { ...@@ -128,26 +131,31 @@ public class ProcessEndListener extends AbstractFlowableEngineEventListener {
if (execution.getCurrentFlowElement() instanceof StartEvent){ if (execution.getCurrentFlowElement() instanceof StartEvent){
DataHistory dataHistory = new DataHistory(); DataHistory dataHistory = new DataHistory();
StartEvent startEvent = (StartEvent) execution.getCurrentFlowElement(); StartEvent startEvent = (StartEvent) execution.getCurrentFlowElement();
//实例id
String processInstanceId = execution.getProcessInstanceId();
String processInstanceBusinessKey = execution.getProcessInstanceBusinessKey();
System.out.println(processInstanceBusinessKey);
String nodeId = execution.getCurrentActivityId(); String nodeId = execution.getCurrentActivityId();
String formKey = startEvent.getFormKey(); String formKey = startEvent.getFormKey();
//通过formKey查询出页面 //通过formKey查询出页面
} }
if (execution.getCurrentFlowElement() instanceof UserTask){ if (execution.getCurrentFlowElement() instanceof UserTask){
//查询任务
Task task = taskService.createTaskQuery().singleResult();
Map<String, Object> variables = taskService.getVariables(task.getId());
DataHistory dataHistory = new DataHistory(); DataHistory dataHistory = new DataHistory();
UserTask userTask = (UserTask) execution.getCurrentFlowElement(); String datas = JSON.toJSONString(variables);
String taskId = userTask.getId(); //流程实例id
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
String processInstanceId = task.getProcessInstanceId(); String processInstanceId = task.getProcessInstanceId();
//当前节点id
String nodeId = task.getTaskDefinitionKey(); String nodeId = task.getTaskDefinitionKey();
String flowKey = task.getProcessDefinitionId();
Map<String, Object> variables = taskService.getVariables(taskId);
String datas = JSON.toJSONString(variables); // dataHistory.setTaskId(taskId);
dataHistory.setTaskId(taskId);
dataHistory.setDatas(datas); dataHistory.setDatas(datas);
dataHistory.setNodeId(nodeId); dataHistory.setNodeId(nodeId);
dataHistory.setProcessInstanceId(processInstanceId); dataHistory.setProcessInstanceId(processInstanceId);
dataHistory.setFlowKey(flowKey);
dataHistoryService.saveData(dataHistory); dataHistoryService.saveData(dataHistory);
} }
} }
......
package com.tykj.workflowcore.workflow_editer.service.impl; package com.tykj.workflowcore.workflow_editer.service.impl;
import cn.hutool.core.util.StrUtil;
import com.tykj.workflowcore.api.service.SpringBeanService; import com.tykj.workflowcore.api.service.SpringBeanService;
import com.tykj.workflowcore.base.result.ApiException; import com.tykj.workflowcore.base.result.ApiException;
import com.tykj.workflowcore.base.util.FileUtil; import com.tykj.workflowcore.base.util.FileUtil;
...@@ -17,6 +16,7 @@ import com.tykj.workflowcore.workflow_editer.service.WorkFlowService; ...@@ -17,6 +16,7 @@ import com.tykj.workflowcore.workflow_editer.service.WorkFlowService;
import com.tykj.workflowcore.workflow_editer.util.UserServiceBeanUtil; import com.tykj.workflowcore.workflow_editer.util.UserServiceBeanUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import liquibase.pro.packaged.E; import liquibase.pro.packaged.E;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.*; import org.dom4j.*;
import org.dom4j.io.SAXReader; import org.dom4j.io.SAXReader;
import org.flowable.bpmn.converter.BpmnXMLConverter; import org.flowable.bpmn.converter.BpmnXMLConverter;
...@@ -24,7 +24,6 @@ import org.flowable.bpmn.model.*; ...@@ -24,7 +24,6 @@ import org.flowable.bpmn.model.*;
import org.flowable.bpmn.model.Process; import org.flowable.bpmn.model.Process;
import org.flowable.common.engine.impl.identity.Authentication; import org.flowable.common.engine.impl.identity.Authentication;
import org.flowable.engine.*; import org.flowable.engine.*;
import org.flowable.engine.history.HistoricDetail;
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl; import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.flowable.engine.repository.Deployment; import org.flowable.engine.repository.Deployment;
import org.flowable.engine.runtime.ProcessInstance; import org.flowable.engine.runtime.ProcessInstance;
...@@ -33,19 +32,16 @@ import org.flowable.task.api.TaskQuery; ...@@ -33,19 +32,16 @@ import org.flowable.task.api.TaskQuery;
import org.flowable.task.api.history.HistoricTaskInstance; import org.flowable.task.api.history.HistoricTaskInstance;
import org.flowable.validation.ProcessValidator; import org.flowable.validation.ProcessValidator;
import org.flowable.validation.ValidationError; import org.flowable.validation.ValidationError;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamReader;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
...@@ -211,7 +207,7 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -211,7 +207,7 @@ public class WorkFlowServiceImpl implements WorkFlowService {
String flowXmlResourceName = flowKey + "bpmn20.xml"; String flowXmlResourceName = flowKey + "bpmn20.xml";
String CustomFlowXmlResourceName = flowKey + "bpmnCustom20.xml"; String CustomFlowXmlResourceName = flowKey + "bpmnCustom20.xml";
//从数据库里查处来 //从数据库里查处来
if (StrUtil.isEmpty(flowsInfo.getFilePath())){ if (StringUtils.isEmpty(flowsInfo.getFilePath())){
//生成xml文件 //生成xml文件
flowsInfo = flowsInfoVo.toEntity(flowsInfo); flowsInfo = flowsInfoVo.toEntity(flowsInfo);
flowsInfo.setResourceName(flowXmlResourceName); flowsInfo.setResourceName(flowXmlResourceName);
...@@ -321,7 +317,7 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -321,7 +317,7 @@ public class WorkFlowServiceImpl implements WorkFlowService {
//设置流程发起人 //设置流程发起人
WorkFlowUser currentUser = userService.getCurrentUser(); WorkFlowUser currentUser = userService.getCurrentUser();
Authentication.setAuthenticatedUserId(currentUser.getId() + ""); Authentication.setAuthenticatedUserId(currentUser.getId() + "");
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(startFlowVo.getFlowKey(), ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(startFlowVo.getFlowKey(),startFlowVo.getFlowKey(),
startFlowVo.getMap()); startFlowVo.getMap());
// 存储流程实例id // 存储流程实例id
// 根据flowKey查询出一个FlowInfo // 根据flowKey查询出一个FlowInfo
...@@ -376,7 +372,8 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -376,7 +372,8 @@ public class WorkFlowServiceImpl implements WorkFlowService {
} }
@Override @Override
public Map<String, Object> findTaskDetail(String taskId) {Map<String, Object> variables = new HashMap<>(); public Map<String, Object> findTaskDetail(String taskId) {
Map<String, Object> variables = new HashMap<>();
//流程还在运行 //流程还在运行
if (taskId != null) { if (taskId != null) {
variables = taskService.getVariables(taskId); variables = taskService.getVariables(taskId);
......
...@@ -91,6 +91,7 @@ public class FlowEventValidator extends ProcessLevelValidator { ...@@ -91,6 +91,7 @@ public class FlowEventValidator extends ProcessLevelValidator {
if (incomingFlows.size() == 0 || incomingFlows.equals("")){ if (incomingFlows.size() == 0 || incomingFlows.equals("")){
errors.add(createValidationErrorProblem("缺少连接网关的输出流")); errors.add(createValidationErrorProblem("缺少连接网关的输出流"));
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论