From 6d9480ad5d0cdc78456710a6f6b36e9489b1ddbb Mon Sep 17 00:00:00 2001 From: wangshuai Date: Sun, 4 Aug 2024 11:02:12 +0800 Subject: [PATCH] =?UTF-8?q?1=EF=BC=9B=E5=8E=86=E5=8F=B2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/BusStoreDayHistoryInfoMapper.java | 2 ++ .../service/impl/MeituanServiceImpl.java | 36 ++++++++++--------- .../business/BusStoreDayHistoryInfoMapper.xml | 9 +++++ 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/business/mapper/BusStoreDayHistoryInfoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/business/mapper/BusStoreDayHistoryInfoMapper.java index c50dd74..e600a99 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/business/mapper/BusStoreDayHistoryInfoMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/business/mapper/BusStoreDayHistoryInfoMapper.java @@ -66,4 +66,6 @@ public interface BusStoreDayHistoryInfoMapper BusStoreDayHistoryInfo getByDate(@Param("id") Long id, @Param("sT") String sT, @Param("eT") String eT); List selectBusStoreDayHistoryInfoListByDate(@Param("id") Long id,@Param("date") String date); + + void insertBatchStoreDayHistoryInfo(@Param("addList") List addList); } 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 a90f657..82fce70 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 @@ -842,33 +842,35 @@ public class MeituanServiceImpl implements IMeituanService { @Override public void getReturnInfo(Long id) { - getComments(null); + log.error("***********history************************"); + List addList = new ArrayList<>(); + List editList = new ArrayList<>(); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); LocalDateTime date = LocalDateTime.now().minusDays(1); - BusStoreInfo storeInfo = new BusStoreInfo(); + BusStoreDayInfo storeInfo = new BusStoreDayInfo(); if (id != null){ - storeInfo.setId(id); + storeInfo.setStoreId(id); } - List storeInfoList = busStoreInfoMapper.selectBusStoreInfoListA(storeInfo); - for (BusStoreInfo busStoreInfo : storeInfoList) { - List list1 = busStoreDayInfoMapper.selectBusStoreDayInfoListByDate(busStoreInfo.getId(),date.format(dateTimeFormatter)); - if (list1.size() == 1) { - BusStoreDayInfo busStoreDayInfo = list1.get(0); - List list2 = busStoreDayHistoryInfoMapper.selectBusStoreDayHistoryInfoListByDate(busStoreInfo.getId(),date.format(dateTimeFormatter)); - if (list2.size() > 0){ - BusStoreDayHistoryInfo target = new BusStoreDayHistoryInfo(); - BeanUtils.copyProperties(busStoreDayInfo, target); - target.setId(list2.get(0).getId()); - busStoreDayHistoryInfoMapper.updateBusStoreDayHistoryInfo(target); - }else { +// List storeInfoList = busStoreInfoMapper.selectBusStoreInfoListA(storeInfo); + List list1 = busStoreDayInfoMapper.selectBusStoreDayInfoListByDate(storeInfo.getStoreId(),date.format(dateTimeFormatter)); + for (BusStoreDayInfo busStoreDayInfo : list1) { +// if (list1.size() == 1) { +// BusStoreDayInfo busStoreDayInfo = list1.get(0); + List list2 = busStoreDayHistoryInfoMapper.selectBusStoreDayHistoryInfoListByDate(busStoreDayInfo.getStoreId(),date.format(dateTimeFormatter)); + if (list2.size() == 0){ BusStoreDayHistoryInfo target = new BusStoreDayHistoryInfo(); BeanUtils.copyProperties(busStoreDayInfo, target); target.setId(null); target.setCreateTime(Date.from(date.atZone(ZoneId.systemDefault()).toInstant())); - busStoreDayHistoryInfoMapper.insertBusStoreDayHistoryInfo(target); +// busStoreDayHistoryInfoMapper.insertBusStoreDayHistoryInfo(target); + addList.add(target); } - } +// } } + if(addList.size()>0){ + busStoreDayHistoryInfoMapper.insertBatchStoreDayHistoryInfo(addList); + } + log.error("***********historyEnd************************"); } private String getRate(int a, int b){ diff --git a/ruoyi-system/src/main/resources/mapper/business/BusStoreDayHistoryInfoMapper.xml b/ruoyi-system/src/main/resources/mapper/business/BusStoreDayHistoryInfoMapper.xml index 049d8d7..88ed06f 100644 --- a/ruoyi-system/src/main/resources/mapper/business/BusStoreDayHistoryInfoMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/business/BusStoreDayHistoryInfoMapper.xml @@ -126,6 +126,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{createTime}, + + insert into bus_store_day_history_info (store_id,last_order_num,last_positive_reviews_num,last_five_star_reviews_num, + last_return_visit_num,last_return_visit_rate,today_return_visit_num,score,create_time) values + + (#{item.storeId},#{item.lastOrderNum},#{item.lastPositiveReviewsNum},#{item.lastFiveStarReviewsNum}, + #{item.lastReturnVisitNum},#{item.lastReturnVisitRate},#{item.todayReturnVisitNum},#{item.score},#{item.createTime}) + + + update bus_store_day_history_info