From ac1e3863197a4a72784cd02335cb9b1f89026369 Mon Sep 17 00:00:00 2001 From: admin <2780501319@qq.com> Date: 星期一, 21 十月 2019 00:42:15 +0800 Subject: [PATCH] 双11红包修改 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java | 69 ++++++++++++++++++---------------- 1 files changed, 37 insertions(+), 32 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 92d82bd..3f24588 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 @@ -182,6 +182,8 @@ if (analysisTaoToken(acceptData, text, out)) { return; } + if (!StringUtil.isNullOrEmpty(TaoBaoUtil.parseSystemTaoToken(text))) + return; JSONObject root = new JSONObject(); root.put("type", 2); @@ -238,17 +240,16 @@ return; } else { tb = TaoBaoUtil.parsePhoneShareUrlByTB(text); - + if (tb == null) { String goodsId = TaoBaoUtil.getGoodsIdByPhoneShareUrl(text); if (!StringUtil.isNullOrEmpty(goodsId)) { tb = TaoBaoUtil.getTmallGoodsInfo(goodsId); - if (tb != null) + if (tb != null) type = 4; } } - - + if (tb == null)// 娣樺疂鏄┖鍊� { String jdId = JDUtil.getJDGoodsId(text); @@ -256,7 +257,7 @@ JDGoods goods = JDApiUtil.getGoodsDetail(Long.parseLong(jdId)); if (goods != null) { // 楂樼骇鎺ュ彛 -- 淇℃伅鏇村畬鏁� - JDGoods jdGoods = JDApiUtil.queryGoodsDetail(Long.parseLong(jdId)); + JDGoods jdGoods = JDApiUtil.queryGoodsDetail(Long.parseLong(jdId)); if (jdGoods != null) { commonGoods = CommonGoodsFactory.create(jdGoods); } else { @@ -280,7 +281,7 @@ } else { type = 4; goods = PinDuoDuoUtil.getPDDGoodsInfo(pddId); - if(goods != null) { + if (goods != null) { commonGoods = new CommonGoods(); commonGoods.setTitle(goods.getGoodsName()); commonGoods.setPicture(goods.getGoodsThumbnailUrl()); @@ -290,42 +291,42 @@ } } } - + if (tb == null && commonGoods == null) { out.println(JsonUtil.loadFalseResult("鏆傛湭鎵惧埌璇ュ晢鍝侊紝璇风◢鍚庡啀璇曪紒")); return; } - + if (type == 4) { if (!VersionUtil.greaterThan_2_0_1(acceptData.getPlatform(), acceptData.getVersion())) { out.println(JsonUtil.loadFalseResult("鏆傛湭鎵惧埌璇ュ晢鍝侊紝璇风◢鍚庡啀璇曪紒")); return; - } - + } + JSONObject data = new JSONObject(); if (tb != null) { commonGoods = new CommonGoods(); commonGoods.setTitle(tb.getTitle()); commonGoods.setPicture(tb.getPictUrl()); } - - if (StringUtil.isNullOrEmpty(commonGoods.getTitle()) || StringUtil.isNullOrEmpty(commonGoods.getPicture())) { + + if (StringUtil.isNullOrEmpty(commonGoods.getTitle()) + || StringUtil.isNullOrEmpty(commonGoods.getPicture())) { out.println(JsonUtil.loadFalseResult("鏆傛湭鎵惧埌璇ュ晢鍝侊紝璇风◢鍚庡啀璇曪紒")); return; } - + JSONObject goodsJSON = new JSONObject(); goodsJSON.put("title", commonGoods.getTitle()); goodsJSON.put("pictUrl", commonGoods.getPicture()); - + data.put("type", type); data.put("desc", "璇ュ晢鍝佹棤鎺ㄥ箍淇℃伅"); data.put("goods", goodsJSON); out.print(JsonUtil.loadTrueResult(data)); return; - } - - + } + JSONObject data = new JSONObject(); if (VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) { if (tb != null) { @@ -341,7 +342,7 @@ } commonGoods = CommonGoodsFactory.create(goodsBrief); } - + BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) @@ -383,9 +384,10 @@ root.put("data", data); out.print(JsonUtil.loadTrueResult(root)); } - + /** * 瑙f瀽鎶栭煶閾炬帴 + * * @param acceptData * @param text * @param out @@ -405,7 +407,7 @@ JSONObject goodsJSON = new JSONObject(); goodsJSON.put("title", goods.getName()); goodsJSON.put("pictUrl", goods.getImg()); - + JSONObject data = new JSONObject(); data.put("type", 4); data.put("desc", "璇ュ晢鍝佹棤鎺ㄥ箍淇℃伅"); @@ -418,10 +420,9 @@ return; } - - /** * 瑙f瀽娣樺彛浠� + * * @param acceptData * @param text * @param out @@ -447,25 +448,25 @@ } catch (TaobaoGoodsDownException e) { e.printStackTrace(); } - + if (goodsBrief == null) { out.println(JsonUtil.loadFalseResult("鏆傛湭鎵惧埌璇ュ晢鍝侊紝璇风◢鍚庡啀璇曪紒")); return false; } - + BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); - + JSONObject data = new JSONObject(); data.put("type", 3); - data.put("goods", gson.toJson(GoodsDetailVOFactory.convertTaoBao(goodsBrief, null, fanLiRate, shareRate))); + data.put("goods", gson + .toJson(GoodsDetailVOFactory.convertTaoBao(goodsBrief, null, fanLiRate, shareRate))); out.print(JsonUtil.loadTrueResult(data)); return true; } - - + JSONObject data = new JSONObject(); JSONObject taoBaoGoodsJSON = new JSONObject(); taoBaoGoodsJSON.put("title", tb.getTitle()); @@ -649,7 +650,8 @@ * @param endprice * @return */ - private void searchTaoBaoGoods(AcceptData acceptData, String key, Integer page, String filter, Integer order, PrintWriter out) { + private void searchTaoBaoGoods(AcceptData acceptData, String key, Integer page, String filter, Integer order, + PrintWriter out) { SearchFilter sf = new SearchFilter(); sf.setKey(SearchFilterUtil.filterSearchContent(key)); sf.setPage(page); @@ -750,7 +752,8 @@ String platform = acceptData.getPlatform(); TaoBaoShopVO taoBaoShop = listShop.get(0); if (("ios".equalsIgnoreCase(platform) && VersionUtil.greaterThan_2_0(platform, acceptData.getVersion())) - || ("android".equalsIgnoreCase(platform) && VersionUtil.greaterThan_2_0_1(platform, acceptData.getVersion()))) { + || ("android".equalsIgnoreCase(platform) + && VersionUtil.greaterThan_2_0_1(platform, acceptData.getVersion()))) { BrandInfoVO brandInfoVO = new BrandInfoVO(); brandInfoVO.setId(taoBaoShop.getId()); brandInfoVO.setName(taoBaoShop.getShopName()); @@ -776,7 +779,8 @@ * @param endprice * @return */ - private void searchJDGoods(AcceptData acceptData, String key, Integer page, String filter, Integer order, PrintWriter out) { + private void searchJDGoods(AcceptData acceptData, String key, Integer page, String filter, Integer order, + PrintWriter out) { JDSearchResult result = null; boolean hasCoupon = false; @@ -951,7 +955,8 @@ * @param endprice * @return */ - private void searchPDDGoods(AcceptData acceptData, String key, Integer page, String filter, Integer order, PrintWriter out) { + private void searchPDDGoods(AcceptData acceptData, String key, Integer page, String filter, Integer order, + PrintWriter out) { PDDSearchFilter pddfilter = new PDDSearchFilter(); pddfilter.setKw(SearchFilterUtil.filterSearchContent(key)); pddfilter.setPage(page); -- Gitblit v1.8.0