|
|
@@ -1,6 +1,5 @@
|
|
|
package shop.alien.store.service.impl;
|
|
|
|
|
|
-import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
@@ -196,8 +195,8 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
try {
|
|
|
StoreTrackEventMapper mapper = this.getBaseMapper();
|
|
|
|
|
|
- // 使用数据库聚合查询统计流量数据
|
|
|
- Map<String, Object> trafficStats = mapper.calculateTrafficStatistics(storeId, startDate, endDate);
|
|
|
+ // 使用数据库聚合查询统计流量数据(累计数据,截至到endDate)
|
|
|
+ Map<String, Object> trafficStats = mapper.calculateTrafficStatistics(storeId, endDate);
|
|
|
|
|
|
// 搜索量
|
|
|
Object searchCountObj = trafficStats.get("searchCount");
|
|
|
@@ -209,11 +208,11 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
long viewCount = viewCountObj != null ? ((Number) viewCountObj).longValue() : 0L;
|
|
|
result.put("viewCount", viewCount);
|
|
|
|
|
|
- // 访客数(去重userId)- 使用数据库聚合查询
|
|
|
- Long visitorCount = mapper.countDistinctVisitors(storeId, startDate, endDate);
|
|
|
+ // 访客数(去重userId)- 累计数据,截至到endDate
|
|
|
+ Long visitorCount = mapper.countDistinctVisitors(storeId, endDate);
|
|
|
result.put("visitorCount", visitorCount != null ? visitorCount : 0L);
|
|
|
|
|
|
- // 新增访客数 - 使用数据库聚合查询
|
|
|
+ // 新增访客数(统计时间段内首次访问的用户,即在startDate之前没有访问记录的用户)
|
|
|
Long newVisitorCount = mapper.countNewVisitors(storeId, startDate, endDate);
|
|
|
result.put("newVisitorCount", newVisitorCount != null ? newVisitorCount : 0L);
|
|
|
|
|
|
@@ -252,8 +251,8 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
try {
|
|
|
StoreTrackEventMapper mapper = this.getBaseMapper();
|
|
|
|
|
|
- // 使用数据库聚合查询统计互动事件(从埋点事件表store_track_event中统计)
|
|
|
- List<Map<String, Object>> interactionStats = mapper.calculateInteractionStatistics(storeId, startDate, endDate);
|
|
|
+ // 使用数据库聚合查询统计互动事件(累计数据,截至到endDate)
|
|
|
+ List<Map<String, Object>> interactionStats = mapper.calculateInteractionStatistics(storeId, endDate);
|
|
|
|
|
|
// 将查询结果转换为Map,便于查找
|
|
|
// 注意:SQL返回的字段名是下划线命名(event_type),而非驼峰命名
|
|
|
@@ -443,9 +442,9 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
|
|
|
try {
|
|
|
- // 赠送好友相关数据(从life_discount_coupon_user表统计,关联店铺的优惠券,type=1优惠券)
|
|
|
+ // 赠送好友相关数据(累计数据,从life_discount_coupon_user表统计)
|
|
|
String storeIdStr = String.valueOf(storeId);
|
|
|
- List<LifeDiscountCouponUser> couponUsers = queryCouponUsersByStore(storeIdStr, startDate, endDate);
|
|
|
+ List<LifeDiscountCouponUser> couponUsers = queryCouponUsersByStore(storeIdStr, endDate);
|
|
|
|
|
|
// 赠送好友数量
|
|
|
long giveToFriendCount = couponUsers.size();
|
|
|
@@ -486,8 +485,8 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
}
|
|
|
result.put("giveToFriendUseAmountPercent", giveToFriendUseAmountPercent);
|
|
|
|
|
|
- // 好友赠送相关数据(从life_discount_coupon_store_friend表统计,type=1优惠券)
|
|
|
- List<LifeDiscountCouponStoreFriend> friendCoupons = queryFriendCouponsByStore(storeId, startDate, endDate, 1);
|
|
|
+ // 好友赠送相关数据(累计数据,从life_discount_coupon_store_friend表统计,type=1优惠券)
|
|
|
+ List<LifeDiscountCouponStoreFriend> friendCoupons = queryFriendCouponsByStore(storeId, endDate, 1);
|
|
|
|
|
|
// 好友赠送数量
|
|
|
long friendGiveCount = friendCoupons.size();
|
|
|
@@ -502,13 +501,12 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
result.put("friendGiveAmount", friendGiveAmount);
|
|
|
|
|
|
- // 好友赠送使用数量(已使用的数量)
|
|
|
- // 需要通过coupon_id和friend_store_user_id查询life_discount_coupon_user表
|
|
|
- long friendGiveUseCount = calculateFriendCouponUseCount(friendCoupons, startDate, endDate);
|
|
|
+ // 好友赠送使用数量(累计数据)
|
|
|
+ long friendGiveUseCount = calculateFriendCouponUseCount(friendCoupons, endDate);
|
|
|
result.put("friendGiveUseCount", friendGiveUseCount);
|
|
|
|
|
|
- // 好友赠送使用金额合计(已使用的优惠券面值总和)
|
|
|
- BigDecimal friendGiveUseAmount = calculateFriendCouponUseAmount(friendCoupons, startDate, endDate);
|
|
|
+ // 好友赠送使用金额合计(累计数据)
|
|
|
+ BigDecimal friendGiveUseAmount = calculateFriendCouponUseAmount(friendCoupons, endDate);
|
|
|
result.put("friendGiveUseAmount", friendGiveUseAmount);
|
|
|
|
|
|
// 好友赠送使用金额占比
|
|
|
@@ -539,9 +537,9 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 查询店铺关联的优惠券用户数据
|
|
|
+ * 查询店铺关联的优惠券用户数据(累计数据,截至到endDate)
|
|
|
*/
|
|
|
- private List<LifeDiscountCouponUser> queryCouponUsersByStore(String storeId, Date startDate, Date endDate) {
|
|
|
+ private List<LifeDiscountCouponUser> queryCouponUsersByStore(String storeId, Date endDate) {
|
|
|
try {
|
|
|
// 先查询店铺的优惠券(type=1优惠券)
|
|
|
LambdaQueryWrapper<LifeDiscountCoupon> couponWrapper = new LambdaQueryWrapper<>();
|
|
|
@@ -558,10 +556,9 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
.map(LifeDiscountCoupon::getId)
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
- // 查询优惠券用户数据
|
|
|
+ // 查询优惠券用户数据(累计数据)
|
|
|
LambdaQueryWrapper<LifeDiscountCouponUser> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.in(LifeDiscountCouponUser::getCouponId, couponIds)
|
|
|
- .ge(LifeDiscountCouponUser::getReceiveTime, startDate)
|
|
|
.lt(LifeDiscountCouponUser::getReceiveTime, endDate)
|
|
|
.eq(LifeDiscountCouponUser::getDeleteFlag, 0);
|
|
|
return lifeDiscountCouponUserMapper.selectList(wrapper);
|
|
|
@@ -572,9 +569,9 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 查询好友赠送的优惠券/代金券数据
|
|
|
+ * 查询好友赠送的优惠券/代金券数据(累计数据,截至到endDate)
|
|
|
*/
|
|
|
- private List<LifeDiscountCouponStoreFriend> queryFriendCouponsByStore(Integer storeId, Date startDate, Date endDate, Integer type) {
|
|
|
+ private List<LifeDiscountCouponStoreFriend> queryFriendCouponsByStore(Integer storeId, Date endDate, Integer type) {
|
|
|
try {
|
|
|
// 先查询店铺用户
|
|
|
LambdaQueryWrapper<StoreUser> userWrapper = new LambdaQueryWrapper<>();
|
|
|
@@ -590,11 +587,9 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
.map(StoreUser::getId)
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
- // 查询好友赠送的优惠券/代金券
|
|
|
- // 需要通过coupon_id关联查询优惠券类型
|
|
|
+ // 查询好友赠送的优惠券/代金券(累计数据)
|
|
|
LambdaQueryWrapper<LifeDiscountCouponStoreFriend> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.in(LifeDiscountCouponStoreFriend::getFriendStoreUserId, storeUserIds)
|
|
|
- .ge(LifeDiscountCouponStoreFriend::getCreatedTime, startDate)
|
|
|
.lt(LifeDiscountCouponStoreFriend::getCreatedTime, endDate)
|
|
|
.eq(LifeDiscountCouponStoreFriend::getDeleteFlag, 0);
|
|
|
List<LifeDiscountCouponStoreFriend> storeFriends = lifeDiscountCouponStoreFriendMapper.selectList(wrapper);
|
|
|
@@ -613,9 +608,9 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 计算好友赠送优惠券使用数量
|
|
|
+ * 计算好友赠送优惠券使用数量(累计数据,截至到endDate)
|
|
|
*/
|
|
|
- private long calculateFriendCouponUseCount(List<LifeDiscountCouponStoreFriend> friendCoupons, Date startDate, Date endDate) {
|
|
|
+ private long calculateFriendCouponUseCount(List<LifeDiscountCouponStoreFriend> friendCoupons, Date endDate) {
|
|
|
if (friendCoupons == null || friendCoupons.isEmpty()) {
|
|
|
return 0L;
|
|
|
}
|
|
|
@@ -629,7 +624,6 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
LambdaQueryWrapper<LifeDiscountCouponUser> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.in(LifeDiscountCouponUser::getCouponId, couponIds)
|
|
|
.eq(LifeDiscountCouponUser::getStatus, 1) // 已使用
|
|
|
- .ge(LifeDiscountCouponUser::getUseTime, startDate)
|
|
|
.lt(LifeDiscountCouponUser::getUseTime, endDate)
|
|
|
.eq(LifeDiscountCouponUser::getDeleteFlag, 0);
|
|
|
return lifeDiscountCouponUserMapper.selectCount(wrapper);
|
|
|
@@ -640,9 +634,9 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 计算好友赠送优惠券使用金额
|
|
|
+ * 计算好友赠送优惠券使用金额(累计数据,截至到endDate)
|
|
|
*/
|
|
|
- private BigDecimal calculateFriendCouponUseAmount(List<LifeDiscountCouponStoreFriend> friendCoupons, Date startDate, Date endDate) {
|
|
|
+ private BigDecimal calculateFriendCouponUseAmount(List<LifeDiscountCouponStoreFriend> friendCoupons, Date endDate) {
|
|
|
if (friendCoupons == null || friendCoupons.isEmpty()) {
|
|
|
return BigDecimal.ZERO;
|
|
|
}
|
|
|
@@ -656,7 +650,6 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
LambdaQueryWrapper<LifeDiscountCouponUser> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.in(LifeDiscountCouponUser::getCouponId, couponIds)
|
|
|
.eq(LifeDiscountCouponUser::getStatus, 1) // 已使用
|
|
|
- .ge(LifeDiscountCouponUser::getUseTime, startDate)
|
|
|
.lt(LifeDiscountCouponUser::getUseTime, endDate)
|
|
|
.eq(LifeDiscountCouponUser::getDeleteFlag, 0);
|
|
|
List<LifeDiscountCouponUser> usedCoupons = lifeDiscountCouponUserMapper.selectList(wrapper);
|
|
|
@@ -682,8 +675,8 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
try {
|
|
|
StoreTrackEventMapper mapper = this.getBaseMapper();
|
|
|
|
|
|
- // 使用数据库聚合查询统计代金券事件
|
|
|
- List<Map<String, Object>> voucherStats = mapper.calculateVoucherStatistics(storeId, startDate, endDate);
|
|
|
+ // 使用数据库聚合查询统计代金券事件(累计数据,截至到endDate)
|
|
|
+ List<Map<String, Object>> voucherStats = mapper.calculateVoucherStatistics(storeId, endDate);
|
|
|
|
|
|
// 将查询结果转换为Map,便于查找
|
|
|
// 注意:SQL返回的字段名是下划线命名(event_type),而非驼峰命名
|
|
|
@@ -729,8 +722,8 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
}
|
|
|
result.put("giveToFriendUseAmountPercent", giveToFriendUseAmountPercent);
|
|
|
|
|
|
- // 好友赠送代金券相关数据(从life_discount_coupon_store_friend表统计,type=2代金券)
|
|
|
- List<LifeDiscountCouponStoreFriend> friendVouchers = queryFriendCouponsByStore(storeId, startDate, endDate, 2); // type=2代金券
|
|
|
+ // 好友赠送代金券相关数据(累计数据,type=2代金券)
|
|
|
+ List<LifeDiscountCouponStoreFriend> friendVouchers = queryFriendCouponsByStore(storeId, endDate, 2);
|
|
|
|
|
|
// 好友赠送数量
|
|
|
long friendGiveCount = friendVouchers.size();
|
|
|
@@ -745,12 +738,12 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
result.put("friendGiveAmount", friendGiveAmount);
|
|
|
|
|
|
- // 好友赠送使用数量(已使用的数量)
|
|
|
- long friendGiveUseCount = calculateFriendCouponUseCount(friendVouchers, startDate, endDate);
|
|
|
+ // 好友赠送使用数量(累计数据)
|
|
|
+ long friendGiveUseCount = calculateFriendCouponUseCount(friendVouchers, endDate);
|
|
|
result.put("friendGiveUseCount", friendGiveUseCount);
|
|
|
|
|
|
- // 好友赠送使用金额合计(已使用的代金券面值总和)
|
|
|
- BigDecimal friendGiveUseAmount = calculateFriendCouponUseAmount(friendVouchers, startDate, endDate);
|
|
|
+ // 好友赠送使用金额合计(累计数据)
|
|
|
+ BigDecimal friendGiveUseAmount = calculateFriendCouponUseAmount(friendVouchers, endDate);
|
|
|
result.put("friendGiveUseAmount", friendGiveUseAmount);
|
|
|
|
|
|
// 好友赠送使用金额占比
|
|
|
@@ -789,11 +782,10 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
try {
|
|
|
StoreTrackEventMapper mapper = this.getBaseMapper();
|
|
|
|
|
|
- // 使用数据库聚合查询统计服务事件
|
|
|
- List<Map<String, Object>> serviceStats = mapper.calculateServiceStatistics(storeId, startDate, endDate);
|
|
|
+ // 使用数据库聚合查询统计服务事件(累计数据,截至到endDate)
|
|
|
+ List<Map<String, Object>> serviceStats = mapper.calculateServiceStatistics(storeId, endDate);
|
|
|
|
|
|
// 将查询结果转换为Map,便于查找
|
|
|
- // 注意:SQL返回的字段名是下划线命名(event_type),而非驼峰命名
|
|
|
Map<String, Long> eventTypeCountMap = new HashMap<>();
|
|
|
for (Map<String, Object> stat : serviceStats) {
|
|
|
String eventType = (String) stat.get("event_type");
|
|
|
@@ -815,11 +807,13 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
Double storeScore = calculateStoreScore(ratings);
|
|
|
result.put("storeScore", storeScore);
|
|
|
|
|
|
- // 口味评分、环境评分、服务评分
|
|
|
- Map<String, Double> otherScores = calculateOtherScores(ratings);
|
|
|
- result.put("tasteScore", otherScores.getOrDefault("口味", null));
|
|
|
- result.put("environmentScore", otherScores.getOrDefault("环境", null));
|
|
|
- result.put("serviceScore", otherScores.getOrDefault("服务", null));
|
|
|
+ // 评分1、评分2、评分3(直接从common_rating表的scoreOne/scoreTwo/scoreThree字段获取)
|
|
|
+ Double scoreOne = calculateScoreAverage(ratings, CommonRating::getScoreOne);
|
|
|
+ Double scoreTwo = calculateScoreAverage(ratings, CommonRating::getScoreTwo);
|
|
|
+ Double scoreThree = calculateScoreAverage(ratings, CommonRating::getScoreThree);
|
|
|
+ result.put("scoreOne", scoreOne);
|
|
|
+ result.put("scoreTwo", scoreTwo);
|
|
|
+ result.put("scoreThree", scoreThree);
|
|
|
|
|
|
// 评价数量
|
|
|
long ratingCount = ratings.size();
|
|
|
@@ -853,8 +847,8 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
}
|
|
|
result.put("badRatingPercent", badRatingPercent);
|
|
|
|
|
|
- // 差评申诉成功次数
|
|
|
- long appealSuccessCount = calculateAppealSuccessCount(storeId, startDate, endDate);
|
|
|
+ // 差评申诉成功次数(累计数据)
|
|
|
+ long appealSuccessCount = calculateAppealSuccessCount(storeId, endDate);
|
|
|
result.put("appealSuccessCount", appealSuccessCount);
|
|
|
|
|
|
// 差评申诉成功占比
|
|
|
@@ -870,9 +864,9 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
log.error("计算服务质量数据失败: storeId={}", storeId, e);
|
|
|
// 返回默认值,避免统计失败
|
|
|
result.put("storeScore", null);
|
|
|
- result.put("tasteScore", null);
|
|
|
- result.put("environmentScore", null);
|
|
|
- result.put("serviceScore", null);
|
|
|
+ result.put("scoreOne", null);
|
|
|
+ result.put("scoreTwo", null);
|
|
|
+ result.put("scoreThree", null);
|
|
|
result.put("ratingCount", 0L);
|
|
|
result.put("goodRatingCount", 0L);
|
|
|
result.put("midRatingCount", 0L);
|
|
|
@@ -894,8 +888,7 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
LambdaQueryWrapper<CommonRating> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(CommonRating::getBusinessId, storeId)
|
|
|
.eq(CommonRating::getBusinessType, 1) // 商铺评价
|
|
|
- .ge(CommonRating::getCreatedTime, startDate)
|
|
|
- .lt(CommonRating::getCreatedTime, endDate)
|
|
|
+ .lt(CommonRating::getCreatedTime, endDate) // 累计数据,只限制截止日期
|
|
|
.eq(CommonRating::getDeleteFlag, 0);
|
|
|
return commonRatingMapper.selectList(wrapper);
|
|
|
} catch (Exception e) {
|
|
|
@@ -931,54 +924,41 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 计算多维度评分(口味、环境、服务)
|
|
|
+ * 计算单个评分字段的平均分
|
|
|
*/
|
|
|
- private Map<String, Double> calculateOtherScores(List<CommonRating> ratings) {
|
|
|
- Map<String, Double> result = new HashMap<>();
|
|
|
- Map<String, List<Double>> scoresMap = new HashMap<>();
|
|
|
-
|
|
|
- for (CommonRating rating : ratings) {
|
|
|
- if (rating.getOtherScore() == null || rating.getOtherScore().trim().isEmpty()) {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- try {
|
|
|
- JSONObject otherScoreJson = JSONObject.parseObject(rating.getOtherScore());
|
|
|
- for (String key : otherScoreJson.keySet()) {
|
|
|
- Object value = otherScoreJson.get(key);
|
|
|
- if (value instanceof Number) {
|
|
|
- scoresMap.computeIfAbsent(key, k -> new ArrayList<>())
|
|
|
- .add(((Number) value).doubleValue());
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.debug("解析otherScore失败: {}", rating.getOtherScore(), e);
|
|
|
- }
|
|
|
+ private Double calculateScoreAverage(List<CommonRating> ratings, java.util.function.Function<CommonRating, Double> scoreExtractor) {
|
|
|
+ if (ratings == null || ratings.isEmpty()) {
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
- // 计算每个维度的平均分
|
|
|
- for (Map.Entry<String, List<Double>> entry : scoresMap.entrySet()) {
|
|
|
- List<Double> scores = entry.getValue();
|
|
|
- if (!scores.isEmpty()) {
|
|
|
- double avg = scores.stream().mapToDouble(Double::doubleValue).sum() / scores.size();
|
|
|
- result.put(entry.getKey(), BigDecimal.valueOf(avg)
|
|
|
- .setScale(1, RoundingMode.HALF_UP)
|
|
|
- .doubleValue());
|
|
|
- }
|
|
|
+ double sum = ratings.stream()
|
|
|
+ .map(scoreExtractor)
|
|
|
+ .filter(score -> score != null)
|
|
|
+ .mapToDouble(Double::doubleValue)
|
|
|
+ .sum();
|
|
|
+ long count = ratings.stream()
|
|
|
+ .map(scoreExtractor)
|
|
|
+ .filter(score -> score != null)
|
|
|
+ .count();
|
|
|
+
|
|
|
+ if (count == 0) {
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
- return result;
|
|
|
+ double avg = sum / count;
|
|
|
+ return BigDecimal.valueOf(avg)
|
|
|
+ .setScale(1, RoundingMode.HALF_UP)
|
|
|
+ .doubleValue();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 计算差评申诉成功次数
|
|
|
+ * 计算差评申诉成功次数(累计数据,截至到endDate)
|
|
|
*/
|
|
|
- private long calculateAppealSuccessCount(Integer storeId, Date startDate, Date endDate) {
|
|
|
+ private long calculateAppealSuccessCount(Integer storeId, Date endDate) {
|
|
|
try {
|
|
|
LambdaQueryWrapper<StoreCommentAppeal> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(StoreCommentAppeal::getStoreId, storeId)
|
|
|
.eq(StoreCommentAppeal::getAppealStatus, 2) // 已同意
|
|
|
- .ge(StoreCommentAppeal::getCreatedTime, startDate)
|
|
|
.lt(StoreCommentAppeal::getCreatedTime, endDate)
|
|
|
.eq(StoreCommentAppeal::getDeleteFlag, 0);
|
|
|
return storeCommentAppealMapper.selectCount(wrapper);
|
|
|
@@ -995,8 +975,8 @@ public class TrackEventServiceImpl extends ServiceImpl<StoreTrackEventMapper, St
|
|
|
try {
|
|
|
StoreTrackEventMapper mapper = this.getBaseMapper();
|
|
|
|
|
|
- // 使用数据库聚合查询统计价目表排名数据(已按viewCount降序排列)
|
|
|
- List<Map<String, Object>> result = mapper.calculatePriceRanking(storeId, startDate, endDate);
|
|
|
+ // 使用数据库聚合查询统计价目表排名数据(累计数据,截至到endDate)
|
|
|
+ List<Map<String, Object>> result = mapper.calculatePriceRanking(storeId, endDate);
|
|
|
|
|
|
// 转换数据类型,确保与文档格式一致
|
|
|
for (Map<String, Object> priceData : result) {
|