增加是否拼好饭与下单时间

This commit is contained in:
Lenovo 2024-07-10 16:27:11 +08:00
parent 3b1d357cc1
commit 38076e05aa
1 changed files with 22 additions and 2 deletions

View File

@ -35,6 +35,7 @@ import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.apache.ibatis.javassist.Loader;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -42,6 +43,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
@ -301,12 +303,18 @@ public class MeituanServiceImpl implements IMeituanService {
BusOrderInfo orderInfo = new BusOrderInfo(); BusOrderInfo orderInfo = new BusOrderInfo();
Object o = array.get(i); Object o = array.get(i);
JSONObject oj = JSONObject.parseObject(JSON.toJSONString(o)); JSONObject oj = JSONObject.parseObject(JSON.toJSONString(o));
String isPhf = oj.getString("businessType");
JSONObject order0 = oj.getJSONObject("orderInfo"); JSONObject order0 = oj.getJSONObject("orderInfo");
JSONObject commonInfo = oj.getJSONObject("commonInfo"); JSONObject commonInfo = oj.getJSONObject("commonInfo");
JSONObject order1 = order0.getJSONObject("orderInfo"); 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"); JSONObject expectTimeVo = order1.getJSONObject("expectTimeVo");
String daySeq = order1.getString("dayseq"); String daySeq = order1.getString("dayseq");
String wmOrderViewId = order1.getString("wmOrderViewId"); String wmOrderViewId = order1.getString("wmOrderViewId");
String orderTimeFmt = order1.getString("orderTimeFmt");
String expectTime = expectTimeVo.getString("expectTimeFmt"); String expectTime = expectTimeVo.getString("expectTimeFmt");
String statusDesc = order1.getString("statusDesc"); String statusDesc = order1.getString("statusDesc");
String userId = commonInfo.getString("wmUserId"); String userId = commonInfo.getString("wmUserId");
@ -331,6 +339,18 @@ public class MeituanServiceImpl implements IMeituanService {
orderInfo.setCompleteTime("2024-"+expectTime); orderInfo.setCompleteTime("2024-"+expectTime);
orderInfo.setOrderStatus(statusDesc); orderInfo.setOrderStatus(statusDesc);
orderInfo.setCustomId(userId); orderInfo.setCustomId(userId);
if ("门店新客".equals(info)){
orderInfo.setOrderCount("0");
} else if (info.contains("下单")){
orderInfo.setOrderCount(info.substring(info.indexOf("下单")+2,info.length()-1));
}
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
orderInfo.setOrderTime(format.parse("2024-"+orderTimeFmt));
} catch (ParseException e) {
throw new RuntimeException(e);
}
orderInfo.setIsPhf(isPhf);
list.add(orderInfo); list.add(orderInfo);
} }
if (list.size() > 0) { if (list.size() > 0) {
@ -541,7 +561,7 @@ public class MeituanServiceImpl implements IMeituanService {
* @return * @return
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
Boolean getScoreOne(BusStoreInfo store) { public Boolean getScoreOne(BusStoreInfo store) {
CloseableHttpClient httpClient = proxyHttpClient(); 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"; String url = "https://waimaieapp.meituan.com/gw/customer/comment/scores";
@ -594,7 +614,7 @@ public class MeituanServiceImpl implements IMeituanService {
* @return * @return
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
Boolean getCommentsOne(BusStoreInfo store) { public Boolean getCommentsOne(BusStoreInfo store) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
String url = "https://waimaieapp.meituan.com/gw/customer/comment/statistics/score/summary/single/distribution"; String url = "https://waimaieapp.meituan.com/gw/customer/comment/statistics/score/summary/single/distribution";