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";