切换mysql为达梦数据库-代码审查
1.bpm-boot模块
This commit is contained in:
@@ -9,7 +9,6 @@ import org.flowable.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior;
|
|||||||
import org.flowable.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior;
|
import org.flowable.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义的【并行】的【多个】流程任务的 assignee 负责人的分配
|
* 自定义的【并行】的【多个】流程任务的 assignee 负责人的分配
|
||||||
@@ -33,7 +32,6 @@ public class BpmParallelMultiInstanceBehavior extends ParallelMultiInstanceBehav
|
|||||||
* 重写该方法,主要实现两个功能:
|
* 重写该方法,主要实现两个功能:
|
||||||
* 1. 忽略原有的 collectionVariable、collectionElementVariable 表达式,而是采用自己定义的
|
* 1. 忽略原有的 collectionVariable、collectionElementVariable 表达式,而是采用自己定义的
|
||||||
* 2. 获得任务的处理人,并设置到 collectionVariable 中,用于 BpmUserTaskActivityBehavior 从中可以获取任务的处理人
|
* 2. 获得任务的处理人,并设置到 collectionVariable 中,用于 BpmUserTaskActivityBehavior 从中可以获取任务的处理人
|
||||||
*
|
|
||||||
* 注意,多个任务实例,每个任务实例对应一个处理人,所以返回的数量就是任务处理人的数量
|
* 注意,多个任务实例,每个任务实例对应一个处理人,所以返回的数量就是任务处理人的数量
|
||||||
*
|
*
|
||||||
* @param execution 执行任务
|
* @param execution 执行任务
|
||||||
@@ -43,7 +41,8 @@ public class BpmParallelMultiInstanceBehavior extends ParallelMultiInstanceBehav
|
|||||||
protected int resolveNrOfInstances(DelegateExecution execution) {
|
protected int resolveNrOfInstances(DelegateExecution execution) {
|
||||||
// 第一步,设置 collectionVariable 和 CollectionVariable
|
// 第一步,设置 collectionVariable 和 CollectionVariable
|
||||||
// 从 execution.getVariable() 读取所有任务处理人的 key
|
// 从 execution.getVariable() 读取所有任务处理人的 key
|
||||||
super.collectionExpression = null; // collectionExpression 和 collectionVariable 是互斥的
|
// collectionExpression 和 collectionVariable 是互斥的
|
||||||
|
super.collectionExpression = null;
|
||||||
super.collectionVariable = FlowableUtils.formatExecutionCollectionVariable(execution.getCurrentActivityId());
|
super.collectionVariable = FlowableUtils.formatExecutionCollectionVariable(execution.getCurrentActivityId());
|
||||||
// 从 execution.getVariable() 读取当前所有任务处理的人的 key
|
// 从 execution.getVariable() 读取当前所有任务处理的人的 key
|
||||||
super.collectionElementVariable = FlowableUtils.formatExecutionCollectionElementVariable(execution.getCurrentActivityId());
|
super.collectionElementVariable = FlowableUtils.formatExecutionCollectionElementVariable(execution.getCurrentActivityId());
|
||||||
|
|||||||
@@ -9,13 +9,10 @@ import org.flowable.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior;
|
|||||||
import org.flowable.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior;
|
import org.flowable.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义的【串行】的【多个】流程任务的 assignee 负责人的分配
|
* 自定义的【串行】的【多个】流程任务的 assignee 负责人的分配
|
||||||
*
|
|
||||||
* 本质上,实现和 {@link BpmParallelMultiInstanceBehavior} 一样,只是继承的类不一样
|
* 本质上,实现和 {@link BpmParallelMultiInstanceBehavior} 一样,只是继承的类不一样
|
||||||
*
|
*
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
@@ -31,20 +28,21 @@ public class BpmSequentialMultiInstanceBehavior extends SequentialMultiInstanceB
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 逻辑和 {@link BpmParallelMultiInstanceBehavior#resolveNrOfInstances(DelegateExecution)} 类似
|
* 逻辑和 {@link BpmParallelMultiInstanceBehavior#resolveNrOfInstances(DelegateExecution)} 类似
|
||||||
*
|
|
||||||
* 差异的点:是在【第二步】的时候,需要返回 LinkedHashSet 集合!因为它需要有序!
|
* 差异的点:是在【第二步】的时候,需要返回 LinkedHashSet 集合!因为它需要有序!
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected int resolveNrOfInstances(DelegateExecution execution) {
|
protected int resolveNrOfInstances(DelegateExecution execution) {
|
||||||
// 第一步,设置 collectionVariable 和 CollectionVariable
|
// 第一步,设置 collectionVariable 和 CollectionVariable
|
||||||
// 从 execution.getVariable() 读取所有任务处理人的 key
|
// 从 execution.getVariable() 读取所有任务处理人的 key
|
||||||
super.collectionExpression = null; // collectionExpression 和 collectionVariable 是互斥的
|
// collectionExpression 和 collectionVariable 是互斥的
|
||||||
|
super.collectionExpression = null;
|
||||||
super.collectionVariable = FlowableUtils.formatExecutionCollectionVariable(execution.getCurrentActivityId());
|
super.collectionVariable = FlowableUtils.formatExecutionCollectionVariable(execution.getCurrentActivityId());
|
||||||
// 从 execution.getVariable() 读取当前所有任务处理的人的 key
|
// 从 execution.getVariable() 读取当前所有任务处理的人的 key
|
||||||
super.collectionElementVariable = FlowableUtils.formatExecutionCollectionElementVariable(execution.getCurrentActivityId());
|
super.collectionElementVariable = FlowableUtils.formatExecutionCollectionElementVariable(execution.getCurrentActivityId());
|
||||||
|
|
||||||
// 第二步,获取任务的所有处理人
|
// 第二步,获取任务的所有处理人
|
||||||
List<String> assigneeUserIds = new ArrayList<>(taskCandidateInvoker.calculateUsers(execution)); // 保证有序!!!
|
// 保证有序!!!
|
||||||
|
List<String> assigneeUserIds = new ArrayList<>(taskCandidateInvoker.calculateUsers(execution));
|
||||||
execution.setVariable(super.collectionVariable, assigneeUserIds);
|
execution.setVariable(super.collectionVariable, assigneeUserIds);
|
||||||
return assigneeUserIds.size();
|
return assigneeUserIds.size();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import org.flowable.task.service.TaskService;
|
|||||||
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
|
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义的【单个】流程任务的 assignee 负责人的分配
|
* 自定义的【单个】流程任务的 assignee 负责人的分配
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ public class BpmFlowableConfiguration {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 参考 {@link org.flowable.spring.boot.FlowableJobConfiguration} 类,创建对应的 AsyncListenableTaskExecutor Bean
|
* 参考 {@link org.flowable.spring.boot.FlowableJobConfiguration} 类,创建对应的 AsyncListenableTaskExecutor Bean
|
||||||
*
|
|
||||||
* 如果不创建,会导致项目启动时,Flowable 报错的问题
|
* 如果不创建,会导致项目启动时,Flowable 报错的问题
|
||||||
*/
|
*/
|
||||||
@Bean(name = "applicationTaskExecutor")
|
@Bean(name = "applicationTaskExecutor")
|
||||||
@@ -49,7 +48,6 @@ public class BpmFlowableConfiguration {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* BPM 模块的 ProcessEngineConfigurationConfigurer 实现类:
|
* BPM 模块的 ProcessEngineConfigurationConfigurer 实现类:
|
||||||
*
|
|
||||||
* 1. 设置各种监听器
|
* 1. 设置各种监听器
|
||||||
* 2. 设置自定义的 ActivityBehaviorFactory 实现
|
* 2. 设置自定义的 ActivityBehaviorFactory 实现
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ import java.util.Set;
|
|||||||
public class BpmTaskEventListener extends AbstractFlowableEngineEventListener {
|
public class BpmTaskEventListener extends AbstractFlowableEngineEventListener {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@Lazy // 解决循环依赖
|
@Lazy
|
||||||
private IBpmTaskService taskService;
|
private IBpmTaskService taskService;
|
||||||
@Resource
|
@Resource
|
||||||
@Lazy // 解决循环依赖
|
@Lazy
|
||||||
private IBpmActivityService activityService;
|
private IBpmActivityService activityService;
|
||||||
|
|
||||||
public static final Set<FlowableEngineEventType> TASK_EVENTS = ImmutableSet.<FlowableEngineEventType>builder()
|
public static final Set<FlowableEngineEventType> TASK_EVENTS = ImmutableSet.<FlowableEngineEventType>builder()
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.njcn.bpm.config;
|
|
||||||
|
|
||||||
import com.njcn.bpm.enums.WebFilterOrderEnum;
|
|
||||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* bpm 模块的 web 组件的 Configuration
|
|
||||||
*
|
|
||||||
* @author hongawen
|
|
||||||
*/
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
|
||||||
public class BpmWebConfiguration {
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * bpm 模块的 API 分组
|
|
||||||
// */
|
|
||||||
// @Bean
|
|
||||||
// public GroupedOpenApi bpmGroupedOpenApi() {
|
|
||||||
// return YudaoSwaggerAutoConfiguration.buildGroupedOpenApi("bpm");
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 配置 Flowable Web 过滤器
|
|
||||||
*/
|
|
||||||
/* @Bean
|
|
||||||
public FilterRegistrationBean<FlowableWebFilter> flowableWebFilter() {
|
|
||||||
FilterRegistrationBean<FlowableWebFilter> registrationBean = new FilterRegistrationBean<>();
|
|
||||||
registrationBean.setFilter(new FlowableWebFilter());
|
|
||||||
registrationBean.setOrder(WebFilterOrderEnum.FLOWABLE_FILTER);
|
|
||||||
return registrationBean;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
//package com.njcn.bpm.config;
|
|
||||||
//
|
|
||||||
//import cn.hutool.core.util.StrUtil;
|
|
||||||
//import com.njcn.bpm.utils.FlowableUtils;
|
|
||||||
//import com.njcn.web.utils.RequestUtil;
|
|
||||||
//import org.springframework.web.filter.OncePerRequestFilter;
|
|
||||||
//
|
|
||||||
//import javax.servlet.FilterChain;
|
|
||||||
//import javax.servlet.ServletException;
|
|
||||||
//import javax.servlet.http.HttpServletRequest;
|
|
||||||
//import javax.servlet.http.HttpServletResponse;
|
|
||||||
//import java.io.IOException;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * Flowable Web 过滤器,将 userId 设置到 {@link org.flowable.common.engine.impl.identity.Authentication} 中
|
|
||||||
// *
|
|
||||||
// * @author jason
|
|
||||||
// */
|
|
||||||
//public class FlowableWebFilter extends OncePerRequestFilter {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
|
|
||||||
// throws ServletException, IOException {
|
|
||||||
// try {
|
|
||||||
// String userIndex = RequestUtil.getUserIndex();
|
|
||||||
// // 设置工作流的用户
|
|
||||||
// if (StrUtil.isNotBlank(userIndex)) {
|
|
||||||
// FlowableUtils.setAuthenticatedUserId(userIndex);
|
|
||||||
// }
|
|
||||||
// // 过滤
|
|
||||||
// chain.doFilter(request, response);
|
|
||||||
// } finally {
|
|
||||||
// // 清理
|
|
||||||
// FlowableUtils.clearAuthenticatedUserId();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
@@ -9,6 +9,9 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author guosongrui
|
||||||
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class JacksonConfig {
|
public class JacksonConfig {
|
||||||
public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ public class BpmConstants {
|
|||||||
public static final String TASK_VARIABLE_STATUS = "TASK_STATUS";
|
public static final String TASK_VARIABLE_STATUS = "TASK_STATUS";
|
||||||
/**
|
/**
|
||||||
* 任务的变量 - 理由
|
* 任务的变量 - 理由
|
||||||
*
|
|
||||||
* 例如说:审批通过、不通过的理由
|
* 例如说:审批通过、不通过的理由
|
||||||
*
|
*
|
||||||
* @see org.flowable.task.api.Task#getTaskLocalVariables()
|
* @see org.flowable.task.api.Task#getTaskLocalVariables()
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ import javax.annotation.Resource;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
*/
|
||||||
@Tag(name = "管理后台 - 流程活动实例")
|
@Tag(name = "管理后台 - 流程活动实例")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/bpm/activity")
|
@RequestMapping("/bpm/activity")
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ import javax.validation.Valid;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/bpm/category")
|
@RequestMapping("/bpm/category")
|
||||||
@Validated
|
@Validated
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ import javax.validation.Valid;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/bpm/form")
|
@RequestMapping("/bpm/form")
|
||||||
@Validated
|
@Validated
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ import static com.njcn.bpm.utils.CollectionUtils.convertMap;
|
|||||||
import static com.njcn.bpm.utils.CollectionUtils.convertSet;
|
import static com.njcn.bpm.utils.CollectionUtils.convertSet;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/bpm/model")
|
@RequestMapping("/bpm/model")
|
||||||
@Validated
|
@Validated
|
||||||
@@ -157,6 +160,11 @@ public class BpmModelController extends BaseController {
|
|||||||
// return success(true);
|
// return success(true);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除模型
|
||||||
|
* @param id 模型编号
|
||||||
|
*/
|
||||||
@GetMapping("/delete")
|
@GetMapping("/delete")
|
||||||
@ApiOperation("删除模型")
|
@ApiOperation("删除模型")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ import java.util.Map;
|
|||||||
import static com.njcn.bpm.utils.CollectionUtils.convertSet;
|
import static com.njcn.bpm.utils.CollectionUtils.convertSet;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/bpm/processDefinition")
|
@RequestMapping("/bpm/processDefinition")
|
||||||
@Validated
|
@Validated
|
||||||
@@ -81,6 +84,10 @@ public class BpmProcessDefinitionController extends BaseController {
|
|||||||
pageResult, deploymentMap, processDefinitionMap, formMap, categoryMap), methodDescribe);
|
pageResult, deploymentMap, processDefinitionMap, formMap, categoryMap), methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得流程定义列表
|
||||||
|
* @param suspensionState 挂起状态
|
||||||
|
*/
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperation("获得流程定义列表")
|
@ApiOperation("获得流程定义列表")
|
||||||
@Parameter(name = "suspensionState", description = "挂起状态", required = true) // 参见 Flowable SuspensionState 枚举
|
@Parameter(name = "suspensionState", description = "挂起状态", required = true) // 参见 Flowable SuspensionState 枚举
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ import static com.njcn.bpm.utils.CollectionUtils.convertList;
|
|||||||
import static com.njcn.bpm.utils.CollectionUtils.convertSet;
|
import static com.njcn.bpm.utils.CollectionUtils.convertSet;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/bpm/processInstance")
|
@RequestMapping("/bpm/processInstance")
|
||||||
@Validated
|
@Validated
|
||||||
@@ -204,7 +207,7 @@ public class BpmProcessInstanceController extends BaseController {
|
|||||||
|
|
||||||
@ApiOperation(value = "删除流程实例(会删除已经审核的流程慎用)")
|
@ApiOperation(value = "删除流程实例(会删除已经审核的流程慎用)")
|
||||||
@GetMapping(value = "/deleteInstance")
|
@GetMapping(value = "/deleteInstance")
|
||||||
public HttpResult delete(@ApiParam(value = "流程实例ID", required = true) @RequestParam String instanceIds) {
|
public HttpResult<Boolean> delete(@ApiParam(value = "流程实例ID", required = true) @RequestParam String instanceIds) {
|
||||||
String methodDescribe = getMethodDescribe("delete");
|
String methodDescribe = getMethodDescribe("delete");
|
||||||
processInstanceService.delete(instanceIds,"测试删除");
|
processInstanceService.delete(instanceIds,"测试删除");
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.bpm.pojo.dto.PageResult;
|
import com.njcn.bpm.pojo.dto.PageResult;
|
||||||
import com.njcn.bpm.pojo.param.instance.BpmProcessInstancePageParam;
|
|
||||||
import com.njcn.bpm.pojo.param.task.*;
|
import com.njcn.bpm.pojo.param.task.*;
|
||||||
import com.njcn.bpm.pojo.po.BpmCategory;
|
import com.njcn.bpm.pojo.po.BpmCategory;
|
||||||
import com.njcn.bpm.pojo.po.BpmForm;
|
import com.njcn.bpm.pojo.po.BpmForm;
|
||||||
@@ -56,6 +55,9 @@ import java.util.stream.Stream;
|
|||||||
import static com.njcn.bpm.utils.CollectionUtils.*;
|
import static com.njcn.bpm.utils.CollectionUtils.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/bpm/task")
|
@RequestMapping("/bpm/task")
|
||||||
@Validated
|
@Validated
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public abstract class BpmProcessInstanceStatusEventListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 获取流程定义Key
|
||||||
* @return 返回监听的流程定义 Key
|
* @return 返回监听的流程定义 Key
|
||||||
*/
|
*/
|
||||||
protected abstract String getProcessDefinitionKey();
|
protected abstract String getProcessDefinitionKey();
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class BpmSupervisionStatusListener implements ApplicationListener<BpmProcessInstanceStatusEvent> {
|
public class BpmSupervisionStatusListener implements ApplicationListener<BpmProcessInstanceStatusEvent> {
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
/**
|
/**
|
||||||
* BPM 流程分类 Mapper
|
* BPM 流程分类 Mapper
|
||||||
*
|
*
|
||||||
|
* @author hongawen
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface BpmCategoryMapper extends BaseMapper<BpmCategory> {
|
public interface BpmCategoryMapper extends BaseMapper<BpmCategory> {
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import com.njcn.bpm.pojo.po.BpmProcessDefinitionInfo;
|
|||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface BpmProcessDefinitionInfoMapper extends BaseMapper<BpmProcessDefinitionInfo> {
|
public interface BpmProcessDefinitionInfoMapper extends BaseMapper<BpmProcessDefinitionInfo> {
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* BPM 流程分类 Service 实现类
|
* BPM 流程分类 Service 实现类
|
||||||
*
|
*
|
||||||
|
* @author hongawen
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Validated
|
@Validated
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ public class BpmFormServiceImpl extends ServiceImpl<BpmFormMapper, BpmForm> impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String createForm(BpmFormParam bpmFormParam) {
|
public String createForm(BpmFormParam bpmFormParam) {
|
||||||
// this.validateFields(createReqVO.getFields());
|
|
||||||
checkFormName(bpmFormParam, false);
|
checkFormName(bpmFormParam, false);
|
||||||
// 插入
|
// 插入
|
||||||
BpmForm form = BeanUtils.toBean(bpmFormParam, BpmForm.class);
|
BpmForm form = BeanUtils.toBean(bpmFormParam, BpmForm.class);
|
||||||
@@ -88,13 +87,6 @@ public class BpmFormServiceImpl extends ServiceImpl<BpmFormMapper, BpmForm> impl
|
|||||||
.update();
|
.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void validateFormExists(Long id) {
|
|
||||||
// if (this.baseMapper.selectById(id) == null) {
|
|
||||||
// throw exception(ErrorCodeConstants.FORM_NOT_EXISTS);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BpmForm> getFormList() {
|
public List<BpmForm> getFormList() {
|
||||||
@@ -120,7 +112,8 @@ public class BpmFormServiceImpl extends ServiceImpl<BpmFormMapper, BpmForm> impl
|
|||||||
* @param fields field 数组
|
* @param fields field 数组
|
||||||
*/
|
*/
|
||||||
private void validateFields(List<String> fields) {
|
private void validateFields(List<String> fields) {
|
||||||
if (true) { // TODO 芋艿:兼容 Vue3 工作流:因为采用了新的表单设计器,所以暂时不校验
|
// TODO 芋艿:兼容 Vue3 工作流:因为采用了新的表单设计器,所以暂时不校验
|
||||||
|
if (true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Map<String, String> fieldMap = new HashMap<>(); // key 是 vModel,value 是 label
|
// Map<String, String> fieldMap = new HashMap<>(); // key 是 vModel,value 是 label
|
||||||
|
|||||||
@@ -63,7 +63,8 @@ public class BpmModelServiceImpl implements IBpmModelService {
|
|||||||
modelQuery.modelKey(bpmModelQueryParam.getKey());
|
modelQuery.modelKey(bpmModelQueryParam.getKey());
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotBlank(bpmModelQueryParam.getName())) {
|
if (StrUtil.isNotBlank(bpmModelQueryParam.getName())) {
|
||||||
modelQuery.modelNameLike("%" + bpmModelQueryParam.getName() + "%"); // 模糊匹配
|
// 模糊匹配
|
||||||
|
modelQuery.modelNameLike("%" + bpmModelQueryParam.getName() + "%");
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotBlank(bpmModelQueryParam.getCategory())) {
|
if (StrUtil.isNotBlank(bpmModelQueryParam.getCategory())) {
|
||||||
modelQuery.modelCategory(bpmModelQueryParam.getCategory());
|
modelQuery.modelCategory(bpmModelQueryParam.getCategory());
|
||||||
@@ -110,7 +111,7 @@ public class BpmModelServiceImpl implements IBpmModelService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class) // 因为进行多个操作,所以开启事务
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void updateModel(BpmModelParam.BpmModelUpdateParam updateParam) {
|
public void updateModel(BpmModelParam.BpmModelUpdateParam updateParam) {
|
||||||
// 校验流程模型存在
|
// 校验流程模型存在
|
||||||
Model model = getModel(updateParam.getId());
|
Model model = getModel(updateParam.getId());
|
||||||
@@ -126,7 +127,7 @@ public class BpmModelServiceImpl implements IBpmModelService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class) // 因为进行多个操作,所以开启事务
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void deployModel(String id) {
|
public void deployModel(String id) {
|
||||||
// 1.1 校验流程模型存在
|
// 1.1 校验流程模型存在
|
||||||
Model model = getModel(id);
|
Model model = getModel(id);
|
||||||
|
|||||||
@@ -76,9 +76,6 @@ public class BpmProcessInstanceServiceImpl implements IBpmProcessInstanceService
|
|||||||
@Resource
|
@Resource
|
||||||
private IBpmProcessDefinitionService processDefinitionService;
|
private IBpmProcessDefinitionService processDefinitionService;
|
||||||
|
|
||||||
// @Resource
|
|
||||||
// private BpmMessageService messageService;
|
|
||||||
//
|
|
||||||
@Resource
|
@Resource
|
||||||
private UserFeignClient userFeignClient;
|
private UserFeignClient userFeignClient;
|
||||||
|
|
||||||
@@ -116,9 +113,11 @@ public class BpmProcessInstanceServiceImpl implements IBpmProcessInstanceService
|
|||||||
.includeProcessVariables()
|
.includeProcessVariables()
|
||||||
.processInstanceTenantId(FlowableUtils.getTenantId())
|
.processInstanceTenantId(FlowableUtils.getTenantId())
|
||||||
.orderByProcessInstanceStartTime().desc();
|
.orderByProcessInstanceStartTime().desc();
|
||||||
if (userId != null) { // 【我的流程】菜单时,需要传递该字段
|
// 【我的流程】菜单时,需要传递该字段
|
||||||
|
if (userId != null) {
|
||||||
processInstanceQuery.startedBy(userId);
|
processInstanceQuery.startedBy(userId);
|
||||||
} else if (bpmProcessInstancePageParam.getStartUserId() != null) { // 【管理流程】菜单时,才会传递该字段
|
// 【管理流程】菜单时,才会传递该字段
|
||||||
|
} else if (bpmProcessInstancePageParam.getStartUserId() != null) {
|
||||||
processInstanceQuery.startedBy(bpmProcessInstancePageParam.getStartUserId());
|
processInstanceQuery.startedBy(bpmProcessInstancePageParam.getStartUserId());
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotEmpty(bpmProcessInstancePageParam.getName())) {
|
if (StrUtil.isNotEmpty(bpmProcessInstancePageParam.getName())) {
|
||||||
@@ -205,10 +204,12 @@ public class BpmProcessInstanceServiceImpl implements IBpmProcessInstanceService
|
|||||||
|
|
||||||
// 2. 创建流程实例
|
// 2. 创建流程实例
|
||||||
if (variables == null) {
|
if (variables == null) {
|
||||||
variables = new HashMap<>();
|
variables = new HashMap<>(32);
|
||||||
}
|
}
|
||||||
FlowableUtils.filterProcessInstanceFormVariable(variables); // 过滤一下,避免 ProcessInstance 系统级的变量被占用
|
// 过滤一下,避免 ProcessInstance 系统级的变量被占用
|
||||||
variables.put(BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, // 流程实例状态:审批中
|
FlowableUtils.filterProcessInstanceFormVariable(variables);
|
||||||
|
// 流程实例状态:审批中
|
||||||
|
variables.put(BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS,
|
||||||
BpmProcessInstanceStatusEnum.RUNNING.getStatus());
|
BpmProcessInstanceStatusEnum.RUNNING.getStatus());
|
||||||
if (CollUtil.isNotEmpty(startUserSelectAssignees)) {
|
if (CollUtil.isNotEmpty(startUserSelectAssignees)) {
|
||||||
variables.put(BpmConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES, startUserSelectAssignees);
|
variables.put(BpmConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES, startUserSelectAssignees);
|
||||||
@@ -312,7 +313,7 @@ public class BpmProcessInstanceServiceImpl implements IBpmProcessInstanceService
|
|||||||
Map<String, Object> processVariables = instance.getProcessVariables();
|
Map<String, Object> processVariables = instance.getProcessVariables();
|
||||||
if (processVariables.containsKey(BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS)) {
|
if (processVariables.containsKey(BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS)) {
|
||||||
Integer stata = Integer.valueOf(processVariables.get(BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS).toString());
|
Integer stata = Integer.valueOf(processVariables.get(BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS).toString());
|
||||||
if (BpmProcessInstanceStatusEnum.REJECT.getStatus() == stata) {
|
if (Objects.equals(BpmProcessInstanceStatusEnum.REJECT.getStatus(), stata)) {
|
||||||
processInstanceStatus = BpmProcessInstanceStatusEnum.REJECT.getStatus();
|
processInstanceStatus = BpmProcessInstanceStatusEnum.REJECT.getStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -326,7 +327,7 @@ public class BpmProcessInstanceServiceImpl implements IBpmProcessInstanceService
|
|||||||
// 3. 发送流程实例的状态事件
|
// 3. 发送流程实例的状态事件
|
||||||
// 注意:此时如果去查询 ProcessInstance 的话,字段是不全的,所以去查询了 HistoricProcessInstance
|
// 注意:此时如果去查询 ProcessInstance 的话,字段是不全的,所以去查询了 HistoricProcessInstance
|
||||||
// 在审核不通过时,会触该信息,设置在审核通过时,才发送
|
// 在审核不通过时,会触该信息,设置在审核通过时,才发送
|
||||||
if (BpmProcessInstanceStatusEnum.APPROVE.getStatus() == processInstanceStatus) {
|
if (Objects.equals(BpmProcessInstanceStatusEnum.APPROVE.getStatus(), processInstanceStatus)) {
|
||||||
HistoricProcessInstance processInstance = getHistoricProcessInstance(instance.getId());
|
HistoricProcessInstance processInstance = getHistoricProcessInstance(instance.getId());
|
||||||
processInstanceEventPublisher.sendProcessInstanceResultEvent(
|
processInstanceEventPublisher.sendProcessInstanceResultEvent(
|
||||||
BpmProcessInstanceConvert.INSTANCE.buildProcessInstanceStatusEvent(this, processInstance, processInstanceStatus));
|
BpmProcessInstanceConvert.INSTANCE.buildProcessInstanceStatusEvent(this, processInstance, processInstanceStatus));
|
||||||
|
|||||||
@@ -81,8 +81,7 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
private IProcessInstanceCopyService processInstanceCopyService;
|
private IProcessInstanceCopyService processInstanceCopyService;
|
||||||
@Resource
|
@Resource
|
||||||
private IBpmModelService bpmModelService;
|
private IBpmModelService bpmModelService;
|
||||||
// @Resource
|
|
||||||
// private BpmMessageService messageService;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private UserFeignClient adminUserApi;
|
private UserFeignClient adminUserApi;
|
||||||
@@ -90,10 +89,12 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<Task> getTaskTodoPage(String userId, BpmTaskParam.BpmTaskQueryParam bpmTaskQueryParam) {
|
public PageResult<Task> getTaskTodoPage(String userId, BpmTaskParam.BpmTaskQueryParam bpmTaskQueryParam) {
|
||||||
TaskQuery taskQuery = taskService.createTaskQuery()
|
TaskQuery taskQuery = taskService.createTaskQuery()
|
||||||
.taskAssignee(userId) // 分配给自己
|
// 分配给自己
|
||||||
|
.taskAssignee(userId)
|
||||||
.active()
|
.active()
|
||||||
.includeProcessVariables()
|
.includeProcessVariables()
|
||||||
.orderByTaskCreateTime().desc(); // 创建时间倒序
|
// 创建时间倒序
|
||||||
|
.orderByTaskCreateTime().desc();
|
||||||
if (StrUtil.isNotBlank(bpmTaskQueryParam.getSearchValue())) {
|
if (StrUtil.isNotBlank(bpmTaskQueryParam.getSearchValue())) {
|
||||||
taskQuery.taskNameLike("%" + bpmTaskQueryParam.getSearchValue() + "%");
|
taskQuery.taskNameLike("%" + bpmTaskQueryParam.getSearchValue() + "%");
|
||||||
}
|
}
|
||||||
@@ -115,10 +116,12 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
@Override
|
@Override
|
||||||
public List<Task> todoAllList(String userIndex) {
|
public List<Task> todoAllList(String userIndex) {
|
||||||
TaskQuery taskQuery = taskService.createTaskQuery()
|
TaskQuery taskQuery = taskService.createTaskQuery()
|
||||||
.taskAssignee(userIndex) // 分配给自己
|
// 分配给自己
|
||||||
|
.taskAssignee(userIndex)
|
||||||
.active()
|
.active()
|
||||||
.includeProcessVariables()
|
.includeProcessVariables()
|
||||||
.orderByTaskCreateTime().desc(); // 创建时间倒序
|
// 创建时间倒序
|
||||||
|
.orderByTaskCreateTime().desc();
|
||||||
return taskQuery.list();
|
return taskQuery.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,10 +129,13 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<HistoricTaskInstance> getTaskDonePage(String userId, BpmTaskParam.BpmTaskQueryParam bpmTaskQueryParam) {
|
public PageResult<HistoricTaskInstance> getTaskDonePage(String userId, BpmTaskParam.BpmTaskQueryParam bpmTaskQueryParam) {
|
||||||
HistoricTaskInstanceQuery taskQuery = historyService.createHistoricTaskInstanceQuery()
|
HistoricTaskInstanceQuery taskQuery = historyService.createHistoricTaskInstanceQuery()
|
||||||
.finished() // 已完成
|
// 已完成
|
||||||
.taskAssignee(String.valueOf(userId)) // 分配给自己
|
.finished()
|
||||||
|
// 分配给自己
|
||||||
|
.taskAssignee(String.valueOf(userId))
|
||||||
.includeTaskLocalVariables()
|
.includeTaskLocalVariables()
|
||||||
.orderByHistoricTaskInstanceEndTime().desc(); // 审批时间倒序
|
// 审批时间倒序
|
||||||
|
.orderByHistoricTaskInstanceEndTime().desc();
|
||||||
if (StrUtil.isNotBlank(bpmTaskQueryParam.getSearchValue())) {
|
if (StrUtil.isNotBlank(bpmTaskQueryParam.getSearchValue())) {
|
||||||
taskQuery.taskNameLike("%" + bpmTaskQueryParam.getSearchValue() + "%");
|
taskQuery.taskNameLike("%" + bpmTaskQueryParam.getSearchValue() + "%");
|
||||||
}
|
}
|
||||||
@@ -327,7 +333,8 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
private void approveDelegateTask(BpmTaskApproveParam bpmTaskApproveParam, Task task) {
|
private void approveDelegateTask(BpmTaskApproveParam bpmTaskApproveParam, Task task) {
|
||||||
// 1. 添加审批意见
|
// 1. 添加审批意见
|
||||||
UserVO currentUser = adminUserApi.getUserById(RequestUtil.getUserIndex()).getData();
|
UserVO currentUser = adminUserApi.getUserById(RequestUtil.getUserIndex()).getData();
|
||||||
UserVO ownerUser = adminUserApi.getUserById(task.getOwner()).getData(); // 发起委托的用户
|
// 发起委托的用户
|
||||||
|
UserVO ownerUser = adminUserApi.getUserById(task.getOwner()).getData();
|
||||||
Assert.notNull(ownerUser, "委派任务找不到原审批人,需要检查数据");
|
Assert.notNull(ownerUser, "委派任务找不到原审批人,需要检查数据");
|
||||||
taskService.addComment(bpmTaskApproveParam.getId(), task.getProcessInstanceId(), BpmCommentTypeEnum.DELEGATE_END.getType(),
|
taskService.addComment(bpmTaskApproveParam.getId(), task.getProcessInstanceId(), BpmCommentTypeEnum.DELEGATE_END.getType(),
|
||||||
BpmCommentTypeEnum.DELEGATE_END.formatComment(currentUser.getName(), ownerUser.getName(), bpmTaskApproveParam.getReason()));
|
BpmCommentTypeEnum.DELEGATE_END.formatComment(currentUser.getName(), ownerUser.getName(), bpmTaskApproveParam.getReason()));
|
||||||
@@ -463,6 +470,8 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
// return historyService.createHistoricTaskInstanceQuery().taskId(id).includeTaskLocalVariables().singleResult();
|
// return historyService.createHistoricTaskInstanceQuery().taskId(id).includeTaskLocalVariables().singleResult();
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<UserTask> getUserTaskListByReturn(String id) {
|
public List<UserTask> getUserTaskListByReturn(String id) {
|
||||||
// 1.1 校验当前任务 task 存在
|
// 1.1 校验当前任务 task 存在
|
||||||
@@ -558,8 +567,10 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
// 3. 执行驳回
|
// 3. 执行驳回
|
||||||
runtimeService.createChangeActivityStateBuilder()
|
runtimeService.createChangeActivityStateBuilder()
|
||||||
.processInstanceId(currentTask.getProcessInstanceId())
|
.processInstanceId(currentTask.getProcessInstanceId())
|
||||||
.moveActivityIdsToSingleActivityId(returnTaskKeyList, // 当前要跳转的节点列表( 1 或多)
|
// 当前要跳转的节点列表( 1 或多)
|
||||||
bpmTaskReturnParam.getTargetTaskDefinitionKey()) // targetKey 跳转到的节点(1)
|
.moveActivityIdsToSingleActivityId(returnTaskKeyList,
|
||||||
|
// targetKey 跳转到的节点(1)
|
||||||
|
bpmTaskReturnParam.getTargetTaskDefinitionKey())
|
||||||
.changeState();
|
.changeState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -569,7 +580,8 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
String taskId = reqVO.getId();
|
String taskId = reqVO.getId();
|
||||||
// 1.1 校验任务
|
// 1.1 校验任务
|
||||||
Task task = validateTask(userId, reqVO.getId());
|
Task task = validateTask(userId, reqVO.getId());
|
||||||
if (task.getAssignee().equals(reqVO.getDelegateUserId())) { // 校验当前审批人和被委派人不是同一人
|
// 校验当前审批人和被委派人不是同一人
|
||||||
|
if (task.getAssignee().equals(reqVO.getDelegateUserId())) {
|
||||||
throw new BusinessException(BpmResponseEnum.TASK_DELEGATE_FAIL_USER_REPEAT);
|
throw new BusinessException(BpmResponseEnum.TASK_DELEGATE_FAIL_USER_REPEAT);
|
||||||
}
|
}
|
||||||
// 1.2 校验目标用户存在
|
// 1.2 校验目标用户存在
|
||||||
@@ -596,7 +608,8 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
String taskId = reqVO.getId();
|
String taskId = reqVO.getId();
|
||||||
// 1.1 校验任务
|
// 1.1 校验任务
|
||||||
Task task = validateTask(userId, reqVO.getId());
|
Task task = validateTask(userId, reqVO.getId());
|
||||||
if (task.getAssignee().equals(reqVO.getAssigneeUserId())) { // 校验当前审批人和被转派人不是同一人
|
// 校验当前审批人和被转派人不是同一人
|
||||||
|
if (task.getAssignee().equals(reqVO.getAssigneeUserId())) {
|
||||||
throw new BusinessException(BpmResponseEnum.TASK_DELEGATE_FAIL_USER_NOT_EXISTS);
|
throw new BusinessException(BpmResponseEnum.TASK_DELEGATE_FAIL_USER_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
// 1.2 校验目标用户存在
|
// 1.2 校验目标用户存在
|
||||||
@@ -614,7 +627,7 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
taskService.setOwner(taskId, task.getAssignee());
|
taskService.setOwner(taskId, task.getAssignee());
|
||||||
// 3.2 执行转派(审批人),将任务转派给 assigneeUser
|
// 3.2 执行转派(审批人),将任务转派给 assigneeUser
|
||||||
// 委托( delegate)和转派(transfer)的差别,就在这块的调用!!!!
|
// 委托( delegate)和转派(transfer)的差别,就在这块的调用!!!!
|
||||||
taskService.setAssignee(taskId, reqVO.getAssigneeUserId().toString());
|
taskService.setAssignee(taskId, reqVO.getAssigneeUserId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -34,14 +34,14 @@ public class ProcessInstanceCopyServiceImpl extends ServiceImpl<ProcessInstanceC
|
|||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@Lazy // 延迟加载,避免循环依赖
|
@Lazy
|
||||||
private IBpmTaskService taskService;
|
private IBpmTaskService taskService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@Lazy // 延迟加载,避免循环依赖
|
@Lazy
|
||||||
private IBpmProcessInstanceService processInstanceService;
|
private IBpmProcessInstanceService processInstanceService;
|
||||||
@Resource
|
@Resource
|
||||||
@Lazy // 延迟加载,避免循环依赖
|
@Lazy
|
||||||
private IBpmProcessDefinitionService processDefinitionService;
|
private IBpmProcessDefinitionService processDefinitionService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -10,13 +10,11 @@ import com.njcn.bpm.utils.CollectionUtils;
|
|||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.user.api.UserFeignClient;
|
import com.njcn.user.api.UserFeignClient;
|
||||||
import com.njcn.user.pojo.po.User;
|
|
||||||
import com.njcn.user.pojo.vo.UserVO;
|
import com.njcn.user.pojo.vo.UserVO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.flowable.bpmn.model.BpmnModel;
|
import org.flowable.bpmn.model.BpmnModel;
|
||||||
import org.flowable.bpmn.model.UserTask;
|
import org.flowable.bpmn.model.UserTask;
|
||||||
import org.flowable.engine.delegate.DelegateExecution;
|
import org.flowable.engine.delegate.DelegateExecution;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色 {@link IBpmTaskCandidateStrategy} 实现类
|
* 角色 {@link IBpmTaskCandidateStrategy} 实现类
|
||||||
@@ -21,8 +20,6 @@ public class BpmTaskCandidateRoleStrategy implements IBpmTaskCandidateStrategy {
|
|||||||
@Resource
|
@Resource
|
||||||
private UserFeignClient userFeignClient;
|
private UserFeignClient userFeignClient;
|
||||||
|
|
||||||
// @Resource
|
|
||||||
// private PermissionApi permissionApi;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BpmTaskCandidateStrategyEnum getStrategy() {
|
public BpmTaskCandidateStrategyEnum getStrategy() {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import java.util.*;
|
|||||||
public class BpmTaskCandidateStartUserSelectStrategy implements IBpmTaskCandidateStrategy {
|
public class BpmTaskCandidateStartUserSelectStrategy implements IBpmTaskCandidateStrategy {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@Lazy // 延迟加载,避免循环依赖
|
@Lazy
|
||||||
private IBpmProcessInstanceService processInstanceService;
|
private IBpmProcessInstanceService processInstanceService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.njcn.bpm.enums.BpmTaskCandidateStrategyEnum;
|
|||||||
import org.flowable.engine.delegate.DelegateExecution;
|
import org.flowable.engine.delegate.DelegateExecution;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BPM 任务的候选人的策略接口
|
* BPM 任务的候选人的策略接口
|
||||||
@@ -33,6 +32,7 @@ public interface IBpmTaskCandidateStrategy {
|
|||||||
* 基于执行任务,获得任务的候选用户们
|
* 基于执行任务,获得任务的候选用户们
|
||||||
*
|
*
|
||||||
* @param execution 执行任务
|
* @param execution 执行任务
|
||||||
|
* @param param 参数
|
||||||
* @return 用户编号集合
|
* @return 用户编号集合
|
||||||
*/
|
*/
|
||||||
List<String> calculateUsers(DelegateExecution execution, String param);
|
List<String> calculateUsers(DelegateExecution execution, String param);
|
||||||
|
|||||||
@@ -3,13 +3,10 @@ package com.njcn.bpm.utils;
|
|||||||
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.bpm.enums.BpmModelFormTypeEnum;
|
|
||||||
import com.njcn.bpm.pojo.dto.BpmModelMetaInfoRespDTO;
|
import com.njcn.bpm.pojo.dto.BpmModelMetaInfoRespDTO;
|
||||||
import com.njcn.bpm.pojo.dto.PageResult;
|
|
||||||
import com.njcn.bpm.pojo.param.BpmModelParam;
|
import com.njcn.bpm.pojo.param.BpmModelParam;
|
||||||
import com.njcn.bpm.pojo.po.BpmCategory;
|
import com.njcn.bpm.pojo.po.BpmCategory;
|
||||||
import com.njcn.bpm.pojo.po.BpmForm;
|
import com.njcn.bpm.pojo.po.BpmForm;
|
||||||
import com.njcn.bpm.pojo.po.BpmProcessDefinitionInfo;
|
|
||||||
import com.njcn.bpm.pojo.vo.BpmModelRespVO;
|
import com.njcn.bpm.pojo.vo.BpmModelRespVO;
|
||||||
import com.njcn.bpm.pojo.vo.BpmProcessDefinitionInfoVO;
|
import com.njcn.bpm.pojo.vo.BpmProcessDefinitionInfoVO;
|
||||||
import org.flowable.common.engine.impl.db.SuspensionState;
|
import org.flowable.common.engine.impl.db.SuspensionState;
|
||||||
|
|||||||
@@ -2,18 +2,12 @@ package com.njcn.bpm.utils;
|
|||||||
|
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
|
||||||
import com.njcn.bpm.pojo.dto.BpmInstanceInfo;
|
import com.njcn.bpm.pojo.dto.BpmInstanceInfo;
|
||||||
import com.njcn.bpm.pojo.dto.PageResult;
|
import com.njcn.bpm.pojo.dto.PageResult;
|
||||||
import com.njcn.bpm.pojo.po.BpmForm;
|
import com.njcn.bpm.pojo.po.BpmForm;
|
||||||
import com.njcn.bpm.pojo.vo.instance.BpmProcessInstanceVO;
|
import com.njcn.bpm.pojo.vo.instance.BpmProcessInstanceVO;
|
||||||
import com.njcn.bpm.pojo.vo.task.BpmTaskVO;
|
import com.njcn.bpm.pojo.vo.task.BpmTaskVO;
|
||||||
import com.njcn.bpm.service.IBpmService;
|
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
|
||||||
import com.njcn.supervision.api.BusinessCommonFeignClient;
|
import com.njcn.supervision.api.BusinessCommonFeignClient;
|
||||||
import com.njcn.supervision.enums.SupervisionKeyEnum;
|
|
||||||
import com.njcn.supervision.enums.SupervisionResponseEnum;
|
|
||||||
import com.njcn.user.pojo.po.Dept;
|
import com.njcn.user.pojo.po.Dept;
|
||||||
import com.njcn.user.pojo.vo.UserVO;
|
import com.njcn.user.pojo.vo.UserVO;
|
||||||
import org.flowable.engine.history.HistoricProcessInstance;
|
import org.flowable.engine.history.HistoricProcessInstance;
|
||||||
@@ -23,9 +17,7 @@ import org.flowable.task.api.history.HistoricTaskInstance;
|
|||||||
import org.flowable.task.service.impl.persistence.entity.TaskEntityImpl;
|
import org.flowable.task.service.impl.persistence.entity.TaskEntityImpl;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
import org.springframework.validation.beanvalidation.SpringValidatorAdapter;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程模型转操作工具类
|
* 流程模型转操作工具类
|
||||||
|
* @author hongawen
|
||||||
*/
|
*/
|
||||||
public class BpmnModelUtils {
|
public class BpmnModelUtils {
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,10 @@ public class JsonUtils {
|
|||||||
static {
|
static {
|
||||||
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
|
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
|
||||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); // 忽略 null 值
|
// 忽略 null 值
|
||||||
objectMapper.registerModules(new JavaTimeModule()); // 解决 LocalDateTime 的序列化
|
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||||
|
// 解决 LocalDateTime 的序列化
|
||||||
|
objectMapper.registerModules(new JavaTimeModule());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ import java.util.stream.Collectors;
|
|||||||
public class StrUtils {
|
public class StrUtils {
|
||||||
|
|
||||||
public static String maxLength(CharSequence str, int maxLength) {
|
public static String maxLength(CharSequence str, int maxLength) {
|
||||||
return StrUtil.maxLength(str, maxLength - 3); // -3 的原因,是该方法会补充 ... 恰好
|
// -3 的原因,是该方法会补充 ... 恰好
|
||||||
|
return StrUtil.maxLength(str, maxLength - 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ import com.njcn.supervision.enums.SupervisionKeyEnum;
|
|||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 实现将各类型的数据转为待办事项
|
* 实现将各类型的数据转为待办事项
|
||||||
|
* @author hongawen
|
||||||
*/
|
*/
|
||||||
public class TodoVOConvert {
|
public class TodoVOConvert {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user