Browse Source

完善business的存值和取值

master
yxt_djz 3 years ago
parent
commit
400a530ce1
  1. 26
      anrui-flowable/anrui-flowable-biz/src/main/java/com/yxt/anrui/flowable/biz/flow/FlowableRest.java
  2. 7
      anrui-flowable/anrui-flowable-biz/src/main/java/com/yxt/anrui/flowable/biz/flow/FlowableService.java
  3. 19
      anrui-flowable/anrui-flowable-biz/src/main/java/com/yxt/anrui/flowable/biz/flowtask/FlowTaskService.java

26
anrui-flowable/anrui-flowable-biz/src/main/java/com/yxt/anrui/flowable/biz/flow/FlowableRest.java

@ -183,6 +183,10 @@ public class FlowableRest implements FlowableFeign {
@Override
public ResultBean<UpdateFlowFieldVo> startProcess(BusinessVariables dto) {
ResultBean rb = ResultBean.fireFail();
if (StringUtils.isBlank(dto.getBusinessSid())) {
return rb.setMsg("businessSid 不能为空!");
}
dto.getFormVariables().put("businessSid",dto.getBusinessSid());
String nextNodeUserSids_ = dto.getNextNodeUserSids();
if(StringUtils.isBlank(nextNodeUserSids_)){
ResultBean<String> nextNodeUserSidsOfCreate = getNextNodeUserSidsOfCreate(dto);
@ -214,10 +218,15 @@ public class FlowableRest implements FlowableFeign {
UpdateFlowFieldVo vo = new UpdateFlowFieldVo();
ResultBean rb = ResultBean.fireFail();
Map<String, Object> formVariables = dto.getFormVariables();
String taskId = dto.getTaskId();
if (StringUtils.isBlank(taskId)) {
return rb.setMsg("taskId 不能为空!");
}
if (StringUtils.isBlank(dto.getBusinessSid())) {
return rb.setMsg("businessSid 不能为空!");
}
formVariables.put("businessSid",dto.getBusinessSid());
String nextUserSid = dto.getNextNodeUserSids();
if(StringUtils.isBlank(nextUserSid)){
ResultBean<String> nextNodeUserSidsOfSubmit = getNextNodeUserSidsOfSubmit(dto);
@ -228,7 +237,8 @@ public class FlowableRest implements FlowableFeign {
}
String comment = dto.getComment();
if (StringUtils.isBlank(comment)) {
return rb.setMsg("comment 不能为空!");
comment="";
//return rb.setMsg("comment 不能为空!");
}
String instanceId = dto.getInstanceId();
if (StringUtils.isBlank(instanceId)) {
@ -292,6 +302,10 @@ public class FlowableRest implements FlowableFeign {
@Override
public ResultBean<UpdateFlowFieldVo> revokeProcess(com.yxt.anrui.flowable.api.flowtask.FlowTaskVo fl) {
ResultBean rb = ResultBean.fireFail();
if (StringUtils.isBlank(fl.getBusinessSid())) {
return rb.setMsg("businessSid 不能为空!");
}
fl.getValues().put("businessSid",fl.getBusinessSid());
UpdateFlowFieldVo vo = new UpdateFlowFieldVo();
ResultBean<FlowProcinst> flowProcinstById = flowableService.getFlowProcinstById(fl.getInstanceId());
if(!StringUtils.isBlank(flowProcinstById.getData().getEND_TIME_())){
@ -320,6 +334,12 @@ public class FlowableRest implements FlowableFeign {
public ResultBean<UpdateFlowFieldVo> taskReject(com.yxt.anrui.flowable.api.flowtask.FlowTaskVo fl) {
ResultBean rb = ResultBean.fireFail();
UpdateFlowFieldVo vo = new UpdateFlowFieldVo();
if (StringUtils.isBlank(fl.getBusinessSid())) {
return rb.setMsg("businessSid 不能为空!");
}
fl.getValues().put("businessSid",fl.getBusinessSid());
ResultBean<List<LatestTaskVo>> resultBean = flowtaskService.taskReject(fl);
if (!resultBean.getSuccess()) {
return rb;
@ -342,6 +362,10 @@ public class FlowableRest implements FlowableFeign {
@Override
public ResultBean<UpdateFlowFieldVo> breakProcess(com.yxt.anrui.flowable.api.flowtask.FlowTaskVo fl) {
ResultBean<UpdateFlowFieldVo> rb = ResultBean.fireFail();
if (StringUtils.isBlank(fl.getBusinessSid())) {
return rb.setMsg("businessSid 不能为空!");
}
fl.getValues().put("businessSid",fl.getBusinessSid());
UpdateFlowFieldVo vo = new UpdateFlowFieldVo();
ResultBean<UpdateFlowFieldVo> resultBean = flowableService.breakProcess(fl);
if (!resultBean.getSuccess()) {

7
anrui-flowable/anrui-flowable-biz/src/main/java/com/yxt/anrui/flowable/biz/flow/FlowableService.java

@ -41,12 +41,15 @@ public class FlowableService extends MybatisBaseService<FlowableMapper, Flowable
}
return rb.success().setData(fp);
}
public ResultBean businessStart(BusinessVariables bv) {
public ResultBean businessStart(BusinessVariables bv) {
/* variables.put("procDefId", procDefId);
variables.put("userSid", userSid);*/
/*BusinessVariables bv = BusinessVariables.builder().build();
bv.setFormVariables(variables);*/
if (StringUtils.isBlank(bv.getBusinessSid())) {
return ResultBean.fireFail().setMsg("businessSid 不能为空!");
}
bv.getFormVariables().put("businessSid",bv.getBusinessSid());
ResultBean<FlowTask> rb = flowDefinitionService.businessStart(bv);
if (!rb.getSuccess()) {
return rb;

19
anrui-flowable/anrui-flowable-biz/src/main/java/com/yxt/anrui/flowable/biz/flowtask/FlowTaskService.java

@ -948,6 +948,12 @@ public class FlowTaskService extends MybatisBaseService<FlowTaskMapper, FlowTask
if (taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult().isSuspended()) {
throw new CustomException("任务处于挂起状态");
}
String comment = flowTaskVo.getComment();
if (StringUtils.isBlank(comment)) {
// comment="";
throw new CustomException("comment 不能为空!");
// return rb.setMsg("comment 不能为空!");
}
// 当前任务 task
Task task = taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult();
// 获取流程定义信息
@ -1001,7 +1007,7 @@ public class FlowTaskService extends MybatisBaseService<FlowTaskMapper, FlowTask
}));
// 设置回退意见
for (String currentTaskId : currentTaskIds) {
taskService.addComment(currentTaskId, task.getProcessInstanceId(), FlowComment.REBACK.getType(), flowTaskVo.getComment());
taskService.addComment(currentTaskId, task.getProcessInstanceId(), FlowComment.REBACK.getType(), comment);
}
try {
@ -1418,6 +1424,12 @@ public class FlowTaskService extends MybatisBaseService<FlowTaskMapper, FlowTask
if (task.isSuspended()) {
return new ResultBean().fail().setMsg("任务处于挂起状态");
}
String comment = flowTaskVo.getComment();
if (StringUtils.isBlank(comment)) {
// comment="";
throw new CustomException("comment 不能为空!");
// return rb.setMsg("comment 不能为空!");
}
String processInstanceId = flowTaskVo.getInstanceId();
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
if (processInstance != null) {
@ -1428,10 +1440,9 @@ public class FlowTaskService extends MybatisBaseService<FlowTaskMapper, FlowTask
List<Execution> executions = runtimeService.createExecutionQuery().parentId(processInstanceId).list();
List<String> executionIds = new ArrayList<>();
executions.forEach(execution -> executionIds.add(execution.getId()));
String comment = flowTaskVo.getComment();
if (StringUtils.isBlank(comment)) {
/*if (StringUtils.isBlank(comment)) {
comment = "终止";
}
}*/
taskService.setAssignee(flowTaskVo.getTaskId(), flowTaskVo.getUserSid());
taskService.addComment(flowTaskVo.getTaskId(), processInstanceId, FlowComment.STOP.getType(), comment);
runtimeService.createChangeActivityStateBuilder().moveExecutionsToSingleActivityId(executionIds, endId).changeState();

Loading…
Cancel
Save