From 58dbadd303034fc45808f70b11bfec3622945f64 Mon Sep 17 00:00:00 2001 From: xhxu Date: Thu, 14 Apr 2022 15:05:49 +0800 Subject: [PATCH] //update test --- .../douyin/web/json/TtSpuGetAdapter.java | 3 ++- .../web/json/TtSpuStatusSyncAdapter.java | 3 ++- .../douyin/web/json/TtSpuSyncAdapter.java | 15 +++++++++------ .../web/json/TtSupplierSyncAdapter.java | 19 +++++++++++-------- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/json/TtSpuGetAdapter.java b/mallinkService/src/main/java/com/iformall/douyin/web/json/TtSpuGetAdapter.java index 37cdfd247..5b75840c4 100644 --- a/mallinkService/src/main/java/com/iformall/douyin/web/json/TtSpuGetAdapter.java +++ b/mallinkService/src/main/java/com/iformall/douyin/web/json/TtSpuGetAdapter.java @@ -34,7 +34,8 @@ public class TtSpuGetAdapter implements JsonSerializer, JsonDeserializ json.addProperty("need_spu_draft", spuGet.isNeedSpuDraft()); json.addProperty("spu_draft_count", spuGet.getSpuDraftcount()); if(spuGet.getSupplierIdsForFilterReason() != null && !spuGet.getSupplierIdsForFilterReason().isEmpty()){ - json.addProperty("supplier_ids_for_filter_reason", new JSONArray(Collections.singletonList(spuGet.getSupplierIdsForFilterReason())).toJSONString()); + JsonArray siffrJsonArray = new Gson().toJsonTree(spuGet.getSupplierIdsForFilterReason()).getAsJsonArray(); + json.add("supplier_ids_for_filter_reason",siffrJsonArray); } return json; } diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/json/TtSpuStatusSyncAdapter.java b/mallinkService/src/main/java/com/iformall/douyin/web/json/TtSpuStatusSyncAdapter.java index 4718ead47..4076bdfcc 100644 --- a/mallinkService/src/main/java/com/iformall/douyin/web/json/TtSpuStatusSyncAdapter.java +++ b/mallinkService/src/main/java/com/iformall/douyin/web/json/TtSpuStatusSyncAdapter.java @@ -31,7 +31,8 @@ public class TtSpuStatusSyncAdapter implements JsonSerializer, protected JsonObject convertToJson(TtSpuStatusSync spuSync) { JsonObject json = new JsonObject(); if(spuSync.getSpuExtIdList() != null && !spuSync.getSpuExtIdList().isEmpty()){ - json.addProperty("spu_ext_id_list", new JSONArray(Collections.singletonList(spuSync.getSpuExtIdList())).toJSONString()); + JsonArray seilJsonArray = new Gson().toJsonTree(spuSync.getSpuExtIdList()).getAsJsonArray(); + json.add("spu_ext_id_list",seilJsonArray); } json.addProperty("status", spuSync.getStatus()); return json; diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/json/TtSpuSyncAdapter.java b/mallinkService/src/main/java/com/iformall/douyin/web/json/TtSpuSyncAdapter.java index 0fdc5d73f..db9db07eb 100644 --- a/mallinkService/src/main/java/com/iformall/douyin/web/json/TtSpuSyncAdapter.java +++ b/mallinkService/src/main/java/com/iformall/douyin/web/json/TtSpuSyncAdapter.java @@ -32,29 +32,32 @@ public class TtSpuSyncAdapter implements JsonSerializer, JsonDeserial protected JsonObject convertToJson(TtSpuSync spuSync) { JsonObject json = new JsonObject(); if(spuSync.getEntryInfo() != null){ - json.addProperty("entry_info", spuSync.getEntryInfo().toString()); + json.add("entry_info", spuSync.getEntryInfo()); } if(spuSync.getFrontCategoryTag() != null && !spuSync.getFrontCategoryTag().isEmpty()){ - json.addProperty("front_category_tag", new JSONArray(Collections.singletonList(spuSync.getFrontCategoryTag())).toJSONString()); + JsonArray fctJsonArray = new Gson().toJsonTree(spuSync.getFrontCategoryTag()).getAsJsonArray(); + json.add("front_category_tag",fctJsonArray); } json.addProperty("recommend_word", spuSync.getRecommendWord()); json.addProperty("sort_weight", spuSync.getSortWeight()); if(spuSync.getSupplierExtIdList() != null && !spuSync.getSupplierExtIdList().isEmpty()){ - json.addProperty("supplier_ext_id_list", new JSONArray(Collections.singletonList(spuSync.getSupplierExtIdList())).toJSONString()); + JsonArray seilJsonArray = new Gson().toJsonTree(spuSync.getSupplierExtIdList()).getAsJsonArray(); + json.add("supplier_ext_id_list",seilJsonArray); } json.addProperty("price", spuSync.getPrice()); json.addProperty("spu_ext_id", spuSync.getSpuExtId()); if(spuSync.getImageList() != null && !spuSync.getImageList().isEmpty()){ - json.addProperty("image_list", new JSONArray(Collections.singletonList(spuSync.getImageList())).toJSONString()); + JsonArray imgJsonArray = new Gson().toJsonTree(spuSync.getImageList()).getAsJsonArray(); + json.add("supplier_ext_id_list",imgJsonArray); } json.addProperty("mp_settle_type", spuSync.getMpSettletype()); json.addProperty("origin_price", spuSync.getOriginPrice()); json.addProperty("take_rate", spuSync.getTakeRate()); if(spuSync.getAttribute() != null){ - json.addProperty("attribute", spuSync.getAttribute().toString()); + json.add("attribute", spuSync.getAttribute()); } if(spuSync.getHighlights() != null){ - json.addProperty("highlights", spuSync.getHighlights().toString()); + json.add("highlights", spuSync.getHighlights()); } json.addProperty("name", spuSync.getName()); json.addProperty("order_depends_on_date", spuSync.getOrderDependsOnDate()); diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/json/TtSupplierSyncAdapter.java b/mallinkService/src/main/java/com/iformall/douyin/web/json/TtSupplierSyncAdapter.java index d699ea16c..f139cb57b 100644 --- a/mallinkService/src/main/java/com/iformall/douyin/web/json/TtSupplierSyncAdapter.java +++ b/mallinkService/src/main/java/com/iformall/douyin/web/json/TtSupplierSyncAdapter.java @@ -34,15 +34,17 @@ public class TtSupplierSyncAdapter implements JsonSerializer, Js json.addProperty("contact_phone", supplierSync.getContactPhone()); json.addProperty("contact_tel", supplierSync.getContactTel()); if(supplierSync.getImages() != null && !supplierSync.getImages().isEmpty()){ - json.addProperty("images", new JSONArray(Collections.singletonList(supplierSync.getImages())).toJSONString()); + JsonArray imgJsonArray = new Gson().toJsonTree(supplierSync.getImages()).getAsJsonArray(); + json.add("images",imgJsonArray); } json.addProperty("merchant_uid", supplierSync.getMerchantUid()); if(supplierSync.getServiceProvider() != null){ - json.addProperty("service_provider", supplierSync.getServiceProvider().toString()); + json.add("service_provider",supplierSync.getServiceProvider()); } json.addProperty("supplier_ext_id", supplierSync.getSupplierExtId()); if(supplierSync.getTags() != null && !supplierSync.getTags().isEmpty()){ - json.addProperty("tags", new JSONArray(Collections.singletonList(supplierSync.getTags())).toJSONString()); + JsonArray tagJsonArray = new Gson().toJsonTree(supplierSync.getTags()).getAsJsonArray(); + json.add("tags",tagJsonArray); } json.addProperty("latitude", supplierSync.getLatitude()); json.addProperty("status", supplierSync.getStatus()); @@ -51,22 +53,23 @@ public class TtSupplierSyncAdapter implements JsonSerializer, Js json.addProperty("address", supplierSync.getAddress()); json.addProperty("avg_cost", supplierSync.getAvgCost()); if(supplierSync.getCustomerInfo() != null ){ - json.addProperty("customer_info", supplierSync.getCustomerInfo().toString()); + json.add("customer_info",supplierSync.getCustomerInfo()); } json.addProperty("description", supplierSync.getDescription()); json.addProperty("name", supplierSync.getName()); if(supplierSync.getRecommends() != null){ - json.addProperty("recommends", supplierSync.getRecommends().toString()); + json.add("recommends", supplierSync.getRecommends()); } if(supplierSync.getServices() != null){ - json.addProperty("services", supplierSync.getServices().toString()); + json.add("services",supplierSync.getServices()); } if(supplierSync.getAttributes() != null){ - json.addProperty("attributes", supplierSync.getAttributes().toString()); + json.add("attributes",supplierSync.getAttributes()); } json.addProperty("longitude", supplierSync.getLongitude()); if(supplierSync.getOpenTime() != null && !supplierSync.getOpenTime().isEmpty()){ - json.addProperty("open_time", new JSONArray(Collections.singletonList(supplierSync.getOpenTime())).toJSONString()); + JsonArray otJsonArray = new Gson().toJsonTree(supplierSync.getOpenTime()).getAsJsonArray(); + json.add("open_time",otJsonArray); } json.addProperty("poi_id", supplierSync.getPoiId()); json.addProperty("type", supplierSync.getType());