1;历史数据新增
This commit is contained in:
parent
781a39d137
commit
6d9480ad5d
|
@ -66,4 +66,6 @@ public interface BusStoreDayHistoryInfoMapper
|
||||||
BusStoreDayHistoryInfo getByDate(@Param("id") Long id, @Param("sT") String sT, @Param("eT") String eT);
|
BusStoreDayHistoryInfo getByDate(@Param("id") Long id, @Param("sT") String sT, @Param("eT") String eT);
|
||||||
|
|
||||||
List<BusStoreDayHistoryInfo> selectBusStoreDayHistoryInfoListByDate(@Param("id") Long id,@Param("date") String date);
|
List<BusStoreDayHistoryInfo> selectBusStoreDayHistoryInfoListByDate(@Param("id") Long id,@Param("date") String date);
|
||||||
|
|
||||||
|
void insertBatchStoreDayHistoryInfo(@Param("addList") List<BusStoreDayHistoryInfo> addList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -842,33 +842,35 @@ public class MeituanServiceImpl implements IMeituanService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getReturnInfo(Long id) {
|
public void getReturnInfo(Long id) {
|
||||||
getComments(null);
|
log.error("***********history************************");
|
||||||
|
List<BusStoreDayHistoryInfo> addList = new ArrayList<>();
|
||||||
|
List<BusStoreDayHistoryInfo> editList = new ArrayList<>();
|
||||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
LocalDateTime date = LocalDateTime.now().minusDays(1);
|
LocalDateTime date = LocalDateTime.now().minusDays(1);
|
||||||
BusStoreInfo storeInfo = new BusStoreInfo();
|
BusStoreDayInfo storeInfo = new BusStoreDayInfo();
|
||||||
if (id != null){
|
if (id != null){
|
||||||
storeInfo.setId(id);
|
storeInfo.setStoreId(id);
|
||||||
}
|
}
|
||||||
List<BusStoreInfo> storeInfoList = busStoreInfoMapper.selectBusStoreInfoListA(storeInfo);
|
// List<BusStoreInfo> storeInfoList = busStoreInfoMapper.selectBusStoreInfoListA(storeInfo);
|
||||||
for (BusStoreInfo busStoreInfo : storeInfoList) {
|
List<BusStoreDayInfo> list1 = busStoreDayInfoMapper.selectBusStoreDayInfoListByDate(storeInfo.getStoreId(),date.format(dateTimeFormatter));
|
||||||
List<BusStoreDayInfo> list1 = busStoreDayInfoMapper.selectBusStoreDayInfoListByDate(busStoreInfo.getId(),date.format(dateTimeFormatter));
|
for (BusStoreDayInfo busStoreDayInfo : list1) {
|
||||||
if (list1.size() == 1) {
|
// if (list1.size() == 1) {
|
||||||
BusStoreDayInfo busStoreDayInfo = list1.get(0);
|
// BusStoreDayInfo busStoreDayInfo = list1.get(0);
|
||||||
List<BusStoreDayHistoryInfo> list2 = busStoreDayHistoryInfoMapper.selectBusStoreDayHistoryInfoListByDate(busStoreInfo.getId(),date.format(dateTimeFormatter));
|
List<BusStoreDayHistoryInfo> list2 = busStoreDayHistoryInfoMapper.selectBusStoreDayHistoryInfoListByDate(busStoreDayInfo.getStoreId(),date.format(dateTimeFormatter));
|
||||||
if (list2.size() > 0){
|
if (list2.size() == 0){
|
||||||
BusStoreDayHistoryInfo target = new BusStoreDayHistoryInfo();
|
|
||||||
BeanUtils.copyProperties(busStoreDayInfo, target);
|
|
||||||
target.setId(list2.get(0).getId());
|
|
||||||
busStoreDayHistoryInfoMapper.updateBusStoreDayHistoryInfo(target);
|
|
||||||
}else {
|
|
||||||
BusStoreDayHistoryInfo target = new BusStoreDayHistoryInfo();
|
BusStoreDayHistoryInfo target = new BusStoreDayHistoryInfo();
|
||||||
BeanUtils.copyProperties(busStoreDayInfo, target);
|
BeanUtils.copyProperties(busStoreDayInfo, target);
|
||||||
target.setId(null);
|
target.setId(null);
|
||||||
target.setCreateTime(Date.from(date.atZone(ZoneId.systemDefault()).toInstant()));
|
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){
|
private String getRate(int a, int b){
|
||||||
|
|
|
@ -126,6 +126,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
<insert id="insertBatchStoreDayHistoryInfo">
|
||||||
|
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
|
||||||
|
<foreach collection="addList" separator="," item="item">
|
||||||
|
(#{item.storeId},#{item.lastOrderNum},#{item.lastPositiveReviewsNum},#{item.lastFiveStarReviewsNum},
|
||||||
|
#{item.lastReturnVisitNum},#{item.lastReturnVisitRate},#{item.todayReturnVisitNum},#{item.score},#{item.createTime})
|
||||||
|
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
<update id="updateBusStoreDayHistoryInfo" parameterType="BusStoreDayHistoryInfo">
|
<update id="updateBusStoreDayHistoryInfo" parameterType="BusStoreDayHistoryInfo">
|
||||||
update bus_store_day_history_info
|
update bus_store_day_history_info
|
||||||
|
|
Loading…
Reference in New Issue