zjh
2025-05-22 a3da2a6fe70e9514638ea4700c4bb2b61ecbc317
ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysDeptController.java
@@ -153,12 +153,12 @@
                                 @ApiParam(value = "页码数(默认1)") @RequestParam(defaultValue = "1") Integer page,
                                 @ApiParam(value = "显示条数(默认10)") @RequestParam(defaultValue = "10") Integer pageSize) {
        String userId = SecurityUtils.getLoginUser().getUserId();
        Integer ksId = null;
        String ksId = null;
        SysUser sysUser = null;
        if (null != userId) {
            sysUser = userService.getById(Long.valueOf(userId));
            if (null != sysUser) {
                ksId = Math.toIntExact(sysUser.getDeptId());
                ksId = sysUser.getDeptId().toString();
            }
        }
        if (ksId == null) {
@@ -167,34 +167,52 @@
        //根据当前登陆的人的科室id,获取该科室下的所有项目
        List<Long> postIds = sysUser.getPostIds();
        List<Long> ksproList = null;
        if (postIds != null) {
            for (Long postId : postIds) {
                LambdaQueryWrapper<SysUserPost> wq111 = new LambdaQueryWrapper<>();
                wq111.eq(SysUserPost::getPostId, postId);
                SysUserPost one = userPostService.getOne(wq111);
                if (one != null) {
                    SysPost byId = postService.getById(one.getPostId());
                    if (byId.getPostName().equals("录入员")) {
                        ksproList = projectService.getKsTjProjectIdListBydeptId(String.valueOf(ksId));
        String byKey =null;
//        if (postIds != null) {
//            for (Long postId : postIds) {
//                LambdaQueryWrapper<SysUserPost> wq111 = new LambdaQueryWrapper<>();
//                wq111.eq(SysUserPost::getPostId, postId);
//                SysUserPost one = userPostService.getOne(wq111);
//                if (one != null) {
//                    SysPost byId = postService.getById(one.getPostId());
//                    if (byId.getPostName().equals("录入员")) {
//                        ksproList = projectService.getKsTjProjectIdListBydeptId(String.valueOf(ksId));
//                    }
//                    if (byId.getPostName().equals("前台")) {
//                        byKey = configService.selectConfigByKey("qt_kjksid");
//
//                    }
//                }
//            }
//        } else {
//            ksproList = projectService.getKsTjProjectIdList();
//        }
//
//        if (ksproList == null || ksproList.isEmpty()) {
//            return AjaxResult.error("请完善科室项目信息");
//        }
        List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
        if (null != roles && !roles.isEmpty()) {
            List<SysRole> list = roles.stream().filter(item -> item.getRoleName().contains("前台")).collect(Collectors.toList());
            if (!list.isEmpty()) {
                byKey = configService.selectConfigByKey("qt_kjksid");
                    }
                }
            }
        } else {
            ksproList = projectService.getKsTjProjectIdList();
        }
        if (ksproList == null || ksproList.isEmpty()) {
            return AjaxResult.error("请完善科室项目信息");
        }
        List<TjCustomer> customerLis = new ArrayList<>();
        if (null == name) name = "";
        if (null == tjNumber) tjNumber = "";
        Map<String, Object> map = null;
        if ( StringUtil.isNotBlank(byKey)) {
            ksId+=(","+byKey);
        }
        if (type == 0) {
            map = deptService.getSysDeptYjWjCustomerList13(String.valueOf(ksId), name, tjNumber, 0, page, pageSize);
            map = deptService.getSysDeptYjWjCustomerList13(ksId, name, tjNumber, 0, page, pageSize);
        }
        if (type == 1) {
            map = deptService.getSysDeptYjWjCustomerList13(String.valueOf(ksId), name, tjNumber, 1, page, pageSize);
            map = deptService.getSysDeptYjWjCustomerList13(ksId, name, tjNumber, 1, page, pageSize);
        }
        return AjaxResult.success(map);