Bladeren bron

新增报告-签字注师1列表展示调整

huangguoce 1 week geleden
bovenliggende
commit
92e6bae0d3

+ 145 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/controller/UserController.java

@@ -610,6 +610,151 @@ public class UserController {
         return ResponseEntity.ok(result);
     }
 
+    /**
+     * 签字注师列表查询
+     *
+     * @param userDTO
+     * @param page
+     * @return
+     */
+    @ApiLog("签字注师列表查询")
+    @ApiOperation(value = "签字注师列表查询")
+    //@PreAuthorize("hasAuthority('sys:user:list')")
+    @GetMapping("findUserList")
+    public ResponseEntity findUserList(UserDTO userDTO, Page<UserDTO> page) throws Exception {
+        QueryWrapper<UserDTO> queryWrapper = QueryWrapperGenerator.buildQueryCondition(userDTO, UserDTO.class);
+        // 管理员查询不限制
+        Boolean isAdmin = false;
+        UserDTO currentUserDTO = UserUtils.getCurrentUserDTO();
+        if (currentUserDTO != null && CollectionUtil.isNotEmpty(currentUserDTO.getRoleDTOList())) {
+            for (RoleDTO roleDTO : currentUserDTO.getRoleDTOList()) {
+                if (roleDTO.getEnName().equals("sys")) {
+                    isAdmin = true;
+                    break;
+                }
+            }
+        }
+        if (!isAdmin) {
+            queryWrapper.isNull("a.is_admin");
+            if (ObjectUtil.isNotEmpty(userDTO)) {
+                if (ObjectUtil.isNotEmpty(userDTO.getCompanyDTO()) && ObjectUtil.isNotEmpty(userDTO.getOfficeDTO())) {
+                    String id = UserUtils.getCurrentUserDTO().getCompanyDTO().getId();
+                    if (StringUtils.isNotBlank(userDTO.getCertType())) {
+                        //获取当前登陆人是否事中审公司人员
+                        /*if(officeDTO.getParentIds().contains("1615171302381182978")){
+
+                        }*/
+                    } else {
+                        // 当不是精确的部门查询时,再添加下面的筛选条件
+                        if ((StringUtils.isNotBlank(userDTO.getCompanyDTO().getId()) && StringUtils.isBlank(userDTO.getOfficeDTO().getId()))
+                                || "true".equals(userDTO.getSelectAll())) {
+                            // officeDTO.id是空,companyDTO.id不是空的话,说明前端组件点击的集团来进行查询
+                            // selectAll为‘true’的话,说明前端没有选择集团或者部门查询,这个时候要展示全部人员
+                            // 根据当前用户的部门id找到此部门的ids
+                            String ids = officeService.getById(UserUtils.getCurrentUserDTO().getOfficeDTO().getId()).getParentIds();
+                            // 根据ids分隔后的index[2],找到当前用户的所属公司id
+                            String companyId = null;
+                            String[] split = ids.split(",");
+                            // split.length大于2,说明当前登录人所属部门是普通部门,展示部分人员信息
+                            // 否则,当前登录人所属公共类部门(忘了叫什么类部门了,就是总经办那种部门),展示全部人员信息
+                            if (split.length > 2) {
+                                companyId = split[2];
+                                // 根据公司id,找到此公司下的所有部门
+                                List<Office> officeList = officeService.list(new QueryWrapper<Office>().lambda().eq(Office::getParentId, companyId));
+                                Set officeIdSet = new HashSet();
+                                for (Office office : officeList) {
+                                    if (StringUtils.isNotBlank(office.getId())) {
+                                        officeIdSet.add(office.getId());
+                                    }
+                                }
+                                List<String> officeIdList = Lists.newArrayList(officeIdSet);
+                                // 拿到所有公有部门的id
+                                List<String> officePublicIdList = officeService.list(new LambdaQueryWrapper<Office>().eq(Office::getIsPublic, "1")).stream().map(Office::getId).collect(Collectors.toList());
+                                // 拿到直属公司的id
+                                officeIdList.add(companyId);
+                                // 最后得到的所有部门的id
+                                officeIdList.addAll(officePublicIdList);
+                                List<String> lastIds = officeIdList.stream().distinct().collect(Collectors.toList());
+                                // 添加筛选条件为这些部门的id
+                                queryWrapper.in("a.office_id", lastIds);
+                            }
+                        } else if (StringUtils.isBlank(userDTO.getCompanyDTO().getId()) && StringUtils.isNotBlank(userDTO.getOfficeDTO().getId())) {
+                            // officeDTO.id不是空,companyDTO.id是空的话,说明前端组件点击的部门查询
+                            queryWrapper.eq("a.office_id", userDTO.getOfficeDTO().getId());
+                        }
+                    }
+                }
+            }
+        }
+        if (ObjectUtil.isNotEmpty(userDTO)) {
+            // 当certType传值时,获取拥有此资格证类型的人员
+            if (StringUtils.isNotBlank(userDTO.getCertType())) {
+                queryWrapper.orderByDesc("a.company_id");
+                queryWrapper.orderByAsc("a.office_id");
+                queryWrapper.orderByDesc("a.name");
+                //获取当前登录人信息
+                UserDTO loginUserDTO = UserUtils.getCurrentUserDTO();
+                //如果当前登录人是中审的管理咨询部人员,则注会列表中添加该部门选择项
+                if (null != loginUserDTO && null != loginUserDTO.getOfficeDTO()) {
+                    OfficeDTO officeDTO = loginUserDTO.getOfficeDTO();
+                    if (StringUtils.isNotBlank(officeDTO.getId())) {
+                        if ("1602840084816138241".equals(officeDTO.getId())) {
+                            queryWrapper.and(
+                                    wrapper -> wrapper.eq("sc.type", userDTO.getCertType()).or().eq("a.office_id", "1602840084816138241")
+                            );
+                            //queryWrapper.eq("sc.type",userDTO.getCertType()).or().eq("a.office_id","1602840084816138241");
+                        } else {
+                            queryWrapper.eq("sc.type", userDTO.getCertType());
+                        }
+                    } else {
+                        queryWrapper.eq("sc.type", userDTO.getCertType());
+                    }
+                } else {
+                    queryWrapper.eq("sc.type", userDTO.getCertType());
+                }
+
+            }
+            if (userDTO.getTenantDTO() != null && StrUtil.isNotBlank(userDTO.getTenantDTO().getId())) {
+                queryWrapper.eq("a.tenant_id", userDTO.getTenantDTO().getId());
+            }
+        }
+        IPage<UserDTO> result = userService.findUserList(page, queryWrapper);
+        IPage<UserDTO> result2 = userService.findPage3(userDTO);
+        //判断 如果是签字注师筛选,则获取签字注师的被选择次数
+        if (StringUtils.isNotBlank(userDTO.getCertType()) && "6".equals(userDTO.getCertType())) {
+            List<UserDTO> userList = result.getRecords();
+            List<UserDTO> user2List = result2.getRecords();
+            List<String> idList = Lists.newArrayList();
+            for (UserDTO dto : user2List) {
+                idList.add(dto.getId());
+            }
+            for (UserDTO info : userList) {
+                if (idList.size() > 0) {
+                    if (idList.contains(info.getId())) {
+                        info.setAccountantUserFlag(0);
+                    } else {
+                        info.setAccountantUserFlag(1);
+                    }
+                } else {
+                    if ("潘中".equals(info.getName())) {
+                        info.setAccountantUserFlag(0);
+                    } else {
+                        info.setAccountantUserFlag(1);
+                    }
+                }
+                /*if("潘中".equals(info.getName())){
+                    info.setAccountantUserFlag(0);
+                }else{
+                    info.setAccountantUserFlag(1);
+                }*/
+                Integer accountantUserCount = userService.getAccountantUserCount(info.getId());
+                info.setAccountantUserCount(accountantUserCount);
+            }
+        }
+        return ResponseEntity.ok(result);
+    }
+
+
     @GetMapping("list2")
     public ResponseEntity list2(UserDTO userDTO, Page<UserDTO> page) throws Exception {
         if (ObjectUtil.isNotEmpty(userDTO.getOfficeDTO().getId()) || ObjectUtil.isNotEmpty(userDTO.getLoginName())) {

+ 3 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/UserMapper.java

@@ -124,6 +124,9 @@ public interface UserMapper extends BaseMapper <User> {
     @InterceptorIgnore(tenantLine = "true")
     IPage <UserDTO> findList(Page <UserDTO> page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper);
 
+    @InterceptorIgnore(tenantLine = "true")
+    IPage <UserDTO> findUserList(Page <UserDTO> page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper);
+
 
     IPage <UserDTO> userFindPage(Page <UserDTO> page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper);
 

+ 10 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/xml/UserMapper.xml

@@ -190,6 +190,16 @@
         ${ew.customSqlSegment}
     </select>
 
+    <!-- 签字注师查询 -->
+    <select id="findUserList" resultMap="userResult">
+        SELECT
+        <include refid="userColumns"/>
+        FROM sys_user a
+        left join sys_cert sc on a.id = sc.user_id and sc.del_flag = '0' and (sc.status = '5' or sc.status IS NULL)
+        <include refid="userJoins"/>
+        ${ew.customSqlSegment}
+    </select>
+
     <!-- 分页查询用户信息 -->
     <select id="userFindPage" resultMap="userResult">
         SELECT

+ 38 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/service/UserService.java

@@ -286,10 +286,48 @@ public class UserService extends ServiceImpl<UserMapper, User> {
             }
         }
         return list;
+    }
 
+    /**
+     * 签字注师用户查询
+     *
+     * @param page
+     * @param queryWrapper
+     * @return
+     */
+    public IPage<UserDTO> findUserList(Page<UserDTO> page, QueryWrapper queryWrapper) {
+        queryWrapper.eq("a.del_flag", CommonConstants.NOT_DELETED); // 排除已经删除
+        IPage<UserDTO> list = baseMapper.findUserList(page, queryWrapper);
+        for (UserDTO record : list.getRecords()) {
+            if (CollectionUtil.isNotEmpty(record.getRoleDTOList())) {
+                StringBuilder names = new StringBuilder();
 
+                for (RoleDTO roleDTO : record.getRoleDTOList()) {
+                    if (names.length() > 0) {
+                        names.append(",");  // 只有在已有内容的情况下才添加逗号
+                    }
+                    names.append(roleDTO.getName());
+                }
+                record.setRole(names.toString());
+            }
+            if (CollectionUtil.isNotEmpty(record.getPostDTOList())) {
+                StringBuilder names = new StringBuilder();
+
+                for (PostDTO postDTO : record.getPostDTOList()) {
+                    if (names.length() > 0) {
+                        names.append(",");  // 只有在已有内容的情况下才添加逗号
+                    }
+                    names.append(postDTO.getName());
+                }
+                record.setPost(names.toString());
+            }
+        }
+        return list;
     }
 
+
+
+
     /**
      * 自定义分页检索
      *