| | |
| | | import com.yeshi.fanli.util.taobao.SearchFilterUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.vo.brand.BrandInfoVO;
|
| | | import com.yeshi.fanli.vo.brand.TaoBaoShopVO;
|
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO;
|
| | | import com.yeshi.fanli.vo.msg.TokenVO;
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | int type = 3;
|
| | | CommonGoods commonGoods = null;
|
| | | text = matcher.group();
|
| | |
|
| | |
| | | }
|
| | | tb = TaoBaoUtil.isAlimama(id);
|
| | | if (tb == null) {
|
| | | tb = TaoBaoUtil.parsePhoneTmAndTb(id);
|
| | | type = 4;
|
| | | tb = TaoBaoUtil.getTmallGoodsInfo(id);
|
| | | }
|
| | | } else if (text.contains("http://zmnxbc.com")) { // 手机端天猫APP分享
|
| | | tb = TaoBaoUtil.parsePhoneShareUrlByTM(text);
|
| | |
| | | id = map.get("id").replace("}", "");
|
| | | tb = TaoBaoUtil.isAlimama(id);
|
| | | if (tb == null) {
|
| | | tb = TaoBaoUtil.parsePhoneTmAndTb(id);
|
| | | type = 4;
|
| | | tb = TaoBaoUtil.getTmallGoodsInfo(id);
|
| | | }
|
| | | } else {
|
| | | tb = TaoBaoUtil.parsePhoneShareUrlByTB(text);
|
| | |
| | | String jdId = JDUtil.getJDGoodsId(text);
|
| | | if (!StringUtil.isNullOrEmpty(jdId)) {
|
| | | JDGoods goods = JDApiUtil.getGoodsDetail(Long.parseLong(jdId));
|
| | | if (goods != null)
|
| | | if (goods != null) {
|
| | | commonGoods = CommonGoodsFactory.create(goods);
|
| | | } else {
|
| | | type = 4;
|
| | | goods = JDUtil.getSimpleGoodsInfo(jdId);
|
| | | if (goods != null) {
|
| | | commonGoods = new CommonGoods();
|
| | | commonGoods.setTitle(goods.getSkuName());
|
| | | commonGoods.setPicture(goods.getPicUrl());
|
| | | }
|
| | | }
|
| | | } else {
|
| | | String pddId = PinDuoDuoUtil.getPDDGoodsId(text);
|
| | | if (!StringUtil.isNullOrEmpty(pddId)) {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | 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())) {
|
| | | 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())) {
|
| | |
| | | out.println(JsonUtil.loadFalseResult("暂未找到该商品,请稍后再试!"));
|
| | | return;
|
| | | }
|
| | | commonGoods = CommonGoodsFactory.create(goodsBrief);
|
| | | commonGoods = CommonGoodsFactory.create(tb);
|
| | | }
|
| | | |
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | data.put("type", 3);
|
| | | data.put("type", type);
|
| | | data.put("goods",
|
| | | gson.toJson(GoodsDetailVOFactory.convertCommonGoods(commonGoods, null, fanLiRate, shareRate)));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
| | |
|
| | | /*--------- 京东商品 -------*/
|
| | | if (goodsType.intValue() == Constant.SOURCE_TYPE_JD) {
|
| | | searchJDGoods(searchkey, page, filter, order, out);
|
| | | searchJDGoods(acceptData, searchkey, page, filter, order, out);
|
| | | return;
|
| | | }
|
| | |
|
| | | /*-------- 拼多多商品 -------*/
|
| | | if (goodsType.intValue() == Constant.SOURCE_TYPE_PDD) {
|
| | | searchPDDGoods(searchkey, page, filter, order, out);
|
| | | searchPDDGoods(acceptData, searchkey, page, filter, order, out);
|
| | | return;
|
| | | }
|
| | |
|
| | | /*-------- 淘宝商品 -------*/
|
| | | searchTaoBaoGoods(searchkey, page, filter, order, out);
|
| | | searchTaoBaoGoods(acceptData, searchkey, page, filter, order, out);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @param endprice
|
| | | * @return
|
| | | */
|
| | | private void searchTaoBaoGoods(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);
|
| | |
| | | data.put("result", gson.toJson(list));
|
| | | data.put("count", result.getTaoBaoHead().getDocsfound());
|
| | |
|
| | | if (page == 1) {
|
| | | // 第一页返回店铺信息
|
| | | if (page == 1) { // 第一页返回店铺信息
|
| | | List<TaoBaoShopVO> listShop = taoBaoShopService.getShopByKeyV2(key);
|
| | | if (listShop != null && listShop.size() > 0 && listShop.get(0).getListGoodsVO() != null
|
| | | && listShop.get(0).getListGoodsVO().size() > 2) {
|
| | | data.put("shop", JsonUtil.getApiCommonGson().toJson(listShop.get(0)));
|
| | | 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()))) {
|
| | | BrandInfoVO brandInfoVO = new BrandInfoVO();
|
| | | brandInfoVO.setId(taoBaoShop.getId());
|
| | | brandInfoVO.setName(taoBaoShop.getShopName());
|
| | | brandInfoVO.setIcon(taoBaoShop.getShopIcon());
|
| | | brandInfoVO.setListGoods(taoBaoShop.getListGoodsVO());
|
| | | data.put("shop", JsonUtil.getApiCommonGson().toJson(brandInfoVO));
|
| | | } else {
|
| | | data.put("shop", JsonUtil.getApiCommonGson().toJson(taoBaoShop));
|
| | | }
|
| | | }
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
| | | * @param endprice
|
| | | * @return
|
| | | */
|
| | | private void searchJDGoods(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;
|
| | |
| | | * @param endprice
|
| | | * @return
|
| | | */
|
| | | private void searchPDDGoods(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);
|