|
|
|
@ -18,6 +18,9 @@ package org.springblade.auth.service;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.alibaba.nacos.common.utils.StringUtils; |
|
|
|
|
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; |
|
|
|
|
import com.logpm.basicdata.entity.WarehouseParcelListEntity; |
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataWarehouseClient; |
|
|
|
|
import io.jsonwebtoken.Claims; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.SneakyThrows; |
|
|
|
@ -67,6 +70,8 @@ public class BladeUserDetailsServiceImpl implements UserDetailsService {
|
|
|
|
|
private final BladeRedis bladeRedis; |
|
|
|
|
private final JwtProperties jwtProperties; |
|
|
|
|
|
|
|
|
|
private final IBasicdataWarehouseClient basicdataWarehouseClient; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@SneakyThrows |
|
|
|
|
public BladeUserDetails loadUserByUsername(String username) { |
|
|
|
@ -156,19 +161,15 @@ public class BladeUserDetailsServiceImpl implements UserDetailsService {
|
|
|
|
|
throw new UserDeniedAuthorizationException(TokenUtil.ACCOUNT_DISABLE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 绑定仓库
|
|
|
|
|
String key = CacheNames.tenantKeyObj(tenantId, CacheNames.USER_WAREHOUSE_KEY, user.getId()); |
|
|
|
|
try{ |
|
|
|
|
Object json = bladeRedis.getRedisTemplate().opsForValue().get(key); |
|
|
|
|
if(ObjectUtil.isNotEmpty(json)){ |
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(json.toString()); |
|
|
|
|
if(ObjectUtil.isNotEmpty(jsonObject)){ |
|
|
|
|
userInfo.getDetail().put("warehouse_id",jsonObject.get("id")); |
|
|
|
|
userInfo.getDetail().put("warehouse_name",jsonObject.get("name")); |
|
|
|
|
} |
|
|
|
|
// 绑定仓库
|
|
|
|
|
try { |
|
|
|
|
BasicdataWarehouseEntity bls = basicdataWarehouseClient.addWarehouseSingle(user.getDeptId(), user.getTenantId(), user.getId()); |
|
|
|
|
if (ObjectUtil.isNotEmpty(bls)) { |
|
|
|
|
userInfo.getDetail().put("warehouse_id", bls.getId()); |
|
|
|
|
userInfo.getDetail().put("warehouse_name", bls.getName()); |
|
|
|
|
} |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.error("登录获取仓库信息报错 {}",e.getMessage()); |
|
|
|
|
} catch ( Exception e) { |
|
|
|
|
log.error("登录获取仓库信息报错 {}", e.getMessage()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 成功则清除登录错误次数
|
|
|
|
|