| | |
| | |
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import com.yeshi.fanli.dto.common.GoodsOtherInfoDTO;
|
| | | import com.yeshi.fanli.dto.jd.JDCouponInfo;
|
| | | import com.yeshi.fanli.dto.jd.JDPingouInfo;
|
| | | import com.yeshi.fanli.dto.jd.JDShopInfo;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | |
| | | import com.yeshi.fanli.vo.goods.MoneyInfoVO;
|
| | | import com.yeshi.fanli.vo.goods.ShopInfoVO;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | /**
|
| | | * 商品加工
|
| | |
| | | Integer shopType = goods.getShopType();
|
| | | if (shopType == null) {
|
| | | goodsInfo.setShopType(10); // 淘宝
|
| | | goodsInfo.setPriceName("淘宝价");
|
| | | } else if (shopType == 1) {
|
| | | goodsInfo.setShopType(10); // 淘宝
|
| | | goodsInfo.setPriceName("淘宝价");
|
| | | } else if (shopType == 2) {
|
| | | goodsInfo.setShopType(11); // 天猫
|
| | | goodsInfo.setPriceName("天猫价");
|
| | | } else {
|
| | | goodsInfo.setShopType(goods.getShopType());
|
| | | }
|
| | |
| | | goodsType = Constant.SOURCE_TYPE_TAOBAO;
|
| | | }
|
| | |
|
| | | if (goodsType == Constant.SOURCE_TYPE_PDD) {
|
| | | GoodsOtherInfoDTO otherDTO = null;
|
| | | String otherInfo = goods.getOtherInfo();
|
| | | if (!StringUtil.isNullOrEmpty(otherInfo)) {
|
| | | JSONObject json = JSONObject.fromObject(otherInfo);
|
| | | otherDTO = (GoodsOtherInfoDTO)JSONObject.toBean(json,GoodsOtherInfoDTO.class);
|
| | | }
|
| | | |
| | | if (goodsType == Constant.SOURCE_TYPE_JD) {
|
| | | // 月销量
|
| | | goodsInfo.setSalesType(1); |
| | | // 自营
|
| | | String owner = otherDTO.getOwner();
|
| | | if (!StringUtil.isNullOrEmpty(owner) && "g".equalsIgnoreCase(owner)) {
|
| | | List<ClientTextStyleVO> labels = new ArrayList<ClientTextStyleVO>();
|
| | | ClientTextStyleVO textStyleVO = new ClientTextStyleVO();
|
| | | textStyleVO.setContent("京东自营");
|
| | | textStyleVO.setColor("#E42219");
|
| | | labels.add(textStyleVO);
|
| | | goodsInfo.setLabels(labels);
|
| | | }
|
| | | // 拼团价
|
| | | JDPingouInfo pinGouInfo = otherDTO.getPinGouInfo();
|
| | | if (pinGouInfo != null) {
|
| | | goods.setPrice(pinGouInfo.getPingouPrice());
|
| | | goodsInfo.setPriceName("拼购价");
|
| | | } else {
|
| | | goodsInfo.setPriceName("京东价");
|
| | | }
|
| | | } else if (goodsType == Constant.SOURCE_TYPE_PDD){
|
| | | goodsInfo.setSalesType(4); // 总销量
|
| | | goodsInfo.setPriceName("拼团价");
|
| | | } else {
|
| | | goodsInfo.setSalesType(1); // 月销量
|
| | | }
|
| | |
| | | } else {
|
| | | goodsInfo.setPicUrl(goods.getPicture());
|
| | | }
|
| | | |
| | |
|
| | | // 资金信息
|
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
|
| | |
| | | Integer shopType = goods.getUserType();
|
| | | if (shopType != null && shopType == 1) {
|
| | | goodsInfo.setShopType(11); // 天猫
|
| | | goodsInfo.setPriceName("天猫价");
|
| | | } else {
|
| | | goodsInfo.setShopType(10); // 淘宝
|
| | | goodsInfo.setPriceName("淘宝价");
|
| | | }
|
| | |
|
| | | // 资金信息
|
| | |
| | | Integer shopType = goods.getUserType();
|
| | | if (shopType != null && shopType == 1) {
|
| | | goodsInfo.setShopType(11); // 天猫
|
| | | goodsInfo.setPriceName("天猫价");
|
| | | } else {
|
| | | goodsInfo.setShopType(10); // 淘宝
|
| | | goodsInfo.setPriceName("淘宝价");
|
| | | }
|
| | |
|
| | | // 资金信息
|
| | |
| | | goodsInfo.setTitle(goods.getSkuName());
|
| | | goodsInfo.setSalesType(1); // 默认月销量
|
| | | goodsInfo.setPicUrl(goods.getPicUrl());
|
| | | goodsInfo.setZkPrice(goods.getPrice());
|
| | | goodsInfo.setImgList(goods.getImageList());
|
| | | goodsInfo.setState(0);
|
| | | goodsInfo.setShopType(20); // 京东
|
| | |
| | | salesCountMidea = salesCountMidea + "万";
|
| | | }
|
| | | goodsInfo.setSalesCount(salesCountMidea);
|
| | |
|
| | | |
| | | |
| | | JDPingouInfo pinGouInfo = goods.getPinGouInfo();
|
| | | if (pinGouInfo != null) {
|
| | | goodsInfo.setZkPrice(pinGouInfo.getPingouPrice());
|
| | | goodsInfo.setPriceName("拼购价");
|
| | | } else {
|
| | | goodsInfo.setZkPrice(goods.getPrice());
|
| | | goodsInfo.setPriceName("京东价");
|
| | | }
|
| | | |
| | |
|
| | | // 资金信息
|
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
|
| | |
| | | moneyInfoVO.setShareMoney("¥" + JDUtil.getGoodsFanLiMoney(goods, shareRate));
|
| | | goodsInfo.setMoneyInfo(moneyInfoVO);
|
| | |
|
| | | |
| | | |
| | | JDCouponInfo couponInfo = goods.getCouponInfo();
|
| | | if (couponInfo != null) {
|
| | | BigDecimal discount = couponInfo.getDiscount();
|
| | | BigDecimal price = goods.getPrice();
|
| | | // 计算券后价
|
| | | BigDecimal sub = price.subtract(couponInfo.getQuota());
|
| | | if (sub.compareTo(BigDecimal.valueOf(0)) >= 0) {
|
| | | BigDecimal quanPrice = MoneyBigDecimalUtil.sub(price, discount);
|
| | | goodsInfo.setCouponPrice(quanPrice);
|
| | | } else {
|
| | | goodsInfo.setCouponPrice(price);
|
| | | }
|
| | | goodsInfo.setCouponPrice(JDUtil.getQuanPrice(goods));
|
| | | |
| | |
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
|
| | | CouponInfoVO coupon = new CouponInfoVO();
|
| | | coupon.setAmount(discount);
|
| | | if (couponInfo.getGetStartTime() != null) {
|
| | | coupon.setStartTime(sdf.format(new Date(couponInfo.getGetStartTime())));
|
| | | } else {
|
| | | coupon.setStartTime(sdf.format(new Date()));
|
| | | }
|
| | | |
| | | int ran2 = (int) (Math.random()*(5) + 1 ); |
| | | if (ran2 > 3) {
|
| | | if (couponInfo.getGetStartTime() != null) {
|
| | | coupon.setStartTime(sdf.format(new Date(couponInfo.getGetStartTime())));
|
| | | } else {
|
| | | coupon.setStartTime(sdf.format(new Date()));
|
| | | }
|
| | |
|
| | | if (couponInfo.getGetEndTime() != null) {
|
| | | coupon.setEndTime(sdf.format(new Date(couponInfo.getGetEndTime())));
|
| | | } else {
|
| | | coupon.setEndTime(sdf.format(new Date()));
|
| | | }
|
| | | if (couponInfo.getGetEndTime() != null) {
|
| | | coupon.setEndTime(sdf.format(new Date(couponInfo.getGetEndTime())));
|
| | | } else {
|
| | | coupon.setEndTime(sdf.format(new Date()));
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | // TODO
|
| | | // coupon.setLeftCount(leftCount);
|
| | |
| | | goodsInfo.setCouponInfo(coupon);
|
| | | }
|
| | |
|
| | | // 店铺信息
|
| | | JDShopInfo shopInfo = goods.getShopInfo();
|
| | | if (shopInfo != null && !StringUtil.isNullOrEmpty(shopInfo.getShopName())) {
|
| | | ShopInfoVO shop = new ShopInfoVO();
|
| | | shop.setShopName(shopInfo.getShopName());
|
| | | shop.setId(shopInfo.getShopId().toString());
|
| | | goodsInfo.setShopInfo(shop);
|
| | | }
|
| | |
|
| | | |
| | | // 京东自营标签
|
| | | String owner = goods.getOwner();
|
| | | if (!StringUtil.isNullOrEmpty(owner) && "g".equalsIgnoreCase(owner)) {
|
| | |
| | | labels.add(textStyleVO);
|
| | | goodsInfo.setLabels(labels);
|
| | | }
|
| | | |
| | | |
| | | // 店铺信息
|
| | | JDShopInfo shopInfo = goods.getShopInfo();
|
| | | if (shopInfo != null && !StringUtil.isNullOrEmpty(shopInfo.getShopName())) {
|
| | | ShopInfoVO shop = new ShopInfoVO();
|
| | | shop.setShopName(shopInfo.getShopName());
|
| | | shop.setId(shopInfo.getShopId().toString());
|
| | | if (!StringUtil.isNullOrEmpty(owner) && "g".equalsIgnoreCase(owner)) {
|
| | | shop.setUserType(20);
|
| | | } else {
|
| | | shop.setUserType(21);
|
| | | }
|
| | | goodsInfo.setShopInfo(shop);
|
| | | }
|
| | | return goodsInfo;
|
| | | }
|
| | |
|
| | |
| | | goodsInfo.setGoodsId(goods.getGoodsId());
|
| | | goodsInfo.setTitle(goods.getGoodsName());
|
| | | goodsInfo.setSalesType(4); // 总销量
|
| | | goodsInfo.setPriceName("拼团价");
|
| | | goodsInfo.setPicUrl(goods.getGoodsThumbnailUrl()); // 缩略图
|
| | | goodsInfo.setZkPrice(MoneyBigDecimalUtil.div(new BigDecimal(goods.getMinGroupPrice()), new BigDecimal(100)).setScale(2));
|
| | | goodsInfo.setShopType(30); // 拼多多
|
| | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
|
| | | CouponInfoVO coupon = new CouponInfoVO();
|
| | | coupon.setAmount(amount);
|
| | | if (goods.getCouponStartTime() != null) {
|
| | | coupon.setStartTime(sdf.format(new Date(goods.getCouponStartTime() * 1000)));
|
| | | }
|
| | | |
| | | |
| | | int ran2 = (int) (Math.random()*(5) + 1 ); |
| | | |
| | | if (ran2 > 3) {
|
| | | if (goods.getCouponStartTime() != null) {
|
| | | coupon.setStartTime(sdf.format(new Date(goods.getCouponStartTime() * 1000)));
|
| | | }
|
| | |
|
| | | if (goods.getCouponEndTime() != null) {
|
| | | coupon.setEndTime(sdf.format(new Date(goods.getCouponEndTime() * 1000)));
|
| | | }
|
| | | if (goods.getCouponEndTime() != null) {
|
| | | coupon.setEndTime(sdf.format(new Date(goods.getCouponEndTime() * 1000)));
|
| | | }
|
| | | }
|
| | | |
| | | coupon.setLink(null);
|
| | | coupon.setStartFee(startFree);
|
| | |
|