| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoUnionConfigService taoBaoUnionConfigService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private TaoKeGoodsService taoKeGoodsService;
|
| | |
|
| | | @Resource
|
| | | private QualityGoodsService qualityGoodsService;
|
| | | |
| | |
|
| | | @RequestMapping(value = "gethotsearch", method = RequestMethod.POST)
|
| | | public void getHotSearch(AcceptData acceptData, PrintWriter out) {
|
| | |
| | | } else if ("fahuodi".equalsIgnoreCase(ty)) {
|
| | | int id = array.optJSONObject(i).optInt("id");
|
| | | sf.setProvinceId(id);
|
| | | }else if ("materialId".equalsIgnoreCase(ty)) {
|
| | | } else if ("materialId".equalsIgnoreCase(ty)) {
|
| | | int id = array.optJSONObject(i).optInt("id");
|
| | | sf.setProvinceId(id);
|
| | | }
|
| | |
| | | return StringUtil.Md5(sb.toString());
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 搜索-新版
|
| | | * |
| | | * @param acceptData
|
| | | * @param kw
|
| | | * @param page
|
| | | * @param filter
|
| | | * @param order 销量由高到低:1 、 价格从高到低:2 、 价格从低到高:3 、 推广量高到低:4(综合默认)、返利比高到低:5 、返利比低到高:6 、推荐20
|
| | | * @param order
|
| | | * 销量由高到低:1 、 价格从高到低:2 、 价格从低到高:3 、 推广量高到低:4(综合默认)、返利比高到低:5
|
| | | * 、返利比低到高:6 、推荐20
|
| | | * @param startprice
|
| | | * @param endprice
|
| | | * @param fastFilter
|
| | |
| | | @RequestMapping(value = "searchgoods")
|
| | | public void searchgoods(AcceptData acceptData, String kw, int page, String filter, String order, String startprice,
|
| | | String endprice, String fastFilter, PrintWriter out) {
|
| | | |
| | |
|
| | | String bid = getHistorySearchBid(acceptData);
|
| | | |
| | |
|
| | | historySearchService.addHistorySearch(kw, bid);
|
| | | |
| | |
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | |
| | | out.print(JsonUtil.loadFalseResult("无法搜索链接"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (!StringUtil.isNullOrEmpty(fastFilter)) {
|
| | | if (!StringUtil.isNullOrEmpty(filter)) {
|
| | | JSONArray filterArray = JSONArray.fromObject(filter);
|
| | |
| | | filter = fastFilter;
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | // 是否是推荐
|
| | | boolean recommend = false;
|
| | | if (!StringUtil.isNullOrEmpty(fastFilter)) {
|
| | |
| | | JSONArray array = JSONArray.fromObject(filter);
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | String ty = array.optJSONObject(i).optString("type");
|
| | | |
| | |
|
| | | if ("recommend".equalsIgnoreCase(ty)) {
|
| | | recommend = true;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | JSONObject data = null;
|
| | | if (!recommend) {
|
| | | // 淘宝接口请求
|
| | |
| | | // 推荐:精选库
|
| | | data = searchQualityGoods(kw, page, filter, order, startprice, endprice);
|
| | | }
|
| | | |
| | |
|
| | | // 获取推荐词
|
| | | List<String> listRecommendWords = new ArrayList<String>();
|
| | | // 综合 查询第一页时获取候选词
|
| | |
| | | listRecommendWords = TaoBaoUtil.getSuguestSearch(kw);
|
| | | if (listRecommendWords == null || listRecommendWords.size() == 0) {
|
| | | listRecommendWords = new ArrayList<String>();
|
| | | } |
| | | }
|
| | | }
|
| | | |
| | |
|
| | | Gson gson = new GsonBuilder().create();
|
| | | data.put("words", gson.toJson(listRecommendWords));
|
| | | |
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 执行搜索-新版
|
| | | * |
| | | * @param kw
|
| | | * @param page
|
| | | * @param filter
|
| | |
| | | * @param endprice
|
| | | * @return
|
| | | */
|
| | | private JSONObject searchGoods(String kw, int page, String filter, String order, String startprice, String endprice) {
|
| | | private JSONObject searchGoods(String kw, int page, String filter, String order, String startprice,
|
| | | String endprice) {
|
| | | page = page + 1;
|
| | |
|
| | | SearchFilter sf = new SearchFilter();
|
| | |
| | | } else if ("fahuodi".equalsIgnoreCase(ty)) {
|
| | | int id = array.optJSONObject(i).optInt("id");
|
| | | sf.setProvinceId(id);
|
| | | }else if ("materialId".equalsIgnoreCase(ty)) {
|
| | | } else if ("materialId".equalsIgnoreCase(ty)) {
|
| | | int id = array.optJSONObject(i).optInt("id");
|
| | | sf.setProvinceId(id);
|
| | | }
|
| | |
| | | data.put("count", result.getTaoBaoHead().getDocsfound());
|
| | | return data;
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 执行搜索精选库
|
| | | * |
| | | * @param kw
|
| | | * @param page
|
| | | * @param filter
|
| | |
| | | * @param endprice
|
| | | * @return
|
| | | */
|
| | | private JSONObject searchQualityGoods(String key, int page, String filter, String order, String startprice, String endprice) {
|
| | | |
| | | private JSONObject searchQualityGoods(String key, int page, String filter, String order, String startprice,
|
| | | String endprice) {
|
| | |
|
| | | Integer hasQuan = null;
|
| | | Integer userType = null;
|
| | | Double start_Price = null;
|
| | | Double end_Price= null;
|
| | | Double end_Price = null;
|
| | | Integer sort = null;
|
| | | |
| | |
|
| | | int provinceId = -100;
|
| | | |
| | |
|
| | | // 起始价格
|
| | | if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(startprice)) {
|
| | | start_Price = Double.parseDouble(startprice);
|
| | | }
|
| | | // 结束价格
|
| | | if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(endprice)) {
|
| | | end_Price = Double.parseDouble(endprice);
|
| | | end_Price = Double.parseDouble(endprice);
|
| | | }
|
| | | |
| | | // 排序 |
| | |
|
| | | // 排序
|
| | | if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(order)) {
|
| | | |
| | |
|
| | | if (Integer.parseInt(order) == 4) {
|
| | | sort = 20; // 综合时:采用默认权重排序
|
| | | } else {
|
| | | sort =Integer.parseInt(order);
|
| | | sort = Integer.parseInt(order);
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
|
| | | /* 其他筛选条件 */ |
| | | /* 其他筛选条件 */
|
| | | if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(filter)) {
|
| | | // 查询淘宝天猫
|
| | | JSONArray array = JSONArray.fromObject(filter);
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | String ty = array.optJSONObject(i).optString("type");
|
| | | |
| | |
|
| | | if ("userType".equalsIgnoreCase(ty)) {
|
| | | userType = 1; // 天猫
|
| | | } else if ("quantype".equalsIgnoreCase(ty)) {
|
| | | hasQuan = 1; // 有券
|
| | | } else if ("hongbaotype".equalsIgnoreCase(ty)) {
|
| | | |
| | |
|
| | | } else if ("fahuodi".equalsIgnoreCase(ty)) {
|
| | | provinceId = array.optJSONObject(i).optInt("id");
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | |
| | | List<QualityFactory> listQuery = qualityGoodsService.listRecommendBykey(page * pageSize,
|
| | | pageSize, key, hasQuan, userType, start_Price, end_Price, sort);
|
| | | |
| | | |
| | |
|
| | | List<QualityFactory> listQuery = qualityGoodsService.listRecommendBykey(page * pageSize, pageSize, key, hasQuan,
|
| | | userType, start_Price, end_Price, sort);
|
| | |
|
| | | List<TaoBaoGoodsBriefExtra> listExtra = new ArrayList<TaoBaoGoodsBriefExtra>();
|
| | | Map<String, String> map = manageService.convertMap();
|
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | | String fcRate = map.get("hongbao_fc_ratio");
|
| | | |
| | |
|
| | | /* 遍历列表数据 */
|
| | | if (listQuery != null && listQuery.size() > 0) {
|
| | | for (QualityFactory selectionGoods : listQuery) {
|
| | | |
| | |
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
|
| | | |
| | |
|
| | | if (taoBaoGoodsBrief == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | int biz30day = taoBaoGoodsBrief.getBiz30day();
|
| | | if (biz30day >= 10000) {
|
| | | double sales = biz30day;
|
| | |
| | | } else {
|
| | | taoBaoGoodsBrief.setSalesCount(biz30day + "");
|
| | | }
|
| | | |
| | | // 改变图片尺寸 |
| | |
|
| | | // 改变图片尺寸
|
| | | String pictUrl = taoBaoGoodsBrief.getPictUrl();
|
| | | if (!StringUtil.isNullOrEmpty(pictUrl) && !pictUrl.contains("320x320")) {
|
| | | taoBaoGoodsBrief.setPictUrl(TbImgUtil.getTBSize320Img(pictUrl));
|
| | | }
|
| | | |
| | |
|
| | | listExtra.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion, fcRate, null));
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | long count = qualityGoodsService.countRecommendBykey(key, hasQuan, userType, start_Price, end_Price);
|
| | | |
| | | |
| | |
|
| | | // 设置发货地址
|
| | | TaoBaoSearchNav nav = new TaoBaoSearchNav();
|
| | | nav.setName("发货地");
|
| | | nav.setName("发货地选择");
|
| | | nav.setFlag("address");
|
| | | nav.setId(11110);
|
| | | nav.setType("fahuodi");
|
| | |
|
| | | List<TaoBaoSearchNav> navList = new ArrayList<>();
|
| | | |
| | |
|
| | | List<TaoBaoSearchNav> childNavList = new ArrayList<>();
|
| | | List<TaoBaoProvince> provinceList = TaoBaoUtil.getTaoBaoProvinceList();
|
| | | for (TaoBaoProvince province : provinceList) {
|
| | |
| | |
|
| | | nav.setSubIds(childNavList);
|
| | | navList.add(nav);
|
| | | |
| | |
|
| | | Gson gson = new GsonBuilder().create();
|
| | | Gson gson2 = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().create();
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("nav", gson.toJson(navList));
|
| | | data.put("result", gson2.toJson(listExtra));
|
| | | data.put("count", count);
|
| | | |
| | |
|
| | | return data;
|
| | | }
|
| | | |
| | |
|
| | | }
|