From 2413961c60525021d6cc5f5b7e4db8a793a8bfa3 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 6 Mar 2024 17:41:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE=E5=BA=93?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/projectlib/manage/AnnualPlanLibManage.java | 56 ++++++++----- .../pm/api/projectlib/manage/ProjectLibManage.java | 94 +++++++++++----------- .../manage/ProjectRenewalFundManage.java | 94 ++++++++++++---------- .../mapper/ProjectRenewalFundDeclarationMapper.xml | 2 +- .../ProjectRenewalFundDeclarationServiceImpl.java | 13 +-- .../task/EarlyWarningInstanceNotStartTask.java | 12 +-- .../hz/pm/api/user/service/IUserInfoService.java | 8 ++ 7 files changed, 155 insertions(+), 124 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java index 31f6c8d..fa22332 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java @@ -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.IProjectService; 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.util.LoginUserUtil; import com.ningdatech.basic.exception.BizException; @@ -79,7 +80,7 @@ import static com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum.*; public class AnnualPlanLibManage { private final IProjectService projectService; - + private final MhUnitCache mhUnitCache; private final IProjectApplicationService applicationService; private final StateMachineUtil stateMachine; private final UserInfoHelper userInfoHelper; @@ -104,7 +105,9 @@ public class AnnualPlanLibManage { query.orderByDesc(Project::getAnnualPlanAddTime); query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); // 数据权限 - buildProjectLibPermission(query); + if (!buildProjectLibPermission(query)) { + return PageVo.empty(); + } Page page = projectService.page(req.page(), query); long total; if ((total = page.getTotal()) == 0) { @@ -242,30 +245,37 @@ public class AnnualPlanLibManage { * * @param query \ */ - public void buildProjectLibPermission(LambdaQueryWrapper query) { + public boolean buildProjectLibPermission(LambdaQueryWrapper query) { + boolean queryState = Boolean.TRUE; UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user); if (!currentUserDataScope.isPresent()) { 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 childUnitIds = mhUnitCache.getChildrenIdsRecursion(user.getMhUnitId()); + childUnitIds.add(user.getMhUnitId()); + List 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) @@ -381,7 +391,9 @@ public class AnnualPlanLibManage { query.orderByDesc(Project::getAnnualPlanAddTime); query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); // 数据权限 - buildProjectLibPermission(query); + if (!buildProjectLibPermission(query)) { + throw BizException.wrap("暂无年度计划导出权限"); + } List projects = projectService.list(query); List list = projects.stream().map(p -> { AnnualLibExportDTO dto = new AnnualLibExportDTO(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java index bb80de4..2d72c1d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java @@ -205,7 +205,9 @@ public class ProjectLibManage { public PageVo projectLibListWithPermission(ProjectListReq req, UserFullInfoDTO user) { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - user = buildProjectLibPermission(query, user); + if (!buildProjectLibPermission(query, user)) { + return PageVo.empty(); + } //项目查最新 query.eq(Project::getNewest, Boolean.TRUE); Page 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 projectLibListApprove(ProjectListReq req, UserFullInfoDTO user) { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - user = buildProjectLibPermission(query, user); + if (!buildProjectLibPermission(query, user)) { + return PageVo.empty(); + } //项目查最新 query.eq(Project::getNewest, Boolean.TRUE); Page page = projectService.page(req.page(), query); if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } - UserFullInfoDTO finalUser = user; - Set instCodes = page.getRecords().stream() .map(Project::getInstCode) .filter(StringUtils::isNotBlank).collect(Collectors.toSet()); @@ -321,13 +323,12 @@ public class ProjectLibManage { item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); 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()) - && w.getSuperOrgCode().equals(finalUser.getMhUnitIdStr())) { + && w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { item.setCanPreDeclared(Boolean.TRUE); } item.setApprovedAmount(w.getApprovalAmount()); - // item.setAnnualPlanAmount(w.getAnnualPlanAmount()); item.setPrePlanProjectId(w.getPrePlanProjectId()); records.add(item); } @@ -389,9 +390,9 @@ public class ProjectLibManage { /** * 项目申报和项目归集的并集 * - * @param req - * @param user - * @return + * @param req \ + * @param user \ + * @return \ */ public PageVo projectAllListWithPermission(ProjectListReq req, UserFullInfoDTO user) { if (!buildProjectLibPermission(req, user)) { @@ -1304,44 +1305,45 @@ public class ProjectLibManage { /** * build 项目的角色权限到req * - * @param query + * @param query 、 */ - public UserFullInfoDTO buildProjectLibPermission(LambdaQueryWrapper query, UserFullInfoDTO user) { + public boolean buildProjectLibPermission(LambdaQueryWrapper query, UserFullInfoDTO user) { + boolean queryState = true; Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user); if (!currentUserDataScope.isPresent()) { log.warn("没有取到权限信息 当前查询 没有权限条件"); - return user; - } - - switch (currentUserDataScope.get().getRole()) { - case NORMAL_MEMBER: - //普通用户 只能看到自己单位去申报的 - query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); - break; - case COMPANY_MANAGER: - List childUnitIds = mhUnitCache.getChildrenIdsRecursion(user.getMhUnitId()); - childUnitIds.add(user.getMhUnitId()); - List 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 childUnitIds = mhUnitCache.getChildrenIdsRecursion(user.getMhUnitId()); + childUnitIds.add(user.getMhUnitId()); + List 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) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java index 392b83e..d5eb00e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java @@ -8,15 +8,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.CommonConst; 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.entity.PaymentPlan; 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.model.dto.ProjectRenewalExportDTO; 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.ProjectAnnualPaymentPlan; 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.req.ProjectRenewalAuditReq; 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.ProjectLibListItemVO; 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.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.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 lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -92,6 +93,7 @@ public class ProjectRenewalFundManage { private final IPaymentPlanService paymentPlanService; private final IProjectAnnualPaymentPlanService projectPaymentPlanService; + private final MhUnitCache mhUnitCache; /** * 项目续建资金库列表 分页 @@ -101,7 +103,9 @@ public class ProjectRenewalFundManage { */ public PageVo list(ProjectRenewalListReq req, UserFullInfoDTO user) { Page page = req.page(); - req = buildProjectLibPermission(req, user); + if (!buildProjectLibPermission(req, user)) { + return PageVo.empty(); + } projectRenewalFundDeclarationService.pageSql(page, req); long total; if ((total = page.getTotal()) == 0) { @@ -611,37 +615,41 @@ public class ProjectRenewalFundManage { } } - public ProjectRenewalListReq buildProjectLibPermission(ProjectRenewalListReq req, UserFullInfoDTO user) { - Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user); - if (!currentUserDataScope.isPresent()) { + public boolean buildProjectLibPermission(ProjectRenewalListReq req, UserFullInfoDTO user) { + boolean queryState = Boolean.TRUE; + Optional dataScope = DataScopeUtil.getCurrentUserDataScope(user); + if (!dataScope.isPresent()) { 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 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; } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml index c2b3309..1358a95 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml @@ -65,7 +65,7 @@ and prfd.org_code = #{param.userValue} - and prfd.org_code = #{param.userValue} + and prfd.org_code in (${param.userValue}) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectRenewalFundDeclarationServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectRenewalFundDeclarationServiceImpl.java index b41edff..a7d32b9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectRenewalFundDeclarationServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectRenewalFundDeclarationServiceImpl.java @@ -1,12 +1,12 @@ package com.hz.pm.api.projectlib.service.impl; 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.model.entity.ProjectRenewalFundDeclaration; import com.hz.pm.api.projectlib.model.po.ProjectRenewalFundDeclarationPO; import com.hz.pm.api.projectlib.model.req.ProjectRenewalListReq; import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -20,12 +20,13 @@ import org.springframework.stereotype.Service; */ @Service @RequiredArgsConstructor -public class ProjectRenewalFundDeclarationServiceImpl extends - ServiceImpl implements IProjectRenewalFundDeclarationService { +public class ProjectRenewalFundDeclarationServiceImpl + extends ServiceImpl + implements IProjectRenewalFundDeclarationService { - private final ProjectRenewalFundDeclarationMapper mapper; @Override public Page pageSql(Page page, ProjectRenewalListReq req) { - return mapper.pageSql(page,req); + return baseMapper.pageSql(page, req); } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java index 3c1ad91..4c2d566 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java @@ -2,6 +2,7 @@ package com.hz.pm.api.scheduler.task; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.StopWatch; +import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -214,10 +215,7 @@ public class EarlyWarningInstanceNotStartTask { username = needToWaringProject.getResponsibleMan(); mobile = needToWaringProject.getResponsibleManMobile(); 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)) { employeeCode = user.getEmployeeCode(); } @@ -312,7 +310,9 @@ public class EarlyWarningInstanceNotStartTask { .eq(Project::getAreaCode, areaCode) .eq(Project::getNewest, Boolean.TRUE) .eq(Project::getStatus, projectStatus)); - + if (needNextProjects.isEmpty()) { + return; + } List projectCodes = needNextProjects.stream().map(Project::getProjectCode).collect(Collectors.toList()); List operations = operationService.list(Wrappers.lambdaQuery(Operation.class) @@ -396,7 +396,7 @@ public class EarlyWarningInstanceNotStartTask { String employeeCode = null; String username = needToWaringProject.getContactName(); String mobile = needToWaringProject.getContactPhone(); - if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)) { + if (StrUtil.isAllNotBlank(username, mobile)) { UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) .eq(UserInfo::getUsername, username) .eq(UserInfo::getMobile, mobile) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IUserInfoService.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IUserInfoService.java index a89597f..71d93f7 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IUserInfoService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IUserInfoService.java @@ -3,6 +3,7 @@ package com.hz.pm.api.user.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; 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.ningdatech.basic.util.CollUtils; @@ -35,4 +36,11 @@ public interface IUserInfoService extends IService { 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)); + } + }