1; 自配送时长限定180分钟

2;优化拉取方法
This commit is contained in:
wangshuai 2024-08-01 21:51:00 +08:00
parent 24e4ff8253
commit 7793d67963
9 changed files with 31 additions and 21 deletions

View File

@ -107,6 +107,7 @@ public class BusAgentInfoController extends BaseController {
} }
@GetMapping("/listA") @GetMapping("/listA")
public AjaxResult listA(BusAgentInfo busAgentInfo) { public AjaxResult listA(BusAgentInfo busAgentInfo) {
busAgentInfo.setDelStatus("1");
List<BusAgentInfo> list = busAgentInfoService.selectBusAgentInfoList(busAgentInfo); List<BusAgentInfo> list = busAgentInfoService.selectBusAgentInfoList(busAgentInfo);
return success(list); return success(list);
} }

View File

@ -92,12 +92,13 @@ public class MeituanController {
* 获取订单 * 获取订单
* @return * @return
*/ */
@ApiOperation("拉取测试")
@GetMapping("/getOrders") @GetMapping("/getOrders")
public R orders(String wmPoiId, String date, String cookie) { 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 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 d = "2024-07-07";
String poiId = "18277065"; // String poiId = "18277065";
return iMeituanService.orderInfo(poiId, d, ck); return iMeituanService.orderInfo(wmPoiId, date, cookie);
} }
/** /**

View File

@ -18,10 +18,10 @@ import java.util.concurrent.ThreadPoolExecutor;
public class ThreadPoolConfig public class ThreadPoolConfig
{ {
// 核心线程池大小 // 核心线程池大小
private int corePoolSize = 15; private int corePoolSize = 20;
// 最大可创建的线程数 // 最大可创建的线程数
private int maxPoolSize = 30; private int maxPoolSize = 40;
// 队列最大长度 // 队列最大长度
private int queueCapacity = 500; private int queueCapacity = 500;

View File

@ -63,7 +63,7 @@ public interface BusOrderInfoMapper
int batchupdateBusOrderInfo(@Param("lcs") List<BusOrderInfo> lcs); int batchupdateBusOrderInfo(@Param("lcs") List<BusOrderInfo> lcs);
List<BusOrderInfo> selectBusOrderInfoListToAi(@Param("storeCode") String storeCode, @Param("t1") String t1,@Param("t2") String t2); List<BusOrderInfo> selectBusOrderInfoListToAi(@Param("storeCode") String storeCode, @Param("t1") String t1,@Param("t2") String t2);
List<BusOrderInfo> selectBusZpsOrderInfoListToAi(@Param("storeCode") String storeCode, @Param("t2") String t2); List<BusOrderInfo> selectBusZpsOrderInfoListToAi(@Param("storeCode") String storeCode, @Param("t1") String t1, @Param("t2") String t2);
List<BusOrderInfo> selectBusOrderInfoListA(BusOrderInfo busOrderInfo); List<BusOrderInfo> selectBusOrderInfoListA(BusOrderInfo busOrderInfo);
} }

View File

@ -61,7 +61,7 @@ public interface IBusOrderInfoService
List<BusOrderInfo> selectBusOrderInfoListToAi(String storeCode, String t1, String t2); List<BusOrderInfo> selectBusOrderInfoListToAi(String storeCode, String t1, String t2);
List<BusOrderInfo> selectBusZpsOrderInfoListToAi(String storeCode, String t2); List<BusOrderInfo> selectBusZpsOrderInfoListToAi(String storeCode, String t1, String t2);
List<BusOrderInfo> selectBusOrderInfoListA(BusOrderInfo busOrderInfo); List<BusOrderInfo> selectBusOrderInfoListA(BusOrderInfo busOrderInfo);
} }

View File

@ -252,10 +252,12 @@ public class AiServiceImpl implements IAiService {
list = orderInfoService.selectBusOrderInfoListToAi(busStoreInfo.getStoreCode(), t1, t2); list = orderInfoService.selectBusOrderInfoListToAi(busStoreInfo.getStoreCode(), t1, t2);
} else if ("2".equals(busStoreInfo.getSelfDeliveryStatus())) { } else if ("2".equals(busStoreInfo.getSelfDeliveryStatus())) {
log.error("自配送营销"); log.error("自配送营销");
LocalDateTime t180 = now.minusMinutes(180);
String t18 = t180.format(formatter);
LocalDateTime tN = now.minusMinutes(busStoreConfigInfo.getSelfDeliveryDuration()); LocalDateTime tN = now.minusMinutes(busStoreConfigInfo.getSelfDeliveryDuration());
String time = tN.format(dateTimeFormatter); String time = tN.format(formatter);
// 自配送前推时间处理 // 自配送前推时间处理
list = orderInfoService.selectBusZpsOrderInfoListToAi(busStoreInfo.getStoreCode(), time); list = orderInfoService.selectBusZpsOrderInfoListToAi(busStoreInfo.getStoreCode(), t18, time);
} }
if (list.size() == 0) continue; if (list.size() == 0) continue;

View File

@ -97,8 +97,8 @@ public class BusOrderInfoServiceImpl implements IBusOrderInfoService
} }
@Override @Override
public List<BusOrderInfo> selectBusZpsOrderInfoListToAi(String storeCode, String t2) { public List<BusOrderInfo> selectBusZpsOrderInfoListToAi(String storeCode, String t1, String t2) {
return busOrderInfoMapper.selectBusZpsOrderInfoListToAi(storeCode, t2); return busOrderInfoMapper.selectBusZpsOrderInfoListToAi(storeCode, t1, t2);
} }
@Override @Override

View File

@ -283,7 +283,7 @@ public class MeituanServiceImpl implements IMeituanService {
busStoreInfo.setReturnVisitStatus("1"); busStoreInfo.setReturnVisitStatus("1");
List<BusStoreInfo> busStoreInfoList = busStoreInfoMapper.selectBusStoreInfoList(busStoreInfo); List<BusStoreInfo> busStoreInfoList = busStoreInfoMapper.selectBusStoreInfoList(busStoreInfo);
long startTime = System.currentTimeMillis(); // 开始时间 long startTime = System.currentTimeMillis(); // 开始时间
List<List<BusStoreInfo>> list1= SplitListUtils.pagingList(busStoreInfoList,30); //拆分集合 List<List<BusStoreInfo>> list1= SplitListUtils.pagingList(busStoreInfoList,20); //拆分集合
CountDownLatch countDownLatch = new CountDownLatch(list1.size()); CountDownLatch countDownLatch = new CountDownLatch(list1.size());
for (List<BusStoreInfo> list2 : list1) { for (List<BusStoreInfo> list2 : list1) {
asyncTask.executeAsync(list2,busStoreInfoMapper,countDownLatch); asyncTask.executeAsync(list2,busStoreInfoMapper,countDownLatch);
@ -532,6 +532,11 @@ public class MeituanServiceImpl implements IMeituanService {
returnVisitInfo1.setStoreName(info.getStoreName()); returnVisitInfo1.setStoreName(info.getStoreName());
returnVisitInfo1.setPhoneEndNumber(info.getRecipientPhone()); returnVisitInfo1.setPhoneEndNumber(info.getRecipientPhone());
returnVisitInfo1.setPhoneNumber(info.getPrivcyPhone()); returnVisitInfo1.setPhoneNumber(info.getPrivcyPhone());
try {
returnVisitInfo1.setOrderCompleteTime(sdf.parse(info.getCompleteTime()));
} catch (ParseException e) {
log.error("****************拼好饭-回访表订单日期异常:****************");
}
lss.add(returnVisitInfo1); lss.add(returnVisitInfo1);
} }
for (BusOrderInfo orderInfo : lsList1) { for (BusOrderInfo orderInfo : lsList1) {
@ -591,7 +596,7 @@ public class MeituanServiceImpl implements IMeituanService {
orderInfo.setRecipientPhone(recipientPhone); orderInfo.setRecipientPhone(recipientPhone);
orderInfo.setRecipientBindedPhone(recipientBindedPhone); orderInfo.setRecipientBindedPhone(recipientBindedPhone);
log.error("****************订单解析成功:****************"+JSON.toJSONString(orderInfo)); // log.error("****************订单解析成功:****************"+JSON.toJSONString(orderInfo));
lsList.add(orderInfo); lsList.add(orderInfo);
@ -604,14 +609,12 @@ public class MeituanServiceImpl implements IMeituanService {
try { try {
returnVisitInfo.setOrderCompleteTime(sdf.parse(orderInfo.getCompleteTime())); returnVisitInfo.setOrderCompleteTime(sdf.parse(orderInfo.getCompleteTime()));
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); log.error("****************回访表订单日期异常:****************");
continue;
} }
lss.add(returnVisitInfo); lss.add(returnVisitInfo);
} }
} }
log.error(ls.get(0).getStoreCode()+"********************************"+lsList.size()); log.error(ls.get(0).getStoreCode()+"********************************busOrderInfo="+lsList.size()+"busReturnVisitInfo="+lss.size());
log.error("********************************"+lss.size());
if (lsList.size() > 0) { if (lsList.size() > 0) {
busOrderInfoMapper.batchInsertOrder(lsList); busOrderInfoMapper.batchInsertOrder(lsList);
} }
@ -678,6 +681,7 @@ public class MeituanServiceImpl implements IMeituanService {
HttpEntity entity = builder.build(); HttpEntity entity = builder.build();
httpPost.setEntity(entity); httpPost.setEntity(entity);
httpPost.setHeader("Cookie", cookie); httpPost.setHeader("Cookie", cookie);
httpPost.setHeader("Accept-Encoding","gzip, deflate, br");
httpPost.setHeader("Host","waimaieapp.meituan.com"); httpPost.setHeader("Host","waimaieapp.meituan.com");
httpPost.setHeader("User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"); httpPost.setHeader("User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36");
@ -718,7 +722,7 @@ public class MeituanServiceImpl implements IMeituanService {
try { try {
result = EntityUtils.toString(client.execute(request).getEntity()); result = EntityUtils.toString(client.execute(request).getEntity());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("*********订单送达时间解析异常*********");
} }
JSONObject jsonObject = JSONObject.parseObject(result); JSONObject jsonObject = JSONObject.parseObject(result);
String code = jsonObject.getString(("code")); String code = jsonObject.getString(("code"));
@ -830,11 +834,11 @@ public class MeituanServiceImpl implements IMeituanService {
result = URLEncoder.encode(result); result = URLEncoder.encode(result);
response.close(); response.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("*********mtgsigInfo e*********",e.getMessage());
try { try {
httpClient.close(); httpClient.close();
} catch (IOException ex) { } catch (IOException ex) {
ex.printStackTrace(); log.error("*********mtgsigInfo ex*********",ex.getMessage());
} }
} }
return result; return result;

View File

@ -73,6 +73,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where b.return_visit_time is null and b.phone_number != '' where b.return_visit_time is null and b.phone_number != ''
and a.store_code = #{storeCode} and a.store_code = #{storeCode}
and a.order_time &lt;= #{t2} and a.order_time &lt;= #{t2}
and a.order_time &gt; #{t1}
and a.order_time &lt;= #{t2}
GROUP BY a.privcy_phone,a.order_no GROUP BY a.privcy_phone,a.order_no
) AS t2 ON t1.order_no = t2.order_no AND t1.id = t2.min_id; ) AS t2 ON t1.order_no = t2.order_no AND t1.id = t2.min_id;
</select> </select>