修改订单时间
This commit is contained in:
parent
3afeb2d8e2
commit
ceadfff3d9
|
@ -13,7 +13,6 @@ import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.common.utils.SplitListUtils;
|
import com.ruoyi.common.utils.SplitListUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.system.mapper.SysDictDataMapper;
|
import com.ruoyi.system.mapper.SysDictDataMapper;
|
||||||
import jdk.nashorn.internal.runtime.logging.Logger;
|
|
||||||
import org.apache.http.HttpEntity;
|
import org.apache.http.HttpEntity;
|
||||||
import org.apache.http.HttpHost;
|
import org.apache.http.HttpHost;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
|
@ -58,7 +57,6 @@ import java.util.stream.Collectors;
|
||||||
* 采集美团数据service
|
* 采集美团数据service
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Logger
|
|
||||||
public class MeituanServiceImpl implements IMeituanService {
|
public class MeituanServiceImpl implements IMeituanService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -392,7 +390,7 @@ public class MeituanServiceImpl implements IMeituanService {
|
||||||
if ("0".equals(code)) {
|
if ("0".equals(code)) {
|
||||||
JSONArray array = jsonObject.getJSONObject("data").getJSONArray("wmOrderList");
|
JSONArray array = jsonObject.getJSONObject("data").getJSONArray("wmOrderList");
|
||||||
|
|
||||||
boolean flag = false;
|
// boolean flag = false;
|
||||||
// String key = wmPoiId + date;
|
// String key = wmPoiId + date;
|
||||||
// String lastDayseq = Optional.ofNullable(redisTemplate.opsForValue().get(key)).orElse(null);
|
// String lastDayseq = Optional.ofNullable(redisTemplate.opsForValue().get(key)).orElse(null);
|
||||||
while (array != null && array.size() > 0) {
|
while (array != null && array.size() > 0) {
|
||||||
|
@ -409,7 +407,7 @@ public class MeituanServiceImpl implements IMeituanService {
|
||||||
JSONObject order0 = oj.getJSONObject("orderInfo");
|
JSONObject order0 = oj.getJSONObject("orderInfo");
|
||||||
JSONObject commonInfo = oj.getJSONObject("commonInfo");
|
JSONObject commonInfo = oj.getJSONObject("commonInfo");
|
||||||
String userId = commonInfo.getString("wmUserId");
|
String userId = commonInfo.getString("wmUserId");
|
||||||
String daySeq = ""; String wmOrderViewId = ""; String orderTimeFmt = ""; String expectTime = ""; String statusDesc = ""; String orderCount = "";
|
String daySeq = ""; String wmOrderViewId = ""; String orderTimeFmt = ""; String statusDesc = ""; String orderCount = "";
|
||||||
String privacyPhone = null; String recipientPhone = null; String recipientBindedPhone = null;
|
String privacyPhone = null; String recipientPhone = null; String recipientBindedPhone = null;
|
||||||
if ("1".equals(businessType)) {
|
if ("1".equals(businessType)) {
|
||||||
JSONObject order1 = order0.getJSONObject("orderInfo");
|
JSONObject order1 = order0.getJSONObject("orderInfo");
|
||||||
|
@ -421,7 +419,6 @@ public class MeituanServiceImpl implements IMeituanService {
|
||||||
daySeq = order1.getString("dayseq");
|
daySeq = order1.getString("dayseq");
|
||||||
wmOrderViewId = order1.getString("wmOrderViewId");
|
wmOrderViewId = order1.getString("wmOrderViewId");
|
||||||
orderTimeFmt = "2024-"+order1.getString("orderTimeFmt");
|
orderTimeFmt = "2024-"+order1.getString("orderTimeFmt");
|
||||||
expectTime = expectTimeVo.getString("expectTimeFmt");
|
|
||||||
statusDesc = order1.getString("statusDesc");
|
statusDesc = order1.getString("statusDesc");
|
||||||
if ("门店新客".equals(info)){
|
if ("门店新客".equals(info)){
|
||||||
orderCount = "1";
|
orderCount = "1";
|
||||||
|
@ -432,7 +429,6 @@ public class MeituanServiceImpl implements IMeituanService {
|
||||||
statusDesc = "用户已收餐";
|
statusDesc = "用户已收餐";
|
||||||
wmOrderViewId = commonInfo.getString("wm_order_id_view");
|
wmOrderViewId = commonInfo.getString("wm_order_id_view");
|
||||||
orderTimeFmt = order0.getString("order_time_fmt");
|
orderTimeFmt = order0.getString("order_time_fmt");
|
||||||
expectTime = order0.getString("expectTimeFmt");
|
|
||||||
daySeq = commonInfo.getString("wm_poi_order_dayseq");
|
daySeq = commonInfo.getString("wm_poi_order_dayseq");
|
||||||
privacyPhone = order0.getString("privacy_phone");
|
privacyPhone = order0.getString("privacy_phone");
|
||||||
recipientPhone = order0.getString("recipient_phone");
|
recipientPhone = order0.getString("recipient_phone");
|
||||||
|
@ -459,28 +455,15 @@ public class MeituanServiceImpl implements IMeituanService {
|
||||||
orderInfo.setDayseq(daySeq);
|
orderInfo.setDayseq(daySeq);
|
||||||
orderInfo.setOrderNo(wmOrderViewId);
|
orderInfo.setOrderNo(wmOrderViewId);
|
||||||
|
|
||||||
if(expectTime.contains("今日")){
|
|
||||||
expectTime = expectTime.substring(3,expectTime.length());
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
orderInfo.setStoreName(storeInfo1.getStoreName());
|
orderInfo.setStoreName(storeInfo1.getStoreName());
|
||||||
|
|
||||||
String completeTime = "2024-"+expectTime;
|
String reachTime = receiveTime(wmPoiId,cookie,wmOrderViewId);
|
||||||
if (completeTime.contains("门店设置")){
|
|
||||||
completeTime = completeTime.replaceAll("门店设置","");
|
|
||||||
}
|
|
||||||
if (completeTime.contains("约今日")){
|
|
||||||
completeTime = completeTime.replaceAll("约今日 ","");
|
|
||||||
}
|
|
||||||
if (completeTime.contains("明日")){
|
|
||||||
completeTime = completeTime.replaceAll("明日 ","");
|
|
||||||
}
|
|
||||||
|
|
||||||
orderInfo.setCompleteTime(completeTime);
|
orderInfo.setCompleteTime(date+" "+reachTime);
|
||||||
orderInfo.setOrderStatus(statusDesc);
|
orderInfo.setOrderStatus(statusDesc);
|
||||||
orderInfo.setCustomId(userId);
|
orderInfo.setCustomId(userId);
|
||||||
orderInfo.setOrderCount(orderCount);
|
orderInfo.setOrderCount(orderCount);
|
||||||
|
@ -540,7 +523,7 @@ public class MeituanServiceImpl implements IMeituanService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getOrderCountByType(String getUrl, String wmOrderViewId,String cookie){
|
private String getOrderCountByType(String getUrl, String wmOrderViewId,String cookie){
|
||||||
CloseableHttpClient httpClient = proxyHttpClient(getUrl);
|
CloseableHttpClient httpClient = proxyHttpClient();
|
||||||
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));
|
||||||
|
@ -616,6 +599,39 @@ public class MeituanServiceImpl implements IMeituanService {
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String receiveTime(String storeCode,String cookie,String orderNo){
|
||||||
|
CloseableHttpClient client = proxyHttpClient();
|
||||||
|
String url = "https://e.waimai.meituan.com/api/logistics/logs";
|
||||||
|
Map<String, Object> params = new LinkedHashMap<>();
|
||||||
|
params.put("region_id", valueFromCookie("region_id",cookie));
|
||||||
|
params.put("region_version",valueFromCookie("region_version",cookie));
|
||||||
|
params.put("wmOrderViewId", orderNo);
|
||||||
|
params.put("wmPoiIdFromQuery", storeCode);
|
||||||
|
params.put("yodaReady", "h5");
|
||||||
|
params.put("csecplatform", 4);
|
||||||
|
params.put("csecversion", "2.4.0");
|
||||||
|
url = appendParams(url, params);
|
||||||
|
HttpGet request = new HttpGet(url);
|
||||||
|
request.setHeader("Cookie",cookie);
|
||||||
|
request.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");
|
||||||
|
String result = null;
|
||||||
|
try {
|
||||||
|
result = EntityUtils.toString(client.execute(request).getEntity());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
|
String code = jsonObject.getString(("code"));
|
||||||
|
String info = null;
|
||||||
|
if ("0".equals(code)) {
|
||||||
|
JSONArray data = jsonObject.getJSONArray("data");
|
||||||
|
info = data.getJSONObject(0).getString("timeLine");
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStoreName(String cookie,String getUrl){
|
public String getStoreName(String cookie,String getUrl){
|
||||||
String url = "https://e.waimai.meituan.com/v2/index/homePage";
|
String url = "https://e.waimai.meituan.com/v2/index/homePage";
|
||||||
|
@ -696,7 +712,14 @@ public class MeituanServiceImpl implements IMeituanService {
|
||||||
List<BusOrderInfo> lsList1 = ls.stream().filter(x -> x.getPrivcyPhone() == null && x.getRecipientPhone() == null && x.getRecipientBindedPhone() == null).collect(Collectors.toList());
|
List<BusOrderInfo> lsList1 = ls.stream().filter(x -> x.getPrivcyPhone() == null && x.getRecipientPhone() == null && x.getRecipientBindedPhone() == null).collect(Collectors.toList());
|
||||||
|
|
||||||
List<BusReturnVisitInfo> lss = new ArrayList<>();
|
List<BusReturnVisitInfo> lss = new ArrayList<>();
|
||||||
|
for (BusOrderInfo info : lsList) {
|
||||||
|
BusReturnVisitInfo returnVisitInfo1 = new BusReturnVisitInfo();
|
||||||
|
returnVisitInfo1.setStoreCode(info.getStoreCode());
|
||||||
|
returnVisitInfo1.setStoreName(info.getStoreName());
|
||||||
|
returnVisitInfo1.setPhoneEndNumber(info.getRecipientPhone());
|
||||||
|
returnVisitInfo1.setPhoneNumber(info.getPrivcyPhone());
|
||||||
|
lss.add(returnVisitInfo1);
|
||||||
|
}
|
||||||
for (BusOrderInfo orderInfo : lsList1) {
|
for (BusOrderInfo orderInfo : lsList1) {
|
||||||
String url = "https://e.waimai.meituan.com/v2/order/history/r/search/ajax";
|
String url = "https://e.waimai.meituan.com/v2/order/history/r/search/ajax";
|
||||||
String regionId = valueFromCookie("region_id", cookie);
|
String regionId = valueFromCookie("region_id", cookie);
|
||||||
|
|
Loading…
Reference in New Issue