集成快代理 评分 好评星级

This commit is contained in:
wangshuai 2024-07-06 14:46:09 +08:00
parent 79e29ba300
commit 52f4a1a9b8
5 changed files with 215 additions and 136 deletions

View File

@ -24,19 +24,19 @@ public class BusStoreDayInfo extends BaseEntity
/** 昨日订单量 */
@Excel(name = "昨日订单量")
private Long lastOrderNum;
private int lastOrderNum;
/** 昨日好评量 */
@Excel(name = "昨日好评量")
private Long lastPositiveReviewsNum;
private int lastPositiveReviewsNum;
/** 昨日五星量 */
@Excel(name = "昨日五星量")
private Long lastFiveStarReviewsNum;
private int lastFiveStarReviewsNum;
/** 昨日回访量 */
@Excel(name = "昨日回访量")
private Long lastReturnVisitNum;
private int lastReturnVisitNum;
/** 昨日回访比50% */
@Excel(name = "昨日回访比50%")
@ -44,7 +44,7 @@ public class BusStoreDayInfo extends BaseEntity
/** 今日回访量 */
@Excel(name = "今日回访量")
private Long todayReturnVisitNum;
private int todayReturnVisitNum;
/** 评分 */
@Excel(name = "评分")
@ -68,39 +68,39 @@ public class BusStoreDayInfo extends BaseEntity
{
return storeId;
}
public void setLastOrderNum(Long lastOrderNum)
public void setLastOrderNum(int lastOrderNum)
{
this.lastOrderNum = lastOrderNum;
}
public Long getLastOrderNum()
public int getLastOrderNum()
{
return lastOrderNum;
}
public void setLastPositiveReviewsNum(Long lastPositiveReviewsNum)
public void setLastPositiveReviewsNum(int lastPositiveReviewsNum)
{
this.lastPositiveReviewsNum = lastPositiveReviewsNum;
}
public Long getLastPositiveReviewsNum()
public int getLastPositiveReviewsNum()
{
return lastPositiveReviewsNum;
}
public void setLastFiveStarReviewsNum(Long lastFiveStarReviewsNum)
public void setLastFiveStarReviewsNum(int lastFiveStarReviewsNum)
{
this.lastFiveStarReviewsNum = lastFiveStarReviewsNum;
}
public Long getLastFiveStarReviewsNum()
public int getLastFiveStarReviewsNum()
{
return lastFiveStarReviewsNum;
}
public void setLastReturnVisitNum(Long lastReturnVisitNum)
public void setLastReturnVisitNum(int lastReturnVisitNum)
{
this.lastReturnVisitNum = lastReturnVisitNum;
}
public Long getLastReturnVisitNum()
public int getLastReturnVisitNum()
{
return lastReturnVisitNum;
}
@ -113,12 +113,12 @@ public class BusStoreDayInfo extends BaseEntity
{
return lastReturnVisitRate;
}
public void setTodayReturnVisitNum(Long todayReturnVisitNum)
public void setTodayReturnVisitNum(int todayReturnVisitNum)
{
this.todayReturnVisitNum = todayReturnVisitNum;
}
public Long getTodayReturnVisitNum()
public int getTodayReturnVisitNum()
{
return todayReturnVisitNum;
}

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.business.domain.*;
import com.ruoyi.business.mapper.BusStoreDayInfoMapper;
import com.ruoyi.business.mapper.BusStoreInfoMapper;
import com.ruoyi.business.service.IBusStoreDayInfoService;
import com.ruoyi.business.service.IBusStoreInfoService;
@ -11,7 +12,6 @@ import com.ruoyi.business.service.IMeituanService;
import com.ruoyi.common.config.ProxyProperties;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.HttpClientUtilT;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
@ -23,7 +23,6 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -32,6 +31,8 @@ import org.springframework.stereotype.Service;
import java.io.IOException;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@ -43,8 +44,13 @@ public class MeituanServiceImpl implements IMeituanService {
@Autowired
private BusStoreInfoMapper busStoreInfoMapper;
@Autowired
private BusStoreDayInfoMapper busStoreDayInfoMapper;
@Autowired
private StringRedisTemplate redisTemplate;
@Autowired
private IBusStoreInfoService busStoreInfoService;
@Autowired
@ -54,15 +60,16 @@ public class MeituanServiceImpl implements IMeituanService {
/**
* 获取cookie
*
* @param cookie
* @return
*/
@Override
public R cookieInfo(SysCookie cookie) {
BusStoreInfo storeInfo = new BusStoreInfo();
storeInfo.setStoreCode(valueFromCookie("wmPoiId",cookie.getCookie()));
storeInfo.setStoreCode(valueFromCookie("wmPoiId", cookie.getCookie()));
List<BusStoreInfo> list = busStoreInfoService.selectBusStoreInfoList(storeInfo);
if(list.size()==0){
if (list.size() == 0) {
storeInfo.setBindUser(cookie.getUserName());
storeInfo.setStoreAccount(cookie.getAccount());
storeInfo.setStorePassword(cookie.getPassword());
@ -73,9 +80,14 @@ public class MeituanServiceImpl implements IMeituanService {
storeInfo.setGrantStatus("1");//授权登录状态
storeInfo.setReturnVisitStatus("2");// 营销状态
storeInfo.setSelfDeliveryStatus("1");// 1 正常 2 自配送 3 删除
return R.ok(busStoreInfoService.insertBusStoreInfo(storeInfo));
}else if(list.size()==1){
if(!cookie.getUserName().equals(storeInfo.getBindUser())){
busStoreInfoService.insertBusStoreInfo(storeInfo)
BusStoreDayInfo busStoreDayInfo = new BusStoreDayInfo();
busStoreDayInfo.setStoreId(storeInfo.getId());
busStoreDayInfo.setCreateTime(new Date());
busStoreDayInfoMapper.insertBusStoreDayInfo(busStoreDayInfo)
return R.ok();
} else if (list.size() == 1) {
if (!cookie.getUserName().equals(storeInfo.getBindUser())) {
throw new ServiceException("授权失败,已绑定其他代理账号!");
}
storeInfo.setStoreAccount(cookie.getAccount());
@ -84,7 +96,7 @@ public class MeituanServiceImpl implements IMeituanService {
storeInfo.setStoreCookie(cookie.getCookie());
storeInfo.setPlatformType(String.valueOf(cookie.getBingType()));
return R.ok(busStoreInfoService.updateBusStoreInfo(storeInfo));
}else{
} else {
throw new ServiceException("授权失败,请重试!");
}
// 触发爬取店铺信息
@ -92,6 +104,7 @@ public class MeituanServiceImpl implements IMeituanService {
/**
* 获取好评批量
*
* @return
*/
@Override
@ -99,14 +112,22 @@ public class MeituanServiceImpl implements IMeituanService {
BusStoreInfo busStoreInfo = new BusStoreInfo();
busStoreInfo.setGrantStatus("1");
List<BusStoreInfo> busStoreInfoList = busStoreInfoMapper.selectBusStoreInfoList(busStoreInfo);
for(BusStoreInfo store: busStoreInfoList){
getCommentsOne(store);
for (BusStoreInfo store : busStoreInfoList) {
Boolean flag = getCommentsOne(store);
if (!flag) {
//掉线
BusStoreInfo busStoreInfo1 = new BusStoreInfo();
busStoreInfo1.setId(store.getId());
busStoreInfo1.setGrantStatus("2");
busStoreInfoMapper.updateBusStoreInfo(busStoreInfo1);
}
}
return "ok";
}
/**
* 获取评分批量
*
* @return
*/
@Override
@ -114,14 +135,22 @@ public class MeituanServiceImpl implements IMeituanService {
BusStoreInfo busStoreInfo = new BusStoreInfo();
busStoreInfo.setGrantStatus("1");
List<BusStoreInfo> busStoreInfoList = busStoreInfoMapper.selectBusStoreInfoList(busStoreInfo);
for(BusStoreInfo store: busStoreInfoList){
getScoreOne(store);
for (BusStoreInfo store : busStoreInfoList) {
Boolean flag = getScoreOne(store);
if (!flag) {
//掉线
BusStoreInfo busStoreInfo1 = new BusStoreInfo();
busStoreInfo1.setId(store.getId());
busStoreInfo1.setGrantStatus("2");
busStoreInfoMapper.updateBusStoreInfo(busStoreInfo1);
}
}
return "ok";
}
/**
* 获取订单
*
* @param wmPoiId
* @param date
* @param cookie
@ -139,7 +168,7 @@ public class MeituanServiceImpl implements IMeituanService {
String key = wmPoiId + date;
String lastDayseq = Optional.ofNullable(redisTemplate.opsForValue().get(key)).orElse(null);
while (array != null && array.size() > 0) {
if (flag){
if (flag) {
break;
}
List<OrderInfo> list = new ArrayList<>();
@ -181,7 +210,7 @@ public class MeituanServiceImpl implements IMeituanService {
}
pageNum += 1;
JSONObject jo = merchantOrders(pageNum, date, cookie);
if("0".equals(jo.getString("code"))){
if ("0".equals(jo.getString("code"))) {
array = jo.getJSONObject("data").getJSONArray("wmOrderList");
} else {
System.out.println(jo.getString("msg"));
@ -193,35 +222,35 @@ public class MeituanServiceImpl implements IMeituanService {
return R.fail(jsonObject.getString("msg"));
}
private JSONObject merchantOrders(int pageNum,String date,String cookie){
private JSONObject merchantOrders(int pageNum, String date, String cookie) {
String url = "https://e.waimai.meituan.com/gw/api/order/mix/history/list/common";
Map<String,Object> params = new LinkedHashMap<>();
params.put("region_id",valueFromCookie("region_id",cookie));
params.put("region_version",valueFromCookie("region_version",cookie));
params.put("yodaReady","h5");
params.put("csecplatform",4);
params.put("csecversion","2.4.0");
url = appendParams(url,params);
Map<String, Object> params = new LinkedHashMap<>();
params.put("region_id", valueFromCookie("region_id", cookie));
params.put("region_version", valueFromCookie("region_version", cookie));
params.put("yodaReady", "h5");
params.put("csecplatform", 4);
params.put("csecversion", "2.4.0");
url = appendParams(url, params);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addTextBody("tag","complete");
builder.addTextBody("startDate",date);
builder.addTextBody("endDate",date);
builder.addTextBody("pageNum",String.valueOf(pageNum));
builder.addTextBody("pageSize","10");
builder.addTextBody("pageGray","1");
builder.addTextBody("tag", "complete");
builder.addTextBody("startDate", date);
builder.addTextBody("endDate", date);
builder.addTextBody("pageNum", String.valueOf(pageNum));
builder.addTextBody("pageSize", "10");
builder.addTextBody("pageGray", "1");
HttpPost httpPost = new HttpPost(url);
HttpEntity entity = builder.build();
httpPost.setEntity(entity);
httpPost.setHeader("Cookie",cookie);
httpPost.setHeader("Cookie", cookie);
HttpClient client = proxyHttpClient();
HttpEntity responseEntity;
String resp;
try {
responseEntity = client.execute(httpPost).getEntity();
responseEntity = client.execute(httpPost).getEntity();
resp = EntityUtils.toString(responseEntity);
} catch (IOException e) {
throw new RuntimeException(e);
@ -232,31 +261,32 @@ public class MeituanServiceImpl implements IMeituanService {
/**
* 获取号码
*
* @param orderId
* @param cookie
* @return
*/
@Override
public R priPhoneInfo(String orderId,String cookie) {
public R priPhoneInfo(String orderId, String cookie) {
String url = "https://e.waimai.meituan.com/v2/order/history/r/search/ajax";
String regionId = valueFromCookie("region_id",cookie);
String regionVersion = valueFromCookie("region_version",cookie);
Map<String,Object> params = new LinkedHashMap<>();
params.put("searchItem",orderId);
params.put("region_id",regionId);
params.put("region_version",regionVersion);
params.put("yodaReady","h5");
params.put("csecplatform",4);
params.put("csecversion","2.4.0");
String mtgsig = mtgsigInfo(orderId,regionId,regionVersion);
params.put("mtgsig",mtgsig);
url = appendParams(url,params);
String regionId = valueFromCookie("region_id", cookie);
String regionVersion = valueFromCookie("region_version", cookie);
Map<String, Object> params = new LinkedHashMap<>();
params.put("searchItem", orderId);
params.put("region_id", regionId);
params.put("region_version", regionVersion);
params.put("yodaReady", "h5");
params.put("csecplatform", 4);
params.put("csecversion", "2.4.0");
String mtgsig = mtgsigInfo(orderId, regionId, regionVersion);
params.put("mtgsig", mtgsig);
url = appendParams(url, params);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
// builder.addTextBody("searchItem","3801144621770927987");
HttpPost httpPost = new HttpPost(url);
HttpEntity entity = builder.build();
httpPost.setEntity(entity);
httpPost.setHeader("Cookie",cookie);
httpPost.setHeader("Cookie", cookie);
HttpClient client = proxyHttpClient();
@ -265,7 +295,7 @@ public class MeituanServiceImpl implements IMeituanService {
HttpResponse response = client.execute(httpPost);
HttpEntity responseEntity = response.getEntity();
resp = EntityUtils.toString(responseEntity);
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
}
JSONObject jsonObject = JSONObject.parseObject(resp);
@ -289,51 +319,52 @@ public class MeituanServiceImpl implements IMeituanService {
}
if (list.size() > 0) {
for (PriPhoneInfo phoneInfo : list) {
System.out.println(phoneInfo.getOrderId() + "," + phoneInfo.getPricyPhone()+ "," +phoneInfo.getRecipientPhone()+ "," +phoneInfo.getRecipientBindedPhone());
System.out.println(phoneInfo.getOrderId() + "," + phoneInfo.getPricyPhone() + "," + phoneInfo.getRecipientPhone() + "," + phoneInfo.getRecipientBindedPhone());
}
return R.ok(JSON.toJSON(list));
}
}
return R.fail("获取手机号码失败"+resp);
return R.fail("获取手机号码失败" + resp);
}
/**
* 获取mtgsig
*
* @param orderId
* @param regionId
* @param regionVersion
* @return
*/
@Override
public String mtgsigInfo(String orderId,String regionId,String regionVersion) {
public String mtgsigInfo(String orderId, String regionId, String regionVersion) {
CloseableHttpClient httpClient = proxyHttpClient();
String url = "http://43.140.224.18:12000/get_mtgsig";
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
Map<String,Object> subUrlParams = new LinkedHashMap<>();
subUrlParams.put("url","https://e.waimai.meituan.com/v2/order/history/r/search/ajax?");
subUrlParams.put("searchItem",orderId);
subUrlParams.put("region_id",regionId);
subUrlParams.put("region_version",regionVersion);
subUrlParams.put("yodaReady","h5");
subUrlParams.put("csecplatform",4);
subUrlParams.put("csecversion","2.4.0");
Map<String, Object> subUrlParams = new LinkedHashMap<>();
subUrlParams.put("url", "https://e.waimai.meituan.com/v2/order/history/r/search/ajax?");
subUrlParams.put("searchItem", orderId);
subUrlParams.put("region_id", regionId);
subUrlParams.put("region_version", regionVersion);
subUrlParams.put("yodaReady", "h5");
subUrlParams.put("csecplatform", 4);
subUrlParams.put("csecversion", "2.4.0");
subUrlParams.put("data","");
subUrlParams.put("dfpid","x528894270u555uvyz734vu21zz348v08095w0y4y68979584766w00y");
subUrlParams.put("data", "");
subUrlParams.put("dfpid", "x528894270u555uvyz734vu21zz348v08095w0y4y68979584766w00y");
String urlParam = "";
for (Map.Entry<String, Object> stringObjectEntry : subUrlParams.entrySet()) {
urlParam = urlParam + stringObjectEntry.getKey() + "=" + stringObjectEntry.getValue()+"&";
urlParam = urlParam + stringObjectEntry.getKey() + "=" + stringObjectEntry.getValue() + "&";
}
String result = null;
try {
StringEntity params = new StringEntity(urlParam.substring(0, urlParam.length()-1));
StringEntity params = new StringEntity(urlParam.substring(0, urlParam.length() - 1));
httpPost.setEntity(params);
CloseableHttpResponse response = httpClient.execute(httpPost);
result = EntityUtils.toString(response.getEntity());
}catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
return URLEncoder.encode(result);
@ -341,40 +372,41 @@ public class MeituanServiceImpl implements IMeituanService {
/**
* 获取评分单条
*
* @return
*/
private Boolean getScoreOne(BusStoreInfo store) {
CloseableHttpClient httpClient = proxyHttpClient();
String wmPoiId = valueFromCookie("wmPoiId",store.getStoreCookie());
String wmPoiId = valueFromCookie("wmPoiId", store.getStoreCookie());
String url = "https://waimaieapp.meituan.com/gw/customer/comment/scores";
Map<String,Object> params = new HashMap<>();
params.put("ignoreSetRouterProxy",true);
params.put("acctId",valueFromCookie("acctId",store.getStoreCookie()));
params.put("wmPoiId",wmPoiId);
params.put("token",valueFromCookie("token",store.getStoreCookie()));
params.put("appType",3);
params.put("source",1);
url = appendParams(url,params);
Map<String, Object> params = new HashMap<>();
params.put("ignoreSetRouterProxy", true);
params.put("acctId", valueFromCookie("acctId", store.getStoreCookie()));
params.put("wmPoiId", wmPoiId);
params.put("token", valueFromCookie("token", store.getStoreCookie()));
params.put("appType", 3);
params.put("source", 1);
url = appendParams(url, params);
HttpGet request = new HttpGet(url);
String result = null;
try {
result = EntityUtils.toString(httpClient.execute(request).getEntity());
}catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
if (result != null){
if (result != null) {
JSONObject jsonObject = JSONObject.parseObject(result);
if ("0".equals(jsonObject.getString("code"))){
if ("0".equals(jsonObject.getString("code"))) {
JSONObject data = jsonObject.getJSONObject("data");
String poiScore = data.getString("poiScore");
BusStoreInfo storeInfo = new BusStoreInfo();
storeInfo.setStoreCode(wmPoiId);
List<BusStoreInfo> list = busStoreInfoService.selectBusStoreInfoList(storeInfo);
if (list.size() > 0){
if (list.size() > 0) {
BusStoreDayInfo dayInfo = new BusStoreDayInfo();
dayInfo.setStoreId(list.get(0).getId());
List<BusStoreDayInfo> list1 = busStoreDayInfoService.selectBusStoreDayInfoList(dayInfo);
if (list1.size() > 0){
if (list1.size() > 0) {
BusStoreDayInfo temp = list1.get(0);
temp.setScore(poiScore);
busStoreDayInfoService.updateBusStoreDayInfo(temp);
@ -391,54 +423,95 @@ public class MeituanServiceImpl implements IMeituanService {
/**
* 获取订单数和好评单条
*
* @return
*/
private Boolean getCommentsOne(BusStoreInfo store){
private Boolean getCommentsOne(BusStoreInfo store) {
//commScore=1 好评commScore=0 全部即订单量五星好评取返回结果orderCommentScore=5
String url = "https://waimaieapp.meituan.com/gw/customer/comment/list";
Map<String,Object> params = new HashMap<>();
params.put("ignoreSetRouterProxy",true);
params.put("acctId",
valueFromCookie("acctId",store.getStoreCookie()));
params.put("wmPoiId",
valueFromCookie("wmPoiId",store.getStoreCookie()));
params.put("token",valueFromCookie("token",store.getStoreCookie()));
params.put("appType",3);
params.put("commScore",1);
params.put("commType",-1);
params.put("hasContent",-1);
params.put("periodType",4);
params.put("beginTime",1719676800);
params.put("endTime",1719676800);
params.put("onlyAuditNotPass",0);
params.put("pageNum",1);
params.put("pageSize",10);
params.put("source",1);
String result = HttpClientUtilT.doGet(url,null,params);
System.out.println(result);//落库
return true;
// String url = "https://waimaieapp.meituan.com/gw/customer/comment/list";
// Map<String,Object> params = new HashMap<>();
// params.put("ignoreSetRouterProxy",true);
// params.put("acctId",
// valueFromCookie("acctId",store.getStoreCookie()));
// params.put("wmPoiId",
// valueFromCookie("wmPoiId",store.getStoreCookie()));
// params.put("token",valueFromCookie("token",store.getStoreCookie()));
// params.put("appType",3);
// params.put("commScore",1);
// params.put("commType",-1);
// params.put("hasContent",-1);
// params.put("periodType",4);
// params.put("beginTime",1719676800);
// params.put("endTime",1719676800);
// params.put("onlyAuditNotPass",0);
// params.put("pageNum",1);
// params.put("pageSize",10);
// params.put("source",1);
// String result = HttpClientUtilT.doGet(url,null,params);
// System.out.println(result);//落库
LocalDateTime now = LocalDateTime.now();
String url = "https://waimaieapp.meituan.com/gw/customer/comment/statistics/score/summary/single/distribution";
Map<String, Object> params = new HashMap<>();
// uriBuilder.setParameter("ignoreSetRouterProxy","true");
params.put("acctId", valueFromCookie("acctId", store.getStoreCookie()));
params.put("wmPoiId", valueFromCookie("wmPoiId", store.getStoreCookie()));
params.put("token", valueFromCookie("token", store.getStoreCookie()));
params.put("bsid", valueFromCookie("bsid", store.getStoreCookie()));
params.put("appType", "3");
params.put("durationType", "2");
params.put("dt", now.format(DateTimeFormatter.ofPattern("yyyyMMdd")));
url = appendParams(url, params);
HttpGet request = new HttpGet(url);
String result = null;
try {
CloseableHttpClient httpClient = proxyHttpClient();
result = EntityUtils.toString(httpClient.execute(request).getEntity());
JSONObject jsonObject = JSONObject.parseObject(result);
int code = jsonObject.getInteger(("code"));
if (code != 0) {
return false;
}
JSONArray array = jsonObject.getJSONObject("data").getJSONArray("list");
BusStoreDayInfo busStoreDayInfo = new BusStoreDayInfo();
busStoreDayInfo.setStoreId(store.getId());
List<BusStoreDayInfo> list1 = busStoreDayInfoService.selectBusStoreDayInfoList(busStoreDayInfo);
if (list1.size() > 0) {
BusStoreDayInfo busStoreDayInfo1 = new BusStoreDayInfo();
int fiveNum = array.getJSONObject(array.size()).getInteger("fiveNum");
int fourNum = array.getJSONObject(array.size()).getInteger("fourNum");
busStoreDayInfo1.setLastFiveStarReviewsNum(fiveNum);
busStoreDayInfo1.setLastPositiveReviewsNum(fiveNum + fourNum);
busStoreDayInfoService.updateBusStoreDayInfo(busStoreDayInfo1);
}
System.out.println(jsonObject);//落库
return true;
} catch (Exception e) {
return false;
// e.printStackTrace();
}
}
// 解析Cookie
private String valueFromCookie(String key,String text) {
private String valueFromCookie(String key, String text) {
String s = text.substring(text.indexOf(key), text.length());
String value = s.substring(s.indexOf("=")+1,s.indexOf(";"));
String value = s.substring(s.indexOf("=") + 1, s.indexOf(";"));
return value;
}
private String appendParams(String url,Map<String,Object> params){
private String appendParams(String url, Map<String, Object> params) {
String param = "?";
for (Map.Entry<String, Object> stringObjectEntry : params.entrySet()) {
param = param + stringObjectEntry.getKey() + "=" + stringObjectEntry.getValue()+"&";
param = param + stringObjectEntry.getKey() + "=" + stringObjectEntry.getValue() + "&";
}
url = url + param.substring(0, param.length()-1);
url = url + param.substring(0, param.length() - 1);
return url;
}
private CloseableHttpClient proxyHttpClient(){
private CloseableHttpClient proxyHttpClient() {
String proxyHost = proxyProperties.getProxyAddr();
int proxyPort = proxyProperties.getProxyPort();
HttpHost proxy = new HttpHost(proxyHost,proxyPort);
HttpHost proxy = new HttpHost(proxyHost, proxyPort);
RequestConfig config = RequestConfig.custom().setProxy(proxy).build();
CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(config).build();
return httpClient;

View File

@ -19,13 +19,14 @@ import java.util.Map;
public class TestProxyOKHttpClient {
public static void main(String[] args) throws Exception {
String pageUrl = "https://waimaieapp.meituan.com/gw/customer/comment/scores"; // 要访问的目标网页
// String pageUrl = "https://waimaieapp.meituan.com/gw/customer/comment/statistics/socre/single/trend"; // 要访问的目标网页
String pageUrl = "https://waimaieapp.meituan.com/gw/customer/comment/statistics/score/summary/single/distribution";
String proxyIp = "q335.kdltpspro.com"; // 隧道服务器域名
int proxyPort = 15818; // 端口号
// 用户名密码, 若已添加白名单则不需要添加
// private static String username = "t12023179565372";
// private static String password = "nffm6c11";
String ck = "WEBDFPID=81x675y2y0x156y20z8194xvv5622uv180938x0x565979585zu21vx7-2034987530564-1719627530564QGCGCKGfd79fef3d01d5e9aadc18ccd4d0c95072413; _lxsdk_cuid=19061b46258c8-0a575a85246371-d373666-1fa400-19061b4625873; _lxsdk=19061b46258c8-0a575a85246371-d373666-1fa400-19061b4625873; device_uuid=!f681d2ae-d8e3-44ae-abed-9319cef9b9a1; uuid_update=true; pushToken=08Y-B6R3RJh0vWW3sunjIls8g5ks282V0XDqw0_8uK2I*; shopCategory=food; JSESSIONID=dkj01s9yo2h2q99aetsthoq3; acctId=196975850; token=0eq1KL_sB7ri93DJ5E3VcEjEWxjBRjeEsXmkjhWmF3bo*; wmPoiId=21737990; isOfflineSelfOpen=0; city_id=510100; isChain=0; ignore_set_router_proxy=false; region_id=1000510100; region_version=1717637457; bsid=XexDMsEVbmI6WgjNSDW-gwTDf1RtcW1Pkmjt8mV3rmsf3lqyuwluHfeuFrPPZ_2JX9I8z7LBpBdpaBthMwykUw; city_location_id=510100; location_id=510107; has_not_waimai_poi=0; cityId=210100; provinceId=210000; set_info=%7B%22wmPoiId%22%3A%2221737990%22%2C%22region_id%22%3A%221000510100%22%2C%22region_version%22%3A1717637457%7D; wpush_server_url=wss://wpush.meituan.com; logan_session_token=r97sfva90wzsyia113hr; setPrivacyTime=1_20240706; _lxsdk_s=19085cff3a6-850-391-417%7C%7C182";
String ck = "WEBDFPID=1720243694471SOQUSWGfd79fef3d01d5e9aadc18ccd4d0c95075017-1720243694471-1720243694471SOQUSWGfd79fef3d01d5e9aadc18ccd4d0c95075017; _lxsdk_cuid=1908683abd3c8-0e87cc55781832-26031d51-1fa400-1908683abd3c8; _lxsdk=1908683abd3c8-0e87cc55781832-26031d51-1fa400-1908683abd3c8; token=0wZSkATTKcJeT2-UVQeT2Up8z8yoEF4wcCF5envvlMiA*; bsid=F7FNo1sEad3bOpIe5IElSfYNcbgOHbnY4yussusoXL7rxgu6XJAk-Grh6nnaCDOSVYwZKH4CiWsK21nq7xIqNg; acctId=160394866; wmPoiId=18277065; _source=PC; acctName=wmhxkl2556816; device_uuid=!3b06a9f7-cb53-4d40-acc9-bb90ff4d4104; _lxsdk_s=1908683abd4-429-f65-925%7C%7C60";
// JDK 8u111版本后目标页面为HTTPS协议启用proxy用户密码鉴权
System.setProperty("jdk.http.auth.tunneling.disabledSchemes", "");
@ -50,17 +51,20 @@ public class TestProxyOKHttpClient {
URIBuilder uriBuilder = new URIBuilder();
uriBuilder.setHost(url.getPath());
Map<String,Object> params = new HashMap<>();
uriBuilder.setParameter("ignoreSetRouterProxy","true");
// uriBuilder.setParameter("ignoreSetRouterProxy","true");
uriBuilder.setParameter("acctId",valueFromCookie("acctId",ck));
uriBuilder.setParameter("wmPoiId",valueFromCookie("wmPoiId",ck));
uriBuilder.setParameter("token",valueFromCookie("token",ck));
uriBuilder.setParameter("bsid",valueFromCookie("bsid",ck));
uriBuilder.setParameter("appType","3");
uriBuilder.setParameter("source","1");
// params.put("acctId",valueFromCookie("acctId",store.getStoreCookie()));
// params.put("wmPoiId",valueFromCookie("wmPoiId",store.getStoreCookie()));
// params.put("token",valueFromCookie("token",store.getStoreCookie()));
// params.put("appType",3);
// params.put("source",1);
uriBuilder.setParameter("durationType","2");
// uriBuilder.setParameter("optimus_uuid","3b06a9f7-cb53-4d40-acc9-bb90ff4d4104");
// uriBuilder.setParameter("optimus_risk_level","71");
// uriBuilder.setParameter("optimus_code","10");
// uriBuilder.setParameter("optimus_partner","19");
// uriBuilder.setParameter("beginDate","20240605");
// uriBuilder.setParameter("endDate","20240705");
uriBuilder.setParameter("dt","20240706");
HttpGet httpget = new HttpGet(uriBuilder.build());

View File

@ -6,6 +6,8 @@ import java.net.InetSocketAddress;
import java.net.Proxy;
public class test2 {
public static void main(String args[]) throws IOException {
// 目标网站
String targetUrl = "https://waimaieapp.meituan.com/gw/customer/comment/scores";

View File

@ -25,13 +25,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectBusStoreDayInfoVo"/>
<where>
<if test="storeId != null "> and store_id = #{storeId}</if>
<if test="lastOrderNum != null "> and last_order_num = #{lastOrderNum}</if>
<if test="lastPositiveReviewsNum != null "> and last_positive_reviews_num = #{lastPositiveReviewsNum}</if>
<if test="lastFiveStarReviewsNum != null "> and last_five_star_reviews_num = #{lastFiveStarReviewsNum}</if>
<if test="lastReturnVisitNum != null "> and last_return_visit_num = #{lastReturnVisitNum}</if>
<if test="lastReturnVisitRate != null and lastReturnVisitRate != ''"> and last_return_visit_rate = #{lastReturnVisitRate}</if>
<if test="todayReturnVisitNum != null "> and today_return_visit_num = #{todayReturnVisitNum}</if>
<if test="score != null and score != ''"> and score = #{score}</if>
<!-- <if test="lastOrderNum != null "> and last_order_num = #{lastOrderNum}</if>-->
<!-- <if test="lastPositiveReviewsNum != null "> and last_positive_reviews_num = #{lastPositiveReviewsNum}</if>-->
<!-- <if test="lastFiveStarReviewsNum != null "> and last_five_star_reviews_num = #{lastFiveStarReviewsNum}</if>-->
<!-- <if test="lastReturnVisitNum != null "> and last_return_visit_num = #{lastReturnVisitNum}</if>-->
<!-- <if test="lastReturnVisitRate != null and lastReturnVisitRate != ''"> and last_return_visit_rate = #{lastReturnVisitRate}</if>-->
<!-- <if test="todayReturnVisitNum != null "> and today_return_visit_num = #{todayReturnVisitNum}</if>-->
<!-- <if test="score != null and score != ''"> and score = #{score}</if>-->
</where>
</select>