Commit 33e0970b by 吕明尚

判断团购是否在线

parent f6e9d86e
......@@ -287,35 +287,37 @@ public class SCouponServiceImpl extends ServiceImpl<SCouponMapper, SCoupon> impl
JSONArray products = entries.getJSONArray("products");
products.stream().forEach(item -> {
JSONObject jsonObject = (JSONObject) item;
JSONObject sku = jsonObject.getJSONObject("sku");
JSONObject product = jsonObject.getJSONObject("product");
JSONArray pois = product.getJSONArray("pois");
SCoupon sCoupon1 = sCouponList.get(sku.getStr("sku_id"));
if (ObjectUtils.isEmpty(sCoupon1)) {
SCoupon sCoupon = new SCoupon();
sCoupon.setSkuId(sku.getStr("sku_id"));
sCoupon.setName(sku.getStr("sku_name"));
sCoupon.setStartDate(new Date(product.getInt("sold_start_time") * 1000L));
sCoupon.setEndDate(new Date(product.getInt("sold_end_time") * 1000L));
sCoupon.setSubPrice(jsonObject.getBigDecimal("origin_amount").divide(new BigDecimal("100")));
sCoupon.setRoomType(RoomType.getCodeList());
sCoupon.setStoreType(StoreType.getCodeList());
sCoupon.setValidStartTime(DEFAULT_START_TIME);
sCoupon.setValidEndTime(DEFAULT_END_TIME);
sCoupon.setMinDuration(DEFAULT_DURATION);
sCoupon.setMaxDuration(DEFAULT_MAX_DURATION);
sCoupon.setMinPrice(new BigDecimal("0.00"));
sCoupon.setCouponType(CouponTypeEnum.CASH.getCode());
pois.stream().forEach(poi -> {
JSONObject jsonObject1 = (JSONObject) poi;
sCoupon.setStoreIds(sCoupon.getStoreIds() + "," + sStores.stream().filter(store -> store.getPoiId().equals(jsonObject1.getStr("poi_id"))).findFirst().get().getId());
});
sCouponList.put(sku.getStr("sku_id"), sCoupon);
} else {
pois.stream().forEach(poi -> {
JSONObject jsonObject1 = (JSONObject) poi;
sCoupon1.setStoreIds(sCoupon1.getStoreIds() + "," + sStores.stream().filter(store -> store.getPoiId().equals(jsonObject1.getStr("poi_id"))).findFirst().get().getId());
});
if (jsonObject.getInt("online_status").equals(YesNoEnum.yes.getIndex())) {
JSONObject sku = jsonObject.getJSONObject("sku");
JSONObject product = jsonObject.getJSONObject("product");
JSONArray pois = product.getJSONArray("pois");
SCoupon sCoupon1 = sCouponList.get(sku.getStr("sku_id"));
if (ObjectUtils.isEmpty(sCoupon1)) {
SCoupon sCoupon = new SCoupon();
sCoupon.setSkuId(sku.getStr("sku_id"));
sCoupon.setName(sku.getStr("sku_name"));
sCoupon.setStartDate(new Date(product.getInt("sold_start_time") * 1000L));
sCoupon.setEndDate(new Date(product.getInt("sold_end_time") * 1000L));
sCoupon.setSubPrice(jsonObject.getBigDecimal("origin_amount").divide(new BigDecimal("100")));
sCoupon.setRoomType(RoomType.getCodeList());
sCoupon.setStoreType(StoreType.getCodeList());
sCoupon.setValidStartTime(DEFAULT_START_TIME);
sCoupon.setValidEndTime(DEFAULT_END_TIME);
sCoupon.setMinDuration(DEFAULT_DURATION);
sCoupon.setMaxDuration(DEFAULT_MAX_DURATION);
sCoupon.setMinPrice(new BigDecimal("0.00"));
sCoupon.setCouponType(CouponTypeEnum.CASH.getCode());
pois.stream().forEach(poi -> {
JSONObject jsonObject1 = (JSONObject) poi;
sCoupon.setStoreIds(sCoupon.getStoreIds() + "," + sStores.stream().filter(store -> store.getPoiId().equals(jsonObject1.getStr("poi_id"))).findFirst().get().getId());
});
sCouponList.put(sku.getStr("sku_id"), sCoupon);
} else {
pois.stream().forEach(poi -> {
JSONObject jsonObject1 = (JSONObject) poi;
sCoupon1.setStoreIds(sCoupon1.getStoreIds() + "," + sStores.stream().filter(store -> store.getPoiId().equals(jsonObject1.getStr("poi_id"))).findFirst().get().getId());
});
}
}
});
return new ArrayList<>(sCouponList.values());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment