From 70ebe043e6b62756be9e257fe954c747d46568b9 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 16 九月 2022 19:00:59 +0800 Subject: [PATCH] 商品ID字符串化 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java | 57 ++++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 38 insertions(+), 19 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java index 9ab8bf7..d8b39ff 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java @@ -171,7 +171,7 @@ // 鍘婚櫎鍓嶅悗绌烘牸 text = text.trim(); String originalText = text; - if (acceptData.getSystem() == SystemEnum.yhqjx||acceptData.getSystem() == SystemEnum.hsb) { + if (acceptData.getSystem() == SystemEnum.yhqjx || acceptData.getSystem() == SystemEnum.hsb) { Integer sourceType = clipboardAnalysisManager.tejiaParseSourceType(text); JSONObject root = new JSONObject(); root.put("type", 2); @@ -188,7 +188,7 @@ @Override public void onResult(GoodsDocParseResultVO result) { - if (uid == null || (acceptData.getSystem() == SystemEnum.yhqjx||acceptData.getSystem() == SystemEnum.hsb)) { + if (uid == null || (acceptData.getSystem() == SystemEnum.yhqjx || acceptData.getSystem() == SystemEnum.hsb)) { out.print(JsonUtil.loadFalseResult("鏃犳帹鑽�")); return; } @@ -201,7 +201,7 @@ int platformCode = Constant.getPlatformCode(acceptData.getPlatform()); int version = Integer.parseInt(acceptData.getVersion()); JumpDetailContentVO convert = new JumpDetailContentVO(); - convert.setJumpDetail(jumpDetailV2Service.getByTypeCache("web", platformCode, version,acceptData.getSystem())); + convert.setJumpDetail(jumpDetailV2Service.getByTypeCache("web", platformCode, version, acceptData.getSystem())); JSONObject convertParams = new JSONObject(); convertParams.put("url", configService.getValue(ConfigKeyEnum.convertDocWebLink.getKey(), acceptData.getSystem())); convertParams.put("clipboard", false); @@ -223,17 +223,17 @@ if (result.getFirstGoods().getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) { view = new JumpDetailContentVO(); view.setJumpDetail( - jumpDetailV2Service.getByTypeCache("goodsdetail", platformCode, version,acceptData.getSystem())); + jumpDetailV2Service.getByTypeCache("goodsdetail", platformCode, version, acceptData.getSystem())); view.setParams(params); } else if (result.getFirstGoods().getGoodsType() == Constant.SOURCE_TYPE_JD) { view = new JumpDetailContentVO(); view.setJumpDetail( - jumpDetailV2Service.getByTypeCache("goodsdetail_jd", platformCode, version,acceptData.getSystem())); + jumpDetailV2Service.getByTypeCache("goodsdetail_jd", platformCode, version, acceptData.getSystem())); view.setParams(params); } else if (result.getFirstGoods().getGoodsType() == Constant.SOURCE_TYPE_PDD) { view = new JumpDetailContentVO(); view.setJumpDetail( - jumpDetailV2Service.getByTypeCache("goodsdetail_pdd", platformCode, version,acceptData.getSystem())); + jumpDetailV2Service.getByTypeCache("goodsdetail_pdd", platformCode, version, acceptData.getSystem())); view.setParams(params); } @@ -241,7 +241,7 @@ state = 2; data.put("stateDesc", "閫夋嫨鎼滃埜鎴栬浆閾�"); view = new JumpDetailContentVO(); - view.setJumpDetail(jumpDetailV2Service.getByTypeCache("web", platformCode, version,acceptData.getSystem())); + view.setJumpDetail(jumpDetailV2Service.getByTypeCache("web", platformCode, version, acceptData.getSystem())); JSONObject params = new JSONObject(); params.put("url", result.getFirstLink()); view.setParams(params); @@ -282,7 +282,7 @@ TaoBaoGoodsBrief goodsBrief = null; String specialId = userExtraTaoBaoInfoService.getSpecialIdByUid(uid); try { - goodsBrief = TaoKeApiUtil.searchGoodsDetail(goods.getGoodsId(), specialId, null); + goodsBrief = TaoKeApiUtil.searchGoodsDetail(StringUtil.isNullOrEmpty(goods.getGoodsSign())? goods.getGoodsId():goods.getGoodsSign(), specialId, null); } catch (TaobaoGoodsDownException e) { e.printStackTrace(); } @@ -301,7 +301,7 @@ acceptData.getPlatform(), acceptData.getVersion(), acceptData.getSystem())); - goodsDetailVO = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, goodsBrief, goodsDetailVO,false); + goodsDetailVO = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, goodsBrief, goodsDetailVO, false); data.put("goods", gson.toJson(goodsDetailVO)); @@ -422,6 +422,9 @@ switch (goods.getGoodsType()) { case Constant.SOURCE_TYPE_TAOBAO: type = "goodsdetail"; + if(!StringUtil.isNullOrEmpty(goods.getGoodsSign())) { + params.put("id", goods.getGoodsSign() + ""); + } break; case Constant.SOURCE_TYPE_JD: type = "goodsdetail_jd"; @@ -439,7 +442,7 @@ } RecommendJumpInfoVO left = new RecommendJumpInfoVO("鍘荤湅鐪�", jumpDetailV2Service.getByTypeCache(type, - Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()), params); + Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()), acceptData.getSystem()), params); data.put("left", gson.toJson(left)); // 鍘荤綉椤� @@ -453,7 +456,7 @@ params.put("url", rightValue); RecommendJumpInfoVO right = new RecommendJumpInfoVO("鏈夋洿楂樿繑鍒╋紵", jumpDetailV2Service.getByTypeCache("web", - Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()), + Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()), acceptData.getSystem()), params); data.put("right", gson.toJson(right)); } @@ -528,7 +531,7 @@ */ @RequestMapping(value = "searchGoods") public void searchGoods(AcceptData acceptData, Integer goodsType, String key, Integer page, String filter, - Integer order, Long uid, String notifyType, HttpSession session,HttpServletRequest request, PrintWriter out) { + Integer order, Long uid, String notifyType, HttpSession session, HttpServletRequest request, PrintWriter out) { if (goodsType == null || goodsType < 1 || goodsType > 5) { out.print(JsonUtil.loadFalseResult(1, "璇蜂紶閫掓纭钩鍙板弬鏁�")); @@ -727,7 +730,7 @@ */ private void searchTaoBaoGoods(AcceptData acceptData, Long uid, String key, Integer page, String filter, Integer order, AppPageNotification ap, PrintWriter out) { - Long goodsId = null; + String goodsId = null; //鏄惁鍖呭惈娣樺疂閾炬帴/鍙d护 if (page == 1) { List<String> linkList = HttpUtil.getUrlListFromText(key); @@ -741,7 +744,7 @@ e.printStackTrace(); } if (goodsId == null) { - Long id = DaTaoKeApiUtil.parseTaoBaoToken(key); + String id = DaTaoKeApiUtil.parseTaoBaoToken(key); if (id != null) { goodsId = id; } @@ -751,7 +754,7 @@ if (linkList != null && linkList.size() > 0) { String tempGoodsId = clipboardAnalysisManager.parseTBAuctionIdFromLink(linkList.get(0)); if (!StringUtil.isNullOrEmpty(tempGoodsId)) { - goodsId = Long.parseLong(tempGoodsId); + goodsId = tempGoodsId; } } } @@ -759,9 +762,14 @@ //鍟嗗搧ID涓虹┖锛屼笖鏄彛浠ょ殑褰㈠紡灏变互鏈姞鍏ユ窐瀹濊仈鐩熺殑鍟嗗搧澶勭悊 if (goodsId == null && (linkList != null && linkList.size() > 0) && TaoBaoUtil.isHaveNewVersionTaoBaoToken(key)) { - String[] ks = key.trim().split(" "); - if (ks.length > 1) - key = ks[1].trim(); + String title = TaoBaoUtil.getGoodsTitleFromTokenText(key); + if (StringUtil.isNullOrEmpty(title)) { + String[] ks = key.trim().split(" "); + if (ks.length > 1) + key = ks[1].trim(); + }else{ + key=title; + } } } @@ -878,7 +886,7 @@ GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion(), acceptData.getSystem()); - List<GoodsDetailVO> list = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, goodsBriefList, paramsDTO,false); + List<GoodsDetailVO> list = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, goodsBriefList, paramsDTO, false); Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) .excludeFieldsWithoutExposeAnnotation().create(); @@ -1177,6 +1185,17 @@ } } catch (PDDApiException e) { e.printStackTrace(); + if (e.getCode() == PDDApiException.CODE_NOT_AUTH) { + try { + PDDGoodsDetail pddGoodsDetail = PinDuoDuoApiUtil.getGoodsDetail(Long.parseLong(goodsId), PinDuoDuoApiUtil.PID_DEFAULT, Constant.PDD_SEARCH_CUSTOMER_PARAMS); + if (pddGoodsDetail != null) { + count = 1; + goodsList.add(pddGoodsDetail); + } + } catch (Exception e1) { + + } + } } } else { PDDSearchFilter pddfilter = new PDDSearchFilter(); -- Gitblit v1.8.0