fix -- 工作流部分移除@Autowired和@Resource注解,改用构造器注入
This commit is contained in:
@@ -19,7 +19,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -37,7 +36,7 @@ import java.util.List;
|
||||
*/
|
||||
@Validated
|
||||
@Api(value = "流程分类控制器", tags = {"流程分类管理"})
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/workflow/category")
|
||||
public class FlowCategoryController extends BaseController {
|
||||
|
||||
@@ -14,12 +14,11 @@ import com.ruoyi.workflow.service.IFlowDefinitionService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.awt.image.BufferedImage;
|
||||
@@ -40,18 +39,16 @@ import java.util.Map;
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "流程定义")
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/workflow/definition")
|
||||
public class FlowDefinitionController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IFlowDefinitionService flowDefinitionService;
|
||||
private final IFlowDefinitionService flowDefinitionService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
private final ISysUserService userService;
|
||||
|
||||
@Resource
|
||||
private ISysRoleService sysRoleService;
|
||||
private final ISysRoleService sysRoleService;
|
||||
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
|
||||
@@ -7,8 +7,8 @@ import com.ruoyi.workflow.service.IFlowInstanceService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -21,12 +21,12 @@ import java.util.Map;
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "工作流流程实例管理")
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/workflow/instance")
|
||||
public class FlowInstanceController {
|
||||
|
||||
@Autowired
|
||||
private IFlowInstanceService flowInstanceService;
|
||||
private final IFlowInstanceService flowInstanceService;
|
||||
|
||||
@ApiOperation(value = "根据流程定义id启动流程实例")
|
||||
@PostMapping("/startBy/{procDefId}")
|
||||
|
||||
@@ -9,8 +9,8 @@ import com.ruoyi.workflow.service.IFlowTaskService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
@@ -28,12 +28,12 @@ import java.io.OutputStream;
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "工作流流程任务管理")
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/workflow/task")
|
||||
public class FlowTaskController {
|
||||
|
||||
@Autowired
|
||||
private IFlowTaskService flowTaskService;
|
||||
private final IFlowTaskService flowTaskService;
|
||||
|
||||
@ApiOperation(value = "我发起的流程", response = FlowTaskDto.class)
|
||||
@GetMapping(value = "/myProcess")
|
||||
|
||||
@@ -8,11 +8,11 @@ import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.workflow.service.ISysDeployFormService;
|
||||
import com.ruoyi.workflow.service.ISysFormService;
|
||||
import com.ruoyi.system.domain.SysDeployForm;
|
||||
import com.ruoyi.system.domain.SysForm;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.ruoyi.workflow.service.ISysDeployFormService;
|
||||
import com.ruoyi.workflow.service.ISysFormService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -24,14 +24,14 @@ import java.util.List;
|
||||
* @author XuanXuan
|
||||
* @date 2021-04-03
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/workflow/form")
|
||||
public class SysFormController extends BaseController {
|
||||
@Autowired
|
||||
private ISysFormService SysFormService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeployFormService sysDeployFormService;
|
||||
private final ISysFormService SysFormService;
|
||||
|
||||
private final ISysDeployFormService sysDeployFormService;
|
||||
|
||||
/**
|
||||
* 查询流程表单列表
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.ruoyi.workflow.domain.vo.FlowTaskVo;
|
||||
import com.ruoyi.workflow.domain.vo.FlowViewerVo;
|
||||
import com.ruoyi.workflow.service.IFlowTaskService;
|
||||
import com.ruoyi.workflow.service.ISysDeployFormService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -55,7 +56,6 @@ import org.flowable.task.api.history.HistoricTaskInstanceQuery;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -67,20 +67,16 @@ import java.util.stream.Collectors;
|
||||
* @author XuanXuan
|
||||
* @date 2021-04-03
|
||||
**/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
@Slf4j
|
||||
public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTaskService {
|
||||
|
||||
@Resource
|
||||
private ISysUserService sysUserService;
|
||||
private final ISysUserService sysUserService;
|
||||
|
||||
private final ISysRoleService sysRoleService;
|
||||
|
||||
@Resource
|
||||
private ISysRoleService sysRoleService;
|
||||
|
||||
|
||||
@Resource
|
||||
private ISysDeployFormService sysInstanceFormService;
|
||||
private final ISysDeployFormService sysInstanceFormService;
|
||||
|
||||
/**
|
||||
* 完成任务
|
||||
@@ -442,23 +438,22 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
||||
flowTask.setDuration(getDate(time));
|
||||
}
|
||||
// 流程定义信息
|
||||
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery()
|
||||
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
|
||||
.processDefinitionId(hisIns.getProcessDefinitionId())
|
||||
.singleResult();
|
||||
flowTask.setDeployId(pd.getDeploymentId());
|
||||
flowTask.setDeployId(processDefinition.getDeploymentId());
|
||||
flowTask.setProcDefId(hisIns.getProcessDefinitionId());
|
||||
flowTask.setProcDefName(pd.getName());
|
||||
flowTask.setProcDefVersion(pd.getVersion());
|
||||
flowTask.setCategory(pd.getCategory());
|
||||
flowTask.setProcDefVersion(pd.getVersion());
|
||||
flowTask.setProcDefName(processDefinition.getName());
|
||||
flowTask.setProcDefVersion(processDefinition.getVersion());
|
||||
flowTask.setCategory(processDefinition.getCategory());
|
||||
// 当前所处流程 todo: 本地启动放开以下注释
|
||||
// List<Task> taskList = taskService.createTaskQuery().processInstanceId(hisIns.getId()).list();
|
||||
// if (CollectionUtils.isNotEmpty(taskList)) {
|
||||
// flowTask.setTaskId(taskList.get(0).getId());
|
||||
// } else {
|
||||
// List<HistoricTaskInstance> historicTaskInstance = historyService.createHistoricTaskInstanceQuery().processInstanceId(hisIns.getId()).orderByHistoricTaskInstanceEndTime().desc().list();
|
||||
// flowTask.setTaskId(historicTaskInstance.get(0).getId());
|
||||
// }
|
||||
// List<Task> taskList = taskService.createTaskQuery().processInstanceId(hisIns.getId()).list();
|
||||
// if (CollectionUtils.isNotEmpty(taskList)) {
|
||||
// flowTask.setTaskId(taskList.get(0).getId());
|
||||
// } else {
|
||||
// List<HistoricTaskInstance> historicTaskInstance = historyService.createHistoricTaskInstanceQuery().processInstanceId(hisIns.getId()).orderByHistoricTaskInstanceEndTime().desc().list();
|
||||
// flowTask.setTaskId(historicTaskInstance.get(0).getId());
|
||||
// }
|
||||
flowList.add(flowTask);
|
||||
}
|
||||
page.setRecords(flowList);
|
||||
@@ -478,8 +473,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
||||
throw new RuntimeException("流程未启动或已执行完成,取消申请失败");
|
||||
}
|
||||
|
||||
ProcessInstance processInstance =
|
||||
runtimeService.createProcessInstanceQuery().processInstanceId(flowTaskVo.getInstanceId()).singleResult();
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
|
||||
.processInstanceId(flowTaskVo.getInstanceId()).singleResult();
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(processInstance.getProcessDefinitionId());
|
||||
if (Objects.nonNull(bpmnModel)) {
|
||||
Process process = bpmnModel.getMainProcess();
|
||||
@@ -489,12 +484,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
||||
// taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.STOP.getType(),
|
||||
// StringUtils.isBlank(flowTaskVo.getComment()) ? "取消申请" : flowTaskVo.getComment());
|
||||
String endId = endNodes.get(0).getId();
|
||||
List<Execution> executions =
|
||||
runtimeService.createExecutionQuery().parentId(processInstance.getProcessInstanceId()).list();
|
||||
List<Execution> executions = runtimeService.createExecutionQuery()
|
||||
.parentId(processInstance.getProcessInstanceId()).list();
|
||||
List<String> executionIds = new ArrayList<>();
|
||||
executions.forEach(execution -> executionIds.add(execution.getId()));
|
||||
runtimeService.createChangeActivityStateBuilder().moveExecutionsToSingleActivityId(executionIds,
|
||||
endId).changeState();
|
||||
runtimeService.createChangeActivityStateBuilder()
|
||||
.moveExecutionsToSingleActivityId(executionIds, endId).changeState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.ruoyi.workflow.service.impl;
|
||||
|
||||
import com.ruoyi.workflow.service.ISysDeployFormService;
|
||||
import com.ruoyi.system.domain.SysDeployForm;
|
||||
import com.ruoyi.system.domain.SysForm;
|
||||
import com.ruoyi.system.mapper.SysDeployFormMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.ruoyi.workflow.service.ISysDeployFormService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -16,11 +16,11 @@ import java.util.Objects;
|
||||
* @author XuanXuan Xuan
|
||||
* @date 2021-04-03
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SysDeployFormServiceImpl implements ISysDeployFormService {
|
||||
|
||||
@Autowired
|
||||
private SysDeployFormMapper sysDeployFormMapper;
|
||||
private final SysDeployFormMapper sysDeployFormMapper;
|
||||
|
||||
/**
|
||||
* 查询流程实例关联表单
|
||||
|
||||
@@ -3,10 +3,10 @@ package com.ruoyi.workflow.service.impl;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.workflow.service.ISysFormService;
|
||||
import com.ruoyi.system.domain.SysForm;
|
||||
import com.ruoyi.system.mapper.SysFormMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.ruoyi.workflow.service.ISysFormService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -17,11 +17,11 @@ import java.util.List;
|
||||
* @author XuanXuan Xuan
|
||||
* @date 2021-04-03
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SysFormServiceImpl implements ISysFormService {
|
||||
|
||||
@Autowired
|
||||
private SysFormMapper sysFormMapper;
|
||||
private final SysFormMapper sysFormMapper;
|
||||
|
||||
/**
|
||||
* 查询流程表单
|
||||
|
||||
Reference in New Issue
Block a user