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 |   74 ++++++++++++++-----------------------
 1 files changed, 28 insertions(+), 46 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 02d719f..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();
@@ -718,7 +719,7 @@
 			quanInfo.setCouponLeftCount(tb.getCouponLeftCount());
 			quanInfo.setCouponLink(
 					TaoBaoCouponUtil.getCoupleUrl(tb.getCouponActivityId(), pid, tb.getAuctionId() + ""));
-			quanInfo.setCouponPrice(tb.getZkPrice().subtract(tb.getTkCommFee()));
+			quanInfo.setCouponPrice(MoneyBigDecimalUtil.sub(tg.getZkPrice(), tb.getCouponAmount()));
 			quanInfo.setCouponStartFee(tb.getCouponStartFee());
 			quanInfo.setCouponTotalCount(tb.getCouponTotalCount());
 			tg.setTaoBaoQuanInfo(quanInfo);
@@ -761,15 +762,14 @@
 
 		tg.setTaoBaoHongBaoInfo(hongBaoInfo);
 
+		tg.setMoneyType(1);
+		tg.setSalesType(1);
 		// 娴嬭瘯浣跨敤
-//		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("鏍囩娴嬭瘯鍐呭", "#FF0000"));
-//		labels.add(new ClientTextStyleVO("鏍囩娴嬭瘯鍐呭", "#00FF00"));
-//		tg.setLabels(labels);
-
+		// 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);
 		return tg;
 	}
 
@@ -1013,14 +1013,16 @@
 		}
 		tg.setTaoBaoHongBaoInfo(hongBaoInfo);
 
+		tg.setMoneyType(1);
+		tg.setSalesType(1);
 		// 娴嬭瘯浣跨敤
-//		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("鏍囩娴嬭瘯鍐呭", "#FF0000"));
-//		labels.add(new ClientTextStyleVO("鏍囩娴嬭瘯鍐呭", "#00FF00"));
-//		tg.setLabels(labels);
+		// 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);
 
 		return tg;
 	}
@@ -1348,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)));
@@ -1362,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);
 	}
 
 	// }
@@ -1405,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