@@ -47,6 +47,4 @@ public interface UserInfoHelper { | |||
* @return | |||
*/ | |||
String getUserEmpPosUnitCode(Long userId); | |||
List<UserInfo> getUsersByRoleType(String roleType); | |||
} |
@@ -4,8 +4,6 @@ import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.toolkit.StringUtils; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.google.common.collect.Lists; | |||
import com.ningdatech.pmapi.common.constant.BizConst; | |||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; | |||
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; | |||
@@ -14,7 +12,6 @@ import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | |||
import com.ningdatech.pmapi.sys.mapper.RoleMapper; | |||
import com.ningdatech.pmapi.sys.model.entity.Role; | |||
import com.ningdatech.pmapi.sys.model.entity.UserRole; | |||
import com.ningdatech.pmapi.sys.service.IRoleService; | |||
import com.ningdatech.pmapi.sys.service.IUserRoleService; | |||
import com.ningdatech.pmapi.user.constant.UserAvailableEnum; | |||
import com.ningdatech.pmapi.user.entity.UserInfo; | |||
@@ -43,9 +40,6 @@ public class UserInfoHelperImpl implements UserInfoHelper { | |||
private final IUserRoleService iUserRoleService; | |||
private final RoleMapper roleMapper; | |||
private final IRoleService roleService; | |||
@Override | |||
public String getOrganizationCode(Long userId) { | |||
UserFullInfoDTO userFullInfo = getUserFullInfo(userId); | |||
@@ -238,22 +232,4 @@ public class UserInfoHelperImpl implements UserInfoHelper { | |||
UserFullInfoDTO userFullInfo = getUserFullInfo(userId); | |||
return userFullInfo.getEmpPosUnitCode(); | |||
} | |||
@Override | |||
public List<UserInfo> getUsersByRoleType(String roleType) { | |||
Role regionRole = roleService.getOne(Wrappers.lambdaQuery(Role.class) | |||
.eq(Role::getCode, roleType) | |||
.last(BizConst.LIMIT_1)); | |||
if(Objects.isNull(regionRole)){ | |||
return Collections.emptyList(); | |||
} | |||
List<UserRole> userRoles = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) | |||
.eq(UserRole::getRoleId, regionRole.getId())); | |||
if(CollUtil.isEmpty(userRoles)){ | |||
return Collections.emptyList(); | |||
} | |||
List<Long> userIds = userRoles.stream().map(UserRole::getUserId) | |||
.collect(Collectors.toList()); | |||
return userInfoService.listByIds(userIds); | |||
} | |||
} |
@@ -8,7 +8,6 @@ import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.pmapi.common.constant.BizConst; | |||
import com.ningdatech.pmapi.common.enumeration.CommonEnum; | |||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.Operation; | |||
import com.ningdatech.pmapi.projectdeclared.service.IContractService; | |||
@@ -19,6 +18,7 @@ import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaratio | |||
import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.sys.manage.EarlyWarningManage; | |||
import com.ningdatech.pmapi.sys.manage.RoleManage; | |||
import com.ningdatech.pmapi.user.entity.UserInfo; | |||
import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; | |||
import com.ningdatech.pmapi.user.service.IUserInfoService; | |||
@@ -66,7 +66,7 @@ public class EarlyWarningInstanceNotStartTask { | |||
private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; | |||
private final UserInfoHelper userInfoHelper; | |||
private final RoleManage roleManage; | |||
@Scheduled(cron = "0 0/2 * * * ?") | |||
public void doEarlyWarningDeclared() throws UnknownHostException { | |||
@@ -414,7 +414,7 @@ public class EarlyWarningInstanceNotStartTask { | |||
for(ProjectRenewalFundDeclaration needToWaringProject : needToWaringProjects){ | |||
Project project = projectService.getProjectByCode(needToWaringProject.getProjectCode()); | |||
//去预警通知 发给区管 | |||
List<UserInfo> users = userInfoHelper.getUsersByRoleType(RoleEnum.REGION_MANAGER.name()); | |||
List<UserInfo> users = roleManage.getUsersByRoleType(RoleEnum.REGION_MANAGER.name()); | |||
for(UserInfo user : users){ | |||
earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,time,null, | |||
needToWaringProject.getUpdateOn(),user.getEmployeeCode(),project, | |||
@@ -1,27 +1,26 @@ | |||
package com.ningdatech.pmapi.sys.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
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.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.pmapi.common.constant.BizConst; | |||
import com.ningdatech.pmapi.sys.model.dto.MenuDataScopeDTO; | |||
import com.ningdatech.pmapi.sys.model.entity.Menu; | |||
import com.ningdatech.pmapi.sys.model.entity.Role; | |||
import com.ningdatech.pmapi.sys.model.entity.RoleMenu; | |||
import com.ningdatech.pmapi.sys.model.entity.RoleMenuDatascope; | |||
import com.ningdatech.pmapi.sys.model.entity.*; | |||
import com.ningdatech.pmapi.sys.model.req.RolePageReq; | |||
import com.ningdatech.pmapi.sys.model.vo.MenuRoleVO; | |||
import com.ningdatech.pmapi.sys.model.vo.RoleVO; | |||
import com.ningdatech.pmapi.sys.service.IMenuService; | |||
import com.ningdatech.pmapi.sys.service.IRoleMenuDatascopeService; | |||
import com.ningdatech.pmapi.sys.service.IRoleMenuService; | |||
import com.ningdatech.pmapi.sys.service.IRoleService; | |||
import com.ningdatech.pmapi.sys.service.*; | |||
import com.ningdatech.pmapi.user.entity.UserInfo; | |||
import com.ningdatech.pmapi.user.service.IUserInfoService; | |||
import lombok.RequiredArgsConstructor; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.stereotype.Component; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import java.util.stream.Collectors; | |||
@@ -43,6 +42,10 @@ public class RoleManage { | |||
private final IRoleMenuService roleMenuService; | |||
private final IRoleMenuDatascopeService roleMenuDatascopeService; | |||
private final IUserRoleService iUserRoleService; | |||
private final IUserInfoService userInfoService; | |||
public PageVo<RoleVO> queryList(RolePageReq rolePageReq) { | |||
Page<Role> page = rolePageReq.page(); | |||
LambdaQueryWrapper<Role> wrapper = Wrappers.lambdaQuery(Role.class); | |||
@@ -87,4 +90,20 @@ public class RoleManage { | |||
}); | |||
} | |||
public List<UserInfo> getUsersByRoleType(String roleType) { | |||
Role regionRole = roleService.getOne(Wrappers.lambdaQuery(Role.class) | |||
.eq(Role::getCode, roleType) | |||
.last(BizConst.LIMIT_1)); | |||
if(Objects.isNull(regionRole)){ | |||
return Collections.emptyList(); | |||
} | |||
List<UserRole> userRoles = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) | |||
.eq(UserRole::getRoleId, regionRole.getId())); | |||
if(CollUtil.isEmpty(userRoles)){ | |||
return Collections.emptyList(); | |||
} | |||
List<Long> userIds = userRoles.stream().map(UserRole::getUserId) | |||
.collect(Collectors.toList()); | |||
return userInfoService.listByIds(userIds); | |||
} | |||
} |