jihs 3 năm trước cách đây
mục cha
commit
cd8aec1f32

+ 3 - 0
jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/system/api/ISysBaseAPI.java

@@ -271,4 +271,7 @@ public interface ISysBaseAPI {
 	 */
 	public String upload(MultipartFile file,String bizPath,String uploadType);
 
+
+	public List<String> getDepartById(String id);
+
 }

+ 14 - 0
jeecg-boot/jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/service/Impl/ActZprocessServiceImpl.java

@@ -258,6 +258,20 @@ public class ActZprocessServiceImpl extends ServiceImpl<ActZprocessMapper, ActZp
                 users.addAll(collect);
             }
         }
+
+
+        //根据当前用户配置负责人
+        if(actNodeService.hasChooseDepHeader2(nodeId)){
+            List<LoginUser> allUser = actNodeService.queryAllUser();
+            LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            List<String> departIds = sysBaseAPI.getDepartById(user.getId());
+            for (String departId : departIds) {
+                List<LoginUser> collect = allUser.stream().filter(u -> u.getDepartIds() != null && u.getDepartIds().indexOf(departId) > -1).collect(Collectors.toList());
+                users.addAll(collect);
+            }
+        }
+
+
         // 判断获取发起人
         if(actNodeService.hasChooseSponsor(nodeId)){
             LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();

+ 2 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysDepartMapper.java

@@ -52,4 +52,6 @@ public interface SysDepartMapper extends BaseMapper<SysDepart> {
 	 */
 	List<String> getSubDepIdsByOrgCodes(@org.apache.ibatis.annotations.Param("orgCodes") String[] orgCodes);
 
+	@Select("select id from sys_depart WHERE id in (SELECT parent_id FROM sys_depart WHERE  id in (SELECT  dep_id FROM sys_user_depart WHERE user_id = #{id}))")
+    List<String> getDepartById(@Param("id") String id);
 }

+ 2 - 1
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysDepartService.java

@@ -102,5 +102,6 @@ public interface ISysDepartService extends IService<SysDepart>{
      * @return
      */
     List<String> getMySubDepIdsByDepId(String departIds);
-    
+
+    List<String> getDepartById(String id);
 }

+ 5 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysBaseApiImpl.java

@@ -636,4 +636,9 @@ public class SysBaseApiImpl implements ISysBaseAPI {
 		return url;
 	}
 
+	@Override
+	public List<String> getDepartById(String id) {
+		return sysDepartService.getDepartById(id);
+	}
+
 }

+ 5 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java

@@ -235,6 +235,11 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
 		return this.baseMapper.getSubDepIdsByOrgCodes(codeArr);
 	}
 
+	@Override
+	public List<String> getDepartById(String id) {
+		return baseMapper.getDepartById(id);
+	}
+
 	/**
 	 * <p>
 	 * 根据关键字搜索相关的部门数据