| | |
| | | package com.yeshi.fanli.util.factory;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | |
|
| | | public class CommonOrderGoodsFactory {
|
| | |
|
| | |
| | | return orderGoods;
|
| | | }
|
| | |
|
| | | public static CommonOrderGoods create(PDDGoodsDetail detail) {
|
| | | CommonOrderGoods goods = new CommonOrderGoods();
|
| | | goods.setGoodsId(detail.getGoodsId() + "");
|
| | | goods.setCreateTime(new Date());
|
| | | goods.setGoodsType(Constant.SOURCE_TYPE_PDD);
|
| | | goods.setPicture(detail.getGoodsThumbnailUrl());
|
| | | goods.setPrice(MoneyBigDecimalUtil.div(new BigDecimal(detail.getMinNormalPrice()), new BigDecimal(100)));
|
| | | goods.setShopId(detail.getMallId());
|
| | | goods.setShopName(detail.getMallName());
|
| | | goods.setShopType(detail.getMerchantType() + "");
|
| | | goods.setState(0);
|
| | | goods.setTitle(detail.getGoodsName());
|
| | | return goods;
|
| | | }
|
| | |
|
| | | public static CommonOrderGoods create(JDGoods jdGoods) {
|
| | | CommonOrderGoods goods = new CommonOrderGoods();
|
| | | goods.setGoodsId(jdGoods.getSkuId() + "");
|
| | | goods.setCreateTime(new Date());
|
| | | goods.setGoodsType(Constant.SOURCE_TYPE_JD);
|
| | | if (jdGoods.getImageList() != null && jdGoods.getImageList().size() > 0)
|
| | | goods.setPicture(jdGoods.getImageList().get(0));
|
| | | goods.setPrice(jdGoods.getPrice());
|
| | | if (jdGoods.getShopInfo() != null) {
|
| | | goods.setShopId((long) jdGoods.getShopInfo().getShopId());
|
| | | goods.setShopName(jdGoods.getShopInfo().getShopName());
|
| | | }
|
| | | goods.setShopType(jdGoods.getOwner());
|
| | | goods.setState(0);
|
| | | goods.setTitle(jdGoods.getSkuName());
|
| | | return goods;
|
| | | }
|
| | |
|
| | | }
|