1; 丢单问题处理 多线程加 隧道
This commit is contained in:
parent
01bed91f03
commit
e7ae1f1ccc
|
@ -81,6 +81,7 @@ public class MeituanController {
|
||||||
* 批量获取订单
|
* 批量获取订单
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("批量获取订单")
|
||||||
@GetMapping("/orderInfoList")
|
@GetMapping("/orderInfoList")
|
||||||
public R orderInfoList() {
|
public R orderInfoList() {
|
||||||
String result = iMeituanService.orderInfoList();
|
String result = iMeituanService.orderInfoList();
|
||||||
|
|
|
@ -71,6 +71,7 @@ spring:
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
host: 43.140.224.18
|
host: 43.140.224.18
|
||||||
|
# host: localhost
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6379
|
port: 6379
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
|
|
|
@ -182,7 +182,7 @@ public class ProxyProperties {
|
||||||
* 隧道 ip获取
|
* 隧道 ip获取
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String gettps(){
|
public String gettpsUrl(){
|
||||||
CloseableHttpClient httpclient = HttpClients.createDefault();
|
CloseableHttpClient httpclient = HttpClients.createDefault();
|
||||||
try {
|
try {
|
||||||
String params = "?secret_id=" + secretId + "&num=1&signature=" + secretKey;
|
String params = "?secret_id=" + secretId + "&num=1&signature=" + secretKey;
|
||||||
|
@ -209,9 +209,9 @@ public class ProxyProperties {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
public static void main(String[] args) {
|
// public static void main(String[] args) {
|
||||||
ProxyProperties proxyProperties = new ProxyProperties();
|
// ProxyProperties proxyProperties = new ProxyProperties();
|
||||||
System.out.println(proxyProperties.gettps());
|
// System.out.println(proxyProperties.gettpsUrl());
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,8 @@ public class AsyncTaskImpl {
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
//异步线程要做的事情
|
//异步线程要做的事情
|
||||||
for (BusStoreInfo store : busStoreInfoList) {
|
for (BusStoreInfo store : busStoreInfoList) {
|
||||||
// R flag = iMeituanService.orderInfo(store.getStoreCode(),now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),store.getStoreCookie());
|
R flag = iMeituanService.orderInfo(store.getStoreCode(),now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),store.getStoreCookie());
|
||||||
R flag = R.fail();
|
// R flag = R.fail();
|
||||||
if (flag.getCode() != 200) {
|
if (flag.getCode() != 200) {
|
||||||
System.out.println(store.getStoreName()+"获取订单信息返回错误..."+store.getStoreCode());
|
System.out.println(store.getStoreName()+"获取订单信息返回错误..."+store.getStoreCode());
|
||||||
}
|
}
|
||||||
|
|
|
@ -283,7 +283,6 @@ 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(); // 开始时间
|
||||||
//boolean a=studentService.batchInsert(list);
|
|
||||||
List<List<BusStoreInfo>> list1= SplitListUtils.pagingList(busStoreInfoList,4); //拆分集合
|
List<List<BusStoreInfo>> list1= SplitListUtils.pagingList(busStoreInfoList,4); //拆分集合
|
||||||
CountDownLatch countDownLatch = new CountDownLatch(list1.size());
|
CountDownLatch countDownLatch = new CountDownLatch(list1.size());
|
||||||
for (List<BusStoreInfo> list2 : list1) {
|
for (List<BusStoreInfo> list2 : list1) {
|
||||||
|
@ -385,157 +384,163 @@ public class MeituanServiceImpl implements IMeituanService {
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public R orderInfo(String wmPoiId, String date, String cookie) { //根据date,查询前一天的key,如果有,则删除
|
public R orderInfo(String wmPoiId, String date, String cookie) { //根据date,查询前一天的key,如果有,则删除
|
||||||
|
try {
|
||||||
|
int pageNum = 1;
|
||||||
|
String getUrl = proxyProperties.gettpsUrl();
|
||||||
|
JSONObject jsonObject = merchantOrders(getUrl,pageNum, date, cookie);
|
||||||
|
String code = jsonObject.getString("code");
|
||||||
|
if ("0".equals(code)) {
|
||||||
|
JSONArray array = jsonObject.getJSONObject("data").getJSONArray("wmOrderList");
|
||||||
|
|
||||||
|
boolean flag = false;
|
||||||
|
// String key = wmPoiId + date;
|
||||||
|
// String lastDayseq = Optional.ofNullable(redisTemplate.opsForValue().get(key)).orElse(null);
|
||||||
|
while (array != null && array.size() > 0) {
|
||||||
|
// if (flag) {
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
List<BusOrderInfo> list = new ArrayList<>();
|
||||||
|
for (int i = 0; i < array.size(); i++) {
|
||||||
|
BusOrderInfo orderInfo = new BusOrderInfo();
|
||||||
|
Object o = array.get(i);
|
||||||
|
JSONObject oj = JSONObject.parseObject(JSON.toJSONString(o));
|
||||||
|
try {
|
||||||
|
String businessType = oj.getString("businessType");
|
||||||
|
JSONObject order0 = oj.getJSONObject("orderInfo");
|
||||||
|
JSONObject commonInfo = oj.getJSONObject("commonInfo");
|
||||||
|
String userId = commonInfo.getString("wmUserId");
|
||||||
|
String daySeq = ""; String wmOrderViewId = ""; String orderTimeFmt = ""; String expectTime = ""; String statusDesc = ""; String orderCount = "";
|
||||||
|
String privacyPhone = null; String recipientPhone = null; String recipientBindedPhone = null;
|
||||||
|
if ("1".equals(businessType)) {
|
||||||
|
JSONObject order1 = order0.getJSONObject("orderInfo");
|
||||||
|
JSONObject foodInfo = order0.getJSONObject("foodInfo");
|
||||||
|
JSONObject userLabelVo = foodInfo.getJSONObject("userLabelVo");
|
||||||
|
JSONArray array1 = userLabelVo.getJSONArray("contents");
|
||||||
|
String info = array1.getJSONObject(0).getString("info");
|
||||||
|
JSONObject expectTimeVo = order1.getJSONObject("expectTimeVo");
|
||||||
|
daySeq = order1.getString("dayseq");
|
||||||
|
wmOrderViewId = order1.getString("wmOrderViewId");
|
||||||
|
orderTimeFmt = "2024-"+order1.getString("orderTimeFmt");
|
||||||
|
expectTime = expectTimeVo.getString("expectTimeFmt");
|
||||||
|
statusDesc = order1.getString("statusDesc");
|
||||||
|
if ("门店新客".equals(info)){
|
||||||
|
orderCount = "1";
|
||||||
|
} else if (info.contains("下单")){
|
||||||
|
orderCount = info.substring(info.indexOf("下单")+2,info.length()-1);
|
||||||
|
}
|
||||||
|
}else if("2".equals(businessType)){
|
||||||
|
statusDesc = "用户已收餐";
|
||||||
|
wmOrderViewId = commonInfo.getString("wm_order_id_view");
|
||||||
|
orderTimeFmt = order0.getString("order_time_fmt");
|
||||||
|
expectTime = order0.getString("expectTimeFmt");
|
||||||
|
daySeq = commonInfo.getString("wm_poi_order_dayseq");
|
||||||
|
privacyPhone = order0.getString("privacy_phone");
|
||||||
|
recipientPhone = order0.getString("recipient_phone");
|
||||||
|
recipientBindedPhone = order0.getString("recipient_bindedPhone");
|
||||||
|
|
||||||
|
|
||||||
|
orderCount = getOrderCountByType(getUrl,wmOrderViewId,cookie);
|
||||||
|
|
||||||
int pageNum = 1;
|
|
||||||
String getUrl = null;
|
|
||||||
JSONObject jsonObject = merchantOrders(getUrl,pageNum, date, cookie);
|
|
||||||
String code = jsonObject.getString("code");
|
|
||||||
if ("0".equals(code)) {
|
|
||||||
JSONArray array = jsonObject.getJSONObject("data").getJSONArray("wmOrderList");
|
|
||||||
|
|
||||||
boolean flag = false;
|
|
||||||
String key = wmPoiId + date;
|
|
||||||
String lastDayseq = Optional.ofNullable(redisTemplate.opsForValue().get(key)).orElse(null);
|
|
||||||
while (array != null && array.size() > 0) {
|
|
||||||
if (flag) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
List<BusOrderInfo> list = new ArrayList<>();
|
|
||||||
for (int i = 0; i < array.size(); i++) {
|
|
||||||
BusOrderInfo orderInfo = new BusOrderInfo();
|
|
||||||
Object o = array.get(i);
|
|
||||||
JSONObject oj = JSONObject.parseObject(JSON.toJSONString(o));
|
|
||||||
try {
|
|
||||||
String businessType = oj.getString("businessType");
|
|
||||||
JSONObject order0 = oj.getJSONObject("orderInfo");
|
|
||||||
JSONObject commonInfo = oj.getJSONObject("commonInfo");
|
|
||||||
String userId = commonInfo.getString("wmUserId");
|
|
||||||
String daySeq = ""; String wmOrderViewId = ""; String orderTimeFmt = ""; String expectTime = ""; String statusDesc = ""; String orderCount = "";
|
|
||||||
String privacyPhone = null; String recipientPhone = null; String recipientBindedPhone = null;
|
|
||||||
if ("1".equals(businessType)) {
|
|
||||||
JSONObject order1 = order0.getJSONObject("orderInfo");
|
|
||||||
JSONObject foodInfo = order0.getJSONObject("foodInfo");
|
|
||||||
JSONObject userLabelVo = foodInfo.getJSONObject("userLabelVo");
|
|
||||||
JSONArray array1 = userLabelVo.getJSONArray("contents");
|
|
||||||
String info = array1.getJSONObject(0).getString("info");
|
|
||||||
JSONObject expectTimeVo = order1.getJSONObject("expectTimeVo");
|
|
||||||
daySeq = order1.getString("dayseq");
|
|
||||||
wmOrderViewId = order1.getString("wmOrderViewId");
|
|
||||||
orderTimeFmt = "2024-"+order1.getString("orderTimeFmt");
|
|
||||||
expectTime = expectTimeVo.getString("expectTimeFmt");
|
|
||||||
statusDesc = order1.getString("statusDesc");
|
|
||||||
if ("门店新客".equals(info)){
|
|
||||||
orderCount = "1";
|
|
||||||
} else if (info.contains("下单")){
|
|
||||||
orderCount = info.substring(info.indexOf("下单")+2,info.length()-1);
|
|
||||||
}
|
}
|
||||||
}else if("2".equals(businessType)){
|
// String redisDaySeq = Optional.ofNullable(redisTemplate.opsForValue().get(key)).orElse(null);
|
||||||
statusDesc = "用户已收餐";
|
// if (redisDaySeq == null) {
|
||||||
wmOrderViewId = commonInfo.getString("wm_order_id_view");
|
// redisTemplate.opsForValue().set(key, daySeq);
|
||||||
orderTimeFmt = order0.getString("order_time_fmt");
|
// } else {
|
||||||
expectTime = order0.getString("expectTimeFmt");
|
// if (Integer.valueOf(daySeq) > Integer.valueOf(redisDaySeq)) {
|
||||||
daySeq = commonInfo.getString("wm_poi_order_dayseq");
|
// redisTemplate.opsForValue().set(key, daySeq);
|
||||||
privacyPhone = order0.getString("privacy_phone");
|
// }
|
||||||
recipientPhone = order0.getString("recipient_phone");
|
// if (daySeq.equals(lastDayseq)) {
|
||||||
recipientBindedPhone = order0.getString("recipient_bindedPhone");
|
// flag = true;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
orderInfo.setStoreCode(wmPoiId);
|
||||||
|
orderInfo.setDayseq(daySeq);
|
||||||
|
orderInfo.setOrderNo(wmOrderViewId);
|
||||||
|
|
||||||
|
if(expectTime.contains("今日")){
|
||||||
orderCount = getOrderCountByType(getUrl,wmOrderViewId,cookie);
|
expectTime = expectTime.substring(3,expectTime.length());
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
String redisDaySeq = Optional.ofNullable(redisTemplate.opsForValue().get(key)).orElse(null);
|
|
||||||
if (redisDaySeq == null) {
|
|
||||||
redisTemplate.opsForValue().set(key, daySeq);
|
|
||||||
} else {
|
|
||||||
if (Integer.valueOf(daySeq) > Integer.valueOf(redisDaySeq)) {
|
|
||||||
redisTemplate.opsForValue().set(key, daySeq);
|
|
||||||
}
|
}
|
||||||
if (daySeq.equals(lastDayseq)) {
|
|
||||||
flag = true;
|
BusStoreInfo storeInfo = new BusStoreInfo();
|
||||||
break;
|
storeInfo.setStoreCode(wmPoiId);
|
||||||
|
BusStoreInfo storeInfo1 = busStoreInfoMapper.selectBusStoreInfoList(storeInfo).get(0);
|
||||||
|
|
||||||
|
orderInfo.setStoreName(storeInfo1.getStoreName());
|
||||||
|
|
||||||
|
String completeTime = "2024-"+expectTime;
|
||||||
|
if (completeTime.contains("门店设置")){
|
||||||
|
completeTime = completeTime.replaceAll("门店设置","");
|
||||||
|
}
|
||||||
|
if (completeTime.contains("约今日")){
|
||||||
|
completeTime = completeTime.replaceAll("约今日 ","");
|
||||||
|
}
|
||||||
|
if (completeTime.contains("明日")){
|
||||||
|
completeTime = completeTime.replaceAll("明日 ","");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
orderInfo.setStoreCode(wmPoiId);
|
|
||||||
orderInfo.setDayseq(daySeq);
|
|
||||||
orderInfo.setOrderNo(wmOrderViewId);
|
|
||||||
|
|
||||||
if(expectTime.contains("今日")){
|
orderInfo.setCompleteTime(completeTime);
|
||||||
expectTime = expectTime.substring(3,expectTime.length());
|
orderInfo.setOrderStatus(statusDesc);
|
||||||
|
orderInfo.setCustomId(userId);
|
||||||
|
orderInfo.setOrderCount(orderCount);
|
||||||
|
orderInfo.setPrivcyPhone(privacyPhone);
|
||||||
|
orderInfo.setRecipientPhone(recipientPhone);
|
||||||
|
orderInfo.setRecipientBindedPhone(recipientBindedPhone);
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||||
|
try {
|
||||||
|
orderInfo.setOrderTime(format.parse(orderTimeFmt));
|
||||||
|
} catch (ParseException e) {
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
}
|
||||||
|
orderInfo.setIsPhf(businessType);
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
list.add(orderInfo);
|
||||||
|
}
|
||||||
|
if (list.size() > 0) {
|
||||||
|
List<BusOrderInfo> newList = list.stream().collect(Collectors.toMap(BusOrderInfo::getOrderNo, p->p,(p1, p2)->p1)).values().stream().collect(Collectors.toList());
|
||||||
|
|
||||||
|
priPhoneInfo(newList,cookie,getUrl);
|
||||||
|
}else{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
pageNum += 1;
|
||||||
|
|
||||||
|
JSONObject jo = merchantOrders(getUrl,pageNum, date, cookie);
|
||||||
|
if ("0".equals(jo.getString("code"))) {
|
||||||
|
array = jo.getJSONObject("data").getJSONArray("wmOrderList");
|
||||||
|
} else if ("1001".equals(jo.getString("code"))) {
|
||||||
BusStoreInfo storeInfo = new BusStoreInfo();
|
BusStoreInfo storeInfo = new BusStoreInfo();
|
||||||
storeInfo.setStoreCode(wmPoiId);
|
storeInfo.setStoreCode(wmPoiId);
|
||||||
BusStoreInfo storeInfo1 = busStoreInfoMapper.selectBusStoreInfoList(storeInfo).get(0);
|
BusStoreInfo storeInfo1 = busStoreInfoMapper.selectBusStoreInfoList(storeInfo).get(0);
|
||||||
|
storeInfo1.setGrantStatus("2");
|
||||||
|
busStoreInfoMapper.updateBusStoreInfo(storeInfo1);
|
||||||
|
|
||||||
orderInfo.setStoreName(storeInfo1.getStoreName());
|
System.out.println(jo.getString("msg"));
|
||||||
|
return R.fail(jo.getString("msg"));
|
||||||
String completeTime = "2024-"+expectTime;
|
|
||||||
if (completeTime.contains("门店设置")){
|
|
||||||
completeTime = completeTime.replaceAll("门店设置","");
|
|
||||||
}
|
|
||||||
if (completeTime.contains("约今日")){
|
|
||||||
completeTime = completeTime.replaceAll("约今日 ","");
|
|
||||||
}
|
|
||||||
if (completeTime.contains("明日")){
|
|
||||||
completeTime = completeTime.replaceAll("明日 ","");
|
|
||||||
}
|
|
||||||
|
|
||||||
orderInfo.setCompleteTime(completeTime);
|
|
||||||
orderInfo.setOrderStatus(statusDesc);
|
|
||||||
orderInfo.setCustomId(userId);
|
|
||||||
orderInfo.setOrderCount(orderCount);
|
|
||||||
orderInfo.setPrivcyPhone(privacyPhone);
|
|
||||||
orderInfo.setRecipientPhone(recipientPhone);
|
|
||||||
orderInfo.setRecipientBindedPhone(recipientBindedPhone);
|
|
||||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
||||||
try {
|
|
||||||
orderInfo.setOrderTime(format.parse(orderTimeFmt));
|
|
||||||
} catch (ParseException e) {
|
|
||||||
System.out.println(e.getMessage());
|
|
||||||
}
|
|
||||||
orderInfo.setIsPhf(businessType);
|
|
||||||
}catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
list.add(orderInfo);
|
|
||||||
}
|
|
||||||
if (list.size() > 0) {
|
|
||||||
List<BusOrderInfo> newList = list.stream().collect(Collectors.toMap(BusOrderInfo::getOrderNo, p->p,(p1, p2)->p1)).values().stream().collect(Collectors.toList());
|
|
||||||
|
|
||||||
priPhoneInfo(newList,cookie,getUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
pageNum += 1;
|
|
||||||
|
|
||||||
JSONObject jo = merchantOrders(getUrl,pageNum, date, cookie);
|
|
||||||
if ("0".equals(jo.getString("code"))) {
|
|
||||||
array = jo.getJSONObject("data").getJSONArray("wmOrderList");
|
|
||||||
} else if ("1001".equals(jo.getString("code"))) {
|
|
||||||
BusStoreInfo storeInfo = new BusStoreInfo();
|
|
||||||
storeInfo.setStoreCode(wmPoiId);
|
|
||||||
BusStoreInfo storeInfo1 = busStoreInfoMapper.selectBusStoreInfoList(storeInfo).get(0);
|
|
||||||
storeInfo1.setGrantStatus("2");
|
|
||||||
busStoreInfoMapper.updateBusStoreInfo(storeInfo1);
|
|
||||||
|
|
||||||
System.out.println(jo.getString("msg"));
|
|
||||||
return R.fail(jo.getString("msg"));
|
|
||||||
}
|
}
|
||||||
|
return R.ok();
|
||||||
|
} else if ("1001".equals(code)) {
|
||||||
|
BusStoreInfo storeInfo = new BusStoreInfo();
|
||||||
|
storeInfo.setStoreCode(wmPoiId);
|
||||||
|
BusStoreInfo storeInfo1 = busStoreInfoMapper.selectBusStoreInfoList(storeInfo).get(0);
|
||||||
|
storeInfo1.setGrantStatus("2");
|
||||||
|
busStoreInfoMapper.updateBusStoreInfo(storeInfo1);
|
||||||
}
|
}
|
||||||
return R.ok();
|
return R.fail(jsonObject.getString("msg"));
|
||||||
} else if ("1001".equals(code)) {
|
}catch (Exception e){
|
||||||
BusStoreInfo storeInfo = new BusStoreInfo();
|
e.printStackTrace();
|
||||||
storeInfo.setStoreCode(wmPoiId);
|
return orderInfo(wmPoiId, date, cookie);
|
||||||
BusStoreInfo storeInfo1 = busStoreInfoMapper.selectBusStoreInfoList(storeInfo).get(0);
|
|
||||||
storeInfo1.setGrantStatus("2");
|
|
||||||
busStoreInfoMapper.updateBusStoreInfo(storeInfo1);
|
|
||||||
}
|
}
|
||||||
return R.fail(jsonObject.getString("msg"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getOrderCountByType(String getUrl, String wmOrderViewId,String cookie){
|
private String getOrderCountByType(String getUrl, String wmOrderViewId,String cookie){
|
||||||
CloseableHttpClient httpClient = proxyHttpClient();
|
CloseableHttpClient httpClient = proxyHttpClient(getUrl);
|
||||||
String url = "https://e.waimai.meituan.com/gw/phf/v2/order/receive/processed/r/orderAsyncInfos/v3";
|
String url = "https://e.waimai.meituan.com/gw/phf/v2/order/receive/processed/r/orderAsyncInfos/v3";
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("region_id", valueFromCookie("region_id",cookie));
|
params.put("region_id", valueFromCookie("region_id",cookie));
|
||||||
|
@ -595,7 +600,7 @@ public class MeituanServiceImpl implements IMeituanService {
|
||||||
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");
|
||||||
|
|
||||||
CloseableHttpClient client = proxyHttpClient();
|
CloseableHttpClient client = proxyHttpClient(getUrl);
|
||||||
// CloseableHttpClient client = HttpClientBuilder.create().build();
|
// CloseableHttpClient client = HttpClientBuilder.create().build();
|
||||||
HttpEntity responseEntity;
|
HttpEntity responseEntity;
|
||||||
String resp = null;
|
String resp = null;
|
||||||
|
@ -715,7 +720,7 @@ public class MeituanServiceImpl implements IMeituanService {
|
||||||
httpPost.setEntity(entity);
|
httpPost.setEntity(entity);
|
||||||
httpPost.setHeader("Cookie", cookie);
|
httpPost.setHeader("Cookie", cookie);
|
||||||
|
|
||||||
CloseableHttpClient client = proxyHttpClient();
|
CloseableHttpClient client = proxyHttpClient(getUrl);
|
||||||
|
|
||||||
String code = null;
|
String code = null;
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
@ -1023,10 +1028,10 @@ public class MeituanServiceImpl implements IMeituanService {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CloseableHttpClient proxyHttpClient() {
|
// private CloseableHttpClient proxyHttpClient() {
|
||||||
// private CloseableHttpClient proxyHttpClient(String ipPort) {
|
private CloseableHttpClient proxyHttpClient(String ipPort) {
|
||||||
String proxyHost = proxyProperties.getProxyAddr();
|
String proxyHost = ipPort.split(":")[0];
|
||||||
int proxyPort = proxyProperties.getProxyPort();
|
int proxyPort = Integer.valueOf(ipPort.split(":")[1]);
|
||||||
String username = proxyProperties.getAccount();
|
String username = proxyProperties.getAccount();
|
||||||
String password = proxyProperties.getPwd();
|
String password = proxyProperties.getPwd();
|
||||||
HttpHost proxy = new HttpHost(proxyHost, proxyPort);
|
HttpHost proxy = new HttpHost(proxyHost, proxyPort);
|
||||||
|
@ -1076,5 +1081,22 @@ public class MeituanServiceImpl implements IMeituanService {
|
||||||
// httpclient.close();
|
// httpclient.close();
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
private CloseableHttpClient proxyHttpClient() {
|
||||||
|
String proxyHost = proxyProperties.getProxyAddr();
|
||||||
|
int proxyPort = proxyProperties.getProxyPort();
|
||||||
|
String username = proxyProperties.getAccount();
|
||||||
|
String password = proxyProperties.getPwd();
|
||||||
|
HttpHost proxy = new HttpHost(proxyHost, proxyPort);
|
||||||
|
CredentialsProvider credsProvider = new BasicCredentialsProvider();
|
||||||
|
credsProvider.setCredentials(new AuthScope(proxyHost, proxyPort),
|
||||||
|
new UsernamePasswordCredentials(username, password));
|
||||||
|
RequestConfig config = RequestConfig.custom().setProxy(proxy).build();
|
||||||
|
CloseableHttpClient httpClient = HttpClients
|
||||||
|
.custom()
|
||||||
|
.setDefaultRequestConfig(config)
|
||||||
|
.setDefaultCredentialsProvider(credsProvider)
|
||||||
|
.build();
|
||||||
|
// CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(config).build();
|
||||||
|
return httpClient;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select ai_duration_balance
|
select ai_duration_balance
|
||||||
from bus_agent_info
|
from bus_agent_info
|
||||||
where agent_account = #{account}
|
where agent_account = #{account}
|
||||||
|
and del_status = '1'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertBusAgentInfo" parameterType="BusAgentInfo">
|
<insert id="insertBusAgentInfo" parameterType="BusAgentInfo">
|
||||||
|
|
Loading…
Reference in New Issue