From dbc8f0b2058d809e6dad0ada92d391109cbb4f57 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期五, 15 十一月 2019 15:05:53 +0800
Subject: [PATCH] Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
---
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java | 804 +++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 582 insertions(+), 222 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 be43293..89b75a2 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
@@ -3,10 +3,12 @@
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
+import org.json.simple.JSONArray;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -14,12 +16,20 @@
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.taobao.TbImgUtil;
+import com.yeshi.fanli.dto.ConfigParamsDTO;
+import com.yeshi.fanli.dto.jd.JDCategoryInfo;
+import com.yeshi.fanli.dto.jd.JDCouponInfo;
import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
+import com.yeshi.fanli.dto.pdd.PDDGoodsResult;
+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.user.ShamUser;
+import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserMoneyExtra;
import com.yeshi.fanli.entity.goods.CollectionGoodsV2;
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.SystemClientParams;
import com.yeshi.fanli.entity.taobao.ClientTBPid;
@@ -32,13 +42,16 @@
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsUpdateException;
import com.yeshi.fanli.log.LogHelper;
+import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
import com.yeshi.fanli.service.inter.config.BusinessSystemService;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service;
import com.yeshi.fanli.service.inter.goods.ScanHistoryV2Service;
import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
-import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
+import com.yeshi.fanli.service.inter.jd.JDGoodsClassService;
+import com.yeshi.fanli.service.inter.money.UserMoneyExtraService;
+import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
@@ -51,26 +64,35 @@
import com.yeshi.fanli.service.inter.user.TBPidService;
import com.yeshi.fanli.service.inter.user.UserGoodsStorageService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
-import com.yeshi.fanli.service.inter.user.UserMoneyExtraService;
+import com.yeshi.fanli.service.inter.user.UserInfoService;
+import com.yeshi.fanli.service.inter.user.integral.IntegralGetService;
import com.yeshi.fanli.util.Constant;
+import com.yeshi.fanli.util.MoneyBigDecimalUtil;
import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TaoBaoConstant;
import com.yeshi.fanli.util.ThreadUtil;
import com.yeshi.fanli.util.TimeUtil;
+import com.yeshi.fanli.util.cache.JDGoodsCacheUtil;
+import com.yeshi.fanli.util.cache.PinDuoDuoCacheUtil;
import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil;
import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
import com.yeshi.fanli.util.factory.goods.ShopInfoVOFactory;
import com.yeshi.fanli.util.jd.JDApiUtil;
+import com.yeshi.fanli.util.jd.JDUtil;
import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
+import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import com.yeshi.fanli.util.taobao.TaoLiJinUtil;
+import com.yeshi.fanli.vo.goods.CouponInfoVO;
import com.yeshi.fanli.vo.goods.GoodsDetailExtraVO;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
import com.yeshi.fanli.vo.goods.MoneyInfoVO;
import com.yeshi.fanli.vo.goods.OtherInfo;
-import com.yeshi.fanli.vo.goods.ShareInfoVO;
+import com.yeshi.fanli.vo.goods.RewardCouponVO;
+import com.yeshi.fanli.vo.goods.ShareVO;
+import com.yeshi.fanli.vo.goods.ShopInfoVO;
import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
import com.yeshi.fanli.vo.tlj.ReduceHongBao;
import com.yeshi.fanli.vo.tlj.SpreadHongBao;
@@ -146,56 +168,38 @@
@Resource
private TLJBuyGoodsService tljBuyGoodsService;
-
-
+
+ @Resource
+ private UserInfoService userInfoService;
+
+ @Resource
+ private JDGoodsCacheUtil jdGoodsCacheUtil;
+
+ @Resource
+ private PinDuoDuoCacheUtil pinDuoDuoCacheUtil;
+
+ @Resource
+ private IntegralGetService integralGetService;
+
+ @Resource
+ private JumpDetailV2Service jumpDetailV2Service;
+
+ @Resource
+ private JDGoodsClassService jdGoodsClassService;
+
/**
- * 鑾峰彇鍟嗗搧璇︽儏
+ * 娣樺疂鍟嗗搧璇︽儏
*
* @param acceptData
* @param id
- * @param source
* @param uid
* @param from
* @param out
*/
- @RequestMapping(value = "getDetail", method = RequestMethod.POST)
- public void getDetail(AcceptData acceptData, Long id, Integer goodsType, Long uid, String from, PrintWriter out) {
- if (id == null || goodsType == null) {
- out.print(JsonUtil.loadFalseResult(1, "鍟嗗搧id鍜屽晢鍝佸钩鍙颁笉鑳戒负绌�"));
- return;
- }
-
- // 娣樺疂鍟嗗搧
- if (Constant.SOURCE_TYPE_TAOBAO == goodsType) {
- getTaoBaoGoodsDetial(acceptData, id, uid, from, out);
- return;
- }
-
- // 浜笢鍟嗗搧
- if (Constant.SOURCE_TYPE_JD == goodsType) {
- getJDGoodsDetial(acceptData, id, uid, from, out);
- return;
- }
-
- // 鎷煎澶氬晢鍝�
- if (Constant.SOURCE_TYPE_PDD == goodsType) {
- getPDDGoodsDetial(acceptData, id, uid, from, out);
- return;
- }
- }
-
-
- /**
- * 娣樺疂鍟嗗搧璇︽儏
- * @param acceptData
- * @param id
- * @param uid
- * @param from
- * @param out
- */
- public void getTaoBaoGoodsDetial(AcceptData acceptData, Long id, Long uid, String from, PrintWriter out) {
+ @RequestMapping(value = "getDetailTB", method = RequestMethod.POST)
+ public void getDetialTB(AcceptData acceptData, Long id, Long uid, String from, PrintWriter out) {
if (id == null) {
- out.print(JsonUtil.loadFalseResult(1, "璇蜂笂浼爄d"));
+ out.print(JsonUtil.loadFalseResult(1, "鍟嗗搧id涓嶈兘涓虹┖"));
return;
}
@@ -262,7 +266,6 @@
taoBaoGoodsUpdateService.offlineTaoBaoGoods(id);
}
});
-
}
} else {
@@ -343,14 +346,23 @@
} catch (Exception e) {
LogHelper.errorDetailInfo(e);
}
-
-
+
BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
BigDecimal shareRate = hongBaoManageService.getShareRate();
- GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(tb, null, fanLiRate, shareRate);
-
+ ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE);
+ GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO);
+
+ if (TaoBaoUtil.isYUShou(goods)) {
+ if (!StringUtil.isNullOrEmpty(goods.getPresaleDiscountFeeText())) {
+ if (goodsDetail.getLabels() == null)
+ goodsDetail.setLabels(new ArrayList<>());
+ goodsDetail.getLabels().add(new ClientTextStyleVO(goods.getPresaleDiscountFeeText(), "#FF2B4E"));
+ }
+ }
+ // 鍦ㄦ爣棰樻坊鍔犱紭鎯犱俊鎭�
+
// 搴楅摵淇℃伅
- TaoBaoShop shop = taoBaoShopService.getTaoBaoShop(goods.getAuctionId(), goods.getSellerId());
+ TaoBaoShop shop = taoBaoShopService.getTaoBaoShop(id, goods.getSellerId());
if (shop != null) {
String shopLink = shop.getShopLink();
if (StringUtil.isNullOrEmpty(shopLink)) {
@@ -358,7 +370,7 @@
}
goodsDetail.setShopInfo(ShopInfoVOFactory.convertTaoBaoShop(shop));
}
-
+
// 鏈夊埜澶勭悊
if (goodsDetail.isHasCoupon()) {
if (!StringUtil.isNullOrEmpty(from)) {
@@ -369,22 +381,22 @@
}
}
}
-
+
extraVO.setTbPidInfo(clientTBPid);
extraVO.setDetailUrl("http://apph5.yeshitv.com/apppage/goods_img.html?id=" + id);
-
+
// 鍒嗕韩璧氫汉鎻愮ず
MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo();
List<ShamUser> listShareUser = new ArrayList<ShamUser>();
if (moneyInfo != null) {
String shareMoney = moneyInfo.getShareMoney();
if (goods.getBiz30day() >= 1000) {
- listShareUser = shamUserService.listRandShareUser(10, new BigDecimal(shareMoney.replaceAll("楼", "")), 1, 5);
+ listShareUser = shamUserService.listRandShareUser(10, new BigDecimal(shareMoney.replaceAll("楼", "")), 1,
+ 5);
}
}
extraVO.setListShareUser(listShareUser);
-
-
+
// 棰嗗埜浜哄垪琛�
List<ShamUser> listCouponUser = new ArrayList<ShamUser>();
if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && goods.getCouponAmount() != null
@@ -394,8 +406,7 @@
}
}
extraVO.setListCouponUser(listCouponUser);
-
-
+
if (uid != null) {
// 鏄惁鍔犲叆鏀惰棌
CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id,
@@ -405,17 +416,15 @@
extraVO.setStorage(userGoodsStorageService.isExistStorage(uid, id, Constant.SOURCE_TYPE_TAOBAO));
}
-
// 娴嬭瘯
SystemClientParams params = systemClientParamsService.getSystemClientParamsBySystemAndKey(system,
"goods_detail_jump_taobao");
if ("1".equalsIgnoreCase((params.getValue() + "").trim())) {
extraVO.setIsNative(true);
- }
+ }
- // 鍟嗗搧閾炬帴
- String h5Url = String.format("http://%s%s?id=%s&appType=flq", configService.getH5Host(),
- Constant.systemCommonConfig.getShareGoodsPagePath(), id + "");
+ String h5Url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(),
+ Constant.systemCommonConfig.getShareGoodsPagePath(), "", id + "");
try {
extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
} catch (Exception e) {
@@ -426,11 +435,11 @@
boolean fanliValid = true;
boolean shareValid = true;
int moneyType = 1;
-
+
// 鎺ㄥ箍绾㈠寘
if (from != null && from.equals("taolijin")) {
// 璁$畻鎺ㄥ箍绾㈠寘
- String warningRate = configTaoLiJinService.getValueByKey("warning_value");
+ String warningRate = configTaoLiJinService.getValueByKey("warning_value", new Date());
BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, goods);
// 鎺ㄥ箍绾㈠寘 涓嶈兘灏忎簬1
@@ -439,8 +448,8 @@
return;
}
- // 鏄惁涓烘柊鐢ㄦ埛
- boolean isNewUser = userInfoExtraService.isNewUser(uid);
+ // 鍙栨秷鏂扮敤鎴疯嚜璐�
+ boolean isNewUser = false;// userInfoExtraService.isNewUser(uid);
if (isNewUser) {
// 鍒ゅ畾涓鸿�佺敤鎴凤細 鏂颁汉鍙浣跨敤浜嗘柊浜虹孩鍖咃紝涔熷氨鏄偅1鍧楅挶锛岄偅涔堬紝浠栫湅鍒扮殑鍒嗕韩鐖嗘涓殑鍟嗗搧-灏卞彧鑳藉垎浜��
long countRecord = userTaoLiJinRecordService.countRecordByUid(uid);
@@ -451,12 +460,12 @@
SpreadHongBao spreadHongBao = new SpreadHongBao();
if (isNewUser) {
- spreadHongBao.setMoney("楼1");
+ spreadHongBao.setMoney("1");
} else {
moneyType = 2;
fanliValid = false;
- spreadHongBao.setMoney("楼" + spreadMoney.toString());
-
+ spreadHongBao.setMoney(spreadMoney.toString());
+
ClientTextStyleVO textStyleVO1 = new ClientTextStyleVO();
textStyleVO1.setContent("鍒嗕韩");
textStyleVO1.setColor("#666666");
@@ -477,12 +486,26 @@
listText.add(textStyleVO4);
extraVO.setTip(listText);
}
-
+
spreadHongBao.setName("鎺ㄥ箍绾㈠寘 ");
spreadHongBao.setTip("褰撴棩棰嗗彇锛屽綋鏃ュ唴浣跨敤锛岃繃鏈熷け鏁�");
OtherInfo otherInfo = new OtherInfo();
otherInfo.setSpreadHongBao(spreadHongBao);
goodsDetail.setOtherInfo(otherInfo);
+
+ // 1.6.5鍚庢敼涓虹鍒╀环
+ if (com.yeshi.fanli.util.VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) {
+ if (goodsDetail.getCouponPrice() != null
+ && goodsDetail.getCouponPrice().compareTo(new BigDecimal(0)) > 0)
+ goodsDetail.setCouponPrice(goodsDetail.getCouponPrice().subtract(spreadMoney));
+ else
+ goodsDetail.setZkPrice(goodsDetail.getZkPrice().subtract(spreadMoney));
+ }
+
+ goodsDetail.getMoneyInfo().setFanliMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods,
+ hongBaoManageService.getTLJShareRate(System.currentTimeMillis())));
+ goodsDetail.getMoneyInfo().setShareMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods,
+ hongBaoManageService.getTLJShareRate(System.currentTimeMillis())));
// 鐢ㄦ埛娣樼ぜ閲�
UserMoneyExtra userMoneyExtra = userMoneyExtraService.selectByPrimaryKey(uid);
@@ -491,7 +514,7 @@
} else {
extraVO.setUserTLJ(userMoneyExtra.getTlj().setScale(2).toString());
}
- helpLink = configTaoLiJinService.getValueByKey("share_goods_help_link");
+ helpLink = configTaoLiJinService.getValueByKey("share_goods_help_link", new Date());
} else if (from != null && from.equals("taolijin_buy")) {
// 鏌ヨ鍒嗕韩搴�
@@ -506,41 +529,58 @@
fanliValid = true;
shareValid = false;
helpLink = configService.get("zigoulijian_nofanli_help");
-
- String tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, new BigDecimal(70)).toString();
-
+
+ BigDecimal tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE);
+
ReduceHongBao reduceHongBao = new ReduceHongBao();
reduceHongBao.setLeft(buyGoods.getLeftHongBaoCount());
- reduceHongBao.setMoney(tljHongBao);
- reduceHongBao.setName("浠樻绔嬪噺 楼" + tljHongBao);
+ reduceHongBao.setMoney(tljHongBao.toString());
+ reduceHongBao.setName("浠樻绔嬪噺 ");
reduceHongBao.setTip("褰撴棩棰嗗彇锛屽綋鏃ュ唴浣跨敤锛岃繃鏈熷け鏁�");
reduceHongBao.setTotal(buyGoods.getTotalHongBaoCount());
-
-
+
OtherInfo otherInfo = new OtherInfo();
otherInfo.setReduceHongBao(reduceHongBao);
+ goodsDetail.setOtherInfo(otherInfo);
+
+ // 1.6.5鍚庢敼涓虹鍒╀环
+ if (com.yeshi.fanli.util.VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) {
+ if (goodsDetail.getCouponPrice() != null
+ && goodsDetail.getCouponPrice().compareTo(new BigDecimal(0)) > 0)
+ goodsDetail.setCouponPrice(goodsDetail.getCouponPrice().subtract(tljHongBao));
+ else
+ goodsDetail.setZkPrice(goodsDetail.getZkPrice().subtract(tljHongBao));
+ }
+ } 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.setParams(params1.toString());
+ rewardCoupon.setMaxMoney("楼" + TaoBaoUtil.getGoodsHongBaoMoney(goods, fanLiRate).add(MoneyBigDecimalUtil
+ .mul(TaoBaoUtil.getGoodsHongBaoMoney(goods, fanLiRate), Constant.MAX_REWARD_RATE)));
+ rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑");
+ otherInfo.setRewardCoupon(rewardCoupon);
goodsDetail.setOtherInfo(otherInfo);
}
extraVO.setFanliValid(fanliValid);
extraVO.setShareValid(shareValid);
-
+
MoneyInfoVO goodsMoney = goodsDetail.getMoneyInfo();
if (goodsMoney != null) {
goodsMoney.setMoneyType(moneyType);
}
-
-
+
// 鍒嗕韩璺緞
if (StringUtil.isNullOrEmpty(helpLink)) {
helpLink = configService.get("no_rebate_help_link");
}
-
+
// 鍒嗕韩璺緞
- String shareUrl = String.format("%s?id=" + id, Constant.systemCommonConfig.getAppShareInfoUrl());
- ShareInfoVO shareInfoVO = new ShareInfoVO();
- shareInfoVO.setUrl(shareUrl);
+ ShareVO shareInfoVO = new ShareVO();
shareInfoVO.setHelpLink(helpLink);
- extraVO.setShareInfo(shareInfoVO);
+ extraVO.setShare(shareInfoVO);
JSONObject object = new JSONObject();
object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO));
@@ -560,7 +600,6 @@
});
}
-
/**
* 浜笢鍟嗗搧璇︽儏
*
@@ -570,7 +609,8 @@
* @param from
* @param out
*/
- public void getJDGoodsDetial(AcceptData acceptData, Long id, Long uid, String from, PrintWriter out) {
+ @RequestMapping(value = "getDetailJD", method = RequestMethod.POST)
+ public void getDetialJD(AcceptData acceptData, Long id, Long uid, String from, PrintWriter out) {
// 绯荤粺楠岃瘉
BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
acceptData.getPackages());
@@ -579,21 +619,86 @@
return;
}
- JDGoods jdGoods = JDApiUtil.queryGoodsDetail(id);
+ JDGoods jdGoods = JDApiUtil.queryGoodsDetail(id); // 楂樼骇鎺ュ彛
if (jdGoods == null) {
- jdGoods = JDApiUtil.getGoodsDetail(id);
+ jdGoods = JDUtil.getGoodsDetail(id); // 鐖彇缃戦〉
+ // jdGoods = JDApiUtil.getGoodsDetail(id); // 鏅�氭帴鍙�
}
-
+
if (jdGoods == null) {
out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧涓嶅瓨鍦�"));
return;
}
+ List<String> imageList = jdGoods.getImageList();
+ if (imageList == null) {
+ imageList = new ArrayList<String>();
+ imageList.add(jdGoods.getPicUrl());
+ }
+
+ // 淇濆瓨缂撳瓨
+ jdGoodsCacheUtil.saveGoodsInfo(jdGoods);
+
BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
BigDecimal shareRate = hongBaoManageService.getShareRate();
- GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, null, fanLiRate, shareRate);
+ ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE);
+ GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, paramsDTO);
-
+ // 闄勫姞淇℃伅
+ OtherInfo otherInfo = new OtherInfo();
+
+ // 浜笢plus杩斿埄
+ String maxMoneyPlus = null;
+ JDCategoryInfo categoryInfo = jdGoods.getCategoryInfo();
+ if (categoryInfo != null && categoryInfo.getCid3() != null && jdGoods.getCommissionInfo() != null) {
+ Long cid3 = categoryInfo.getCid3();
+ JDGoodsClass threeClass = jdGoodsClassService.getThreeClassByCid(Integer.parseInt(cid3.toString()));
+ if (threeClass != null && threeClass.getSelfComm() != null
+ && threeClass.getSelfComm().compareTo(new BigDecimal(0)) > 0) {
+ BigDecimal commissionShare = jdGoods.getCommissionInfo().getCommissionShare();
+ // plus姣斾緥 灏忎簬姝e父姣斾緥
+ if (commissionShare != null && commissionShare.compareTo(threeClass.getSelfComm()) > 0) {
+ jdGoods.setCommissionPlus(threeClass.getSelfComm());
+ // plus杩斿埄
+ BigDecimal fanliMoneyPlus = JDUtil.getGoodsFanLiMoneyPlus(jdGoods, fanLiRate);
+ otherInfo.setFanliMoneyPlus("浜笢plus浼氬憳杩斅�" + fanliMoneyPlus);
+ // 浣跨敤濂栧姳鍒告渶楂樿繑
+ maxMoneyPlus = "锛堜含涓減lus浼氬憳鏈�楂樿繑楼"
+ + fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE))
+ + "锛�";
+ }
+ }
+ }
+
+ // 濂栧姳鍒歌繑鍒�
+ RewardCouponVO rewardCoupon = new RewardCouponVO();
+ rewardCoupon.setMaxMoneyPlus(maxMoneyPlus);
+ rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web"));
+ JSONObject params1 = new JSONObject();
+ params1.put("url", configService.get("special_guide_reward_coupon_link"));
+ rewardCoupon.setParams(params1.toString());
+ rewardCoupon.setMaxMoney("楼" + JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate)
+ .add(MoneyBigDecimalUtil.mul(JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate), Constant.MAX_REWARD_RATE)));
+ rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑");
+ otherInfo.setRewardCoupon(rewardCoupon);
+ 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);
+ couponInfo.setLink(url);
+ }
+
+ ShopInfoVO shopInfo = goodsDetail.getShopInfo();
+ if (shopInfo != null) {
+ if (shopInfo.getId() == null || shopInfo.getScoreGoods() == null || shopInfo.getScoreLogistics() == null
+ || shopInfo.getScoreSeller() == null) {
+ goodsDetail.setShopInfo(null);
+ }
+ }
+
GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO();
extraVO.setIsNative(false);
// IOS鏄惁姝e湪涓婄嚎
@@ -637,8 +742,8 @@
}
// 鍥炬枃璇︽儏
- extraVO.setDetailUrl("https://in.m.jd.com/product/jieshao/video/"+ id +".html");
-
+ extraVO.setDetailUrl("https://in.m.jd.com/product/jieshao/video/" + id + ".html");
+
// 娴嬭瘯
SystemClientParams params = systemClientParamsService.getSystemClientParamsBySystemAndKey(system,
"goods_detail_jump_taobao");
@@ -647,8 +752,8 @@
}
// 鍟嗗搧閾炬帴
- String h5Url = String.format("http://%s%s?id=%s&appType=flq&goodsType=%s", configService.getH5Host(),
- Constant.systemCommonConfig.getShareGoodsPagePath(), jdGoods.getSkuId() + "", Constant.SOURCE_TYPE_JD);
+ String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(),
+ Constant.systemCommonConfig.getShareGoodsPagePathJD(), "", id + "");
try {
extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
} catch (Exception e) {
@@ -662,13 +767,9 @@
helpLink = configService.get("no_rebate_help_link");
}
- // 鍒嗕韩璺緞
- String shareUrl = String.format("%s?id=" + jdGoods.getSkuId(),
- Constant.systemCommonConfig.getAppShareInfoUrl());
- ShareInfoVO shareInfoVO = new ShareInfoVO();
- shareInfoVO.setUrl(shareUrl);
+ ShareVO shareInfoVO = new ShareVO();
shareInfoVO.setHelpLink(helpLink);
- extraVO.setShareInfo(shareInfoVO);
+ extraVO.setShare(shareInfoVO);
JSONObject object = new JSONObject();
object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO));
@@ -689,7 +790,7 @@
}
/**
- * 浜笢鍟嗗搧璇︽儏
+ * 鎷煎澶氬晢鍝佽鎯�
*
* @param acceptData
* @param id
@@ -697,7 +798,8 @@
* @param from
* @param out
*/
- public void getPDDGoodsDetial(AcceptData acceptData, Long id, Long uid, String from, PrintWriter out) {
+ @RequestMapping(value = "getDetailPDD", method = RequestMethod.POST)
+ public void getDetialPDD(AcceptData acceptData, Long id, Long uid, String from, PrintWriter out) {
// 绯荤粺楠岃瘉
BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
acceptData.getPackages());
@@ -714,7 +816,37 @@
BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
BigDecimal shareRate = hongBaoManageService.getShareRate();
- GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, null, fanLiRate, shareRate);
+ ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE);
+ GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, paramsDTO);
+
+ // 闄勫姞淇℃伅
+ 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.setParams(params1.toString());
+ rewardCoupon.setMaxMoney("楼" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate).add(MoneyBigDecimalUtil
+ .mul(PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate), Constant.MAX_REWARD_RATE)));
+ rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑");
+ otherInfo.setRewardCoupon(rewardCoupon);
+ goodsDetail.setOtherInfo(otherInfo);
+
+ CouponInfoVO couponInfo = goodsDetail.getCouponInfo();
+ PDDPromotionUrl convertUrl = null;
+ if (couponInfo != null) {
+ convertUrl = PinDuoDuoApiUtil.convert(id, PinDuoDuoApiUtil.PID_COUPON + "", null);
+ if (convertUrl != null)
+ couponInfo.setLink(convertUrl.getUrl());
+ }
+
+ ShopInfoVO shopInfo = goodsDetail.getShopInfo();
+ if (shopInfo != null) {
+ if (shopInfo.getId() == null || shopInfo.getScoreGoods() == null || shopInfo.getScoreLogistics() == null
+ || shopInfo.getScoreSeller() == null) {
+ goodsDetail.setShopInfo(null);
+ }
+ }
GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO();
extraVO.setIsNative(false);
@@ -724,24 +856,41 @@
extraVO.setIosOnling(configService.iosOnLining(Integer.parseInt(version)));
}
-
- Long inOrderCount30Days = pddGoods.getSoldQuantity();
- List<ShamUser> listShareUser = new ArrayList<ShamUser>();
- MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo();
- if (moneyInfo != null) {
- String shareMoney = moneyInfo.getShareMoney().replaceAll("楼", "");
- if (Integer.parseInt(inOrderCount30Days.toString()) >= 50000) {
- listShareUser = shamUserService.listRandShareUser(10, new BigDecimal(shareMoney), 1, 5);
- }
- }
- extraVO.setListShareUser(listShareUser);
+ // 鍥炬枃璇︽儏
+ extraVO.setDetailUrl("http://apph5.yeshitv.com/apppage/goods_img_pdd.html?id=" + id);
- // 棰嗗埜浜哄垪琛�
- List<ShamUser> listCouponUser = new ArrayList<ShamUser>();
- if (goodsDetail.isHasCoupon() && Integer.parseInt(inOrderCount30Days.toString()) >= 50000) {
- listCouponUser = shamUserService.listRandCouponUser(5, 1, 300);
+ String salesTip = pddGoods.getSalesTip();
+ if (!StringUtil.isNullOrEmpty(salesTip)) {
+ int indexOf = salesTip.indexOf("+");
+ if (indexOf > 0) {
+ salesTip = salesTip.substring(0, indexOf);
+ }
+
+ int totalSales = 0;
+ if (salesTip.contains("涓�")) {
+ salesTip = salesTip.substring(0, salesTip.indexOf("涓�"));
+ totalSales = (int) (Float.parseFloat(salesTip) * 10000);
+ } else {
+ totalSales = Integer.parseInt(salesTip);
+ }
+
+ List<ShamUser> listShareUser = new ArrayList<ShamUser>();
+ MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo();
+ if (moneyInfo != null) {
+ String shareMoney = moneyInfo.getShareMoney().replaceAll("楼", "");
+ if (totalSales >= 50000) {
+ listShareUser = shamUserService.listRandShareUser(10, new BigDecimal(shareMoney), 1, 5);
+ }
+ }
+ extraVO.setListShareUser(listShareUser);
+
+ // 棰嗗埜浜哄垪琛�
+ List<ShamUser> listCouponUser = new ArrayList<ShamUser>();
+ if (goodsDetail.isHasCoupon() && totalSales >= 50000) {
+ listCouponUser = shamUserService.listRandCouponUser(5, 1, 300);
+ }
+ extraVO.setListCouponUser(listCouponUser);
}
- extraVO.setListCouponUser(listCouponUser);
if (uid != null) {
// 鏄惁鍔犲叆鏀惰棌
@@ -752,16 +901,11 @@
extraVO.setStorage(userGoodsStorageService.isExistStorage(uid, id, Constant.SOURCE_TYPE_PDD));
}
- // 娴嬭瘯
- SystemClientParams params = systemClientParamsService.getSystemClientParamsBySystemAndKey(system,
- "goods_detail_jump_taobao");
- if ("1".equalsIgnoreCase((params.getValue() + "").trim())) {
- extraVO.setIsNative(true);
- }
+ extraVO.setIsNative(true);
- // 鍟嗗搧閾炬帴
- String h5Url = String.format("http://%s%s?id=%s&appType=flq&goodsType=%s", configService.getH5Host(),
- Constant.systemCommonConfig.getShareGoodsPagePath(), id + "", Constant.SOURCE_TYPE_PDD);
+ // 鍒嗕韩璺緞
+ String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(),
+ Constant.systemCommonConfig.getShareGoodsPagePathPDD(), "", id + "");
try {
extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
} catch (Exception e) {
@@ -775,12 +919,15 @@
if (StringUtil.isNullOrEmpty(helpLink)) {
helpLink = configService.get("no_rebate_help_link");
}
- // 鍒嗕韩璺緞
- String shareUrl = String.format("%s?id=" + id, Constant.systemCommonConfig.getAppShareInfoUrl());
- ShareInfoVO shareInfoVO = new ShareInfoVO();
- shareInfoVO.setUrl(shareUrl);
+
+ ShareVO shareInfoVO = new ShareVO();
shareInfoVO.setHelpLink(helpLink);
- extraVO.setShareInfo(shareInfoVO);
+ extraVO.setShare(shareInfoVO);
+
+ if (convertUrl != null) {
+ extraVO.setCouponJumpLink(convertUrl.getUrl());
+ extraVO.setNativeCouponJumpLink(PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl()));
+ }
JSONObject object = new JSONObject();
object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO));
@@ -798,10 +945,9 @@
}
});
}
-
-
+
/**
- * 鍟嗗搧璇︽儏鎺ㄨ崘锛堢寽浣犲枩娆� + 鎺ㄨ崘锛�
+ * 鍟嗗搧璇︽儏鎺ㄨ崘锛堢寽浣犲枩娆� + 鎺ㄨ崘锛�
*
* @param acceptData
* @param id
@@ -812,98 +958,312 @@
if (goodsType == null) {
goodsType = Constant.SOURCE_TYPE_TAOBAO;
}
-
- // 浜笢
- if (goodsType == Constant.SOURCE_TYPE_JD) {
- JSONObject data = new JSONObject();
- data.put("listQuality", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>()));
- data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>()));
- out.print(JsonUtil.loadTrueResult(data));
- return;
- }
-
- // 鎷煎澶�
- if (goodsType == Constant.SOURCE_TYPE_PDD) {
- JSONObject data = new JSONObject();
- data.put("listQuality", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>()));
- data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>()));
- out.print(JsonUtil.loadTrueResult(data));
- return;
- }
-
-
- List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.getRelationGoodsRecommend(id, 10);
- // 鍒濆鍖�
- if (goodsList == null) {
- goodsList = new ArrayList<TaoBaoGoodsBrief>();
- }
-
-
- List<GoodsDetailVO> listExtra = new ArrayList<GoodsDetailVO>();
- TaoKeAppInfo app = new TaoKeAppInfo();
- app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY);
- app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
- app.setAdzoneId(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT.split("_")[3]);
- app.setPid(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT);
-
- List<Long> ids = new ArrayList<>();
- for (TaoBaoGoodsBrief goods : goodsList)
- ids.add(goods.getAuctionId());
try {
- goodsList = TaoKeApiUtil.getBatchGoodsInfo(ids);
- } catch (TaoKeApiException e1) {
- e1.printStackTrace();
- } catch (TaobaoGoodsDownException e1) {
- e1.printStackTrace();
- }
- if (goodsList != null && goodsList.size() > 0) {
-
- BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
- BigDecimal shareRate = hongBaoManageService.getShareRate();
-
- goodsList.parallelStream().forEach(goods -> {
- if (goods != null) {
- // 鑾峰彇璇︽儏
- TaoBaoGoodsBrief taoBaoGoodsBrief = null;
- try {
- taoBaoGoodsBrief = taoBaoGoodsCacheUtil.getCommonTaoBaoGoodsInfo(goods.getAuctionId());
- } catch (Exception e) {
- e.printStackTrace();
- }
+ // 浜笢
+ if (goodsType == Constant.SOURCE_TYPE_JD) {
+ JSONObject data = new JSONObject();
+ data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>()));
- if (taoBaoGoodsBrief == null) {
- TaoBaoGoodsBrief newGoods = TaoKeApiUtil.specialConvertCoupon(goods.getAuctionId(), app);
- goods.setCouponInfo(newGoods.getCouponInfo());
- goods.setCouponLink(newGoods.getCouponLink());
- goods.setTkRate(newGoods.getTkRate());
- taoBaoGoodsBrief = goods;
- }
+ List<JDGoods> list = JDUtil.getRecommendGoodsById(id);
+ if (list == null) {
+ list = new ArrayList<JDGoods>();
+ } else if (list.size() > 10) {
+ list = list.subList(0, 10);
+ }
- if (taoBaoGoodsBrief != null) {
- listExtra.add(GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate));
+ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
+ BigDecimal shareRate = hongBaoManageService.getShareRate();
+ ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE);
+ List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>();
+
+ for (JDGoods goods : list) {
+ listDetailVO.add(GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO));
+ }
+
+ // 鍙栧伓鏁颁釜鏁版嵁
+ if (listDetailVO.size() % 2 != 0) {
+ listDetailVO.remove(listDetailVO.size() - 1);
+ }
+
+ data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listDetailVO));
+ out.print(JsonUtil.loadTrueResult(data));
+ return;
+ }
+
+ // 鎷煎澶�
+ if (goodsType == Constant.SOURCE_TYPE_PDD) {
+ JSONObject data = new JSONObject();
+ data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>()));
+
+ List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>();
+
+ List<Long> goodsIdList = PinDuoDuoUtil.getRecommendGoodsId(id);
+ if (goodsIdList != null && goodsIdList.size() > 0) {
+ PDDSearchFilter pddfilter = new PDDSearchFilter();
+ pddfilter.setPage(1);
+ pddfilter.setPageSize(Constant.PAGE_SIZE);
+ Long[] strings = new Long[goodsIdList.size()];
+ pddfilter.setGoodsIdList(goodsIdList.toArray(strings));
+
+ PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter);
+ if (result != null) {
+ List<PDDGoodsDetail> goodsList = result.getGoodsList();
+ if (goodsList != null && goodsList.size() > 0) {
+
+ if (goodsList.size() > 10) {
+ goodsList = goodsList.subList(0, 10);
+ }
+
+ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
+ BigDecimal shareRate = hongBaoManageService.getShareRate();
+ ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE);
+ for (PDDGoodsDetail goods : goodsList) {
+ listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO));
+ }
+ }
}
}
- });
- }
-
-
- List<GoodsDetailVO> listQuality = new ArrayList<GoodsDetailVO>();
- // 鍙栧伓鏁颁釜鏁版嵁
- if (listExtra.size() % 2 != 0) {
- listExtra.remove(listExtra.size() - 1);
- }
- if (listQuality.size() % 2 != 0) {
- listQuality.remove(listQuality.size() - 1);
- }
+ // 鍙栧伓鏁颁釜鏁版嵁
+ if (listDetailVO.size() % 2 != 0) {
+ listDetailVO.remove(listDetailVO.size() - 1);
+ }
- JSONObject data = new JSONObject();
- data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listExtra));
- data.put("listGuess", JsonUtil.getApiCommonGson().toJson(listQuality));
- out.print(JsonUtil.loadTrueResult(data));
+ data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listDetailVO));
+ out.print(JsonUtil.loadTrueResult(data));
+ return;
+ }
+
+ List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.getRelationGoodsRecommend(id, 10);
+ // 鍒濆鍖�
+ if (goodsList == null) {
+ goodsList = new ArrayList<TaoBaoGoodsBrief>();
+ }
+
+ List<GoodsDetailVO> listExtra = new ArrayList<GoodsDetailVO>();
+ TaoKeAppInfo app = new TaoKeAppInfo();
+ app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY);
+ app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
+ app.setAdzoneId(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT.split("_")[3]);
+ app.setPid(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT);
+
+ List<Long> ids = new ArrayList<>();
+ for (TaoBaoGoodsBrief goods : goodsList)
+ ids.add(goods.getAuctionId());
+
+ try {
+ goodsList = TaoKeApiUtil.getBatchGoodsInfo(ids);
+ } catch (TaoKeApiException e1) {
+ } catch (TaobaoGoodsDownException e1) {
+ }
+
+ if (goodsList != null && goodsList.size() > 0) {
+
+ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
+ BigDecimal shareRate = hongBaoManageService.getShareRate();
+ ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE);
+
+ goodsList.parallelStream().forEach(goods -> {
+ if (goods != null) {
+ // 鑾峰彇璇︽儏
+ TaoBaoGoodsBrief taoBaoGoodsBrief = null;
+ try {
+ taoBaoGoodsBrief = taoBaoGoodsCacheUtil.getCommonTaoBaoGoodsInfo(goods.getAuctionId());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ if (taoBaoGoodsBrief == null) {
+ TaoBaoGoodsBrief newGoods = TaoKeApiUtil.specialConvertCoupon(goods.getAuctionId(), app);
+ goods.setCouponInfo(newGoods.getCouponInfo());
+ goods.setCouponLink(newGoods.getCouponLink());
+ goods.setTkRate(newGoods.getTkRate());
+ taoBaoGoodsBrief = goods;
+ }
+
+ if (taoBaoGoodsBrief != null) {
+ listExtra.add(
+ GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO));
+ }
+ }
+ });
+ }
+
+ List<GoodsDetailVO> listQuality = new ArrayList<GoodsDetailVO>();
+ // 鍙栧伓鏁颁釜鏁版嵁
+ if (listExtra.size() % 2 != 0) {
+ listExtra.remove(listExtra.size() - 1);
+ }
+
+ if (listQuality.size() % 2 != 0) {
+ listQuality.remove(listQuality.size() - 1);
+ }
+
+ JSONObject data = new JSONObject();
+ data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listExtra));
+ data.put("listGuess", JsonUtil.getApiCommonGson().toJson(listQuality));
+ out.print(JsonUtil.loadTrueResult(data));
+ } catch (Exception e) {
+ LogHelper.errorDetailInfo(e);
+ JSONObject data = new JSONObject();
+ data.put("listQuality", new JSONArray());
+ data.put("listGuess", new JSONArray());
+ out.print(JsonUtil.loadTrueResult(data));
+ }
}
+ /**
+ * 浜笢璐拱閾炬帴
+ *
+ * @param acceptData
+ * @param uid
+ * @param id
+ * @param source
+ * @param request
+ * @param out
+ */
+ @RequestMapping(value = "getJDLink")
+ public void getJDLink(AcceptData acceptData, Long uid, Long id, String source, PrintWriter out) {
+ if (uid == null || uid <= 0) {
+ out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛ID涓嶈兘涓虹┖"));
+ return;
+ }
+ if (id == null || id <= 0) {
+ out.print(JsonUtil.loadFalseResult(1, "鍟嗗搧ID涓嶈兘涓虹┖"));
+ return;
+ }
+
+ UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
+ if (user != null && user.getState() != UserInfo.STATE_NORMAL) {
+ out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC));
+ return;
+ }
+
+ JDGoods goods = jdGoodsCacheUtil.getGoodsInfo(id);
+ if (goods == null) {
+ out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧宸蹭笅鏋�"));
+ return;
+ }
+
+ String couponUrl = null;
+ String materialId = "https://item.jd.com/" + id + ".html";
+ JDCouponInfo couponInfo = goods.getCouponInfo();
+ if (couponInfo != null) {
+ couponUrl = couponInfo.getLink();
+ }
+ String jumpLink = JDApiUtil.convertLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", uid + "");
+
+ JSONObject data = new JSONObject();
+ data.put("native", true);
+ data.put("jumpLink", jumpLink);
+ out.print(JsonUtil.loadTrueResult(data));
+
+ // 鑾峰緱閲戝竵
+ integralGetService.addCouponRebate(uid);
+ }
+
+ /**
+ * 鎷煎澶氳喘涔伴摼鎺�
+ *
+ * @param acceptData
+ * @param uid
+ * @param id
+ * @param source
+ * @param request
+ * @param out
+ */
+ @RequestMapping(value = "getPDDLink")
+ public void getPDDLink(AcceptData acceptData, Long uid, Long id, String source, PrintWriter out) {
+ if (uid == null || uid <= 0) {
+ out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛ID涓嶈兘涓虹┖"));
+ return;
+ }
+
+ if (id == null || id <= 0) {
+ out.print(JsonUtil.loadFalseResult(1, "鍟嗗搧ID涓嶈兘涓虹┖"));
+ return;
+ }
+
+ UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
+ if (user != null && user.getState() != UserInfo.STATE_NORMAL) {
+ out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC));
+ return;
+ }
+
+ PDDGoodsDetail goods = pinDuoDuoCacheUtil.getGoodsInfo(id);
+ if (goods == null) {
+ out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧宸蹭笅鏋�"));
+ return;
+ }
+
+ PDDPromotionUrl convertUrl = PinDuoDuoApiUtil.convert(id, PinDuoDuoApiUtil.PID_FANLI + "", uid + "");
+ JSONObject data = new JSONObject();
+ data.put("native", true);
+ data.put("jumpLink", convertUrl.getUrl());
+ data.put("nativeJumpLink", PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl()));
+ out.print(JsonUtil.loadTrueResult(data));
+
+ // 鑾峰緱閲戝竵
+ integralGetService.addCouponRebate(uid);
+ }
+
+ /**
+ * 鏄惁鍦ㄥ弬涓庢帹骞�
+ *
+ * @param goodsId
+ * -鍟嗗搧ID
+ * @param goodsType
+ * -TB/JD
+ * @param out
+ */
+ @RequestMapping(value = "isGoodsExtend")
+ public void isGoodsExtend(AcceptData acceptData, String goodsId, Integer goodsType, PrintWriter out) {
+ if (StringUtil.isNullOrEmpty(goodsId)) {
+ out.print(JsonUtil.loadFalseResult(1, "鏈弬涓庢帹骞�"));
+ return;
+ }
+ if (goodsType == null) {
+ out.print(JsonUtil.loadFalseResult(2, "缂哄皯goodsType"));
+ return;
+ }
+ JSONObject data = new JSONObject();
+ if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
+ TaoBaoGoodsBrief goods = null;
+ try {
+ goods = TaoKeApiUtil.getSimpleGoodsInfo(Long.parseLong(goodsId));
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
+ } catch (TaobaoGoodsDownException e) {
+ e.printStackTrace();
+ }
+
+ if (goods == null) {
+ data.put("extend", false);
+ data.put("url", "https://h5.m.taobao.com/awp/core/detail.htm?id=" + goodsId);
+ } else {
+ data.put("extend", true);
+ }
+
+ } else if (goodsType == Constant.SOURCE_TYPE_JD) {
+ JDGoods goods = JDApiUtil.getGoodsDetail(Long.parseLong(goodsId));
+ if (goods == null) {
+ data.put("extend", false);
+ data.put("url", String.format("https://item.m.jd.com/product/%s.html", goodsId));
+ } else {
+ data.put("extend", true);
+ }
+ } else if (goodsType == Constant.SOURCE_TYPE_PDD) {
+ PDDGoodsDetail goods = PinDuoDuoApiUtil.getGoodsDetail(Long.parseLong(goodsId));
+ if (goods == null) {
+ data.put("extend", false);
+ data.put("url", String.format("https://mobile.yangkeduo.com/goods.html?goods_id=%s", goodsId));
+ } else {
+ data.put("extend", true);
+ }
+ }
+ out.print(JsonUtil.loadTrueResult(data));
+ }
}
--
Gitblit v1.8.0