|
@@ -2,14 +2,12 @@ package com.gis.service.impl;
|
|
|
|
|
|
import com.gis.common.util.Result;
|
|
|
import com.gis.domain.po.NewsEntity;
|
|
|
-import com.gis.service.CommentService;
|
|
|
-import com.gis.service.NewsService;
|
|
|
-import com.gis.service.SceneService;
|
|
|
-import com.gis.service.StatsService;
|
|
|
+import com.gis.domain.vo.StatsVo;
|
|
|
+import com.gis.service.*;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import tk.mybatis.mapper.entity.Condition;
|
|
|
|
|
|
import java.time.LocalDate;
|
|
|
import java.util.ArrayList;
|
|
@@ -32,68 +30,64 @@ public class StatsServiceImpl implements StatsService {
|
|
|
@Autowired
|
|
|
NewsService newsService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ VisitService visitService;
|
|
|
+
|
|
|
|
|
|
|
|
|
@Override
|
|
|
public Result flowCount() {
|
|
|
List result = new ArrayList<>();
|
|
|
-//
|
|
|
-// // 线上史馆
|
|
|
-// StatsVo sceneCount = new StatsVo();
|
|
|
-// sceneCount.setType("scene");
|
|
|
-// sceneCount.setSort(1);
|
|
|
-// sceneCount.setTotal(sceneService.countTotal());
|
|
|
-// LocalDate now = LocalDate.now();
|
|
|
-// sceneCount.setToday(sceneService.countFindByDate(now));
|
|
|
-// sceneCount.setYesterday(sceneService.countFindByDate(now.minusDays(1)));
|
|
|
-//
|
|
|
-// // 弹幕
|
|
|
-// StatsVo barrageCount = new StatsVo();
|
|
|
-// barrageCount.setType("barrage");
|
|
|
-// barrageCount.setSort(2);
|
|
|
-// barrageCount.setTotal(barrageService.findAll().size());
|
|
|
-// barrageCount.setToday(barrageService.countFindByDate(now));
|
|
|
-// barrageCount.setYesterday(barrageService.countFindByDate(now.minusDays(1)));
|
|
|
-//
|
|
|
-//
|
|
|
-// // 留言
|
|
|
-// StatsVo commentCount = new StatsVo();
|
|
|
-// commentCount.setType("comment");
|
|
|
-// commentCount.setSort(3);
|
|
|
-// commentCount.setTotal(commentService.findAll().size());
|
|
|
-// commentCount.setToday(commentService.countFindByDate(now));
|
|
|
-// commentCount.setYesterday(commentService.countFindByDate(now.minusDays(1)));
|
|
|
-//
|
|
|
-//
|
|
|
-// // 礼物
|
|
|
-// StatsVo giftCount = new StatsVo();
|
|
|
-// giftCount.setType("gift");
|
|
|
-// giftCount.setSort(3);
|
|
|
-// giftCount.setTotal(giftService.findAll().size());
|
|
|
-// giftCount.setToday(giftService.countFindByDate(now));
|
|
|
-// giftCount.setYesterday(giftService.countFindByDate(now.minusDays(1)));
|
|
|
+ LocalDate now = LocalDate.now();
|
|
|
+
|
|
|
+ // 官网
|
|
|
+ StatsVo webCount = new StatsVo();
|
|
|
+ webCount.setType("web");
|
|
|
+ webCount.setSort(1);
|
|
|
+ webCount.setTotal(visitService.countTotal(webCount.getType()));
|
|
|
+ webCount.setToday(visitService.countByDate(now, webCount.getType()));
|
|
|
+ webCount.setYesterday(visitService.countByDate(now.minusDays(1), webCount.getType()));
|
|
|
+
|
|
|
+ // 线上史馆
|
|
|
+ StatsVo sceneCount = new StatsVo();
|
|
|
+ sceneCount.setType("scene");
|
|
|
+ sceneCount.setSort(2);
|
|
|
+ sceneCount.setTotal(visitService.countTotal(sceneCount.getType()));
|
|
|
+ sceneCount.setToday(visitService.countByDate(now, sceneCount.getType()));
|
|
|
+ sceneCount.setYesterday(visitService.countByDate(now.minusDays(1), sceneCount.getType()));
|
|
|
+
|
|
|
+
|
|
|
+ // 留言
|
|
|
+ StatsVo commentCount = new StatsVo();
|
|
|
+ commentCount.setType("comment");
|
|
|
+ commentCount.setSort(3);
|
|
|
+ commentCount.setTotal(commentService.findAll().size());
|
|
|
+ commentCount.setToday(commentService.countFindByDate(now));
|
|
|
+ commentCount.setYesterday(commentService.countFindByDate(now.minusDays(1)));
|
|
|
+
|
|
|
|
|
|
|
|
|
// todo 目前缺官网,不知道数据从那里来, 可能在tb_scene_visit 加一个字段来区分是场景、官网数据
|
|
|
|
|
|
-// result.add(sceneCount);
|
|
|
-// result.add(barrageCount);
|
|
|
-// result.add(commentCount);
|
|
|
-// result.add(giftCount);
|
|
|
+ result.add(webCount);
|
|
|
+ result.add(sceneCount);
|
|
|
+ result.add(commentCount);
|
|
|
|
|
|
return Result.success(result);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Result trend() {
|
|
|
-// return sceneService.trend(LocalDate.now());
|
|
|
- return null;
|
|
|
+ public Result trend(String date, String module) {
|
|
|
+ if (StringUtils.isBlank(date)) {
|
|
|
+ date = LocalDate.now().toString();
|
|
|
+ }
|
|
|
+ return visitService.trend(date, module);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Result newsSort(String type) {
|
|
|
List<NewsEntity> list = newsService.newsSort(type);
|
|
|
- return null;
|
|
|
+ return Result.success(list);
|
|
|
}
|
|
|
|
|
|
|