|
@@ -139,25 +139,35 @@ public class FdService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void checkCaseAuth(String caseId,String pageType,String token) {
|
|
|
+ public void checkCaseAuth(String caseId,String pageType,String token) {
|
|
|
if(StringUtils.isBlank(pageType) || StringUtils.isBlank(caseId)|| StringUtils.isBlank(token)){
|
|
|
throw new BusinessException(ResultCode.NOT_PERMISSION);
|
|
|
}
|
|
|
Boolean viewAuth = false;
|
|
|
Boolean editAuth = false;
|
|
|
- try {
|
|
|
- JSONObject jsonObject = fdKKClient.checkCaseAuth(Integer.valueOf(caseId),token);
|
|
|
- Integer code = jsonObject.getInteger("code");
|
|
|
- String message = jsonObject.getString("message");
|
|
|
- if(code != 0){
|
|
|
- throw new BusinessException(code,message);
|
|
|
+ String redisKey = "fusion:checkCase:caseId:%s:pageType:%s:token:%s";
|
|
|
+ String format = String.format(redisKey, caseId, pageType, token);
|
|
|
+ if(redisUtil.hasKey(format)){
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(redisUtil.get(format));
|
|
|
+ viewAuth = jsonObject.getBoolean("viewAuth");
|
|
|
+ editAuth = jsonObject.getBoolean("editAuth");
|
|
|
+ }else {
|
|
|
+ try {
|
|
|
+ JSONObject jsonObject = fdKKClient.checkCaseAuth(Integer.valueOf(caseId),token);
|
|
|
+ Integer code = jsonObject.getInteger("code");
|
|
|
+ String message = jsonObject.getString("message");
|
|
|
+ if(code != 0){
|
|
|
+ throw new BusinessException(code,message);
|
|
|
+ }
|
|
|
+ JSONObject data = jsonObject.getJSONObject("data");
|
|
|
+ viewAuth = data.getBoolean("viewAuth");
|
|
|
+ editAuth = data.getBoolean("editAuth");
|
|
|
+ redisUtil.set(format,data.toJSONString(),60);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.info("checkCaseAuth-error:",e);
|
|
|
}
|
|
|
- JSONObject data = jsonObject.getJSONObject("data");
|
|
|
- viewAuth = data.getBoolean("viewAuth");
|
|
|
- editAuth = data.getBoolean("editAuth");
|
|
|
- }catch (Exception e){
|
|
|
- log.info("checkCaseAuth-error:",e);
|
|
|
}
|
|
|
+
|
|
|
if(!viewAuth && !editAuth){
|
|
|
throw new BusinessException(ResultCode.NOT_PERMISSION);
|
|
|
}
|