找人
This commit is contained in:
@@ -13,24 +13,24 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
public enum UserRoleEnum {
|
||||
|
||||
INVESTMENT_MANAGER(100000000, "招商经理"),
|
||||
SELECT_SITE_MANAGER(110000000, "选址人员"),
|
||||
REGION_MANAGER(120000000, "大区经理"),
|
||||
THEATER_MANAGER(130000000, "战区经理"),
|
||||
INVESTMENT_MANAGER(100000000L, "招商经理"),
|
||||
SELECT_SITE_MANAGER(110000000L, "选址人员"),
|
||||
REGION_MANAGER(120000000L, "大区经理"),
|
||||
THEATER_MANAGER(130000000L, "战区经理"),
|
||||
;
|
||||
|
||||
private Integer code;
|
||||
private Long code;
|
||||
private String desc;
|
||||
|
||||
protected static final Map<String, UserRoleEnum> map = Arrays.stream(values()).collect(
|
||||
Collectors.toMap(UserRoleEnum::getDesc, Function.identity()));
|
||||
|
||||
UserRoleEnum(Integer code, String desc) {
|
||||
UserRoleEnum(Long code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
public Long getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,13 +72,12 @@ public class UserAuthMappingServiceImpl implements UserAuthMappingService {
|
||||
*/
|
||||
@Override
|
||||
public EnterpriseUserDO getUserByRoleEnumAndAreaId(UserRoleEnum userRoleEnum, Long wantShopAreaId) {
|
||||
String roleName = userRoleEnum.getDesc();
|
||||
if(StringUtils.isBlank(roleName) || Objects.isNull(wantShopAreaId)){
|
||||
if(Objects.isNull(userRoleEnum) || Objects.isNull(wantShopAreaId)){
|
||||
return null;
|
||||
}
|
||||
String suitableUserId = null;
|
||||
String investmentManagerKey = redisConstantUtil.getInvestmentManagerKey(wantShopAreaId);
|
||||
if(UserRoleEnum.INVESTMENT_MANAGER.getDesc().equals(roleName)){
|
||||
if(UserRoleEnum.INVESTMENT_MANAGER.equals(userRoleEnum)){
|
||||
suitableUserId = redisUtilPool.rpopStr(investmentManagerKey);
|
||||
if(StringUtils.isNotBlank(suitableUserId)){
|
||||
EnterpriseUserDO userDO = enterpriseUserDAO.getUserInfoById(suitableUserId);
|
||||
@@ -91,17 +90,15 @@ public class UserAuthMappingServiceImpl implements UserAuthMappingService {
|
||||
if(CollectionUtils.isEmpty(authWarRegionUserIdList)){
|
||||
return null;
|
||||
}
|
||||
SysRoleDO sysRoleDO = sysRoleMapper.getRolesByNameAndSource(roleName, RoleSourceEnum.CREATE.getCode());
|
||||
Long roleId = sysRoleDO.getId();
|
||||
Long roleId = userRoleEnum.getCode();
|
||||
List<String> hasRoleUserIdList = sysRoleMapper.getPositionUserIds(Collections.singletonList(String.valueOf(roleId)));
|
||||
if(UserRoleEnum.INVESTMENT_MANAGER.getDesc().equals(roleName) && CollectionUtils.isEmpty(hasRoleUserIdList)){
|
||||
if(UserRoleEnum.INVESTMENT_MANAGER.equals(userRoleEnum) && CollectionUtils.isEmpty(hasRoleUserIdList)){
|
||||
// 找大区经理 找不到找战区经理,再找不到找大区经理?
|
||||
sysRoleDO = sysRoleMapper.getRolesByNameAndSource(UserRoleEnum.REGION_MANAGER.getDesc(), RoleSourceEnum.CREATE.getCode());
|
||||
roleId = sysRoleDO.getId();
|
||||
roleId = UserRoleEnum.REGION_MANAGER.getCode();
|
||||
hasRoleUserIdList = sysRoleMapper.getPositionUserIds(Collections.singletonList(String.valueOf(roleId)));
|
||||
}
|
||||
authWarRegionUserIdList.retainAll(hasRoleUserIdList);
|
||||
if(UserRoleEnum.INVESTMENT_MANAGER.getDesc().equals(roleName)){
|
||||
if(UserRoleEnum.INVESTMENT_MANAGER.equals(userRoleEnum)){
|
||||
// 按工号排序后放入redis
|
||||
redisUtilPool.listPushTail(investmentManagerKey, authWarRegionUserIdList.toArray(new String[authWarRegionUserIdList.size()]));
|
||||
suitableUserId = redisUtilPool.rpopStr(investmentManagerKey);
|
||||
|
||||
Reference in New Issue
Block a user