找人
This commit is contained in:
@@ -149,5 +149,7 @@ public class CommonConstants {
|
|||||||
|
|
||||||
public static final Long LONG_ONE = 1L;
|
public static final Long LONG_ONE = 1L;
|
||||||
|
|
||||||
|
public static final String DEAULT_INVESTMENT_JOBNUMBER = "020125244825417786";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,13 @@ public class EnterpriseUserDAO {
|
|||||||
return enterpriseUserMapper.getUserInfoById( userId);
|
return enterpriseUserMapper.getUserInfoById( userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EnterpriseUserDO getUserInfoByJobnumber(String jobnumber){
|
||||||
|
if(StringUtils.isAnyBlank(jobnumber)){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return enterpriseUserMapper.getUserInfoByJobnumber(jobnumber);
|
||||||
|
}
|
||||||
|
|
||||||
public List<EnterpriseUserDO> getUserInfoByUserIds(List<String> userIdList){
|
public List<EnterpriseUserDO> getUserInfoByUserIds(List<String> userIdList){
|
||||||
if(CollectionUtils.isEmpty(userIdList)){
|
if(CollectionUtils.isEmpty(userIdList)){
|
||||||
return Lists.newArrayList();
|
return Lists.newArrayList();
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ public interface EnterpriseUserMapper {
|
|||||||
*/
|
*/
|
||||||
EnterpriseUserDO getUserInfoById(@Param("userId") String userId);
|
EnterpriseUserDO getUserInfoById(@Param("userId") String userId);
|
||||||
|
|
||||||
|
EnterpriseUserDO getUserInfoByJobnumber(@Param("jobnumber") String jobnumber);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量获取用户信息
|
* 批量获取用户信息
|
||||||
* @param userIdList
|
* @param userIdList
|
||||||
|
|||||||
@@ -41,6 +41,16 @@
|
|||||||
user_id = #{userId}
|
user_id = #{userId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getUserInfoByJobnumber" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>,
|
||||||
|
<include refid="Blob_Column_List"/>
|
||||||
|
from
|
||||||
|
enterprise_user_${enterpriseId}
|
||||||
|
where
|
||||||
|
jobnumber = #{jobnumber}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="getUserInfoByUserIds" resultMap="BaseResultMap">
|
<select id="getUserInfoByUserIds" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.cool.store.service.impl;
|
package com.cool.store.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.cool.store.constants.CommonConstants;
|
||||||
import com.cool.store.dao.EnterpriseUserDAO;
|
import com.cool.store.dao.EnterpriseUserDAO;
|
||||||
import com.cool.store.dao.RegionAreaConfigDao;
|
import com.cool.store.dao.RegionAreaConfigDao;
|
||||||
import com.cool.store.entity.*;
|
import com.cool.store.entity.*;
|
||||||
@@ -86,19 +87,23 @@ public class UserAuthMappingServiceImpl implements UserAuthMappingService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Long warRegionId = regionAreaConfigDao.getByWantShopAreaId(wantShopAreaId);
|
Long warRegionId = regionAreaConfigDao.getByWantShopAreaId(wantShopAreaId);
|
||||||
|
if(warRegionId == null){
|
||||||
|
return fillDefaultUser(userRoleEnum);
|
||||||
|
}
|
||||||
// 查找有战区权限的人
|
// 查找有战区权限的人
|
||||||
List<String> authWarRegionUserIdList = authWarRegionUser(warRegionId);
|
List<String> authWarRegionUserIdList = authWarRegionUser(warRegionId);
|
||||||
if(CollectionUtils.isEmpty(authWarRegionUserIdList)){
|
if(CollectionUtils.isEmpty(authWarRegionUserIdList)){
|
||||||
return null;
|
return fillDefaultUser(userRoleEnum);
|
||||||
}
|
}
|
||||||
Long roleId = userRoleEnum.getCode();
|
Long roleId = userRoleEnum.getCode();
|
||||||
List<String> hasRoleUserIdList = sysRoleMapper.getPositionUserIds(Collections.singletonList(String.valueOf(roleId)));
|
List<String> hasRoleUserIdList = sysRoleMapper.getPositionUserIds(Collections.singletonList(String.valueOf(roleId)));
|
||||||
if(UserRoleEnum.INVESTMENT_MANAGER.equals(userRoleEnum) && CollectionUtils.isEmpty(hasRoleUserIdList)){
|
if(CollectionUtils.isEmpty(hasRoleUserIdList)){
|
||||||
// 找大区经理 找不到找战区经理,再找不到找大区经理?
|
return fillDefaultUser(userRoleEnum);
|
||||||
roleId = UserRoleEnum.REGION_MANAGER.getCode();
|
|
||||||
hasRoleUserIdList = sysRoleMapper.getPositionUserIds(Collections.singletonList(String.valueOf(roleId)));
|
|
||||||
}
|
}
|
||||||
authWarRegionUserIdList.retainAll(hasRoleUserIdList);
|
authWarRegionUserIdList.retainAll(hasRoleUserIdList);
|
||||||
|
if(CollectionUtils.isEmpty(authWarRegionUserIdList)){
|
||||||
|
return fillDefaultUser(userRoleEnum);
|
||||||
|
}
|
||||||
if(UserRoleEnum.INVESTMENT_MANAGER.equals(userRoleEnum)){
|
if(UserRoleEnum.INVESTMENT_MANAGER.equals(userRoleEnum)){
|
||||||
// 按工号排序后放入redis
|
// 按工号排序后放入redis
|
||||||
redisUtilPool.listPushTail(investmentManagerKey, authWarRegionUserIdList.toArray(new String[authWarRegionUserIdList.size()]));
|
redisUtilPool.listPushTail(investmentManagerKey, authWarRegionUserIdList.toArray(new String[authWarRegionUserIdList.size()]));
|
||||||
@@ -110,6 +115,14 @@ public class UserAuthMappingServiceImpl implements UserAuthMappingService {
|
|||||||
return userDO;
|
return userDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private EnterpriseUserDO fillDefaultUser(UserRoleEnum userRoleEnum) {
|
||||||
|
if(UserRoleEnum.INVESTMENT_MANAGER.equals(userRoleEnum)){
|
||||||
|
EnterpriseUserDO defaultUser = enterpriseUserDAO.getUserInfoByJobnumber(CommonConstants.DEAULT_INVESTMENT_JOBNUMBER);
|
||||||
|
return defaultUser;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, List<String>> getUserIdByRoleIdAndRegionId(List<String> roleIds, Long regionId) {
|
public Map<String, List<String>> getUserIdByRoleIdAndRegionId(List<String> roleIds, Long regionId) {
|
||||||
if(CollectionUtils.isEmpty(roleIds) || Objects.isNull(regionId)){
|
if(CollectionUtils.isEmpty(roleIds) || Objects.isNull(regionId)){
|
||||||
|
|||||||
Reference in New Issue
Block a user