| | |
| | | import org.yeshi.utils.BigDecimalUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.goods.ShareGoodsTextTemplateMapper;
|
| | | import com.yeshi.fanli.dto.jd.JDPingouInfo;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.entity.goods.ShareGoodsTextTemplate;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | |
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.goods.ShareGoodsTextTemplateService;
|
| | | import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.jd.JDUtil;
|
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil;
|
| | |
| | |
|
| | | @Override
|
| | | public void isCommonTemplateRightJD(String template) throws ShareGoodsTextTemplateException {
|
| | | String[] keys = new String[] { "{标题}", "{商品原价}", "{月销量}", "{短链接}" };
|
| | | String[] keys = new String[] { "{标题}","{京东价}", "{商品原价}", "{月销量}", "{短链接}" };
|
| | | int keysCount = 0;
|
| | | for (String key : keys)
|
| | | if (template != null && template.contains(key))
|
| | |
| | |
|
| | | @Override
|
| | | public void isCouponTemplateRightJD(String template) throws ShareGoodsTextTemplateException {
|
| | | String[] keys = new String[] { "{标题}", "{商品原价}", "{优惠券面额}", "{优惠券价}", "{月销量}", "{短链接}" };
|
| | | String[] keys = new String[] { "{标题}","{京东价}", "{商品原价}", "{优惠券面额}", "{优惠券价}", "{月销量}", "{短链接}" };
|
| | | int keysCount = 0;
|
| | | for (String key : keys)
|
| | | if (template != null && template.contains(key))
|
| | |
| | |
|
| | | @Override
|
| | | public String createContentByTemplateJD(String template, Long uid, JDGoods goods, String shortLink, boolean hasCoupon) {
|
| | | BigDecimal price = goods.getPrice();
|
| | | JDPingouInfo pinGouInfo = goods.getPinGouInfo();
|
| | | if (pinGouInfo != null) {
|
| | | price = pinGouInfo.getPingouPrice();
|
| | | }
|
| | | |
| | | if (!hasCoupon) {
|
| | | return template.replace("{标题}", goods.getSkuName()).replace("{商品原价}", BigDecimalUtil.getWithNoZera(goods.getPrice()).toString())
|
| | | template = template.replace("{标题}", goods.getSkuName()).replace("{商品原价}", BigDecimalUtil.getWithNoZera(price).toString())
|
| | | .replace("{月销量}", JDUtil.getSaleCount(goods.getInOrderCount30Days())).replace("{短链接}", shortLink);
|
| | | } else {
|
| | | return template.replace("{标题}", goods.getSkuName()).replace("{商品原价}", BigDecimalUtil.getWithNoZera( goods.getPrice()).toString())
|
| | | template = template.replace("{标题}", goods.getSkuName()).replace("{商品原价}", BigDecimalUtil.getWithNoZera(price).toString())
|
| | | .replace("{月销量}", JDUtil.getSaleCount(goods.getInOrderCount30Days())).replace("{短链接}", shortLink)
|
| | | .replace("{优惠券面额}", BigDecimalUtil.getWithNoZera(goods.getCouponInfo().getDiscount()).toString())
|
| | | .replace("{优惠券价}", BigDecimalUtil.getWithNoZera(JDUtil.getQuanPrice(goods)).toString());
|
| | | }
|
| | | |
| | | if (pinGouInfo != null) {
|
| | | template = template.replace("{京东价}", "拼购价");
|
| | | } else {
|
| | | template = template.replace("{京东价}", "京东价");
|
| | | }
|
| | | return template;
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public String createContentByTemplatePDD(String template, Long uid, PDDGoodsDetail goods,
|
| | | String shortLink, boolean hasCoupon, String token) {
|
| | | BigDecimal hundred = new BigDecimal(100);
|
| | | BigDecimal price = MoneyBigDecimalUtil.div(new BigDecimal(goods.getMinGroupPrice()), hundred);
|
| | | if (!hasCoupon) {
|
| | | template = template.replace("{标题}", goods.getGoodsName()).replace("{商品原价}", BigDecimalUtil.getWithNoZera(new BigDecimal(goods.getMinNormalPrice())).toString())
|
| | | template = template.replace("{标题}", goods.getGoodsName()).replace("{商品原价}", BigDecimalUtil.getWithNoZera(price).toString())
|
| | | .replace("{总销量}", goods.getSalesTip()).replace("{短链接}", shortLink);
|
| | | } else {
|
| | | template = template.replace("{标题}", goods.getGoodsName()).replace("{商品原价}", BigDecimalUtil.getWithNoZera(new BigDecimal(goods.getMinNormalPrice())).toString())
|
| | | BigDecimal amount = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponDiscount()), hundred);
|
| | | template = template.replace("{标题}", goods.getGoodsName()).replace("{商品原价}", BigDecimalUtil.getWithNoZera(price).toString())
|
| | | .replace("{总销量}", goods.getSalesTip()).replace("{短链接}", shortLink)
|
| | | .replace("{优惠券面额}", BigDecimalUtil.getWithNoZera(new BigDecimal(goods.getCouponDiscount())).toString())
|
| | | .replace("{优惠券价}", BigDecimalUtil.getWithNoZera( PinDuoDuoUtil.getQuanPrice(goods)).toString());
|
| | | .replace("{优惠券面额}", BigDecimalUtil.getWithNoZera(amount).toString())
|
| | | .replace("{优惠券价}", BigDecimalUtil.getWithNoZera(PinDuoDuoUtil.getQuanPrice(goods)).toString());
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|