|
|
@ -46,12 +46,15 @@ public class EncryptionResponseBodyInterceptor implements ResponseBodyIntercepto |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Object handleReturnValue(String sk, String iv, Object returnValue) { |
|
|
|
private Object handleReturnValue(String sk, String iv, Object returnValue) { |
|
|
|
|
|
|
|
if (returnValue == null) { |
|
|
|
|
|
|
|
return returnValue; |
|
|
|
|
|
|
|
} |
|
|
|
if (returnValue instanceof BaseReturn) { |
|
|
|
if (returnValue instanceof BaseReturn) { |
|
|
|
BaseReturn br = (BaseReturn) returnValue; |
|
|
|
BaseReturn br = (BaseReturn) returnValue; |
|
|
|
if (br.getData() != null) { |
|
|
|
if (br.getData() != null) { |
|
|
|
br.setData(handleReturnValue(sk, iv, br.getData())); |
|
|
|
br.setData(handleReturnValue(sk, iv, br.getData())); |
|
|
|
return returnValue; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return returnValue; |
|
|
|
} else if (returnValue instanceof String) { |
|
|
|
} else if (returnValue instanceof String) { |
|
|
|
String str = (String) returnValue; |
|
|
|
String str = (String) returnValue; |
|
|
|
if (JSONUtil.isJsonObj(str)) { |
|
|
|
if (JSONUtil.isJsonObj(str)) { |
|
|
@ -60,11 +63,16 @@ public class EncryptionResponseBodyInterceptor implements ResponseBodyIntercepto |
|
|
|
} else if (returnValue instanceof JSONObject) { |
|
|
|
} else if (returnValue instanceof JSONObject) { |
|
|
|
JSONObject jObject = (JSONObject) returnValue; |
|
|
|
JSONObject jObject = (JSONObject) returnValue; |
|
|
|
if (BaseReturnUtils.isBaseReturnFormat(jObject)) { |
|
|
|
if (BaseReturnUtils.isBaseReturnFormat(jObject)) { |
|
|
|
|
|
|
|
if (jObject.get("data") != null) { |
|
|
|
jObject.put("data", handleReturnValue(sk, iv, jObject.get("data"))); |
|
|
|
jObject.put("data", handleReturnValue(sk, iv, jObject.get("data"))); |
|
|
|
|
|
|
|
} |
|
|
|
return jObject; |
|
|
|
return jObject; |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (returnValue instanceof Map) { |
|
|
|
} else if (returnValue instanceof Map && !((Map) returnValue).isEmpty()) { |
|
|
|
return handleReturnValue(sk, iv, new JSONObject((Map<String, Object>) returnValue)); |
|
|
|
Map map = (Map) returnValue; |
|
|
|
|
|
|
|
if (BaseReturnUtils.isBaseReturnFormat(map)) { |
|
|
|
|
|
|
|
return map.get("data") == null ? returnValue : handleReturnValue(sk, iv, new JSONObject((Map<String, Object>) returnValue)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return BodyCryptUtils.encrypt(sk, iv, returnValue); |
|
|
|
return BodyCryptUtils.encrypt(sk, iv, returnValue); |
|
|
|