ソースを参照

完善工作流的注释

YunaiV 2 年 前
コミット
b0cdfd7afc

+ 0 - 1
sql/mysql/ruoyi-vue-pro.sql

@@ -431,7 +431,6 @@ CREATE TABLE `bpm_task_ext`  (
   `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
   `assignee_user_id` bigint NULL DEFAULT NULL COMMENT '任务的审批人',
   `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '任务的名字',
-  `task_def_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '流程任务key',
   `task_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务的编号',
   `result` tinyint NOT NULL COMMENT '任务的结果',
   `reason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '审批建议',

+ 1 - 0
yudao-framework/yudao-spring-boot-starter-biz-weixin/pom.xml

@@ -14,6 +14,7 @@
     <name>${project.artifactId}</name>
     <description>微信拓展
         1. 基于 weixin-java-mp 库,对接微信公众号平台。目前主要解决微信公众号的支付场景。
+        2. 基于 weixin-java-miniapp 库,对接微信小程序。目前主要解决微信小程序的一键登录场景。
     </description>
     <url>https://github.com/YunaiV/ruoyi-vue-pro</url>
 

+ 1 - 0
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmProcessInstanceController.java

@@ -22,6 +22,7 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti
 @RequestMapping("/bpm/process-instance")
 @Validated
 public class BpmProcessInstanceController {
+
     @Resource
     private BpmProcessInstanceService processInstanceService;
 

+ 4 - 5
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmFormServiceImpl.java

@@ -1,6 +1,8 @@
 package cn.iocoder.yudao.module.bpm.service.definition;
 
 import cn.hutool.core.lang.Assert;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
 import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
 import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormCreateReqVO;
 import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormPageReqVO;
@@ -11,9 +13,6 @@ import cn.iocoder.yudao.module.bpm.dal.mysql.definition.BpmFormMapper;
 import cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants;
 import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelFormTypeEnum;
 import cn.iocoder.yudao.module.bpm.service.definition.dto.BpmFormFieldRespDTO;
-import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
 import cn.iocoder.yudao.module.bpm.service.definition.dto.BpmModelMetaInfoRespDTO;
 import org.springframework.stereotype.Service;
 import org.springframework.validation.annotation.Validated;
@@ -66,7 +65,7 @@ public class BpmFormServiceImpl implements BpmFormService {
 
     private void validateFormExists(Long id) {
         if (formMapper.selectById(id) == null) {
-            throw ServiceExceptionUtil.exception(ErrorCodeConstants.FORM_NOT_EXISTS);
+            throw exception(ErrorCodeConstants.FORM_NOT_EXISTS);
         }
     }
 
@@ -129,7 +128,7 @@ public class BpmFormServiceImpl implements BpmFormService {
                 continue;
             }
             // 如果存在,则报错
-            throw ServiceExceptionUtil.exception(ErrorCodeConstants.FORM_FIELD_REPEAT, oldLabel, fieldDTO.getLabel(), fieldDTO.getVModel());
+            throw exception(ErrorCodeConstants.FORM_FIELD_REPEAT, oldLabel, fieldDTO.getLabel(), fieldDTO.getVModel());
         }
     }
 

+ 14 - 13
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmModelServiceImpl.java

@@ -99,7 +99,7 @@ public class BpmModelServiceImpl implements BpmModelService {
     public String createModel(@Valid BpmModelCreateReqVO createReqVO, String bpmnXml) {
         checkKeyNCName(createReqVO.getKey());
         // 校验流程标识已经存在
-        Model keyModel = this.getModelByKey(createReqVO.getKey());
+        Model keyModel = getModelByKey(createReqVO.getKey());
         if (keyModel != null) {
             throw exception(MODEL_KEY_EXISTS, createReqVO.getKey());
         }
@@ -151,42 +151,43 @@ public class BpmModelServiceImpl implements BpmModelService {
     @Override
     @Transactional(rollbackFor = Exception.class) // 因为进行多个操作,所以开启事务
     public void deployModel(String id) {
-        // 校验流程模型存在
+        // 1.1 校验流程模型存在
         Model model = repositoryService.getModel(id);
         if (ObjectUtils.isEmpty(model)) {
             throw exception(MODEL_NOT_EXISTS);
         }
-        // 校验流程图
+        // 1.2 校验流程图
+        // TODO 芋艿:校验流程图的有效性;例如说,是否有开始的元素,是否有结束的元素;
         byte[] bpmnBytes = repositoryService.getModelEditorSource(model.getId());
         if (bpmnBytes == null) {
             throw exception(MODEL_NOT_EXISTS);
         }
-        // TODO 芋艿:校验流程图的有效性;例如说,是否有开始的元素,是否有结束的元素;
-        // 校验表单已配
+        // 1.3 校验表单已配
         BpmFormDO form = checkFormConfig(model.getMetaInfo());
-        //校验任务分配规则已配置
+        // 1.4 校验任务分配规则已配置
         taskAssignRuleService.checkTaskAssignRuleAllConfig(id);
 
+        // 1.5 校验模型是否发生修改。如果未修改,则不允许创建
         BpmProcessDefinitionCreateReqDTO definitionCreateReqDTO = BpmModelConvert.INSTANCE.convert2(model, form).setBpmnBytes(bpmnBytes);
-        //校验模型是否发生修改。如果未修改,则不允许创建
         if (processDefinitionService.isProcessDefinitionEquals(definitionCreateReqDTO)) { // 流程定义的信息相等
-            ProcessDefinition oldProcessInstance = processDefinitionService.getProcessDefinitionByDeploymentId(model.getDeploymentId());
-            if (oldProcessInstance != null && taskAssignRuleService.isTaskAssignRulesEquals(model.getId(), oldProcessInstance.getId())) {
+            ProcessDefinition oldProcessDefinition = processDefinitionService.getProcessDefinitionByDeploymentId(model.getDeploymentId());
+            if (oldProcessDefinition != null && taskAssignRuleService.isTaskAssignRulesEquals(model.getId(), oldProcessDefinition.getId())) {
                 throw exception(MODEL_DEPLOY_FAIL_TASK_INFO_EQUALS);
             }
         }
-        // 创建流程定义
+
+        // 2.1 创建流程定义
         String definitionId = processDefinitionService.createProcessDefinition(definitionCreateReqDTO);
 
-        // 将老的流程定义进行挂起。也就是说,只有最新部署的流程定义,才可以发起任务。
+        // 2.2 将老的流程定义进行挂起。也就是说,只有最新部署的流程定义,才可以发起任务。
         updateProcessDefinitionSuspended(model.getDeploymentId());
 
-        // 更新 model 的 deploymentId,进行关联
+        // 2.3 更新 model 的 deploymentId,进行关联
         ProcessDefinition definition = processDefinitionService.getProcessDefinition(definitionId);
         model.setDeploymentId(definition.getDeploymentId());
         repositoryService.saveModel(model);
 
-        //复制任务分配规则
+        // 2.4 复制任务分配规则
         taskAssignRuleService.copyTaskAssignRules(id, definition.getId());
     }
 

+ 3 - 4
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmProcessDefinitionServiceImpl.java

@@ -127,7 +127,8 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
                 .deploy();
 
         // 设置 ProcessDefinition 的 category 分类
-        ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deploy.getId()).singleResult();
+        ProcessDefinition definition = repositoryService.createProcessDefinitionQuery()
+                .deploymentId(deploy.getId()).singleResult();
         repositoryService.setProcessDefinitionCategory(definition.getId(), createReqDTO.getCategory());
         // 注意 1,ProcessDefinition 的 key 和 name 是通过 BPMN 中的 <bpmn2:process /> 的 id 和 name 决定
         // 注意 2,目前该项目的设计上,需要保证 Model、Deployment、ProcessDefinition 使用相同的 key,保证关联性。
@@ -198,7 +199,7 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
         // 校验 BPMN XML 信息
         BpmnModel newModel = buildBpmnModel(createReqDTO.getBpmnBytes());
         BpmnModel oldModel = getBpmnModel(oldProcessDefinition.getId());
-        //TODO  貌似 flowable 不修改这个也不同。需要看看。 sourceSystemId 不同
+        // TODO  貌似 flowable 不修改这个也不同。需要看看。 sourceSystemId 不同
         if (FlowableUtils.equals(oldModel, newModel)) {
             return false;
         }
@@ -218,8 +219,6 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
         return converter.convertToBpmnModel(new BytesStreamSource(bpmnBytes), true, true);
     }
 
-
-
     @Override
     public BpmProcessDefinitionExtDO getProcessDefinitionExt(String id) {
         return processDefinitionMapper.selectByProcessDefinitionId(id);

+ 1 - 26
yudao-ui-admin/src/views/bpm/processInstance/detail.vue

@@ -35,7 +35,7 @@
       <el-col v-if="this.processInstance.processDefinition && this.processInstance.processDefinition.formType === 10"
               :span="16" :offset="6">
         <div >
-          <parser :key="new Date().getTime()" :form-conf="detailForm" @submit="submitForm" />
+          <parser :key="new Date().getTime()" :form-conf="detailForm" />
         </div>
       </el-col>
       <div v-if="this.processInstance.processDefinition && this.processInstance.processDefinition.formType === 20">
@@ -290,31 +290,6 @@ export default {
         // 这里暂时无需加载流程图,因为跳出到另外个 Tab;
       }
     },
-    /** 提交按钮 */
-    submitForm(params) {
-      if (!params) {
-        return;
-      }
-      // 设置表单禁用
-      const conf = params.conf;
-      conf.disabled = true; // 表单禁用
-      conf.formBtns = false; // 按钮隐藏
-
-      // 提交表单,创建流程
-      const variables = params.values;
-      createProcessInstance({
-        processDefinitionId: this.selectProcessInstance.id,
-        variables: variables
-      }).then(response => {
-        this.$modal.msgSuccess("发起流程成功");
-        // 关闭当前窗口
-        this.$tab.closeOpenPage();
-        this.$router.go(-1);
-      }).catch(() => {
-        conf.disabled = false; // 表单开启
-        conf.formBtns = true; // 按钮展示
-      })
-    },
     getDateStar(ms) {
       return getDate(ms);
     },