diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java index c1517b9..80aa1d4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java @@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; import com.ningdatech.basic.util.NdDateUtils; import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.common.constant.RegionConst; @@ -378,9 +379,45 @@ public class DeclaredProjectManage { public PageVo projectLibList(ProjectListReq req) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - //放入用户的单位 因为数据权限 只能看自己单位 - req.setBuildOrgCode(user.getOrganizationCode()); - return projectlibManager.projectLibList(req); + LambdaQueryWrapper query = ProjectHelper.projectQuery(req); + //当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 + preQuery(query,user); + Page page = projectService.page(req.page(), query); + long total; + if ((total = page.getTotal()) == 0) { + return PageVo.empty(); + } + List records = CollUtils.convert(page.getRecords(), w -> { + ProjectLibListItemVO item = new ProjectLibListItemVO(); + item.setId(w.getId()); + item.setProjectName(w.getProjectName()); + item.setCreateOn(w.getCreateOn()); + item.setDeclaredAmount(w.getDeclareAmount()); + item.setStage(w.getStage()); + item.setStatus(w.getStatus()); + item.setProjectType(w.getProjectType()); + item.setProjectYear(w.getProjectYear()); + item.setBuildOrg(w.getBuildOrgName()); + item.setBizDomain(w.getBizDomain()); + item.setProcessStatus(w.getProcessStatus()); + item.setInstCode(w.getInstCode()); + item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); + return item; + }); + return PageVo.of(records, total); + } + + //当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 并且他是单位管理员 + private void preQuery(LambdaQueryWrapper query,UserFullInfoDTO user) { + //如果当前登录是单位管理员 + if(user.getIsOrgAdmin()){ + query.and(s1 -> s1.eq(Project::getStatus,ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()) + .eq(Project::getSuperOrgCode,user.getOrganizationCode()) + .or(q2 -> q2.eq(Project::getBuildOrgCode,user.getOrganizationCode()))); + }else{ + //否则 只能看到 非预审 并且 + query.and(q2 -> q2.eq(Project::getBuildOrgCode,user.getOrganizationCode())); + } } public void exportList(HttpServletResponse response, ProjectListReq param) {