From f4a0f2acc63d7785eab108419a4e16f5f688cb95 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期六, 18 一月 2020 12:06:27 +0800
Subject: [PATCH] 用户注册信息

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java |  324 ++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 230 insertions(+), 94 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
index eabd256..92f3bb6 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
@@ -2,10 +2,10 @@
 
 import java.io.PrintWriter;
 import java.math.BigDecimal;
-import java.text.ParseException;
 import java.util.ArrayList;
-import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import javax.annotation.Resource;
 
@@ -13,11 +13,11 @@
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
-import org.yeshi.utils.DateUtil;
 import org.yeshi.utils.HttpUtil;
 import org.yeshi.utils.JsonUtil;
 import org.yeshi.utils.taobao.TbImgUtil;
 
+import com.google.gson.Gson;
 import com.yeshi.fanli.dto.ConfigParamsDTO;
 import com.yeshi.fanli.dto.jd.JDCategoryInfo;
 import com.yeshi.fanli.dto.jd.JDCouponInfo;
@@ -26,14 +26,14 @@
 import com.yeshi.fanli.dto.pdd.PDDPromotionUrl;
 import com.yeshi.fanli.dto.pdd.PDDSearchFilter;
 import com.yeshi.fanli.entity.accept.AcceptData;
-import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinNewbies;
 import com.yeshi.fanli.entity.bus.user.ShamUser;
 import com.yeshi.fanli.entity.bus.user.UserInfo;
-import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
 import com.yeshi.fanli.entity.goods.CollectionGoodsV2;
+import com.yeshi.fanli.entity.goods.CommonGoods;
 import com.yeshi.fanli.entity.jd.JDGoods;
 import com.yeshi.fanli.entity.jd.JDGoodsClass;
 import com.yeshi.fanli.entity.system.BusinessSystem;
+import com.yeshi.fanli.entity.system.ConfigKeyEnum;
 import com.yeshi.fanli.entity.system.SystemClientParams;
 import com.yeshi.fanli.entity.taobao.ClientTBPid;
 import com.yeshi.fanli.entity.taobao.TLJBuyGoods;
@@ -62,7 +62,7 @@
 import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
 import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
 import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
-import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
+import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service;
 import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService;
 import com.yeshi.fanli.service.inter.user.ShamUserService;
 import com.yeshi.fanli.service.inter.user.TBPidService;
@@ -70,6 +70,8 @@
 import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
 import com.yeshi.fanli.service.inter.user.UserInfoService;
 import com.yeshi.fanli.service.inter.user.integral.IntegralGetService;
+import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
+import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
 import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.MoneyBigDecimalUtil;
 import com.yeshi.fanli.util.RedisManager;
@@ -141,7 +143,7 @@
 	private TaoBaoUnionConfigService taoBaoUnionConfigService;
 
 	@Resource
-	private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
+	private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service;
 
 	@Resource
 	private HongBaoManageService hongBaoManageService;
@@ -184,12 +186,18 @@
 
 	@Resource
 	private JDGoodsClassService jdGoodsClassService;
-	
+
 	@Resource
 	private TLJFreeBuyGoodsService tljFreeBuyGoodsService;
-	
+
 	@Resource
 	private UserTaoLiJinNewbiesService userTaoLiJinNewbiesService;
