|
@@ -82,38 +82,39 @@ public class KfcPublish implements ProductPublish {
|
|
kfcShopsRequest.setOt(string);
|
|
kfcShopsRequest.setOt(string);
|
|
ShopsResponse shops = kfcApi.shops(kfcShopsRequest);
|
|
ShopsResponse shops = kfcApi.shops(kfcShopsRequest);
|
|
shops.getData().forEach(it -> {
|
|
shops.getData().forEach(it -> {
|
|
- LocationModel locationModel = new LocationModel();
|
|
|
|
- try {
|
|
|
|
-
|
|
|
|
- locationModel.setLongitude(it.getLon());
|
|
|
|
- locationModel.setLatitude(it.getLat());
|
|
|
|
-
|
|
|
|
- productCenterStream.send(List.of(
|
|
|
|
- ProductPushModel.builder()
|
|
|
|
- .regionCode(productTriggerTask.getRegion().getCode())
|
|
|
|
- .pid(it.getShopCode())
|
|
|
|
- .address(it.getAddress())
|
|
|
|
- .productType(ProductType.Restaurant)
|
|
|
|
- .locationPoint(locationModel)
|
|
|
|
- .title(it.getShopName())
|
|
|
|
- .meta(Map.of("shop", it, "ot", string))
|
|
|
|
- .build()));
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
|
|
+ LocationModel locationModel = new LocationModel();
|
|
|
|
+ try {
|
|
|
|
+
|
|
|
|
+ locationModel.setLongitude(it.getLon());
|
|
|
|
+ locationModel.setLatitude(it.getLat());
|
|
|
|
+
|
|
|
|
+ productCenterStream.send(List.of(
|
|
|
|
+ ProductPushModel.builder()
|
|
|
|
+ .regionCode(productTriggerTask.getRegion().getCode())
|
|
|
|
+ .pid(it.getId())
|
|
|
|
+ .address(it.getAddress())
|
|
|
|
+ .productType(ProductType.Restaurant)
|
|
|
|
+ .locationPoint(locationModel)
|
|
|
|
+ .title(it.getShopName())
|
|
|
|
+ .meta(Map.of("shop", it, "ot", string))
|
|
|
|
+ .build()));
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
|
|
try {
|
|
try {
|
|
JSONObject menus = kfcApi.menus(it.getId());
|
|
JSONObject menus = kfcApi.menus(it.getId());
|
|
ArrayList arrayList = (ArrayList) menus.getByPath("data.menuVoList");
|
|
ArrayList arrayList = (ArrayList) menus.getByPath("data.menuVoList");
|
|
- arrayList.forEach(list-> {
|
|
|
|
|
|
+ arrayList.forEach(list -> {
|
|
|
|
|
|
JSONArray jsonArray = new JSONArray(list);
|
|
JSONArray jsonArray = new JSONArray(list);
|
|
- jsonArray.forEach(item->{
|
|
|
|
|
|
+ jsonArray.forEach(item -> {
|
|
JSONObject jsonObject = (JSONObject) item;
|
|
JSONObject jsonObject = (JSONObject) item;
|
|
Object productId = jsonObject.get("productId");
|
|
Object productId = jsonObject.get("productId");
|
|
Object nameCn = jsonObject.get("nameCn");
|
|
Object nameCn = jsonObject.get("nameCn");
|
|
Object priceHead = jsonObject.get("priceHead");
|
|
Object priceHead = jsonObject.get("priceHead");
|
|
Object imageUrl = jsonObject.get("imageUrl");
|
|
Object imageUrl = jsonObject.get("imageUrl");
|
|
|
|
+ jsonObject.set("shop", it);
|
|
productCenterStream.send(List.of(
|
|
productCenterStream.send(List.of(
|
|
ProductPushModel.builder()
|
|
ProductPushModel.builder()
|
|
.regionCode(productTriggerTask.getRegion().getCode())
|
|
.regionCode(productTriggerTask.getRegion().getCode())
|
|
@@ -124,16 +125,17 @@ public class KfcPublish implements ProductPublish {
|
|
.title((String) nameCn)
|
|
.title((String) nameCn)
|
|
.cover(new String[]{(String) imageUrl})
|
|
.cover(new String[]{(String) imageUrl})
|
|
.salePrice(new BigDecimal(String.valueOf(priceHead)).multiply(BigDecimal.valueOf(100)).longValue())
|
|
.salePrice(new BigDecimal(String.valueOf(priceHead)).multiply(BigDecimal.valueOf(100)).longValue())
|
|
- .meta(Map.of("menus", item, "ot", string))
|
|
|
|
|
|
+ .meta(Map.of("menus", jsonObject, "ot", string))
|
|
.build()));
|
|
.build()));
|
|
|
|
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
- }catch (Exception e){}
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
);
|
|
);
|
|
}
|
|
}
|