From 3340ed122e19e3943ce4f93eb52103b623a3fc2c Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 27 四月 2022 15:43:58 +0800 Subject: [PATCH] 订单消息bug修改 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java | 330 ++++++++++++++++++++++++++++++------------------------ 1 files changed, 182 insertions(+), 148 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 2cc1748..9e566ec 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 @@ -5,23 +5,27 @@ import java.math.BigDecimal; import java.net.URLDecoder; import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import javax.annotation.Resource; import com.yeshi.fanli.entity.SystemEnum; import com.yeshi.fanli.entity.SystemFunction; +import com.yeshi.fanli.entity.SystemPIDInfo; import com.yeshi.fanli.exception.pdd.PDDApiException; +import com.yeshi.fanli.lijin.manager.GoodsLijinMnager; +import com.yeshi.fanli.lijin.manager.UserLijinMnager; import com.yeshi.fanli.service.inter.pdd.PDDAuthService; +import com.yeshi.fanli.service.inter.user.*; import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; +import com.yeshi.fanli.service.manger.PIDManager; import com.yeshi.fanli.util.*; +import com.yeshi.fanli.util.goods.GoodsJumpUtil; import com.yeshi.fanli.vo.common.WXXCXJumpInfoVO; import com.yeshi.fanli.vo.pdd.PDDConvertLinkResultVO; import com.yeshi.fanli.vo.goods.GoodsJumpLinkVO; import com.yeshi.fanli.vo.suning.SuningConvertLinkResult; +import com.yeshi.goods.facade.dto.taobao.TaoBaoGoodsImportantInfo; import org.json.simple.JSONArray; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -83,10 +87,6 @@ import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService; import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService; import com.yeshi.goods.facade.service.DaTaoKeGoodsDetailV2Service; -import com.yeshi.fanli.service.inter.user.ShamUserService; -import com.yeshi.fanli.service.inter.user.TBPidService; -import com.yeshi.fanli.service.inter.user.UserGoodsStorageService; -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; @@ -217,6 +217,18 @@ @Resource private PDDAuthService pddAuthService; + @Resource + private GoodsLijinMnager goodsLijinMnager; + + @Resource + private PIDManager pidManager; + + @Resource + private UserLijinMnager userLijinMnager; + + @Resource + private UserFunctionsLimitService userFunctionsLimitService; + private GoodsMoneyConfigParamsDTO getParamsDTO(String platform, String version, Long uid, SystemEnum system) { UserLevelEnum level = UserLevelEnum.daRen; if (uid != null && uid > 0) { @@ -232,7 +244,10 @@ return orderHongBaoMoneyComputeService.getShowComputeRate(platform, version, level, system); } - private TaoBaoGoodsBrief filterDaTaoKeGoodsInfo(TaoBaoGoodsBrief goods) { + private TaoBaoGoodsBrief filterDaTaoKeGoodsInfo(SystemEnum system, TaoBaoGoodsBrief goods) { + String specialPid = pidManager.getPidCache(system, Constant.SOURCE_TYPE_TAOBAO, SystemPIDInfo.PidType.fanli); + String relationPid = pidManager.getPidCache(system, Constant.SOURCE_TYPE_TAOBAO, SystemPIDInfo.PidType.fanliChannel); + try { DaTaoKeFilterResult result = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods); if (result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_COUPON @@ -240,9 +255,9 @@ // 缂撳瓨鍩虹閾炬帴 String dpid = null; if (TaoBaoUtil.isSpecialGoods(goods.getMaterialLibType())) { - dpid = TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT; + dpid = specialPid; } else { - dpid = TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID; + dpid = relationPid; } String link = taoBaoGoodsCacheUtil.getBaseConvertLink(goods.getAuctionId(), dpid); if (!StringUtil.isNullOrEmpty(link)) { @@ -397,6 +412,9 @@ TaoBaoGoodsBrief tb = goods; + //鍒涘缓鏃堕棿璁剧疆涓虹┖锛岄槻姝㈠墠绔敤long瑙f瀽 + tb.setCreatetime(null); + if (tb == null) { out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧涓嶅瓨鍦�")); @@ -411,7 +429,7 @@ if (uid != null && uid > 0) { String specialId = userExtraTaoBaoInfoService.getSpecialIdByUid(uid); //鑾峰彇鏈�鏂扮殑姣斾緥 - TaoBaoGoodsBrief rateGoods = TaoKeApiUtil.specialConvertCoupon(tb.getAuctionId(), TaoBaoConstant.getSpecialAuthAppInfo(), specialId, null); + TaoBaoGoodsBrief rateGoods = TaoKeApiUtil.specialConvertCoupon(tb.getAuctionId(), TaoBaoConstant.getSpecialAuthAppInfo(pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_TAOBAO, SystemPIDInfo.PidType.fanli)), specialId, null); if (rateGoods != null) tb.setMinTkRate(rateGoods.getTkRate()); } @@ -442,7 +460,7 @@ // 澶ф窐瀹㈠晢鍝佽繃婊� try { - goods = filterDaTaoKeGoodsInfo(goods); + goods = filterDaTaoKeGoodsInfo(acceptData.getSystem(), goods); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -612,7 +630,7 @@ } else {// 鏅�氳喘涔� OtherInfo otherInfo = new OtherInfo(); RewardCouponVO rewardCoupon = new RewardCouponVO(); - rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); + rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web",acceptData.getSystem())); JSONObject params1 = new JSONObject(); if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) params1.put("url", configService.getValue(ConfigKeyEnum.specialGuideRewardCouponLink.getKey(), acceptData.getSystem())); @@ -769,7 +787,7 @@ // 濂栧姳鍒歌繑鍒� RewardCouponVO rewardCoupon = new RewardCouponVO(); rewardCoupon.setMaxMoneyPlus(maxMoneyPlus); - rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); + rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web",acceptData.getSystem())); JSONObject params1 = new JSONObject(); if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) params1.put("url", configService.getValue(ConfigKeyEnum.specialGuideRewardCouponLink.getKey(), acceptData.getSystem())); @@ -798,7 +816,7 @@ // 鍒搁摼鎺ュ鐞� String materialId = "https://item.jd.com/" + id + ".html"; String url = JDApiUtil.convertLinkWithSubUnionId(materialId, couponInfo.getLink(), null, - JDApiUtil.POSITION_COUPON + "", null); + pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_JD, SystemPIDInfo.PidType.coupon), null); couponInfo.setLink(url); } @@ -930,14 +948,16 @@ return; } + String pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.fanli); + PDDGoodsDetail pddGoods = null; try { - pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id, PinDuoDuoApiUtil.PID_FANLI, pddAuthService.getFanliCustomParams(uid)); + pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id, pid, pddAuthService.getFanliCustomParams(uid)); } catch (PDDApiException e) { e.printStackTrace(); if (e.getCode() == PDDApiException.CODE_NOT_AUTH) { try { - pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id, PinDuoDuoApiUtil.PID_FANLI, Constant.PDD_SEARCH_CUSTOMER_PARAMS); + pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id, pid, Constant.PDD_SEARCH_CUSTOMER_PARAMS); } catch (PDDApiException e1) { } } @@ -964,7 +984,7 @@ // 闄勫姞淇℃伅 OtherInfo otherInfo = new OtherInfo(); RewardCouponVO rewardCoupon = new RewardCouponVO(); - rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); + rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web",acceptData.getSystem())); JSONObject params1 = new JSONObject(); if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) params1.put("url", configService.getValue(ConfigKeyEnum.specialGuideRewardCouponLink.getKey(), acceptData.getSystem())); @@ -988,7 +1008,7 @@ CouponInfoVO couponInfo = goodsDetail.getCouponInfo(); PDDConvertLinkResultVO convertUrl = null; if (couponInfo != null) { - convertUrl = PinDuoDuoApiUtil.convert(pddGoods.getGoodsSign(), PinDuoDuoApiUtil.PID_COUPON + "", null, false); + convertUrl = PinDuoDuoApiUtil.convert(pddGoods.getGoodsSign(), pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.coupon), null, false); if (convertUrl != null) couponInfo.setLink(convertUrl.getUrl()); } @@ -1171,7 +1191,7 @@ // 闄勫姞淇℃伅 OtherInfo otherInfo = new OtherInfo(); RewardCouponVO rewardCoupon = new RewardCouponVO(); - rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); + rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web",acceptData.getSystem())); JSONObject params1 = new JSONObject(); if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) params1.put("url", configService.getValue(ConfigKeyEnum.specialGuideRewardCouponLink.getKey(), acceptData.getSystem())); @@ -1311,7 +1331,7 @@ // 闄勫姞淇℃伅 OtherInfo otherInfo = new OtherInfo(); RewardCouponVO rewardCoupon = new RewardCouponVO(); - rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); + rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web",acceptData.getSystem())); JSONObject params1 = new JSONObject(); params1.put("url", userVipConfigService.getValueByKey("vip_link")); @@ -1482,7 +1502,7 @@ * @param out */ @RequestMapping(value = "getRecommendGoods", method = RequestMethod.POST) - public void getRecommendGoods(AcceptData acceptData, String id, Integer goodsType, PrintWriter out) { + public void getRecommendGoods(AcceptData acceptData, String id, Long uid, Integer goodsType, PrintWriter out) { if (goodsType == null) { goodsType = Constant.SOURCE_TYPE_TAOBAO; } @@ -1501,11 +1521,7 @@ } GoodsMoneyConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null, acceptData.getSystem()); - List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>(); - - for (JDGoods goods : list) { - listDetailVO.add(GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO)); - } + List<GoodsDetailVO> listDetailVO = goodsLijinMnager.loadOtherMoneyInfo(acceptData.getSystem(), uid, list, paramsDTO); //new ArrayList<GoodsDetailVO>(); // 鍙栧伓鏁颁釜鏁版嵁 if (listDetailVO.size() % 2 != 0) { @@ -1543,9 +1559,7 @@ GoodsMoneyConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null, acceptData.getSystem()); - for (PDDGoodsDetail goods : goodsList) { - listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO)); - } + listDetailVO = goodsLijinMnager.loadOtherMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO); } } } @@ -1589,11 +1603,7 @@ if (resultList != null && resultList.size() > 0) { GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion(), acceptData.getSystem()); - - for (SuningGoodsInfo goods : resultList) { - GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertSuningGoods(goods, paramsDTO); - listDetailVO.add(goodsDetailVO); - } + listDetailVO = goodsLijinMnager.loadOtherMoneyInfo(acceptData.getSystem(), uid, resultList, paramsDTO); } } @@ -1612,11 +1622,8 @@ List<GoodsDetailVO> listExtra = new ArrayList<GoodsDetailVO>(); GoodsMoneyConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null, acceptData.getSystem()); - goodsList.parallelStream().forEach(goods -> { - if (goods != null) { - listExtra.add(GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO)); - } - }); + + listExtra = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO,false); List<GoodsDetailVO> listQuality = new ArrayList<GoodsDetailVO>(); // 鍙栧伓鏁颁釜鏁版嵁 @@ -1659,26 +1666,29 @@ } String jumpLink = null; String materialId = "https://item.jd.com/" + id + ".html"; + String pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_JD, SystemPIDInfo.PidType.coupon); if (StringUtil.isNullOrEmpty(couponUrl)) { JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods.getCouponInfoList(), goods.getPrice()); if (couponInfo != null) { couponUrl = couponInfo.getLink(); } - jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_COUPON + "", + + + jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, pid, ""); if (jumpLink == null) { - jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, null, JDApiUtil.POSITION_COUPON + "", + jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, null, pid, ""); } } else { - jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_COUPON + "", + jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, pid, ""); if (StringUtil.isNullOrEmpty(jumpLink)) { jumpLink = couponUrl; } } - GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); + GoodsJumpLinkVO vo = GoodsJumpUtil.getJDJumpInfo(jumpLink); vo.set_native(true); vo.setJumpLink(jumpLink); vo.setNativeJumpLink(jumpLink); @@ -1719,6 +1729,11 @@ getJDLinkWithoutFanLi(acceptData, id, couponUrl, source, out); return; } + //鏈櫥褰曢鍒� + if (uid == null) { + getJDLinkWithoutFanLi(acceptData, id, couponUrl, source, out); + return; + } if (uid == null || uid <= 0) { out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛ID涓嶈兘涓虹┖")); @@ -1732,6 +1747,11 @@ return; } + if (userFunctionsLimitService.isLimit(uid, SystemFunction.fanli, new Date())) { + out.print(JsonUtil.loadFalseResult(1, "璇ュ姛鑳介檺鍒朵娇鐢�")); + return; + } + JDGoods goods = jdGoodsCacheUtil.getGoodsInfo(id); if (goods == null) { out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧宸蹭笅鏋�")); @@ -1740,41 +1760,33 @@ String jumpLink = null; String materialId = "https://item.jd.com/" + id + ".html"; + + String pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_JD, SystemPIDInfo.PidType.fanli); + if (StringUtil.isNullOrEmpty(couponUrl)) { JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods.getCouponInfoList(), goods.getPrice()); if (couponInfo != null) { couponUrl = couponInfo.getLink(); } - jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_FANLI + "", + jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, pid, uid + ""); if (jumpLink == null) { - jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, null, JDApiUtil.POSITION_FANLI + "", + jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, null, pid, uid + ""); } } else { - jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_FANLI + "", + jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, pid, uid + ""); if (StringUtil.isNullOrEmpty(jumpLink)) { jumpLink = couponUrl; } } - - GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); - vo.set_native(true); - vo.setJumpLink(jumpLink); - vo.setNativeJumpLink(jumpLink); - try { - String wxPage = "pages/union/proxy/proxy?spreadUrl=" + URLEncoder.encode(jumpLink, "UTF-8"); - WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO(); - wxxcxJumpInfoVO.setUserName("gh_45b306365c3d"); - wxxcxJumpInfoVO.setPath(wxPage); - vo.setWxxcxJumpInfo(wxxcxJumpInfoVO); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } + GoodsJumpLinkVO vo = GoodsJumpUtil.getJDJumpInfo(jumpLink); JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); data.put("native", vo.is_native()); + if (uid != null) + data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); out.print(JsonUtil.loadTrueResult(data)); // 鑾峰緱閲戝竵 @@ -1795,7 +1807,7 @@ String jumpLink = null; String materialId = "https://item.jd.com/" + id + ".html"; - jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_FANLI + "", null); + jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_JD, SystemPIDInfo.PidType.fanli), null); if (StringUtil.isNullOrEmpty(jumpLink)) { jumpLink = couponUrl; } @@ -1823,21 +1835,32 @@ return; } - String pid = PinDuoDuoApiUtil.PID_FANLI; + String pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.fanli); //鍙槸棰嗗埜 if (!SystemInfoUtil.hasFunctions(acceptData.getSystem(), SystemFunction.fanli)) { - pid = PinDuoDuoApiUtil.PID_COUPON; + pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.coupon); uid = null; } else { - if (uid == null || uid <= 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; + if (uid == null) { + pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.coupon); + uid = null; + } else { + if (uid == null || uid <= 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; + } + + if (userFunctionsLimitService.isLimit(uid, SystemFunction.fanli, new Date())) { + out.print(JsonUtil.loadFalseResult(1, "璇ュ姛鑳介檺鍒朵娇鐢�")); + return; + } } } @@ -1849,7 +1872,7 @@ return; } - String customParams = pddAuthService.getFanliCustomParams(uid); + String customParams = uid == null ? Constant.PDD_SEARCH_CUSTOMER_PARAMS : pddAuthService.getFanliCustomParams(uid); boolean auth = PinDuoDuoApiUtil.isAuth(pid, customParams); JSONObject data = new JSONObject(); PDDConvertLinkResultVO convertUrl = null; @@ -1860,18 +1883,11 @@ LogHelper.test(String.format("鎷煎澶氳浆閾�:uid:%s data:%s", uid + "", data.toString())); } - GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); - vo.set_native(true); - vo.setNativeJumpLink(PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl())); - vo.setJumpLink(convertUrl.getUrl()); - if (convertUrl.getWe_app_info() != null) { - WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO(); - wxxcxJumpInfoVO.setPath(convertUrl.getWe_app_info().getPage_path()); - wxxcxJumpInfoVO.setUserName(convertUrl.getWe_app_info().getUser_name()); - vo.setWxxcxJumpInfo(wxxcxJumpInfoVO); - } + GoodsJumpLinkVO vo = GoodsJumpUtil.getPDDJumpInfo(convertUrl); data = JSONObject.fromObject(new Gson().toJson(vo)); data.put("native", vo.is_native()); + if (uid != null) + data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); out.print(JsonUtil.loadTrueResult(data)); // 鑾峰緱閲戝竵 @@ -1899,18 +1915,28 @@ if (!SystemInfoUtil.hasFunctions(acceptData.getSystem(), SystemFunction.fanli)) { tag = VipShopUtil.getCouponChanTag(); } else { - if (uid == null || uid <= 0) { - out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛ID涓嶈兘涓虹┖")); - return; - } + //鍙槸棰嗗埜 + if (uid == null) { + tag = VipShopUtil.getCouponChanTag(); + } else { + if (uid == null || uid <= 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; - } + 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; + } - tag = VipShopUtil.getBuyChanTag(uid); + if (userFunctionsLimitService.isLimit(uid, SystemFunction.fanli, new Date())) { + out.print(JsonUtil.loadFalseResult(1, "璇ュ姛鑳介檺鍒朵娇鐢�")); + return; + } + + tag = VipShopUtil.getBuyChanTag(uid); + } } VIPGoodsInfo goods = VipShopApiUtil.getGoodsDetail(id + ""); @@ -1920,20 +1946,12 @@ } VIPConvertResultDTO convertUrl = VipShopApiUtil.convertLink(id + "", tag); - - GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); - vo.set_native(true); - vo.setJumpLink(convertUrl.getUrl()); - vo.setNativeJumpLink(convertUrl.getDeeplinkUrl()); - if (!StringUtil.isNullOrEmpty(convertUrl.getVipWxUrl())) { - WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO(); - wxxcxJumpInfoVO.setUserName("gh_8ed2afad9972"); - wxxcxJumpInfoVO.setPath(convertUrl.getVipWxUrl()); - vo.setWxxcxJumpInfo(wxxcxJumpInfoVO); - } + GoodsJumpLinkVO vo = GoodsJumpUtil.getVIPShopJumpInfo(convertUrl); JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); data.put("native", vo.is_native()); + if (uid != null) + data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); out.print(JsonUtil.loadTrueResult(data)); // 鑾峰緱閲戝竵 integralGetService.addCouponRebate(uid); @@ -1946,19 +1964,29 @@ return; } - String pid = SuningApiUtil.PID_BUY; + String pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_SUNING, SystemPIDInfo.PidType.fanli); if (!SystemInfoUtil.hasFunctions(acceptData.getSystem(), SystemFunction.fanli)) { - pid = SuningApiUtil.PID_COUPON; + pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_SUNING, SystemPIDInfo.PidType.coupon); uid = null; } else { - if (uid == null || uid <= 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; + if (uid == null) { + pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_SUNING, SystemPIDInfo.PidType.coupon); + uid = null; + } else { + if (uid == null || uid <= 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; + } + + if (userFunctionsLimitService.isLimit(uid, SystemFunction.fanli, new Date())) { + out.print(JsonUtil.loadFalseResult(1, "璇ュ姛鑳介檺鍒朵娇鐢�")); + return; + } } } @@ -1979,26 +2007,12 @@ SuningConvertLinkResult link = SuningApiUtil.convertLinkNew(goodsCode, supplierCode, pid, uid + ""); - GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); - vo.set_native(false); - try { - vo.setJumpLink(URLDecoder.decode(link.getWapExtendUrl(), "UTF-8")); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - if (!StringUtil.isNullOrEmpty(link.getSpPageUrl())) { - WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO(); - wxxcxJumpInfoVO.setUserName("gh_1d1e15e90afc"); - try { - wxxcxJumpInfoVO.setPath(URLDecoder.decode(link.getSpPageUrl(), "UTF-8")); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - vo.setWxxcxJumpInfo(wxxcxJumpInfoVO); - } + GoodsJumpLinkVO vo = GoodsJumpUtil.getSuningJumpInfo(link); JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); data.put("native", vo.is_native()); + if (uid != null) + data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); out.print(JsonUtil.loadTrueResult(data)); @@ -2184,27 +2198,47 @@ return; } - link = JDApiUtil.convertLinkWithSubUnionId(link, null, null, JDApiUtil.POSITION_FANLI + "", uid + ""); + link = JDApiUtil.convertLinkWithSubUnionId(link, null, null, pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_JD, SystemPIDInfo.PidType.fanli), uid + ""); - GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); - vo.set_native(true); - vo.setJumpLink(link); - vo.setNativeJumpLink(link); - try { - String wxPage = "pages/union/proxy/proxy?spreadUrl=" + URLEncoder.encode(link, "UTF-8"); - WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO(); - wxxcxJumpInfoVO.setUserName("gh_45b306365c3d"); - wxxcxJumpInfoVO.setPath(wxPage); - vo.setWxxcxJumpInfo(wxxcxJumpInfoVO); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - - + GoodsJumpLinkVO vo = GoodsJumpUtil.getJDJumpInfo(link); JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); data.put("native", vo.is_native()); JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); } + @RequestMapping(value = "convertPDDLink") + public void convertPDDLink(AcceptData acceptData, String resourceType, String channelType, Long uid, PrintWriter out) { + if (StringUtil.isNullOrEmpty(resourceType)&&StringUtil.isNullOrEmpty(channelType)) { + out.print(JsonUtil.loadFalseResult(1, "resourceType|channelType涓虹┖")); + return; + } + String customParams = null; + if (uid != null) + customParams = pddAuthService.getFanliCustomParams(uid); + String pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.fanli); + PDDConvertLinkResultVO pddConvertLinkResultVO = null; + if (!StringUtil.isNullOrEmpty(resourceType)) { + pddConvertLinkResultVO = PinDuoDuoApiUtil.convertActivity(resourceType, null, pid, customParams); + } else if (!StringUtil.isNullOrEmpty(channelType)) { + pddConvertLinkResultVO = PinDuoDuoApiUtil.convertChannel(channelType, pid, customParams); + } + + + GoodsJumpLinkVO vo = GoodsJumpUtil.getPDDJumpInfo(pddConvertLinkResultVO); + JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); + data.put("native", vo.is_native()); + out.print(JsonUtil.loadTrueResult(data)); + } + + @RequestMapping(value = "getTaoBaoGoodsDetailImgs") + public void getTaoBaoGoodsDetailImgs(AcceptData acceptData, Long id, PrintWriter out) { + TaoBaoGoodsImportantInfo info = DaTaoKeApiUtil.getGoodsImportantInfo(id); + if (info == null || info.getDetailImages() == null) { + out.print(JsonUtil.loadFalseResult("")); + return; + } + out.print(JsonUtil.loadTrueResult(new Gson().toJson(info.getDetailImages()))); + } + } -- Gitblit v1.8.0