diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectRenewalFundDeclarationController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectRenewalFundDeclarationController.java index 587f864..88c72e8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectRenewalFundDeclarationController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectRenewalFundDeclarationController.java @@ -3,12 +3,15 @@ package com.ningdatech.pmapi.projectlib.controller; import com.ningdatech.basic.model.PageVo; import com.ningdatech.log.annotation.WebLog; +import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.util.ExcelDownUtil; import com.ningdatech.pmapi.projectlib.manage.ProjectRenewalFundManage; import com.ningdatech.pmapi.projectlib.model.dto.ProjectRenewalFundDeclarationDTO; import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalAuditReq; import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalListReq; import com.ningdatech.pmapi.projectlib.model.vo.ProjectRenewalFundDeclarationVO; +import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; +import com.ningdatech.pmapi.user.util.LoginUserUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; @@ -32,11 +35,14 @@ import javax.servlet.http.HttpServletResponse; public class ProjectRenewalFundDeclarationController { private final ProjectRenewalFundManage projectRenewalFundManage; + private final UserInfoHelper userInfoHelper; + @GetMapping("/list") @ApiOperation("项目续建资金库") @WebLog("项目续建资金库") public PageVo list(ProjectRenewalListReq req) { - return projectRenewalFundManage.list(req); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + return projectRenewalFundManage.list(req,user); } @GetMapping("/{id}") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index 09abac7..2fa2365 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -1209,7 +1209,7 @@ public class ProjectLibManage { return user; } - private ProjectListReq buildProjectLibPermission(ProjectListReq req,UserFullInfoDTO user) { + public ProjectListReq buildProjectLibPermission(ProjectListReq req,UserFullInfoDTO user) { Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user); if (!currentUserDataScope.isPresent()) { log.warn("没有取到权限信息 当前查询 没有权限条件"); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java index 61f0dcd..a360a64 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java @@ -12,8 +12,12 @@ import com.ningdatech.basic.util.CollUtils; import com.ningdatech.basic.util.NdDateUtils; import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.common.constant.CommonConst; +import com.ningdatech.pmapi.common.constant.RegionConst; +import com.ningdatech.pmapi.common.helper.RegionCacheHelper; import com.ningdatech.pmapi.common.util.ExcelDownUtil; import com.ningdatech.pmapi.common.util.ExcelExportStyle; +import com.ningdatech.pmapi.datascope.model.DataScopeDTO; +import com.ningdatech.pmapi.datascope.utils.DataScopeUtil; import com.ningdatech.pmapi.gov.model.entity.GovBizProjectApply; import com.ningdatech.pmapi.gov.model.entity.GovBizProjectApprove; import com.ningdatech.pmapi.gov.model.entity.GovBizProjectBaseinfo; @@ -32,16 +36,19 @@ import com.ningdatech.pmapi.projectlib.model.dto.ProjectRenewalFundDeclarationDT import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; import com.ningdatech.pmapi.projectlib.model.po.ProjectRenewalFundDeclarationPO; +import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalAuditReq; import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalListReq; import com.ningdatech.pmapi.projectlib.model.vo.AnnualAmountVO; import com.ningdatech.pmapi.projectlib.model.vo.ProjectRenewalFundDeclarationVO; import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; import com.ningdatech.pmapi.projectlib.service.IProjectService; +import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.wflow.exception.BusinessException; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; @@ -49,6 +56,7 @@ import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.time.LocalDateTime; +import java.util.Collection; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -64,6 +72,7 @@ import java.util.stream.Collectors; */ @Component @RequiredArgsConstructor +@Slf4j public class ProjectRenewalFundManage { private final IProjectRenewalFundDeclarationService projectRenewalFundDeclarationService; @@ -78,13 +87,16 @@ public class ProjectRenewalFundManage { private final IGovBizProjectApproveService approveService; + private final RegionCacheHelper regionCacheHelper; + /** * 项目续建资金库列表 分页 * @param req * @return */ - public PageVo list(ProjectRenewalListReq req) { + public PageVo list(ProjectRenewalListReq req, UserFullInfoDTO user) { Page page = req.page(); + req = buildProjectLibPermission(req,user); projectRenewalFundDeclarationService.pageSql(page, req); long total; if ((total = page.getTotal()) == 0) { @@ -446,4 +458,49 @@ public class ProjectRenewalFundManage { throw new RuntimeException(e); } } + + public ProjectRenewalListReq buildProjectLibPermission(ProjectRenewalListReq req, UserFullInfoDTO user) { + Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user); + if (!currentUserDataScope.isPresent()) { + log.warn("没有取到权限信息 当前查询 没有权限条件"); + return req; + } + + switch (currentUserDataScope.get().getRole()) { + case NORMAL_MEMBER: + //普通用户 只能看到自己单位去申报的 + req.setUserType("normal"); + req.setUserValue(user.getEmpPosUnitCode()); + break; + case COMPANY_MANAGER: + //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 + req.setUserType("org"); + req.setUserValue(user.getEmpPosUnitCode()); + break; + case SUPER_ADMIN: + //超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 + break; + case REGION_MANAGER: + //区域管理员 看到自己区域的项目 如果是市本级 就看全市的 + if (RegionConst.RC_LS.equals(user.getRegionCode())) { + Collection regionCodes = regionCacheHelper.listChildRegionCodeList(user.getRegionCode(), + RegionConst.RL_CITY); + req.setRegionCodes(regionCodes); + } else { + req.setUserRegionCode(user.getRegionCode()); + } + req.setUserType("region"); + break; + case VISITOR: + //访客可以看全市的 + break; + case DASHBOARD: + break; + default: + //没有权限的话 就让它查不到 + req.setId(0L); + break; + } + return req; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml index d484194..1c5ce38 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml @@ -61,6 +61,23 @@ and prfd.approval_status = #{param.approvalStatus} + + and prfd.org_code = #{param.userValue} + + + and prfd.org_code = #{param.userValue} + + + + and prfd.region_code in + + #{code} + + + + and prfd.region_code = param.userRegionCode} + + order by prfd.update_on desc diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectRenewalListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectRenewalListReq.java index 0cd3855..ba3f8c3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectRenewalListReq.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectRenewalListReq.java @@ -7,6 +7,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDateTime; +import java.util.Collection; import java.util.List; /** @@ -22,6 +23,8 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public class ProjectRenewalListReq extends PagePo { + private Long id; + @ApiModelProperty("区域编码") private String regionCode; @@ -62,4 +65,12 @@ public class ProjectRenewalListReq extends PagePo { @ApiModelProperty("审核状态") private String approvalStatus; + + private String userType; + private String userValue; + + private Collection regionCodes; + + @ApiModelProperty("区域编码") + private String userRegionCode; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java index 2987dce..b74c32a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java @@ -81,8 +81,7 @@ public class CockpitStatsStatisticsTask { /** - * 前置机每天晚上10点自动清空,第二天早上6点获取数据 - * 定时同步前置机数据 每天1点开始执行一次 + * 定义统计 驾驶舱数据 每天3点开始执行一次 * */ @Scheduled(cron = "0 0 3 * * ?")