Pārlūkot izejas kodu

工作流完善

wangwei 7 gadi atpakaļ
vecāks
revīzija
240d894060

+ 10 - 2
hsweb-system/hsweb-system-workflow/hsweb-system-workflow-flowable/src/main/java/org/hswebframework/web/workflow/flowable/service/BpmTaskService.java

@@ -105,13 +105,21 @@ public interface BpmTaskService{
     void reject(String taskId);
 
     /**
-     * 设置办
+     * 设置办人
      *
      * @param taskId   当前环节ID
      * @param actId   当前环节图元ID
      * @param userId 用户ID
      */
-    void setAssignee(String taskId, String actId, String userId);
+    void addCandidateUser(String taskId, String actId, String userId);
+
+    /**
+     * 设置办理人
+     *
+     * @param taskId   当前环节ID
+     * @param userId 用户ID
+     */
+    void setAssignee(String taskId, String userId);
 
     /**
      * 结束流程

+ 12 - 4
hsweb-system/hsweb-system-workflow/hsweb-system-workflow-flowable/src/main/java/org/hswebframework/web/workflow/flowable/service/imp/BpmTaskServiceImp.java

@@ -17,6 +17,7 @@ import org.hswebframework.utils.StringUtils;
 import org.hswebframework.web.NotFoundException;
 import org.hswebframework.web.entity.organizational.RelationDefineEntity;
 import org.hswebframework.web.entity.workflow.ActDefEntity;
+import org.hswebframework.web.organizational.authorization.relation.Relation;
 import org.hswebframework.web.organizational.authorization.relation.Relations;
 import org.hswebframework.web.service.organizational.RelationDefineService;
 import org.hswebframework.web.service.organizational.RelationInfoService;
@@ -259,21 +260,28 @@ public class BpmTaskServiceImp extends FlowableAbstract implements BpmTaskServic
     }
 
     @Override
-    public void setAssignee(String taskId, String actId, String userId) {
+    public void addCandidateUser(String taskId, String actId, String userId) {
         if(!StringUtils.isNullOrEmpty(actId)){
             // 获取节点配置信息
             ActDefEntity actDefEntity = actDefService.selectSingle(single(ActDefEntity.actId,actId));
             // 获取矩阵信息
             RelationDefineEntity relationDefineEntity = relationDefineService.selectByPk(actDefEntity.getDefId());
             // 获取人员信息
-            Relations relations = relationInfoService.getRelations(relationDefineEntity.getName(),userId);
+            List<Relation> relations = relationInfoService.getRelations("person",userId).findRev(relationDefineEntity.getName());
             // 设置待办人
-            taskService.setAssignee(taskId, userId);
+            for(Relation relation : relations){
+                taskService.addCandidateUser(taskId,relation.getTarget() );
+            }
         }else {
-            taskService.setAssignee(taskId, userId);
+            taskService.addCandidateUser(taskId, userId);
         }
     }
 
+    @Override
+    public void setAssignee(String taskId, String userId) {
+        taskService.setAssignee(taskId, userId);
+    }
+
     @Override
     public void endProcess(String procInstId) {
         ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(procInstId).singleResult();