+
+	@Resource
+	private UserVIPInfoService userVIPInfoService;
+
+	@Resource
+	private UserVipConfigService userVipConfigService;
 
 	/**
 	 * 娣樺疂鍟嗗搧璇︽儏
@@ -237,7 +245,7 @@
 
 		LogHelper.test("鑾峰彇PID鑰楁椂锛�" + (java.lang.System.currentTimeMillis() - startTime));
 
-		final List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
+		// final List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
 		// 鏄惁鍦ㄦ湇鍔$杩涜杞摼
 		boolean convertInServer = configService.isConvertTaoBaoLinkInServer();
 
@@ -306,7 +314,6 @@
 		}
 
 		if (goods != null) {
-			goodsList.add(goods);
 			final TaoBaoGoodsBrief newGoods = goods;
 			ThreadUtil.run(new Runnable() {
 				public void run() {
@@ -321,10 +328,7 @@
 			});
 		}
 
-		TaoBaoGoodsBrief tb = null;
-		if (goodsList.size() > 0) {
-			tb = goodsList.get(0);
-		}
+		TaoBaoGoodsBrief tb = goods;
 
 		if (tb == null) {
 			out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧涓嶅瓨鍦�"));
@@ -335,26 +339,51 @@
 			tb.setImgList(new ArrayList<>());
 		}
 
-		tb.getImgList().add(0, tb.getPictUrl());
+		// tb.getImgList().add(0, tb.getPictUrl());
 
 		List<String> finalImgList = new ArrayList<>();
 		for (String img : tb.getImgList()) {
 			finalImgList.add(TbImgUtil.getTBSizeImg(img, 600));
 		}
+
+		if (finalImgList.size() == 0) {
+			finalImgList.add(tb.getPictUrl());
+		}
+
 		if (!StringUtil.isNullOrEmpty(tb.getPictUrlWhite()))
 			finalImgList.add(0, tb.getPictUrlWhite());
 
+		// 绉婚櫎鐩稿悓鍥剧墖
+		if (finalImgList.size() > 0)
+			for (int i = 0; i < finalImgList.size(); i++) {
+				if (i < finalImgList.size() - 1)
+					if (TbImgUtil.getTBSizeImg(finalImgList.get(i), 600)
+							.equalsIgnoreCase(TbImgUtil.getTBSizeImg(finalImgList.get(i + 1), 600))) {
+						finalImgList.remove(i--);
+					}
+			}
+
+		tb.setImgList(finalImgList);
+
 		// 澶ф窐瀹㈠晢鍝佽繃婊�
 		try {
-			goods = daTaoKeGoodsDetailService.filterTaoBaoGoods(goods);
+			goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods);
 		} catch (Exception e) {
 			LogHelper.errorDetailInfo(e);
 		}
 
-		BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
-		BigDecimal shareRate = hongBaoManageService.getShareRate();
-		ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE);
+		ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
+				acceptData.getVersion());
+
 		GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO);
+		if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) {
+			goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney());
+			goodsDetail.getMoneyInfo().setShareMoney(
+					"楼" + TaoBaoUtil.getGoodsHongBaoMoney(goods, hongBaoManageService.getVIPShareRate()));
+			goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo());
+		}
+		goodsDetail.getMoneyInfo()
+				.setRateInfoHelpUrl(configService.get(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey()));
 
 		if (TaoBaoUtil.isYUShou(goods)) {
 			if (!StringUtil.isNullOrEmpty(goods.getPresaleDiscountFeeText())) {
@@ -387,7 +416,7 @@
 		}
 
 		extraVO.setTbPidInfo(clientTBPid);
-		extraVO.setDetailUrl("http://apph5.yeshitv.com/apppage/goods_img.html?id=" + id);
+		extraVO.setDetailUrl("http://apph5.banliapp.com/apppage/goods_img.html?id=" + id);
 
 		// 鍒嗕韩璧氫汉鎻愮ず
 		MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo();
@@ -434,8 +463,7 @@
 		} catch (Exception e) {
 			extraVO.setH5Url(h5Url);
 		}
-		
-		String tips = null;
+
 		String helpLink = null;
 		boolean fanliValid = true;
 		boolean shareValid = true;
@@ -453,7 +481,7 @@
 			moneyType = 2;
 			fanliValid = true;
 			shareValid = false;
-			helpLink = configService.get("zigoulijian_nofanli_help");
+			helpLink = configService.get(ConfigKeyEnum.zigoulijianNofanliHelp.getKey());
 
 			BigDecimal tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE);
 
@@ -477,7 +505,8 @@
 					goodsDetail.setZkPrice(goodsDetail.getZkPrice().subtract(tljHongBao));
 			}
 		} else if (from != null && from.equals("taolijin_free_buy")) {
-			TLJFreeBuyGoods freeGoods = tljFreeBuyGoodsService.selectByAuctionIdAndDay(id, TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd"));
+			TLJFreeBuyGoods freeGoods = tljFreeBuyGoodsService.selectByAuctionIdAndDay(id,
+					TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd"));
 			if (freeGoods == null) {
 				out.print(JsonUtil.loadFalseResult(2, "鍏嶅崟鍟嗗搧宸蹭笅鏋�"));
 				return;
@@ -486,9 +515,9 @@
 			fanliValid = true;
 			shareValid = false;
 			BigDecimal couponPrice = goodsDetail.getCouponPrice();
-			if (couponPrice == null) 
+			if (couponPrice == null)
 				couponPrice = goodsDetail.getZkPrice();
-			
+
 			NewUserHongBao newUserHongBao = new NewUserHongBao();
 			newUserHongBao.setMoney(couponPrice.setScale(2).toString());
 			newUserHongBao.setName("鏂颁汉绾㈠寘 ");
@@ -499,47 +528,40 @@
 			OtherInfo otherInfo = new OtherInfo();
 			otherInfo.setReduceHongBao(newUserHongBao);
 			goodsDetail.setOtherInfo(otherInfo);
-			
-			tips = "浣犱笉鏄�滄柊鐢ㄦ埛鈥濇棤娉曚娇鐢ㄦ柊浜虹孩鍖�0鍏冭喘涔般��";
-			UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
-			if (userInfoExtra != null  && userInfoExtra.getFirstLoginTime() != null) {
-				try {
-					int	days = DateUtil.daysBetween2(userInfoExtra.getFirstLoginTime(), new Date());
-					if (days < Constant.TLJ_NEW_USER_DEFINE){
-						UserTaoLiJinNewbies winDetail = userTaoLiJinNewbiesService.selectByPrimaryKey(uid);
-						if (winDetail == null || winDetail.getEndTime().getTime() < java.lang.System.currentTimeMillis()
-								|| winDetail.getMoney().compareTo(couponPrice) < 0) {
-							tips = "鏂颁汉绾㈠寘涓嶈冻锛岃鎹釜鍟嗗搧鍐嶈瘯鎴栫户缁鍙栧埌瓒抽鏂颁汉绾㈠寘銆�";
-						} else {
-							tips = null;
-						}
-					}  
-				} catch (ParseException e) {
-					e.printStackTrace();
-				}
-			}
+
+			// 涓撳睘鏍囩
+			List<ClientTextStyleVO> labels = new ArrayList<ClientTextStyleVO>();
+			labels.add(new ClientTextStyleVO("鏂颁汉涓撳睘", "#FE0014"));
+			labels.add(new ClientTextStyleVO("瀹炰粯0鍏�", "#FF9600"));
+			goodsDetail.setLabels(labels);
+
 		} else {// 鏅�氳喘涔�
 			OtherInfo otherInfo = new OtherInfo();
 			RewardCouponVO rewardCoupon = new RewardCouponVO();
 			rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web"));
 			JSONObject params1 = new JSONObject();
-			params1.put("url", configService.get("special_guide_reward_coupon_link"));
-
-			rewardCoupon.setMaxMoney("楼" + TaoBaoUtil.getGoodsHongBaoMoney(goods, fanLiRate).add(MoneyBigDecimalUtil
-					.mul(TaoBaoUtil.getGoodsHongBaoMoney(goods, fanLiRate), Constant.MAX_REWARD_RATE)));
-			if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
+			if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion()))
+				params1.put("url", configService.get(ConfigKeyEnum.specialGuideRewardCouponLink.getKey()));
+			else
+				params1.put("url", userVipConfigService.getValueByKey("vip_link"));
+			rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney());
+			if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) {
 				rewardCoupon.setDesc("杩�");
-				params1.put("url", configService.get("vip_link"));
+				params1.put("url", userVipConfigService.getValueByKey("vip_link"));
 				rewardCoupon.getJumpDetail().setNeedLogin(true);
 			} else
 				rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑");
 			rewardCoupon.setParams(params1.toString());
+
 			otherInfo.setRewardCoupon(rewardCoupon);
+			if ("ios".equalsIgnoreCase(acceptData.getPlatform())
+					&& configService.iosOnLining(Integer.parseInt(acceptData.getVersion())))
+				otherInfo.setRewardCoupon(null);
+
 			goodsDetail.setOtherInfo(otherInfo);
 		}
 		extraVO.setFanliValid(fanliValid);
 		extraVO.setShareValid(shareValid);
-		extraVO.setTips(tips);
 
 		MoneyInfoVO goodsMoney = goodsDetail.getMoneyInfo();
 		if (goodsMoney != null) {
@@ -548,7 +570,7 @@
 
 		// 鍒嗕韩璺緞
 		if (StringUtil.isNullOrEmpty(helpLink)) {
-			helpLink = configService.get("no_rebate_help_link");
+			helpLink = configService.get(ConfigKeyEnum.noRebateHelpLink.getKey());
 		}
 
 		// 鍒嗕韩璺緞
@@ -613,10 +635,17 @@
 		// 淇濆瓨缂撳瓨
 		jdGoodsCacheUtil.saveGoodsInfo(jdGoods);
 
-		BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
-		BigDecimal shareRate = hongBaoManageService.getShareRate();
-		ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE);
+		ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
+				acceptData.getVersion());
 		GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, paramsDTO);
+		if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) {
+			goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney());
+			goodsDetail.getMoneyInfo()
+					.setShareMoney("楼" + JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getVIPShareRate()));
+			goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo());
+		}
+		goodsDetail.getMoneyInfo()
+				.setRateInfoHelpUrl(configService.get(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey()));
 
 		// 闄勫姞淇℃伅
 		OtherInfo otherInfo = new OtherInfo();
@@ -634,15 +663,15 @@
 				if (commissionShare != null && commissionShare.compareTo(threeClass.getSelfComm()) > 0) {
 					jdGoods.setCommissionPlus(threeClass.getSelfComm());
 					// plus杩斿埄
-					BigDecimal fanliMoneyPlus = JDUtil.getGoodsFanLiMoneyPlus(jdGoods, fanLiRate);
-					otherInfo.setFanliMoneyPlus("浜笢plus浼氬憳杩斅�" + fanliMoneyPlus);
+					BigDecimal fanliMoneyPlus = JDUtil.getGoodsFanLiMoneyPlus(jdGoods,
+							hongBaoManageService.getFanLiRate());
+					otherInfo.setFanliMoneyPlus("浜笢plus杩斅�" + fanliMoneyPlus);
 					// 浣跨敤濂栧姳鍒告渶楂樿繑
-					if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
+					if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) {
 						maxMoneyPlus = "锛堜含涓減lus杩斅�"
-								+ fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE))
-								+ "锛�";
+								+ JDUtil.getGoodsFanLiMoneyPlus(jdGoods, hongBaoManageService.getVIPFanLiRate()) + "锛�";
 					} else
-						maxMoneyPlus = "锛堜含涓減lus浼氬憳鏈�楂樿繑楼"
+						maxMoneyPlus = "锛堜含涓減lus鏈�楂樿繑楼"
 								+ fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE))
 								+ "锛�";
 				}
@@ -654,26 +683,34 @@
 		rewardCoupon.setMaxMoneyPlus(maxMoneyPlus);
 		rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web"));
 		JSONObject params1 = new JSONObject();
-		params1.put("url", configService.get("special_guide_reward_coupon_link"));
+		if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion()))
+			params1.put("url", configService.get(ConfigKeyEnum.specialGuideRewardCouponLink.getKey()));
+		else
+			params1.put("url", userVipConfigService.getValueByKey("vip_link"));
 
-		rewardCoupon.setMaxMoney("楼" + JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate)
-				.add(MoneyBigDecimalUtil.mul(JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate), Constant.MAX_REWARD_RATE)));
-		if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
+		rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney());
+		if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) {
 			rewardCoupon.setDesc("杩�");
-			params1.put("url", configService.get("vip_link"));
+			params1.put("url", userVipConfigService.getValueByKey("vip_link"));
 			rewardCoupon.getJumpDetail().setNeedLogin(true);
 		} else {
 			rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑");
 		}
 		rewardCoupon.setParams(params1.toString());
+		
 		otherInfo.setRewardCoupon(rewardCoupon);
+		if ("ios".equalsIgnoreCase(acceptData.getPlatform())
+				&& configService.iosOnLining(Integer.parseInt(acceptData.getVersion())))
+			otherInfo.setRewardCoupon(null);
+		
 		goodsDetail.setOtherInfo(otherInfo);
 
 		CouponInfoVO couponInfo = goodsDetail.getCouponInfo();
 		if (couponInfo != null) {
 			// 鍒搁摼鎺ュ鐞�
 			String materialId = "https://item.jd.com/" + id + ".html";
-			String url = JDApiUtil.convertLink(materialId, couponInfo.getLink(), JDApiUtil.POSITION_COUPON + "", null);
+			String url = JDApiUtil.convertLinkWithSubUnionId(materialId, couponInfo.getLink(),
+					JDApiUtil.POSITION_COUPON + "", null);
 			couponInfo.setLink(url);
 		}
 
@@ -697,7 +734,7 @@
 		List<ShamUser> listShareUser = new ArrayList<ShamUser>();
 
 		// 浜笢寮�鍚垎浜�
-		String open = configService.get("share_jd_open");
+		String open = configService.get(ConfigKeyEnum.shareOpenJD.getKey());
 		if ("1".equals(open.trim())) {
 			extraVO.setShareValid(true);
 			MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo();
@@ -750,7 +787,7 @@
 		extraVO.setFanliValid(true);
 
 		if (StringUtil.isNullOrEmpty(helpLink)) {
-			helpLink = configService.get("no_rebate_help_link");
+			helpLink = configService.get(ConfigKeyEnum.noRebateHelpLink.getKey());
 		}
 
 		ShareVO shareInfoVO = new ShareVO();
@@ -800,28 +837,40 @@
 			return;
 		}
 
-		BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
-		BigDecimal shareRate = hongBaoManageService.getShareRate();
-		ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE);
+		ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
+				acceptData.getVersion());
 		GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, paramsDTO);
+		if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) {
+			goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney());
+			goodsDetail.getMoneyInfo().setShareMoney(
+					"楼" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, hongBaoManageService.getVIPShareRate()));
+			goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo());
+		}
+		goodsDetail.getMoneyInfo()
+				.setRateInfoHelpUrl(configService.get(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey()));
 
 		// 闄勫姞淇℃伅
 		OtherInfo otherInfo = new OtherInfo();
 		RewardCouponVO rewardCoupon = new RewardCouponVO();
 		rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web"));
 		JSONObject params1 = new JSONObject();
-		params1.put("url", configService.get("special_guide_reward_coupon_link"));
+		if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion()))
+			params1.put("url", configService.get(ConfigKeyEnum.specialGuideRewardCouponLink.getKey()));
+		else
+			params1.put("url", userVipConfigService.getValueByKey("vip_link"));
 
-		rewardCoupon.setMaxMoney("楼" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate).add(MoneyBigDecimalUtil
-				.mul(PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate), Constant.MAX_REWARD_RATE)));
-		if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
+		rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney());
+		if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) {
 			rewardCoupon.setDesc("杩�");
-			params1.put("url", configService.get("vip_link"));
+			params1.put("url", userVipConfigService.getValueByKey("vip_link"));
 			rewardCoupon.getJumpDetail().setNeedLogin(true);
 		} else
 			rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑");
 		rewardCoupon.setParams(params1.toString());
 		otherInfo.setRewardCoupon(rewardCoupon);
+		if ("ios".equalsIgnoreCase(acceptData.getPlatform())
+				&& configService.iosOnLining(Integer.parseInt(acceptData.getVersion())))
+			otherInfo.setRewardCoupon(null);
 		goodsDetail.setOtherInfo(otherInfo);
 
 		CouponInfoVO couponInfo = goodsDetail.getCouponInfo();
@@ -849,7 +898,7 @@
 		}
 
 		// 鍥炬枃璇︽儏
-		extraVO.setDetailUrl("http://apph5.yeshitv.com/apppage/goods_img_pdd.html?id=" + id);
+		extraVO.setDetailUrl("http://apph5.banliapp.com/apppage/goods_img_pdd.html?id=" + id);
 
 		String salesTip = pddGoods.getSalesTip();
 		if (!StringUtil.isNullOrEmpty(salesTip)) {
@@ -909,7 +958,7 @@
 		extraVO.setShareValid(true);
 
 		if (StringUtil.isNullOrEmpty(helpLink)) {
-			helpLink = configService.get("no_rebate_help_link");
+			helpLink = configService.get(ConfigKeyEnum.noRebateHelpLink.getKey());
 		}
 
 		ShareVO shareInfoVO = new ShareVO();
@@ -965,9 +1014,8 @@
 					list = list.subList(0, 10);
 				}
 
-				BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
-				BigDecimal shareRate = hongBaoManageService.getShareRate();
-				ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE);
+				ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
+						acceptData.getVersion());
 				List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>();
 
 				for (JDGoods goods : list) {
@@ -1008,10 +1056,8 @@
 								goodsList = goodsList.subList(0, 10);
 							}
 
-							BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
-							BigDecimal shareRate = hongBaoManageService.getShareRate();
-							ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate,
-									Constant.MAX_REWARD_RATE);
+							ConfigParamsDTO paramsDTO = hongBaoManageService
+									.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion());
 							for (PDDGoodsDetail goods : goodsList) {
 								listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO));
 							}
@@ -1054,9 +1100,8 @@
 
 			if (goodsList != null && goodsList.size() > 0) {
 
-				BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
-				BigDecimal shareRate = hongBaoManageService.getShareRate();
-				ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE);
+				ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
+						acceptData.getVersion());
 
 				goodsList.parallelStream().forEach(goods -> {
 					if (goods != null) {
@@ -1148,9 +1193,11 @@
 			if (couponInfo != null) {
 				couponUrl = couponInfo.getLink();
 			}
-			jumpLink = JDApiUtil.convertLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", uid + "");
+			jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "",
+					uid + "");
 		} else {
-			jumpLink = JDApiUtil.convertLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", uid + "");
+			jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "",
+					uid + "");
 		}
 
 		JSONObject data = new JSONObject();
@@ -1176,7 +1223,7 @@
 		String jumpLink = null;
 		String materialId = "https://item.jd.com/" + id + ".html";
 
-		jumpLink = JDApiUtil.convertLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", null + "");
+		jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", null);
 
 		JSONObject data = new JSONObject();
 		data.put("native", true);
@@ -1285,4 +1332,93 @@
 		}
 		out.print(JsonUtil.loadTrueResult(data));
 	}
+
+	@RequestMapping(value = "listSimpleGoods", method = RequestMethod.POST)
+	public void listSimpleGoods(AcceptData acceptData, String goodsInfo, PrintWriter out) {
+		if (StringUtil.isNullOrEmpty(goodsInfo)) {
+			out.print(JsonUtil.loadFalseResult(1, "鍟嗗搧淇℃伅涓虹┖"));
+			return;
+		}
+
+		net.sf.json.JSONArray array = net.sf.json.JSONArray.fromObject(goodsInfo);
+
+		List<CommonGoods> commonGoodsList = new ArrayList<>();
+
+		for (int i = 0; i < array.size(); i++) {
+			JSONObject obj = array.optJSONObject(i);
+			CommonGoods cg = new CommonGoods();
+			cg.setGoodsId(obj.optLong("goodsId"));
+			cg.setGoodsType(obj.optInt("goodsType"));
+			commonGoodsList.add(cg);
+		}
+
+		if (commonGoodsList.size() > 9) {
+			out.print(JsonUtil.loadFalseResult(1, "鏈�澶氬悓鏃惰幏鍙�9鏉℃暟鎹�"));
+			return;
+		}
+
+		// 鍒嗙鍚勪釜骞冲彴鐨勫晢鍝佷俊鎭�
+		List<Long> tbGoodsList = new ArrayList<>();
+		List<Long> jdGoodsList = new ArrayList<>();
+		List<Long> pddGoodsList = new ArrayList<>();
+
+		List<String> keyList = new ArrayList<>();
+
+		for (CommonGoods cg : commonGoodsList) {
+			keyList.add(cg.getGoodsId() + "-" + cg.getGoodsType());
+			if (cg.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) {
+				tbGoodsList.add(cg.getGoodsId());
+			} else if (cg.getGoodsType() == Constant.SOURCE_TYPE_JD) {
+				jdGoodsList.add(cg.getGoodsId());
+			} else if (cg.getGoodsType() == Constant.SOURCE_TYPE_PDD) {
+				pddGoodsList.add(cg.getGoodsId());
+			}
+		}
+
+		Map<String, GoodsDetailVO> tempGoodsList = new HashMap<>();
+
+		ConfigParamsDTO params = new ConfigParamsDTO(hongBaoManageService.getFanLiRate(),
+				hongBaoManageService.getShareRate(), new BigDecimal(80), hongBaoManageService.getVIPFanLiRate());
+		hongBaoManageService.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion());
+
+		if (tbGoodsList.size() > 0) {
+			List<TaoBaoGoodsBrief> goodsList = null;
+			try {
+				goodsList = TaoKeApiUtil.getBatchGoodsInfo(tbGoodsList);
+			} catch (TaobaoGoodsDownException e) {
+				e.printStackTrace();
+			} catch (TaoKeApiException e) {
+				e.printStackTrace();
+			}
+			if (goodsList != null)
+				for (TaoBaoGoodsBrief goods : goodsList) {
+					goods.setTkRate(new BigDecimal(0));
+					tempGoodsList.put(goods.getAuctionId() + "-" + Constant.SOURCE_TYPE_TAOBAO,
+							GoodsDetailVOFactory.convertTaoBao(goods, params));
+				}
+		}
+		if (jdGoodsList.size() > 0) {
+			List<JDGoods> goodsList = JDApiUtil.getGoodsDetail(jdGoodsList);
+			for (JDGoods goods : goodsList) {
+				tempGoodsList.put(goods.getSkuId() + "-" + Constant.SOURCE_TYPE_JD,
+						GoodsDetailVOFactory.convertJDGoods(goods, params));
+			}
+		}
+		if (pddGoodsList.size() > 0) {
+			List<PDDGoodsDetail> goodsList = PinDuoDuoApiUtil.listGoodsDetail(pddGoodsList);
+			for (PDDGoodsDetail goods : goodsList) {
+				tempGoodsList.put(goods.getGoodsId() + "-" + Constant.SOURCE_TYPE_PDD,
+						GoodsDetailVOFactory.convertPDDGoods(goods, params));
+			}
+		}
+		List<GoodsDetailVO> voList = new ArrayList<>();
+		Gson gson = JsonUtil.getApiCommonGson();
+		for (String key : keyList) {
+			GoodsDetailVO vo = tempGoodsList.get(key);
+			if (vo != null) {
+				voList.add(vo);
+			}
+		}
+		out.print(JsonUtil.loadTrueResult(gson.toJson(voList)));
+	}
 }

--
Gitblit v1.8.0