|
|
|
@@ -40,19 +40,27 @@ public class TtSpuGetResultAdapter implements JsonSerializer<TtSpuGetResult>, Js |
|
|
|
@Override |
|
|
|
public TtSpuGetResult deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { |
|
|
|
TtSpuGetResult spuGetResult = new TtSpuGetResult(); |
|
|
|
JsonObject syncObject = json.getAsJsonObject().get("spu_detail").getAsJsonObject(); |
|
|
|
TtSpuSync spuSync = TtWebGsonBuilder.create().fromJson(syncObject, TtSpuSync.class); |
|
|
|
spuGetResult.setSpuDetail(spuSync); |
|
|
|
JsonElement spu_detail = json.getAsJsonObject().get("spu_detail"); |
|
|
|
if(spu_detail != null){ |
|
|
|
JsonObject syncObject = spu_detail.getAsJsonObject(); |
|
|
|
TtSpuSync spuSync = TtWebGsonBuilder.create().fromJson(syncObject, TtSpuSync.class); |
|
|
|
spuGetResult.setSpuDetail(spuSync); |
|
|
|
} |
|
|
|
|
|
|
|
List<TtSpuSync> spuDraft = new ArrayList<>(); |
|
|
|
JsonArray jsonArray = json.getAsJsonObject().get("spu_draft").getAsJsonArray(); |
|
|
|
if(jsonArray != null && jsonArray.size() > 0){ |
|
|
|
for (int i = 0;i < jsonArray.size(); i++){ |
|
|
|
JsonObject asJsonObject = jsonArray.get(i).getAsJsonObject(); |
|
|
|
TtSpuSync spuSync1 = TtWebGsonBuilder.create().fromJson(asJsonObject, TtSpuSync.class); |
|
|
|
spuDraft.add(spuSync1); |
|
|
|
|
|
|
|
JsonElement spu_draft = json.getAsJsonObject().get("spu_draft"); |
|
|
|
if(spu_draft != null){ |
|
|
|
JsonArray jsonArray = spu_draft.getAsJsonArray(); |
|
|
|
if(jsonArray != null && jsonArray.size() > 0){ |
|
|
|
for (int i = 0;i < jsonArray.size(); i++){ |
|
|
|
JsonObject asJsonObject = jsonArray.get(i).getAsJsonObject(); |
|
|
|
TtSpuSync spuSync1 = TtWebGsonBuilder.create().fromJson(asJsonObject, TtSpuSync.class); |
|
|
|
spuDraft.add(spuSync1); |
|
|
|
} |
|
|
|
} |
|
|
|
spuGetResult.setSpuDraft(spuDraft); |
|
|
|
} |
|
|
|
spuGetResult.setSpuDraft(spuDraft); |
|
|
|
return spuGetResult; |
|
|
|
} |
|
|
|
|
|
|
|
|