|
@@ -1,6 +1,9 @@
|
|
|
package com.fs.statis.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.redis.RedisCache;
|
|
|
+import com.fs.common.utils.TimeUtils;
|
|
|
import com.fs.company.cache.ICompanyCacheService;
|
|
|
import com.fs.course.mapper.FsCourseTrafficLogMapper;
|
|
|
import com.fs.statis.StatisticsRedisConstant;
|
|
@@ -25,7 +28,9 @@ import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.time.temporal.TemporalAdjusters;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import static com.fs.statis.StatisticsRedisConstant.*;
|
|
|
|
|
@@ -788,4 +793,44 @@ public class StatisticsServiceImpl implements IStatisticsService {
|
|
|
trafficLogDTO.setThisMonth(monthTrafficLog);
|
|
|
return trafficLogDTO;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void thisMonthOrderCount() {
|
|
|
+ Long[] users=new Long[0];
|
|
|
+ TimeUtils.TimeEntity timeEntity=TimeUtils.parseTime("5",null,null);
|
|
|
+ timeEntity.setUserIds(users);
|
|
|
+ Integer cycleNum = timeEntity.getCycleNum();
|
|
|
+ Integer beginTime = timeEntity.getBeginTime();
|
|
|
+ List<Integer> timeList = new ArrayList<>();
|
|
|
+ for (int i = 1; i <= cycleNum; i++) {
|
|
|
+ timeList.add(beginTime);
|
|
|
+ beginTime = TimeUtils.formatTime(beginTime);
|
|
|
+ }
|
|
|
+ List<JSONObject> jsonObjectList = storeOrderService.selectFsStoreOrderCounts(timeEntity.toMap());
|
|
|
+ List<String> dates = jsonObjectList.stream().map(jsonObject -> jsonObject.getString("type")).collect(Collectors.toList());
|
|
|
+ List<Integer> orderCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("orderCount")).collect(Collectors.toList());
|
|
|
+ List<Integer> payPrice = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("payPrice")).collect(Collectors.toList());
|
|
|
+ R result = R.ok().put("dates", dates).put("orderCount", orderCount).put("payPrice", payPrice);
|
|
|
+ redisCache.setCacheObject(THIS_MONTH_ORDER_COUNT,result);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void thisMonthRecvCount() {
|
|
|
+ Long[] users=new Long[0];
|
|
|
+ TimeUtils.TimeEntity timeEntity=TimeUtils.parseTime("5",null,null);
|
|
|
+ timeEntity.setUserIds(users);
|
|
|
+ Integer cycleNum = timeEntity.getCycleNum();
|
|
|
+ Integer beginTime = timeEntity.getBeginTime();
|
|
|
+ List<Integer> timeList = new ArrayList<>();
|
|
|
+ for (int i = 1; i <= cycleNum; i++) {
|
|
|
+ timeList.add(beginTime);
|
|
|
+ beginTime = TimeUtils.formatTime(beginTime);
|
|
|
+ }
|
|
|
+ List<JSONObject> jsonObjectList = paymentService.selectFsStorePaymentCounts(timeEntity.toMap());
|
|
|
+ List<String> dates = jsonObjectList.stream().map(jsonObject -> jsonObject.getString("type")).collect(Collectors.toList());
|
|
|
+ List<Integer> orderCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("orderCount")).collect(Collectors.toList());
|
|
|
+ List<Float> payMoney = jsonObjectList.stream().map(jsonObject -> jsonObject.getFloatValue("payMoney")).collect(Collectors.toList());
|
|
|
+ R result = R.ok().put("dates", dates).put("orderCount", orderCount).put("payMoney", payMoney);
|
|
|
+ redisCache.setCacheObject(THIS_MONTH_RECV_COUNT,result);
|
|
|
+ }
|
|
|
}
|