Merge branch 'master' into div
Conflicts:
fanli/src/main/java/com/yeshi/fanli/service/inter/order/CommonOrderService.java
fanli/src/main/java/com/yeshi/fanli/util/jd/JDUtil.java
fanli/src/main/java/com/yeshi/fanli/util/pinduoduo/PinDuoDuoUtil.java
| | |
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls();
|
| | | gsonBuilder.setDateFormat("yyyy-MM-dd HH:mm:ss");
|
| | | |
| | | Gson gson = gsonBuilder.create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
New file |
| | |
| | | package com.yeshi.fanli.controller.admin.order;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.lang.reflect.Type;
|
| | | import java.util.Date;
|
| | | import java.util.HashSet;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Set;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.google.gson.JsonElement;
|
| | | import com.google.gson.JsonPrimitive;
|
| | | import com.google.gson.JsonSerializationContext;
|
| | | import com.google.gson.JsonSerializer;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.job.UpdateOrderJob;
|
| | | import com.yeshi.fanli.job.UpdateRelationAndSpecialOrderJob;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/taobaoOrder")
|
| | | public class TaoBaoOrderController {
|
| | |
|
| | | @Resource
|
| | | private TaoBaoOrderService taoBaoOrderService;
|
| | |
|
| | | @Resource
|
| | | private UpdateRelationAndSpecialOrderJob updateRelationAndSpecialOrderJob;
|
| | |
|
| | | @Resource
|
| | | private UpdateOrderJob updateOrderJob;
|
| | |
|
| | | /**
|
| | | * 查询列表 - 新后台
|
| | | * |
| | | * @param callback
|
| | | * @param key
|
| | | * 查询词 名称
|
| | | * @param pageIndex
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "listTaoBaoOrder")
|
| | | public void listTaoBaoOrder(String callback, String key, Integer pageIndex, PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 0) {
|
| | | pageIndex = 1;
|
| | | }
|
| | |
|
| | | List<TaoBaoOrder> orderList = null;
|
| | | Long count = null;
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(key)) {
|
| | | orderList = taoBaoOrderService.getTaoBaoOrderByOrderId(key);
|
| | | count = (long) orderList.size();
|
| | | } else {
|
| | | orderList = taoBaoOrderService.listAllOrder(pageIndex, Constant.PAGE_SIZE);
|
| | | count = taoBaoOrderService.countAllOrder();
|
| | | }
|
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
|
| | | @Override
|
| | | public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) {
|
| | | if (value == null) {
|
| | | return new JsonPrimitive("");
|
| | | } else {
|
| | | return new JsonPrimitive(TimeUtil.getGernalTime(value.getTime(), "yyyy-MM-dd HH:mm:ss"));
|
| | | }
|
| | | }
|
| | | }).create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("result_list", gson.toJson(orderList));
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "updateTaoBaoOrder")
|
| | | public void updateTaoBaoOrder(String callback, String ids, PrintWriter out) {
|
| | | try {
|
| | | if (StringUtil.isNullOrEmpty(ids)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请上传订单ID"));
|
| | | return;
|
| | | }
|
| | | net.sf.json.JSONArray idsArray = net.sf.json.JSONArray.fromObject(ids);
|
| | |
|
| | | Set<String> orderIds = new HashSet<>();
|
| | |
|
| | | for (int i = 0; i < idsArray.size(); i++) {
|
| | | TaoBaoOrder taoBaoOrder = taoBaoOrderService.selectByPrimaryKey(idsArray.optLong(i));
|
| | | orderIds.add(taoBaoOrder.getOrderId());
|
| | | }
|
| | |
|
| | | Long[] startTimes = new Long[orderIds.size()];
|
| | | Long[] endTimes = new Long[orderIds.size()];
|
| | |
|
| | | int p = 0;
|
| | | for (Iterator<String> its = orderIds.iterator(); its.hasNext();) {
|
| | | String orderId = its.next();
|
| | | List<TaoBaoOrder> list = taoBaoOrderService.getTaoBaoOrderByOrderId(orderId);
|
| | | startTimes[p] = TimeUtil.convertToTimeTemp(list.get(0).getCreateTime(), "yyyy-MM-dd HH:mm:ss") - 1000L;
|
| | | endTimes[p] = TimeUtil.convertToTimeTemp(list.get(0).getCreateTime(), "yyyy-MM-dd HH:mm:ss") + 1000L;
|
| | | p++;
|
| | | }
|
| | |
|
| | | for (int i = 0; i < idsArray.size(); i++) {
|
| | | updateRelationAndSpecialOrderJob.updateRelationAndSpecialOrder(startTimes[i], endTimes[i]);
|
| | | updateOrderJob.updateOrder(startTimes[i], endTimes[i]);
|
| | | }
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("更新成功"));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("更新失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.Utils;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | |
| | | text = text.substring(1, end);
|
| | | }
|
| | |
|
| | | LogHelper.test("根据粘贴板推荐:"+text);
|
| | | LogHelper.test("根据粘贴板推荐:" + text);
|
| | |
|
| | | if (text.length() > 80) {
|
| | | out.print(JsonUtil.loadFalseResult("值过长"));
|
| | |
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 解析淘口令
|
| | | * |
| | | * @param text
|
| | | * @param out
|
| | | * @return
|
| | | */
|
| | | private boolean analysisTaoToken(String text, PrintWriter out) {
|
| | | String token = StringUtil.picUpTaoToken(text);
|
| | | if (!StringUtil.isNullOrEmpty(token)) {
|
| | | Long auctionId = TaoKeApiUtil.tokenConvertAuctionId(token);
|
| | | if (auctionId != null) {
|
| | | TaoBaoGoodsBrief tb = null;
|
| | | try {
|
| | | tb = TaoKeApiUtil.getSimpleGoodsInfo(auctionId);
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | if (tb != null) {
|
| | | JSONObject data = new JSONObject();
|
| | | JSONObject taoBaoGoodsJSON = new JSONObject();
|
| | | taoBaoGoodsJSON.put("title", tb.getTitle());
|
| | | taoBaoGoodsJSON.put("zkPrice", tb.getZkPrice());
|
| | | taoBaoGoodsJSON.put("auctionId", tb.getAuctionId());
|
| | | taoBaoGoodsJSON.put("url", "http://item.taobao.com/item.htm?id=" + tb.getAuctionId());
|
| | | data.put("taoBaoGoodsBrief", taoBaoGoodsJSON);
|
| | | if (!StringUtil.isNullOrEmpty(tb.getPictUrl())) {
|
| | | if (tb.getImgList() == null)
|
| | | tb.setImgList(new ArrayList<>());
|
| | | tb.getImgList().add(0, TbImgUtil.getTBSize220Img(tb.getPictUrl()));
|
| | | }
|
| | | data.put("tbImgs", tb.getImgList());
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("type", 1);
|
| | | root.put("data", data);
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | return true;
|
| | | }
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | data.put("type", 1);
|
| | | data.put("link", link);
|
| | | data.put("native", true);
|
| | |
|
| | | } catch (Exception e1) {
|
| | | String siteId = tbPid.getPid().split("_")[2];
|
| | | String adzoneId = tbPid.getPid().split("_")[3];
|
| | |
| | | }
|
| | |
|
| | | String token = "";
|
| | | if (!StringUtil.isNullOrEmpty(tb.getCouponLink())) {
|
| | | if (!StringUtil.isNullOrEmpty(tb.getCouponLink())
|
| | | && VersionUtil.greaterThan_1_5_60(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | token = redisManager.getCommonTaoToken(tb.getAuctionId());
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | token = TaoKeApiUtil.getTKToken(tb.getPictUrl(), tb.getTitle(), tb.getCouponLink());
|
| | |
| | | */ |
| | | List<CommonOrder> listBySourceTypeAndTradeId(@Param("sourceType") int sourceType, @Param("tradeId") String tradeId); |
| | | |
| | | /** |
| | | * |
| | | * @param sourceType |
| | | * @param state |
| | | * @param minTime |
| | | * -最大创建时间 |
| | | * @param maxTime |
| | | * -最小创建时间 |
| | | * @return |
| | | */ |
| | | List<CommonOrder> listBySourceTypeAndStateAndThirdCrateTime(@Param("sourceType") int sourceType, |
| | | @Param("state") Integer state, @Param("minTime") Long minTime, @Param("maxTime") Long maxTime, |
| | | @Param("start") long start, @Param("count") int count); |
| | | } |
| | |
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.HashSet;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Set;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.LostOrder;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.taobao.PidUser;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.common.DataMonitorService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.LostOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderProcessService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | |
| | |
|
| | | @Resource
|
| | | private OrderService orderService;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | |
|
| | | /**
|
| | | * 新版获取普通订单
|
| | |
| | | addOrder(orderList);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 跟新本地订单(凌晨25分更新)
|
| | | */
|
| | | @Scheduled(cron = "25 0 0 * * ? ")
|
| | | public void doLocalTaoBaoOrder() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | // 处理3-15天前的订单,每天跑一次
|
| | | Long startTime = System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 60L;
|
| | | Long endTime = startTime + 1000 * 60 * 60 * 24 * 48L;
|
| | | List<CommonOrder> commonOrderList = commonOrderService.listBySourceTypeAndStateAndThirdCrateTime(
|
| | | Constant.SOURCE_TYPE_TAOBAO, CommonOrder.STATE_FK, startTime, endTime, 1, 500);
|
| | | Set<String> orderIds = new HashSet<>();
|
| | | for (CommonOrder co : commonOrderList) {
|
| | | orderIds.add(co.getOrderNo());
|
| | | }
|
| | |
|
| | | for (Iterator<String> its = orderIds.iterator(); its.hasNext();) {
|
| | | String orderId = its.next();
|
| | | List<TaoBaoOrder> orderList = taoBaoOrderService.getTaoBaoOrderByOrderId(orderId);
|
| | | Map<String, List<TaoBaoOrder>> orders = new HashMap<>();
|
| | | orders.put(orderId, orderList);
|
| | | orderProcessService.processOrder(orders);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} and |
| | | co_trade_id=#{tradeId} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="listBySourceTypeAndStateAndThirdCrateTime" resultMap="BaseResultMap">SELECT * |
| | | FROM |
| | | yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} |
| | | |
| | | <if test="state!=null"> |
| | | and co_state=#{state} |
| | | </if> |
| | | |
| | | <if test="minTime!=null"> |
| | | and UNIX_TIMESTAMP(co_third_create_time)*1000>=#{minTime} |
| | | </if> |
| | | |
| | | |
| | | <if test="maxTime!=null"> |
| | | and #{maxTime}> UNIX_TIMESTAMP(co_third_create_time)*1000 |
| | | </if> |
| | | |
| | | order by co_id desc |
| | | limit #{start},#{count} |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_common_order where co_id = #{id,jdbcType=BIGINT} |
| | |
| | | }
|
| | |
|
| | | private CommonContentResult get9K9Content(String cid, int page, int pageSize) {
|
| | | if (pageSize == 20)
|
| | | pageSize = 50;
|
| | |
|
| | | DaTaoKeGoodsResult result = null;
|
| | | if ("-1".equalsIgnoreCase(cid)) {
|
| | | result = DaTaoKeApiUtil.search("", null, null, new BigDecimal("10"), page, pageSize,
|
| | |
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | |
|
| | | @Service
|
| | | public class HomeRecommendGoodsServiceImpl implements HomeRecommendGoodsService {
|
| | |
|
| | |
| | | if (fList != null && fList.size() > 0)
|
| | | return fList;
|
| | |
|
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.getRankingList(type, null);
|
| | | DaTaoKeGoodsResult result = null;
|
| | | int count = 0;
|
| | | while (result == null && count < 4) {
|
| | | count++;
|
| | | try {
|
| | | result = DaTaoKeApiUtil.getRankingList(type, null);
|
| | | } catch (Exception e) {
|
| | | }
|
| | | }
|
| | |
|
| | | List<DaTaoKeDetailV2> list = result.getGoodsList();
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | if (list != null)
|
| | |
| | | return commonOrderMapper.listBySourceTypeAndTradeId(sourceType, tradeId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<CommonOrder> listBySourceTypeAndStateAndThirdCrateTime(int sourceType, Integer state, Long minTime,
|
| | | Long maxTime, int page, int pageSize) {
|
| | | return commonOrderMapper.listBySourceTypeAndStateAndThirdCrateTime(sourceType, state, minTime, maxTime,
|
| | | (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | @Cacheable(value = "commonContentCache", key = "'tljBuy-listByDay'+#day")
|
| | | @Override
|
| | | public List<TLJBuyGoods> listByDay(String day) {
|
| | | return listByDay(day, 10);
|
| | | List<TLJBuyGoods> list = listByDay(day, 30);
|
| | | if (list.size() <= 10)
|
| | | return list;
|
| | | else {
|
| | | List<TLJBuyGoods> newList = new ArrayList<>();
|
| | | for (int i = 0; i < 10; i++) {
|
| | | newList.add(list.get(i));
|
| | | }
|
| | | return newList;
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | if (exec == null || exec.size() == 0) {
|
| | | throw new UserAccountException(10, "请稍后再试");
|
| | | } else {
|
| | | |
| | | // 查询是否存在该电话历史用户
|
| | | UserInfo userInfo = userInfoMapper.getEffectiveUserInfoByPhone(phone);
|
| | | if (userInfo != null) {
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | return userInfo;
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | jedis.del(watchKey);
|
| | | jedis.unwatch();
|
| | | jedisPool.returnResource(jedis);
|
| | | }
|
| | |
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | jedis.del(watchKey);
|
| | | jedis.unwatch();
|
| | | jedisPool.returnResource(jedis);
|
| | | }
|
| | |
| | | */
|
| | | public List<CommonOrder> listBySourceTypeAndTradeId(int sourceType, String tradeId);
|
| | |
|
| | | /**
|
| | | * 根据条件查询订单
|
| | | * |
| | | * @param sourceType
|
| | | * @param state
|
| | | * @param minTime
|
| | | * @param maxTime
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | | List<CommonOrder> listBySourceTypeAndStateAndThirdCrateTime(int sourceType, Integer state, Long minTime,
|
| | | Long maxTime, int page, int pageSize);
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.util.jd;
|
| | |
|
| | | import java.io.IOException;
|
| | | import java.io.UnsupportedEncodingException;
|
| | | import java.math.BigDecimal;
|
| | | import java.net.URLEncoder;
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | |
| | | return salesCountMidea;
|
| | | }
|
| | |
|
| | | public static List<String> suggestSearch(String key) {
|
| | | List<String> list = new ArrayList<>();
|
| | | if (StringUtil.isNullOrEmpty(key))
|
| | | return list;
|
| | | String url = null;
|
| | | try {
|
| | | url = String.format(
|
| | | "https://wq.jd.com/bases/searchdropdown/getdropdown?terminal=m&zip=1&key=%s&newjson=1&_=%s&sceneval=2",
|
| | | URLEncoder.encode(key, "UTF-8"), System.currentTimeMillis() + "");
|
| | | } catch (UnsupportedEncodingException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | if (url == null)
|
| | | return list;
|
| | | try {
|
| | | String result = HttpUtil.get(url);
|
| | | result = result.replace("callback(", "").replace(")", "");
|
| | | JSONArray array = JSONArray.fromObject(result);
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | String sk = array.optJSONObject(i).optString("key");
|
| | | if (!StringUtil.isNullOrEmpty(sk))
|
| | | list.add(sk);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | }
|
| | | return list;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.util.pinduoduo;
|
| | |
|
| | | import java.io.UnsupportedEncodingException;
|
| | | import java.math.BigDecimal;
|
| | | import java.net.URLEncoder;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | |
| | | import org.jsoup.nodes.Document;
|
| | | import org.jsoup.select.Elements;
|
| | | import org.yeshi.utils.BigDecimalUtil;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | |
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | public static List<String> getDetailImages(Long id) {
|
| | | List<String> imgList = new ArrayList<>();
|
| | | try {
|
| | | Document doc = Jsoup.connect("http://yangkeduo.com/goods.html?goods_id="+id)
|
| | | Document doc = Jsoup.connect("http://yangkeduo.com/goods.html?goods_id=" + id)
|
| | | .userAgent(
|
| | | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36")
|
| | | .get();
|
| | |
| | |
|
| | | }
|
| | |
|
| | | public static List<String> suggestSearch(String key) {
|
| | | List<String> list = new ArrayList<>();
|
| | | if (StringUtil.isNullOrEmpty(key))
|
| | | return list;
|
| | | String url = null;
|
| | | try {
|
| | | url = String.format("http://apiv3.yangkeduo.com/search_suggest?query=%s&pdduid=0",
|
| | | URLEncoder.encode(key, "UTF-8"));
|
| | | } catch (UnsupportedEncodingException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | if (url == null)
|
| | | return list;
|
| | | try {
|
| | | String result = HttpUtil.get(url);
|
| | | JSONObject dataJSON = JSONObject.fromObject(result);
|
| | | JSONArray array = dataJSON.optJSONArray("suggest_list");
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | String sk = array.optJSONObject(i).optJSONObject("item_data").optString("suggestion");
|
| | | if (!StringUtil.isNullOrEmpty(sk))
|
| | | list.add(sk);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | }
|
| | | return list;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | <!-- 通用模板缓存 -->
|
| | | <cache name="commonContentCache" maxElementsInMemory="1000"
|
| | | maxElementsOnDisk="10000" eternal="false" timeToIdleSeconds="120"
|
| | | timeToLiveSeconds="120" overflowToDisk="true"
|
| | | maxElementsOnDisk="10000" eternal="false" timeToIdleSeconds="1800"
|
| | | timeToLiveSeconds="1800" overflowToDisk="true"
|
| | | memoryStoreEvictionPolicy="LRU" />
|
| | |
|
| | |
|