diff --git a/pom.xml b/pom.xml
index e770c0359..beb8a071b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,7 +16,7 @@
yudao-module-system
yudao-module-infra
-
+ yudao-module-bpm
diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/ErrorCodeConstants.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/ErrorCodeConstants.java
index ec167719c..e344a2145 100644
--- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/ErrorCodeConstants.java
+++ b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/ErrorCodeConstants.java
@@ -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, "该流程模型不支持仿钉钉设计流程");
+
}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmSimpleModelController.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmSimpleModelController.java
new file mode 100644
index 000000000..2f88c6b6d
--- /dev/null
+++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmSimpleModelController.java
@@ -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 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 getSimpleModel(@RequestParam("modelId") String modelId){
+ return success(bpmSimpleModelService.getSimpleModel(modelId));
+ }
+
+}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/simple/BpmSimpleModelSaveReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/simple/BpmSimpleModelSaveReqVO.java
new file mode 100644
index 000000000..54e0191d5
--- /dev/null
+++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/simple/BpmSimpleModelSaveReqVO.java
@@ -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;
+
+}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/enums/BpmnModelConstants.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/enums/BpmnModelConstants.java
index e21ba876b..f26890c9a 100644
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/enums/BpmnModelConstants.java
+++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/enums/BpmnModelConstants.java
@@ -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 常量信息
*
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/BpmnModelUtils.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/BpmnModelUtils.java
index 923c51fa6..e0b2d02b9 100644
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/BpmnModelUtils.java
+++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/BpmnModelUtils.java
@@ -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.*;
/**
* 流程模型转操作工具类
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmModelServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmModelServiceImpl.java
index abfa0d568..9a12b7acd 100644
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmModelServiceImpl.java
+++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmModelServiceImpl.java
@@ -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);
}
/**
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmSimpleModelService.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmSimpleModelService.java
new file mode 100644
index 000000000..9edaa4aa7
--- /dev/null
+++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmSimpleModelService.java
@@ -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);
+
+}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceCopyService.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceCopyService.java
index bd84490e8..94df76d4d 100644
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceCopyService.java
+++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceCopyService.java
@@ -17,9 +17,11 @@ public interface BpmProcessInstanceCopyService {
* 流程实例的抄送
*
* @param userIds 抄送的用户编号
- * @param taskId 流程任务编号
+ * @param processInstanceId 流程编号
+ * @param taskId 任务编号
+ * @param taskName 任务名称
*/
- void createProcessInstanceCopy(Collection userIds, String taskId);
+ void createProcessInstanceCopy(Collection userIds, String processInstanceId, String taskId, String taskName);
/**
* 获得抄送的流程的分页
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
index aa5326ddd..c18ea5398 100644
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
+++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
@@ -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 去完成任务
diff --git a/yudao-server/pom.xml b/yudao-server/pom.xml
index bc850b590..e5b816b9b 100644
--- a/yudao-server/pom.xml
+++ b/yudao-server/pom.xml
@@ -46,11 +46,11 @@
-
-
-
-
-
+
+ cn.iocoder.boot
+ yudao-module-bpm-biz
+ ${revision}
+