| | |
| | | import com.yeshi.fanli.dto.jd.JDCouponInfo;
|
| | | import com.yeshi.fanli.dto.jd.JDShopInfo;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.dto.suning.SuningGoodsInfo;
|
| | | import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | |
| | |
|
| | | cg.setCouponTotalCount(0);
|
| | | cg.setGoodsId(Long.parseLong(goods.getGoodsId()));
|
| | | cg.setGoodsType(CommonGoods.GOODS_TYPE_PDD);
|
| | | cg.setGoodsType(CommonGoods.GOODS_TYPE_VIP);
|
| | | cg.setPicture(goods.getGoodsThumbUrl());
|
| | | cg.setPictureWhite(null);
|
| | | cg.setPrice(new BigDecimal(goods.getMarketPrice()));
|
| | |
| | | cg.setRate(new BigDecimal(goods.getCommissionRate()));
|
| | | cg.setSellerId(goods.getBrandId());
|
| | | cg.setSellerName(goods.getBrandName());
|
| | | cg.setShopType(CommonGoods.SHOP_TYPE_PDD);
|
| | | cg.setShopType(CommonGoods.SHOP_TYPE_VIP);
|
| | | cg.setState(CommonGoods.STATE_NORMAL);
|
| | | cg.setTitle(goods.getGoodsName());
|
| | | // 保留字段
|
| | |
| | | categoryInfo.setCid1(goods.getCategoryId());
|
| | | categoryInfo.setCid1Name(goods.getCategoryName());
|
| | | cg.setCategoryInfo(JSONObject.toJSON(categoryInfo).toString());
|
| | | //存放折扣价
|
| | | cg.setCouponStartPrice(new BigDecimal(goods.getVipPrice()));
|
| | | cg.setCouponInfo(MoneyBigDecimalUtil.getWithNoZera(MoneyBigDecimalUtil.mul(new BigDecimal(goods.getDiscount()), new BigDecimal(10))) + "折");
|
| | | return cg;
|
| | | }
|
| | |
|
| | | public static CommonGoods create(SuningGoodsInfo goods) {
|
| | | if (goods == null)
|
| | | return null;
|
| | |
|
| | | CommonGoods cg = new CommonGoods();
|
| | |
|
| | | if (goods.getCouponInfo() != null && !StringUtil.isNullOrEmpty(goods.getCouponInfo().getCouponUrl())) {// 有券
|
| | | cg.setCouponInfo(String.format("满%s元减%s元", goods.getCouponInfo().getBounsLimit(),
|
| | | goods.getCouponInfo().getCouponValue()));
|
| | | cg.setCouponAmount(new BigDecimal(goods.getCouponInfo().getCouponValue()));
|
| | | |
| | | if (goods.getCouponInfo().getCouponCount() == null) {
|
| | | cg.setCouponLeftCount(500000);
|
| | | cg.setCouponTotalCount(500000);
|
| | | } else {
|
| | | cg.setCouponLeftCount(Integer.parseInt(goods.getCouponInfo().getCouponCount()));
|
| | | cg.setCouponTotalCount(Integer.parseInt(goods.getCouponInfo().getCouponCount()));
|
| | | }
|
| | | |
| | | cg.setCouponStartPrice(new BigDecimal(goods.getCouponInfo().getBounsLimit()));
|
| | | } else {
|
| | | cg.setCouponLeftCount(0);
|
| | | cg.setCouponTotalCount(0);
|
| | | cg.setCouponAmount(new BigDecimal(0));
|
| | | }
|
| | |
|
| | | cg.setGoodsId(Long.parseLong(goods.getCommodityInfo().getCommodityCode()));
|
| | | cg.setGoodsType(CommonGoods.GOODS_TYPE_SUNING);
|
| | | if (goods.getCommodityInfo().getPictureUrl() != null && goods.getCommodityInfo().getPictureUrl().size() > 0)
|
| | | cg.setPicture(goods.getCommodityInfo().getPictureUrl().get(0).getPicUrl());
|
| | | cg.setPictureWhite(null);
|
| | | cg.setPrice(new BigDecimal(goods.getCommodityInfo().getSnPrice()));
|
| | |
|
| | | cg.setSales(Integer.parseInt(goods.getCommodityInfo().getMonthSales()));
|
| | | cg.setRate(new BigDecimal(goods.getCommodityInfo().getRate()));
|
| | | cg.setSellerId(Long.parseLong(goods.getCommodityInfo().getSupplierCode()));
|
| | | cg.setSellerName(goods.getCommodityInfo().getSupplierName());
|
| | | cg.setShopType(CommonGoods.SHOP_TYPE_SUNING);
|
| | | cg.setState(CommonGoods.STATE_NORMAL);
|
| | | cg.setTitle(goods.getCommodityInfo().getCommodityName());
|
| | | // 保留字段
|
| | | cg.setVideoCover(null);
|
| | | cg.setVideoUrl(null);
|
| | | cg.setState(0);
|
| | | cg.setMaterialLibType(1);
|
| | |
|
| | | // 分类信息
|
| | | CategoryInfoDTO categoryInfo = new CategoryInfoDTO();
|
| | | categoryInfo.setCid1(Long.parseLong(goods.getCategoryInfo().getFirstSaleCategoryId()));
|
| | | categoryInfo.setCid1Name(goods.getCategoryInfo().getFirstSaleCategoryName());
|
| | |
|
| | | categoryInfo.setCid2(Long.parseLong(goods.getCategoryInfo().getSecondSaleCategoryId()));
|
| | | categoryInfo.setCid2Name(goods.getCategoryInfo().getSecondSaleCategoryName());
|
| | |
|
| | | cg.setCategoryInfo(JSONObject.toJSON(categoryInfo).toString());
|
| | |
|
| | | return cg;
|
| | | }
|