diff --git a/ruoyi-admin/src/main/java/com/ruoyi/business/controller/MeituanController.java b/ruoyi-admin/src/main/java/com/ruoyi/business/controller/MeituanController.java index e1dad79..472ad37 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/business/controller/MeituanController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/business/controller/MeituanController.java @@ -97,8 +97,10 @@ public class MeituanController { public R orders(String wmPoiId, String date, String cookie) { // String ck = "WEBDFPID=1720313779673YKASQECfd79fef3d01d5e9aadc18ccd4d0c95072894-1720313779673-1720313779673YKASQECfd79fef3d01d5e9aadc18ccd4d0c95072894; _lxsdk_cuid=1908ab11622c8-05c631efe52fbf-26031d51-1fa400-1908ab11623c8; _lxsdk=1908ab11622c8-05c631efe52fbf-26031d51-1fa400-1908ab11623c8; device_uuid=!add95b49-6d31-414c-b096-458e40b710e0; uuid_update=true; shopCategory=food; JSESSIONID=166osatxa3vej17siwfi3kfzso; logan_session_token=y5xcyzjk6epwp80j79nx; acctId=160394866; token=0vqM7ZAhWG5gEXioWJq2CpJTDb5vmeQ64StlZHudt6Pk*; wmPoiId=18277065; isOfflineSelfOpen=0; city_id=440100; isChain=0; ignore_set_router_proxy=false; region_id=1000440100; region_version=1687236854; set_info=%7B%22ignoreSetRouterProxy%22%3Afalse%2C%22region_id%22%3A%221000440100%22%2C%22region_version%22%3A1687236854%2C%22wmPoiId%22%3A18277065%7D; bsid=LA-NjGQthUuIAYmATre3dMUaeO3fwl-hrGQwBLxOUSxeJmBKyXpk1tC7WdiUH4UoqHDtHHYPiymWJM5KJ80Vag; city_location_id=440100; location_id=440103; wpush_server_url=wss%3A%2F%2Fwpush.meituan.com; has_not_waimai_poi=0; _lxsdk_s=1908ab11624-5f4-1f2-8a6%7C%7C5"; // String d = "2024-07-07"; -// String poiId = "18277065"; - iMeituanService.orderInfo(wmPoiId, date, cookie,""); +// String poiId = "23813665"; + String getUrl = proxyProperties.gettpsUrl(); +// iMeituanService.orderInfo(poiId, d, ck,getUrl); + iMeituanService.orderInfo(wmPoiId, date, cookie,getUrl); return R.ok(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/MeituanServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/MeituanServiceImpl.java index 7d5bee4..7876fb1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/MeituanServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/MeituanServiceImpl.java @@ -295,37 +295,6 @@ public class MeituanServiceImpl implements IMeituanService { return "ok"; } - @Autowired - private AsyncTaskImpl asyncTask; - /** - * 获取订单批量 - * - * @return - */ - @Override - public String orderInfoList() { - log.error(("拉取订单开始: ")); - BusStoreInfo busStoreInfo = new BusStoreInfo(); - busStoreInfo.setReturnVisitStatus("1"); - String getUrl = proxyProperties.gettpsUrl(); - List busStoreInfoList = busStoreInfoMapper.selectBusStoreInfoList(busStoreInfo); - long startTime = System.currentTimeMillis(); // 开始时间 - List> list1= SplitListUtils.pagingList(busStoreInfoList,20); //拆分集合 - CountDownLatch countDownLatch = new CountDownLatch(list1.size()); - for (List list2 : list1) { - asyncTask.executeAsync(list2,getUrl,countDownLatch); - } - try { - countDownLatch.await(); //保证之前的所有的线程都执行完成,才会走下面的; - long endTime = System.currentTimeMillis(); //结束时间 - log.error(("拉取订单结束,一共耗时time: " + (endTime - startTime) / 1000 + " s")); - // 这样就可以在下面拿到所有线程执行完的集合结果 - } catch (Exception e) { - log.error("阻塞异常:"+e.getMessage()); - } - return "ok"; - } - /** * 昨日订单量 * @param storeInfo @@ -356,7 +325,7 @@ public class MeituanServiceImpl implements IMeituanService { try { result = EntityUtils.toString(httpClient.execute(request).getEntity()); } catch (Exception e) { - log.error("昨日订单量异常跳出",e.getMessage()); + log.error("昨日订单量异常跳出"+e.getMessage()); return false; } if (result != null) { @@ -389,6 +358,37 @@ public class MeituanServiceImpl implements IMeituanService { return true; } + @Autowired + private AsyncTaskImpl asyncTask; + /** + * 获取订单批量 + * + * @return + */ + @Override + public String orderInfoList() { + log.error(("拉取订单开始: ")); + BusStoreInfo busStoreInfo = new BusStoreInfo(); + busStoreInfo.setReturnVisitStatus("1"); + String getUrl = proxyProperties.gettpsUrl(); + List busStoreInfoList = busStoreInfoMapper.selectBusStoreInfoList(busStoreInfo); + long startTime = System.currentTimeMillis(); // 开始时间 + List> list1= SplitListUtils.pagingList(busStoreInfoList,20); //拆分集合 + CountDownLatch countDownLatch = new CountDownLatch(list1.size()); + for (List list2 : list1) { + asyncTask.executeAsync(list2,getUrl,countDownLatch); + } + try { + countDownLatch.await(); //保证之前的所有的线程都执行完成,才会走下面的; + long endTime = System.currentTimeMillis(); //结束时间 + log.error(("拉取订单结束,一共耗时time: " + (endTime - startTime) / 1000 + " s")); + // 这样就可以在下面拿到所有线程执行完的集合结果 + } catch (Exception e) { + log.error("阻塞异常:"+e.getMessage()); + } + return "ok"; + } + /** * 获取订单 * @@ -413,7 +413,7 @@ public class MeituanServiceImpl implements IMeituanService { String key = wmPoiId +"-"+ date; while (array != null && array.size() > 0) { - List list = new ArrayList<>(); + List list = new Vector<>(); for (int i = 0; i < array.size(); i++) { Object o = array.get(i); JSONObject oj = JSONObject.parseObject(JSON.toJSONString(o)); @@ -434,7 +434,7 @@ public class MeituanServiceImpl implements IMeituanService { String data = Optional.ofNullable(redisTemplate.opsForValue().get(key)).orElse(null); if (data == null) { - List s1 = new ArrayList<>(); + List s1 = new Vector<>(); s1.add(wmOrderViewId); redisTemplate.opsForValue().set(key,JSON.toJSONString(s1)); }else{ @@ -548,7 +548,7 @@ public class MeituanServiceImpl implements IMeituanService { List lsList = ls.stream().filter(x -> x.getPrivcyPhone() != null && x.getRecipientPhone() != null && x.getRecipientBindedPhone() != null).collect(Collectors.toList()); List lsList1 = ls.stream().filter(x -> x.getPrivcyPhone() == null && x.getRecipientPhone() == null && x.getRecipientBindedPhone() == null).collect(Collectors.toList()); - List lss = new ArrayList<>(); + List lss = new Vector<>(); for (BusOrderInfo info : lsList) { BusReturnVisitInfo returnVisitInfo1 = new BusReturnVisitInfo(); returnVisitInfo1.setStoreCode(info.getStoreCode()); @@ -686,7 +686,7 @@ public class MeituanServiceImpl implements IMeituanService { try { result = EntityUtils.toString(httpClient.execute(request).getEntity()); } catch (Exception e) { - log.error("拼好饭订单数拉取失败",e.getMessage()); + log.error("拼好饭订单数拉取失败"+e.getMessage()); } JSONObject json = JSONObject.parseObject(result); String code = json.getString("code"); @@ -872,11 +872,11 @@ public class MeituanServiceImpl implements IMeituanService { result = URLEncoder.encode(result); response.close(); } catch (IOException e) { - log.error("*********mtgsigInfo e*********",e.getMessage()); + log.error("*********mtgsigInfo e*********"+e.getMessage()); try { httpClient.close(); } catch (IOException ex) { - log.error("*********mtgsigInfo ex*********",ex.getMessage()); + log.error("*********mtgsigInfo ex*********"+ex.getMessage()); } } return result; @@ -904,7 +904,6 @@ public class MeituanServiceImpl implements IMeituanService { }else{ BusStoreDayHistoryInfo target = new BusStoreDayHistoryInfo(); BeanUtils.copyProperties(busStoreDayInfo, target); - target.setId(null); target.setCreateTime(Date.from(date.atZone(ZoneId.systemDefault()).toInstant())); editList.add(target); } @@ -1058,7 +1057,7 @@ public class MeituanServiceImpl implements IMeituanService { } return true; } catch (Exception e) { - log.error("获取好评数五星数失败",e.getMessage()); + log.error("获取好评数五星数失败"+e.getMessage()); return false; } }