@@ -40,6 +40,7 @@ import com.hz.pm.api.projectlib.service.IProjectApplicationService; | |||||
import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService; | import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService; | ||||
import com.hz.pm.api.projectlib.service.IProjectService; | import com.hz.pm.api.projectlib.service.IProjectService; | ||||
import com.hz.pm.api.todocenter.constant.TodoCenterConst; | import com.hz.pm.api.todocenter.constant.TodoCenterConst; | ||||
import com.hz.pm.api.user.helper.MhUnitCache; | |||||
import com.hz.pm.api.user.security.model.UserFullInfoDTO; | import com.hz.pm.api.user.security.model.UserFullInfoDTO; | ||||
import com.hz.pm.api.user.util.LoginUserUtil; | import com.hz.pm.api.user.util.LoginUserUtil; | ||||
import com.ningdatech.basic.exception.BizException; | import com.ningdatech.basic.exception.BizException; | ||||
@@ -79,7 +80,7 @@ import static com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum.*; | |||||
public class AnnualPlanLibManage { | public class AnnualPlanLibManage { | ||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final MhUnitCache mhUnitCache; | |||||
private final IProjectApplicationService applicationService; | private final IProjectApplicationService applicationService; | ||||
private final StateMachineUtil stateMachine; | private final StateMachineUtil stateMachine; | ||||
private final UserInfoHelper userInfoHelper; | private final UserInfoHelper userInfoHelper; | ||||
@@ -104,7 +105,9 @@ public class AnnualPlanLibManage { | |||||
query.orderByDesc(Project::getAnnualPlanAddTime); | query.orderByDesc(Project::getAnnualPlanAddTime); | ||||
query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); | query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); | ||||
// 数据权限 | // 数据权限 | ||||
buildProjectLibPermission(query); | |||||
if (!buildProjectLibPermission(query)) { | |||||
return PageVo.empty(); | |||||
} | |||||
Page<Project> page = projectService.page(req.page(), query); | Page<Project> page = projectService.page(req.page(), query); | ||||
long total; | long total; | ||||
if ((total = page.getTotal()) == 0) { | if ((total = page.getTotal()) == 0) { | ||||
@@ -242,30 +245,37 @@ public class AnnualPlanLibManage { | |||||
* | * | ||||
* @param query \ | * @param query \ | ||||
*/ | */ | ||||
public void buildProjectLibPermission(LambdaQueryWrapper<Project> query) { | |||||
public boolean buildProjectLibPermission(LambdaQueryWrapper<Project> query) { | |||||
boolean queryState = Boolean.TRUE; | |||||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | ||||
Optional<DataScopeDTO> currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user); | Optional<DataScopeDTO> currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user); | ||||
if (!currentUserDataScope.isPresent()) { | if (!currentUserDataScope.isPresent()) { | ||||
log.warn("没有取到权限信息 当前查询 没有权限条件"); | log.warn("没有取到权限信息 当前查询 没有权限条件"); | ||||
return; | |||||
} | |||||
switch (currentUserDataScope.get().getRole()) { | |||||
case NORMAL_MEMBER: | |||||
// 普通用户 只能看到自己单位去申报的 | |||||
query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); | |||||
break; | |||||
case COMPANY_MANAGER: | |||||
// 单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 | |||||
query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); | |||||
break; | |||||
case SUPER_ADMIN: | |||||
// 超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 | |||||
break; | |||||
default: | |||||
// 没有权限的话 就让它查不到 | |||||
query.eq(Project::getId, "NULL"); | |||||
break; | |||||
queryState = Boolean.FALSE; | |||||
} else { | |||||
switch (currentUserDataScope.get().getRole()) { | |||||
case NORMAL_MEMBER: | |||||
// 普通用户 只能看到自己单位去申报的 | |||||
query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); | |||||
break; | |||||
case COMPANY_MANAGER: | |||||
// 单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 | |||||
List<Long> childUnitIds = mhUnitCache.getChildrenIdsRecursion(user.getMhUnitId()); | |||||
childUnitIds.add(user.getMhUnitId()); | |||||
List<String> viewUnitIdList = CollUtils.convert(childUnitIds, String::valueOf); | |||||
query.in(Project::getBuildOrgCode, viewUnitIdList); | |||||
break; | |||||
case SUPER_ADMIN: | |||||
// 超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 | |||||
break; | |||||
default: | |||||
// 没有权限的话 就让它查不到 | |||||
queryState = Boolean.FALSE; | |||||
break; | |||||
} | |||||
} | } | ||||
return queryState; | |||||
} | } | ||||
@Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
@@ -381,7 +391,9 @@ public class AnnualPlanLibManage { | |||||
query.orderByDesc(Project::getAnnualPlanAddTime); | query.orderByDesc(Project::getAnnualPlanAddTime); | ||||
query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); | query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); | ||||
// 数据权限 | // 数据权限 | ||||
buildProjectLibPermission(query); | |||||
if (!buildProjectLibPermission(query)) { | |||||
throw BizException.wrap("暂无年度计划导出权限"); | |||||
} | |||||
List<Project> projects = projectService.list(query); | List<Project> projects = projectService.list(query); | ||||
List<AnnualLibExportDTO> list = projects.stream().map(p -> { | List<AnnualLibExportDTO> list = projects.stream().map(p -> { | ||||
AnnualLibExportDTO dto = new AnnualLibExportDTO(); | AnnualLibExportDTO dto = new AnnualLibExportDTO(); | ||||
@@ -205,7 +205,9 @@ public class ProjectLibManage { | |||||
public PageVo<ProjectLibListItemVO> projectLibListWithPermission(ProjectListReq req, UserFullInfoDTO user) { | public PageVo<ProjectLibListItemVO> projectLibListWithPermission(ProjectListReq req, UserFullInfoDTO user) { | ||||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | ||||
user = buildProjectLibPermission(query, user); | |||||
if (!buildProjectLibPermission(query, user)) { | |||||
return PageVo.empty(); | |||||
} | |||||
//项目查最新 | //项目查最新 | ||||
query.eq(Project::getNewest, Boolean.TRUE); | query.eq(Project::getNewest, Boolean.TRUE); | ||||
Page<Project> page = projectService.page(req.page(), query); | Page<Project> page = projectService.page(req.page(), query); | ||||
@@ -271,21 +273,21 @@ public class ProjectLibManage { | |||||
/** | /** | ||||
* 项目列表带当前审批人(工作流的) | * 项目列表带当前审批人(工作流的) | ||||
* | * | ||||
* @param req | |||||
* @param user | |||||
* @return | |||||
* @param req \ | |||||
* @param user \ | |||||
* @return \ | |||||
*/ | */ | ||||
public PageVo<ProjectLibListItemVO> projectLibListApprove(ProjectListReq req, UserFullInfoDTO user) { | public PageVo<ProjectLibListItemVO> projectLibListApprove(ProjectListReq req, UserFullInfoDTO user) { | ||||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | ||||
user = buildProjectLibPermission(query, user); | |||||
if (!buildProjectLibPermission(query, user)) { | |||||
return PageVo.empty(); | |||||
} | |||||
//项目查最新 | //项目查最新 | ||||
query.eq(Project::getNewest, Boolean.TRUE); | query.eq(Project::getNewest, Boolean.TRUE); | ||||
Page<Project> page = projectService.page(req.page(), query); | Page<Project> page = projectService.page(req.page(), query); | ||||
if (CollUtil.isEmpty(page.getRecords())) { | if (CollUtil.isEmpty(page.getRecords())) { | ||||
return PageVo.empty(); | return PageVo.empty(); | ||||
} | } | ||||
UserFullInfoDTO finalUser = user; | |||||
Set<String> instCodes = page.getRecords().stream() | Set<String> instCodes = page.getRecords().stream() | ||||
.map(Project::getInstCode) | .map(Project::getInstCode) | ||||
.filter(StringUtils::isNotBlank).collect(Collectors.toSet()); | .filter(StringUtils::isNotBlank).collect(Collectors.toSet()); | ||||
@@ -321,13 +323,12 @@ public class ProjectLibManage { | |||||
item.setInstCode(w.getInstCode()); | item.setInstCode(w.getInstCode()); | ||||
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); | item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); | ||||
item.setApproveUsers(buildApproveUsers(w.getInstCode(), map, userMap)); | item.setApproveUsers(buildApproveUsers(w.getInstCode(), map, userMap)); | ||||
if (finalUser.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.eq(item.getStatus()) | |||||
if (user.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.eq(item.getStatus()) | |||||
&& StringUtils.isNotBlank(w.getSuperOrgCode()) | && StringUtils.isNotBlank(w.getSuperOrgCode()) | ||||
&& w.getSuperOrgCode().equals(finalUser.getMhUnitIdStr())) { | |||||
&& w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { | |||||
item.setCanPreDeclared(Boolean.TRUE); | item.setCanPreDeclared(Boolean.TRUE); | ||||
} | } | ||||
item.setApprovedAmount(w.getApprovalAmount()); | item.setApprovedAmount(w.getApprovalAmount()); | ||||
// item.setAnnualPlanAmount(w.getAnnualPlanAmount()); | |||||
item.setPrePlanProjectId(w.getPrePlanProjectId()); | item.setPrePlanProjectId(w.getPrePlanProjectId()); | ||||
records.add(item); | records.add(item); | ||||
} | } | ||||
@@ -389,9 +390,9 @@ public class ProjectLibManage { | |||||
/** | /** | ||||
* 项目申报和项目归集的并集 | * 项目申报和项目归集的并集 | ||||
* | * | ||||
* @param req | |||||
* @param user | |||||
* @return | |||||
* @param req \ | |||||
* @param user \ | |||||
* @return \ | |||||
*/ | */ | ||||
public PageVo<ProjectLibListItemVO> projectAllListWithPermission(ProjectListReq req, UserFullInfoDTO user) { | public PageVo<ProjectLibListItemVO> projectAllListWithPermission(ProjectListReq req, UserFullInfoDTO user) { | ||||
if (!buildProjectLibPermission(req, user)) { | if (!buildProjectLibPermission(req, user)) { | ||||
@@ -1304,44 +1305,45 @@ public class ProjectLibManage { | |||||
/** | /** | ||||
* build 项目的角色权限到req | * build 项目的角色权限到req | ||||
* | * | ||||
* @param query | |||||
* @param query 、 | |||||
*/ | */ | ||||
public UserFullInfoDTO buildProjectLibPermission(LambdaQueryWrapper<Project> query, UserFullInfoDTO user) { | |||||
public boolean buildProjectLibPermission(LambdaQueryWrapper<Project> query, UserFullInfoDTO user) { | |||||
boolean queryState = true; | |||||
Optional<DataScopeDTO> currentUserDataScope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user); | Optional<DataScopeDTO> currentUserDataScope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user); | ||||
if (!currentUserDataScope.isPresent()) { | if (!currentUserDataScope.isPresent()) { | ||||
log.warn("没有取到权限信息 当前查询 没有权限条件"); | log.warn("没有取到权限信息 当前查询 没有权限条件"); | ||||
return user; | |||||
} | |||||
switch (currentUserDataScope.get().getRole()) { | |||||
case NORMAL_MEMBER: | |||||
//普通用户 只能看到自己单位去申报的 | |||||
query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); | |||||
break; | |||||
case COMPANY_MANAGER: | |||||
List<Long> childUnitIds = mhUnitCache.getChildrenIdsRecursion(user.getMhUnitId()); | |||||
childUnitIds.add(user.getMhUnitId()); | |||||
List<String> viewUnitIdList = CollUtils.convert(childUnitIds, String::valueOf); | |||||
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 | |||||
query.and(q1 -> q1.in(Project::getBuildOrgCode, viewUnitIdList) | |||||
.or(q2 -> q2.eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) | |||||
.eq(Project::getStatus, ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) | |||||
.in(Project::getSuperOrgCode, viewUnitIdList))); | |||||
break; | |||||
case SUPER_ADMIN: | |||||
//超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 | |||||
break; | |||||
case VISITOR: | |||||
//访客可以看全市的 | |||||
break; | |||||
case DASHBOARD: | |||||
break; | |||||
default: | |||||
//没有权限的话 就让它查不到 | |||||
query.eq(Project::getId, 0L); | |||||
break; | |||||
queryState = false; | |||||
} else { | |||||
switch (currentUserDataScope.get().getRole()) { | |||||
case NORMAL_MEMBER: | |||||
//普通用户 只能看到自己单位去申报的 | |||||
query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); | |||||
break; | |||||
case COMPANY_MANAGER: | |||||
List<Long> childUnitIds = mhUnitCache.getChildrenIdsRecursion(user.getMhUnitId()); | |||||
childUnitIds.add(user.getMhUnitId()); | |||||
List<String> viewUnitIdList = CollUtils.convert(childUnitIds, String::valueOf); | |||||
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 | |||||
query.and(q1 -> q1.in(Project::getBuildOrgCode, viewUnitIdList) | |||||
.or(q2 -> q2.eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) | |||||
.eq(Project::getStatus, ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) | |||||
.in(Project::getSuperOrgCode, viewUnitIdList))); | |||||
break; | |||||
case SUPER_ADMIN: | |||||
//超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 | |||||
break; | |||||
case VISITOR: | |||||
//访客可以看全市的 | |||||
break; | |||||
case DASHBOARD: | |||||
break; | |||||
default: | |||||
//没有权限的话 就让它查不到 | |||||
queryState = false; | |||||
break; | |||||
} | |||||
} | } | ||||
return user; | |||||
return queryState; | |||||
} | } | ||||
public boolean buildProjectLibPermission(ProjectListReq req, UserFullInfoDTO user) { | public boolean buildProjectLibPermission(ProjectListReq req, UserFullInfoDTO user) { | ||||
@@ -8,15 +8,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
import com.hz.pm.api.projectlib.model.entity.ProjectAnnualPaymentPlan; | |||||
import com.hz.pm.api.projectlib.service.IProjectAnnualPaymentPlanService; | |||||
import com.hz.pm.api.user.security.model.UserInfoDetails; | |||||
import com.hz.pm.api.user.util.LoginUserUtil; | |||||
import com.ningdatech.basic.exception.BizException; | |||||
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.hz.pm.api.common.model.constant.BizConst; | import com.hz.pm.api.common.model.constant.BizConst; | ||||
import com.hz.pm.api.common.model.constant.CommonConst; | import com.hz.pm.api.common.model.constant.CommonConst; | ||||
import com.hz.pm.api.common.util.ExcelDownUtil; | import com.hz.pm.api.common.util.ExcelDownUtil; | ||||
@@ -34,23 +25,33 @@ import com.hz.pm.api.gov.service.IGovOperationProjectBaseinfoService; | |||||
import com.hz.pm.api.projectdeclared.model.dto.ProjectRenewalDeclareExportDTO; | import com.hz.pm.api.projectdeclared.model.dto.ProjectRenewalDeclareExportDTO; | ||||
import com.hz.pm.api.projectdeclared.model.entity.PaymentPlan; | import com.hz.pm.api.projectdeclared.model.entity.PaymentPlan; | ||||
import com.hz.pm.api.projectdeclared.service.IPaymentPlanService; | import com.hz.pm.api.projectdeclared.service.IPaymentPlanService; | ||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectRenewalApprovalStatusEnum; | |||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | |||||
import com.hz.pm.api.projectlib.helper.ProjectRenewFundHelper; | import com.hz.pm.api.projectlib.helper.ProjectRenewFundHelper; | ||||
import com.hz.pm.api.projectlib.model.dto.ProjectRenewalExportDTO; | import com.hz.pm.api.projectlib.model.dto.ProjectRenewalExportDTO; | ||||
import com.hz.pm.api.projectlib.model.dto.ProjectRenewalFundDeclarationDTO; | import com.hz.pm.api.projectlib.model.dto.ProjectRenewalFundDeclarationDTO; | ||||
import com.hz.pm.api.projectlib.model.entity.Project; | import com.hz.pm.api.projectlib.model.entity.Project; | ||||
import com.hz.pm.api.projectlib.model.entity.ProjectAnnualPaymentPlan; | |||||
import com.hz.pm.api.projectlib.model.entity.ProjectRenewalFundDeclaration; | import com.hz.pm.api.projectlib.model.entity.ProjectRenewalFundDeclaration; | ||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectRenewalApprovalStatusEnum; | |||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | |||||
import com.hz.pm.api.projectlib.model.po.ProjectRenewalFundDeclarationPO; | import com.hz.pm.api.projectlib.model.po.ProjectRenewalFundDeclarationPO; | ||||
import com.hz.pm.api.projectlib.model.req.ProjectRenewalAuditReq; | import com.hz.pm.api.projectlib.model.req.ProjectRenewalAuditReq; | ||||
import com.hz.pm.api.projectlib.model.req.ProjectRenewalListReq; | import com.hz.pm.api.projectlib.model.req.ProjectRenewalListReq; | ||||
import com.hz.pm.api.projectlib.model.vo.AnnualAmountVO; | import com.hz.pm.api.projectlib.model.vo.AnnualAmountVO; | ||||
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; | import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; | ||||
import com.hz.pm.api.projectlib.model.vo.ProjectRenewalFundDeclarationVO; | import com.hz.pm.api.projectlib.model.vo.ProjectRenewalFundDeclarationVO; | ||||
import com.hz.pm.api.projectlib.service.IProjectAnnualPaymentPlanService; | |||||
import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService; | import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService; | ||||
import com.hz.pm.api.projectlib.service.IProjectService; | import com.hz.pm.api.projectlib.service.IProjectService; | ||||
import com.hz.pm.api.user.helper.MhUnitCache; | |||||
import com.hz.pm.api.user.security.model.UserFullInfoDTO; | import com.hz.pm.api.user.security.model.UserFullInfoDTO; | ||||
import com.hz.pm.api.user.security.model.UserInfoDetails; | |||||
import com.hz.pm.api.user.util.LoginUserUtil; | |||||
import com.ningdatech.basic.exception.BizException; | |||||
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.wflow.exception.BusinessException; | import com.wflow.exception.BusinessException; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
@@ -92,6 +93,7 @@ public class ProjectRenewalFundManage { | |||||
private final IPaymentPlanService paymentPlanService; | private final IPaymentPlanService paymentPlanService; | ||||
private final IProjectAnnualPaymentPlanService projectPaymentPlanService; | private final IProjectAnnualPaymentPlanService projectPaymentPlanService; | ||||
private final MhUnitCache mhUnitCache; | |||||
/** | /** | ||||
* 项目续建资金库列表 分页 | * 项目续建资金库列表 分页 | ||||
@@ -101,7 +103,9 @@ public class ProjectRenewalFundManage { | |||||
*/ | */ | ||||
public PageVo<ProjectRenewalFundDeclarationVO> list(ProjectRenewalListReq req, UserFullInfoDTO user) { | public PageVo<ProjectRenewalFundDeclarationVO> list(ProjectRenewalListReq req, UserFullInfoDTO user) { | ||||
Page<ProjectRenewalFundDeclarationPO> page = req.page(); | Page<ProjectRenewalFundDeclarationPO> page = req.page(); | ||||
req = buildProjectLibPermission(req, user); | |||||
if (!buildProjectLibPermission(req, user)) { | |||||
return PageVo.empty(); | |||||
} | |||||
projectRenewalFundDeclarationService.pageSql(page, req); | projectRenewalFundDeclarationService.pageSql(page, req); | ||||
long total; | long total; | ||||
if ((total = page.getTotal()) == 0) { | if ((total = page.getTotal()) == 0) { | ||||
@@ -611,37 +615,41 @@ public class ProjectRenewalFundManage { | |||||
} | } | ||||
} | } | ||||
public ProjectRenewalListReq buildProjectLibPermission(ProjectRenewalListReq req, UserFullInfoDTO user) { | |||||
Optional<DataScopeDTO> currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user); | |||||
if (!currentUserDataScope.isPresent()) { | |||||
public boolean buildProjectLibPermission(ProjectRenewalListReq req, UserFullInfoDTO user) { | |||||
boolean queryState = Boolean.TRUE; | |||||
Optional<DataScopeDTO> dataScope = DataScopeUtil.getCurrentUserDataScope(user); | |||||
if (!dataScope.isPresent()) { | |||||
log.warn("没有取到权限信息 当前查询 没有权限条件"); | log.warn("没有取到权限信息 当前查询 没有权限条件"); | ||||
return req; | |||||
} | |||||
switch (currentUserDataScope.get().getRole()) { | |||||
case NORMAL_MEMBER: | |||||
//普通用户 只能看到自己单位去申报的 | |||||
req.setUserType("normal"); | |||||
req.setUserValue(user.getMhUnitIdStr()); | |||||
break; | |||||
case COMPANY_MANAGER: | |||||
case SUPER_ADMIN: | |||||
case REGION_MANAGER: | |||||
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 | |||||
//超级管理员 也只能看本单位的 | |||||
req.setUserType("org"); | |||||
req.setUserValue(user.getMhUnitIdStr()); | |||||
break; | |||||
case VISITOR: | |||||
//访客可以看全市的 | |||||
break; | |||||
case DASHBOARD: | |||||
break; | |||||
default: | |||||
//没有权限的话 就让它查不到 | |||||
req.setId(0L); | |||||
break; | |||||
queryState = Boolean.FALSE; | |||||
} else { | |||||
switch (dataScope.get().getRole()) { | |||||
case NORMAL_MEMBER: | |||||
//普通用户 只能看到自己单位去申报的 | |||||
req.setUserType("normal"); | |||||
req.setUserValue(user.getMhUnitIdStr()); | |||||
break; | |||||
case COMPANY_MANAGER: | |||||
case SUPER_ADMIN: | |||||
case REGION_MANAGER: | |||||
List<Long> childUnitIds = mhUnitCache.getChildrenIdsRecursion(user.getMhUnitId()); | |||||
childUnitIds.add(user.getMhUnitId()); | |||||
String viewUnitIdStr = CollUtils.joinByComma(childUnitIds, w -> "'" + w + "'"); | |||||
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 | |||||
//超级管理员 也只能看本单位的 | |||||
req.setUserType("org"); | |||||
req.setUserValue(viewUnitIdStr); | |||||
break; | |||||
case VISITOR: | |||||
//访客可以看全市的 | |||||
break; | |||||
case DASHBOARD: | |||||
break; | |||||
default: | |||||
//没有权限的话 就让它查不到 | |||||
queryState = Boolean.FALSE; | |||||
break; | |||||
} | |||||
} | } | ||||
return req; | |||||
return queryState; | |||||
} | } | ||||
} | } |
@@ -65,7 +65,7 @@ | |||||
and prfd.org_code = #{param.userValue} | and prfd.org_code = #{param.userValue} | ||||
</if> | </if> | ||||
<if test="param.userType != null and param.userType == 'org'"> | <if test="param.userType != null and param.userType == 'org'"> | ||||
and prfd.org_code = #{param.userValue} | |||||
and prfd.org_code in (${param.userValue}) | |||||
</if> | </if> | ||||
<if test="param.userType != null and param.userType == 'region'"> | <if test="param.userType != null and param.userType == 'region'"> | ||||
<if test="param.regionCodes != null"> | <if test="param.regionCodes != null"> | ||||
@@ -1,12 +1,12 @@ | |||||
package com.hz.pm.api.projectlib.service.impl; | package com.hz.pm.api.projectlib.service.impl; | ||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.hz.pm.api.projectlib.model.entity.ProjectRenewalFundDeclaration; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import com.hz.pm.api.projectlib.mapper.ProjectRenewalFundDeclarationMapper; | import com.hz.pm.api.projectlib.mapper.ProjectRenewalFundDeclarationMapper; | ||||
import com.hz.pm.api.projectlib.model.entity.ProjectRenewalFundDeclaration; | |||||
import com.hz.pm.api.projectlib.model.po.ProjectRenewalFundDeclarationPO; | import com.hz.pm.api.projectlib.model.po.ProjectRenewalFundDeclarationPO; | ||||
import com.hz.pm.api.projectlib.model.req.ProjectRenewalListReq; | import com.hz.pm.api.projectlib.model.req.ProjectRenewalListReq; | ||||
import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService; | import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService; | ||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
@@ -20,12 +20,13 @@ import org.springframework.stereotype.Service; | |||||
*/ | */ | ||||
@Service | @Service | ||||
@RequiredArgsConstructor | @RequiredArgsConstructor | ||||
public class ProjectRenewalFundDeclarationServiceImpl extends | |||||
ServiceImpl<ProjectRenewalFundDeclarationMapper, ProjectRenewalFundDeclaration> implements IProjectRenewalFundDeclarationService { | |||||
public class ProjectRenewalFundDeclarationServiceImpl | |||||
extends ServiceImpl<ProjectRenewalFundDeclarationMapper, ProjectRenewalFundDeclaration> | |||||
implements IProjectRenewalFundDeclarationService { | |||||
private final ProjectRenewalFundDeclarationMapper mapper; | |||||
@Override | @Override | ||||
public Page<ProjectRenewalFundDeclarationPO> pageSql(Page<ProjectRenewalFundDeclarationPO> page, ProjectRenewalListReq req) { | public Page<ProjectRenewalFundDeclarationPO> pageSql(Page<ProjectRenewalFundDeclarationPO> page, ProjectRenewalListReq req) { | ||||
return mapper.pageSql(page,req); | |||||
return baseMapper.pageSql(page, req); | |||||
} | } | ||||
} | } |
@@ -2,6 +2,7 @@ package com.hz.pm.api.scheduler.task; | |||||
import cn.hutool.core.collection.CollUtil; | import cn.hutool.core.collection.CollUtil; | ||||
import cn.hutool.core.date.StopWatch; | import cn.hutool.core.date.StopWatch; | ||||
import cn.hutool.core.util.StrUtil; | |||||
import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
import com.alibaba.fastjson.JSONArray; | import com.alibaba.fastjson.JSONArray; | ||||
import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
@@ -214,10 +215,7 @@ public class EarlyWarningInstanceNotStartTask { | |||||
username = needToWaringProject.getResponsibleMan(); | username = needToWaringProject.getResponsibleMan(); | ||||
mobile = needToWaringProject.getResponsibleManMobile(); | mobile = needToWaringProject.getResponsibleManMobile(); | ||||
if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)) { | if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)) { | ||||
UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) | |||||
.eq(UserInfo::getUsername, username) | |||||
.eq(UserInfo::getMobile, mobile) | |||||
.last(BizConst.LIMIT_1)); | |||||
UserInfo user = userInfoService.getByUserNameAndMobile(username, mobile); | |||||
if (Objects.nonNull(user)) { | if (Objects.nonNull(user)) { | ||||
employeeCode = user.getEmployeeCode(); | employeeCode = user.getEmployeeCode(); | ||||
} | } | ||||
@@ -312,7 +310,9 @@ public class EarlyWarningInstanceNotStartTask { | |||||
.eq(Project::getAreaCode, areaCode) | .eq(Project::getAreaCode, areaCode) | ||||
.eq(Project::getNewest, Boolean.TRUE) | .eq(Project::getNewest, Boolean.TRUE) | ||||
.eq(Project::getStatus, projectStatus)); | .eq(Project::getStatus, projectStatus)); | ||||
if (needNextProjects.isEmpty()) { | |||||
return; | |||||
} | |||||
List<String> projectCodes = needNextProjects.stream().map(Project::getProjectCode).collect(Collectors.toList()); | List<String> projectCodes = needNextProjects.stream().map(Project::getProjectCode).collect(Collectors.toList()); | ||||
List<Operation> operations = operationService.list(Wrappers.lambdaQuery(Operation.class) | List<Operation> operations = operationService.list(Wrappers.lambdaQuery(Operation.class) | ||||
@@ -396,7 +396,7 @@ public class EarlyWarningInstanceNotStartTask { | |||||
String employeeCode = null; | String employeeCode = null; | ||||
String username = needToWaringProject.getContactName(); | String username = needToWaringProject.getContactName(); | ||||
String mobile = needToWaringProject.getContactPhone(); | String mobile = needToWaringProject.getContactPhone(); | ||||
if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)) { | |||||
if (StrUtil.isAllNotBlank(username, mobile)) { | |||||
UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) | UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) | ||||
.eq(UserInfo::getUsername, username) | .eq(UserInfo::getUsername, username) | ||||
.eq(UserInfo::getMobile, mobile) | .eq(UserInfo::getMobile, mobile) | ||||
@@ -3,6 +3,7 @@ package com.hz.pm.api.user.service; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.baomidou.mybatisplus.extension.service.IService; | import com.baomidou.mybatisplus.extension.service.IService; | ||||
import com.hz.pm.api.common.model.constant.BizConst; | |||||
import com.hz.pm.api.user.model.entity.UserInfo; | import com.hz.pm.api.user.model.entity.UserInfo; | ||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
@@ -35,4 +36,11 @@ public interface IUserInfoService extends IService<UserInfo> { | |||||
return CollUtils.listToMap(list(query), UserInfo::getMhUserId, UserInfo::getId); | return CollUtils.listToMap(list(query), UserInfo::getMhUserId, UserInfo::getId); | ||||
} | } | ||||
default UserInfo getByUserNameAndMobile(String userName, String mobile) { | |||||
return getOne(Wrappers.lambdaQuery(UserInfo.class) | |||||
.eq(UserInfo::getMobile, mobile) | |||||
.eq(UserInfo::getUsername, userName) | |||||
.last(BizConst.LIMIT_1)); | |||||
} | |||||
} | } |