From 38076e05aa12e2a3bec0ed7c79282ae8f06540a6 Mon Sep 17 00:00:00 2001 From: Lenovo Date: Wed, 10 Jul 2024 16:27:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=98=AF=E5=90=A6=E6=8B=BC?= =?UTF-8?q?=E5=A5=BD=E9=A5=AD=E4=B8=8E=E4=B8=8B=E5=8D=95=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/MeituanServiceImpl.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/MeituanServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/MeituanServiceImpl.java index 824a2b2..1abae87 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/MeituanServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/MeituanServiceImpl.java @@ -35,6 +35,7 @@ import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; +import org.apache.ibatis.javassist.Loader; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; @@ -42,6 +43,7 @@ import org.springframework.transaction.annotation.Transactional; import java.io.IOException; import java.net.URLEncoder; +import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -301,12 +303,18 @@ public class MeituanServiceImpl implements IMeituanService { BusOrderInfo orderInfo = new BusOrderInfo(); Object o = array.get(i); JSONObject oj = JSONObject.parseObject(JSON.toJSONString(o)); + String isPhf = oj.getString("businessType"); JSONObject order0 = oj.getJSONObject("orderInfo"); JSONObject commonInfo = oj.getJSONObject("commonInfo"); 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"); String daySeq = order1.getString("dayseq"); String wmOrderViewId = order1.getString("wmOrderViewId"); + String orderTimeFmt = order1.getString("orderTimeFmt"); String expectTime = expectTimeVo.getString("expectTimeFmt"); String statusDesc = order1.getString("statusDesc"); String userId = commonInfo.getString("wmUserId"); @@ -331,6 +339,18 @@ public class MeituanServiceImpl implements IMeituanService { orderInfo.setCompleteTime("2024-"+expectTime); orderInfo.setOrderStatus(statusDesc); 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); } if (list.size() > 0) { @@ -541,7 +561,7 @@ public class MeituanServiceImpl implements IMeituanService { * @return */ @Transactional(rollbackFor = Exception.class) - Boolean getScoreOne(BusStoreInfo store) { + public Boolean getScoreOne(BusStoreInfo store) { CloseableHttpClient httpClient = proxyHttpClient(); String wmPoiId = valueFromCookie("wmPoiId", store.getStoreCookie()); String url = "https://waimaieapp.meituan.com/gw/customer/comment/scores"; @@ -594,7 +614,7 @@ public class MeituanServiceImpl implements IMeituanService { * @return */ @Transactional(rollbackFor = Exception.class) - Boolean getCommentsOne(BusStoreInfo store) { + public Boolean getCommentsOne(BusStoreInfo store) { LocalDateTime now = LocalDateTime.now(); String url = "https://waimaieapp.meituan.com/gw/customer/comment/statistics/score/summary/single/distribution";