mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-08-15 18:51:54 +08:00
Merge branch 'master-jdk17' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into feature/bpm
# Conflicts: # yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmSimpleModelNodeType.java # yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/simple/BpmSimpleModelNodeVO.java # yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/enums/BpmnModelConstants.java # yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/BpmnModelUtils.java # yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmModelService.java # yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmSimpleModelServiceImpl.java # yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceCopyServiceImpl.java # yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmSimpleNodeService.java
This commit is contained in:
@@ -28,10 +28,6 @@
|
||||
</dependency>
|
||||
|
||||
<!-- 业务组件 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-data-permission</artifactId>
|
||||
@@ -69,6 +65,7 @@
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-excel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Flowable 工作流相关 -->
|
||||
<dependency>
|
||||
<groupId>org.flowable</groupId>
|
||||
|
@@ -1,39 +0,0 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.definition;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.simple.BpmSimpleModelNodeVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.simple.BpmSimpleModelSaveReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.service.definition.BpmSimpleModelService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
// TODO @芋艿:后续考虑下,怎么放这个 Controller
|
||||
@Tag(name = "管理后台 - BPM 仿钉钉流程设计器")
|
||||
@RestController
|
||||
@RequestMapping("/bpm/simple")
|
||||
public class BpmSimpleModelController {
|
||||
@Resource
|
||||
private BpmSimpleModelService bpmSimpleModelService;
|
||||
|
||||
@PostMapping("/save")
|
||||
@Operation(summary = "保存仿钉钉流程设计模型")
|
||||
@PreAuthorize("@ss.hasPermission('bpm:model:update')")
|
||||
public CommonResult<Boolean> saveSimpleModel(@Valid @RequestBody BpmSimpleModelSaveReqVO reqVO) {
|
||||
return success(bpmSimpleModelService.saveSimpleModel(reqVO));
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得仿钉钉流程设计模型")
|
||||
@Parameter(name = "modelId", description = "流程模型编号", required = true, example = "a2c5eee0-eb6c-11ee-abf4-0c37967c420a")
|
||||
public CommonResult<BpmSimpleModelNodeVO> getSimpleModel(@RequestParam("modelId") String modelId){
|
||||
return success(bpmSimpleModelService.getSimpleModel(modelId));
|
||||
}
|
||||
|
||||
}
|
@@ -1,23 +0,0 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.simple;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
// TODO @芋艿:或许挪到 model 里的 simple 包
|
||||
@Schema(description = "管理后台 - 仿钉钉流程设计模型的新增/修改 Request VO")
|
||||
@Data
|
||||
public class BpmSimpleModelSaveReqVO {
|
||||
|
||||
@Schema(description = "流程模型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotEmpty(message = "流程模型编号不能为空")
|
||||
private String modelId; // 对应 Flowable act_re_model 表 ID_ 字段
|
||||
|
||||
@Schema(description = "仿钉钉流程设计模型对象", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "仿钉钉流程设计模型对象不能为空")
|
||||
@Valid
|
||||
private BpmSimpleModelNodeVO simpleModelBody;
|
||||
|
||||
}
|
@@ -97,7 +97,7 @@ public class BpmTaskController {
|
||||
@GetMapping("manager-page")
|
||||
@Operation(summary = "获取全部任务的分页", description = "用于【流程任务】菜单")
|
||||
@PreAuthorize("@ss.hasPermission('bpm:task:mananger-query')")
|
||||
public CommonResult<PageResult<BpmTaskRespVO>> getDoneTaskPage(@Valid BpmTaskPageReqVO pageVO) {
|
||||
public CommonResult<PageResult<BpmTaskRespVO>> getTaskManagerPage(@Valid BpmTaskPageReqVO pageVO) {
|
||||
PageResult<HistoricTaskInstance> pageResult = taskService.getTaskPage(getLoginUserId(), pageVO);
|
||||
if (CollUtil.isEmpty(pageResult.getList())) {
|
||||
return success(PageResult.empty());
|
||||
|
@@ -53,8 +53,10 @@ public interface BpmProcessInstanceConvert {
|
||||
// user
|
||||
if (userMap != null) {
|
||||
AdminUserRespDTO startUser = userMap.get(NumberUtils.parseLong(pageResult.getList().get(i).getStartUserId()));
|
||||
respVO.setStartUser(BeanUtils.toBean(startUser, BpmProcessInstanceRespVO.User.class));
|
||||
MapUtils.findAndThen(deptMap, startUser.getDeptId(), dept -> respVO.getStartUser().setDeptName(dept.getName()));
|
||||
if (startUser != null) {
|
||||
respVO.setStartUser(BeanUtils.toBean(startUser, BpmProcessInstanceRespVO.User.class));
|
||||
MapUtils.findAndThen(deptMap, startUser.getDeptId(), dept -> respVO.getStartUser().setDeptName(dept.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return vpPageResult;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package cn.iocoder.yudao.module.bpm.dal.dataobject.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatustEnum;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
@@ -57,7 +57,7 @@ public class BpmOALeaveDO extends BaseDO {
|
||||
/**
|
||||
* 审批结果
|
||||
*
|
||||
* 枚举 {@link BpmTaskStatustEnum}
|
||||
* 枚举 {@link BpmTaskStatusEnum}
|
||||
* 考虑到简单,所以直接复用了 BpmProcessInstanceStatusEnum 枚举,也可以自己定义一个枚举哈
|
||||
*/
|
||||
private Integer status;
|
||||
|
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
@@ -77,6 +78,7 @@ public class BpmTaskCandidateInvoker {
|
||||
* @param execution 执行任务
|
||||
* @return 用户编号集合
|
||||
*/
|
||||
@DataPermission(enable = false) // 忽略数据权限,避免因为过滤,导致找不到候选人
|
||||
public Set<Long> calculateUsers(DelegateExecution execution) {
|
||||
Integer strategy = BpmnModelUtils.parseCandidateStrategy(execution.getCurrentFlowElement());
|
||||
String param = BpmnModelUtils.parseCandidateParam(execution.getCurrentFlowElement());
|
||||
|
@@ -34,6 +34,13 @@ public class BpmTaskAssignLeaderExpression {
|
||||
@Resource
|
||||
private BpmProcessInstanceService processInstanceService;
|
||||
|
||||
/**
|
||||
* 计算审批的候选人
|
||||
*
|
||||
* @param execution 流程执行实体
|
||||
* @param level 指定级别
|
||||
* @return 指定级别的领导
|
||||
*/
|
||||
public Set<Long> calculateUsers(DelegateExecution execution, int level) {
|
||||
Assert.isTrue(level > 0, "level 必须大于 0");
|
||||
// 获得发起人
|
||||
|
@@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.util.collection.SetUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -20,7 +21,13 @@ public class BpmTaskAssignStartUserExpression {
|
||||
@Resource
|
||||
private BpmProcessInstanceService processInstanceService;
|
||||
|
||||
public Set<Long> calculateUsers(org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl execution) {
|
||||
/**
|
||||
* 计算审批的候选人
|
||||
*
|
||||
* @param execution 流程执行实体
|
||||
* @return 发起人
|
||||
*/
|
||||
public Set<Long> calculateUsers(ExecutionEntityImpl execution) {
|
||||
ProcessInstance processInstance = processInstanceService.getProcessInstance(execution.getProcessInstanceId());
|
||||
Long startUserId = NumberUtils.parseLong(processInstance.getStartUserId());
|
||||
return SetUtils.asSet(startUserId);
|
||||
|
@@ -1,9 +1,9 @@
|
||||
package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
|
||||
import org.dromara.hutool.core.convert.Convert;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
|
||||
import org.flowable.engine.delegate.DelegateExecution;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@@ -1,10 +1,5 @@
|
||||
package cn.iocoder.yudao.module.bpm.framework.flowable.core.enums;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import org.flowable.bpmn.model.*;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* BPMN XML 常量信息
|
||||
*
|
||||
|
@@ -20,7 +20,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 监听 {@link org.flowable.task.api.Task} 的开始与完成
|
||||
* 监听 {@link Task} 的开始与完成
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
|
@@ -3,14 +3,12 @@ package cn.iocoder.yudao.module.bpm.framework.flowable.core.listener.demo.task;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.engine.delegate.TaskListener;
|
||||
import org.flowable.task.service.delegate.DelegateTask;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 类型为 class 的 TaskListener 监听器示例
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class DemoDelegateClassTaskListener implements TaskListener {
|
||||
|
||||
|
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.framework.flowable.core.listener.demo.task;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.task.service.delegate.DelegateTask;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 类型为 expression 的 TaskListener 监听器示例
|
||||
@@ -9,6 +10,7 @@ import org.flowable.task.service.delegate.DelegateTask;
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class DemoSpringExpressionTaskListener {
|
||||
|
||||
public void notify(DelegateTask delegateTask) {
|
||||
|
@@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.bpm.framework.flowable.core.util;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants;
|
||||
import org.flowable.bpmn.converter.BpmnXMLConverter;
|
||||
@@ -15,6 +14,7 @@ import java.util.*;
|
||||
|
||||
import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants.*;
|
||||
import static org.flowable.bpmn.constants.BpmnXMLConstants.FLOWABLE_EXTENSIONS_NAMESPACE;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 流程模型转操作工具类
|
||||
@@ -359,4 +359,5 @@ public class BpmnModelUtils {
|
||||
}
|
||||
return userTaskList;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,10 +1,12 @@
|
||||
package cn.iocoder.yudao.module.bpm.framework.flowable.core.util;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmConstants;
|
||||
import org.flowable.common.engine.api.delegate.Expression;
|
||||
import org.flowable.common.engine.api.variable.VariableContainer;
|
||||
import org.flowable.common.engine.impl.el.ExpressionManager;
|
||||
import org.flowable.common.engine.impl.identity.Authentication;
|
||||
import org.flowable.engine.ProcessEngineConfiguration;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||
import org.flowable.engine.impl.util.CommandContextUtil;
|
||||
@@ -32,6 +34,11 @@ public class FlowableUtils {
|
||||
Authentication.setAuthenticatedUserId(null);
|
||||
}
|
||||
|
||||
public static String getTenantId() {
|
||||
Long tenantId = TenantContextHolder.getTenantId();
|
||||
return tenantId != null ? String.valueOf(tenantId) : ProcessEngineConfiguration.NO_TENANT_ID;
|
||||
}
|
||||
|
||||
// ========== Execution 相关的工具方法 ==========
|
||||
|
||||
/**
|
||||
|
@@ -1,12 +1,10 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.definition;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.PageUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelPageReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelUpdateReqVO;
|
||||
@@ -15,6 +13,7 @@ import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO;
|
||||
import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelFormTypeEnum;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateInvoker;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
|
||||
import cn.iocoder.yudao.module.bpm.service.definition.dto.BpmModelMetaInfoRespDTO;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -79,7 +78,7 @@ public class BpmModelServiceImpl implements BpmModelService {
|
||||
return PageResult.empty(count);
|
||||
}
|
||||
List<Model> models = modelQuery
|
||||
.modelTenantId(TenantContextHolder.getTenantIdStr())
|
||||
.modelTenantId(FlowableUtils.getTenantId())
|
||||
.orderByCreateTime().desc()
|
||||
.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize());
|
||||
return new PageResult<>(models, count);
|
||||
@@ -100,11 +99,11 @@ public class BpmModelServiceImpl implements BpmModelService {
|
||||
// 创建流程定义
|
||||
Model model = repositoryService.newModel();
|
||||
BpmModelConvert.INSTANCE.copyToCreateModel(model, createReqVO);
|
||||
model.setTenantId(TenantContextHolder.getTenantIdStr());
|
||||
model.setTenantId(FlowableUtils.getTenantId());
|
||||
// 保存流程定义
|
||||
repositoryService.saveModel(model);
|
||||
// 保存 BPMN XML
|
||||
saveModelBpmnXml(model.getId(), StrUtil.utf8Bytes(bpmnXml));
|
||||
saveModelBpmnXml(model, bpmnXml);
|
||||
return model.getId();
|
||||
}
|
||||
|
||||
@@ -122,7 +121,7 @@ public class BpmModelServiceImpl implements BpmModelService {
|
||||
// 更新模型
|
||||
repositoryService.saveModel(model);
|
||||
// 更新 BPMN XML
|
||||
saveModelBpmnXml(model.getId(), StrUtil.utf8Bytes(updateReqVO.getBpmnXml()));
|
||||
saveModelBpmnXml(model, updateReqVO.getBpmnXml());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -237,25 +236,11 @@ public class BpmModelServiceImpl implements BpmModelService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveModelBpmnXml(String id, byte[] xmlBytes) {
|
||||
if (ArrayUtil.isEmpty(xmlBytes)) {
|
||||
private void saveModelBpmnXml(Model model, String bpmnXml) {
|
||||
if (StrUtil.isEmpty(bpmnXml)) {
|
||||
return;
|
||||
}
|
||||
repositoryService.addModelEditorSource(id, xmlBytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getModelSimpleJson(String id) {
|
||||
return repositoryService.getModelEditorSourceExtra(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveModelSimpleJson(String id, byte[] jsonBytes) {
|
||||
if (ArrayUtil.isEmpty(jsonBytes)) {
|
||||
return;
|
||||
}
|
||||
repositoryService.addModelEditorSourceExtra(id, jsonBytes);
|
||||
repositoryService.addModelEditorSource(model.getId(), StrUtil.utf8Bytes(bpmnXml));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -5,12 +5,12 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.PageUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionPageReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.definition.BpmProcessDefinitionInfoMapper;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
|
||||
import cn.iocoder.yudao.module.bpm.service.definition.dto.BpmModelMetaInfoRespDTO;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -109,7 +109,7 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
|
||||
Deployment deploy = repositoryService.createDeployment()
|
||||
.key(model.getKey()).name(model.getName()).category(model.getCategory())
|
||||
.addBytes(model.getKey() + BpmnModelConstants.BPMN_FILE_SUFFIX, bpmnBytes)
|
||||
.tenantId(TenantContextHolder.getTenantIdStr())
|
||||
.tenantId(FlowableUtils.getTenantId())
|
||||
.disableSchemaValidation() // 禁用 XML Schema 验证,因为有自定义的属性
|
||||
.deploy();
|
||||
|
||||
@@ -195,7 +195,7 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
|
||||
query.active();
|
||||
}
|
||||
// 执行查询
|
||||
query.processDefinitionTenantId(TenantContextHolder.getTenantIdStr());
|
||||
query.processDefinitionTenantId(FlowableUtils.getTenantId());
|
||||
return query.list();
|
||||
}
|
||||
|
||||
|
@@ -1,29 +0,0 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.definition;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.simple.BpmSimpleModelNodeVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.simple.BpmSimpleModelSaveReqVO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
/**
|
||||
* 仿钉钉流程设计 Service 接口
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
public interface BpmSimpleModelService {
|
||||
|
||||
/**
|
||||
* 保存仿钉钉流程设计模型
|
||||
*
|
||||
* @param reqVO 请求信息
|
||||
*/
|
||||
Boolean saveSimpleModel(@Valid BpmSimpleModelSaveReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 获取仿钉钉流程设计模型结构
|
||||
*
|
||||
* @param modelId 流程模型编号
|
||||
* @return 仿钉钉流程设计模型结构
|
||||
*/
|
||||
BpmSimpleModelNodeVO getSimpleModel(String modelId);
|
||||
|
||||
}
|
@@ -9,7 +9,7 @@ import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.BpmOALeaveCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.BpmOALeavePageReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOALeaveDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOALeaveMapper;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatustEnum;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -48,7 +48,7 @@ public class BpmOALeaveServiceImpl implements BpmOALeaveService {
|
||||
// 插入 OA 请假单
|
||||
long day = LocalDateTimeUtil.between(createReqVO.getStartTime(), createReqVO.getEndTime()).toDays();
|
||||
BpmOALeaveDO leave = BeanUtils.toBean(createReqVO, BpmOALeaveDO.class)
|
||||
.setUserId(userId).setDay(day).setStatus(BpmTaskStatustEnum.RUNNING.getStatus());
|
||||
.setUserId(userId).setDay(day).setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
|
||||
leaveMapper.insert(leave);
|
||||
|
||||
// 发起 BPM 流程
|
||||
|
@@ -17,11 +17,9 @@ public interface BpmProcessInstanceCopyService {
|
||||
* 流程实例的抄送
|
||||
*
|
||||
* @param userIds 抄送的用户编号
|
||||
* @param processInstanceId 流程编号
|
||||
* @param taskId 任务编号
|
||||
* @param taskName 任务名称
|
||||
* @param taskId 流程任务编号
|
||||
*/
|
||||
void createProcessInstanceCopy(Collection<Long> userIds, String processInstanceId, String taskId, String taskName);
|
||||
void createProcessInstanceCopy(Collection<Long> userIds, String taskId);
|
||||
|
||||
/**
|
||||
* 获得抄送的流程的分页
|
||||
|
File diff suppressed because one or more lines are too long
@@ -17,7 +17,7 @@ import cn.iocoder.yudao.module.bpm.convert.task.BpmTaskConvert;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmCommentTypeEnum;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmDeleteReasonEnum;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskSignTypeEnum;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatustEnum;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmConstants;
|
||||
import cn.iocoder.yudao.module.bpm.service.definition.BpmModelService;
|
||||
import cn.iocoder.yudao.module.bpm.service.message.BpmMessageService;
|
||||
@@ -134,6 +134,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
public PageResult<HistoricTaskInstance> getTaskPage(Long userId, BpmTaskPageReqVO pageVO) {
|
||||
HistoricTaskInstanceQuery taskQuery = historyService.createHistoricTaskInstanceQuery()
|
||||
.includeTaskLocalVariables()
|
||||
.taskTenantId(FlowableUtils.getTenantId())
|
||||
.orderByHistoricTaskInstanceEndTime().desc(); // 审批时间倒序
|
||||
if (StrUtil.isNotBlank(pageVO.getName())) {
|
||||
taskQuery.taskNameLike("%" + pageVO.getName() + "%");
|
||||
@@ -185,8 +186,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
|
||||
// 2. 抄送用户
|
||||
if (CollUtil.isNotEmpty(reqVO.getCopyUserIds())) {
|
||||
processInstanceCopyService.createProcessInstanceCopy(reqVO.getCopyUserIds(), instance.getProcessInstanceId(),
|
||||
reqVO.getId(), task.getName());
|
||||
processInstanceCopyService.createProcessInstanceCopy(reqVO.getCopyUserIds(), reqVO.getId());
|
||||
}
|
||||
|
||||
// 情况一:被委派的任务,不调用 complete 去完成任务
|
||||
@@ -203,7 +203,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
|
||||
// 情况三:审批普通的任务。大多数情况下,都是这样
|
||||
// 3.1 更新 task 状态、原因
|
||||
updateTaskStatusAndReason(task.getId(), BpmTaskStatustEnum.APPROVE.getStatus(), reqVO.getReason());
|
||||
updateTaskStatusAndReason(task.getId(), BpmTaskStatusEnum.APPROVE.getStatus(), reqVO.getReason());
|
||||
// 3.2 添加评论
|
||||
taskService.addComment(task.getId(), task.getProcessInstanceId(), BpmCommentTypeEnum.APPROVE.getType(),
|
||||
BpmCommentTypeEnum.APPROVE.formatComment(reqVO.getReason()));
|
||||
@@ -231,14 +231,14 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
*/
|
||||
private void approveAfterSignTask(Task task, BpmTaskApproveReqVO reqVO) {
|
||||
// 更新父 task 状态 + 原因
|
||||
updateTaskStatusAndReason(task.getId(), BpmTaskStatustEnum.APPROVING.getStatus(), reqVO.getReason());
|
||||
updateTaskStatusAndReason(task.getId(), BpmTaskStatusEnum.APPROVING.getStatus(), reqVO.getReason());
|
||||
|
||||
// 2. 激活子任务
|
||||
List<Task> childrenTaskList = getTaskListByParentTaskId(task.getId());
|
||||
for (Task childrenTask : childrenTaskList) {
|
||||
taskService.resolveTask(childrenTask.getId());
|
||||
// 更新子 task 状态
|
||||
updateTaskStatus(childrenTask.getId(), BpmTaskStatustEnum.RUNNING.getStatus());
|
||||
updateTaskStatus(childrenTask.getId(), BpmTaskStatusEnum.RUNNING.getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
// 1.2 只处理加签的父任务
|
||||
Task parentTask = validateTaskExist(parentTaskId);
|
||||
String scopeType = parentTask.getScopeType();
|
||||
if (BpmTaskSignTypeEnum.of(scopeType) == null){
|
||||
if (BpmTaskSignTypeEnum.of(scopeType) == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -276,17 +276,17 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
// 3.1.1 owner 重新赋值给父任务的 assignee,这样它就可以被审批
|
||||
taskService.resolveTask(parentTaskId);
|
||||
// 3.1.2 更新流程任务 status
|
||||
updateTaskStatus(parentTaskId, BpmTaskStatustEnum.RUNNING.getStatus());
|
||||
updateTaskStatus(parentTaskId, BpmTaskStatusEnum.RUNNING.getStatus());
|
||||
// 3.2 情况二:处理向【向后】加签
|
||||
} else if (BpmTaskSignTypeEnum.AFTER.getType().equals(scopeType)) {
|
||||
// 只有 parentTask 处于 APPROVING 的情况下,才可以继续 complete 完成
|
||||
// 否则,一个未审批的 parentTask 任务,在加签出来的任务都被减签的情况下,就直接完成审批,这样会存在问题
|
||||
Integer status = (Integer) parentTask.getTaskLocalVariables().get(BpmConstants.TASK_VARIABLE_STATUS);
|
||||
if (ObjectUtil.notEqual(status, BpmTaskStatustEnum.APPROVING.getStatus())) {
|
||||
if (ObjectUtil.notEqual(status, BpmTaskStatusEnum.APPROVING.getStatus())) {
|
||||
return;
|
||||
}
|
||||
// 3.2.2 完成自己(因为它已经没有子任务,所以也可以完成)
|
||||
updateTaskStatus(parentTaskId, BpmTaskStatustEnum.APPROVE.getStatus());
|
||||
updateTaskStatus(parentTaskId, BpmTaskStatusEnum.APPROVE.getStatus());
|
||||
taskService.complete(parentTaskId);
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
// 底层调用 TaskHelper.changeTaskAssignee(task, task.getOwner()):将 owner 设置为 assignee
|
||||
taskService.resolveTask(task.getId());
|
||||
// 2.2 更新 task 状态 + 原因
|
||||
updateTaskStatusAndReason(task.getId(), BpmTaskStatustEnum.RUNNING.getStatus(), reqVO.getReason());
|
||||
updateTaskStatusAndReason(task.getId(), BpmTaskStatusEnum.RUNNING.getStatus(), reqVO.getReason());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -327,7 +327,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
}
|
||||
|
||||
// 2.1 更新流程实例为不通过
|
||||
updateTaskStatusAndReason(task.getId(), BpmTaskStatustEnum.REJECT.getStatus(), reqVO.getReason());
|
||||
updateTaskStatusAndReason(task.getId(), BpmTaskStatusEnum.REJECT.getStatus(), reqVO.getReason());
|
||||
// 2.2 添加评论
|
||||
taskService.addComment(task.getId(), task.getProcessInstanceId(), BpmCommentTypeEnum.REJECT.getType(),
|
||||
BpmCommentTypeEnum.REJECT.formatComment(reqVO.getReason()));
|
||||
@@ -379,7 +379,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
log.error("[updateTaskStatusWhenCreated][taskId({}) 已经有状态({})]", task.getId(), status);
|
||||
return;
|
||||
}
|
||||
updateTaskStatus(task.getId(), BpmTaskStatustEnum.RUNNING.getStatus());
|
||||
updateTaskStatus(task.getId(), BpmTaskStatusEnum.RUNNING.getStatus());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -393,11 +393,11 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
|
||||
// 2. 更新 task 状态 + 原因
|
||||
Integer status = (Integer) task.getTaskLocalVariables().get(BpmConstants.TASK_VARIABLE_STATUS);
|
||||
if (BpmTaskStatustEnum.isEndStatus(status)) {
|
||||
if (BpmTaskStatusEnum.isEndStatus(status)) {
|
||||
log.error("[updateTaskStatusWhenCanceled][taskId({}) 处于结果({}),无需进行更新]", taskId, status);
|
||||
return;
|
||||
}
|
||||
updateTaskStatusAndReason(taskId, BpmTaskStatustEnum.CANCEL.getStatus(), BpmDeleteReasonEnum.CANCEL_BY_SYSTEM.getReason());
|
||||
updateTaskStatusAndReason(taskId, BpmTaskStatusEnum.CANCEL.getStatus(), BpmDeleteReasonEnum.CANCEL_BY_SYSTEM.getReason());
|
||||
// 补充说明:由于 Task 被删除成 HistoricTask 后,无法通过 taskService.addComment 添加理由,所以无法存储具体的取消理由
|
||||
}
|
||||
|
||||
@@ -526,7 +526,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
taskService.addComment(task.getId(), currentTask.getProcessInstanceId(), BpmCommentTypeEnum.RETURN.getType(),
|
||||
BpmCommentTypeEnum.RETURN.formatComment(reqVO.getReason()));
|
||||
// 2.2 更新 task 状态 + 原因
|
||||
updateTaskStatusAndReason(task.getId(), BpmTaskStatustEnum.RETURN.getStatus(), reqVO.getReason());
|
||||
updateTaskStatusAndReason(task.getId(), BpmTaskStatusEnum.RETURN.getStatus(), reqVO.getReason());
|
||||
});
|
||||
|
||||
// 3. 执行驳回
|
||||
@@ -563,7 +563,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
taskService.delegateTask(taskId, reqVO.getDelegateUserId().toString());
|
||||
// 3.3 更新 task 状态。
|
||||
// 为什么不更新原因?因为原因目前主要给审批通过、不通过时使用
|
||||
updateTaskStatus(taskId, BpmTaskStatustEnum.DELEGATE.getStatus());
|
||||
updateTaskStatus(taskId, BpmTaskStatusEnum.DELEGATE.getStatus());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -617,7 +617,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
taskService.saveTask(taskEntity);
|
||||
// 2.6 更新 task 状态为 WAIT,只有在向前加签的时候
|
||||
if (reqVO.getType().equals(BpmTaskSignTypeEnum.BEFORE.getType())) {
|
||||
updateTaskStatus(taskEntity.getId(), BpmTaskStatustEnum.WAIT.getStatus());
|
||||
updateTaskStatus(taskEntity.getId(), BpmTaskStatusEnum.WAIT.getStatus());
|
||||
}
|
||||
|
||||
// 3. 创建加签任务
|
||||
@@ -704,7 +704,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
|
||||
// 3. 向后前签,设置子任务的状态为 WAIT,因为需要等父任务审批完
|
||||
if (BpmTaskSignTypeEnum.AFTER.getType().equals(parentTask.getScopeType())) {
|
||||
updateTaskStatus(task.getId(), BpmTaskStatustEnum.WAIT.getStatus());
|
||||
updateTaskStatus(task.getId(), BpmTaskStatusEnum.WAIT.getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -728,8 +728,8 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
childTaskList.add(task);
|
||||
// 2.2 更新子任务为已取消
|
||||
String cancelReason = StrUtil.format("任务被取消,原因:由于[{}]操作[减签],", cancelUser.getNickname());
|
||||
childTaskList.forEach(childTask -> updateTaskStatusAndReason(childTask.getId(), BpmTaskStatustEnum.CANCEL.getStatus(), cancelReason));
|
||||
// 2.2 删除任务和所有子任务
|
||||
childTaskList.forEach(childTask -> updateTaskStatusAndReason(childTask.getId(), BpmTaskStatusEnum.CANCEL.getStatus(), cancelReason));
|
||||
// 2.3 删除任务和所有子任务
|
||||
taskService.deleteTasks(convertList(childTaskList, Task::getId));
|
||||
|
||||
// 3. 记录日志到父任务中。先记录日志是因为,通过 handleParentTask 方法之后,任务可能被完成了,并且不存在了,会报异常,所以先记录
|
||||
|
@@ -32,8 +32,6 @@ mybatis-plus:
|
||||
|
||||
# Lock4j 配置项(单元测试,禁用 Lock4j)
|
||||
|
||||
# Resilience4j 配置项
|
||||
|
||||
--- #################### 监控相关配置 ####################
|
||||
|
||||
--- #################### 芋道相关配置 ####################
|
||||
|
Reference in New Issue
Block a user