admin
2022-09-16 70ebe043e6b62756be9e257fe954c747d46568b9
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) {
        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) {
                            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;
        //是否包含淘宝链接/口令
        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();