Merge remote-tracking branch 'origin/master'

approve-sys
bob 2 years ago
commit 1839fd3f8e

@ -52,7 +52,7 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<!-- JSON工具类 -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
@ -131,6 +131,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.11</version>
</dependency>
</dependencies>
</project>
</project>

@ -5,6 +5,7 @@ import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.flowable.domain.dto.FlowTaskDto;
import com.ruoyi.flowable.domain.vo.FlowTaskVo;
import com.ruoyi.flowable.domain.vo.UpdateVariablesSubmitDateVo;
import com.ruoyi.flowable.service.IFlowTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -41,6 +42,12 @@ public class FlowTaskController {
@ApiParam(value = "每页条数", required = true) @RequestParam Integer pageSize) {
return flowTaskService.myProcess(pageNum, pageSize);
}
@ApiOperation(value = "所有流程", response = FlowTaskDto.class)
@GetMapping(value = "/allProcess")
public AjaxResult allProcess(@ApiParam(value = "当前页码", required = true) @RequestParam Integer pageNum,
@ApiParam(value = "每页条数", required = true) @RequestParam Integer pageSize) {
return flowTaskService.allProcess(pageNum, pageSize);
}
@ApiOperation(value = "取消申请", response = FlowTaskDto.class)
@PostMapping(value = "/stopProcess")
@ -80,6 +87,11 @@ public class FlowTaskController {
public AjaxResult processVariables(@ApiParam(value = "流程任务Id") @PathVariable(value = "taskId") String taskId) {
return flowTaskService.processVariables(taskId);
}
@ApiOperation(value = "更新流程变量提交时间", response = FlowTaskDto.class)
@PostMapping(value = "/updateVariablesSubmitDate")
public AjaxResult updateVariablesSubmitDate(@RequestBody UpdateVariablesSubmitDateVo vo) {
return flowTaskService.updateVariablesSubmitDate(vo.getProcessInstanceId(), vo.getSubmitDate());
}
@ApiOperation(value = "审批任务")
@PostMapping(value = "/complete")

@ -0,0 +1,16 @@
package com.ruoyi.flowable.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("工作流任务相关--请求参数")
public class UpdateVariablesSubmitDateVo {
@ApiModelProperty("流程实例id")
private String processInstanceId;
@ApiModelProperty("提交时间")
private String submitDate;
}

@ -5,7 +5,6 @@ import com.ruoyi.flowable.domain.vo.FlowTaskVo;
import org.flowable.task.api.Task;
import java.io.InputStream;
import java.util.List;
/**
* @author XuanXuan
@ -87,6 +86,14 @@ public interface IFlowTaskService {
*/
AjaxResult myProcess(Integer pageNum, Integer pageSize);
/**
*
* @param pageNum
* @param pageSize
* @return
*/
AjaxResult allProcess(Integer pageNum, Integer pageSize);
/**
*
* @param flowTaskVo
@ -158,6 +165,8 @@ public interface IFlowTaskService {
*/
AjaxResult processVariables(String taskId);
AjaxResult updateVariablesSubmitDate(String processInstanceId,String submitDate);
/**
*
* @param flowTaskVo

@ -1,16 +1,16 @@
package com.ruoyi.flowable.service.impl;
import com.alibaba.fastjson.JSONObject;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.ruoyi.flowable.common.constant.ProcessConstants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.flowable.common.enums.FlowComment;
import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.flowable.common.constant.ProcessConstants;
import com.ruoyi.flowable.common.enums.FlowComment;
import com.ruoyi.flowable.domain.dto.FlowCommentDto;
import com.ruoyi.flowable.domain.dto.FlowNextDto;
import com.ruoyi.flowable.domain.dto.FlowTaskDto;
@ -22,25 +22,22 @@ import com.ruoyi.flowable.flow.FindNextNodeUtil;
import com.ruoyi.flowable.flow.FlowableUtils;
import com.ruoyi.flowable.service.IFlowTaskService;
import com.ruoyi.flowable.service.ISysDeployFormService;
import com.ruoyi.system.domain.SysForm;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.flowable.bpmn.model.Process;
import org.flowable.bpmn.model.*;
import org.flowable.common.engine.api.FlowableException;
import org.flowable.common.engine.api.FlowableObjectNotFoundException;
import org.flowable.common.engine.api.query.QueryProperty;
import org.flowable.common.engine.impl.identity.Authentication;
import org.flowable.engine.ProcessEngineConfiguration;
import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.history.HistoricProcessInstanceQuery;
import org.flowable.engine.impl.ActivityInstanceQueryProperty;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.engine.runtime.ActivityInstance;
import org.flowable.engine.runtime.Execution;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.engine.task.Comment;
@ -413,12 +410,35 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
*/
@Override
public AjaxResult myProcess(Integer pageNum, Integer pageSize) {
Page<FlowTaskDto> page = new Page<>();
Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery()
.startedBy(userId.toString())
.orderByProcessInstanceStartTime()
.desc();
return AjaxResult.success(buildFlowTask(pageNum, pageSize, historicProcessInstanceQuery));
}
/**
*
*
* @param pageNum
* @param pageSize
* @return
*/
@Override
public AjaxResult allProcess(Integer pageNum, Integer pageSize) {
// 管理员才有权查询此接口
HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery()
.orderByProcessInstanceStartTime()
.includeProcessVariables()
.desc();
return AjaxResult.success(buildFlowTask(pageNum, pageSize, historicProcessInstanceQuery));
}
public Page<FlowTaskDto> buildFlowTask(Integer pageNum, Integer pageSize, HistoricProcessInstanceQuery historicProcessInstanceQuery) {
Page<FlowTaskDto> page = new Page<>();
List<HistoricProcessInstance> historicProcessInstances = historicProcessInstanceQuery.listPage(pageSize * (pageNum - 1), pageSize);
page.setTotal(historicProcessInstanceQuery.count());
List<FlowTaskDto> flowList = new ArrayList<>();
@ -445,6 +465,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
flowTask.setProcDefVersion(pd.getVersion());
flowTask.setCategory(pd.getCategory());
flowTask.setProcDefVersion(pd.getVersion());
if (MapUtils.isNotEmpty(hisIns.getProcessVariables())
&& hisIns.getProcessVariables().containsKey("submitDate")
&& StringUtils.isNotBlank(MapUtils.getString(hisIns.getProcessVariables(), "submitDate"))) {
String submitDate = MapUtils.getString(hisIns.getProcessVariables(), "submitDate");
flowTask.setCreateTime(DateUtil.parse(submitDate));
}
// 当前所处流程 todo: 本地启动放开以下注释
// List<Task> taskList = taskService.createTaskQuery().processInstanceId(hisIns.getId()).list();
// if (CollectionUtils.isNotEmpty(taskList)) {
@ -456,7 +482,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
flowList.add(flowTask);
}
page.setRecords(flowList);
return AjaxResult.success(page);
return page;
}
/**
@ -889,6 +915,19 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
}
}
@Override
public AjaxResult updateVariablesSubmitDate(String processInstanceId, String submitDate) {
if (StringUtils.isBlank(processInstanceId) || StringUtils.isBlank(submitDate)) {
return AjaxResult.error("更新提交时间失败,参数无效");
}
Execution execution = runtimeService.createExecutionQuery().processInstanceId(processInstanceId).variableExists("submitDate").singleResult();
if (Objects.isNull(execution)) {
return AjaxResult.error("更新提交时间失败,查询错误");
}
runtimeService.setVariable(execution.getId(),"submitDate",submitDate);
return AjaxResult.success();
}
/**
*
*
@ -986,4 +1025,4 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
return 0 + "秒";
}
}
}
}

Loading…
Cancel
Save