From fc0cc7e808f9228b39b1e6b9d29c5417f41dbcc4 Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期五, 24 五月 2019 16:52:02 +0800 Subject: [PATCH] 删除 老版动态查询商品 关联yeshi_ec_taobao_goods 的sql --- fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoUtil.java | 57 +++++++++++++++++++-------------------------------------- 1 files changed, 19 insertions(+), 38 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoUtil.java index 0aab3ff..4d1109d 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoUtil.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoUtil.java @@ -28,6 +28,7 @@ import org.springframework.stereotype.Component; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NodeList; +import org.yeshi.utils.BigDecimalUtil; import org.yeshi.utils.HttpUtil; import org.yeshi.utils.NumberUtil; import org.yeshi.utils.entity.ProxyIP; @@ -705,9 +706,9 @@ tg.setShopTitle(tb.getShopTitle()); tg.setState(tb.getState()); // 鐘舵�侊細2018-12-03 if (tb.getCouponAmount().compareTo(BigDecimal.valueOf(0)) > 0) { - - tg.setCoupon(true);// 鏈夊埜 - + + tg.setCoupon(true);// 鏈夊埜 + TaoBaoQuanInfo quanInfo = new TaoBaoQuanInfo(); quanInfo.setCouponAmount(tb.getCouponAmount()); String couponEffectiveEndTime = tb.getCouponEffectiveEndTime(); @@ -765,10 +766,10 @@ tg.setSalesType(1); // 娴嬭瘯浣跨敤 // tg.setSalesType(Math.random() > 0.5 ? tg.getSalesType() : 3); - List<ClientTextStyleVO> labels = new ArrayList<>(); - labels.add(new ClientTextStyleVO("鏍囩鍐呭", "#F14242")); - labels.add(new ClientTextStyleVO("鏍囩鍐呭", "#00FF00")); - tg.setLabels(labels); + // List<ClientTextStyleVO> labels = new ArrayList<>(); + // labels.add(new ClientTextStyleVO("鏍囩鍐呭", "#F14242")); + // labels.add(new ClientTextStyleVO("鏍囩鍐呭", "#00FF00")); + // tg.setLabels(labels); return tg; } @@ -1018,10 +1019,10 @@ // tg.setMoneyType(Math.random() > 0.5 ? 1 : 2); // tg.setSalesType(Math.random() > 0.5 ? 1 : 2); // tg.setSalesType(Math.random() > 0.5 ? tg.getSalesType() : 3); - List<ClientTextStyleVO> labels = new ArrayList<>(); - labels.add(new ClientTextStyleVO("鏍囩鍐呭", "#F14242")); - labels.add(new ClientTextStyleVO("鏍囩鍐呭", "#000000")); - tg.setLabels(labels); + // List<ClientTextStyleVO> labels = new ArrayList<>(); + // labels.add(new ClientTextStyleVO("鏍囩鍐呭", "#F14242")); + // labels.add(new ClientTextStyleVO("鏍囩鍐呭", "#000000")); + // tg.setLabels(labels); return tg; } @@ -1349,9 +1350,11 @@ * @return */ public static BigDecimal getGoodsHongBaoMoney(TaoBaoGoodsBrief goodsBrief, BigDecimal rate) { + BigDecimal money = null; + if (StringUtil.isNullOrEmpty(goodsBrief.getCouponInfo()) || goodsBrief.getCouponInfo().trim().equalsIgnoreCase("鏃�")) { - return MoneyBigDecimalUtil.mul( + money = MoneyBigDecimalUtil.mul( MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(goodsBrief.getZkPrice(), goodsBrief.getTkRate()), new BigDecimal("0.01")), MoneyBigDecimalUtil.div(rate, new BigDecimal(100))); @@ -1363,16 +1366,17 @@ if (startFee.compareTo(goodsBrief.getZkPrice()) <= 0 && goodsBrief.getZkPrice().compareTo(couponAccount) > 0) { BigDecimal finalPrice = goodsBrief.getZkPrice().subtract(couponAccount); - return MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil + money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil .mul(MoneyBigDecimalUtil.mul(finalPrice, goodsBrief.getTkRate()), new BigDecimal("0.01")), MoneyBigDecimalUtil.div(rate, new BigDecimal(100))); } else {// 涓嶈兘鐢ㄥ埜 - return MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul( + money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul( MoneyBigDecimalUtil.mul(goodsBrief.getZkPrice(), goodsBrief.getTkRate()), new BigDecimal("0.01")), MoneyBigDecimalUtil.div(rate, new BigDecimal(100))); } } + return BigDecimalUtil.getWithNoZera(money); } // } @@ -1406,30 +1410,7 @@ */ public static BigDecimal getShareGoodsHongBaoInfo(TaoBaoGoodsBrief goodsBrief, BigDecimal rate) { - - // 璁$畻杩斿埄 - // 鏃犲埜 - if (StringUtil.isNullOrEmpty(goodsBrief.getCouponInfo()) || goodsBrief.getCouponInfo().contains("鏃�")) { - return goodsBrief.getZkPrice().multiply(goodsBrief.getTkRate()).divide(new BigDecimal(10000)).multiply(rate) - .setScale(2, BigDecimal.ROUND_DOWN); - - } else// 鏈夊埜 - { - List<BigDecimal> list = TaoBaoCouponUtil.getCouponInfo(goodsBrief.getCouponInfo()); - BigDecimal startFee = list.get(0); - BigDecimal couponAccount = list.get(1); - if (startFee.compareTo(goodsBrief.getZkPrice()) <= 0 - && goodsBrief.getZkPrice().compareTo(couponAccount) > 0) { - BigDecimal finalPrice = goodsBrief.getZkPrice().subtract(couponAccount); - return finalPrice.multiply(goodsBrief.getTkRate()).divide(new BigDecimal(10000)).multiply(rate) - .setScale(2, BigDecimal.ROUND_DOWN); - - } else {// 涓嶈兘鐢ㄥ埜 - return goodsBrief.getZkPrice().multiply(goodsBrief.getTkRate()).divide(new BigDecimal(10000)) - .multiply(rate).setScale(2, BigDecimal.ROUND_DOWN); - } - - } + return getGoodsHongBaoMoney(goodsBrief, rate); } /** -- Gitblit v1.8.0