Commit a7939a29 authored by 赵啸非's avatar 赵啸非

产品版本更新分站点

parent b02cc660
package com.mortals.xhx.base.framework.interceptor;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.AESUtil;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
......@@ -25,6 +28,7 @@ import javax.servlet.http.HttpServletRequest;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* token验证处理
......@@ -61,6 +65,9 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
@Value("${platform.type:cloud}")
private String platFormType;//版本,默认云服务版本
@Autowired
private ResourceService resourceService;
@Autowired
private UserService userService;
......@@ -112,6 +119,9 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
if(!ObjectUtils.isEmpty(temp)){
userEntity.setId(temp.getId());
}
//更新menul
Set<String> urls = resourceService.findUrlSetByUserId(userEntity.getId());
userEntity.setMenuUrl(generateMenuUrlCode(urls));
return userEntity;
}
} catch (Exception e) {
......@@ -122,6 +132,26 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
return null;
}
private String generateMenuUrlCode(Set<String> urls) {
try {
String securityKey = GlobalSysInfo.getPropertyValue(SysConstains.PROP_COOKIE_SECURITY_KEY);
StringBuilder sb = new StringBuilder();
if (urls != null && urls.size() > 0) {
for (String url : urls) {
int index = url.hashCode() & (Integer.MAX_VALUE - 1);
sb.append(index).append(",");
}
}
String menuUrl = sb.toString();
return AESUtil.encrypt(menuUrl, securityKey);
} catch (Throwable e) {
log.error("编码异常", e);
return null;
}
}
/**
* 设置用户信息
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment