1;算法参数导致获取手机号403

2;表格数据页空数据处理
This commit is contained in:
wangshuai 2024-07-28 23:43:44 +08:00
parent 0452fc3071
commit 6bf1204632
4 changed files with 38 additions and 28 deletions

View File

@ -77,6 +77,10 @@ public class BusStoreDayHistoryInfoController extends BaseController
if (storeInfo != null) {
int totalComments = 0;
BigDecimal totamMoney = new BigDecimal("0");
BigDecimal d = new BigDecimal("0");
if (storeInfo.getPrice() != null){
d = storeInfo.getPrice();
}
while (dateFormat.parse(startTime).getTime() <= dateFormat.parse(expEndTime).getTime()){
BusStoreExcelInfo excelInfo = new BusStoreExcelInfo();
excelInfo.setOrderDate(startTime);
@ -92,18 +96,15 @@ public class BusStoreDayHistoryInfoController extends BaseController
if (data != null){
excelInfo.setCommentsNumber(data.getLastPositiveReviewsNum());
totalComments += data.getLastPositiveReviewsNum();
}else{
excelInfo.setCommentsNumber(0);
}
BigDecimal d = new BigDecimal("0");
if (storeInfo.getPrice() != null){
d = storeInfo.getPrice();
}
excelInfo.setPrice(d.toString());
BigDecimal money = d.multiply(new BigDecimal(data.getLastPositiveReviewsNum()));
excelInfo.setMoney(money.toString());
totamMoney = totamMoney.add(money);
}else{
excelInfo.setCommentsNumber(0);
excelInfo.setPrice(d.toString());
excelInfo.setMoney("0");
}
list.add(excelInfo);
Calendar calendar = Calendar.getInstance();

View File

@ -120,9 +120,10 @@ public class MeituanController {
iMeituanService.priPhoneInfo(list, cookie);
}
@ApiOperation("getMtgsig")
@GetMapping("/getMtgsig")
public String mtgsig(String orderId,String regionId,String regionVersion) {
return iMeituanService.mtgsigInfo(orderId,regionId,regionVersion);
public String mtgsig(String orderId,String regionId,String regionVersion,String dfpid) {
return iMeituanService.mtgsigInfo(orderId,regionId,regionVersion,dfpid);
}

View File

@ -51,7 +51,7 @@ public interface IMeituanService {
* @param regionVersion
* @return
*/
String mtgsigInfo(String orderId,String regionId,String regionVersion);
String mtgsigInfo(String orderId,String regionId,String regionVersion,String dfpid);
String getStoreName(String cookie);

View File

@ -451,6 +451,9 @@ public class MeituanServiceImpl implements IMeituanService {
if (completeTime.contains("约今日")){
completeTime = completeTime.replaceAll("约今日 ","");
}
if (completeTime.contains("明日")){
completeTime = completeTime.replaceAll("明日 ","");
}
orderInfo.setCompleteTime(completeTime);
orderInfo.setOrderStatus(statusDesc);
@ -523,7 +526,7 @@ public class MeituanServiceImpl implements IMeituanService {
params.put("yodaReady", "h5");
params.put("csecplatform", 4);
params.put("csecversion", "2.4.0");
params.put("mtgsig", mtgsigInfo(wmOrderViewId,valueFromCookie("region_id", cookie),valueFromCookie("region_version", cookie)));
params.put("mtgsig", mtgsigInfo(wmOrderViewId,valueFromCookie("region_id", cookie),valueFromCookie("region_version", cookie),valueFromCookie("WEBDFPID",cookie)));
url = appendParams(url, params);
HttpGet request = new HttpGet(url);
request.setHeader("Cookie",cookie);
@ -552,7 +555,7 @@ public class MeituanServiceImpl implements IMeituanService {
params.put("yodaReady", "h5");
params.put("csecplatform", 4);
params.put("csecversion", "2.4.0");
params.put("mtgsig", mtgsigInfo("",valueFromCookie("region_id", cookie),valueFromCookie("region_version", cookie)));
params.put("mtgsig", mtgsigInfo("",valueFromCookie("region_id", cookie),valueFromCookie("region_version", cookie),valueFromCookie("WEBDFPID",cookie)));
url = appendParams(url, params);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
@ -672,11 +675,13 @@ public class MeituanServiceImpl implements IMeituanService {
params.put("yodaReady", "h5");
params.put("csecplatform", 4);
params.put("csecversion", "2.4.0");
String mtgsig = mtgsigInfo(orderInfo.getOrderNo(), regionId, regionVersion);
String mtgsig = mtgsigInfo(orderInfo.getOrderNo(), regionId, regionVersion,valueFromCookie("WEBDFPID",cookie));
System.out.println(mtgsig);
System.out.println(orderInfo.toString());
params.put("mtgsig", mtgsig);
url = appendParams(url, params);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
// builder.addTextBody("searchItem","3801144621770927987");
builder.addTextBody("wmPoiId",orderInfo.getStoreCode());
HttpPost httpPost = new HttpPost(url);
HttpEntity entity = builder.build();
httpPost.setEntity(entity);
@ -684,16 +689,18 @@ public class MeituanServiceImpl implements IMeituanService {
CloseableHttpClient client = proxyHttpClient();
String resp = null;
String code = null;
JSONObject jsonObject = new JSONObject();
try {
HttpResponse response = client.execute(httpPost);
HttpEntity responseEntity = response.getEntity();
resp = EntityUtils.toString(responseEntity);
String resp = EntityUtils.toString(responseEntity);
jsonObject = JSONObject.parseObject(resp);
code = jsonObject.getString(("code"));
} catch (Exception e) {
e.printStackTrace();
continue;
}
JSONObject jsonObject = JSONObject.parseObject(resp);
String code = jsonObject.getString(("code"));
if ("0".equals(code)) {
JSONArray array = jsonObject.getJSONArray("wmOrderList");
@ -759,7 +766,7 @@ public class MeituanServiceImpl implements IMeituanService {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public String mtgsigInfo(String orderId, String regionId, String regionVersion) {
public String mtgsigInfo(String orderId, String regionId, String regionVersion,String dfpid) {
CloseableHttpClient httpClient = proxyHttpClient();
String url = "http://43.140.224.18:12000/get_mtgsig";
HttpPost httpPost = new HttpPost(url);
@ -767,15 +774,16 @@ public class MeituanServiceImpl implements IMeituanService {
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("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("dfpid", dfpid.split("-")[0]);
subUrlParams.put("method", "post");
String urlParam = "";
for (Map.Entry<String, Object> stringObjectEntry : subUrlParams.entrySet()) {