From 43362240e4f061f137729a7fb8cf4d1b0e899241 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 19 十月 2019 18:20:08 +0800
Subject: [PATCH] 淘宝双11预售商品添加修改

---
 fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoUtil.java |   55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 54 insertions(+), 1 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 cde7b97..7c282c9 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
@@ -72,6 +72,7 @@
 import com.yeshi.fanli.util.TaoBaoConstant;
 import com.yeshi.fanli.util.TaoBaoHttpUtil;
 import com.yeshi.fanli.util.TimeUtil;
+import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
 
 import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
@@ -782,7 +783,44 @@
 		// labels.add(new ClientTextStyleVO("鏍囩鍐呭", "#00FF00"));
 		// tg.setLabels(labels);
 		// }
-		return tg;
+		return loadYuShouInfo(tg, tb);
+	}
+
+	private static TaoBaoGoodsBriefExtra loadYuShouInfo(TaoBaoGoodsBriefExtra extra, TaoBaoGoodsBrief goods) {
+		if (goods != null && extra != null) {
+			if (isYUShou(goods)) {// 棰勫敭鍟嗗搧
+				extra.setZkPrice(new BigDecimal(goods.getPresaleDeposit()));
+				// 棰勫敭
+				if (extra.getLabels() == null)
+					extra.setLabels(new ArrayList<>());
+				extra.getLabels().add(new ClientTextStyleVO("棰勫敭", "#FF2B4E"));
+				if (!StringUtil.isNullOrEmpty(goods.getPresaleDiscountFeeText())) {// 鍦ㄦ爣棰樻坊鍔犱紭鎯犱俊鎭�
+					extra.setTitle(String.format("銆�%s銆�", goods.getPresaleDiscountFeeText()) + extra.getTitle());
+				}
+			}
+		}
+		return extra;
+	}
+
+	/**
+	 * 鏄惁涓洪鍞晢鍝�
+	 * 
+	 * @param goods
+	 * @return
+	 */
+	public static boolean isYUShou(TaoBaoGoodsBrief goods) {
+		if (!StringUtil.isNullOrEmpty(goods.getPresaleDeposit())
+				&& !StringUtil.isNullOrEmpty(goods.getPresaleStartTime())
+				&& !StringUtil.isNullOrEmpty(goods.getPresaleEndTime())) {
+			long startTime = Long.parseLong(goods.getPresaleStartTime());
+			long endTime = Long.parseLong(goods.getPresaleEndTime());
+			long now = System.currentTimeMillis();
+			if (now >= startTime && now < endTime) {
+				return true;
+			}
+		}
+
+		return false;
 	}
 
 	/**
@@ -1399,6 +1437,21 @@
 	public static BigDecimal getGoodsHongBaoMoney(TaoBaoGoodsBrief goodsBrief, BigDecimal rate) {
 		BigDecimal money = null;
 
+		// 棰勫敭鍟嗗搧
+		if (isYUShou(goodsBrief)) {
+			if (goodsBrief.getYsylCommissionRate() != null)
+				money = MoneyBigDecimalUtil.mul(
+						MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(new BigDecimal(goodsBrief.getPresaleDeposit()),
+								goodsBrief.getYsylCommissionRate()), new BigDecimal("0.01")),
+						MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
+			else
+				money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(
+						MoneyBigDecimalUtil.mul(goodsBrief.getZkPrice(), goodsBrief.getTkRate()),
+						new BigDecimal("0.01")), MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
+
+			return money;
+		}
+
 		if (StringUtil.isNullOrEmpty(goodsBrief.getCouponInfo())
 				|| goodsBrief.getCouponInfo().trim().equalsIgnoreCase("鏃�")) {
 			money = MoneyBigDecimalUtil.mul(

--
Gitblit v1.8.0