Commit 4cf43b1c by kangxiaoshan

权限处理

parent 0587e349
...@@ -9,6 +9,7 @@ import common.service.UserService; ...@@ -9,6 +9,7 @@ import common.service.UserService;
import dic.ContractStatusEnum; import dic.ContractStatusEnum;
import dic.ContractTypeEnum; import dic.ContractTypeEnum;
import dic.RoleEnum; import dic.RoleEnum;
import net.sf.json.JSONArray;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -101,7 +102,6 @@ public class ContractServiceImpl implements ContractService { ...@@ -101,7 +102,6 @@ public class ContractServiceImpl implements ContractService {
@Autowired @Autowired
ContractRelationRepository contractRelationRepository; ContractRelationRepository contractRelationRepository;
@Autowired @Autowired
FlowChangeRepository flowChangeRepository; FlowChangeRepository flowChangeRepository;
...@@ -114,10 +114,12 @@ public class ContractServiceImpl implements ContractService { ...@@ -114,10 +114,12 @@ public class ContractServiceImpl implements ContractService {
@Autowired @Autowired
SalesRepository salesRepository; SalesRepository salesRepository;
@Autowired @Autowired
PackageBaseRepository packageBaseRepository; PackageBaseRepository packageBaseRepository;
@Autowired
AuthRepository authRepository;
@Override @Override
public Map<String, Object> checkAccount(String email, String platfrom) { public Map<String, Object> checkAccount(String email, String platfrom) {
...@@ -1078,10 +1080,13 @@ public class ContractServiceImpl implements ContractService { ...@@ -1078,10 +1080,13 @@ public class ContractServiceImpl implements ContractService {
List<String> ids = new ArrayList<>(idsDic.keySet()); List<String> ids = new ArrayList<>(idsDic.keySet());
Auth auth = authRepository.findByUser(loginAccount.getId());
if(RoleEnum.FINANCE.getKey().equals(loginAccount.getRole())){ if(RoleEnum.FINANCE.getKey().equals(loginAccount.getRole())){
//财务 按签约主体查看 //财务 按签约主体查看
List bodyids = Arrays.asList(loginAccount.getAuthExtend().split(",")); // List bodyids = Arrays.asList(loginAccount.getAuthExtend().split(","));
List bodyids = JSONArray.fromObject(auth.getAuthExtend());
if (!StringUtils.isEmpty(contractId)) { if (!StringUtils.isEmpty(contractId)) {
if (ids != null && ids.size() > 0) { if (ids != null && ids.size() > 0) {
...@@ -1094,7 +1099,8 @@ public class ContractServiceImpl implements ContractService { ...@@ -1094,7 +1099,8 @@ public class ContractServiceImpl implements ContractService {
}else if(RoleEnum.SALSEMAN.getKey().equals(loginAccount.getRole())){ }else if(RoleEnum.SALSEMAN.getKey().equals(loginAccount.getRole())){
//销售 按签约合同人查看 //销售 按签约合同人查看
List salseid = Arrays.asList(loginAccount.getAuthExtend().split(",")); // List salseid = Arrays.asList(loginAccount.getAuthExtend().split(","));
List salseid = JSONArray.fromObject(auth.getAuthExtend());
if (!StringUtils.isEmpty(contractId)) { if (!StringUtils.isEmpty(contractId)) {
......
...@@ -37,6 +37,7 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { ...@@ -37,6 +37,7 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
//鉴权信息的无用前缀,默认为空 //鉴权信息的无用前缀,默认为空
private String httpHeaderPrefix = ""; private String httpHeaderPrefix = "";
public void setHttpHeaderName(String httpHeaderName) { public void setHttpHeaderName(String httpHeaderName) {
this.httpHeaderName = httpHeaderName; this.httpHeaderName = httpHeaderName;
} }
...@@ -76,10 +77,11 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { ...@@ -76,10 +77,11 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
boolean loginStatus = redisLoginStatusManager.getLoginStatusByKey(token); boolean loginStatus = redisLoginStatusManager.getLoginStatusByKey(token);
if (!StringUtil.isEmpty(key)) { if (!StringUtil.isEmpty(key)) {
User one = userRepository.findOne(Long.parseLong(key));
User sessionAct = (User) request.getSession().getAttribute(Constant.CURRENT_ACCOUNT); User sessionAct = (User) request.getSession().getAttribute(Constant.CURRENT_ACCOUNT);
// 可这里查出权限
if (sessionAct == null) { if (sessionAct == null) {
User one = userRepository.findOne(Long.parseLong(key));
request.getSession().setAttribute(Constant.CURRENT_ACCOUNT,one); request.getSession().setAttribute(Constant.CURRENT_ACCOUNT,one);
} }
return true; return true;
......
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