提交 62c2ba5f authored 作者: zhoushaopan's avatar zhoushaopan

[工作流模块] 新增了可发起流程接口

上级 88e09b00
...@@ -3,11 +3,8 @@ package com.tykj.workflowcore.workflow_editer.controller; ...@@ -3,11 +3,8 @@ 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.workflow_editer.entity.FlowsInfo; import com.tykj.workflowcore.workflow_editer.entity.FlowsInfo;
import com.tykj.workflowcore.workflow_editer.entity.VariableStorage; import com.tykj.workflowcore.workflow_editer.entity.VariableStorage;
import com.tykj.workflowcore.workflow_editer.entity.vo.SearchFlowInfoVo; import com.tykj.workflowcore.workflow_editer.entity.vo.*;
import com.tykj.workflowcore.workflow_editer.entity.vo.SearchVariableStorageVo;
import com.tykj.workflowcore.workflow_editer.entity.vo.VariableStorageVo;
import com.tykj.workflowcore.workflow_editer.service.*; import com.tykj.workflowcore.workflow_editer.service.*;
import com.tykj.workflowcore.workflow_editer.entity.vo.FlowsInfoVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -46,11 +43,18 @@ public class FlowsInfoController { ...@@ -46,11 +43,18 @@ public class FlowsInfoController {
private VariableStorageService variableStorageService; private VariableStorageService variableStorageService;
@PostMapping("/searchAllFlowInfo")
@ApiOperation(value = "查询所有流程信息")
public Page<FlowsInfo> searchAllFlowInfo(@RequestBody SearchAllFlowInfoVo searchAllFlowInfoVo){
return flowInfoService.searchAllFlowInfo(searchAllFlowInfoVo);
}
@PostMapping("/searchFlowInfo") @PostMapping("/searchFlowInfo")
@ApiOperation(value = "查询流程信息") @ApiOperation(value = "查询可发起流程信息")
public ResponseEntity searchFlowInfo(@RequestBody SearchFlowInfoVo searchFlowInfoVo){ public Page<FlowsInfo> searchFlowInfo(@RequestBody SearchFlowInfoVo searchFlowInfoVo){
Page<FlowsInfo> flowsInfoList = flowInfoService.searchFlowInfo(searchFlowInfoVo);
return ResultUtil.success(flowsInfoList,"查询成功"); return flowInfoService.searchFlowInfo(searchFlowInfoVo);
} }
@PostMapping("/upLoadFile") @PostMapping("/upLoadFile")
......
...@@ -33,9 +33,9 @@ public class WorkFlowController { ...@@ -33,9 +33,9 @@ public class WorkFlowController {
@PostMapping("/startFlow") @PostMapping("/startFlow")
@ApiOperation("开启流程") @ApiOperation("开启流程")
public String startFlow(@RequestBody StartFlowVo startFlowVo){ public ResponseEntity startFlow(@RequestBody StartFlowVo startFlowVo){
workFlowService.startFlow(startFlowVo); workFlowService.startFlow(startFlowVo);
return null; return ResultUtil.success("流程开启成功");
} }
@PostMapping("/findUserTask") @PostMapping("/findUserTask")
......
...@@ -33,4 +33,5 @@ public interface FlowsInfoMapper extends JpaRepository<FlowsInfo,Integer>, JpaSp ...@@ -33,4 +33,5 @@ public interface FlowsInfoMapper extends JpaRepository<FlowsInfo,Integer>, JpaSp
* @return * @return
*/ */
FlowsInfo findByProcessInstanceId(String processInstanceId); FlowsInfo findByProcessInstanceId(String processInstanceId);
} }
...@@ -62,7 +62,7 @@ public class FlowsInfo extends BaseEntity { ...@@ -62,7 +62,7 @@ public class FlowsInfo extends BaseEntity {
private String startId; private String startId;
@ApiModelProperty("开始节点的id") @ApiModelProperty("开始节点的id")
private String startPageId; private Integer startPageId;
@ApiModelProperty("流程实例id") @ApiModelProperty("流程实例id")
private String processInstanceId; private String processInstanceId;
......
...@@ -54,6 +54,7 @@ public class FormPage extends BaseEntity { ...@@ -54,6 +54,7 @@ public class FormPage extends BaseEntity {
private String css; private String css;
@ApiModelProperty("json描述文件") @ApiModelProperty("json描述文件")
@Lob
private String descFile; private String descFile;
@ApiModelProperty("实体类id") @ApiModelProperty("实体类id")
......
...@@ -39,23 +39,23 @@ public class NodeInfo extends BaseEntity { ...@@ -39,23 +39,23 @@ public class NodeInfo extends BaseEntity {
@ApiModelProperty("流程名") @ApiModelProperty("流程名")
private String flowName; private String flowName;
@ApiModelProperty("候选人类型") // @ApiModelProperty("候选人类型")
private String candidateType; // private String candidateType;
//
@ApiModelProperty("候选人显示值") // @ApiModelProperty("候选人显示值")
private String candidateLabel; // private String candidateLabel;
//
@ApiModelProperty("候选人显示值") // @ApiModelProperty("候选人显示值")
private String candidateValue; // private String candidateValue;
//
@ApiModelProperty("0为默认,1为可视,2为公式") // @ApiModelProperty("0为默认,1为可视,2为公式")
private Integer expressionType; // private Integer expressionType;
//
@ApiModelProperty("输入框中的值 例如: 同意,不同意") // @ApiModelProperty("输入框中的值 例如: 同意,不同意")
private Integer expressionValue; // private Integer expressionValue;
//
@ApiModelProperty("连接条件") // @ApiModelProperty("连接条件")
private String expressionConnectionConditions; // private String expressionConnectionConditions;
@ApiModelProperty("判断条件拼接字段 例如:[{'resource':'${people.id}','comparator':'>=','value':'10'}]") @ApiModelProperty("判断条件拼接字段 例如:[{'resource':'${people.id}','comparator':'>=','value':'10'}]")
private String expressionCondition; private String expressionCondition;
......
...@@ -52,6 +52,7 @@ public class FormPageVo { ...@@ -52,6 +52,7 @@ public class FormPageVo {
private Date updateTime; private Date updateTime;
@ApiModelProperty("json描述文件") @ApiModelProperty("json描述文件")
@Lob
private String descFile; private String descFile;
@ApiModelProperty("实体类") @ApiModelProperty("实体类")
......
...@@ -18,7 +18,7 @@ import lombok.NoArgsConstructor; ...@@ -18,7 +18,7 @@ import lombok.NoArgsConstructor;
public class SearchFlowInfoVo extends JpaCustomPage { public class SearchFlowInfoVo extends JpaCustomPage {
@ApiModelProperty(value = "状态",notes = "0 可用,1 暂停") @ApiModelProperty(value = "状态",notes = "0 可用,1 暂停")
private Integer state; private Integer state = 0;
@ApiModelProperty("流程名称") @ApiModelProperty("流程名称")
private String flowName; private String flowName;
......
...@@ -39,6 +39,6 @@ public class TaskVo { ...@@ -39,6 +39,6 @@ public class TaskVo {
private Map<String,Object> map; private Map<String,Object> map;
@ApiModelProperty("条件表达式") // @ApiModelProperty("条件表达式")
private String conditionalExpression; // private String conditionalExpression;
} }
package com.tykj.workflowcore.workflow_editer.enums;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
/**
* ClassName: TypeEnums
* Package: com.tykj
* Description:
* Datetime: 2021/3/2 19:46
*
* @Author: zsp
*/
@AllArgsConstructor
@NoArgsConstructor
public enum TypeEnums {
AGREE("同意",0),
REFUSE("拒绝",1),
TRANSFER("转交",2);
private String name;
private int index;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
}
package com.tykj.workflowcore.workflow_editer.service; package com.tykj.workflowcore.workflow_editer.service;
import com.tykj.workflowcore.workflow_editer.entity.FlowsInfo; import com.tykj.workflowcore.workflow_editer.entity.FlowsInfo;
import com.tykj.workflowcore.workflow_editer.entity.vo.SearchAllFlowInfoVo;
import com.tykj.workflowcore.workflow_editer.entity.vo.SearchFlowInfoVo; import com.tykj.workflowcore.workflow_editer.entity.vo.SearchFlowInfoVo;
import com.tykj.workflowcore.workflow_editer.entity.vo.FlowsInfoVo; import com.tykj.workflowcore.workflow_editer.entity.vo.FlowsInfoVo;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
...@@ -58,6 +59,13 @@ public interface FlowInfoService { ...@@ -58,6 +59,13 @@ public interface FlowInfoService {
*/ */
FlowsInfo disableFlow(Integer flowInfoId); FlowsInfo disableFlow(Integer flowInfoId);
/**
* 有条件的查询flowInfo
* @param searchAllFlowInfoVo
* @return
*/
Page<FlowsInfo> searchAllFlowInfo(SearchAllFlowInfoVo searchAllFlowInfoVo);
/** /**
* 有条件的查询flowInfo * 有条件的查询flowInfo
* @param searchFlowInfoVo * @param searchFlowInfoVo
......
...@@ -4,6 +4,7 @@ import com.github.wenhao.jpa.PredicateBuilder; ...@@ -4,6 +4,7 @@ import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications; import com.github.wenhao.jpa.Specifications;
import com.tykj.workflowcore.base.result.ApiException; import com.tykj.workflowcore.base.result.ApiException;
import com.tykj.workflowcore.workflow_editer.entity.FlowsInfo; import com.tykj.workflowcore.workflow_editer.entity.FlowsInfo;
import com.tykj.workflowcore.workflow_editer.entity.vo.SearchAllFlowInfoVo;
import com.tykj.workflowcore.workflow_editer.entity.vo.SearchFlowInfoVo; import com.tykj.workflowcore.workflow_editer.entity.vo.SearchFlowInfoVo;
import com.tykj.workflowcore.workflow_editer.dao.FlowsInfoMapper; import com.tykj.workflowcore.workflow_editer.dao.FlowsInfoMapper;
import com.tykj.workflowcore.workflow_editer.service.FlowInfoService; import com.tykj.workflowcore.workflow_editer.service.FlowInfoService;
...@@ -80,6 +81,15 @@ public class FlowInfoServiceImpl implements FlowInfoService { ...@@ -80,6 +81,15 @@ public class FlowInfoServiceImpl implements FlowInfoService {
return null; return null;
} }
@Override
public Page<FlowsInfo> searchAllFlowInfo(SearchAllFlowInfoVo searchAllFlowInfoVo) {
PredicateBuilder<FlowsInfo> and = Specifications.and();
and.eq(searchAllFlowInfoVo.getState()!=null,"state",searchAllFlowInfoVo.getState());
and.eq(searchAllFlowInfoVo.getFlowKey()!=null,"flowKey",searchAllFlowInfoVo.getFlowKey());
and.like(searchAllFlowInfoVo.getFlowName()!=null,"flowName","%"+searchAllFlowInfoVo.getFlowName()+"%");
return flowsInfoMapper.findAll(and.build(), searchAllFlowInfoVo.getPageable());
}
@Override @Override
public Page<FlowsInfo> searchFlowInfo(SearchFlowInfoVo searchFlowInfoVo) { public Page<FlowsInfo> searchFlowInfo(SearchFlowInfoVo searchFlowInfoVo) {
PredicateBuilder<FlowsInfo> and = Specifications.and(); PredicateBuilder<FlowsInfo> and = Specifications.and();
......
...@@ -161,8 +161,15 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -161,8 +161,15 @@ public class WorkFlowServiceImpl implements WorkFlowService {
throw new ApiException(null,message.toString()); throw new ApiException(null,message.toString());
}else { }else {
//自动部署 //通过id状态
deployXml(save); Integer state = save.getState();
if(state == 1){
return;
}else {
//自动部署
deployXml(save);
}
} }
} }
...@@ -200,11 +207,14 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -200,11 +207,14 @@ public class WorkFlowServiceImpl implements WorkFlowService {
Authentication.setAuthenticatedUserId(currentUser.getId() + ""); Authentication.setAuthenticatedUserId(currentUser.getId() + "");
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(startFlowVo.getFlowKey(), ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(startFlowVo.getFlowKey(),
startFlowVo.getMap()); startFlowVo.getMap());
//存储流程实例id // 存储流程实例id
//根据flowKey查询出一个FlowInfo // 根据flowKey查询出一个FlowInfo
// FlowsInfo flowsInfo = flowsInfoMapper.findByFlowKey(startFlowVo.getFlowKey()); // FlowsInfo flowsInfo = flowsInfoMapper.findByFlowKey(startFlowVo.getFlowKey());
//开始页面的id
// Integer startPageId = flowsInfo.getStartPageId();
// flowsInfo.setProcessInstanceId(processInstance.getProcessInstanceId()); // flowsInfo.setProcessInstanceId(processInstance.getProcessInstanceId());
// flowsInfoMapper.save(flowsInfo); // flowsInfoMapper.save(flowsInfo);
// return startPageId;
} }
...@@ -233,7 +243,8 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -233,7 +243,8 @@ public class WorkFlowServiceImpl implements WorkFlowService {
//节点id //节点id
String taskDefinitionKey = task.getTaskDefinitionKey(); String taskDefinitionKey = task.getTaskDefinitionKey();
//通过节点id查询出pageId //通过节点id查询出pageId
Integer currentPageId = nodeInfoService.findByNodeId(taskDefinitionKey); // Integer currentPageId = nodeInfoService.findByNodeId(taskDefinitionKey);
String formKey = task.getFormKey();
map.put("taskId", task.getId()); map.put("taskId", task.getId());
map.put("processKey", processInstance.getProcessDefinitionKey()); map.put("processKey", processInstance.getProcessDefinitionKey());
map.put("taskName", task.getName()); map.put("taskName", task.getName());
...@@ -241,7 +252,7 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -241,7 +252,7 @@ public class WorkFlowServiceImpl implements WorkFlowService {
map.put("createTime", task.getCreateTime()); map.put("createTime", task.getCreateTime());
map.put("promoter", processInstance.getStartUserId()); map.put("promoter", processInstance.getStartUserId());
map.put("processInstanceId", processInstance.getId()); map.put("processInstanceId", processInstance.getId());
map.put("currentPageId", currentPageId); map.put("currentPageId", formKey);
listMap.add(map); listMap.add(map);
} }
return listMap; return listMap;
...@@ -336,6 +347,7 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -336,6 +347,7 @@ public class WorkFlowServiceImpl implements WorkFlowService {
repositoryService.activateProcessDefinitionByKey(flowKey, true, new Date()); repositoryService.activateProcessDefinitionByKey(flowKey, true, new Date());
flowsInfo.setState(0); flowsInfo.setState(0);
} }
} else { } else {
throw new ApiException("该流程未编辑流程图无法被启用"); throw new ApiException("该流程未编辑流程图无法被启用");
} }
......
...@@ -16,7 +16,6 @@ import java.util.List; ...@@ -16,7 +16,6 @@ import java.util.List;
* *
* @Author: zsp * @Author: zsp
*/ */
//在部署流程之前需要校验流程中的所有用户任务是否指定办理人
public class UserTaskValidator extends ProcessLevelValidator { public class UserTaskValidator extends ProcessLevelValidator {
@Override @Override
......
spring: spring:
datasource: datasource:
username: root username: root
password: 123456 password: Huang123+
url: jdbc:mysql://localhost:3306/mydata?useSSL=false&serverTimezone=UTC&characterEncoding=utf-8&nullCatalogMeansCurrent=true url: jdbc:mysql://47.106.142.73:3306/www?useSSL=false&serverTimezone=GMT%2b8&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
hibernate: hibernate:
ddl-auto: update ddl-auto: update
jackson:
time-zone: GMT+8
server: server:
port: 8800 port: 8800
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论