|
@@ -21,6 +21,7 @@ import com.fdkankan.fusion.httpClient.response.FdkkLoginVo;
|
|
|
import com.fdkankan.fusion.httpClient.response.FdkkResponse;
|
|
|
import com.fdkankan.fusion.response.CameraVo;
|
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -32,6 +33,7 @@ import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
+@Slf4j
|
|
|
public class FdService {
|
|
|
|
|
|
@Autowired
|
|
@@ -136,4 +138,34 @@ public class FdService {
|
|
|
throw new BusinessException(code,message);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ if(pageType.equals("view") && !viewAuth){
|
|
|
+ throw new BusinessException(ResultCode.NOT_PERMISSION);
|
|
|
+ }
|
|
|
+ if(pageType.equals("edit") && !editAuth){
|
|
|
+ throw new BusinessException(ResultCode.NOT_PERMISSION);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|