From bbb7a538df960f2f47b0af8c3db03622fca08d99 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 22 五月 2020 13:54:31 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div --- fanli/src/main/java/com/yeshi/fanli/util/factory/CommonOrderGoodsFactory.java | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 57 insertions(+), 0 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/util/factory/CommonOrderGoodsFactory.java b/fanli/src/main/java/com/yeshi/fanli/util/factory/CommonOrderGoodsFactory.java index a00e79f..d8078f3 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/factory/CommonOrderGoodsFactory.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/factory/CommonOrderGoodsFactory.java @@ -1,8 +1,15 @@ 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.dto.vip.goods.VIPGoodsInfo; +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 { @@ -24,4 +31,54 @@ 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; + } + + public static CommonOrderGoods create(VIPGoodsInfo vipGoods) { + CommonOrderGoods goods = new CommonOrderGoods(); + goods.setGoodsId(vipGoods.getGoodsId() + ""); + goods.setCreateTime(new Date()); + goods.setGoodsType(Constant.SOURCE_TYPE_VIP); + goods.setPicture(vipGoods.getGoodsMainPicture()); + goods.setPrice(new BigDecimal(vipGoods.getVipPrice())); + if (vipGoods.getBrandId() != null) { + goods.setShopId(vipGoods.getBrandId()); + goods.setShopName(vipGoods.getBrandName()); + } + goods.setShopType("鍞搧浼�"); + goods.setState(0); + goods.setTitle(vipGoods.getGoodsName()); + return goods; + } + } -- Gitblit v1.8.0