【同步】BPM:合并 master-jdk17 代码

This commit is contained in:
YunaiV 2024-05-19 11:18:30 +08:00
parent 51917c7413
commit b65ccd769f
11 changed files with 135 additions and 15 deletions

View File

@ -16,7 +16,7 @@
<module>yudao-module-system</module>
<module>yudao-module-infra</module>
<!-- <module>yudao-module-member</module>-->
<!-- <module>yudao-module-bpm</module>-->
<module>yudao-module-bpm</module>
<!-- <module>yudao-module-report</module>-->
<!-- <module>yudao-module-mp</module>-->
<!-- <module>yudao-module-pay</module>-->

View File

@ -75,4 +75,8 @@ public interface ErrorCodeConstants {
// ========== BPM 流程表达式 1-009-014-000 ==========
ErrorCode PROCESS_EXPRESSION_NOT_EXISTS = new ErrorCode(1_009_014_000, "流程表达式不存在");
// ========== BPM 仿钉钉流程设计器 1-009-015-000 ==========
// TODO @芋艿这个错误码需要关注下
ErrorCode CONVERT_TO_SIMPLE_MODEL_NOT_SUPPORT = new ErrorCode(1_009_015_000, "该流程模型不支持仿钉钉设计流程");
}

View File

@ -0,0 +1,39 @@
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));
}
}

View File

@ -0,0 +1,23 @@
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;
}

View File

@ -1,5 +1,12 @@
package cn.iocoder.yudao.module.bpm.framework.flowable.core.enums;
import com.google.common.collect.ImmutableSet;
import org.flowable.bpmn.model.EndEvent;
import org.flowable.bpmn.model.FlowNode;
import org.flowable.bpmn.model.UserTask;
import java.util.Set;
/**
* BPMN XML 常量信息
*

View File

@ -3,6 +3,7 @@ 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;
@ -14,7 +15,6 @@ 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.*;
/**
* 流程模型转操作工具类

View File

@ -1,5 +1,6 @@
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;
@ -103,7 +104,7 @@ public class BpmModelServiceImpl implements BpmModelService {
// 保存流程定义
repositoryService.saveModel(model);
// 保存 BPMN XML
saveModelBpmnXml(model, bpmnXml);
saveModelBpmnXml(model.getId(), StrUtil.utf8Bytes(bpmnXml));
return model.getId();
}
@ -121,7 +122,7 @@ public class BpmModelServiceImpl implements BpmModelService {
// 更新模型
repositoryService.saveModel(model);
// 更新 BPMN XML
saveModelBpmnXml(model, updateReqVO.getBpmnXml());
saveModelBpmnXml(model.getId(), StrUtil.utf8Bytes(updateReqVO.getBpmnXml()));
}
@Override
@ -236,11 +237,25 @@ public class BpmModelServiceImpl implements BpmModelService {
}
}
private void saveModelBpmnXml(Model model, String bpmnXml) {
if (StrUtil.isEmpty(bpmnXml)) {
@Override
public void saveModelBpmnXml(String id, byte[] xmlBytes) {
if (ArrayUtil.isEmpty(xmlBytes)) {
return;
}
repositoryService.addModelEditorSource(model.getId(), StrUtil.utf8Bytes(bpmnXml));
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);
}
/**

View File

@ -0,0 +1,29 @@
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);
}

View File

@ -17,9 +17,11 @@ public interface BpmProcessInstanceCopyService {
* 流程实例的抄送
*
* @param userIds 抄送的用户编号
* @param taskId 流程任务编号
* @param processInstanceId 流程编号
* @param taskId 任务编号
* @param taskName 任务名称
*/
void createProcessInstanceCopy(Collection<Long> userIds, String taskId);
void createProcessInstanceCopy(Collection<Long> userIds, String processInstanceId, String taskId, String taskName);
/**
* 获得抄送的流程的分页

View File

@ -186,7 +186,8 @@ public class BpmTaskServiceImpl implements BpmTaskService {
// 2. 抄送用户
if (CollUtil.isNotEmpty(reqVO.getCopyUserIds())) {
processInstanceCopyService.createProcessInstanceCopy(reqVO.getCopyUserIds(), reqVO.getId());
processInstanceCopyService.createProcessInstanceCopy(reqVO.getCopyUserIds(), instance.getProcessInstanceId(),
reqVO.getId(), task.getName());
}
// 情况一被委派的任务不调用 complete 去完成任务

View File

@ -46,11 +46,11 @@
<!-- <version>${revision}</version>-->
<!-- </dependency>-->
<!-- 工作流。默认注释,保证编译速度 -->
<!-- <dependency>-->
<!-- <groupId>cn.iocoder.boot</groupId>-->
<!-- <artifactId>yudao-module-bpm-biz</artifactId>-->
<!-- <version>${revision}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-bpm-biz</artifactId>
<version>${revision}</version>
</dependency>
<!-- 支付服务。默认注释,保证编译速度 -->
<!-- <dependency>-->
<!-- <groupId>cn.iocoder.boot</groupId>-->