|
|
@@ -11,6 +11,7 @@ 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.company.service.ICompanyUserService;
|
|
|
import com.fs.course.mapper.FsCourseTrafficLogMapper;
|
|
|
import com.fs.his.service.IFsStoreOrderService;
|
|
|
import com.fs.his.service.IFsStorePaymentService;
|
|
|
@@ -91,7 +92,7 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
|
|
|
private QwUserMapper qwUserMapper;
|
|
|
|
|
|
@Autowired
|
|
|
- private ICompanyRoleService companyRoleService;
|
|
|
+ private ICompanyUserService companyUserService;
|
|
|
@Override
|
|
|
public void dataOverviewTask() {
|
|
|
List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
|
|
|
@@ -117,40 +118,7 @@ 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);
|
|
|
-// }
|
|
|
-// }
|
|
|
+
|
|
|
@Override
|
|
|
public AnalysisPreviewDTO analysisPreviewTask(Integer type, Integer userType,Long companyId) {
|
|
|
// 根据type计算出时间范围
|
|
|
@@ -210,53 +178,16 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
|
|
|
// 看所有
|
|
|
if(DataScopeEnum.ALL == dataScope) {
|
|
|
analysisPreviewDTO = this.analysisPreview(param);
|
|
|
-
|
|
|
- // 自定义数据权限
|
|
|
- } else if(DataScopeEnum.CUSTOM == dataScope) {
|
|
|
-
|
|
|
+ } else{
|
|
|
+ Long currentCompanyUserId = LoginContextManager.getCurrentCompanyUserId();
|
|
|
+ List<Long> companyUserIdsByDataScope = companyUserService.getCompanyUserIdsByDataScope(dataScope, currentCompanyUserId);
|
|
|
+ param.setCompanyUserIds(companyUserIdsByDataScope);
|
|
|
+ analysisPreviewDTO = this.analysisPreview(param);
|
|
|
}
|
|
|
|
|
|
return analysisPreviewDTO;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- public void watchEndPlayTrendTask0(){
|
|
|
- List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
|
|
|
- for (OptionsVO optionsVO : optionsVOS) {
|
|
|
- Long companyId = optionsVO.getDictValue();
|
|
|
- if(companyId == null){
|
|
|
- continue;
|
|
|
- }
|
|
|
- this.watchEndPlayTrendTask(0,1,companyId);
|
|
|
- this.watchEndPlayTrendTask(0,2,companyId);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public void watchEndPlayTrendTask1(){
|
|
|
- List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
|
|
|
- for (OptionsVO optionsVO : optionsVOS) {
|
|
|
- Long companyId = optionsVO.getDictValue();
|
|
|
- if(companyId == null){
|
|
|
- continue;
|
|
|
- }
|
|
|
- this.watchEndPlayTrendTask(1,1,companyId);
|
|
|
-
|
|
|
- this.watchEndPlayTrendTask(2,1,companyId);
|
|
|
- this.watchEndPlayTrendTask(3,1,companyId);
|
|
|
- this.watchEndPlayTrendTask(4,1,companyId);
|
|
|
-
|
|
|
- this.watchEndPlayTrendTask(1,2,companyId);
|
|
|
- this.watchEndPlayTrendTask(2,2,companyId);
|
|
|
- this.watchEndPlayTrendTask(3,2,companyId);
|
|
|
- this.watchEndPlayTrendTask(4,2,companyId);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
@Override
|
|
|
public List<WatchEndPlayTrendDTO> watchEndPlayTrendTask(Integer type, Integer userType,Long companyId) {
|
|
|
// 根据type计算出时间范围
|
|
|
@@ -310,14 +241,26 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
|
|
|
param.setCompanyId(companyId);
|
|
|
|
|
|
param.setUserType(userType);
|
|
|
- List<WatchEndPlayTrendDTO> watchEndPlayTrendDTOS = this.watchEndPlayTrend(param);
|
|
|
|
|
|
- redisCache.setCacheObject(String.format("%s:%d:%d",DATA_OVERVIEW_DEALER_CHARTS,type,userType),watchEndPlayTrendDTOS);
|
|
|
+
|
|
|
+
|
|
|
+ // 获取当前用户的数据权限
|
|
|
+ DataScopeEnum dataScope = LoginContextManager.getDataScope();
|
|
|
+ List<WatchEndPlayTrendDTO> watchEndPlayTrendDTOS = null;
|
|
|
+ // 看所有
|
|
|
+ if(DataScopeEnum.ALL == dataScope) {
|
|
|
+ watchEndPlayTrendDTOS = this.watchEndPlayTrend(param);
|
|
|
+ } else{
|
|
|
+ Long currentCompanyUserId = LoginContextManager.getCurrentCompanyUserId();
|
|
|
+ List<Long> companyUserIdsByDataScope = companyUserService.getCompanyUserIdsByDataScope(dataScope, currentCompanyUserId);
|
|
|
+ param.setCompanyUserIds(companyUserIdsByDataScope);
|
|
|
+ watchEndPlayTrendDTOS = this.watchEndPlayTrend(param);
|
|
|
+ }
|
|
|
return watchEndPlayTrendDTOS;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void companyWatchCourseTopTenTask(Integer type, Integer statisticalType, Integer userType,Long companyId) {
|
|
|
+ public List<DeaMemberTopTenDTO> companyWatchCourseTopTenTask(Integer type, Integer statisticalType, Integer userType,Long companyId) {
|
|
|
|
|
|
AnalysisPreviewQueryDTO dto = new AnalysisPreviewQueryDTO();
|
|
|
dto.setType(type);
|
|
|
@@ -371,59 +314,23 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
|
|
|
dto.setUserType(userType);
|
|
|
dto.setCompanyId(companyId);
|
|
|
|
|
|
- List<DeaMemberTopTenDTO> deaMemberTopTenDTOS = deaMemberTopTen(dto);
|
|
|
- redisCache.setCacheObject(String.format("%s:%d:%d:%d:%d", CHARTS_MEMBER_TOP_TEN_WATCH, type,statisticalType,userType,companyId), deaMemberTopTenDTOS);
|
|
|
- }
|
|
|
-
|
|
|
- public void companyWatchCourseTopTenTask0(){
|
|
|
- List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
|
|
|
- for (OptionsVO optionsVO : optionsVOS) {
|
|
|
- Long companyId = optionsVO.getDictValue();
|
|
|
- if (companyId == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- companyWatchCourseTopTenTask(0,0,1,companyId);
|
|
|
- companyWatchCourseTopTenTask(0,1,1,companyId);
|
|
|
-
|
|
|
-
|
|
|
- companyWatchCourseTopTenTask(0,0,2,companyId);
|
|
|
- companyWatchCourseTopTenTask(0,1,2,companyId);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public void companyWatchCourseTopTenTask1(){
|
|
|
- List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
|
|
|
- for (OptionsVO optionsVO : optionsVOS) {
|
|
|
- Long companyId = optionsVO.getDictValue();
|
|
|
- if (companyId == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- companyWatchCourseTopTenTask(1,0,1,companyId);
|
|
|
- companyWatchCourseTopTenTask(1,1,1,companyId);
|
|
|
- companyWatchCourseTopTenTask(2,0,1,companyId);
|
|
|
- companyWatchCourseTopTenTask(2,1,1,companyId);
|
|
|
- companyWatchCourseTopTenTask(3,0,1,companyId);
|
|
|
- companyWatchCourseTopTenTask(3,1,1,companyId);
|
|
|
- companyWatchCourseTopTenTask(4,0,1,companyId);
|
|
|
- companyWatchCourseTopTenTask(4,1,1,companyId);
|
|
|
-
|
|
|
- companyWatchCourseTopTenTask(1,0,2,companyId);
|
|
|
- companyWatchCourseTopTenTask(1,1,2,companyId);
|
|
|
- companyWatchCourseTopTenTask(2,0,2,companyId);
|
|
|
- companyWatchCourseTopTenTask(2,1,2,companyId);
|
|
|
- companyWatchCourseTopTenTask(3,0,2,companyId);
|
|
|
- companyWatchCourseTopTenTask(3,1,2,companyId);
|
|
|
- companyWatchCourseTopTenTask(4,0,2,companyId);
|
|
|
- companyWatchCourseTopTenTask(4,1,2,companyId);
|
|
|
+ List<DeaMemberTopTenDTO> deaMemberTopTenDTOS;
|
|
|
+ // 获取当前用户的数据权限
|
|
|
+ DataScopeEnum dataScope = LoginContextManager.getDataScope();
|
|
|
+ // 看所有
|
|
|
+ if(DataScopeEnum.ALL == dataScope) {
|
|
|
+ deaMemberTopTenDTOS = this.deaMemberTopTen(dto);
|
|
|
+ } else{
|
|
|
+ Long currentCompanyUserId = LoginContextManager.getCurrentCompanyUserId();
|
|
|
+ List<Long> companyUserIdsByDataScope = companyUserService.getCompanyUserIdsByDataScope(dataScope, currentCompanyUserId);
|
|
|
+ dto.setCompanyUserIds(companyUserIdsByDataScope);
|
|
|
+ deaMemberTopTenDTOS = this.deaMemberTopTen(dto);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ return deaMemberTopTenDTOS;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void watchCourseTopTenTask(Integer type, Integer statisticalType, Integer userType, String sort,Long companyId) {
|
|
|
+ public List<CourseStatsDTO> watchCourseTopTenTask(Integer type, Integer statisticalType, Integer userType, String sort,Long companyId) {
|
|
|
AnalysisPreviewQueryDTO dto = new AnalysisPreviewQueryDTO();
|
|
|
dto.setType(type);
|
|
|
dto.setStatisticalType(statisticalType);
|
|
|
@@ -475,152 +382,25 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
|
|
|
dto.setEndTime(endDate);
|
|
|
dto.setUserType(userType);
|
|
|
dto.setCompanyId(companyId);
|
|
|
- List<CourseStatsDTO> courseStatsDTOS = watchCourseTopTen(dto);
|
|
|
-
|
|
|
- redisCache.setCacheObject( String.format("%s:%d:%d:%d:%s:%d", CHARTS_WATCH_TOP_TEN, type,statisticalType,userType,sort,companyId), courseStatsDTOS);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public void watchCourseTopTenTask0(){
|
|
|
- List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
|
|
|
- for (OptionsVO optionsVO : optionsVOS) {
|
|
|
- Long companyId = optionsVO.getDictValue();
|
|
|
- if (companyId == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- watchCourseTopTenTask(0,0,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(0,0,1,"ASC",companyId);
|
|
|
- watchCourseTopTenTask(0,1,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(0,1,1,"ASC",companyId);
|
|
|
- watchCourseTopTenTask(0,2,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(0,2,1,"ASC",companyId);
|
|
|
- watchCourseTopTenTask(0,3,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(0,3,1,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(0,0,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(0,0,1,"ASC",companyId);
|
|
|
- watchCourseTopTenTask(0,1,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(0,1,1,"ASC",companyId);
|
|
|
- watchCourseTopTenTask(0,2,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(0,2,1,"ASC",companyId);
|
|
|
- watchCourseTopTenTask(0,3,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(0,3,1,"ASC",companyId);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public void watchCourseTopTenTask1(){
|
|
|
- List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
|
|
|
- for (OptionsVO optionsVO : optionsVOS) {
|
|
|
- Long companyId = optionsVO.getDictValue();
|
|
|
- if (companyId == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- watchCourseTopTenTask(1,0,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(1,0,1,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(1,0,2,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(1,0,2,"ASC",companyId);
|
|
|
-
|
|
|
-
|
|
|
- watchCourseTopTenTask(1,1,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(1,1,1,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(1,1,2,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(1,1,2,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(1,2,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(1,2,1,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(1,2,2,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(1,2,2,"ASC",companyId);
|
|
|
-
|
|
|
|
|
|
- watchCourseTopTenTask(1,3,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(1,3,1,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(1,3,2,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(1,3,2,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(2,0,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(2,0,1,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(2,0,2,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(2,0,2,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(2,1,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(2,1,1,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(2,1,2,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(2,1,2,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(2,2,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(2,2,1,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(2,2,2,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(2,2,2,"ASC",companyId);
|
|
|
-
|
|
|
-
|
|
|
- watchCourseTopTenTask(2,3,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(2,3,1,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(2,3,2,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(2,3,2,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(3,0,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(3,0,1,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(3,0,2,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(3,0,2,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(3,1,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(3,1,1,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(3,1,2,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(3,1,2,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(3,2,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(3,2,1,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(3,2,2,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(3,2,2,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(3,3,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(3,3,1,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(3,3,2,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(3,3,2,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(4,0,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(4,0,1,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(4,0,2,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(4,0,2,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(4,1,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(4,1,1,"ASC",companyId);
|
|
|
- watchCourseTopTenTask(4,2,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(4,2,1,"ASC",companyId);
|
|
|
- watchCourseTopTenTask(4,3,1,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(4,3,1,"ASC",companyId);
|
|
|
-
|
|
|
- watchCourseTopTenTask(4,1,2,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(4,1,2,"ASC",companyId);
|
|
|
- watchCourseTopTenTask(4,2,2,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(4,2,2,"ASC",companyId);
|
|
|
- watchCourseTopTenTask(4,3,2,"DESC",companyId);
|
|
|
- watchCourseTopTenTask(4,3,2,"ASC",companyId);
|
|
|
+ List<CourseStatsDTO> courseStatsDTOS;
|
|
|
+ // 获取当前用户的数据权限
|
|
|
+ DataScopeEnum dataScope = LoginContextManager.getDataScope();
|
|
|
+ // 看所有
|
|
|
+ if(DataScopeEnum.ALL == dataScope) {
|
|
|
+ courseStatsDTOS = this.watchCourseTopTen(dto);
|
|
|
+ } else{
|
|
|
+ Long currentCompanyUserId = LoginContextManager.getCurrentCompanyUserId();
|
|
|
+ List<Long> companyUserIdsByDataScope = companyUserService.getCompanyUserIdsByDataScope(dataScope, currentCompanyUserId);
|
|
|
+ dto.setCompanyUserIds(companyUserIdsByDataScope);
|
|
|
+ courseStatsDTOS = this.watchCourseTopTen(dto);
|
|
|
}
|
|
|
|
|
|
+ return courseStatsDTOS;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
- public void rewardMoneyTopTenTask(Integer type, Integer dataType, Integer userType,Long companyId) {
|
|
|
+ public List<RewardMoneyTopTenDTO> rewardMoneyTopTenTask(Integer type, Integer dataType, Integer userType,Long companyId) {
|
|
|
AnalysisPreviewQueryDTO dto = new AnalysisPreviewQueryDTO();
|
|
|
dto.setType(type);
|
|
|
dto.setDataType(dataType);
|
|
|
@@ -673,14 +453,24 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
|
|
|
dto.setUserType(userType);
|
|
|
dto.setCompanyId(companyId);
|
|
|
|
|
|
- List<RewardMoneyTopTenDTO> rewardMoneyTopTenDTOS = rewardMoneyTopTen(dto);
|
|
|
-
|
|
|
- redisCache.setCacheObject( String.format("%s:%d:%d:%d:%d", CHARTS_REWARD_MONEY_TOP_TEN, type,dataType,userType,companyId), rewardMoneyTopTenDTOS);
|
|
|
+ List<RewardMoneyTopTenDTO> rewardMoneyTopTenDTOS = null;
|
|
|
+ // 获取当前用户的数据权限
|
|
|
+ DataScopeEnum dataScope = LoginContextManager.getDataScope();
|
|
|
+ // 看所有
|
|
|
+ if(DataScopeEnum.ALL == dataScope) {
|
|
|
+ rewardMoneyTopTenDTOS = this.rewardMoneyTopTen(dto);
|
|
|
+ } else{
|
|
|
+ Long currentCompanyUserId = LoginContextManager.getCurrentCompanyUserId();
|
|
|
+ List<Long> companyUserIdsByDataScope = companyUserService.getCompanyUserIdsByDataScope(dataScope, currentCompanyUserId);
|
|
|
+ dto.setCompanyUserIds(companyUserIdsByDataScope);
|
|
|
+ rewardMoneyTopTenDTOS = this.rewardMoneyTopTen(dto);
|
|
|
+ }
|
|
|
|
|
|
+ return rewardMoneyTopTenDTOS;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void rewardMoneyTradeTask(Integer type, Integer userType,Long companyId) {
|
|
|
+ public List<RewardMoneyTrendDTO> rewardMoneyTradeTask(Integer type, Integer userType,Long companyId) {
|
|
|
AnalysisPreviewQueryDTO dto = new AnalysisPreviewQueryDTO();
|
|
|
dto.setType(type);
|
|
|
|
|
|
@@ -731,77 +521,28 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
|
|
|
dto.setEndTime(endDate);
|
|
|
dto.setUserType(userType);
|
|
|
dto.setCompanyId(companyId);
|
|
|
- List<RewardMoneyTrendDTO> rewardMoneyTrendDTOS = rewardMoneyTrendDTO(dto);
|
|
|
- redisCache.setCacheObject( String.format("%s:%d:%d:%d", CHARTS_REWARD_MONEY_TREND, type,userType,companyId), rewardMoneyTrendDTOS);
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ List<RewardMoneyTrendDTO> rewardMoneyTrendDTOS;
|
|
|
|
|
|
- public void rewardMoneyTask15Minutes(){
|
|
|
- List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
|
|
|
- for (OptionsVO optionsVO : optionsVOS) {
|
|
|
- Long companyId = optionsVO.getDictValue();
|
|
|
- if (companyId == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- rewardMoneyTopTenTask(0,0,1,companyId);
|
|
|
- rewardMoneyTopTenTask(0,1,1,companyId);
|
|
|
-
|
|
|
- rewardMoneyTradeTask(0,1,companyId);
|
|
|
-
|
|
|
- rewardMoneyTopTenTask(0,0,2,companyId);
|
|
|
- rewardMoneyTopTenTask(0,1,2,companyId);
|
|
|
-
|
|
|
- rewardMoneyTradeTask(0,2,companyId);
|
|
|
+ // 获取当前用户的数据权限
|
|
|
+ DataScopeEnum dataScope = LoginContextManager.getDataScope();
|
|
|
+ // 看所有
|
|
|
+ if(DataScopeEnum.ALL == dataScope) {
|
|
|
+ rewardMoneyTrendDTOS = this.rewardMoneyTrendDTO(dto);
|
|
|
+ } else{
|
|
|
+ Long currentCompanyUserId = LoginContextManager.getCurrentCompanyUserId();
|
|
|
+ List<Long> companyUserIdsByDataScope = companyUserService.getCompanyUserIdsByDataScope(dataScope, currentCompanyUserId);
|
|
|
+ dto.setCompanyUserIds(companyUserIdsByDataScope);
|
|
|
+ rewardMoneyTrendDTOS = this.rewardMoneyTrendDTO(dto);
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public void rewardMoneyTaskEveryday(){
|
|
|
- List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
|
|
|
- for (OptionsVO optionsVO : optionsVOS) {
|
|
|
- Long companyId = optionsVO.getDictValue();
|
|
|
- if (companyId == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- rewardMoneyTopTenTask(1,0,1,companyId);
|
|
|
- rewardMoneyTopTenTask(1,1,1,companyId);
|
|
|
-
|
|
|
-
|
|
|
- rewardMoneyTopTenTask(2,0,1,companyId);
|
|
|
- rewardMoneyTopTenTask(2,1,1,companyId);
|
|
|
-
|
|
|
- rewardMoneyTopTenTask(3,0,1,companyId);
|
|
|
- rewardMoneyTopTenTask(3,1,1,companyId);
|
|
|
-
|
|
|
- rewardMoneyTopTenTask(4,0,1,companyId);
|
|
|
- rewardMoneyTopTenTask(4,1,1,companyId);
|
|
|
-
|
|
|
-
|
|
|
- rewardMoneyTradeTask(1,1,companyId);
|
|
|
- rewardMoneyTradeTask(2,1,companyId);
|
|
|
- rewardMoneyTradeTask(3,1,companyId);
|
|
|
- rewardMoneyTradeTask(4,1,companyId);
|
|
|
|
|
|
+ return rewardMoneyTrendDTOS;
|
|
|
|
|
|
- rewardMoneyTopTenTask(1,0,2,companyId);
|
|
|
- rewardMoneyTopTenTask(1,1,2,companyId);
|
|
|
- rewardMoneyTopTenTask(2,0,2,companyId);
|
|
|
- rewardMoneyTopTenTask(2,1,2,companyId);
|
|
|
- rewardMoneyTopTenTask(3,0,2,companyId);
|
|
|
- rewardMoneyTopTenTask(3,1,2,companyId);
|
|
|
- rewardMoneyTopTenTask(4,0,2,companyId);
|
|
|
- rewardMoneyTopTenTask(4,1,2,companyId);
|
|
|
+ }
|
|
|
|
|
|
- rewardMoneyTradeTask(1,2,companyId);
|
|
|
- rewardMoneyTradeTask(2,2,companyId);
|
|
|
- rewardMoneyTradeTask(3,2,companyId);
|
|
|
- rewardMoneyTradeTask(4,2,companyId);
|
|
|
- }
|
|
|
|
|
|
- }
|
|
|
|
|
|
@Override
|
|
|
public DealerAggregatedDTO dealerAggregated(Long companyId) {
|
|
|
@@ -1065,23 +806,13 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
|
|
|
return trafficLogDTO;
|
|
|
}
|
|
|
|
|
|
- public void companyThisMonthOrderCount(){
|
|
|
- List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
|
|
|
- for (OptionsVO optionsVO : optionsVOS) {
|
|
|
- Long companyId = optionsVO.getDictValue();
|
|
|
- if (companyId == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- this.thisMonthOrderCount(companyId);
|
|
|
- this.thisMonthRecvCount(companyId);
|
|
|
- }
|
|
|
- }
|
|
|
@Override
|
|
|
- public void thisMonthOrderCount(Long companyId) {
|
|
|
+ public R thisMonthOrderCount(Long companyId) {
|
|
|
Long[] users=new Long[0];
|
|
|
TimeUtils.TimeEntity timeEntity=TimeUtils.parseTime("5",null,null);
|
|
|
timeEntity.setUserIds(users);
|
|
|
timeEntity.setCompanyId(companyId);
|
|
|
+
|
|
|
Integer cycleNum = timeEntity.getCycleNum();
|
|
|
Integer beginTime = timeEntity.getBeginTime();
|
|
|
List<Integer> timeList = new ArrayList<>();
|
|
|
@@ -1089,16 +820,30 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
|
|
|
timeList.add(beginTime);
|
|
|
beginTime = TimeUtils.formatTime(beginTime);
|
|
|
}
|
|
|
- List<JSONObject> jsonObjectList = storeOrderService.selectFsStoreOrderCounts(timeEntity.toMap());
|
|
|
+
|
|
|
+ List<JSONObject> jsonObjectList;
|
|
|
+ // 获取当前用户的数据权限
|
|
|
+ DataScopeEnum dataScope = LoginContextManager.getDataScope();
|
|
|
+ // 看所有
|
|
|
+ if(DataScopeEnum.ALL == dataScope) {
|
|
|
+ jsonObjectList = storeOrderService.selectFsStoreOrderCounts(timeEntity.toMap());
|
|
|
+ } else{
|
|
|
+ Long currentCompanyUserId = LoginContextManager.getCurrentCompanyUserId();
|
|
|
+ List<Long> companyUserIdsByDataScope = companyUserService.getCompanyUserIdsByDataScope(dataScope, currentCompanyUserId);
|
|
|
+ timeEntity.setCompanyUserIds(companyUserIdsByDataScope);
|
|
|
+ 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(String.format(THIS_MONTH_ORDER_COUNT+":%d",companyId),result);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void thisMonthRecvCount(Long companyId) {
|
|
|
+ public R thisMonthRecvCount(Long companyId) {
|
|
|
Long[] users=new Long[0];
|
|
|
TimeUtils.TimeEntity timeEntity=TimeUtils.parseTime("5",null,null);
|
|
|
timeEntity.setUserIds(users);
|
|
|
@@ -1110,11 +855,25 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
|
|
|
timeList.add(beginTime);
|
|
|
beginTime = TimeUtils.formatTime(beginTime);
|
|
|
}
|
|
|
- List<JSONObject> jsonObjectList = paymentService.selectFsStorePaymentCounts(timeEntity.toMap());
|
|
|
+
|
|
|
+ List<JSONObject> jsonObjectList;
|
|
|
+ // 获取当前用户的数据权限
|
|
|
+ DataScopeEnum dataScope = LoginContextManager.getDataScope();
|
|
|
+ // 看所有
|
|
|
+ if(DataScopeEnum.ALL == dataScope) {
|
|
|
+ jsonObjectList = paymentService.selectFsStorePaymentCounts(timeEntity.toMap());
|
|
|
+ } else{
|
|
|
+ Long currentCompanyUserId = LoginContextManager.getCurrentCompanyUserId();
|
|
|
+ List<Long> companyUserIdsByDataScope = companyUserService.getCompanyUserIdsByDataScope(dataScope, currentCompanyUserId);
|
|
|
+ timeEntity.setCompanyUserIds(companyUserIdsByDataScope);
|
|
|
+ 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(String.format(THIS_MONTH_RECV_COUNT+":%d",companyId),result);
|
|
|
+ return result;
|
|
|
}
|
|
|
}
|