|
|
@ -21,20 +21,23 @@ public class SingleNestDataTemplate implements DataTemplate { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Object handle(Object returnValue) { |
|
|
|
public Object handle(Object returnValue) { |
|
|
|
if (returnValue instanceof BaseReturn) { |
|
|
|
if (returnValue instanceof BaseReturn) { |
|
|
|
if (((BaseReturn) returnValue).getData() instanceof BaseReturn) { |
|
|
|
Object data = ((BaseReturn) returnValue).getData(); |
|
|
|
|
|
|
|
if (data instanceof BaseReturn) { |
|
|
|
returnValue = ((BaseReturn) returnValue).getData(); |
|
|
|
returnValue = ((BaseReturn) returnValue).getData(); |
|
|
|
|
|
|
|
} else if (data instanceof JSONObject && BaseReturnUtils.isBaseReturnFormat((JSONObject) data)) { |
|
|
|
|
|
|
|
return data; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return returnValue; |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (returnValue instanceof JSONObject) { |
|
|
|
} else if (returnValue instanceof JSONObject) { |
|
|
|
returnValue = BaseReturnUtils.parse((JSONObject) returnValue).getData(); |
|
|
|
return BaseReturnUtils.parse((JSONObject) returnValue).getData(); |
|
|
|
} else if (returnValue instanceof String) { |
|
|
|
} else if (returnValue instanceof String) { |
|
|
|
String sData = (String) returnValue; |
|
|
|
String sData = (String) returnValue; |
|
|
|
if (sData.startsWith("{") && sData.endsWith("}")) { |
|
|
|
if (sData.startsWith("{") && sData.endsWith("}")) { |
|
|
|
returnValue = BaseReturnUtils.parse(JSONObject.parseObject(sData)).getData(); |
|
|
|
return BaseReturnUtils.parse(JSONObject.parseObject(sData)).getData(); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
|
|
|
|
returnValue = BaseReturn.suc(returnValue); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return returnValue; |
|
|
|
return BaseReturn.suc(returnValue); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|