提交 1e9eb789 authored 作者: zhoushaopan's avatar zhoushaopan

[工作流模块] 增加了流程的变量池的结合

上级 c6fac988
package com.tykj.workflowcore.base.entity; package com.tykj.workflowcore.base.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -24,10 +25,12 @@ public abstract class BaseEntity { ...@@ -24,10 +25,12 @@ public abstract class BaseEntity {
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
@JsonFormat(pattern = "yyyy-MM-dd hh:mm")
protected Date createdTime; protected Date createdTime;
@ApiModelProperty("修改时间") @ApiModelProperty("修改时间")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
@JsonFormat(pattern = "yyyy-MM-dd hh:mm")
protected Date updatedTime; protected Date updatedTime;
@ApiModelProperty("逻辑删除 0为 false 1为 true") @ApiModelProperty("逻辑删除 0为 false 1为 true")
......
package com.tykj.workflowcore.model_layer.config; //package com.tykj.workflowcore.model_layer.config;
//
//
import com.github.benmanes.caffeine.cache.CacheLoader; //import com.github.benmanes.caffeine.cache.CacheLoader;
import com.github.benmanes.caffeine.cache.Caffeine; //import com.github.benmanes.caffeine.cache.Caffeine;
import org.springframework.cache.CacheManager; //import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching; //import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.caffeine.CaffeineCacheManager; //import org.springframework.cache.caffeine.CaffeineCacheManager;
import org.springframework.cache.concurrent.ConcurrentMapCache; //import org.springframework.cache.concurrent.ConcurrentMapCache;
import org.springframework.cache.support.SimpleCacheManager; //import org.springframework.cache.support.SimpleCacheManager;
import org.springframework.context.annotation.Bean; //import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; //import org.springframework.context.annotation.Configuration;
//
//
import java.util.Arrays; //import java.util.Arrays;
import java.util.Collections; //import java.util.Collections;
import java.util.concurrent.TimeUnit; //import java.util.concurrent.TimeUnit;
//
//
/** ///**
* @Author WWW // * @Author WWW
* @Description // * @Description
* @Date 10:47 2021/3/26 // * @Date 10:47 2021/3/26
* @return // * @return
**/ // **/
@Configuration //@Configuration
@EnableCaching //@EnableCaching
public class MyCacheConfig { //public class MyCacheConfig {
//
@Bean // @Bean
public CaffeineCacheManager cacheManager() { // public CacheManager cacheManager() {
/* // /*
api + cache spring cache + hashmap // api + cache spring cache + hashmap
myCode + redis // myCode + redis
spring cache + caffeine // spring cache + caffeine
SimpleCacheManager cacheManager = new SimpleCacheManager(); // */
*/ // SimpleCacheManager cacheManager = new SimpleCacheManager();
CaffeineCacheManager cacheManager = new CaffeineCacheManager(); //
Caffeine caffeine = Caffeine.newBuilder() //// CaffeineCacheManager cacheManager = new CaffeineCacheManager();
/* cache的初始容量值 */ //// Caffeine caffeine = Caffeine.newBuilder()
.initialCapacity(150) //// /* cache的初始容量值 */
//maximumSize用来控制cache的最大缓存数量,maximumSize和maximumWeight(最大权重)不可以同时使用, //// .initialCapacity(150)
.maximumSize(1000) //// //maximumSize用来控制cache的最大缓存数量,maximumSize和maximumWeight(最大权重)不可以同时使用,
//最后一次写入或者访问后过久过期 //// .maximumSize(1000);
.expireAfterAccess(10, TimeUnit.SECONDS) //// //最后一次写入或者访问后过久过期
//创建或更新之后多久刷新,需要设置cacheLoader ////// .expireAfterAccess(10, TimeUnit.SECONDS)
.refreshAfterWrite(5, TimeUnit.SECONDS); ////// //创建或更新之后多久刷新,需要设置cacheLoader
cacheManager.setCaffeine(caffeine); ////// .refreshAfterWrite(5, TimeUnit.SECONDS);
cacheManager.setCacheLoader(cacheLoader()); //// cacheManager.setCaffeine(caffeine);
/* 根据名字可以创建多个cache,但是多个cache使用相同的策略 */ //// cacheManager.setCacheLoader(cacheLoader());
cacheManager.setCacheNames(Arrays //// /* 根据名字可以创建多个cache,但是多个cache使用相同的策略 */
.asList("tableInfos")); //// cacheManager.setCacheNames(Arrays
//是否允许值为空 //// .asList("tableInfos"));
cacheManager.setAllowNullValues(false); //// //是否允许值为空
/* cacheManager.setCaches(Collections.singletonList(new ConcurrentMapCache("tableInfos"))); */ //// cacheManager.setAllowNullValues(false);
return cacheManager; // cacheManager.setCaches(Collections.singletonList(new ConcurrentMapCache("tableInfos")));
} // return cacheManager;
// }
//
@Bean //
public CacheLoader<Object, Object> cacheLoader() { // @Bean
return new CacheLoader<Object, Object>() { // public CacheLoader<Object, Object> cacheLoader() {
@Override // return new CacheLoader<Object, Object>() {
public Object load(Object key) { // @Override
return null; // public Object load(Object key) {
} // return null;
// 重写这个方法将oldValue值返回回去,进而刷新缓存 // }
@Override // // 重写这个方法将oldValue值返回回去,进而刷新缓存
public Object reload(Object key, Object oldValue) { // @Override
return oldValue; // public Object reload(Object key, Object oldValue) {
} // return oldValue;
}; // }
} // };
} // }
//}
...@@ -154,7 +154,7 @@ public class ModelController { ...@@ -154,7 +154,7 @@ public class ModelController {
} }
@ApiOperation("删除操作") @ApiOperation("删除操作")
@DeleteMapping("/delete") @DeleteMapping("/delete")
public ResponseEntity delTable(@RequestBody DelTableVO delTableVO) { public ResponseEntity delTable( DelTableVO delTableVO) {
int i = modelService.delTable(delTableVO); int i = modelService.delTable(delTableVO);
if (i==1){ if (i==1){
......
...@@ -31,7 +31,7 @@ public interface ModelService { ...@@ -31,7 +31,7 @@ public interface ModelService {
* @return * @return
* @throws SQLException * @throws SQLException
*/ */
@Cacheable(value = "tableInfos" ) // @Cacheable(cacheNames = "tableInfos")
Page<TableInfo> listAllEntities(SearchTableInfoVo searchTableInfoVo) throws SQLException; Page<TableInfo> listAllEntities(SearchTableInfoVo searchTableInfoVo) throws SQLException;
...@@ -58,7 +58,7 @@ public interface ModelService { ...@@ -58,7 +58,7 @@ public interface ModelService {
* @param tableVO * @param tableVO
* @return * @return
*/ */
@CachePut(value = "tableInfos") // @CachePut(cacheNames = "tableInfos")
TableVO newTable(TableVO tableVO); TableVO newTable(TableVO tableVO);
/** /**
...@@ -97,7 +97,7 @@ public interface ModelService { ...@@ -97,7 +97,7 @@ public interface ModelService {
* @param updateTableInfoVO * @param updateTableInfoVO
* @return * @return
*/ */
@CachePut(value = "tableInfos") // @CachePut(cacheNames = "tableInfos")
int updateTable(UpdateTableInfoVO updateTableInfoVO); int updateTable(UpdateTableInfoVO updateTableInfoVO);
...@@ -106,8 +106,8 @@ public interface ModelService { ...@@ -106,8 +106,8 @@ public interface ModelService {
* @param delTableVO * @param delTableVO
* @return * @return
*/ */
@CacheEvict(value = "tableInfos") // @CacheEvict(cacheNames = "tableInfos")
@Transactional // @Transactional
int delTable(DelTableVO delTableVO); int delTable(DelTableVO delTableVO);
......
...@@ -2,6 +2,7 @@ package com.tykj.workflowcore.workflow_editer.controller; ...@@ -2,6 +2,7 @@ package com.tykj.workflowcore.workflow_editer.controller;
import com.tykj.workflowcore.base.result.ResultUtil; import com.tykj.workflowcore.base.result.ResultUtil;
import com.tykj.workflowcore.model_layer.entity.TableInfo; import com.tykj.workflowcore.model_layer.entity.TableInfo;
import com.tykj.workflowcore.model_layer.entity.vo.TableAndColumnInfoVO;
import com.tykj.workflowcore.workflow_editer.entity.FormPage; import com.tykj.workflowcore.workflow_editer.entity.FormPage;
//import com.tykj.workflowcore.workflow_editer.entity.PageEntity; //import com.tykj.workflowcore.workflow_editer.entity.PageEntity;
import com.tykj.workflowcore.workflow_editer.service.FormPageService; import com.tykj.workflowcore.workflow_editer.service.FormPageService;
...@@ -68,7 +69,7 @@ public class FormPageController { ...@@ -68,7 +69,7 @@ public class FormPageController {
@ApiOperation("通过页面id查询所对应的数据模型") @ApiOperation("通过页面id查询所对应的数据模型")
@PostMapping("/findByPages") @PostMapping("/findByPages")
public List<TableInfo> findByPages(@RequestBody List<Integer> pageIds){ public TableAndColumnInfoVO findByPages(@RequestBody List<Integer> pageIds){
return formPageService.findByPageIds(pageIds); return formPageService.findByPageIds(pageIds);
} }
......
...@@ -75,7 +75,7 @@ public class WorkFlowController { ...@@ -75,7 +75,7 @@ public class WorkFlowController {
@ApiOperation("是否删除") @ApiOperation("是否删除")
public ResponseEntity deleteFlow(Integer id){ public ResponseEntity deleteFlow(Integer id){
workFlowService.deleteFlow(id); workFlowService.deleteFlow(id);
return ResultUtil.success("该流程已被删除"); return ResultUtil.success("该流程删除成功");
} }
@PostMapping("/flowProgress") @PostMapping("/flowProgress")
......
...@@ -57,7 +57,10 @@ public class ProcessEndListener extends AbstractFlowableEngineEventListener { ...@@ -57,7 +57,10 @@ public class ProcessEndListener extends AbstractFlowableEngineEventListener {
if (event.getEntity() instanceof ProcessInstance){ if (event.getEntity() instanceof ProcessInstance){
ProcessInstance processInstance = (ProcessInstance) event.getEntity(); ProcessInstance processInstance = (ProcessInstance) event.getEntity();
String processDefinitionId = processInstance.getProcessDefinitionId(); String processDefinitionId = processInstance.getProcessDefinitionId();
String flowKey = processDefinitionId.substring(0,processDefinitionId.indexOf(":")); String flowKey = processDefinitionId;
if (processDefinitionId.indexOf(":")>=0){
flowKey = processDefinitionId.substring(0,processDefinitionId.indexOf(":"));
}
List<VariableStorage> variableStorageList = variableStorageService.searchVariableStorageList(new SearchVariableStorageVo(flowKey)); List<VariableStorage> variableStorageList = variableStorageService.searchVariableStorageList(new SearchVariableStorageVo(flowKey));
for (VariableStorage variableStorage : variableStorageList) { for (VariableStorage variableStorage : variableStorageList) {
InvokeRequestVo variableInfo = variableStorage.getInvokeRequest(); InvokeRequestVo variableInfo = variableStorage.getInvokeRequest();
......
package com.tykj.workflowcore.workflow_editer.service; package com.tykj.workflowcore.workflow_editer.service;
import com.tykj.workflowcore.model_layer.entity.TableInfo; import com.tykj.workflowcore.model_layer.entity.TableInfo;
import com.tykj.workflowcore.model_layer.entity.vo.TableAndColumnInfoVO;
import com.tykj.workflowcore.workflow_editer.entity.FormPage; import com.tykj.workflowcore.workflow_editer.entity.FormPage;
import com.tykj.workflowcore.workflow_editer.entity.vo.FormPageVo; import com.tykj.workflowcore.workflow_editer.entity.vo.FormPageVo;
import com.tykj.workflowcore.workflow_editer.entity.vo.PageFormPageVo; import com.tykj.workflowcore.workflow_editer.entity.vo.PageFormPageVo;
...@@ -57,5 +58,5 @@ public interface FormPageService { ...@@ -57,5 +58,5 @@ public interface FormPageService {
* @param pageIds 页面id * @param pageIds 页面id
* @return * @return
*/ */
List<TableInfo> findByPageIds(List<Integer> pageIds); TableAndColumnInfoVO findByPageIds(List<Integer> pageIds);
} }
...@@ -5,6 +5,8 @@ import com.github.wenhao.jpa.PredicateBuilder; ...@@ -5,6 +5,8 @@ import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications; import com.github.wenhao.jpa.Specifications;
import com.tykj.workflowcore.model_layer.dao.TableInfoDao; import com.tykj.workflowcore.model_layer.dao.TableInfoDao;
import com.tykj.workflowcore.model_layer.entity.TableInfo; import com.tykj.workflowcore.model_layer.entity.TableInfo;
import com.tykj.workflowcore.model_layer.entity.vo.TableAndColumnInfoVO;
import com.tykj.workflowcore.model_layer.service.ModelService;
import com.tykj.workflowcore.workflow_editer.entity.FormPage; import com.tykj.workflowcore.workflow_editer.entity.FormPage;
import com.tykj.workflowcore.workflow_editer.dao.FormPageMapper; import com.tykj.workflowcore.workflow_editer.dao.FormPageMapper;
import com.tykj.workflowcore.workflow_editer.service.FormPageService; import com.tykj.workflowcore.workflow_editer.service.FormPageService;
...@@ -35,7 +37,7 @@ public class FormPageServiceImpl implements FormPageService { ...@@ -35,7 +37,7 @@ public class FormPageServiceImpl implements FormPageService {
@Autowired @Autowired
private FormPageMapper formPageMapper; private FormPageMapper formPageMapper;
@Autowired @Autowired
private TableInfoDao tableInfoDao; private ModelService modelService;
@Override @Override
public Integer savePage(@RequestBody FormPageVo inFormPageVo) { public Integer savePage(@RequestBody FormPageVo inFormPageVo) {
inFormPageVo.setCreateTime(new Date()); inFormPageVo.setCreateTime(new Date());
...@@ -78,7 +80,7 @@ public class FormPageServiceImpl implements FormPageService { ...@@ -78,7 +80,7 @@ public class FormPageServiceImpl implements FormPageService {
} }
@Override @Override
public List<TableInfo> findByPageIds(List<Integer> pageIds) { public TableAndColumnInfoVO findByPageIds(List<Integer> pageIds) {
ArrayList<TableInfo> list = new ArrayList<>(); ArrayList<TableInfo> list = new ArrayList<>();
PredicateBuilder<FormPage> builder = Specifications.and(); PredicateBuilder<FormPage> builder = Specifications.and();
...@@ -93,8 +95,9 @@ public class FormPageServiceImpl implements FormPageService { ...@@ -93,8 +95,9 @@ public class FormPageServiceImpl implements FormPageService {
String[] split = entityIds.toString().split(","); String[] split = entityIds.toString().split(",");
List<String> lastEntityIds = Arrays.asList(split).stream().distinct().collect(Collectors.toList()); List<String> lastEntityIds = Arrays.asList(split).stream().distinct().collect(Collectors.toList());
//todo //todo
Integer[] ids = (Integer[]) lastEntityIds.toArray();
return list; return modelService.getTableInfoAndColumnInfoByBatch(ids);
} }
} }
...@@ -3,6 +3,7 @@ package com.tykj.workflowcore.workflow_editer.service.impl; ...@@ -3,6 +3,7 @@ package com.tykj.workflowcore.workflow_editer.service.impl;
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;
import com.tykj.workflowcore.workflow_editer.util.MapUtils;
import com.tykj.workflowcore.workflow_editer.validate.ProcessValidatorFactoryExt; import com.tykj.workflowcore.workflow_editer.validate.ProcessValidatorFactoryExt;
import com.tykj.workflowcore.workflow_editer.entity.*; import com.tykj.workflowcore.workflow_editer.entity.*;
import com.tykj.workflowcore.workflow_editer.dao.FlowsInfoMapper; import com.tykj.workflowcore.workflow_editer.dao.FlowsInfoMapper;
...@@ -13,6 +14,7 @@ import com.tykj.workflowcore.workflow_editer.service.UserService; ...@@ -13,6 +14,7 @@ import com.tykj.workflowcore.workflow_editer.service.UserService;
import com.tykj.workflowcore.workflow_editer.service.VariableStorageService; import com.tykj.workflowcore.workflow_editer.service.VariableStorageService;
import com.tykj.workflowcore.workflow_editer.service.WorkFlowService; 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 org.dom4j.Attribute; import org.dom4j.Attribute;
import org.dom4j.Document; import org.dom4j.Document;
import org.dom4j.DocumentException; import org.dom4j.DocumentException;
...@@ -43,6 +45,7 @@ import javax.xml.stream.XMLStreamException; ...@@ -43,6 +45,7 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamReader;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
/** /**
* ClassName: FlowableServiceImpl * ClassName: FlowableServiceImpl
...@@ -161,9 +164,9 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -161,9 +164,9 @@ public class WorkFlowServiceImpl implements WorkFlowService {
String flowKey = flowsInfoVo.getFlowKey(); String flowKey = flowsInfoVo.getFlowKey();
String fileXml = flowsInfoVo.getFileXml(); String fileXml = flowsInfoVo.getFileXml();
//生成xml文件 //生成xml文件
File file = FileUtil.createFileByString(basePath + flowKey + "bpmn20.xml", File file = FileUtil.createFileByString(basePath + flowKey + "bpmn20.xml",
flowsInfoVo.getFileXml().replaceAll("\\[\\?\\?[^\\]]+\\?\\?\\]", "")); flowsInfoVo.getFileXml().replaceAll("\\[\\?\\?[^\\]]+\\?\\?\\]", "").replaceAll("&lt;","<").replaceAll("&gt;",">"));
FileUtil.createFileByString(basePath + flowKey + "bpmnCustom20.xml", flowsInfoVo.getFileXml()); FileUtil.createFileByString(basePath + flowKey + "bpmnCustom20.xml", flowsInfoVo.getFileXml());
FlowsInfo flowsInfo = new FlowsInfo(); FlowsInfo flowsInfo = new FlowsInfo();
...@@ -190,7 +193,7 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -190,7 +193,7 @@ public class WorkFlowServiceImpl implements WorkFlowService {
for (int i =0;i<validate.size();i++){ for (int i =0;i<validate.size();i++){
ValidationError validationError = validate.get(i); ValidationError validationError = validate.get(i);
String problem = validationError.getProblem(); String problem = validationError.getProblem();
message.append(i+1+problem); message.append(i+1+""+problem);
message.append("\r\n"); message.append("\r\n");
} }
throw new ApiException(null,message.toString()); throw new ApiException(null,message.toString());
...@@ -205,6 +208,7 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -205,6 +208,7 @@ public class WorkFlowServiceImpl implements WorkFlowService {
@Override @Override
public Integer createFlow(FlowsInfo flowsInfo) { public Integer createFlow(FlowsInfo flowsInfo) {
flowsInfo.setCreatedTime(new Date());
FlowsInfo flowsInfo1 = flowsInfoMapper.save(flowsInfo); FlowsInfo flowsInfo1 = flowsInfoMapper.save(flowsInfo);
return flowsInfo1.getId(); return flowsInfo1.getId();
} }
...@@ -251,8 +255,8 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -251,8 +255,8 @@ public class WorkFlowServiceImpl implements WorkFlowService {
if (nextTaskVo.getRoleId() != null || nextTaskVo.getUserId() != null) { if (nextTaskVo.getRoleId() != null || nextTaskVo.getUserId() != null) {
taskQuery.or(); taskQuery.or();
if (nextTaskVo.getUserId() != null) { if (nextTaskVo.getUserId() != null) {
// taskQuery.taskCandidateUser(nextTaskVo.getUserId()).orderByTaskCreateTime().desc(); taskQuery.taskCandidateUser(nextTaskVo.getUserId()).orderByTaskCreateTime().desc();
taskQuery.taskAssignee(nextTaskVo.getUserId()).orderByTaskCreateTime().desc(); // taskQuery.taskAssignee(nextTaskVo.getUserId()).orderByTaskCreateTime().desc();
} }
if (nextTaskVo.getRoleId() != null && nextTaskVo.getRoleId().size() > 0) { if (nextTaskVo.getRoleId() != null && nextTaskVo.getRoleId().size() > 0) {
taskQuery.taskCandidateGroupIn(nextTaskVo.getRoleId()).orderByTaskCreateTime().desc(); taskQuery.taskCandidateGroupIn(nextTaskVo.getRoleId()).orderByTaskCreateTime().desc();
...@@ -301,27 +305,45 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -301,27 +305,45 @@ public class WorkFlowServiceImpl implements WorkFlowService {
@Override @Override
public void completeTask(@RequestBody TaskVo taskVo) { public void completeTask(@RequestBody TaskVo taskVo) {
Map<String, Object> map = new HashMap<>(); // Map<String, Object> map = new HashMap<>();
if (taskVo.getMap() != null) { // if (taskVo.getMap() != null) {
setVariables(taskVo.getMap()); // map = setVariables(taskVo.getMap());
} // }
ConcurrentHashMap flowMap = new ConcurrentHashMap<>();
ConcurrentHashMap oldFlowMap = new ConcurrentHashMap<>();
ConcurrentHashMap userMap = new ConcurrentHashMap<>();
Task task = taskService.createTaskQuery().taskId(taskVo.getTaskId()).singleResult(); Task task = taskService.createTaskQuery().taskId(taskVo.getTaskId()).singleResult();
if (task==null){
throw new ApiException(null,"该任务已经被完成了");
}
//用户map
userMap.putAll(taskVo.getMap());
//流程map
oldFlowMap.putAll(taskService.getVariables(taskVo.getTaskId()));
flowMap.putAll(taskService.getVariables(taskVo.getTaskId()));
MapUtils.loopMap(flowMap,"",userMap);
String processInstanceId = task.getProcessInstanceId(); String processInstanceId = task.getProcessInstanceId();
//如果 存在任务评论的话 向任务中添加任务评论 //如果 存在任务评论的话 向任务中添加任务评论
if (taskVo.getComments() != null) { if (taskVo.getComments() != null) {
taskService.addComment(task.getId(), processInstanceId, taskVo.getComments()); taskService.addComment(task.getId(), processInstanceId, taskVo.getComments());
} }
//先判断是不是表达式 //先判断是
if (taskVo.getConditionalExpression() != null) { if (taskVo.getHandlingOpinion() != null){
claimTask(task.getId(), userService.getCurrentUser().getId()); taskVo.getMap().put("handlingOpinion", taskVo.getHandlingOpinion());
taskService.complete(task.getId()); }
try {
taskService.setVariables(task.getId(),flowMap);
taskService.complete(task.getId(), taskVo.getMap());
} catch (Exception e) {
taskService.removeVariables(task.getId(),taskService.getVariables(task.getId()).keySet());
taskService.setVariables(task.getId(),oldFlowMap);
} else {
map.put("handlingOpinion", taskVo.getHandlingOpinion());
claimTask(task.getId(), userService.getCurrentUser().getId());
taskService.complete(task.getId(), map);
} }
} }
@Override @Override
...@@ -366,7 +388,7 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -366,7 +388,7 @@ public class WorkFlowServiceImpl implements WorkFlowService {
Optional<FlowsInfo> flowsInfoMapperById = flowsInfoMapper.findById(id); Optional<FlowsInfo> flowsInfoMapperById = flowsInfoMapper.findById(id);
if (flowsInfoMapperById.isPresent()) { if (flowsInfoMapperById.isPresent()) {
FlowsInfo flowsInfo = flowsInfoMapperById.get(); FlowsInfo flowsInfo = flowsInfoMapperById.get();
if (flowsInfo.getState() == 0) { if (flowsInfo.getDeleted() == 0) {
flowsInfoMapper.deleteById(id); flowsInfoMapper.deleteById(id);
} }
} else { } else {
...@@ -426,7 +448,7 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -426,7 +448,7 @@ public class WorkFlowServiceImpl implements WorkFlowService {
@Override @Override
public List<Object> findHistoryTask(String userId) { public List<Object> findHistoryTask(String userId) {
List<HistoricTaskInstance> taskInstanceList = List<HistoricTaskInstance> taskInstanceList =
historyService.createHistoricTaskInstanceQuery().taskAssignee(userId).finished().list(); historyService.createHistoricTaskInstanceQuery().taskCandidateUser(userId).finished().list();
ArrayList<Object> arrayList = new ArrayList<>(); ArrayList<Object> arrayList = new ArrayList<>();
arrayList.addAll(taskInstanceList); arrayList.addAll(taskInstanceList);
return arrayList; return arrayList;
...@@ -434,7 +456,12 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -434,7 +456,12 @@ public class WorkFlowServiceImpl implements WorkFlowService {
@Override @Override
public String getCurrentNodeId(String taskId) { public String getCurrentNodeId(String taskId) {
if (taskId!=null){
return taskService.createTaskQuery().taskId(taskId).singleResult().getTaskDefinitionKey(); return taskService.createTaskQuery().taskId(taskId).singleResult().getTaskDefinitionKey();
}else {
throw new ApiException(null,"任务已经不存在了");
}
} }
@Override @Override
......
package com.tykj.workflowcore.workflow_editer.util;
import org.springframework.util.StringUtils;
import java.util.Map;
import java.util.Set;
/**
* ClassName: MapUtils
* Package: com.tykj.workflowcore.workflow_editer.util
* Description:
* Datetime: 2021/3/30 16:15
*
* @Author: zsp
*/
public class MapUtils {
public static void loopMap(Map m1, String p, Map m2) {
m1.forEach((key, value) -> {
Set mapKeySetByPath = getMapKeySetByPath(m2, p + "." + key);
System.out.println(p + "." + key);
System.out.println(mapKeySetByPath);
if (mapKeySetByPath!=null){
mapKeySetByPath.forEach( (keyStr)->{
if (!m1.containsKey(keyStr)){
m1.put(keyStr,getMapByPath(m2,p + "." + keyStr));
}
});
}
if (value instanceof Map) {
String path;
if (StringUtils.isEmpty(p)) {
path = (String) key;
} else {
path = p + "." + key;
}
loopMap((Map) value, path, m2);
} else {
if (!StringUtils.isEmpty(p)) {
String path = p + "." + key;
Object result = getMapByPath(m2, path);
if (result != null) {
m1.put(key, result);
}
}
}
});
}
public static Object getMapByPath(Map m2, String path) {
int point = path.indexOf(".");
if (point==0){
//第一层
Object r = m2.get(path.substring(1));
return r;
}
if (point == -1) {
//已经递归到最后一层了
Object r = m2.get(path);
return r;
}
String key = path.substring(0, point);
String last = path.substring(point + 1);
Object result = m2.get(key);
if (result == null) {
return null;
} else {
try {
return getMapByPath((Map) result, last);
} catch (Exception e) {
return null;
}
}
}
public static Set getMapKeySetByPath(Map m2, String path) {
int point = path.indexOf(".");
if (point <= 0) {
Set r = m2.keySet();
return r;
}
String key = path.substring(0, point);
String last = path.substring(point + 1);
Object result = m2.get(key);
if (result == null) {
return null;
} else {
try {
return getMapKeySetByPath((Map) result, last);
} catch (Exception e) {
return null;
}
}
}
}
...@@ -15,6 +15,7 @@ import org.springframework.stereotype.Component; ...@@ -15,6 +15,7 @@ import org.springframework.stereotype.Component;
*/ */
@Component @Component
public class ProcessValidatorFactoryExt extends ProcessValidatorFactory { public class ProcessValidatorFactoryExt extends ProcessValidatorFactory {
@Override @Override
public ProcessValidator createDefaultProcessValidator() { public ProcessValidator createDefaultProcessValidator() {
ProcessValidator defaultProcessValidator = super.createDefaultProcessValidator(); ProcessValidator defaultProcessValidator = super.createDefaultProcessValidator();
...@@ -24,4 +25,5 @@ public class ProcessValidatorFactoryExt extends ProcessValidatorFactory { ...@@ -24,4 +25,5 @@ public class ProcessValidatorFactoryExt extends ProcessValidatorFactory {
defaultProcessValidator.getValidatorSets().add(validatorSet); defaultProcessValidator.getValidatorSets().add(validatorSet);
return defaultProcessValidator; return defaultProcessValidator;
} }
} }
...@@ -27,8 +27,7 @@ public class UserTaskValidator extends ProcessLevelValidator { ...@@ -27,8 +27,7 @@ public class UserTaskValidator extends ProcessLevelValidator {
List<EndEvent> endEvents = process.findFlowElementsOfType(EndEvent.class); List<EndEvent> endEvents = process.findFlowElementsOfType(EndEvent.class);
//判断开始节点 //判断开始节点
List<StartEvent> startEvents = process.findFlowElementsOfType(StartEvent.class); List<StartEvent> startEvents = process.findFlowElementsOfType(StartEvent.class);
//判断网关
// List<ExclusiveGateway> exclusiveGateways = process.findFlowElementsOfType(ExclusiveGateway.class);
if (userTaskList.size() > 0) { if (userTaskList.size() > 0) {
for (UserTask userTask : userTaskList) { for (UserTask userTask : userTaskList) {
if (userTask.getName() == null || userTask.getName().equals("")) { if (userTask.getName() == null || userTask.getName().equals("")) {
...@@ -44,7 +43,8 @@ public class UserTaskValidator extends ProcessLevelValidator { ...@@ -44,7 +43,8 @@ public class UserTaskValidator extends ProcessLevelValidator {
} }
List<String> candidateUsers = userTask.getCandidateUsers(); List<String> candidateUsers = userTask.getCandidateUsers();
List<String> candidateGroups = userTask.getCandidateGroups(); List<String> candidateGroups = userTask.getCandidateGroups();
if (candidateUsers.size() == 0 || candidateUsers.equals("") && candidateGroups.size() == 0 || candidateGroups.equals("")) {
if ((candidateUsers.size() == 0 || candidateUsers.equals("")) && (candidateGroups.size() == 0 || candidateGroups.equals(""))) {
errors.add(createValidationErrorProblem("用户节点未设置用户或者未设置用户组")); errors.add(createValidationErrorProblem("用户节点未设置用户或者未设置用户组"));
} }
...@@ -72,19 +72,20 @@ public class UserTaskValidator extends ProcessLevelValidator { ...@@ -72,19 +72,20 @@ public class UserTaskValidator extends ProcessLevelValidator {
} }
} }
} }
//判断网关
// for (ExclusiveGateway exclusiveGateway : exclusiveGateways) { List<ExclusiveGateway> exclusiveGateways = process.findFlowElementsOfType(ExclusiveGateway.class);
// //输出流 for (ExclusiveGateway exclusiveGateway : exclusiveGateways) {
// List<SequenceFlow> outgoingFlows = exclusiveGateway.getOutgoingFlows(); //输出流
// if (outgoingFlows.size() == 0 || outgoingFlows.equals("")){ List<SequenceFlow> outgoingFlows = exclusiveGateway.getOutgoingFlows();
// validationError.setProblem(exclusiveGateway.getId()+"--->缺少连接用户任务的输出流"); if (outgoingFlows.size() == 0 || outgoingFlows.equals("")){
// } errors.add(createValidationErrorProblem("缺少连接网关的输入流"));
// //输入流 }
// List<SequenceFlow> incomingFlows = exclusiveGateway.getIncomingFlows(); //输入流
// if (incomingFlows.size() == 0 || incomingFlows.equals("")){ List<SequenceFlow> incomingFlows = exclusiveGateway.getIncomingFlows();
// validationError.setProblem(exclusiveGateway.getId()+"--->缺少连接用户任务的输入流"); if (incomingFlows.size() == 0 || incomingFlows.equals("")){
// } errors.add(createValidationErrorProblem("缺少连接网关的输出流"));
// } }
}
} }
......
...@@ -2,7 +2,7 @@ spring: ...@@ -2,7 +2,7 @@ spring:
datasource: datasource:
username: root username: root
password: Huang123+ password: Huang123+
url: jdbc:mysql://47.106.142.73:3306/www2?useSSL=false&serverTimezone=Asia/Shanghai&characterEncoding=utf-8&nullCatalogMeansCurrent=true url: jdbc:mysql://47.106.142.73:3306/www?useSSL=false&serverTimezone=Asia/Shanghai&characterEncoding=utf-8&nullCatalogMeansCurrent=true
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
jpa: jpa:
show-sql: true show-sql: true
......
...@@ -6,6 +6,8 @@ import com.alibaba.fastjson.JSONObject; ...@@ -6,6 +6,8 @@ import com.alibaba.fastjson.JSONObject;
import com.tykj.workflowcore.workflow_editer.controller.FlowsInfoController; import com.tykj.workflowcore.workflow_editer.controller.FlowsInfoController;
import com.tykj.workflowcore.workflow_editer.controller.WorkFlowController; import com.tykj.workflowcore.workflow_editer.controller.WorkFlowController;
import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
...@@ -17,6 +19,10 @@ import org.springframework.test.web.servlet.RequestBuilder; ...@@ -17,6 +19,10 @@ import org.springframework.test.web.servlet.RequestBuilder;
import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import springfox.documentation.spring.web.json.Json; import springfox.documentation.spring.web.json.Json;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import static org.hamcrest.Matchers.equalToObject; import static org.hamcrest.Matchers.equalToObject;
import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.not;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
...@@ -47,129 +53,268 @@ class WorkflowCoreApplicationTests_workflow { ...@@ -47,129 +53,268 @@ class WorkflowCoreApplicationTests_workflow {
@Test @Test
//部署流程 //部署流程
void deployFlow() throws Exception { void deployFlow() throws Exception {
// String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
// "<bpmn2:definitions xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:bpmn2=\"http://www" +
// ".omg.org/spec/BPMN/20100524/MODEL\" xmlns:bpmndi=\"http://www.omg.org/spec/BPMN/20100524/DI\" " +
// "xmlns:dc=\"http://www.omg.org/spec/DD/20100524/DC\" xmlns:di=\"http://www.omg" +
// ".org/spec/DD/20100524/DI\" xmlns:flowable=\"http://flowable.org/bpmn\" targetNamespace=\"http://bpmn" +
// ".io/schema/bpmn\">\n" +
// " <bpmn2:process id=\"processId_fb773ab4-4d09-4f9f-b1d1-2cdb3805d02b\" name=\"第一次完整的测试\" " +
// "isExecutable=\"true\">\n" +
// " <bpmn2:documentation>这是第一次完整的测试</bpmn2:documentation>\n" +
// " <bpmn2:startEvent id=\"StartEvent_6dae980e-109d-4bdf-a4e8-7bcd1fed3517\" name=\"开始\">\n" +
// " <bpmn2:outgoing>Flow_1tfbtm6</bpmn2:outgoing>\n" +
// " </bpmn2:startEvent>\n" +
// " <bpmn2:sequenceFlow id=\"Flow_1tfbtm6\" " +
// "sourceRef=\"StartEvent_6dae980e-109d-4bdf-a4e8-7bcd1fed3517\" " +
// "targetRef=\"Activity_a750f23d-4cf2-49c6-9232-2d0a07c9221f\" />\n" +
// " <bpmn2:userTask id=\"Activity_a750f23d-4cf2-49c6-9232-2d0a07c9221f\" name=\"开始审批请假\" " +
// "flowable:candidateUsers=\"0,1,2,3\">\n" +
// " <bpmn2:incoming>Flow_1tfbtm6</bpmn2:incoming>\n" +
// " <bpmn2:outgoing>Flow_022g1sr</bpmn2:outgoing>\n" +
// " </bpmn2:userTask>\n" +
// " <bpmn2:exclusiveGateway id=\"Gateway_0f788cb8-b0a7-4867-ba7f-396df0b9c65a\">\n" +
// " <bpmn2:incoming>Flow_022g1sr</bpmn2:incoming>\n" +
// " <bpmn2:outgoing>Flow_cee3b49d-ebc5-45e3-a182-954d1ab60cdb</bpmn2:outgoing>\n" +
// " <bpmn2:outgoing>Flow_a4bc9aa7-25be-40c9-8b06-20563560a19a</bpmn2:outgoing>\n" +
// " </bpmn2:exclusiveGateway>\n" +
// " <bpmn2:sequenceFlow id=\"Flow_022g1sr\" " +
// "sourceRef=\"Activity_a750f23d-4cf2-49c6-9232-2d0a07c9221f\" " +
// "targetRef=\"Gateway_0f788cb8-b0a7-4867-ba7f-396df0b9c65a\" />\n" +
// " <bpmn2:sequenceFlow id=\"Flow_cee3b49d-ebc5-45e3-a182-954d1ab60cdb\" name=\"同意\" " +
// "sourceRef=\"Gateway_0f788cb8-b0a7-4867-ba7f-396df0b9c65a\" " +
// "targetRef=\"Activity_b8a67160-7332-4185-a782-1be95be7233a\">\n" +
// " <bpmn2:conditionExpression xsi:type=\"bpmn2:tFormalExpression\">${handlingOpinion " +
// "== 0}</bpmn2:conditionExpression>\n" +
// " </bpmn2:sequenceFlow>\n" +
// " <bpmn2:userTask id=\"Activity_b8a67160-7332-4185-a782-1be95be7233a\" name=\"人事备案\" " +
// "flowable:candidateUsers=\"1\">\n" +
// " <bpmn2:incoming>Flow_cee3b49d-ebc5-45e3-a182-954d1ab60cdb</bpmn2:incoming>\n" +
// " <bpmn2:outgoing>Flow_0pp1clp</bpmn2:outgoing>\n" +
// " </bpmn2:userTask>\n" +
// " <bpmn2:endEvent id=\"Event_5505a99e-25c8-4378-bb95-4c76bf370f44\" name=\"结束\">\n" +
// " <bpmn2:incoming>Flow_0pp1clp</bpmn2:incoming>\n" +
// " <bpmn2:incoming>Flow_0cc5fme</bpmn2:incoming>\n" +
// " </bpmn2:endEvent>\n" +
// " <bpmn2:sequenceFlow id=\"Flow_0pp1clp\" " +
// "sourceRef=\"Activity_b8a67160-7332-4185-a782-1be95be7233a\" " +
// "targetRef=\"Event_5505a99e-25c8-4378-bb95-4c76bf370f44\" />\n" +
// " <bpmn2:sequenceFlow id=\"Flow_a4bc9aa7-25be-40c9-8b06-20563560a19a\" name=\"不同意\" " +
// "sourceRef=\"Gateway_0f788cb8-b0a7-4867-ba7f-396df0b9c65a\" " +
// "targetRef=\"Activity_c9c101b8-e27e-4e48-8807-c9345f8f3f35\">\n" +
// " <bpmn2:conditionExpression xsi:type=\"bpmn2:tFormalExpression\">${handlingOpinion " +
// "== 1}</bpmn2:conditionExpression>\n" +
// " </bpmn2:sequenceFlow>\n" +
// " <bpmn2:userTask id=\"Activity_c9c101b8-e27e-4e48-8807-c9345f8f3f35\" name=\"通知用户请假不通过\" " +
// "flowable:candidateUsers=\"2\">\n" +
// " <bpmn2:incoming>Flow_a4bc9aa7-25be-40c9-8b06-20563560a19a</bpmn2:incoming>\n" +
// " <bpmn2:outgoing>Flow_0cc5fme</bpmn2:outgoing>\n" +
// " </bpmn2:userTask>\n" +
// " <bpmn2:sequenceFlow id=\"Flow_0cc5fme\" " +
// "sourceRef=\"Activity_c9c101b8-e27e-4e48-8807-c9345f8f3f35\" " +
// "targetRef=\"Event_5505a99e-25c8-4378-bb95-4c76bf370f44\" />\n" +
// " </bpmn2:process>\n" +
// " <bpmndi:BPMNDiagram id=\"BPMNDiagram_1\">\n" +
// " <bpmndi:BPMNPlane id=\"BPMNPlane_1\" " +
// "bpmnElement=\"processId_fb773ab4-4d09-4f9f-b1d1-2cdb3805d02b\">\n" +
// " <bpmndi:BPMNEdge id=\"Flow_1tfbtm6_di\" bpmnElement=\"Flow_1tfbtm6\">\n" +
// " <di:waypoint x=\"196\" y=\"178\" />\n" +
// " <di:waypoint x=\"270\" y=\"178\" />\n" +
// " </bpmndi:BPMNEdge>\n" +
// " <bpmndi:BPMNEdge id=\"Flow_022g1sr_di\" bpmnElement=\"Flow_022g1sr\">\n" +
// " <di:waypoint x=\"370\" y=\"178\" />\n" +
// " <di:waypoint x=\"405\" y=\"178\" />\n" +
// " </bpmndi:BPMNEdge>\n" +
// " <bpmndi:BPMNEdge id=\"Flow_14iep5w_di\" " +
// "bpmnElement=\"Flow_cee3b49d-ebc5-45e3-a182-954d1ab60cdb\">\n" +
// " <di:waypoint x=\"455\" y=\"178\" />\n" +
// " <di:waypoint x=\"510\" y=\"178\" />\n" +
// " <bpmndi:BPMNLabel>\n" +
// " <dc:Bounds x=\"471\" y=\"160\" width=\"23\" height=\"14\" />\n" +
// " </bpmndi:BPMNLabel>\n" +
// " </bpmndi:BPMNEdge>\n" +
// " <bpmndi:BPMNEdge id=\"Flow_0pp1clp_di\" bpmnElement=\"Flow_0pp1clp\">\n" +
// " <di:waypoint x=\"610\" y=\"178\" />\n" +
// " <di:waypoint x=\"672\" y=\"178\" />\n" +
// " </bpmndi:BPMNEdge>\n" +
// " <bpmndi:BPMNEdge id=\"Flow_0coa6ri_di\" " +
// "bpmnElement=\"Flow_a4bc9aa7-25be-40c9-8b06-20563560a19a\">\n" +
// " <di:waypoint x=\"430\" y=\"203\" />\n" +
// " <di:waypoint x=\"430\" y=\"310\" />\n" +
// " <di:waypoint x=\"510\" y=\"310\" />\n" +
// " <bpmndi:BPMNLabel>\n" +
// " <dc:Bounds x=\"428\" y=\"254\" width=\"34\" height=\"14\" />\n" +
// " </bpmndi:BPMNLabel>\n" +
// " </bpmndi:BPMNEdge>\n" +
// " <bpmndi:BPMNEdge id=\"Flow_0cc5fme_di\" bpmnElement=\"Flow_0cc5fme\">\n" +
// " <di:waypoint x=\"610\" y=\"310\" />\n" +
// " <di:waypoint x=\"641\" y=\"310\" />\n" +
// " <di:waypoint x=\"641\" y=\"178\" />\n" +
// " <di:waypoint x=\"672\" y=\"178\" />\n" +
// " </bpmndi:BPMNEdge>\n" +
// " <bpmndi:BPMNShape id=\"_BPMNShape_StartEvent_2\" " +
// "bpmnElement=\"StartEvent_6dae980e-109d-4bdf-a4e8-7bcd1fed3517\">\n" +
// " <dc:Bounds x=\"160\" y=\"160\" width=\"36\" height=\"36\" />\n" +
// " <bpmndi:BPMNLabel>\n" +
// " <dc:Bounds x=\"167\" y=\"203\" width=\"23\" height=\"14\" />\n" +
// " </bpmndi:BPMNLabel>\n" +
// " </bpmndi:BPMNShape>\n" +
// " <bpmndi:BPMNShape id=\"Gateway_069z61g_di\" " +
// "bpmnElement=\"Gateway_0f788cb8-b0a7-4867-ba7f-396df0b9c65a\" isMarkerVisible=\"true\">\n" +
// " <dc:Bounds x=\"405\" y=\"153\" width=\"50\" height=\"50\" />\n" +
// " </bpmndi:BPMNShape>\n" +
// " <bpmndi:BPMNShape id=\"Activity_096xy47_di\" " +
// "bpmnElement=\"Activity_b8a67160-7332-4185-a782-1be95be7233a\">\n" +
// " <dc:Bounds x=\"510\" y=\"138\" width=\"100\" height=\"80\" />\n" +
// " </bpmndi:BPMNShape>\n" +
// " <bpmndi:BPMNShape id=\"Event_0c8zgz5_di\" " +
// "bpmnElement=\"Event_5505a99e-25c8-4378-bb95-4c76bf370f44\">\n" +
// " <dc:Bounds x=\"672\" y=\"160\" width=\"36\" height=\"36\" />\n" +
// " <bpmndi:BPMNLabel>\n" +
// " <dc:Bounds x=\"679\" y=\"203\" width=\"23\" height=\"14\" />\n" +
// " </bpmndi:BPMNLabel>\n" +
// " </bpmndi:BPMNShape>\n" +
// " <bpmndi:BPMNShape id=\"Activity_0wehih5_di\" " +
// "bpmnElement=\"Activity_c9c101b8-e27e-4e48-8807-c9345f8f3f35\">\n" +
// " <dc:Bounds x=\"510\" y=\"270\" width=\"100\" height=\"80\" />\n" +
// " </bpmndi:BPMNShape>\n" +
// " <bpmndi:BPMNShape id=\"Activity_17cgfam_di\" " +
// "bpmnElement=\"Activity_a750f23d-4cf2-49c6-9232-2d0a07c9221f\">\n" +
// " <dc:Bounds x=\"270\" y=\"138\" width=\"100\" height=\"80\" />\n" +
// " </bpmndi:BPMNShape>\n" +
// " </bpmndi:BPMNPlane>\n" +
// " </bpmndi:BPMNDiagram>\n" +
// "</bpmn2:definitions>\n";
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<bpmn2:definitions xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:bpmn2=\"http://www" + "<bpmn2:definitions xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:bpmn2=\"http://www" +
".omg.org/spec/BPMN/20100524/MODEL\" xmlns:bpmndi=\"http://www.omg.org/spec/BPMN/20100524/DI\" " + ".omg.org/spec/BPMN/20100524/MODEL\" xmlns:bpmndi=\"http://www.omg.org/spec/BPMN/20100524/DI\" " +
"xmlns:dc=\"http://www.omg.org/spec/DD/20100524/DC\" xmlns:di=\"http://www.omg" + "xmlns:dc=\"http://www.omg.org/spec/DD/20100524/DC\" xmlns:di=\"http://www.omg" +
".org/spec/DD/20100524/DI\" targetNamespace=\"http://bpmn.io/schema/bpmn\">\n" + ".org/spec/DD/20100524/DI\" xmlns:flowable=\"http://flowable.org/bpmn\" targetNamespace=\"http://bpmn" +
" <bpmn2:process id=\"processId_26246e2b-2f1a-46a5-b2f1-f3df8109d06b\" name=\"processName_1\" " + ".io/schema/bpmn\">\n" +
" <bpmn2:process id=\"processId_1\" name=\"测试1\" " +
"isExecutable=\"true\">\n" + "isExecutable=\"true\">\n" +
" <bpmn2:documentation>description_1</bpmn2:documentation>\n" + " <bpmn2:documentation>测试1</bpmn2:documentation>\n" +
" <bpmn2:startEvent id=\"StartEvent_30cf7590-b7a4-4b17-ab9b-e1d1af577c77\" name=\"1\">\n" + " <bpmn2:startEvent id=\"StartEvent_11cf0b84-8cf7-4984-b029-2bc2d443be7f\" name=\"开始\">\n" +
" <bpmn2:outgoing>Flow_0mknr4h</bpmn2:outgoing>\n" + " <bpmn2:outgoing>Flow_1t7jvmu</bpmn2:outgoing>\n" +
" </bpmn2:startEvent>\n" + " </bpmn2:startEvent>\n" +
" <bpmn2:endEvent id=\"Event_1790b5c6-cb47-4193-8ffa-c721812850cf\" name=\"4\">\n" + " <bpmn2:sequenceFlow id=\"Flow_1t7jvmu\" " +
" <bpmn2:incoming>Flow_01cdmlh</bpmn2:incoming>\n" + "sourceRef=\"StartEvent_11cf0b84-8cf7-4984-b029-2bc2d443be7f\" " +
"targetRef=\"Activity_f69a408f-6814-49c9-b6d8-3024c92a12ec\" />\n" +
" <bpmn2:sequenceFlow id=\"Flow_1ke0rj0\" " +
"sourceRef=\"Activity_f69a408f-6814-49c9-b6d8-3024c92a12ec\" " +
"targetRef=\"Activity_4a50b9c8-2a74-4fff-9376-7b5a0bf5a680\" />\n" +
" <bpmn2:exclusiveGateway id=\"Gateway_d7c6c303-7b23-4021-9be0-886f4cb53349\">\n" +
" <bpmn2:incoming>Flow_18goqkp</bpmn2:incoming>\n" +
" <bpmn2:outgoing>Flow_120d9e6e-1b95-4f70-8cc7-c0c969776098</bpmn2:outgoing>\n" +
" <bpmn2:outgoing>Flow_e593b679-77d1-4c88-8265-e9dffb30006d</bpmn2:outgoing>\n" +
" </bpmn2:exclusiveGateway>\n" +
" <bpmn2:sequenceFlow id=\"Flow_18goqkp\" " +
"sourceRef=\"Activity_4a50b9c8-2a74-4fff-9376-7b5a0bf5a680\" " +
"targetRef=\"Gateway_d7c6c303-7b23-4021-9be0-886f4cb53349\" />\n" +
" <bpmn2:sequenceFlow id=\"Flow_120d9e6e-1b95-4f70-8cc7-c0c969776098\" " +
"sourceRef=\"Gateway_d7c6c303-7b23-4021-9be0-886f4cb53349\" " +
"targetRef=\"Activity_fe37dde6-44c1-4a50-8bd2-b32962ccfcb5\">\n" +
" <bpmn2:conditionExpression xsi:type=\"bpmn2:tFormalExpression\"><![CDATA[${handlingOpinion " +
"== 0}]]></bpmn2:conditionExpression>\n" +
" </bpmn2:sequenceFlow>\n" +
" <bpmn2:endEvent id=\"Event_40112390-cfe6-4853-96f3-bdf703e77f31\" name=\"结束\">\n" +
" <bpmn2:incoming>Flow_166w58n</bpmn2:incoming>\n" +
" <bpmn2:incoming>Flow_e593b679-77d1-4c88-8265-e9dffb30006d</bpmn2:incoming>\n" +
" </bpmn2:endEvent>\n" + " </bpmn2:endEvent>\n" +
" <bpmn2:sequenceFlow id=\"Flow_01cdmlh\" " + " <bpmn2:sequenceFlow id=\"Flow_166w58n\" " +
"sourceRef=\"Activity_305965ea-f523-4891-a0e1-9024412c83b3\" " + "sourceRef=\"Activity_fe37dde6-44c1-4a50-8bd2-b32962ccfcb5\" " +
"targetRef=\"Event_1790b5c6-cb47-4193-8ffa-c721812850cf\" />\n" + "targetRef=\"Event_40112390-cfe6-4853-96f3-bdf703e77f31\" />\n" +
" <bpmn2:sequenceFlow id=\"Flow_0mknr4h\" " + " <bpmn2:sequenceFlow id=\"Flow_e593b679-77d1-4c88-8265-e9dffb30006d\" " +
"sourceRef=\"StartEvent_30cf7590-b7a4-4b17-ab9b-e1d1af577c77\" " + "sourceRef=\"Gateway_d7c6c303-7b23-4021-9be0-886f4cb53349\" " +
"targetRef=\"Activity_9ce9cc86-6a7d-48a7-833d-72a1bcb526b1\" />\n" + "targetRef=\"Event_40112390-cfe6-4853-96f3-bdf703e77f31\">\n" +
" <bpmn2:sequenceFlow id=\"Flow_0is5s56\" " + " <bpmn2:conditionExpression xsi:type=\"bpmn2:tFormalExpression\"><![CDATA[${handlingOpinion " +
"sourceRef=\"Activity_9ce9cc86-6a7d-48a7-833d-72a1bcb526b1\" " + "== 1}]]></bpmn2:conditionExpression>\n" +
"targetRef=\"Activity_305965ea-f523-4891-a0e1-9024412c83b3\" />\n" + " </bpmn2:sequenceFlow>\n" +
" <bpmn2:userTask id=\"Activity_9ce9cc86-6a7d-48a7-833d-72a1bcb526b1\" name=\"2\">\n" + " <bpmn2:userTask id=\"Activity_f69a408f-6814-49c9-b6d8-3024c92a12ec\" name=\"1\" " +
" <bpmn2:incoming>Flow_0mknr4h</bpmn2:incoming>\n" + "flowable:candidateUsers=\"0,1,2\">\n" +
" <bpmn2:outgoing>Flow_0is5s56</bpmn2:outgoing>\n" + " <bpmn2:incoming>Flow_1t7jvmu</bpmn2:incoming>\n" +
" <bpmn2:outgoing>Flow_1ke0rj0</bpmn2:outgoing>\n" +
" </bpmn2:userTask>\n" +
" <bpmn2:userTask id=\"Activity_4a50b9c8-2a74-4fff-9376-7b5a0bf5a680\" name=\"2\" " +
"flowable:candidateGroups=\"department_1\">\n" +
" <bpmn2:incoming>Flow_1ke0rj0</bpmn2:incoming>\n" +
" <bpmn2:outgoing>Flow_18goqkp</bpmn2:outgoing>\n" +
" </bpmn2:userTask>\n" + " </bpmn2:userTask>\n" +
" <bpmn2:userTask id=\"Activity_305965ea-f523-4891-a0e1-9024412c83b3\" name=\"3\">\n" + " <bpmn2:userTask id=\"Activity_fe37dde6-44c1-4a50-8bd2-b32962ccfcb5\" name=\"3\" " +
" <bpmn2:incoming>Flow_0is5s56</bpmn2:incoming>\n" + "flowable:candidateUsers=\"6\">\n" +
" <bpmn2:outgoing>Flow_01cdmlh</bpmn2:outgoing>\n" + " <bpmn2:incoming>Flow_120d9e6e-1b95-4f70-8cc7-c0c969776098</bpmn2:incoming>\n" +
" <bpmn2:outgoing>Flow_166w58n</bpmn2:outgoing>\n" +
" </bpmn2:userTask>\n" + " </bpmn2:userTask>\n" +
" </bpmn2:process>\n" + " </bpmn2:process>\n" +
" <bpmndi:BPMNDiagram id=\"BPMNDiagram_1\">\n" + " <bpmndi:BPMNDiagram id=\"BPMNDiagram_1\">\n" +
" <bpmndi:BPMNPlane id=\"BPMNPlane_1\" " + " <bpmndi:BPMNPlane id=\"BPMNPlane_1\" " +
"bpmnElement=\"processId_8b17c25a-db3c-4392-bc3c-c4d3e6af8ba8\">\n" + "bpmnElement=\"processId_a3b266fc-0359-4cde-8215-98f9a9797c22\">\n" +
" <bpmndi:BPMNEdge id=\"Flow_01cdmlh_di\" bpmnElement=\"Flow_01cdmlh\">\n" + " <bpmndi:BPMNEdge id=\"Flow_1t7jvmu_di\" bpmnElement=\"Flow_1t7jvmu\">\n" +
" <di:waypoint x=\"510\" y=\"178\" />\n" +
" <di:waypoint x=\"562\" y=\"178\" />\n" +
" </bpmndi:BPMNEdge>\n" +
" <bpmndi:BPMNEdge id=\"Flow_0mknr4h_di\" bpmnElement=\"Flow_0mknr4h\">\n" +
" <di:waypoint x=\"196\" y=\"178\" />\n" + " <di:waypoint x=\"196\" y=\"178\" />\n" +
" <di:waypoint x=\"250\" y=\"178\" />\n" + " <di:waypoint x=\"250\" y=\"178\" />\n" +
" </bpmndi:BPMNEdge>\n" + " </bpmndi:BPMNEdge>\n" +
" <bpmndi:BPMNEdge id=\"Flow_0is5s56_di\" bpmnElement=\"Flow_0is5s56\">\n" + " <bpmndi:BPMNEdge id=\"Flow_1ke0rj0_di\" bpmnElement=\"Flow_1ke0rj0\">\n" +
" <di:waypoint x=\"350\" y=\"178\" />\n" + " <di:waypoint x=\"350\" y=\"178\" />\n" +
" <di:waypoint x=\"410\" y=\"178\" />\n" + " <di:waypoint x=\"410\" y=\"178\" />\n" +
" </bpmndi:BPMNEdge>\n" + " </bpmndi:BPMNEdge>\n" +
" <bpmndi:BPMNEdge id=\"Flow_18goqkp_di\" bpmnElement=\"Flow_18goqkp\">\n" +
" <di:waypoint x=\"510\" y=\"178\" />\n" +
" <di:waypoint x=\"575\" y=\"178\" />\n" +
" </bpmndi:BPMNEdge>\n" +
" <bpmndi:BPMNEdge id=\"Flow_0t6e45t_di\" " +
"bpmnElement=\"Flow_120d9e6e-1b95-4f70-8cc7-c0c969776098\">\n" +
" <di:waypoint x=\"600\" y=\"203\" />\n" +
" <di:waypoint x=\"600\" y=\"370\" />\n" +
" <di:waypoint x=\"650\" y=\"370\" />\n" +
" </bpmndi:BPMNEdge>\n" +
" <bpmndi:BPMNEdge id=\"Flow_166w58n_di\" bpmnElement=\"Flow_166w58n\">\n" +
" <di:waypoint x=\"750\" y=\"370\" />\n" +
" <di:waypoint x=\"806\" y=\"370\" />\n" +
" <di:waypoint x=\"806\" y=\"178\" />\n" +
" <di:waypoint x=\"862\" y=\"178\" />\n" +
" </bpmndi:BPMNEdge>\n" +
" <bpmndi:BPMNEdge id=\"Flow_1fwrst6_di\" " +
"bpmnElement=\"Flow_e593b679-77d1-4c88-8265-e9dffb30006d\">\n" +
" <di:waypoint x=\"625\" y=\"178\" />\n" +
" <di:waypoint x=\"862\" y=\"178\" />\n" +
" </bpmndi:BPMNEdge>\n" +
" <bpmndi:BPMNShape id=\"_BPMNShape_StartEvent_2\" " + " <bpmndi:BPMNShape id=\"_BPMNShape_StartEvent_2\" " +
"bpmnElement=\"StartEvent_30cf7590-b7a4-4b17-ab9b-e1d1af577c77\">\n" + "bpmnElement=\"StartEvent_11cf0b84-8cf7-4984-b029-2bc2d443be7f\">\n" +
" <dc:Bounds x=\"160\" y=\"160\" width=\"36\" height=\"36\" />\n" + " <dc:Bounds x=\"160\" y=\"160\" width=\"36\" height=\"36\" />\n" +
" <bpmndi:BPMNLabel>\n" + " <bpmndi:BPMNLabel>\n" +
" <dc:Bounds x=\"175\" y=\"203\" width=\"7\" height=\"14\" />\n" + " <dc:Bounds x=\"167\" y=\"203\" width=\"22\" height=\"14\" />\n" +
" </bpmndi:BPMNLabel>\n" + " </bpmndi:BPMNLabel>\n" +
" </bpmndi:BPMNShape>\n" + " </bpmndi:BPMNShape>\n" +
" <bpmndi:BPMNShape id=\"Event_0blwxcq_di\" " + " <bpmndi:BPMNShape id=\"Gateway_1vn7rsw_di\" " +
"bpmnElement=\"Event_1790b5c6-cb47-4193-8ffa-c721812850cf\">\n" + "bpmnElement=\"Gateway_d7c6c303-7b23-4021-9be0-886f4cb53349\" isMarkerVisible=\"true\">\n" +
" <dc:Bounds x=\"562\" y=\"160\" width=\"36\" height=\"36\" />\n" + " <dc:Bounds x=\"575\" y=\"153\" width=\"50\" height=\"50\" />\n" +
" </bpmndi:BPMNShape>\n" +
" <bpmndi:BPMNShape id=\"Event_1iat3a3_di\" " +
"bpmnElement=\"Event_40112390-cfe6-4853-96f3-bdf703e77f31\">\n" +
" <dc:Bounds x=\"862\" y=\"160\" width=\"36\" height=\"36\" />\n" +
" <bpmndi:BPMNLabel>\n" + " <bpmndi:BPMNLabel>\n" +
" <dc:Bounds x=\"577\" y=\"203\" width=\"7\" height=\"14\" />\n" + " <dc:Bounds x=\"869\" y=\"203\" width=\"22\" height=\"14\" />\n" +
" </bpmndi:BPMNLabel>\n" + " </bpmndi:BPMNLabel>\n" +
" </bpmndi:BPMNShape>\n" + " </bpmndi:BPMNShape>\n" +
" <bpmndi:BPMNShape id=\"Activity_05096b4_di\" " + " <bpmndi:BPMNShape id=\"Activity_0ll4t0b_di\" " +
"bpmnElement=\"Activity_9ce9cc86-6a7d-48a7-833d-72a1bcb526b1\">\n" + "bpmnElement=\"Activity_f69a408f-6814-49c9-b6d8-3024c92a12ec\">\n" +
" <dc:Bounds x=\"250\" y=\"138\" width=\"100\" height=\"80\" />\n" +
" </bpmndi:BPMNShape>\n" +
" <bpmndi:BPMNShape id=\"Activity_1iwz5sx_di\" " +
"bpmnElement=\"Activity_305965ea-f523-4891-a0e1-9024412c83b3\">\n" +
" <dc:Bounds x=\"410\" y=\"138\" width=\"100\" height=\"80\" />\n" +
" </bpmndi:BPMNShape>\n" +
"<bpmn2:definitions xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:bpmn2=\"http://www.omg.org/spec/BPMN/20100524/MODEL\" xmlns:bpmndi=\"http://www.omg.org/spec/BPMN/20100524/DI\" xmlns:dc=\"http://www.omg.org/spec/DD/20100524/DC\" xmlns:di=\"http://www.omg.org/spec/DD/20100524/DI\" xmlns:flowable=\"http://flowable.org/bpmn\" targetNamespace=\"http://bpmn.io/schema/bpmn\">\n" +
" <bpmn2:process id=\"processId_26246e2b-2f1a-46a5-b2f1-f3df8109d06b\" name=\"测试流程1\" isExecutable=\"true\">\n" +
" <bpmn2:documentation>这是一个测试流程1</bpmn2:documentation>\n" +
" <bpmn2:startEvent id=\"StartEvent_38617d3f-09e7-4342-aa7a-49e89189d4d2\">\n" +
" <bpmn2:outgoing>Flow_1jxsm3b</bpmn2:outgoing>\n" +
" </bpmn2:startEvent>\n" +
" <bpmn2:sequenceFlow id=\"Flow_1jxsm3b\" sourceRef=\"StartEvent_38617d3f-09e7-4342-aa7a-49e89189d4d2\" targetRef=\"Activity_b4c5faae-2078-4c24-8e8c-d8fae56c2136\" />\n" +
" <bpmn2:sequenceFlow id=\"Flow_1xfelj7\" sourceRef=\"Activity_b4c5faae-2078-4c24-8e8c-d8fae56c2136\" targetRef=\"Activity_32aa4df7-1f13-439d-a3f9-58c3d01ef9f9\" />\n" +
" <bpmn2:userTask id=\"Activity_b4c5faae-2078-4c24-8e8c-d8fae56c2136\" name=\"人工节点1\" flowable:assignee=\"zhangsan\">\n" +
" <bpmn2:incoming>Flow_1jxsm3b</bpmn2:incoming>\n" +
" <bpmn2:outgoing>Flow_1xfelj7</bpmn2:outgoing>\n" +
" </bpmn2:userTask>\n" +
" <bpmn2:userTask id=\"Activity_32aa4df7-1f13-439d-a3f9-58c3d01ef9f9\" name=\"人工节点2\" flowable:assignee=\"lisi\">\n" +
" <bpmn2:incoming>Flow_1xfelj7</bpmn2:incoming>\n" +
" <bpmn2:outgoing>Flow_0n5k9bw</bpmn2:outgoing>\n" +
" </bpmn2:userTask>\n" +
" <bpmn2:endEvent id=\"Event_5835a2ee-d2ae-43c5-9d4a-7d8c9dff0dea\">\n" +
" <bpmn2:incoming>Flow_0n5k9bw</bpmn2:incoming>\n" +
" </bpmn2:endEvent>\n" +
" <bpmn2:sequenceFlow id=\"Flow_0n5k9bw\" sourceRef=\"Activity_32aa4df7-1f13-439d-a3f9-58c3d01ef9f9\" targetRef=\"Event_5835a2ee-d2ae-43c5-9d4a-7d8c9dff0dea\" />\n" +
" </bpmn2:process>\n" +
" <bpmndi:BPMNDiagram id=\"BPMNDiagram_1\">\n" +
" <bpmndi:BPMNPlane id=\"BPMNPlane_1\" bpmnElement=\"processId_26246e2b-2f1a-46a5-b2f1-f3df8109d06b\">\n" +
" <bpmndi:BPMNEdge id=\"Flow_1jxsm3b_di\" bpmnElement=\"Flow_1jxsm3b\">\n" +
" <di:waypoint x=\"196\" y=\"178\" />\n" +
" <di:waypoint x=\"250\" y=\"178\" />\n" +
" </bpmndi:BPMNEdge>\n" +
" <bpmndi:BPMNEdge id=\"Flow_1xfelj7_di\" bpmnElement=\"Flow_1xfelj7\">\n" +
" <di:waypoint x=\"350\" y=\"178\" />\n" +
" <di:waypoint x=\"410\" y=\"178\" />\n" +
" </bpmndi:BPMNEdge>\n" +
" <bpmndi:BPMNEdge id=\"Flow_0n5k9bw_di\" bpmnElement=\"Flow_0n5k9bw\">\n" +
" <di:waypoint x=\"510\" y=\"178\" />\n" +
" <di:waypoint x=\"572\" y=\"178\" />\n" +
" </bpmndi:BPMNEdge>\n" +
" <bpmndi:BPMNShape id=\"_BPMNShape_StartEvent_2\" bpmnElement=\"StartEvent_38617d3f-09e7-4342-aa7a-49e89189d4d2\">\n" +
" <dc:Bounds x=\"160\" y=\"160\" width=\"36\" height=\"36\" />\n" +
" </bpmndi:BPMNShape>\n" +
" <bpmndi:BPMNShape id=\"Activity_051mk34_di\" bpmnElement=\"Activity_b4c5faae-2078-4c24-8e8c-d8fae56c2136\">\n" +
" <dc:Bounds x=\"250\" y=\"138\" width=\"100\" height=\"80\" />\n" + " <dc:Bounds x=\"250\" y=\"138\" width=\"100\" height=\"80\" />\n" +
" </bpmndi:BPMNShape>\n" + " </bpmndi:BPMNShape>\n" +
" <bpmndi:BPMNShape id=\"Activity_0audtcs_di\" bpmnElement=\"Activity_32aa4df7-1f13-439d-a3f9-58c3d01ef9f9\">\n" + " <bpmndi:BPMNShape id=\"Activity_1vv2tlo_di\" " +
"bpmnElement=\"Activity_4a50b9c8-2a74-4fff-9376-7b5a0bf5a680\">\n" +
" <dc:Bounds x=\"410\" y=\"138\" width=\"100\" height=\"80\" />\n" + " <dc:Bounds x=\"410\" y=\"138\" width=\"100\" height=\"80\" />\n" +
" </bpmndi:BPMNShape>\n" + " </bpmndi:BPMNShape>\n" +
" <bpmndi:BPMNShape id=\"Event_181nibi_di\" bpmnElement=\"Event_5835a2ee-d2ae-43c5-9d4a-7d8c9dff0dea\">\n" + " <bpmndi:BPMNShape id=\"Activity_0t2an3h_di\" " +
" <dc:Bounds x=\"572\" y=\"160\" width=\"36\" height=\"36\" />\n" + "bpmnElement=\"Activity_fe37dde6-44c1-4a50-8bd2-b32962ccfcb5\">\n" +
" <dc:Bounds x=\"650\" y=\"330\" width=\"100\" height=\"80\" />\n" +
" </bpmndi:BPMNShape>\n" + " </bpmndi:BPMNShape>\n" +
" </bpmndi:BPMNPlane>\n" + " </bpmndi:BPMNPlane>\n" +
" </bpmndi:BPMNDiagram>\n" + " </bpmndi:BPMNDiagram>\n" +
"</bpmn2:definitions>\n"; "</bpmn2:definitions>\n";
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("fileXml",xml); jsonObject.put("fileXml",xml);
jsonObject.put("flowKey","processId_26246e2b-2f1a-46a5-b2f1-f3df8109d06b"); jsonObject.put("flowKey","processId_fb773ab4-4d09-4f9f-b1d1-2cdb3805d02b");
jsonObject.put("flowName","测试流程1"); jsonObject.put("flowName","第一次完整的测试");
request = post("/flowsInfo/saveXml/") request = post("/flowsInfo/saveXml/")
.contentType(MediaType.APPLICATION_JSON) .contentType(MediaType.APPLICATION_JSON)
...@@ -190,10 +335,8 @@ class WorkflowCoreApplicationTests_workflow { ...@@ -190,10 +335,8 @@ class WorkflowCoreApplicationTests_workflow {
void startFlow() throws Exception { void startFlow() throws Exception {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("flowKey","processId_26246e2b-2f1a-46a5-b2f1-f3df8109d06b"); jsonObject.put("flowKey","processId_1");
JSONObject jsonObject1 = new JSONObject(); JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("handlingOpinion","0");
JSONObject jsonObject2 = new JSONObject(); JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("id","5"); jsonObject2.put("id","5");
jsonObject2.put("userName","张三"); jsonObject2.put("userName","张三");
...@@ -209,22 +352,20 @@ class WorkflowCoreApplicationTests_workflow { ...@@ -209,22 +352,20 @@ class WorkflowCoreApplicationTests_workflow {
// 设置返回值类型为utf-8,否则默认为ISO-8859-1 // 设置返回值类型为utf-8,否则默认为ISO-8859-1
.accept(MediaType.APPLICATION_JSON_UTF8_VALUE); .accept(MediaType.APPLICATION_JSON_UTF8_VALUE);
mockMvc.perform(request).andExpect(status().isOk()) mockMvc.perform(request).andExpect(status().isOk())
.andExpect(content().string(not(""))) //条件
// .andExpect(content().string(not(""))) //条件 // .andExpect(content().string(not(""))) //条件
.andExpect(content().string(not("[]"))) .andExpect(content().string(not("[]")))
.andDo(print());//打印输出结果 .andDo(print());//打印输出结果
} }
@Test @Test
//查询代办 //查询代办
//开启流程
void findUserTask() throws Exception { void findUserTask() throws Exception {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("userId","zhangsan"); jsonObject.put("userId","0");
request = post("/workFlow/findUserTask/") request = post("/workFlow/findUserTask/")
.contentType(MediaType.APPLICATION_JSON) .contentType(MediaType.APPLICATION_JSON)
.content(jsonObject.toJSONString()) .content(jsonObject.toJSONString())
// .param("userId","zhangsan")//参数 // .param("userId","0")//参数
// 设置返回值类型为utf-8,否则默认为ISO-8859-1 // 设置返回值类型为utf-8,否则默认为ISO-8859-1
.accept(MediaType.APPLICATION_JSON_UTF8_VALUE); .accept(MediaType.APPLICATION_JSON_UTF8_VALUE);
mockMvc.perform(request).andExpect(status().isOk()) mockMvc.perform(request).andExpect(status().isOk())
...@@ -235,14 +376,14 @@ class WorkflowCoreApplicationTests_workflow { ...@@ -235,14 +376,14 @@ class WorkflowCoreApplicationTests_workflow {
} }
@Test @Test
//查询代办 //查询代办详情
void findUserTaskDetail() throws Exception { void findUserTaskDetail() throws Exception {
// JSONObject jsonObject = new JSONObject(); // JSONObject jsonObject = new JSONObject();
// jsonObject.put("taskId","2563cd2d-8c72-11eb-9463-005056c00001"); // jsonObject.put("taskId","2563cd2d-8c72-11eb-9463-005056c00001");
request = get("/workFlow/findTaskDetail/") request = get(URI.create("/workFlow/findUserTask/"))
.contentType(MediaType.APPLICATION_JSON) .contentType(MediaType.APPLICATION_JSON)
.param("taskId","2563cd2d-8c72-11eb-9463-005056c00001")//参数 .param("taskId","8d1f5032-9068-11eb-a31d-005056c00008")//参数
// 设置返回值类型为utf-8,否则默认为ISO-8859-1 // 设置返回值类型为utf-8,否则默认为ISO-8859-1
.accept(MediaType.APPLICATION_JSON_UTF8_VALUE); .accept(MediaType.APPLICATION_JSON_UTF8_VALUE);
mockMvc.perform(request).andExpect(status().isOk()) mockMvc.perform(request).andExpect(status().isOk())
...@@ -251,16 +392,101 @@ class WorkflowCoreApplicationTests_workflow { ...@@ -251,16 +392,101 @@ class WorkflowCoreApplicationTests_workflow {
.andDo(print());//打印输出结果 .andDo(print());//打印输出结果
} }
@Test @Test //完成任务
void complteTask() throws Exception { void complteTask() throws Exception {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("userId","1"); JSONObject jsonMap = new JSONObject();
jsonMap.put("id",1);
jsonMap.put("userName","李四");
jsonObject.put("workFlowUser",jsonMap);
jsonObject.put("handlingOpinion",0); jsonObject.put("handlingOpinion",0);
request = get("/workFlow/completeTask/") jsonObject.put("taskId","ee5382fd-9130-11eb-9913-005056c00008");
request = post("/workFlow/completeTask/")
.contentType(MediaType.APPLICATION_JSON)
.content(jsonObject.toJSONString())
// 设置返回值类型为utf-8,否则默认为ISO-8859-1
.accept(MediaType.APPLICATION_JSON_UTF8_VALUE);
mockMvc.perform(request).andExpect(status().isOk())
.andExpect(content().string(not(""))) //条件
// .andExpect(content().string(not("[]")))
.andDo(print());//打印输出结果
}
@Test //查询所有流程
void getAllFlows() throws Exception {
JSONObject jsonObject = new JSONObject();
request = post("/flowsInfo/searchFlowInfo/")
.contentType(MediaType.APPLICATION_JSON)
.content(jsonObject.toJSONString())
// 设置返回值类型为utf-8,否则默认为ISO-8859-1
.accept(MediaType.APPLICATION_JSON_UTF8_VALUE);
mockMvc.perform(request).andExpect(status().isOk())
.andExpect(content().string(not(""))) //条件
// .andExpect(content().string(not("[]")))
.andDo(print());//打印输出结果
}
@Test //创建流程
void createFlow() throws Exception {
JSONObject jsonObject = new JSONObject();
jsonObject.put("flowName","我的测试");
jsonObject.put("flowDescribe","这是我的测试");
request = post("/flowsInfo/createFlow/")
.contentType(MediaType.APPLICATION_JSON)
.content(jsonObject.toJSONString())
// 设置返回值类型为utf-8,否则默认为ISO-8859-1
.accept(MediaType.APPLICATION_JSON_UTF8_VALUE);
mockMvc.perform(request).andExpect(status().isOk())
.andExpect(content().string(not(""))) //条件
// .andExpect(content().string(not("[]")))
.andDo(print());//打印输出结果
}
@Test //编辑流程
void editFlow() throws Exception {
request = get("/flowsInfo/editFlow/")
.contentType(MediaType.APPLICATION_JSON)
.param("id","4")
// 设置返回值类型为utf-8,否则默认为ISO-8859-1
.accept(MediaType.APPLICATION_JSON_UTF8_VALUE);
mockMvc.perform(request).andExpect(status().isOk())
.andExpect(content().string(not(""))) //条件
// .andExpect(content().string(not("[]")))
.andDo(print());//打印输出结果
}
@Test //通过流程名称修改
void editByName() throws Exception {
JSONObject jsonObject = new JSONObject();
jsonObject.put("flowName","我的测试1");
request = post("/flowsInfo/updateByProcessName/")
.contentType(MediaType.APPLICATION_JSON)
// .param("id","4")
.content(jsonObject.toJSONString())
// 设置返回值类型为utf-8,否则默认为ISO-8859-1
.accept(MediaType.APPLICATION_JSON_UTF8_VALUE);
mockMvc.perform(request).andExpect(status().isOk())
.andExpect(content().string(not(""))) //条件
// .andExpect(content().string(not("[]")))
.andDo(print());//打印输出结果
}
@Test //通过流程描述修改
void editByDesc() throws Exception {
JSONObject jsonObject = new JSONObject();
jsonObject.put("flowDescribe","这是我的测试1");
request = post("/flowsInfo/updateByDesc/")
.contentType(MediaType.APPLICATION_JSON) .contentType(MediaType.APPLICATION_JSON)
.content(jsonObject.toJSONString()) .content(jsonObject.toJSONString())
// .param("taskId","2563cd2d-8c72-11eb-9463-005056c00001")//参数
// 设置返回值类型为utf-8,否则默认为ISO-8859-1 // 设置返回值类型为utf-8,否则默认为ISO-8859-1
.accept(MediaType.APPLICATION_JSON_UTF8_VALUE); .accept(MediaType.APPLICATION_JSON_UTF8_VALUE);
mockMvc.perform(request).andExpect(status().isOk()) mockMvc.perform(request).andExpect(status().isOk())
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论