| | |
| | | package com.yeshi.fanli.controller.wxmp.v1;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.regex.Matcher;
|
| | | import java.util.regex.Pattern;
|
| | |
| | | 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.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.search.HotSearch;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandInfoService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.HotSearchService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.manger.goods.jd.JDGoodsLinkParseManager;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | |
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | | |
| | | @Resource
|
| | | private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
|
| | |
|
| | | @Resource(name = "taskExecutor")
|
| | | private TaskExecutor executor;
|
| | |
| | |
|
| | | @Resource
|
| | | private JDGoodsLinkParseManager jdGoodsLinkParseManager;
|
| | | |
| | |
|
| | | @Resource
|
| | | private HotSearchService hotSearchService;
|
| | |
|
| | | /**
|
| | | * 粘贴板信息推荐
|
| | |
| | | out.print(JsonUtil.loadFalseResult("值为空"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | // 去除前后空格
|
| | | int type = 1;
|
| | | text = text.trim();
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if (commonGoods == null) {
|
| | | out.println(JsonUtil.loadFalseResult("暂未找到该商品,请稍后再试!"));
|
| | | return;
|
| | |
| | | data.put("goods", goodsJSON);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | data.put("type", type);
|
| | | data.put("goods", gson.toJson(GoodsDetailVOFactory.convertCommonGoods(commonGoods, hongBaoManageService.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion()))));
|
| | | data.put("goods", gson.toJson(GoodsDetailVOFactory.convertCommonGoods(commonGoods,
|
| | | orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion()))));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 热门搜索
|
| | | * |
| | | * @param acceptData
|
| | | * @param goodsType
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "gethotsearch", method = RequestMethod.POST)
|
| | | public void getHotSearch(AcceptData acceptData, Integer goodsType, PrintWriter out) {
|
| | | // 默认淘宝
|
| | | if (goodsType == null) {
|
| | | goodsType = Constant.SOURCE_TYPE_TAOBAO;
|
| | | }
|
| | |
|
| | | List<HotSearch> list = hotSearchService.getHotSearchCache(goodsType);
|
| | | if (list == null || list.size() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("没有数据"));
|
| | | return;
|
| | | }
|
| | | List<String> hotSearchList = new ArrayList<String>();
|
| | | if(list!=null)
|
| | | for (HotSearch hot : list)
|
| | | hotSearchList.add(hot.getName());
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", list.size());
|
| | | data.put("hotSearchList", hotSearchList);
|
| | | data.put("helpLink", configService.get(ConfigKeyEnum.newerGonglue.getKey()));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 搜索候选词
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "请输入搜索内容"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (page == null || page < 1) {
|
| | | page = 1;
|
| | | }
|
| | | |
| | |
|
| | | final String searchkey = key.trim();
|
| | | if (searchkey.startsWith("http://") || searchkey.startsWith("https://")) {
|
| | | JSONObject data = new JSONObject();
|
| | |
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 京东
|
| | |
| | | if (goodsList != null && goodsList.size() > 0) {
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
|
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | | for (JDGoods goods : goodsList) {
|
| | | GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO);
|
| | |
| | | Gson gson = JsonUtil.getApiCommonGson();
|
| | | List<PDDGoodsDetail> goodsList = result.getGoodsList();
|
| | | if (goodsList != null && goodsList.size() > 0) {
|
| | | ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
|
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | |
|
| | | for (PDDGoodsDetail goods : goodsList) {
|