|
|
@@ -2,10 +2,14 @@ package com.fs.statis.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.fs.common.config.LoginContextManager;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.redis.RedisCache;
|
|
|
+import com.fs.common.enums.DataScopeEnum;
|
|
|
+import com.fs.common.utils.SecurityUtils;
|
|
|
import com.fs.common.utils.TimeUtils;
|
|
|
import com.fs.company.cache.ICompanyCacheService;
|
|
|
+import com.fs.company.service.ICompanyRoleService;
|
|
|
import com.fs.company.service.ICompanyService;
|
|
|
import com.fs.course.mapper.FsCourseTrafficLogMapper;
|
|
|
import com.fs.his.service.IFsStoreOrderService;
|
|
|
@@ -24,9 +28,11 @@ import com.fs.statis.service.utils.TrendDataFiller;
|
|
|
import com.fs.store.service.cache.IFsUserCourseCacheService;
|
|
|
import com.fs.system.domain.SysConfig;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import com.hc.openapi.tool.util.ObjectUtils;
|
|
|
import com.hc.openapi.tool.util.StringUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.http.util.Asserts;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -39,6 +45,8 @@ import java.time.LocalTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.time.temporal.TemporalAdjusters;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -81,6 +89,9 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
|
|
|
|
|
|
@Autowired
|
|
|
private QwUserMapper qwUserMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICompanyRoleService companyRoleService;
|
|
|
@Override
|
|
|
public void dataOverviewTask() {
|
|
|
List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
|
|
|
@@ -106,42 +117,42 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
|
|
|
redisCache.setCacheObject(String.format(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_SMS_BALANCE+":%d",companyId), smsBalance);
|
|
|
redisCache.setCacheObject(String.format(StatisticsRedisConstant.DATA_OVERVIEW_TRAFFIC_LOG+":%d",companyId),trafficLog);
|
|
|
}
|
|
|
- public void analysisPreviewTask0(){
|
|
|
- List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
|
|
|
- for (OptionsVO optionsVO : optionsVOS) {
|
|
|
- Long companyId = optionsVO.getDictValue();
|
|
|
- if (companyId == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- analysisPreviewTask(0,1,companyId);
|
|
|
- analysisPreviewTask(0,2,companyId);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public void analysisPreviewTask1(){
|
|
|
- List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
|
|
|
- for (OptionsVO optionsVO : optionsVOS) {
|
|
|
- Long companyId = optionsVO.getDictValue();
|
|
|
- if (companyId == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- analysisPreviewTask(0,1,companyId);
|
|
|
- analysisPreviewTask(1,1,companyId);
|
|
|
- analysisPreviewTask(2,1,companyId);
|
|
|
- analysisPreviewTask(3,1,companyId);
|
|
|
- analysisPreviewTask(4,1,companyId);
|
|
|
-
|
|
|
- analysisPreviewTask(0,2,companyId);
|
|
|
- analysisPreviewTask(1,2,companyId);
|
|
|
- analysisPreviewTask(2,2,companyId);
|
|
|
- analysisPreviewTask(3,2,companyId);
|
|
|
- analysisPreviewTask(4,2,companyId);
|
|
|
- }
|
|
|
- }
|
|
|
+// public void analysisPreviewTask0(){
|
|
|
+// List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
|
|
|
+// for (OptionsVO optionsVO : optionsVOS) {
|
|
|
+// Long companyId = optionsVO.getDictValue();
|
|
|
+// if (companyId == null) {
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// analysisPreviewTask(0,1,companyId);
|
|
|
+// analysisPreviewTask(0,2,companyId);
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
+// public void analysisPreviewTask1(){
|
|
|
+// List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
|
|
|
+// for (OptionsVO optionsVO : optionsVOS) {
|
|
|
+// Long companyId = optionsVO.getDictValue();
|
|
|
+// if (companyId == null) {
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+//
|
|
|
+// analysisPreviewTask(0,1,companyId);
|
|
|
+// analysisPreviewTask(1,1,companyId);
|
|
|
+// analysisPreviewTask(2,1,companyId);
|
|
|
+// analysisPreviewTask(3,1,companyId);
|
|
|
+// analysisPreviewTask(4,1,companyId);
|
|
|
+//
|
|
|
+// analysisPreviewTask(0,2,companyId);
|
|
|
+// analysisPreviewTask(1,2,companyId);
|
|
|
+// analysisPreviewTask(2,2,companyId);
|
|
|
+// analysisPreviewTask(3,2,companyId);
|
|
|
+// analysisPreviewTask(4,2,companyId);
|
|
|
+// }
|
|
|
+// }
|
|
|
@Override
|
|
|
- public void analysisPreviewTask(Integer type, Integer userType,Long companyId) {
|
|
|
+ public AnalysisPreviewDTO analysisPreviewTask(Integer type, Integer userType,Long companyId) {
|
|
|
// 根据type计算出时间范围
|
|
|
String startDate = "";
|
|
|
String endDate = "";
|
|
|
@@ -193,12 +204,26 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
|
|
|
param.setUserType(userType);
|
|
|
param.setCompanyId(companyId);
|
|
|
|
|
|
- AnalysisPreviewDTO analysisPreviewDTO = this.analysisPreview(param);
|
|
|
+ // 获取当前用户的数据权限
|
|
|
+ DataScopeEnum dataScope = LoginContextManager.getDataScope();
|
|
|
+ AnalysisPreviewDTO analysisPreviewDTO = null;
|
|
|
+ // 看所有
|
|
|
+ if(DataScopeEnum.ALL == dataScope) {
|
|
|
+ analysisPreviewDTO = this.analysisPreview(param);
|
|
|
|
|
|
- redisCache.setCacheObject(String.format("%s:%d:%d:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type,userType,companyId), analysisPreviewDTO);
|
|
|
+ // 自定义数据权限
|
|
|
+ } else if(DataScopeEnum.CUSTOM == dataScope) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return analysisPreviewDTO;
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public void watchEndPlayTrendTask0(){
|
|
|
List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
|
|
|
for (OptionsVO optionsVO : optionsVOS) {
|
|
|
@@ -220,6 +245,7 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
|
|
|
continue;
|
|
|
}
|
|
|
this.watchEndPlayTrendTask(1,1,companyId);
|
|
|
+
|
|
|
this.watchEndPlayTrendTask(2,1,companyId);
|
|
|
this.watchEndPlayTrendTask(3,1,companyId);
|
|
|
this.watchEndPlayTrendTask(4,1,companyId);
|
|
|
@@ -232,7 +258,7 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
|
|
|
|
|
|
}
|
|
|
@Override
|
|
|
- public void watchEndPlayTrendTask(Integer type, Integer userType,Long companyId) {
|
|
|
+ public List<WatchEndPlayTrendDTO> watchEndPlayTrendTask(Integer type, Integer userType,Long companyId) {
|
|
|
// 根据type计算出时间范围
|
|
|
String startDate = "";
|
|
|
String endDate = "";
|
|
|
@@ -287,6 +313,7 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
|
|
|
List<WatchEndPlayTrendDTO> watchEndPlayTrendDTOS = this.watchEndPlayTrend(param);
|
|
|
|
|
|
redisCache.setCacheObject(String.format("%s:%d:%d",DATA_OVERVIEW_DEALER_CHARTS,type,userType),watchEndPlayTrendDTOS);
|
|
|
+ return watchEndPlayTrendDTOS;
|
|
|
}
|
|
|
|
|
|
@Override
|