| | |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsResult;
|
| | | import com.yeshi.fanli.dto.pdd.PDDSearchFilter;
|
| | | import com.yeshi.fanli.dto.suning.SuningGoodsInfo;
|
| | | import com.yeshi.fanli.dto.suning.SuningQueryModel;
|
| | | import com.yeshi.fanli.dto.vip.VIPSearchFilter;
|
| | | import com.yeshi.fanli.dto.vip.VIPSearchResult;
|
| | | import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo;
|
| | |
| | | import com.yeshi.fanli.util.jd.JDUtil;
|
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
|
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil;
|
| | | import com.yeshi.fanli.util.suning.SuningApiUtil;
|
| | | import com.yeshi.fanli.util.taobao.SearchFilterUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
| | | public void searchGoods(AcceptData acceptData, Integer goodsType, String key, Integer page, String filter,
|
| | | Integer order, Long uid, HttpSession session, PrintWriter out) {
|
| | |
|
| | | if (goodsType == null || goodsType < 1 || goodsType > 3) {
|
| | | if (goodsType == null || goodsType < 1 || goodsType > 5) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "请传递正确平台参数"));
|
| | | return;
|
| | | }
|
| | |
| | | /*-------- 唯品会商品 ------*/
|
| | | if (goodsType.intValue() == Constant.SOURCE_TYPE_VIP) {
|
| | | searchVIPGoods(acceptData, searchkey, page, filter, order, out);
|
| | | return;
|
| | | }
|
| | |
|
| | | /*-------- 苏宁商品 ------*/
|
| | | if (goodsType.intValue() == Constant.SOURCE_TYPE_SUNING) {
|
| | | searchSuningGoods(acceptData, searchkey, page, filter, order, out);
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | searchFilter.setFieldName("price");
|
| | | searchFilter.setOrder(0);
|
| | | break;
|
| | | case 4: // 折扣—desc
|
| | | searchFilter.setFieldName("discount");
|
| | | searchFilter.setOrder(1);
|
| | | break;
|
| | | case 5: // 折扣—aec
|
| | | searchFilter.setFieldName("discount");
|
| | | searchFilter.setOrder(0);
|
| | |
| | | data.put("count", count);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 搜索唯品会商品
|
| | | * @Title: searchVIPGoods
|
| | | * @Description: |
| | | * @param acceptData
|
| | | * @param key
|
| | | * @param page
|
| | | * @param filter
|
| | | * @param order
|
| | | * @param out |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | private void searchSuningGoods(AcceptData acceptData, String key, Integer page, String filter, Integer order,
|
| | | PrintWriter out) {
|
| | | SuningQueryModel searchFilter = new SuningQueryModel();
|
| | | searchFilter.setKeyword(key);
|
| | | searchFilter.setPageIndex(page);
|
| | | searchFilter.setSize(Constant.PAGE_SIZE);
|
| | |
|
| | | if (order != null) {
|
| | | if (order == 1) { // 销量高到低
|
| | | searchFilter.setSortType(2);
|
| | | } else if (order == 2) { // 价格高到低
|
| | | searchFilter.setSortType(3);
|
| | | } else if (order == 3) { // 价格低到高
|
| | | searchFilter.setSortType(4);
|
| | | } else if (order == 4) { // 返利比高到低
|
| | | searchFilter.setSortType(5);
|
| | | }
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(filter)) {
|
| | | JSONObject jsonfilter = JSONObject.fromObject(filter);
|
| | | Boolean coupon = jsonfilter.optBoolean("coupon");
|
| | | if (coupon != null && coupon) {
|
| | | searchFilter.setCoupon(1); // 有券
|
| | | }
|
| | |
|
| | | Boolean snfwservice = jsonfilter.optBoolean("snfwservice");// 苏宁服务
|
| | | if (snfwservice != null && snfwservice) {
|
| | | searchFilter.setSnfwservice(1);
|
| | | }
|
| | |
|
| | | Boolean snhwg = jsonfilter.optBoolean("snhwg");// 苏宁国际
|
| | | if (snhwg != null && snhwg) {
|
| | | searchFilter.setSnhwg(1);
|
| | | }
|
| | |
|
| | | Boolean suningService = jsonfilter.optBoolean("suningService");// 苏宁自营
|
| | | if (suningService != null && suningService) {
|
| | | searchFilter.setSuningService(1);
|
| | | }
|
| | |
|
| | | Boolean pgSearch = jsonfilter.optBoolean("pgSearch");// 拼购
|
| | | if (pgSearch != null && pgSearch) {
|
| | | searchFilter.setPgSearch(1);
|
| | | }
|
| | |
|
| | | String minPrice = jsonfilter.optString("minPrice");
|
| | | if (!StringUtil.isNullOrEmpty(minPrice)) {
|
| | | searchFilter.setStartPrice(minPrice);
|
| | | }
|
| | |
|
| | | String maxPrice = jsonfilter.optString("maxPrice");
|
| | | if (!StringUtil.isNullOrEmpty(maxPrice)) {
|
| | | searchFilter.setEndPrice(maxPrice);
|
| | | }
|
| | | }
|
| | |
|
| | | int count = 0;
|
| | | JSONObject data = new JSONObject();
|
| | | JSONArray array = new JSONArray();
|
| | |
|
| | | List<SuningGoodsInfo> resultList = SuningApiUtil.searchGoods(searchFilter);
|
| | | if (resultList != null) {
|
| | | if (resultList.size() == 0)
|
| | | count = 0;
|
| | | else
|
| | | count = resultList.size() + 1;
|
| | | Gson gson = JsonUtil.getApiCommonGson();
|
| | | if (resultList != null && resultList.size() > 0) {
|
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | |
|
| | | for (SuningGoodsInfo goods : resultList) {
|
| | | GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertSuningGoods(goods, paramsDTO);
|
| | | array.add(gson.toJson(goodsDetailVO));
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | data.put("result", array);
|
| | | data.put("count", count);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | }
|