Przeglądaj źródła

Merge branch 'master' of http://114.55.67.98:8070/Natural_p1/zjugis_OA

songxy 7 miesięcy temu
rodzic
commit
54797b214c

+ 14 - 4
zjugis-business/src/main/java/com/zjugis/business/flow/commoncost/service/CommonCostServiceImpl.java

@@ -292,8 +292,13 @@ public class CommonCostServiceImpl implements CommonCostService {
     public PageResult<CommonCostRespVO> getCommonCostDeptPage(CommonCostPageReqVO pageReqVO) {
         List<Project> projects = projectService.selectByPermission();
         Set<String> deptProjectIds = convertSet(projects, Project::getId);
-        List<CommonCostDetailDO> detailList = commonCostDetailService.getListByProjectIds(deptProjectIds);
-        Set<String> ids = convertSet(detailList, CommonCostDetailDO::getCommonCostId);
+        Set<String> ids;
+        if (CollectionUtil.isEmpty(deptProjectIds)){
+            ids = Collections.emptySet();
+        } else {
+            List<CommonCostDetailDO> detailList = commonCostDetailService.getListByProjectIds(deptProjectIds);
+            ids = convertSet(detailList, CommonCostDetailDO::getCommonCostId);
+        }
         PageResult<CommonCostDO> pageResult = commonCostDao.getCommonCostDeptPage(pageReqVO, ids);
         PageResult<CommonCostRespVO> commonCostRespVOPageResult = getCommonCostRespVOPageResult(pageResult);
         return commonCostRespVOPageResult;
@@ -324,8 +329,13 @@ public class CommonCostServiceImpl implements CommonCostService {
     public CommonCostOverviewVO getCommonCostOverviewDept(CommonCostPageReqVO pageReqVO) {
         List<Project> projects = projectService.selectByPermission();
         Set<String> deptProjectIds = convertSet(projects, Project::getId);
-        List<CommonCostDetailDO> detailList = commonCostDetailService.getListByProjectIds(deptProjectIds);
-        Set<String> ids = convertSet(detailList, CommonCostDetailDO::getCommonCostId);
+        Set<String> ids;
+        if (CollectionUtil.isEmpty(deptProjectIds)){
+            ids = Collections.emptySet();
+        } else {
+            List<CommonCostDetailDO> detailList = commonCostDetailService.getListByProjectIds(deptProjectIds);
+            ids = convertSet(detailList, CommonCostDetailDO::getCommonCostId);
+        }
         List<CommonCostDO> commonCostList = commonCostDao.getCommonCostDeptList(pageReqVO, ids);
         CommonCostOverviewVO result = new CommonCostOverviewVO();
         double totalAmount = commonCostList.stream().collect(Collectors.summarizingDouble(value -> value.getTotalAmount().doubleValue())).getSum();

+ 1 - 1
zjugis-business/src/main/java/com/zjugis/business/service/impl/ProjectServiceImpl.java

@@ -257,7 +257,7 @@ public class ProjectServiceImpl implements ProjectService {
         AdminUserRespDTO adminUserRespDTO = adminUserApi.getUser(SecurityFrameworkUtils.getLoginUserId()).getCheckedData();
         Boolean all = respDTO.getAll();
         if(all){
-            return projectMapper.selectList();
+            return Collections.emptyList();
         } else{
             Set<String> deptIds = respDTO.getDeptIds();
             deptIds.add(adminUserRespDTO.getDeptId());

+ 5 - 0
zjugis-module-system/zjugis-module-system-api/src/main/java/com/zjugis/module/system/api/user/AdminUserApi.java

@@ -77,6 +77,11 @@ public interface AdminUserApi {
     @Parameter(name = "deptIds", description = "部门编号数组", example = "1,2", required = true)
     CommonResult<List<AdminUserRespDTO>> getUserListByRoleId(@RequestParam("roleId") Long roleId);
 
+    @GetMapping(PREFIX + "/list-by-role-ids")
+    @Operation(summary = "获得指定部门的用户数组")
+    @Parameter(name = "deptIds", description = "部门编号数组", example = "1,2", required = true)
+    CommonResult<List<AdminUserRespDTO>> getUserListByRoleIds(@RequestParam("roleIds") Collection<Long> roleIds);
+
     @GetMapping(PREFIX + "/list-by-dept-id")
     @Operation(summary = "获得指定部门的用户数组")
     @Parameter(name = "deptIds", description = "部门编号数组", example = "1,2", required = true)

+ 6 - 0
zjugis-module-system/zjugis-module-system-biz/src/main/java/com/zjugis/module/system/api/user/AdminUserApiImpl.java

@@ -116,6 +116,12 @@ public class AdminUserApiImpl implements AdminUserApi {
         return success(UserConvert.INSTANCE.convertList4(users));
     }
 
+    @Override
+    public CommonResult<List<AdminUserRespDTO>> getUserListByRoleIds(Collection<Long> roleIds) {
+        List<AdminUserDO> users = userService.getUserListByRoleIds(roleIds);
+        return success(UserConvert.INSTANCE.convertList4(users));
+    }
+
     @Override
     public CommonResult<List<AdminUserRespDTO>> getUserListByDeptIds(Collection<String> deptIds) {
         List<AdminUserDO> users = userService.getUserListByDeptIds(deptIds);

+ 7 - 0
zjugis-module-system/zjugis-module-system-biz/src/main/java/com/zjugis/module/system/service/user/AdminUserService.java

@@ -307,4 +307,11 @@ public interface AdminUserService {
      * @return
      */
     AdminUserDO getNextLeader(String id);
+
+    /**
+     * 获得指定角色数组的用户数组
+     * @param roleIds
+     * @return
+     */
+    List<AdminUserDO> getUserListByRoleIds(Collection<Long> roleIds);
 }

+ 9 - 0
zjugis-module-system/zjugis-module-system-biz/src/main/java/com/zjugis/module/system/service/user/AdminUserServiceImpl.java

@@ -677,6 +677,15 @@ public class AdminUserServiceImpl implements AdminUserService {
         }
     }
 
+    @Override
+    public List<AdminUserDO> getUserListByRoleIds(Collection<Long> roleIds) {
+        Set<String> userIds = convertSet(userRoleMapper.selectListByRoleIds(roleIds), UserRoleDO::getUserId);
+        if (CollUtil.isEmpty(userIds)) {
+            return Collections.emptyList();
+        }
+        return userMapper.selectBatchIds(userIds);
+    }
+
     /**
      * 对密码进行加密
      *

+ 41 - 23
zjugis-workflow/src/main/java/com/zjugis/z_workflow/utils/ParticipantsUtils/MethodHandler.java

@@ -7,6 +7,9 @@ import com.alibaba.fastjson2.JSONObject;
 import com.alibaba.fastjson2.TypeReference;
 import com.zjugis.framework.common.pojo.CommonResult;
 import com.zjugis.framework.workflow.spring.SpringUtils;
+import com.zjugis.module.system.api.dept.dto.PostRespDTO;
+import com.zjugis.module.system.api.permission.RoleApi;
+import com.zjugis.module.system.api.permission.dto.RoleRespDto;
 import com.zjugis.module.system.api.user.AdminUserApi;
 import com.zjugis.module.system.api.user.dto.AdminUserRespDTO;
 import com.zjugis.z_workflow.base.utils.ServiceApiUtils;
@@ -17,6 +20,8 @@ import org.springframework.util.CollectionUtils;
 import java.util.*;
 import java.util.function.Function;
 
+import static com.zjugis.framework.common.util.collection.CollectionUtils.convertSet;
+
 /**
  * @ClassName:
  * @Description: 〈一句话功能简述〉
@@ -35,7 +40,8 @@ public class MethodHandler {
     public static Function<Map<String, Object>, Set<Map<String, Object>>> getUserByDeptFun = postData -> {
 
         AdminUserApi adminUserApi = SpringUtils.getBean(AdminUserApi.class);
-        CommonResult<List<AdminUserRespDTO>> result = adminUserApi.getUserListByDeptIds(Collections.singleton((String) postData.get("dID")));
+        String deptID = (String) postData.get("dID");
+        CommonResult<List<AdminUserRespDTO>> result = adminUserApi.getDeptChildUserListByDeptId(deptID);
         return handledResult(result.getCheckedData());
     };
 
@@ -87,21 +93,27 @@ public class MethodHandler {
         return handledResult(result.getCheckedData());
     };
 
-//    /**
-//     * 指定用户所在部门
-//     */
-//    public static Function<Map<String, Object>, Set<Map<String, Object>>> getUserByWithDeptFun = postData -> {
-//        String postUrl = YmlUtil.getzUserOrgRightUrl() + WorkFlowConstant.USER_API_FIND_DEPT_USER_BY_USER_ID;
-//        return post(postUrl, postData);
-//    };
-//
-//    /**
-//     * 指定用户所在职位
-//     */
-//    public static Function<Map<String, Object>, Set<Map<String, Object>>> getUserByWithPositionFun = postData -> {
-//        String postUrl = YmlUtil.getzUserOrgRightUrl() + WorkFlowConstant.USER_API_FIND_POSITION_USER_BY_USER_ID;
-//        return post(postUrl, postData);
-//    };
+    /**
+     * 指定用户所在部门
+     */
+    public static Function<Map<String, Object>, Set<Map<String, Object>>> getUserByWithDeptFun = postData -> {
+        AdminUserApi adminUserApi = SpringUtils.getBean(AdminUserApi.class);
+        String id = postData.getOrDefault("id", "").toString();
+        AdminUserRespDTO user = adminUserApi.getUser(id).getCheckedData();
+        CommonResult<List<AdminUserRespDTO>> result = adminUserApi.getUserListByDeptIds(Collections.singleton(user.getDeptId()));
+        return handledResult(result.getCheckedData());
+    };
+
+    /**
+     * 指定用户所在职位
+     */
+    public static Function<Map<String, Object>, Set<Map<String, Object>>> getUserByWithPositionFun = postData -> {
+        AdminUserApi adminUserApi = SpringUtils.getBean(AdminUserApi.class);
+        String id = postData.getOrDefault("id", "").toString();
+        AdminUserRespDTO user = adminUserApi.getUser(id).getCheckedData();
+        CommonResult<List<AdminUserRespDTO>> result = adminUserApi.getUserListByPostIds(user.getPostIds());
+        return handledResult(result.getCheckedData());
+    };
 
 //    /**
 //     * 指定用户所在部门职位
@@ -111,13 +123,19 @@ public class MethodHandler {
 //        return post(postUrl, postData);
 //    };
 //
-//    /**
-//     * 指定用户所在角色
-//     */
-//    public static Function<Map<String, Object>, Set<Map<String, Object>>> getUserByWithRoleFun = postData -> {
-//        String postUrl = YmlUtil.getzUserOrgRightUrl() + WorkFlowConstant.USER_API_FIND_ROLE_USER_BY_USER_ID;
-//        return post(postUrl, postData);
-//    };
+    /**
+     * 指定用户所在角色
+     */
+    public static Function<Map<String, Object>, Set<Map<String, Object>>> getUserByWithRoleFun = postData -> {
+        AdminUserApi adminUserApi = SpringUtils.getBean(AdminUserApi.class);
+        RoleApi roleApi = SpringUtils.getBean(RoleApi.class);
+        String id = postData.getOrDefault("id", "").toString();
+        AdminUserRespDTO user = adminUserApi.getUser(id).getCheckedData();
+        List<RoleRespDto> roleList = roleApi.getRoleByUser(user.getId()).getCheckedData();
+        Set<Long> roleIds = convertSet(roleList, RoleRespDto::getId);
+        CommonResult<List<AdminUserRespDTO>> result = adminUserApi.getUserListByRoleIds(roleIds);
+        return handledResult(result.getCheckedData());
+    };
 
     /**
      * 指定用户的分管领导

+ 3 - 3
zjugis-workflow/src/main/java/com/zjugis/z_workflow/utils/ParticipantsUtils/PostParticipantsUtils.java

@@ -230,10 +230,10 @@ public class PostParticipantsUtils {
         ASSIGN_ROLE("指定角色", 4, MethodHandler.getUserByRoleFun, ParamsHandler.getParamsByRoleFun),
 //        DEPT_MANAGE("指定部门分管", 5, MethodHandler.getUserByInChargeFun, ParamsHandler.getParamsByInChargeFun),
         ASSIGN_USER("指定用户", 6, MethodHandler.getUserByIdFun, ParamsHandler.getParamsByIdFun),
-//        ASSIGN_USER_DEPT("指定用户所在部门", 7, MethodHandler.getUserByWithDeptFun, ParamsHandler.getParamsByWithDeptFun),
-//        ASSIGN_USER_POSITION("指定用户所在职位", 8, MethodHandler.getUserByWithPositionFun, ParamsHandler.getParamsByWithPositionFun),
+        ASSIGN_USER_DEPT("指定用户所在部门", 7, MethodHandler.getUserByWithDeptFun, ParamsHandler.getParamsByWithDeptFun),
+        ASSIGN_USER_POSITION("指定用户所在职位", 8, MethodHandler.getUserByWithPositionFun, ParamsHandler.getParamsByWithPositionFun),
 //        ASSIGN_USER_DEPT_POSITION("指定用户所在部门职位", 16, MethodHandler.getUserByWithDeptPositionFun, ParamsHandler.getParamsByWithDeptPositionFun),
-//        ASSIGN_USER_ROLE("指定用户所在角色", 9, MethodHandler.getUserByWithRoleFun, ParamsHandler.getParamsByWithRoleFun),
+        ASSIGN_USER_ROLE("指定用户所在角色", 9, MethodHandler.getUserByWithRoleFun, ParamsHandler.getParamsByWithRoleFun),
         ASSIGN_USER_LEADER("指定用户的分管领导", 10, MethodHandler.getUserByWithLeaderFun, ParamsHandler.getParamsByWithLeaderFun),
         ASSIGN_ACTIVITY_PARTICIPANT("指定已创建活动实例参与人(最近)", 11, MethodHandler.getUserByActivityInstanceFun, ParamsHandler.getParamsByActivityInstanceFun),
         CUSTOM_PARTICIPANT("自定义可参与人", 13, MethodHandler.getUserByCustomFun, ParamsHandler.getParamsByCustomFun);