| | |
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | import com.alibaba.fastjson.JSONObject;
|
| | | import com.yeshi.fanli.dto.common.GoodsOtherInfoDTO;
|
| | | import com.yeshi.fanli.dto.jd.JDCommissionInfo;
|
| | | import com.yeshi.fanli.dto.jd.JDCouponInfo;
|
| | | import com.yeshi.fanli.dto.jd.JDShopInfo;
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.jd.JDUtil;
|
| | |
|
| | | public class CommonGoodsFactory {
|
| | |
|
| | |
| | | return null;
|
| | |
|
| | | CommonGoods cg = new CommonGoods();
|
| | | JDCouponInfo couponInfo = goods.getCouponInfo();
|
| | | JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods);
|
| | | if (couponInfo != null) {
|
| | | cg.setCouponStartPrice(couponInfo.getQuota());
|
| | | BigDecimal discount = couponInfo.getDiscount();
|
| | |
| | | } else {
|
| | | cg.setCouponAmount(new BigDecimal(0));
|
| | | }
|
| | | cg.setCouponLeftCount(1);
|
| | | cg.setCouponTotalCount(1);
|
| | | }
|
| | |
|
| | | JDCommissionInfo commissionInfo = goods.getCommissionInfo();
|
| | |
| | | }
|
| | |
|
| | | cg.setState(CommonGoods.STATE_NORMAL);
|
| | | |
| | | // 其他信息
|
| | | GoodsOtherInfoDTO other = new GoodsOtherInfoDTO();
|
| | | other.setOwner(owner); // 是否自营
|
| | | other.setPinGouInfo( goods.getPinGouInfo()); // 拼购信息
|
| | | other.setIsFreeShipping(goods.getIsFreeShipping()); // 是否包邮
|
| | | cg.setOtherInfo(JSONObject.toJSON(other).toString());
|
| | |
|
| | | // 保留字段
|
| | | cg.setVideoCover(null);
|
| | |
| | | cg.setGoodsType(CommonGoods.GOODS_TYPE_PDD);
|
| | | cg.setPicture(goods.getGoodsThumbnailUrl());
|
| | | cg.setPictureWhite(null);
|
| | | cg.setPrice(MoneyBigDecimalUtil.div(new BigDecimal(goods.getMinNormalPrice()), new BigDecimal(100)));
|
| | | cg.setPrice(MoneyBigDecimalUtil.div(new BigDecimal(goods.getMinGroupPrice()), new BigDecimal(100)));
|
| | |
|
| | | String salesTip = goods.getSalesTip();
|
| | | if (StringUtil.isNullOrEmpty(salesTip)) {
|
| | | salesTip = "0";
|
| | | } else {
|
| | | int indexOf = salesTip.indexOf("+");
|
| | | if (indexOf > 0) {
|
| | | salesTip = salesTip.substring(0, indexOf);
|
| | | }
|
| | | }
|
| | |
|
| | | int totalSales = 0;
|
| | | if (salesTip.contains("万")) {
|
| | | salesTip = salesTip.replace("万", "") + "0000";
|
| | | salesTip = salesTip.substring(0, salesTip.indexOf("万"));
|
| | | totalSales= (int) (Float.parseFloat(salesTip) * 10000);
|
| | | } else {
|
| | | totalSales = Integer.parseInt(salesTip);
|
| | | }
|
| | | cg.setSales(Integer.parseInt(salesTip));
|
| | | cg.setSales(totalSales);
|
| | | cg.setRate(MoneyBigDecimalUtil.div(new BigDecimal(goods.getPromotionRate()), new BigDecimal(10)));
|
| | | cg.setSellerId(goods.getMallId());
|
| | | cg.setSellerName(goods.getMallName());
|