From 9a8d9ef43c70fe6d70b494f49b19e5ca6ef01d4b Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期五, 14 三月 2025 17:52:46 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowDefinitionServiceImpl.java |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowDefinitionServiceImpl.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowDefinitionServiceImpl.java
index 5add0ad..edf2eb1 100644
--- a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowDefinitionServiceImpl.java
+++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowDefinitionServiceImpl.java
@@ -22,12 +22,12 @@
 import org.jeecg.common.util.SpringContextUtils;
 import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness;
 import org.jeecg.modules.flowable.apithird.business.service.impl.FlowMyBusinessServiceImpl;
+import org.jeecg.modules.flowable.apithird.common.constant.ProcessConstants;
+import org.jeecg.modules.flowable.apithird.common.enums.FlowComment;
 import org.jeecg.modules.flowable.apithird.entity.ActStatus;
 import org.jeecg.modules.flowable.apithird.entity.SysUser;
 import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI;
 import org.jeecg.modules.flowable.apithird.service.IFlowThirdService;
-import org.jeecg.modules.flowable.apithird.common.constant.ProcessConstants;
-import org.jeecg.modules.flowable.apithird.common.enums.FlowComment;
 import org.jeecg.modules.flowable.domain.dto.FlowNextDto;
 import org.jeecg.modules.flowable.domain.dto.FlowProcDefDto;
 import org.jeecg.modules.flowable.factory.FlowServiceFactory;
@@ -63,7 +63,7 @@
         ProcessDefinitionQuery processDefinitionQuery
                 = repositoryService.createProcessDefinitionQuery().processDefinitionKey(processDefinitionKey);
         long count = processDefinitionQuery.count();
-        return count > 0 ? true : false;
+        return count > 0;
     }
 
 
@@ -143,7 +143,7 @@
     public Result readXml(String deployId) throws IOException {
         ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult();
         InputStream inputStream = repositoryService.getResourceAsStream(definition.getDeploymentId(), definition.getResourceName());
-        String result = IOUtils.toString(inputStream, StandardCharsets.UTF_8.name());
+        String result = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
         return Result.OK("", result);
     }
 
@@ -156,7 +156,7 @@
         FlowMyBusiness business = flowMyBusinessService.getOne(flowMyBusinessLambdaQueryWrapper);
         ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().processDefinitionId(business.getProcessDefinitionId()).singleResult();
         InputStream inputStream = repositoryService.getResourceAsStream(definition.getDeploymentId(), definition.getResourceName());
-        String result = IOUtils.toString(inputStream, StandardCharsets.UTF_8.name());
+        String result = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
         return Result.OK("", result);
     }
 
@@ -237,11 +237,12 @@
      * @return
      */
     @Override
-    public Result startProcessInstanceByKey(String procDefKey, Map<String, Object> variables) {
+    public Result<?> startProcessInstanceByKey(String procDefKey, Map<String, Object> variables) {
         ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
                 .processDefinitionKey(procDefKey)
                 .latestVersion().singleResult();
-        return startProcessInstanceById(processDefinition.getId(),variables);
+        Result result = startProcessInstanceById(processDefinition.getId(),variables);
+        return result;
     }
     /**
      * 鏍规嵁娴佺▼瀹氫箟ID鍚姩娴佺▼瀹炰緥
@@ -252,7 +253,7 @@
      */
     @Override
     @Transactional
-    public Result startProcessInstanceById(String procDefId, Map<String, Object> variables) {
+    public Result<?> startProcessInstanceById(String procDefId, Map<String, Object> variables) {
             ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
                     .processDefinitionId(procDefId)
                     .singleResult();
@@ -268,9 +269,15 @@
             ProcessInstance processInstance = runtimeService.startProcessInstanceById(procDefId, variables);
             // 缁欑涓�姝ョ敵璇蜂汉鑺傜偣璁剧疆浠诲姟鎵ц浜哄拰鎰忚
             Task task = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).active().singleResult();
+            if (!sysUser.getUsername().equals(task.getAssignee())){
+                return Result.error("褰撳墠鐢ㄦ埛涓嶆槸娴佺▼鍙戣捣浜�");
+            }
             if (Objects.nonNull(task)) {
                 taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.NORMAL.getType(), sysUser.getRealname() + "鍙戣捣娴佺▼鐢宠");
                 taskService.setAssignee(task.getId(), sysUser.getUsername());
+                task.setDescription(variables.get("organization").toString());
+                // 鏇存柊浠诲姟
+                taskService.saveTask(task);
                 //taskService.complete(task.getId(), variables);
             }
             //璁剧疆鎵�鏈夌敵璇蜂汉

--
Gitblit v1.9.3