From 1e9d66afda722a8ace7c5a21c9c0bfa0f14989c4 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 24 九月 2021 15:23:27 +0800 Subject: [PATCH] 热门搜索采用大淘客的搜索排行 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java | 167 ++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 122 insertions(+), 45 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 29e9db9..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,10 +5,7 @@ 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; @@ -19,6 +16,7 @@ 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.*; @@ -27,6 +25,7 @@ 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; @@ -88,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; @@ -230,6 +225,9 @@ @Resource private UserLijinMnager userLijinMnager; + + @Resource + private UserFunctionsLimitService userFunctionsLimitService; private GoodsMoneyConfigParamsDTO getParamsDTO(String platform, String version, Long uid, SystemEnum system) { UserLevelEnum level = UserLevelEnum.daRen; @@ -632,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())); @@ -789,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())); @@ -986,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())); @@ -1193,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())); @@ -1333,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")); @@ -1625,7 +1623,7 @@ List<GoodsDetailVO> listExtra = new ArrayList<GoodsDetailVO>(); GoodsMoneyConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null, acceptData.getSystem()); - listExtra = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO); + listExtra = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO,false); List<GoodsDetailVO> listQuality = new ArrayList<GoodsDetailVO>(); // 鍙栧伓鏁颁釜鏁版嵁 @@ -1731,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涓嶈兘涓虹┖")); @@ -1741,6 +1744,11 @@ 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; } @@ -1777,7 +1785,8 @@ GoodsJumpLinkVO vo = GoodsJumpUtil.getJDJumpInfo(jumpLink); JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); data.put("native", vo.is_native()); - data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); + if (uid != null) + data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); out.print(JsonUtil.loadTrueResult(data)); // 鑾峰緱閲戝竵 @@ -1832,15 +1841,26 @@ 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; + } } } @@ -1852,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; @@ -1866,7 +1886,8 @@ GoodsJumpLinkVO vo = GoodsJumpUtil.getPDDJumpInfo(convertUrl); data = JSONObject.fromObject(new Gson().toJson(vo)); data.put("native", vo.is_native()); - data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); + if (uid != null) + data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); out.print(JsonUtil.loadTrueResult(data)); // 鑾峰緱閲戝竵 @@ -1894,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 + ""); @@ -1919,7 +1950,8 @@ JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); data.put("native", vo.is_native()); - data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); + if (uid != null) + data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); out.print(JsonUtil.loadTrueResult(data)); // 鑾峰緱閲戝竵 integralGetService.addCouponRebate(uid); @@ -1937,14 +1969,24 @@ 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; + } } } @@ -1969,7 +2011,8 @@ JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); data.put("native", vo.is_native()); - data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); + if (uid != null) + data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); out.print(JsonUtil.loadTrueResult(data)); @@ -2164,4 +2207,38 @@ 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