admin
2019-09-29 6f14a131b39c8fc44b29b6130c4e2002bbf2d3ca
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java
@@ -176,12 +176,11 @@
            return;
         }
         if (analysisTaoToken(text, out)) {
         if (analysisTaoToken(acceptData, text, out)) {
            return;
         }
         JSONObject root = new JSONObject();
         root.put("type", 2);
         JSONObject data = new JSONObject();
         data.put("title", text);
@@ -253,8 +252,17 @@
               String pddId = PinDuoDuoUtil.getPDDGoodsId(text);
               if (!StringUtil.isNullOrEmpty(pddId)) {
                  PDDGoodsDetail goods = PinDuoDuoApiUtil.getGoodsDetail(Long.parseLong(pddId));
                  if (goods != null)
                  if (goods != null) {
                     commonGoods = CommonGoodsFactory.create(goods);
                  } else {
                     type = 4;
                     goods = PinDuoDuoUtil.getPDDGoodsInfo(pddId);
                     if(goods != null) {
                        commonGoods = new CommonGoods();
                        commonGoods.setTitle(goods.getGoodsName());
                        commonGoods.setPicture(goods.getGoodsThumbnailUrl());
                     }
                  }
               }
            }
         }
@@ -353,7 +361,7 @@
      out.print(JsonUtil.loadTrueResult(root));
   }
   private boolean analysisTaoToken(String text, PrintWriter out) {
   private boolean analysisTaoToken(AcceptData acceptData, String text, PrintWriter out) {
      String token = StringUtil.picUpTaoToken(text);
      if (!StringUtil.isNullOrEmpty(token)) {
         Long auctionId = TaoKeApiUtil.tokenConvertAuctionId(token);
@@ -366,6 +374,32 @@
            }
            if (tb != null) {
               if (VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) {
                  TaoBaoGoodsBrief goodsBrief = null;
                  try {
                     goodsBrief = TaoKeApiUtil.searchGoodsDetail(tb.getAuctionId());
                  } 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)));
                  out.print(JsonUtil.loadTrueResult(data));
                  return true;
               }
               JSONObject data = new JSONObject();
               JSONObject taoBaoGoodsJSON = new JSONObject();
               taoBaoGoodsJSON.put("title", tb.getTitle());