| | |
| | |
|
| | | /**
|
| | | * 商品加工
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | * @author Administrator
|
| | | */
|
| | | public class GoodsDetailVOFactory {
|
| | |
|
| | | /**
|
| | | * 淘宝商品组织
|
| | | * |
| | | * @param goods
|
| | | * 淘宝商品
|
| | | * @param pid
|
| | | * @param fanLiRate
|
| | | * 返利比例
|
| | | * @return
|
| | | */
|
| | | public static GoodsDetailVO convertCommonGoods(CommonGoods goods, ConfigParamsDTO params) {
|
| | | GoodsDetailVO goodsInfo = new GoodsDetailVO();
|
| | | goodsInfo.setGoodsId(goods.getGoodsId() + "");
|
| | | goodsInfo.setTitle(goods.getTitle());
|
| | | /**
|
| | | * 淘宝商品组织
|
| | | *
|
| | | * @param goods 淘宝商品
|
| | | * @param pid
|
| | | * @param fanLiRate 返利比例
|
| | | * @return
|
| | | */
|
| | | public static GoodsDetailVO convertCommonGoods(CommonGoods goods, ConfigParamsDTO params) {
|
| | | GoodsDetailVO goodsInfo = new GoodsDetailVO();
|
| | | goodsInfo.setGoodsId(goods.getGoodsId() + "");
|
| | | goodsInfo.setTitle(goods.getTitle());
|
| | |
|
| | | 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());
|
| | | }
|
| | | 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());
|
| | | }
|
| | |
|
| | | Integer goodsType = goods.getGoodsType();
|
| | | if (goodsType == null) {
|
| | | goodsType = Constant.SOURCE_TYPE_TAOBAO;
|
| | | }
|
| | | Integer goodsType = goods.getGoodsType();
|
| | | if (goodsType == null) {
|
| | | goodsType = Constant.SOURCE_TYPE_TAOBAO;
|
| | | }
|
| | |
|
| | | GoodsOtherInfoDTO otherDTO = null;
|
| | | String otherInfo = goods.getOtherInfo();
|
| | | if (!StringUtil.isNullOrEmpty(otherInfo)) {
|
| | | JSONObject json = JSONObject.fromObject(otherInfo);
|
| | | otherDTO = (GoodsOtherInfoDTO) JSONObject.toBean(json, GoodsOtherInfoDTO.class);
|
| | | }
|
| | | 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);
|
| | | if (goodsType == Constant.SOURCE_TYPE_JD) {
|
| | | // 月销量
|
| | | goodsInfo.setSalesType(1);
|
| | |
|
| | | Integer isFreeShipping = otherDTO.getIsFreeShipping();
|
| | | if (isFreeShipping != null && isFreeShipping == 1) {
|
| | | goodsInfo.setBaoyou(true);
|
| | | }
|
| | | Integer isFreeShipping = otherDTO.getIsFreeShipping();
|
| | | if (isFreeShipping != null && isFreeShipping == 1) {
|
| | | goodsInfo.setBaoyou(true);
|
| | | }
|
| | |
|
| | | List<ClientTextStyleVO> labels = goodsInfo.getLabels();
|
| | | // 自营
|
| | | String owner = otherDTO.getOwner();
|
| | | if (!StringUtil.isNullOrEmpty(owner) && "g".equalsIgnoreCase(owner)) {
|
| | | if (labels == null) {
|
| | | labels = new ArrayList<ClientTextStyleVO>();
|
| | | }
|
| | | ClientTextStyleVO textStyleVO = new ClientTextStyleVO();
|
| | | textStyleVO.setContent("京东自营");
|
| | | textStyleVO.setColor("#E42219");
|
| | | labels.add(textStyleVO);
|
| | | }
|
| | | // 拼团价
|
| | | JDPingouInfo pinGouInfo = otherDTO.getPinGouInfo();
|
| | | if (pinGouInfo != null) {
|
| | | goods.setPrice(pinGouInfo.getPingouPrice());
|
| | | goodsInfo.setPriceName("拼购价");
|
| | | List<ClientTextStyleVO> labels = goodsInfo.getLabels();
|
| | | // 自营
|
| | | String owner = otherDTO.getOwner();
|
| | | if (!StringUtil.isNullOrEmpty(owner) && "g".equalsIgnoreCase(owner)) {
|
| | | if (labels == null) {
|
| | | labels = new ArrayList<ClientTextStyleVO>();
|
| | | }
|
| | | ClientTextStyleVO textStyleVO = new ClientTextStyleVO();
|
| | | textStyleVO.setContent("京东自营");
|
| | | textStyleVO.setColor("#E42219");
|
| | | labels.add(textStyleVO);
|
| | | }
|
| | | // 拼团价
|
| | | JDPingouInfo pinGouInfo = otherDTO.getPinGouInfo();
|
| | | if (pinGouInfo != null) {
|
| | | goods.setPrice(pinGouInfo.getPingouPrice());
|
| | | goodsInfo.setPriceName("拼购价");
|
| | |
|
| | | if (labels == null) {
|
| | | labels = new ArrayList<ClientTextStyleVO>();
|
| | | }
|
| | | ClientTextStyleVO textStyleVO = new ClientTextStyleVO();
|
| | | textStyleVO.setContent("拼购");
|
| | | textStyleVO.setColor("#E42219");
|
| | | labels.add(textStyleVO);
|
| | | } else {
|
| | | goodsInfo.setPriceName("京东价");
|
| | | }
|
| | | goodsInfo.setLabels(labels);
|
| | | } else if (goodsType == Constant.SOURCE_TYPE_PDD) {
|
| | | goodsInfo.setSalesType(4); // 总销量
|
| | | goodsInfo.setPriceName("拼团价");
|
| | | goodsInfo.setBaoyou(true);
|
| | | } else if (goodsType == Constant.SOURCE_TYPE_SUNING) {
|
| | | goodsInfo.setSalesType(1);
|
| | | goodsInfo.setGoodsId(SuningUtil.getConcatGoodsIId(SuningUtil.getFullSupplierCode(goods.getSellerId() + ""),
|
| | | goods.getGoodsId() + ""));
|
| | | } else {
|
| | | goodsInfo.setSalesType(1); // 月销量
|
| | | goodsInfo.setBaoyou(true);
|
| | | }
|
| | | if (labels == null) {
|
| | | labels = new ArrayList<ClientTextStyleVO>();
|
| | | }
|
| | | ClientTextStyleVO textStyleVO = new ClientTextStyleVO();
|
| | | textStyleVO.setContent("拼购");
|
| | | textStyleVO.setColor("#E42219");
|
| | | labels.add(textStyleVO);
|
| | | } else {
|
| | | goodsInfo.setPriceName("京东价");
|
| | | }
|
| | | goodsInfo.setLabels(labels);
|
| | | } else if (goodsType == Constant.SOURCE_TYPE_PDD) {
|
| | | goodsInfo.setSalesType(4); // 总销量
|
| | | goodsInfo.setPriceName("拼团价");
|
| | | goodsInfo.setBaoyou(true);
|
| | | } else if (goodsType == Constant.SOURCE_TYPE_SUNING) {
|
| | | goodsInfo.setSalesType(1);
|
| | | goodsInfo.setGoodsId(SuningUtil.getConcatGoodsIId(SuningUtil.getFullSupplierCode(goods.getSellerId() + ""),
|
| | | goods.getGoodsId() + ""));
|
| | | } else {
|
| | | goodsInfo.setSalesType(1); // 月销量
|
| | | goodsInfo.setBaoyou(true);
|
| | | }
|
| | |
|
| | | if (goodsType == Constant.SOURCE_TYPE_VIP) {
|
| | | goodsInfo.setDiscount(goods.getCouponInfo());
|
| | | goodsInfo.setPriceName("折后价");
|
| | | goodsInfo.setCouponPrice(goods.getCouponStartPrice());
|
| | | }
|
| | | if (goodsType == Constant.SOURCE_TYPE_VIP) {
|
| | | goodsInfo.setDiscount(goods.getCouponInfo());
|
| | | goodsInfo.setPriceName("折后价");
|
| | | goodsInfo.setCouponPrice(goods.getCouponStartPrice());
|
| | | }
|
| | |
|
| | | goodsInfo.setGoodsType(goodsType);
|
| | | goodsInfo.setZkPrice(goods.getPrice());
|
| | | Integer state = goods.getState();
|
| | | if (state == null) {
|
| | | goodsInfo.setState(0);
|
| | | } else {
|
| | | goodsInfo.setState(goods.getState());
|
| | | }
|
| | | goodsInfo.setSalesCount(TaoBaoUtil.getSaleCount(goods.getSales()));
|
| | | goodsInfo.setGoodsType(goodsType);
|
| | | goodsInfo.setZkPrice(goods.getPrice());
|
| | | Integer state = goods.getState();
|
| | | if (state == null) {
|
| | | goodsInfo.setState(0);
|
| | | } else {
|
| | | goodsInfo.setState(goods.getState());
|
| | | }
|
| | | goodsInfo.setSalesCount(TaoBaoUtil.getSaleCount(goods.getSales()));
|
| | |
|
| | | if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | // 使用白底图
|
| | | if (!StringUtil.isNullOrEmpty(goods.getPictureWhite())) {
|
| | | goodsInfo.setPicUrl(TbImgUtil.getTBSize320Img(goods.getPictureWhite()));
|
| | | } else {
|
| | | goodsInfo.setPicUrl(TbImgUtil.getTBSize320Img(goods.getPicture()));
|
| | | }
|
| | | } else {
|
| | | goodsInfo.setPicUrl(goods.getPicture());
|
| | | }
|
| | | if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | // 使用白底图
|
| | | if (!StringUtil.isNullOrEmpty(goods.getPictureWhite())) {
|
| | | goodsInfo.setPicUrl(TbImgUtil.getTBSize320Img(goods.getPictureWhite()));
|
| | | } else {
|
| | | goodsInfo.setPicUrl(TbImgUtil.getTBSize320Img(goods.getPicture()));
|
| | | }
|
| | | } else {
|
| | | goodsInfo.setPicUrl(goods.getPicture());
|
| | | }
|
| | |
|
| | | // 资金信息
|
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
|
| | | moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6
|
| | | // 资金信息
|
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
|
| | | moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6
|
| | |
|
| | | BigDecimal commission = CommonGoodsUtil.getCommission(goods, params.getFanLiRate());
|
| | | moneyInfoVO.setFanliMoney("¥" + commission);
|
| | | BigDecimal commission = CommonGoodsUtil.getCommission(goods, params.getFanLiRate());
|
| | | moneyInfoVO.setFanliMoney("¥" + commission);
|
| | |
|
| | | BigDecimal maxCommission = CommonGoodsUtil.getCommission(goods, params.getVipFanLiRate());
|
| | | if (params.getMaxRewardRate() != null)
|
| | | moneyInfoVO
|
| | | .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate())));
|
| | | else
|
| | | moneyInfoVO.setMaxMoney("¥" + maxCommission);
|
| | | BigDecimal maxCommission = CommonGoodsUtil.getCommission(goods, params.getVipFanLiRate());
|
| | | if (params.getMaxRewardRate() != null)
|
| | | moneyInfoVO
|
| | | .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate())));
|
| | | else
|
| | | moneyInfoVO.setMaxMoney("¥" + maxCommission);
|
| | |
|
| | | moneyInfoVO.setShareMoney(CommonGoodsUtil.getCommissionInfo(goods, params.getShareRate()));
|
| | | moneyInfoVO.setShareMoney(CommonGoodsUtil.getCommissionInfo(goods, params.getShareRate()));
|
| | |
|
| | | moneyInfoVO.setRateInfo("返利比 " + MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)),
|
| | | CommonGoodsUtil.getAfterUseCouplePrice(goods)) + "%");
|
| | | moneyInfoVO.setRateInfo("返利比 " + MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)),
|
| | | CommonGoodsUtil.getAfterUseCouplePrice(goods)) + "%");
|
| | |
|
| | | moneyInfoVO.setMaxRateInfo("返利比 " + MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)),
|
| | | CommonGoodsUtil.getAfterUseCouplePrice(goods)) + "%");
|
| | | moneyInfoVO.setMaxRateInfo("返利比 " + MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)),
|
| | | CommonGoodsUtil.getAfterUseCouplePrice(goods)) + "%");
|
| | |
|
| | | goodsInfo.setMoneyInfo(moneyInfoVO);
|
| | | goodsInfo.setMoneyInfo(moneyInfoVO);
|
| | |
|
| | | // 券信息
|
| | | if (goods.getCouponAmount() != null && goods.getCouponAmount().compareTo(BigDecimal.valueOf(0)) > 0) {
|
| | | // 计算券后价
|
| | | BigDecimal sub = goods.getPrice().subtract(goods.getCouponStartPrice());
|
| | | if (sub.compareTo(BigDecimal.valueOf(0)) >= 0) {
|
| | | BigDecimal quanPrice = MoneyBigDecimalUtil.sub(goods.getPrice(), goods.getCouponAmount());
|
| | | goodsInfo.setCouponPrice(quanPrice);
|
| | | } else {
|
| | | goodsInfo.setCouponPrice(goods.getPrice());
|
| | | }
|
| | | // 券信息
|
| | | if (goods.getCouponAmount() != null && goods.getCouponAmount().compareTo(BigDecimal.valueOf(0)) > 0) {
|
| | | // 计算券后价
|
| | | BigDecimal sub = goods.getPrice().subtract(goods.getCouponStartPrice());
|
| | | if (sub.compareTo(BigDecimal.valueOf(0)) >= 0) {
|
| | | BigDecimal quanPrice = MoneyBigDecimalUtil.sub(goods.getPrice(), goods.getCouponAmount());
|
| | | goodsInfo.setCouponPrice(quanPrice);
|
| | | } else {
|
| | | goodsInfo.setCouponPrice(goods.getPrice());
|
| | | }
|
| | |
|
| | | CouponInfoVO coupon = new CouponInfoVO();
|
| | | coupon.setAmount(goods.getCouponAmount());
|
| | | coupon.setLeftCount(goods.getCouponLeftCount());
|
| | | coupon.setTotalCount(goods.getCouponTotalCount());
|
| | | coupon.setStartFee(goods.getCouponStartPrice());
|
| | | goodsInfo.setHasCoupon(true);
|
| | | goodsInfo.setCouponInfo(coupon);
|
| | | }
|
| | | CouponInfoVO coupon = new CouponInfoVO();
|
| | | coupon.setAmount(goods.getCouponAmount());
|
| | | coupon.setLeftCount(goods.getCouponLeftCount());
|
| | | coupon.setTotalCount(goods.getCouponTotalCount());
|
| | | coupon.setStartFee(goods.getCouponStartPrice());
|
| | | goodsInfo.setHasCoupon(true);
|
| | | goodsInfo.setCouponInfo(coupon);
|
| | | }
|
| | |
|
| | | // 店铺信息
|
| | | if (!StringUtil.isNullOrEmpty(goods.getSellerName())) {
|
| | | ShopInfoVO shop = new ShopInfoVO();
|
| | | shop.setShopName(goods.getSellerName());
|
| | | // 店铺信息
|
| | | if (!StringUtil.isNullOrEmpty(goods.getSellerName())) {
|
| | | ShopInfoVO shop = new ShopInfoVO();
|
| | | shop.setShopName(goods.getSellerName());
|
| | |
|
| | | if (goods.getSellerId() != null)
|
| | | shop.setId(goods.getSellerId().toString());
|
| | | if (goods.getSellerId() != null)
|
| | | shop.setId(goods.getSellerId().toString());
|
| | |
|
| | | if (shopType == null || shopType == 0) {
|
| | | shop.setUserType(10);
|
| | | } else if (shopType == 1) {
|
| | | shop.setUserType(11);
|
| | | } else {
|
| | | shop.setUserType(goods.getShopType());
|
| | | }
|
| | | if (shopType == null || shopType == 0) {
|
| | | shop.setUserType(10);
|
| | | } else if (shopType == 1) {
|
| | | shop.setUserType(11);
|
| | | } else {
|
| | | shop.setUserType(goods.getShopType());
|
| | | }
|
| | |
|
| | | goodsInfo.setShopInfo(shop);
|
| | | }
|
| | | goodsInfo.setShopInfo(shop);
|
| | | }
|
| | |
|
| | | if (goodsType == Constant.SOURCE_TYPE_VIP) {
|
| | | goodsInfo.setShopInfo(null);
|
| | | }
|
| | | if (goodsType == Constant.SOURCE_TYPE_VIP) {
|
| | | goodsInfo.setShopInfo(null);
|
| | | }
|
| | |
|
| | | // if (Constant.IS_TEST) {
|
| | | // // 添加标签
|
| | | // List<ClientTextStyleVO> labels = goodsInfo.getLabels();
|
| | | // if (labels == null)
|
| | | // labels = new ArrayList<>();
|
| | | //
|
| | | // labels.add(new ClientTextStyleVO("预售", "#FF2B4E"));
|
| | | // labels.add(new ClientTextStyleVO("爆款", "#FF2B4E"));
|
| | | // labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E"));
|
| | | // goodsInfo.setLabels(labels);
|
| | | // }
|
| | | // if (Constant.IS_TEST) {
|
| | | // // 添加标签
|
| | | // List<ClientTextStyleVO> labels = goodsInfo.getLabels();
|
| | | // if (labels == null)
|
| | | // labels = new ArrayList<>();
|
| | | //
|
| | | // labels.add(new ClientTextStyleVO("预售", "#FF2B4E"));
|
| | | // labels.add(new ClientTextStyleVO("爆款", "#FF2B4E"));
|
| | | // labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E"));
|
| | | // goodsInfo.setLabels(labels);
|
| | | // }
|
| | |
|
| | | return goodsInfo;
|
| | | }
|
| | | return goodsInfo;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 淘宝商品组织
|
| | | * |
| | | * @param goods
|
| | | * 淘宝商品
|
| | | * @param pid
|
| | | * @param fanLiRate
|
| | | * 返利比例
|
| | | * @return
|
| | | */
|
| | | public static GoodsDetailVO convertTaoBaoGoodsBriefExtra(TaoBaoGoodsBriefExtra goods, ConfigParamsDTO params) {
|
| | | GoodsDetailVO goodsInfo = new GoodsDetailVO();
|
| | | goodsInfo.setBaoyou(true);
|
| | | goodsInfo.setGoodsType(Constant.SOURCE_TYPE_TAOBAO);
|
| | | goodsInfo.setGoodsId(goods.getAuctionId() + "");
|
| | | goodsInfo.setTitle(goods.getTitle());
|
| | | goodsInfo.setSalesType(1); // 默认月销量
|
| | | goodsInfo.setZkPrice(goods.getZkPrice());
|
| | | goodsInfo.setImgList(goods.getImgList());
|
| | | goodsInfo.setState(goods.getState() == null ? 0 : goods.getState());
|
| | | goodsInfo.setSalesCount(goods.getSalesCount());
|
| | | goodsInfo.setPicUrl(goods.getPictUrl());
|
| | | goodsInfo.setDescription(goods.getDescription());
|
| | | /**
|
| | | * 淘宝商品组织
|
| | | *
|
| | | * @param goods 淘宝商品
|
| | | * @param pid
|
| | | * @param fanLiRate 返利比例
|
| | | * @return
|
| | | */
|
| | | public static GoodsDetailVO convertTaoBaoGoodsBriefExtra(TaoBaoGoodsBriefExtra goods, ConfigParamsDTO params) {
|
| | | GoodsDetailVO goodsInfo = new GoodsDetailVO();
|
| | | goodsInfo.setBaoyou(true);
|
| | | goodsInfo.setGoodsType(Constant.SOURCE_TYPE_TAOBAO);
|
| | | goodsInfo.setGoodsId(goods.getAuctionId() + "");
|
| | | goodsInfo.setTitle(goods.getTitle());
|
| | | goodsInfo.setSalesType(1); // 默认月销量
|
| | | goodsInfo.setZkPrice(goods.getZkPrice());
|
| | | goodsInfo.setImgList(goods.getImgList());
|
| | | goodsInfo.setState(goods.getState() == null ? 0 : goods.getState());
|
| | | goodsInfo.setSalesCount(goods.getSalesCount());
|
| | | goodsInfo.setPicUrl(goods.getPictUrl());
|
| | | goodsInfo.setDescription(goods.getDescription());
|
| | |
|
| | | 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("淘宝价");
|
| | | }
|
| | |
|
| | | // 资金信息
|
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
|
| | | moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6
|
| | | // 资金信息
|
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
|
| | | moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6
|
| | |
|
| | | if (goods.getTkRate() == null) {
|
| | | TaoBaoHongBaoInfo taoBaoHongBaoInfo = goods.getTaoBaoHongBaoInfo();
|
| | | moneyInfoVO.setFanliMoney("¥" + taoBaoHongBaoInfo.getHongbao());
|
| | | moneyInfoVO.setShareMoney("¥" + taoBaoHongBaoInfo.getHongbao());
|
| | | if (params.getMaxRewardRate() != null)
|
| | | moneyInfoVO.setMaxMoney("¥" + taoBaoHongBaoInfo.getHongbao()
|
| | | .add(MoneyBigDecimalUtil.mul(taoBaoHongBaoInfo.getHongbao(), params.getMaxRewardRate())));
|
| | | else
|
| | | moneyInfoVO.setMaxMoney("¥" + TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getVipFanLiRate(), false));
|
| | | } else {
|
| | | BigDecimal commission = TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getFanLiRate(), false);
|
| | | moneyInfoVO.setFanliMoney("¥" + commission);
|
| | | if (params.getMaxRewardRate() != null)
|
| | | moneyInfoVO.setMaxMoney(
|
| | | "¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate())));
|
| | | else
|
| | | moneyInfoVO.setMaxMoney("¥" + TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getVipFanLiRate(), false));
|
| | | moneyInfoVO.setShareMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods, params.getShareRate(), true));
|
| | | }
|
| | | goodsInfo.setMoneyInfo(moneyInfoVO);
|
| | | if (goods.getTkRate() == null) {
|
| | | TaoBaoHongBaoInfo taoBaoHongBaoInfo = goods.getTaoBaoHongBaoInfo();
|
| | | moneyInfoVO.setFanliMoney("¥" + taoBaoHongBaoInfo.getHongbao());
|
| | | moneyInfoVO.setShareMoney("¥" + taoBaoHongBaoInfo.getHongbao());
|
| | | if (params.getMaxRewardRate() != null)
|
| | | moneyInfoVO.setMaxMoney("¥" + taoBaoHongBaoInfo.getHongbao()
|
| | | .add(MoneyBigDecimalUtil.mul(taoBaoHongBaoInfo.getHongbao(), params.getMaxRewardRate())));
|
| | | else
|
| | | moneyInfoVO.setMaxMoney("¥" + TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getVipFanLiRate(), false));
|
| | | } else {
|
| | | BigDecimal commission = TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getFanLiRate(), false);
|
| | | moneyInfoVO.setFanliMoney("¥" + commission);
|
| | | if (params.getMaxRewardRate() != null)
|
| | | moneyInfoVO.setMaxMoney(
|
| | | "¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate())));
|
| | | else
|
| | | moneyInfoVO.setMaxMoney("¥" + TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getVipFanLiRate(), false));
|
| | | moneyInfoVO.setShareMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods, params.getShareRate(), true));
|
| | | }
|
| | | goodsInfo.setMoneyInfo(moneyInfoVO);
|
| | |
|
| | | TaoBaoQuanInfo taoBaoQuanInfo = goods.getTaoBaoQuanInfo();
|
| | | if (taoBaoQuanInfo != null) {
|
| | | goodsInfo.setCouponPrice(taoBaoQuanInfo.getCouponPrice());
|
| | | CouponInfoVO coupon = new CouponInfoVO();
|
| | | coupon.setAmount(taoBaoQuanInfo.getCouponAmount());
|
| | | coupon.setLeftCount(taoBaoQuanInfo.getCouponLeftCount());
|
| | | coupon.setTotalCount(taoBaoQuanInfo.getCouponTotalCount());
|
| | | TaoBaoQuanInfo taoBaoQuanInfo = goods.getTaoBaoQuanInfo();
|
| | | if (taoBaoQuanInfo != null) {
|
| | | goodsInfo.setCouponPrice(taoBaoQuanInfo.getCouponPrice());
|
| | | CouponInfoVO coupon = new CouponInfoVO();
|
| | | coupon.setAmount(taoBaoQuanInfo.getCouponAmount());
|
| | | coupon.setLeftCount(taoBaoQuanInfo.getCouponLeftCount());
|
| | | coupon.setTotalCount(taoBaoQuanInfo.getCouponTotalCount());
|
| | |
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
|
| | | String couponEffectiveEndTime = taoBaoQuanInfo.getCouponEffectiveEndTime();
|
| | | String couponEffectiveStartTime = taoBaoQuanInfo.getCouponEffectiveStartTime();
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
|
| | | String couponEffectiveEndTime = taoBaoQuanInfo.getCouponEffectiveEndTime();
|
| | | String couponEffectiveStartTime = taoBaoQuanInfo.getCouponEffectiveStartTime();
|
| | |
|
| | | coupon.setEndTime(sdf.format(new Date(Long.parseLong(couponEffectiveEndTime))));
|
| | | coupon.setStartTime(sdf.format(new Date(Long.parseLong(couponEffectiveStartTime))));
|
| | | coupon.setLink(taoBaoQuanInfo.getCouponLink());
|
| | | coupon.setStartFee(taoBaoQuanInfo.getCouponStartFee());
|
| | | coupon.setShopCoupon(goods.isShopCoupon());
|
| | | goodsInfo.setHasCoupon(true);
|
| | | goodsInfo.setCouponInfo(coupon);
|
| | | }
|
| | | coupon.setEndTime(sdf.format(new Date(Long.parseLong(couponEffectiveEndTime))));
|
| | | coupon.setStartTime(sdf.format(new Date(Long.parseLong(couponEffectiveStartTime))));
|
| | | coupon.setLink(taoBaoQuanInfo.getCouponLink());
|
| | | coupon.setStartFee(taoBaoQuanInfo.getCouponStartFee());
|
| | | coupon.setShopCoupon(goods.isShopCoupon());
|
| | | goodsInfo.setHasCoupon(true);
|
| | | goodsInfo.setCouponInfo(coupon);
|
| | | }
|
| | |
|
| | | // 店铺信息
|
| | | String shopTitle = goods.getShopTitle();
|
| | | // 店铺信息
|
| | | String shopTitle = goods.getShopTitle();
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(shopTitle)) {
|
| | | ShopInfoVO shop = new ShopInfoVO();
|
| | | shop.setShopName(shopTitle);
|
| | | if (!StringUtil.isNullOrEmpty(shopTitle)) {
|
| | | ShopInfoVO shop = new ShopInfoVO();
|
| | | shop.setShopName(shopTitle);
|
| | |
|
| | | Long sellerId = goods.getSellerId();
|
| | | if (sellerId != null)
|
| | | shop.setId(goods.getSellerId().toString());
|
| | | Long sellerId = goods.getSellerId();
|
| | | if (sellerId != null)
|
| | | shop.setId(goods.getSellerId().toString());
|
| | |
|
| | | if (shopType != null && shopType == 1) {
|
| | | shop.setUserType(11);
|
| | | } else {
|
| | | shop.setUserType(10);
|
| | | }
|
| | | goodsInfo.setShopInfo(shop);
|
| | | }
|
| | | if (shopType != null && shopType == 1) {
|
| | | shop.setUserType(11);
|
| | | } else {
|
| | | shop.setUserType(10);
|
| | | }
|
| | | goodsInfo.setShopInfo(shop);
|
| | | }
|
| | |
|
| | | // if (Constant.IS_TEST) {
|
| | | // // 添加标签
|
| | | // List<ClientTextStyleVO> labels = goodsInfo.getLabels();
|
| | | // if (labels == null)
|
| | | // labels = new ArrayList<>();
|
| | | //
|
| | | // labels.add(new ClientTextStyleVO("预售", "#FF2B4E"));
|
| | | // labels.add(new ClientTextStyleVO("爆款", "#FF2B4E"));
|
| | | // labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E"));
|
| | | // goodsInfo.setLabels(labels);
|
| | | // }
|
| | | // if (Constant.IS_TEST) {
|
| | | // // 添加标签
|
| | | // List<ClientTextStyleVO> labels = goodsInfo.getLabels();
|
| | | // if (labels == null)
|
| | | // labels = new ArrayList<>();
|
| | | //
|
| | | // labels.add(new ClientTextStyleVO("预售", "#FF2B4E"));
|
| | | // labels.add(new ClientTextStyleVO("爆款", "#FF2B4E"));
|
| | | // labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E"));
|
| | | // goodsInfo.setLabels(labels);
|
| | | // }
|
| | |
|
| | | return goodsInfo;
|
| | | }
|
| | | return goodsInfo;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 淘宝商品组织
|
| | | * |
| | | * @param goods
|
| | | * 淘宝商品
|
| | | * @param pid
|
| | | * @param fanLiRate
|
| | | * 返利比例
|
| | | * @return
|
| | | */
|
| | | public static GoodsDetailVO convertTaoBao(TaoBaoGoodsBrief goods, ConfigParamsDTO params) {
|
| | | GoodsDetailVO goodsInfo = new GoodsDetailVO();
|
| | | goodsInfo.setBaoyou(true);
|
| | | goodsInfo.setGoodsType(Constant.SOURCE_TYPE_TAOBAO);
|
| | | goodsInfo.setGoodsId(goods.getAuctionId() + "");
|
| | | goodsInfo.setTitle(goods.getTitle());
|
| | | goodsInfo.setSalesType(1); // 默认月销量
|
| | | goodsInfo.setZkPrice(goods.getZkPrice());
|
| | | goodsInfo.setDescription(goods.getDescription());
|
| | | /**
|
| | | * 淘宝商品组织
|
| | | *
|
| | | * @param goods 淘宝商品
|
| | | * @param pid
|
| | | * @param fanLiRate 返利比例
|
| | | * @return
|
| | | */
|
| | | public static GoodsDetailVO convertTaoBao(TaoBaoGoodsBrief goods, ConfigParamsDTO params) {
|
| | | GoodsDetailVO goodsInfo = new GoodsDetailVO();
|
| | | goodsInfo.setBaoyou(true);
|
| | | goodsInfo.setGoodsType(Constant.SOURCE_TYPE_TAOBAO);
|
| | | goodsInfo.setGoodsId(goods.getAuctionId() + "");
|
| | | goodsInfo.setTitle(goods.getTitle());
|
| | | goodsInfo.setSalesType(1); // 默认月销量
|
| | | goodsInfo.setZkPrice(goods.getZkPrice());
|
| | | goodsInfo.setDescription(goods.getDescription());
|
| | |
|
| | | String provcity = goods.getProvcity();
|
| | | if (!StringUtil.isNullOrEmpty(provcity)) {
|
| | | String[] arr = provcity.split("\\s+");
|
| | | goodsInfo.setProvcity(arr[arr.length - 1]);
|
| | | }
|
| | | String provcity = goods.getProvcity();
|
| | | if (!StringUtil.isNullOrEmpty(provcity)) {
|
| | | String[] arr = provcity.split("\\s+");
|
| | | goodsInfo.setProvcity(arr[arr.length - 1]);
|
| | | }
|
| | |
|
| | | List<String> imgList = goods.getImgList();
|
| | | if (imgList != null) {
|
| | | goodsInfo.setImgList(imgList);
|
| | | } else {
|
| | | imgList = new ArrayList<String>();
|
| | | imgList.add(goods.getPictUrl());
|
| | | goodsInfo.setImgList(imgList);
|
| | | }
|
| | | List<String> imgList = goods.getImgList();
|
| | | if (imgList != null) {
|
| | | goodsInfo.setImgList(imgList);
|
| | | } else {
|
| | | imgList = new ArrayList<String>();
|
| | | imgList.add(goods.getPictUrl());
|
| | | goodsInfo.setImgList(imgList);
|
| | | }
|
| | |
|
| | | Integer state = goods.getState();
|
| | | if (state == null) {
|
| | | goodsInfo.setState(0);
|
| | | } else {
|
| | | goodsInfo.setState(state);
|
| | | }
|
| | | Integer state = goods.getState();
|
| | | if (state == null) {
|
| | | goodsInfo.setState(0);
|
| | | } else {
|
| | | goodsInfo.setState(state);
|
| | | }
|
| | |
|
| | | goodsInfo.setSalesCount(TaoBaoUtil.getSaleCount(goods.getBiz30day()));
|
| | | goodsInfo.setSalesCount(TaoBaoUtil.getSaleCount(goods.getBiz30day()));
|
| | |
|
| | | // 白底图可能有错误
|
| | | // https://img.alicdn.com/bao/uploaded/TB1LVqmVZbpK1RjSZFyXXX_qFXa.png
|
| | | if (!StringUtil.isNullOrEmpty(goods.getPictUrlWhite())) {
|
| | | goodsInfo.setPicUrl(TbImgUtil.getTBSize320Img(goods.getPictUrlWhite()));
|
| | | } else {
|
| | | goodsInfo.setPicUrl(TbImgUtil.getTBSize320Img(goods.getPictUrl()));
|
| | | }
|
| | | // 白底图可能有错误
|
| | | // https://img.alicdn.com/bao/uploaded/TB1LVqmVZbpK1RjSZFyXXX_qFXa.png
|
| | | if (!StringUtil.isNullOrEmpty(goods.getPictUrlWhite())) {
|
| | | goodsInfo.setPicUrl(TbImgUtil.getTBSize320Img(goods.getPictUrlWhite()));
|
| | | } else {
|
| | | goodsInfo.setPicUrl(TbImgUtil.getTBSize320Img(goods.getPictUrl()));
|
| | | }
|
| | |
|
| | | 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("淘宝价");
|
| | | }
|
| | |
|
| | | // 资金信息
|
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
|
| | | moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6
|
| | | // 资金信息
|
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
|
| | | moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6
|
| | |
|
| | |
|
| | | BigDecimal buyCommission = TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getFanLiRate(), false);
|
| | |
|
| | | BigDecimal buyCommission = TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getFanLiRate(), false);
|
| | | BigDecimal baseCommisstion = null;
|
| | | if (params.getBaseFanliRate() != null)
|
| | | baseCommisstion = TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getBaseFanliRate(), false);
|
| | | moneyInfoVO.setFanliMoney("¥" + buyCommission);
|
| | | if (params.getMaxRewardRate() != null)
|
| | | moneyInfoVO
|
| | | .setMaxMoney("¥" + buyCommission.add(MoneyBigDecimalUtil.mul(buyCommission, params.getMaxRewardRate())));
|
| | | else {// 只有有VIP后的版本才会显示返利比
|
| | |
|
| | | BigDecimal baseCommisstion = null;
|
| | | if (params.getBaseFanliRate() != null)
|
| | | baseCommisstion = TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getBaseFanliRate(), false);
|
| | | moneyInfoVO.setFanliMoney("¥" + buyCommission);
|
| | | if (params.getMaxRewardRate() != null)
|
| | | moneyInfoVO
|
| | | .setMaxMoney("¥" + buyCommission.add(MoneyBigDecimalUtil.mul(buyCommission, params.getMaxRewardRate())));
|
| | | else {// 只有有VIP后的版本才会显示返利比
|
| | | BigDecimal price = TaoBaoUtil.getAfterUseCouplePrice(goods);
|
| | | BigDecimal rate = MoneyBigDecimalUtil.div(buyCommission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setRateInfo("返利比 " + rate + "%");
|
| | |
|
| | | BigDecimal price = TaoBaoUtil.getAfterUseCouplePrice(goods);
|
| | | BigDecimal rate = MoneyBigDecimalUtil.div(buyCommission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setRateInfo("返利比 " + rate + "%");
|
| | | BigDecimal maxCommission = TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getVipFanLiRate(), false);
|
| | | BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%");
|
| | | moneyInfoVO.setMaxMoney("¥" + maxCommission);
|
| | | if (baseCommisstion != null) {
|
| | | String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | buyCommission.subtract(baseCommisstion).setScale(2).toString());
|
| | | String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | maxCommission.subtract(baseCommisstion).setScale(2).toString());
|
| | | moneyInfoVO.setCompositionInfo(desc);
|
| | | moneyInfoVO.setMaxCompositionInfo(maxDesc);
|
| | | }
|
| | | }
|
| | |
|
| | | BigDecimal maxCommission = TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getVipFanLiRate(), false);
|
| | | BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%");
|
| | | moneyInfoVO.setMaxMoney("¥" + maxCommission);
|
| | | if (baseCommisstion != null) {
|
| | | String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | buyCommission.subtract(baseCommisstion).setScale(2).toString());
|
| | | String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | maxCommission.subtract(baseCommisstion).setScale(2).toString());
|
| | | moneyInfoVO.setCompositionInfo(desc);
|
| | | moneyInfoVO.setMaxCompositionInfo(maxDesc);
|
| | | }
|
| | | }
|
| | | moneyInfoVO.setShareMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods, params.getShareRate(), true));
|
| | |
|
| | | moneyInfoVO.setShareMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods, params.getShareRate(), true));
|
| | | goodsInfo.setMoneyInfo(moneyInfoVO);
|
| | |
|
| | | goodsInfo.setMoneyInfo(moneyInfoVO);
|
| | | // 券信息
|
| | | if (goods.getCouponAmount().compareTo(BigDecimal.valueOf(0)) > 0) {
|
| | | // 计算券后价
|
| | | BigDecimal sub = goods.getZkPrice().subtract(goods.getCouponStartFee());
|
| | | if (sub.compareTo(BigDecimal.valueOf(0)) >= 0) {
|
| | | BigDecimal quanPrice = MoneyBigDecimalUtil.sub(goods.getZkPrice(), goods.getCouponAmount());
|
| | | goodsInfo.setCouponPrice(quanPrice);
|
| | | } else {
|
| | | goodsInfo.setCouponPrice(goods.getZkPrice());
|
| | | }
|
| | |
|
| | | // 券信息
|
| | | if (goods.getCouponAmount().compareTo(BigDecimal.valueOf(0)) > 0) {
|
| | | // 计算券后价
|
| | | BigDecimal sub = goods.getZkPrice().subtract(goods.getCouponStartFee());
|
| | | if (sub.compareTo(BigDecimal.valueOf(0)) >= 0) {
|
| | | BigDecimal quanPrice = MoneyBigDecimalUtil.sub(goods.getZkPrice(), goods.getCouponAmount());
|
| | | goodsInfo.setCouponPrice(quanPrice);
|
| | | } else {
|
| | | goodsInfo.setCouponPrice(goods.getZkPrice());
|
| | | }
|
| | | CouponInfoVO coupon = new CouponInfoVO();
|
| | | coupon.setAmount(goods.getCouponAmount());
|
| | | coupon.setLeftCount(goods.getCouponLeftCount());
|
| | | coupon.setTotalCount(goods.getCouponTotalCount());
|
| | | if (goods.getCouponEffectiveEndTime() != null) {
|
| | | coupon.setEndTime(goods.getCouponEffectiveEndTime().replace("-", "."));
|
| | | }
|
| | |
|
| | | CouponInfoVO coupon = new CouponInfoVO();
|
| | | coupon.setAmount(goods.getCouponAmount());
|
| | | coupon.setLeftCount(goods.getCouponLeftCount());
|
| | | coupon.setTotalCount(goods.getCouponTotalCount());
|
| | | if (goods.getCouponEffectiveEndTime() != null) {
|
| | | coupon.setEndTime(goods.getCouponEffectiveEndTime().replace("-", "."));
|
| | | }
|
| | | if (goods.getCouponEffectiveStartTime() != null) {
|
| | | coupon.setStartTime(goods.getCouponEffectiveStartTime().replace("-", "."));
|
| | | }
|
| | |
|
| | | if (goods.getCouponEffectiveStartTime() != null) {
|
| | | coupon.setStartTime(goods.getCouponEffectiveStartTime().replace("-", "."));
|
| | | }
|
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponLink()))
|
| | | coupon.setLink(goods.getCouponLink());
|
| | | else
|
| | | coupon.setLink(
|
| | | TaoBaoCouponUtil.getCoupleUrl(goods.getCouponActivityId(), null, goods.getAuctionId() + ""));
|
| | | coupon.setStartFee(goods.getCouponStartFee());
|
| | | coupon.setShopCoupon(goods.isShopCoupon());
|
| | | goodsInfo.setHasCoupon(true);
|
| | | goodsInfo.setCouponInfo(coupon);
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponLink()))
|
| | | coupon.setLink(goods.getCouponLink());
|
| | | else
|
| | | coupon.setLink(
|
| | | TaoBaoCouponUtil.getCoupleUrl(goods.getCouponActivityId(), null, goods.getAuctionId() + ""));
|
| | | coupon.setStartFee(goods.getCouponStartFee());
|
| | | coupon.setShopCoupon(goods.isShopCoupon());
|
| | | goodsInfo.setHasCoupon(true);
|
| | | goodsInfo.setCouponInfo(coupon);
|
| | | }
|
| | | // 店铺信息
|
| | | if (!StringUtil.isNullOrEmpty(goods.getShopTitle())) {
|
| | | ShopInfoVO shop = new ShopInfoVO();
|
| | | shop.setShopName(goods.getShopTitle());
|
| | |
|
| | | // 店铺信息
|
| | | if (!StringUtil.isNullOrEmpty(goods.getShopTitle())) {
|
| | | ShopInfoVO shop = new ShopInfoVO();
|
| | | shop.setShopName(goods.getShopTitle());
|
| | | if (goods.getSellerId() != null)
|
| | | shop.setId(goods.getSellerId().toString());
|
| | |
|
| | | if (goods.getSellerId() != null)
|
| | | shop.setId(goods.getSellerId().toString());
|
| | | if (shopType != null && shopType == 1) {
|
| | | shop.setUserType(11);
|
| | | } else {
|
| | | shop.setUserType(10);
|
| | | }
|
| | |
|
| | | if (shopType != null && shopType == 1) {
|
| | | shop.setUserType(11);
|
| | | } else {
|
| | | shop.setUserType(10);
|
| | | }
|
| | | goodsInfo.setShopInfo(shop);
|
| | | }
|
| | |
|
| | | goodsInfo.setShopInfo(shop);
|
| | | }
|
| | | if (TaoBaoUtil.isYUShou(goods)) {// 预售商品
|
| | | goodsInfo = loadYuShouInfo(goodsInfo, goods, null, params.getFanLiRate(), params.getShareRate());
|
| | | }
|
| | |
|
| | | if (TaoBaoUtil.isYUShou(goods)) {// 预售商品
|
| | | goodsInfo = loadYuShouInfo(goodsInfo, goods, null, params.getFanLiRate(), params.getShareRate());
|
| | | }
|
| | | if (Constant.IS_TEST) {
|
| | | // 添加标签
|
| | | List<ClientTextStyleVO> labels = goodsInfo.getLabels();
|
| | | if (labels == null)
|
| | | labels = new ArrayList<>();
|
| | |
|
| | | if (Constant.IS_TEST) {
|
| | | // 添加标签
|
| | | List<ClientTextStyleVO> labels = goodsInfo.getLabels();
|
| | | if (labels == null)
|
| | | labels = new ArrayList<>();
|
| | | labels.add(new ClientTextStyleVO("预售", "#FF2B4E"));
|
| | | labels.add(new ClientTextStyleVO("爆款", "#FF2B4E"));
|
| | | labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E"));
|
| | | goodsInfo.setLabels(labels);
|
| | | }
|
| | |
|
| | | labels.add(new ClientTextStyleVO("预售", "#FF2B4E"));
|
| | | labels.add(new ClientTextStyleVO("爆款", "#FF2B4E"));
|
| | | labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E"));
|
| | | goodsInfo.setLabels(labels);
|
| | | }
|
| | | return goodsInfo;
|
| | | }
|
| | |
|
| | | return goodsInfo;
|
| | | }
|
| | | private static GoodsDetailVO loadYuShouInfo(GoodsDetailVO goodsInfo, TaoBaoGoodsBrief goods, String pid,
|
| | | BigDecimal fanLiRate, BigDecimal shareRate) {
|
| | |
|
| | | private static GoodsDetailVO loadYuShouInfo(GoodsDetailVO goodsInfo, TaoBaoGoodsBrief goods, String pid,
|
| | | BigDecimal fanLiRate, BigDecimal shareRate) {
|
| | | if (goodsInfo != null && goods != null) {
|
| | | // 添加标签
|
| | | if (goodsInfo.getLabels() == null)
|
| | | goodsInfo.setLabels(new ArrayList<>());
|
| | | goodsInfo.getLabels().add(new ClientTextStyleVO("预售", "#FF2B4E"));
|
| | | }
|
| | | return goodsInfo;
|
| | | }
|
| | |
|
| | | if (goodsInfo != null && goods != null) {
|
| | | // 添加标签
|
| | | if (goodsInfo.getLabels() == null)
|
| | | goodsInfo.setLabels(new ArrayList<>());
|
| | | goodsInfo.getLabels().add(new ClientTextStyleVO("预售", "#FF2B4E"));
|
| | | }
|
| | | return goodsInfo;
|
| | | }
|
| | | private static CouponInfoVO convertJDCouponInfo(JDCouponInfo couponInfo) {
|
| | | CouponInfoVO coupon = new CouponInfoVO();
|
| | | coupon.setAmount(couponInfo.getDiscount());
|
| | | coupon.setLink(couponInfo.getLink());
|
| | | coupon.setStartFee(couponInfo.getQuota());
|
| | |
|
| | | private static CouponInfoVO convertJDCouponInfo(JDCouponInfo couponInfo) {
|
| | | CouponInfoVO coupon = new CouponInfoVO();
|
| | | coupon.setAmount(couponInfo.getDiscount());
|
| | | coupon.setLink(couponInfo.getLink());
|
| | | coupon.setStartFee(couponInfo.getQuota());
|
| | | if (couponInfo.getGetStartTime() != null) {
|
| | | coupon.setStartTime(TimeUtil.getGernalTime(couponInfo.getGetStartTime(), "yyyy.MM.dd"));
|
| | | }
|
| | |
|
| | | if (couponInfo.getGetStartTime() != null) {
|
| | | coupon.setStartTime(TimeUtil.getGernalTime(couponInfo.getGetStartTime(), "yyyy.MM.dd"));
|
| | | }
|
| | | if (couponInfo.getGetEndTime() != null) {
|
| | | coupon.setEndTime(TimeUtil.getGernalTime(couponInfo.getGetEndTime(), "yyyy.MM.dd"));
|
| | | }
|
| | |
|
| | | if (couponInfo.getGetEndTime() != null) {
|
| | | coupon.setEndTime(TimeUtil.getGernalTime(couponInfo.getGetEndTime(), "yyyy.MM.dd"));
|
| | | }
|
| | | return coupon;
|
| | | }
|
| | |
|
| | | return coupon;
|
| | | }
|
| | | private static List<CouponInfoVO> filterCouponInfo(List<CouponInfoVO> couponList) {
|
| | | if (couponList == null)
|
| | | return null;
|
| | | long currentTime = System.currentTimeMillis();
|
| | | Set<String> sets = new HashSet<>();
|
| | | // 过滤掉过期券
|
| | | for (int i = 0; i < couponList.size(); i++) {
|
| | | if (couponList.get(i).getStartTime() != null && couponList.get(i).getEndTime() != null) {
|
| | | long startTime = TimeUtil.convertToTimeTemp(couponList.get(i).getStartTime(), "yyyy.MM.dd");
|
| | | long endTime = TimeUtil.convertToTimeTemp(couponList.get(i).getEndTime(), "yyyy.MM.dd")
|
| | | + 1000 * 60 * 60 * 24L;
|
| | | if (currentTime < startTime || currentTime >= endTime) {
|
| | | couponList.remove(i--);
|
| | | continue;
|
| | | }
|
| | | }
|
| | | // 过滤掉面值相同与起始金额相同的
|
| | | String key = couponList.get(i).getStartFee() + "-" + couponList.get(i).getAmount();
|
| | | if (!sets.contains(key))
|
| | | sets.add(key);
|
| | | else {
|
| | | couponList.remove(i--);
|
| | | continue;
|
| | | }
|
| | | }
|
| | | return couponList;
|
| | | }
|
| | |
|
| | | private static List<CouponInfoVO> filterCouponInfo(List<CouponInfoVO> couponList) {
|
| | | if (couponList == null)
|
| | | return null;
|
| | | long currentTime = System.currentTimeMillis();
|
| | | Set<String> sets = new HashSet<>();
|
| | | // 过滤掉过期券
|
| | | for (int i = 0; i < couponList.size(); i++) {
|
| | | if (couponList.get(i).getStartTime() != null && couponList.get(i).getEndTime() != null) {
|
| | | long startTime = TimeUtil.convertToTimeTemp(couponList.get(i).getStartTime(), "yyyy.MM.dd");
|
| | | long endTime = TimeUtil.convertToTimeTemp(couponList.get(i).getEndTime(), "yyyy.MM.dd")
|
| | | + 1000 * 60 * 60 * 24L;
|
| | | if (currentTime < startTime || currentTime >= endTime) {
|
| | | couponList.remove(i--);
|
| | | continue;
|
| | | }
|
| | | }
|
| | | // 过滤掉面值相同与起始金额相同的
|
| | | String key = couponList.get(i).getStartFee() + "-" + couponList.get(i).getAmount();
|
| | | if (!sets.contains(key))
|
| | | sets.add(key);
|
| | | else {
|
| | | couponList.remove(i--);
|
| | | continue;
|
| | | }
|
| | | }
|
| | | return couponList;
|
| | | }
|
| | | /**
|
| | | * 淘宝商品组织
|
| | | *
|
| | | * @param goods 淘宝商品
|
| | | * @param pid
|
| | | * @param fanLiRate 返利比例
|
| | | * @return
|
| | | */
|
| | | public static GoodsDetailVO convertJDGoods(JDGoods goods, ConfigParamsDTO params) {
|
| | | GoodsDetailVO goodsInfo = new GoodsDetailVO();
|
| | | goodsInfo.setGoodsType(Constant.SOURCE_TYPE_JD);
|
| | | goodsInfo.setGoodsId(goods.getSkuId() + "");
|
| | | goodsInfo.setTitle(goods.getSkuName());
|
| | | goodsInfo.setSalesType(1); // 默认月销量
|
| | | goodsInfo.setPicUrl(goods.getPicUrl());
|
| | | goodsInfo.setImgList(goods.getImageList());
|
| | | goodsInfo.setState(0);
|
| | |
|
| | | /**
|
| | | * 淘宝商品组织
|
| | | * |
| | | * @param goods
|
| | | * 淘宝商品
|
| | | * @param pid
|
| | | * @param fanLiRate
|
| | | * 返利比例
|
| | | * @return
|
| | | */
|
| | | public static GoodsDetailVO convertJDGoods(JDGoods goods, ConfigParamsDTO params) {
|
| | | GoodsDetailVO goodsInfo = new GoodsDetailVO();
|
| | | goodsInfo.setGoodsType(Constant.SOURCE_TYPE_JD);
|
| | | goodsInfo.setGoodsId(goods.getSkuId() + "");
|
| | | goodsInfo.setTitle(goods.getSkuName());
|
| | | goodsInfo.setSalesType(1); // 默认月销量
|
| | | goodsInfo.setPicUrl(goods.getPicUrl());
|
| | | goodsInfo.setImgList(goods.getImageList());
|
| | | goodsInfo.setState(0);
|
| | | String salesCountMidea = null;
|
| | | Long count = goods.getInOrderCount30Days();
|
| | | if (count < 10000) {
|
| | | salesCountMidea = count + "";
|
| | | } else {
|
| | | double sales = count;
|
| | | salesCountMidea = String.format("%.1f", sales / 10000);
|
| | | salesCountMidea = salesCountMidea + "万";
|
| | | }
|
| | | goodsInfo.setSalesCount(salesCountMidea);
|
| | |
|
| | | String salesCountMidea = null;
|
| | | Long count = goods.getInOrderCount30Days();
|
| | | if (count < 10000) {
|
| | | salesCountMidea = count + "";
|
| | | } else {
|
| | | double sales = count;
|
| | | salesCountMidea = String.format("%.1f", sales / 10000);
|
| | | salesCountMidea = salesCountMidea + "万";
|
| | | }
|
| | | goodsInfo.setSalesCount(salesCountMidea);
|
| | | // 资金信息
|
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
|
| | | moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6
|
| | | BigDecimal commission = JDUtil.getGoodsFanLiMoney(goods, params.getFanLiRate());
|
| | | moneyInfoVO.setFanliMoney("¥" + commission);
|
| | | BigDecimal baseCommisstion = null;
|
| | | if (params.getBaseFanliRate() != null)
|
| | | baseCommisstion = JDUtil.getGoodsFanLiMoney(goods, params.getBaseFanliRate());
|
| | |
|
| | | // 资金信息
|
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
|
| | | moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6
|
| | | BigDecimal commission = JDUtil.getGoodsFanLiMoney(goods, params.getFanLiRate());
|
| | | moneyInfoVO.setFanliMoney("¥" + commission);
|
| | | BigDecimal baseCommisstion = null;
|
| | | if (params.getBaseFanliRate() != null)
|
| | | baseCommisstion = JDUtil.getGoodsFanLiMoney(goods, params.getBaseFanliRate());
|
| | | if (params.getMaxRewardRate() != null)
|
| | | moneyInfoVO
|
| | | .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate())));
|
| | | else {
|
| | | BigDecimal price = JDUtil.getQuanPrice(goods);
|
| | | BigDecimal rate = MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setRateInfo("返利比 " + rate + "%");
|
| | |
|
| | | if (params.getMaxRewardRate() != null)
|
| | | moneyInfoVO
|
| | | .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate())));
|
| | | else {
|
| | | BigDecimal price = JDUtil.getQuanPrice(goods);
|
| | | BigDecimal rate = MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setRateInfo("返利比 " + rate + "%");
|
| | | BigDecimal maxCommission = JDUtil.getGoodsFanLiMoney(goods, params.getVipFanLiRate());
|
| | | BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%");
|
| | | moneyInfoVO.setMaxMoney("¥" + maxCommission);
|
| | |
|
| | | BigDecimal maxCommission = JDUtil.getGoodsFanLiMoney(goods, params.getVipFanLiRate());
|
| | | BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%");
|
| | | moneyInfoVO.setMaxMoney("¥" + maxCommission);
|
| | | if (baseCommisstion != null) {
|
| | | String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | commission.subtract(baseCommisstion).setScale(2).toString());
|
| | | String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | maxCommission.subtract(baseCommisstion).setScale(2).toString());
|
| | | moneyInfoVO.setCompositionInfo(desc);
|
| | | moneyInfoVO.setMaxCompositionInfo(maxDesc);
|
| | | }
|
| | | }
|
| | | moneyInfoVO.setShareMoney("¥" + JDUtil.getGoodsFanLiMoney(goods, params.getShareRate()));
|
| | | goodsInfo.setMoneyInfo(moneyInfoVO);
|
| | |
|
| | | if (baseCommisstion != null) {
|
| | | String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | commission.subtract(baseCommisstion).setScale(2).toString());
|
| | | String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | maxCommission.subtract(baseCommisstion).setScale(2).toString());
|
| | | moneyInfoVO.setCompositionInfo(desc);
|
| | | moneyInfoVO.setMaxCompositionInfo(maxDesc);
|
| | | }
|
| | | }
|
| | | moneyInfoVO.setShareMoney("¥" + JDUtil.getGoodsFanLiMoney(goods, params.getShareRate()));
|
| | | goodsInfo.setMoneyInfo(moneyInfoVO);
|
| | | JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods);
|
| | | if (couponInfo != null) {
|
| | | BigDecimal discount = couponInfo.getDiscount();
|
| | | // 计算券后价
|
| | | goodsInfo.setCouponPrice(JDUtil.getQuanPrice(goods));
|
| | |
|
| | | JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods);
|
| | | if (couponInfo != null) {
|
| | | BigDecimal discount = couponInfo.getDiscount();
|
| | | // 计算券后价
|
| | | goodsInfo.setCouponPrice(JDUtil.getQuanPrice(goods));
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
|
| | | CouponInfoVO coupon = new CouponInfoVO();
|
| | | coupon.setAmount(discount);
|
| | | coupon.setLink(couponInfo.getLink());
|
| | | coupon.setStartFee(couponInfo.getQuota());
|
| | |
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
|
| | | CouponInfoVO coupon = new CouponInfoVO();
|
| | | coupon.setAmount(discount);
|
| | | coupon.setLink(couponInfo.getLink());
|
| | | coupon.setStartFee(couponInfo.getQuota());
|
| | | if (couponInfo.getGetStartTime() != null) {
|
| | | coupon.setStartTime(sdf.format(new Date(couponInfo.getGetStartTime())));
|
| | | }
|
| | |
|
| | | if (couponInfo.getGetStartTime() != null) {
|
| | | coupon.setStartTime(sdf.format(new Date(couponInfo.getGetStartTime())));
|
| | | }
|
| | | if (couponInfo.getGetEndTime() != null) {
|
| | | coupon.setEndTime(sdf.format(new Date(couponInfo.getGetEndTime())));
|
| | | }
|
| | |
|
| | | if (couponInfo.getGetEndTime() != null) {
|
| | | coupon.setEndTime(sdf.format(new Date(couponInfo.getGetEndTime())));
|
| | | }
|
| | | goodsInfo.setHasCoupon(true);
|
| | | goodsInfo.setCouponInfo(coupon);
|
| | | }
|
| | |
|
| | | goodsInfo.setHasCoupon(true);
|
| | | goodsInfo.setCouponInfo(coupon);
|
| | | }
|
| | | if (goods.getCouponInfoList() != null && goods.getCouponInfoList().size() > 0) {
|
| | | List<CouponInfoVO> couponList = new ArrayList<>();
|
| | | for (JDCouponInfo jdCoupon : goods.getCouponInfoList()) {
|
| | | couponList.add(convertJDCouponInfo(jdCoupon));
|
| | | }
|
| | | goodsInfo.setCouponInfoList(filterCouponInfo(couponList));
|
| | | }
|
| | |
|
| | | if (goods.getCouponInfoList() != null && goods.getCouponInfoList().size() > 0) {
|
| | | List<CouponInfoVO> couponList = new ArrayList<>();
|
| | | for (JDCouponInfo jdCoupon : goods.getCouponInfoList()) {
|
| | | couponList.add(convertJDCouponInfo(jdCoupon));
|
| | | }
|
| | | goodsInfo.setCouponInfoList(filterCouponInfo(couponList));
|
| | | }
|
| | | List<ClientTextStyleVO> labels = goodsInfo.getLabels();
|
| | | // 京东自营标签
|
| | | String owner = goods.getOwner();
|
| | | if (!StringUtil.isNullOrEmpty(owner) && "g".equalsIgnoreCase(owner)) {
|
| | | goodsInfo.setShopType(21); // 京东自营
|
| | | if (labels == null) {
|
| | | labels = new ArrayList<ClientTextStyleVO>();
|
| | | }
|
| | | ClientTextStyleVO textStyleVO = new ClientTextStyleVO();
|
| | | textStyleVO.setContent("京东自营");
|
| | | textStyleVO.setColor("#E42219");
|
| | | labels.add(textStyleVO);
|
| | | } else {
|
| | | goodsInfo.setShopType(20); // 京东
|
| | | }
|
| | |
|
| | | List<ClientTextStyleVO> labels = goodsInfo.getLabels();
|
| | | // 京东自营标签
|
| | | String owner = goods.getOwner();
|
| | | if (!StringUtil.isNullOrEmpty(owner) && "g".equalsIgnoreCase(owner)) {
|
| | | goodsInfo.setShopType(21); // 京东自营
|
| | | if (labels == null) {
|
| | | labels = new ArrayList<ClientTextStyleVO>();
|
| | | }
|
| | | ClientTextStyleVO textStyleVO = new ClientTextStyleVO();
|
| | | textStyleVO.setContent("京东自营");
|
| | | textStyleVO.setColor("#E42219");
|
| | | labels.add(textStyleVO);
|
| | | } else {
|
| | | goodsInfo.setShopType(20); // 京东
|
| | | }
|
| | | JDPingouInfo pinGouInfo = goods.getPinGouInfo();
|
| | | if (pinGouInfo != null) {
|
| | | goodsInfo.setZkPrice(pinGouInfo.getPingouPrice());
|
| | | goodsInfo.setPriceName("拼购价");
|
| | |
|
| | | JDPingouInfo pinGouInfo = goods.getPinGouInfo();
|
| | | if (pinGouInfo != null) {
|
| | | goodsInfo.setZkPrice(pinGouInfo.getPingouPrice());
|
| | | goodsInfo.setPriceName("拼购价");
|
| | | if (labels == null) {
|
| | | labels = new ArrayList<ClientTextStyleVO>();
|
| | | }
|
| | | ClientTextStyleVO textStyleVO = new ClientTextStyleVO();
|
| | | textStyleVO.setContent("拼购");
|
| | | textStyleVO.setColor("#E42219");
|
| | | labels.add(textStyleVO);
|
| | | } else {
|
| | | goodsInfo.setZkPrice(goods.getPrice());
|
| | | goodsInfo.setPriceName("京东价");
|
| | | }
|
| | | goodsInfo.setLabels(labels);
|
| | |
|
| | | if (labels == null) {
|
| | | labels = new ArrayList<ClientTextStyleVO>();
|
| | | }
|
| | | ClientTextStyleVO textStyleVO = new ClientTextStyleVO();
|
| | | textStyleVO.setContent("拼购");
|
| | | textStyleVO.setColor("#E42219");
|
| | | labels.add(textStyleVO);
|
| | | } else {
|
| | | goodsInfo.setZkPrice(goods.getPrice());
|
| | | goodsInfo.setPriceName("京东价");
|
| | | }
|
| | | 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());
|
| | |
|
| | | // 店铺信息
|
| | | 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);
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(owner) && "g".equalsIgnoreCase(owner)) {
|
| | | shop.setUserType(20);
|
| | | } else {
|
| | | shop.setUserType(21);
|
| | | }
|
| | | goodsInfo.setShopInfo(shop);
|
| | | }
|
| | | // 是否包邮
|
| | | Integer isFreeShipping = goods.getIsFreeShipping();
|
| | | if (isFreeShipping != null && isFreeShipping == 1) {
|
| | | goodsInfo.setBaoyou(true);
|
| | | }
|
| | |
|
| | | // 是否包邮
|
| | | Integer isFreeShipping = goods.getIsFreeShipping();
|
| | | if (isFreeShipping != null && isFreeShipping == 1) {
|
| | | goodsInfo.setBaoyou(true);
|
| | | }
|
| | | return goodsInfo;
|
| | | }
|
| | |
|
| | | return goodsInfo;
|
| | | }
|
| | | /**
|
| | | * 拼多多商品
|
| | | *
|
| | | * @param goods 拼多多商品
|
| | | * @param pid
|
| | | * @param fanLiRate 返利比例
|
| | | * @return
|
| | | */
|
| | | public static GoodsDetailVO convertPDDGoods(PDDGoodsDetail goods, ConfigParamsDTO params) {
|
| | | GoodsDetailVO goodsInfo = new GoodsDetailVO();
|
| | | goodsInfo.setBaoyou(true);
|
| | | goodsInfo.setGoodsType(Constant.SOURCE_TYPE_PDD);
|
| | | 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); // 拼多多
|
| | |
|
| | | /**
|
| | | * 拼多多商品
|
| | | * |
| | | * @param goods
|
| | | * 拼多多商品
|
| | | * @param pid
|
| | | * @param fanLiRate
|
| | | * 返利比例
|
| | | * @return
|
| | | */
|
| | | public static GoodsDetailVO convertPDDGoods(PDDGoodsDetail goods, ConfigParamsDTO params) {
|
| | | GoodsDetailVO goodsInfo = new GoodsDetailVO();
|
| | | goodsInfo.setBaoyou(true);
|
| | | goodsInfo.setGoodsType(Constant.SOURCE_TYPE_PDD);
|
| | | 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); // 拼多多
|
| | | String[] goodsGalleryUrls = goods.getGoodsGalleryUrls();
|
| | | if (goodsGalleryUrls != null) {
|
| | | goodsInfo.setImgList(Arrays.asList(goodsGalleryUrls));
|
| | | }
|
| | |
|
| | | String[] goodsGalleryUrls = goods.getGoodsGalleryUrls();
|
| | | if (goodsGalleryUrls != null) {
|
| | | goodsInfo.setImgList(Arrays.asList(goodsGalleryUrls));
|
| | | }
|
| | | Integer state = goods.getState();
|
| | | if (state == null) {
|
| | | goodsInfo.setState(0);
|
| | | } else {
|
| | | goodsInfo.setState(goods.getState());
|
| | | }
|
| | |
|
| | | Integer state = goods.getState();
|
| | | if (state == null) {
|
| | | goodsInfo.setState(0);
|
| | | } else {
|
| | | goodsInfo.setState(goods.getState());
|
| | | }
|
| | | // 总销量
|
| | | String salesTip = goods.getSalesTip();
|
| | | if (StringUtil.isNullOrEmpty(salesTip)) {
|
| | | salesTip = "0";
|
| | | }
|
| | | goodsInfo.setSalesCount(salesTip);
|
| | |
|
| | | // 总销量
|
| | | String salesTip = goods.getSalesTip();
|
| | | if (StringUtil.isNullOrEmpty(salesTip)) {
|
| | | salesTip = "0";
|
| | | }
|
| | | goodsInfo.setSalesCount(salesTip);
|
| | | // 资金信息
|
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
|
| | | moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6
|
| | | BigDecimal commission = PinDuoDuoUtil.getGoodsFanLiMoney(goods, params.getFanLiRate());
|
| | | BigDecimal shareCommission = PinDuoDuoUtil.getGoodsShareMoney(goods, params.getFanLiRate());
|
| | | moneyInfoVO.setFanliMoney("¥" + commission);
|
| | | moneyInfoVO.setShareMoney("¥" + shareCommission);
|
| | |
|
| | | // 资金信息
|
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
|
| | | moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6
|
| | | BigDecimal commission = PinDuoDuoUtil.getGoodsFanLiMoney(goods, params.getFanLiRate());
|
| | | moneyInfoVO.setFanliMoney("¥" + commission);
|
| | | moneyInfoVO.setShareMoney("¥" + commission);
|
| | | Boolean hasCoupon = goods.getHasCoupon();
|
| | | if (hasCoupon != null && hasCoupon) {
|
| | | BigDecimal hundred = new BigDecimal(100);
|
| | | BigDecimal amount = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponDiscount()), hundred).setScale(2);
|
| | | BigDecimal price = MoneyBigDecimalUtil.div(new BigDecimal(goods.getMinGroupPrice()), hundred).setScale(2);
|
| | | BigDecimal startFree = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponMinOrderAmount()), hundred)
|
| | | .setScale(2);
|
| | |
|
| | | Boolean hasCoupon = goods.getHasCoupon();
|
| | | if (hasCoupon != null && hasCoupon) {
|
| | | BigDecimal hundred = new BigDecimal(100);
|
| | | BigDecimal amount = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponDiscount()), hundred).setScale(2);
|
| | | BigDecimal price = MoneyBigDecimalUtil.div(new BigDecimal(goods.getMinGroupPrice()), hundred).setScale(2);
|
| | | BigDecimal startFree = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponMinOrderAmount()), hundred)
|
| | | .setScale(2);
|
| | | // 计算券后价
|
| | | if (startFree.compareTo(price) <= 0) {
|
| | | BigDecimal quanPrice = MoneyBigDecimalUtil.sub(price, amount);
|
| | | goodsInfo.setCouponPrice(quanPrice);
|
| | | } else {
|
| | | goodsInfo.setCouponPrice(price);
|
| | | }
|
| | |
|
| | | // 计算券后价
|
| | | if (startFree.compareTo(price) <= 0) {
|
| | | BigDecimal quanPrice = MoneyBigDecimalUtil.sub(price, amount);
|
| | | goodsInfo.setCouponPrice(quanPrice);
|
| | | } else {
|
| | | goodsInfo.setCouponPrice(price);
|
| | | }
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
|
| | | CouponInfoVO coupon = new CouponInfoVO();
|
| | | coupon.setAmount(amount);
|
| | | coupon.setStartFee(startFree);
|
| | |
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
|
| | | CouponInfoVO coupon = new CouponInfoVO();
|
| | | coupon.setAmount(amount);
|
| | | coupon.setStartFee(startFree);
|
| | | if (goods.getCouponStartTime() != null) {
|
| | | coupon.setStartTime(sdf.format(new Date(goods.getCouponStartTime() * 1000)));
|
| | | }
|
| | |
|
| | | 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)));
|
| | | }
|
| | | if (goods.getCouponTotalQuantity() != null)
|
| | | coupon.setTotalCount(Integer.parseInt(goods.getCouponTotalQuantity().toString()));
|
| | |
|
| | | if (goods.getCouponTotalQuantity() != null)
|
| | | coupon.setTotalCount(Integer.parseInt(goods.getCouponTotalQuantity().toString()));
|
| | | if (goods.getCouponRemainQuantity() != null)
|
| | | coupon.setLeftCount(Integer.parseInt(goods.getCouponRemainQuantity().toString()));
|
| | |
|
| | | if (goods.getCouponRemainQuantity() != null)
|
| | | coupon.setLeftCount(Integer.parseInt(goods.getCouponRemainQuantity().toString()));
|
| | | goodsInfo.setHasCoupon(true);
|
| | | goodsInfo.setCouponInfo(coupon);
|
| | | }
|
| | |
|
| | | goodsInfo.setHasCoupon(true);
|
| | | goodsInfo.setCouponInfo(coupon);
|
| | | }
|
| | | BigDecimal baseCommisstion = null;
|
| | | if (params.getBaseFanliRate() != null)
|
| | | baseCommisstion = PinDuoDuoUtil.getGoodsFanLiMoney(goods, params.getBaseFanliRate());
|
| | |
|
| | | BigDecimal baseCommisstion = null;
|
| | | if (params.getBaseFanliRate() != null)
|
| | | baseCommisstion = PinDuoDuoUtil.getGoodsFanLiMoney(goods, params.getBaseFanliRate());
|
| | | if (params.getMaxRewardRate() != null)
|
| | | moneyInfoVO
|
| | | .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate())));
|
| | | else {
|
| | | BigDecimal price = goodsInfo.getCouponPrice() != null ? goodsInfo.getCouponPrice() : goodsInfo.getZkPrice();
|
| | | BigDecimal rate = MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setRateInfo("返利比 " + rate + "%");
|
| | |
|
| | | if (params.getMaxRewardRate() != null)
|
| | | moneyInfoVO
|
| | | .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate())));
|
| | | else {
|
| | | BigDecimal price = goodsInfo.getCouponPrice() != null ? goodsInfo.getCouponPrice() : goodsInfo.getZkPrice();
|
| | | BigDecimal rate = MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setRateInfo("返利比 " + rate + "%");
|
| | | BigDecimal maxCommission = PinDuoDuoUtil.getGoodsFanLiMoney(goods, params.getVipFanLiRate());
|
| | | BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%");
|
| | |
|
| | | BigDecimal maxCommission = PinDuoDuoUtil.getGoodsFanLiMoney(goods, params.getVipFanLiRate());
|
| | | BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%");
|
| | | moneyInfoVO.setMaxMoney("¥" + maxCommission);
|
| | |
|
| | | moneyInfoVO.setMaxMoney("¥" + maxCommission);
|
| | | if (baseCommisstion != null) {
|
| | | String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | commission.subtract(baseCommisstion).setScale(2).toString());
|
| | | String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | maxCommission.subtract(baseCommisstion).setScale(2).toString());
|
| | | if (goods.getPromotionRate() > 0 && (goods.getPredictPromotionRate() != null && goods.getPredictPromotionRate().compareTo(new BigDecimal(0)) == 0)) {
|
| | | desc = "比价商品无返利";
|
| | | maxDesc = "比价商品无返利";
|
| | | }
|
| | |
|
| | | if (baseCommisstion != null) {
|
| | | String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | commission.subtract(baseCommisstion).setScale(2).toString());
|
| | | String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | maxCommission.subtract(baseCommisstion).setScale(2).toString());
|
| | | moneyInfoVO.setCompositionInfo(desc);
|
| | | moneyInfoVO.setMaxCompositionInfo(maxDesc);
|
| | | }
|
| | | }
|
| | | goodsInfo.setMoneyInfo(moneyInfoVO);
|
| | | moneyInfoVO.setCompositionInfo(desc);
|
| | | moneyInfoVO.setMaxCompositionInfo(maxDesc);
|
| | | }
|
| | | }
|
| | | goodsInfo.setMoneyInfo(moneyInfoVO);
|
| | |
|
| | | // 店铺信息
|
| | | String mallName = goods.getMallName();
|
| | | if (!StringUtil.isMobile(mallName)) {
|
| | | ShopInfoVO shop = new ShopInfoVO();
|
| | | shop.setShopName(mallName);
|
| | | if (goods.getMallId() != null) {
|
| | | shop.setId(goods.getMallId().toString());
|
| | | }
|
| | | shop.setUserType(30);
|
| | | goodsInfo.setShopInfo(shop);
|
| | | }
|
| | | // 店铺信息
|
| | | String mallName = goods.getMallName();
|
| | | if (!StringUtil.isMobile(mallName)) {
|
| | | ShopInfoVO shop = new ShopInfoVO();
|
| | | shop.setShopName(mallName);
|
| | | if (goods.getMallId() != null) {
|
| | | shop.setId(goods.getMallId().toString());
|
| | | }
|
| | | shop.setUserType(30);
|
| | | goodsInfo.setShopInfo(shop);
|
| | | }
|
| | |
|
| | | // if (Constant.IS_TEST) {
|
| | | // // 添加标签
|
| | | // List<ClientTextStyleVO> labels = goodsInfo.getLabels();
|
| | | // if (labels == null)
|
| | | // labels = new ArrayList<>();
|
| | | //
|
| | | // labels.add(new ClientTextStyleVO("预售", "#FF2B4E"));
|
| | | // labels.add(new ClientTextStyleVO("爆款", "#FF2B4E"));
|
| | | // labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E"));
|
| | | // goodsInfo.setLabels(labels);
|
| | | // }
|
| | | return goodsInfo;
|
| | | }
|
| | | // if (Constant.IS_TEST) {
|
| | | // // 添加标签
|
| | | // List<ClientTextStyleVO> labels = goodsInfo.getLabels();
|
| | | // if (labels == null)
|
| | | // labels = new ArrayList<>();
|
| | | //
|
| | | // labels.add(new ClientTextStyleVO("预售", "#FF2B4E"));
|
| | | // labels.add(new ClientTextStyleVO("爆款", "#FF2B4E"));
|
| | | // labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E"));
|
| | | // goodsInfo.setLabels(labels);
|
| | | // }
|
| | | return goodsInfo;
|
| | | }
|
| | |
|
| | | public static GoodsDetailVO convertVIPGoods(VIPGoodsInfo goods, ConfigParamsDTO params) {
|
| | | GoodsDetailVO goodsInfo = new GoodsDetailVO();
|
| | | goodsInfo.setBaoyou(true);
|
| | | goodsInfo.setGoodsType(Constant.SOURCE_TYPE_VIP);
|
| | | goodsInfo.setGoodsId(Long.parseLong(goods.getGoodsId()) + "");
|
| | | goodsInfo.setTitle(goods.getGoodsName());
|
| | | goodsInfo.setSalesType(5); // 无销量
|
| | | goodsInfo.setPriceName("原价");
|
| | | goodsInfo.setPicUrl(goods.getGoodsThumbUrl()); // 缩略图
|
| | | goodsInfo.setZkPrice(MoneyBigDecimalUtil.getWithNoZera(new BigDecimal(goods.getMarketPrice())));
|
| | | goodsInfo.setCouponPrice(MoneyBigDecimalUtil.getWithNoZera(new BigDecimal(goods.getVipPrice())));
|
| | | goodsInfo.setShopType(CommonGoods.SHOP_TYPE_VIP);
|
| | | public static GoodsDetailVO convertVIPGoods(VIPGoodsInfo goods, ConfigParamsDTO params) {
|
| | | GoodsDetailVO goodsInfo = new GoodsDetailVO();
|
| | | goodsInfo.setBaoyou(true);
|
| | | goodsInfo.setGoodsType(Constant.SOURCE_TYPE_VIP);
|
| | | goodsInfo.setGoodsId(Long.parseLong(goods.getGoodsId()) + "");
|
| | | goodsInfo.setTitle(goods.getGoodsName());
|
| | | goodsInfo.setSalesType(5); // 无销量
|
| | | goodsInfo.setPriceName("原价");
|
| | | goodsInfo.setPicUrl(goods.getGoodsThumbUrl()); // 缩略图
|
| | | goodsInfo.setZkPrice(MoneyBigDecimalUtil.getWithNoZera(new BigDecimal(goods.getMarketPrice())));
|
| | | goodsInfo.setCouponPrice(MoneyBigDecimalUtil.getWithNoZera(new BigDecimal(goods.getVipPrice())));
|
| | | goodsInfo.setShopType(CommonGoods.SHOP_TYPE_VIP);
|
| | |
|
| | | goodsInfo.setImgList(goods.getGoodsDetailPictures());
|
| | | goodsInfo.setImgList(goods.getGoodsDetailPictures());
|
| | |
|
| | | Integer state = goods.getStatus();
|
| | | if (state == null) {
|
| | | goodsInfo.setState(0);
|
| | | } else {
|
| | | goodsInfo.setState(goods.getStatus() == 1 ? CommonGoods.STATE_OFFLINE : CommonGoods.STATE_NORMAL);
|
| | | }
|
| | | Integer state = goods.getStatus();
|
| | | if (state == null) {
|
| | | goodsInfo.setState(0);
|
| | | } else {
|
| | | goodsInfo.setState(goods.getStatus() == 1 ? CommonGoods.STATE_OFFLINE : CommonGoods.STATE_NORMAL);
|
| | | }
|
| | |
|
| | | goodsInfo.setSalesCount("");
|
| | | goodsInfo.setSalesCount("");
|
| | |
|
| | | // 资金信息
|
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
|
| | | moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6
|
| | | BigDecimal commission = VipShopUtil.getGoodsFanLiMoney(goods, params.getFanLiRate());
|
| | | moneyInfoVO.setFanliMoney("¥" + commission);
|
| | | moneyInfoVO.setShareMoney("¥" + commission);
|
| | | // 资金信息
|
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
|
| | | moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6
|
| | | BigDecimal commission = VipShopUtil.getGoodsFanLiMoney(goods, params.getFanLiRate());
|
| | | moneyInfoVO.setFanliMoney("¥" + commission);
|
| | | moneyInfoVO.setShareMoney("¥" + commission);
|
| | |
|
| | | BigDecimal baseCommisstion = null;
|
| | | if (params.getBaseFanliRate() != null)
|
| | | baseCommisstion = VipShopUtil.getGoodsFanLiMoney(goods, params.getBaseFanliRate());
|
| | | BigDecimal baseCommisstion = null;
|
| | | if (params.getBaseFanliRate() != null)
|
| | | baseCommisstion = VipShopUtil.getGoodsFanLiMoney(goods, params.getBaseFanliRate());
|
| | |
|
| | | if (params.getMaxRewardRate() != null)
|
| | | moneyInfoVO
|
| | | .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate())));
|
| | | else {
|
| | | BigDecimal price = new BigDecimal(goods.getVipPrice());
|
| | | BigDecimal rate = MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setRateInfo("返利比 " + rate + "%");
|
| | | if (params.getMaxRewardRate() != null)
|
| | | moneyInfoVO
|
| | | .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate())));
|
| | | else {
|
| | | BigDecimal price = new BigDecimal(goods.getVipPrice());
|
| | | BigDecimal rate = MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setRateInfo("返利比 " + rate + "%");
|
| | |
|
| | | BigDecimal maxCommission = VipShopUtil.getGoodsFanLiMoney(goods, params.getVipFanLiRate());
|
| | | BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%");
|
| | | BigDecimal maxCommission = VipShopUtil.getGoodsFanLiMoney(goods, params.getVipFanLiRate());
|
| | | BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%");
|
| | |
|
| | | moneyInfoVO.setMaxMoney("¥" + maxCommission);
|
| | | moneyInfoVO.setMaxMoney("¥" + maxCommission);
|
| | |
|
| | | if (baseCommisstion != null) {
|
| | | String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | commission.subtract(baseCommisstion).setScale(2).toString());
|
| | | String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | maxCommission.subtract(baseCommisstion).setScale(2).toString());
|
| | | moneyInfoVO.setCompositionInfo(desc);
|
| | | moneyInfoVO.setMaxCompositionInfo(maxDesc);
|
| | | }
|
| | | }
|
| | | goodsInfo.setMoneyInfo(moneyInfoVO);
|
| | | if (baseCommisstion != null) {
|
| | | String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | commission.subtract(baseCommisstion).setScale(2).toString());
|
| | | String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | maxCommission.subtract(baseCommisstion).setScale(2).toString());
|
| | | moneyInfoVO.setCompositionInfo(desc);
|
| | | moneyInfoVO.setMaxCompositionInfo(maxDesc);
|
| | | }
|
| | | }
|
| | | goodsInfo.setMoneyInfo(moneyInfoVO);
|
| | |
|
| | | // 店铺信息
|
| | | String mallName = goods.getBrandName();
|
| | | if (!StringUtil.isNullOrEmpty(mallName)) {
|
| | | ShopInfoVO shop = new ShopInfoVO();
|
| | | shop.setShopName(mallName);
|
| | | if (goods.getBrandId() != null) {
|
| | | shop.setId(goods.getBrandId().toString());
|
| | | }
|
| | | shop.setUserType(30);
|
| | | goodsInfo.setShopInfo(shop);
|
| | | }
|
| | | // 店铺信息
|
| | | String mallName = goods.getBrandName();
|
| | | if (!StringUtil.isNullOrEmpty(mallName)) {
|
| | | ShopInfoVO shop = new ShopInfoVO();
|
| | | shop.setShopName(mallName);
|
| | | if (goods.getBrandId() != null) {
|
| | | shop.setId(goods.getBrandId().toString());
|
| | | }
|
| | | shop.setUserType(30);
|
| | | goodsInfo.setShopInfo(shop);
|
| | | }
|
| | |
|
| | | // 折扣信息
|
| | | goodsInfo.setDiscount(MoneyBigDecimalUtil
|
| | | .getWithNoZera(MoneyBigDecimalUtil.mul(new BigDecimal(goods.getDiscount()), new BigDecimal(10))) + "折");
|
| | | goodsInfo.setShopInfo(null);
|
| | | return goodsInfo;
|
| | | }
|
| | | // 折扣信息
|
| | | goodsInfo.setDiscount(MoneyBigDecimalUtil
|
| | | .getWithNoZera(MoneyBigDecimalUtil.mul(new BigDecimal(goods.getDiscount()), new BigDecimal(10))) + "折");
|
| | | goodsInfo.setShopInfo(null);
|
| | | return goodsInfo;
|
| | | }
|
| | |
|
| | | public static GoodsDetailVO convertSuningGoods(SuningGoodsInfo goods, ConfigParamsDTO params) {
|
| | | GoodsDetailVO goodsInfo = new GoodsDetailVO();
|
| | | goodsInfo.setBaoyou(true);
|
| | | goodsInfo.setGoodsType(Constant.SOURCE_TYPE_SUNING);
|
| | | goodsInfo.setGoodsId(SuningUtil.getConcatGoodsIId(goods.getCommodityInfo().getSupplierCode(),
|
| | | goods.getCommodityInfo().getCommodityCode()));
|
| | | goodsInfo.setTitle(goods.getCommodityInfo().getCommodityName());
|
| | | goodsInfo.setSalesType(1); // 月销
|
| | | goodsInfo.setPriceName("原价");
|
| | | if (goods.getCommodityInfo().getPictureUrl().size() > 0)
|
| | | goodsInfo.setPicUrl(goods.getCommodityInfo().getPictureUrl().get(0).getPicUrl()); // 缩略图
|
| | | public static GoodsDetailVO convertSuningGoods(SuningGoodsInfo goods, ConfigParamsDTO params) {
|
| | | GoodsDetailVO goodsInfo = new GoodsDetailVO();
|
| | | goodsInfo.setBaoyou(true);
|
| | | goodsInfo.setGoodsType(Constant.SOURCE_TYPE_SUNING);
|
| | | goodsInfo.setGoodsId(SuningUtil.getConcatGoodsIId(goods.getCommodityInfo().getSupplierCode(),
|
| | | goods.getCommodityInfo().getCommodityCode()));
|
| | | goodsInfo.setTitle(goods.getCommodityInfo().getCommodityName());
|
| | | goodsInfo.setSalesType(1); // 月销
|
| | | goodsInfo.setPriceName("原价");
|
| | | if (goods.getCommodityInfo().getPictureUrl().size() > 0)
|
| | | goodsInfo.setPicUrl(goods.getCommodityInfo().getPictureUrl().get(0).getPicUrl()); // 缩略图
|
| | |
|
| | | String commodityPrice = goods.getCommodityInfo().getCommodityPrice();
|
| | | if (StringUtil.isNullOrEmpty(commodityPrice)) {
|
| | | commodityPrice = goods.getCommodityInfo().getSnPrice();
|
| | | }
|
| | | goodsInfo.setZkPrice(MoneyBigDecimalUtil.getWithNoZera(new BigDecimal(commodityPrice)));
|
| | | goodsInfo.setShopType(CommonGoods.SHOP_TYPE_SUNING);
|
| | | String commodityPrice = goods.getCommodityInfo().getCommodityPrice();
|
| | | if (StringUtil.isNullOrEmpty(commodityPrice)) {
|
| | | commodityPrice = goods.getCommodityInfo().getSnPrice();
|
| | | }
|
| | | goodsInfo.setZkPrice(MoneyBigDecimalUtil.getWithNoZera(new BigDecimal(commodityPrice)));
|
| | | goodsInfo.setShopType(CommonGoods.SHOP_TYPE_SUNING);
|
| | |
|
| | | List<String> imgList = new ArrayList<>();
|
| | | for (SuningGoodsImg img : goods.getCommodityInfo().getPictureUrl()) {
|
| | | imgList.add(img.getPicUrl());
|
| | | }
|
| | | List<String> imgList = new ArrayList<>();
|
| | | for (SuningGoodsImg img : goods.getCommodityInfo().getPictureUrl()) {
|
| | | imgList.add(img.getPicUrl());
|
| | | }
|
| | |
|
| | | goodsInfo.setImgList(imgList);
|
| | | goodsInfo.setState(0);
|
| | | goodsInfo.setImgList(imgList);
|
| | | goodsInfo.setState(0);
|
| | |
|
| | | String salesCountMidea = "";
|
| | | Integer count = Integer.parseInt(goods.getCommodityInfo().getMonthSales());
|
| | | if (count < 10000) {
|
| | | salesCountMidea = count + "";
|
| | | } else {
|
| | | double sales = count;
|
| | | salesCountMidea = String.format("%.1f", sales / 10000);
|
| | | salesCountMidea = salesCountMidea + "万";
|
| | | }
|
| | | goodsInfo.setSalesCount(salesCountMidea);
|
| | | String salesCountMidea = "";
|
| | | Integer count = Integer.parseInt(goods.getCommodityInfo().getMonthSales());
|
| | | if (count < 10000) {
|
| | | salesCountMidea = count + "";
|
| | | } else {
|
| | | double sales = count;
|
| | | salesCountMidea = String.format("%.1f", sales / 10000);
|
| | | salesCountMidea = salesCountMidea + "万";
|
| | | }
|
| | | goodsInfo.setSalesCount(salesCountMidea);
|
| | |
|
| | | // 券信息
|
| | | if (goods.getCouponInfo() != null && !StringUtil.isNullOrEmpty(goods.getCouponInfo().getCouponUrl())) {// 有券
|
| | | CouponInfoVO coupon = new CouponInfoVO();
|
| | | coupon.setAmount(new BigDecimal(goods.getCouponInfo().getCouponValue()));
|
| | | if (StringUtil.isNullOrEmpty(goods.getCouponInfo().getBounsLimit())) {
|
| | | coupon.setStartFee(new BigDecimal(goods.getCouponInfo().getCouponValue()));
|
| | | } else
|
| | | coupon.setStartFee(new BigDecimal(goods.getCouponInfo().getBounsLimit()));
|
| | | // 券信息
|
| | | if (goods.getCouponInfo() != null && !StringUtil.isNullOrEmpty(goods.getCouponInfo().getCouponUrl())) {// 有券
|
| | | CouponInfoVO coupon = new CouponInfoVO();
|
| | | coupon.setAmount(new BigDecimal(goods.getCouponInfo().getCouponValue()));
|
| | | if (StringUtil.isNullOrEmpty(goods.getCouponInfo().getBounsLimit())) {
|
| | | coupon.setStartFee(new BigDecimal(goods.getCouponInfo().getCouponValue()));
|
| | | } else
|
| | | coupon.setStartFee(new BigDecimal(goods.getCouponInfo().getBounsLimit()));
|
| | |
|
| | | if (goods.getCouponInfo().getCouponStartTime() != null) {
|
| | | coupon.setStartTime(goods.getCouponInfo().getCouponStartTime());
|
| | | }
|
| | | if (goods.getCouponInfo().getCouponStartTime() != null) {
|
| | | coupon.setStartTime(goods.getCouponInfo().getCouponStartTime());
|
| | | }
|
| | |
|
| | | if (goods.getCouponInfo().getCouponEndTime() != null) {
|
| | | coupon.setEndTime(goods.getCouponInfo().getCouponEndTime());
|
| | | }
|
| | | if (goods.getCouponInfo().getCouponEndTime() != null) {
|
| | | coupon.setEndTime(goods.getCouponInfo().getCouponEndTime());
|
| | | }
|
| | |
|
| | | if (goods.getCouponInfo().getCouponCount() != null)
|
| | | coupon.setTotalCount(Integer.parseInt(goods.getCouponInfo().getCouponCount()));
|
| | | if (goods.getCouponInfo().getCouponCount() != null)
|
| | | coupon.setTotalCount(Integer.parseInt(goods.getCouponInfo().getCouponCount()));
|
| | |
|
| | | if (goods.getCouponInfo().getCouponCount() != null)
|
| | | coupon.setLeftCount(Integer.parseInt(goods.getCouponInfo().getCouponCount()));
|
| | | if (goods.getCouponInfo().getCouponCount() != null)
|
| | | coupon.setLeftCount(Integer.parseInt(goods.getCouponInfo().getCouponCount()));
|
| | |
|
| | | goodsInfo.setHasCoupon(true);
|
| | | goodsInfo.setCouponInfo(coupon);
|
| | | goodsInfo.setHasCoupon(true);
|
| | | goodsInfo.setCouponInfo(coupon);
|
| | |
|
| | | if (goodsInfo.getZkPrice().compareTo(coupon.getStartFee()) >= 0) {
|
| | | goodsInfo.setCouponPrice(goodsInfo.getZkPrice().subtract(coupon.getAmount()));
|
| | | } else {
|
| | | goodsInfo.setCouponPrice(goodsInfo.getZkPrice());
|
| | | }
|
| | | if (goodsInfo.getZkPrice().compareTo(coupon.getStartFee()) >= 0) {
|
| | | goodsInfo.setCouponPrice(goodsInfo.getZkPrice().subtract(coupon.getAmount()));
|
| | | } else {
|
| | | goodsInfo.setCouponPrice(goodsInfo.getZkPrice());
|
| | | }
|
| | |
|
| | | } else {
|
| | | goodsInfo.setHasCoupon(false);
|
| | | }
|
| | | } else {
|
| | | goodsInfo.setHasCoupon(false);
|
| | | }
|
| | |
|
| | | // 资金信息
|
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
|
| | | moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6
|
| | | BigDecimal commission = SuningUtil.getGoodsFanLiMoney(goods, params.getFanLiRate());
|
| | | moneyInfoVO.setFanliMoney("¥" + commission);
|
| | | moneyInfoVO.setShareMoney("¥" + commission);
|
| | | // 资金信息
|
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
|
| | | moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6
|
| | | BigDecimal commission = SuningUtil.getGoodsFanLiMoney(goods, params.getFanLiRate());
|
| | | moneyInfoVO.setFanliMoney("¥" + commission);
|
| | | moneyInfoVO.setShareMoney("¥" + commission);
|
| | |
|
| | | BigDecimal baseCommisstion = null;
|
| | | if (params.getBaseFanliRate() != null)
|
| | | baseCommisstion = SuningUtil.getGoodsFanLiMoney(goods, params.getBaseFanliRate());
|
| | | BigDecimal baseCommisstion = null;
|
| | | if (params.getBaseFanliRate() != null)
|
| | | baseCommisstion = SuningUtil.getGoodsFanLiMoney(goods, params.getBaseFanliRate());
|
| | |
|
| | | if (params.getMaxRewardRate() != null)
|
| | | moneyInfoVO
|
| | | .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate())));
|
| | | else {
|
| | | BigDecimal price = new BigDecimal(commodityPrice);
|
| | | BigDecimal rate = MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setRateInfo("返利比 " + rate + "%");
|
| | | if (params.getMaxRewardRate() != null)
|
| | | moneyInfoVO
|
| | | .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate())));
|
| | | else {
|
| | | BigDecimal price = new BigDecimal(commodityPrice);
|
| | | BigDecimal rate = MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setRateInfo("返利比 " + rate + "%");
|
| | |
|
| | | BigDecimal maxCommission = SuningUtil.getGoodsFanLiMoney(goods, params.getVipFanLiRate());
|
| | | BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%");
|
| | | BigDecimal maxCommission = SuningUtil.getGoodsFanLiMoney(goods, params.getVipFanLiRate());
|
| | | BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%");
|
| | |
|
| | | moneyInfoVO.setMaxMoney("¥" + maxCommission);
|
| | | moneyInfoVO.setMaxMoney("¥" + maxCommission);
|
| | |
|
| | | if (baseCommisstion != null) {
|
| | | String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | commission.subtract(baseCommisstion).setScale(2).toString());
|
| | | String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | maxCommission.subtract(baseCommisstion).setScale(2).toString());
|
| | | moneyInfoVO.setCompositionInfo(desc);
|
| | | moneyInfoVO.setMaxCompositionInfo(maxDesc);
|
| | | }
|
| | | }
|
| | | goodsInfo.setMoneyInfo(moneyInfoVO);
|
| | | if (baseCommisstion != null) {
|
| | | String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | commission.subtract(baseCommisstion).setScale(2).toString());
|
| | | String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | maxCommission.subtract(baseCommisstion).setScale(2).toString());
|
| | | moneyInfoVO.setCompositionInfo(desc);
|
| | | moneyInfoVO.setMaxCompositionInfo(maxDesc);
|
| | | }
|
| | | }
|
| | | goodsInfo.setMoneyInfo(moneyInfoVO);
|
| | |
|
| | | // 店铺信息
|
| | | String mallName = goods.getCommodityInfo().getSupplierName();
|
| | | if (!StringUtil.isMobile(mallName)) {
|
| | | ShopInfoVO shop = new ShopInfoVO();
|
| | | shop.setShopName(mallName);
|
| | | if (goods.getCommodityInfo().getSupplierCode() != null) {
|
| | | shop.setId(goods.getCommodityInfo().getSupplierCode());
|
| | | }
|
| | | shop.setUserType(30);
|
| | | goodsInfo.setShopInfo(shop);
|
| | | }
|
| | | // 店铺信息
|
| | | String mallName = goods.getCommodityInfo().getSupplierName();
|
| | | if (!StringUtil.isMobile(mallName)) {
|
| | | ShopInfoVO shop = new ShopInfoVO();
|
| | | shop.setShopName(mallName);
|
| | | if (goods.getCommodityInfo().getSupplierCode() != null) {
|
| | | shop.setId(goods.getCommodityInfo().getSupplierCode());
|
| | | }
|
| | | shop.setUserType(30);
|
| | | goodsInfo.setShopInfo(shop);
|
| | | }
|
| | |
|
| | | return goodsInfo;
|
| | | }
|
| | | return goodsInfo;
|
| | | }
|
| | |
|
| | | }
|