记得上下班打卡 | git大法好,push需谨慎

Commit bae05b01 authored by 胡佳晨's avatar 胡佳晨

修改bug

parent 265abaf2
......@@ -829,6 +829,7 @@ public class GoblinMongoUtils {
//查询销量
int size = 20;
int skipCount = ((page - 1) * size);
int finalCount = skipCount+size;
List<GoblinGoodsInfoVo> spuIdAndName = null;
Criteria criteria = Criteria.where("status").in(GoblinStatusConst.Status.ORDER_LOG_STATUS_11.getValue(), GoblinStatusConst.Status.ORDER_LOG_STATUS_22.getValue(), GoblinStatusConst.Status.ORDER_LOG_STATUS_28.getValue()).and("storeId").is(storeId);
if (spuName != null) {
......@@ -841,14 +842,22 @@ public class GoblinMongoUtils {
if (st != null && et != null) {
criteria = criteria.and("createdAt").gte(st).lt(et);
}
//查询总数量
Query countQuery = Query.query(criteria);
countQuery.fields().include("spuId");
List<GoblinOrderLogVo> countList = mongoTemplate.find(countQuery, GoblinOrderLogVo.class, GoblinOrderLogVo.class.getSimpleName());
List<String> spuIdList = countList.stream().map(GoblinOrderLogVo::getSpuId).distinct().collect(Collectors.toList());
long total = spuIdList.size();
if(finalCount>total){
finalCount = (int)total;
}
criteria = criteria.and("spuId").in(spuIdList.subList(skipCount, finalCount));
//查询聚合数据
Aggregation aggregation = Aggregation.newAggregation(
Aggregation.match(criteria),
Aggregation.skip(skipCount),
Aggregation.limit(size),
Aggregation.project("spuId", "skuPriceActual"),
Aggregation.group("spuId")
.first("spuId").as("spuId")
.first("createdAt").as("createdAt")
.sum("skuPriceActual").as("skuPriceActual")
);
AggregationResults<GoblinOrderLogVo> outputType = mongoTemplate.aggregate(aggregation, GoblinOrderLogVo.class.getSimpleName(), GoblinOrderLogVo.class);
......@@ -858,11 +867,6 @@ public class GoblinMongoUtils {
query.fields().include("spuId").include("name");
spuIdAndName = mongoTemplate.find(query, GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName());
}
//查询总数量
Query countQuery = Query.query(criteria);
countQuery.fields().include("spuId");
List<GoblinOrderLogVo> countList = mongoTemplate.find(countQuery, GoblinOrderLogVo.class, GoblinOrderLogVo.class.getSimpleName());
long total = countList.stream().map(GoblinOrderLogVo::getSpuId).distinct().collect(Collectors.toList()).size();
//处理数据
for (GoblinOrderLogVo item : dataList) {
for (GoblinGoodsInfoVo item2 : spuIdAndName) {
......
......@@ -61,8 +61,8 @@ public class SweetPerformanceServiceImpl extends ServiceImpl<SweetPerformanceMap
show.setArUrl(arUrl);
show.setArName(arName);
show.setOfflineUrl(offlineUrl);
show.setTimeStart(LocalDateTime.parse(timeStart));
show.setTimeEnd(LocalDateTime.parse(timeEnd));
show.setTimeStart(LocalDateTime.parse(timeStart,DTF_YMD_HMS));
show.setTimeEnd(LocalDateTime.parse(timeEnd,DTF_YMD_HMS));
//redis
List<SweetPerformanceShow> performanceARList = redisUtils.getPerformanceAR();
performanceARList.add(show);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment