|
@@ -7,6 +7,7 @@ import com.fs.common.core.page.TableDataInfo;
|
|
|
import com.fs.common.utils.DateUtils;
|
|
|
import com.fs.common.utils.DictUtils;
|
|
|
import com.fs.company.cache.ICompanyCacheService;
|
|
|
+import com.fs.company.cache.ICompanyUserCacheService;
|
|
|
import com.fs.company.domain.Company;
|
|
|
import com.fs.company.domain.CompanyUser;
|
|
|
import com.fs.company.mapper.CompanyUserMapper;
|
|
@@ -53,6 +54,9 @@ public class QwWatchLogServiceImpl extends ServiceImpl<QwWatchLogMapper, QwWatch
|
|
|
|
|
|
@Autowired
|
|
|
private ICompanyCacheService companyCacheService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICompanyUserCacheService companyUserCacheService;
|
|
|
/**
|
|
|
* 查询企微看课
|
|
|
*
|
|
@@ -127,13 +131,18 @@ public class QwWatchLogServiceImpl extends ServiceImpl<QwWatchLogMapper, QwWatch
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<QwWatchLogStatisticsListVO> selectQwWatchLogStatisticsListVO(QwWatchLogStatisticsListParam param) {
|
|
|
+ public TableDataInfo selectQwWatchLogStatisticsListVO(QwWatchLogStatisticsListParam param) {
|
|
|
+ TableDataInfo rspData = new TableDataInfo();
|
|
|
+ rspData.setCode(HttpStatus.SUCCESS);
|
|
|
+ rspData.setMsg("查询成功");
|
|
|
+ rspData.setRows(new ArrayList<>());
|
|
|
+ rspData.setTotal(0L);
|
|
|
|
|
|
Date sTime = param.getSTime();
|
|
|
Date eTime = param.getETime();
|
|
|
List<Date> datesBetween = getDatesBetween(sTime, eTime);
|
|
|
if (datesBetween.size() > 7) {
|
|
|
- return new ArrayList<>();
|
|
|
+ return rspData;
|
|
|
}
|
|
|
if (param.getCompanyUserId()!=null){
|
|
|
param.setIds(companyUserMapper.selectQwUserIdsByCompany(param.getCompanyUserId()));
|
|
@@ -149,10 +158,12 @@ public class QwWatchLogServiceImpl extends ServiceImpl<QwWatchLogMapper, QwWatch
|
|
|
vo.setFirstOver(stat.getFirstOver());
|
|
|
}
|
|
|
|
|
|
- return vos;
|
|
|
+ Long total = qwWatchLogMapper.selectQwExtCountByDayAndCount(param);
|
|
|
+ rspData.setRows(vos);
|
|
|
+ rspData.setTotal(total);
|
|
|
+ return rspData;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public TableDataInfo selectQwWatchLogStatisticsListVONew(QwWatchLogStatisticsListParam param) {
|
|
|
// 获取当前公司下的所有销售
|
|
@@ -243,45 +254,61 @@ public class QwWatchLogServiceImpl extends ServiceImpl<QwWatchLogMapper, QwWatch
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<QwWatchLogAllStatisticsListVO> selectQwWatchLogAllStatisticsListVONew(QwWatchLogStatisticsListParam param) {
|
|
|
+ public TableDataInfo selectQwWatchLogAllStatisticsListVONew(QwWatchLogStatisticsListParam param) {
|
|
|
// 获取当前公司下的所有销售
|
|
|
List<CompanyUser> companyUsers = companyUserMapper.selectCompanyUserByCompanyId(param.getCompanyId());
|
|
|
|
|
|
List<QwWatchLogAllStatisticsListVO> list = new ArrayList<>();
|
|
|
|
|
|
- for (CompanyUser companyUser : companyUsers) {
|
|
|
- List<QwWatchLogAllStatisticsListVO> vos = qwWatchLogMapper
|
|
|
- .selectQwWatchLogAllStatisticsListVONew(companyUser.getUserId(),companyUser.getCompanyId(), param.getSTime(), param.getETime(),
|
|
|
- param.getProject(),param.getCourseId(),param.getVideoId()
|
|
|
- );
|
|
|
- for (QwWatchLogAllStatisticsListVO item : vos) {
|
|
|
- if(ObjectUtils.isNotNull(item.getProject())){
|
|
|
- String sysCourseProject = DictUtils.getDictLabel("sys_course_project", String.valueOf(item.getProject()));
|
|
|
- if(StringUtils.isNotBlank(sysCourseProject)){
|
|
|
- item.setProjectName(sysCourseProject);
|
|
|
- }
|
|
|
+ List<Long> userIds = companyUsers.stream().filter(e -> e.getUserId() != null)
|
|
|
+ .map(e -> e.getUserId())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<QwWatchLogAllStatisticsListVO> vos = qwWatchLogMapper
|
|
|
+ .selectQwWatchLogAllStatisticsListVONew(userIds, param.getSTime(), param.getETime(),
|
|
|
+ param.getProject(),param.getCourseId(),param.getVideoId()
|
|
|
+ );
|
|
|
+ for (QwWatchLogAllStatisticsListVO item : vos) {
|
|
|
+ if(ObjectUtils.isNotNull(item.getProject())){
|
|
|
+ String sysCourseProject = DictUtils.getDictLabel("sys_course_project", String.valueOf(item.getProject()));
|
|
|
+ if(StringUtils.isNotBlank(sysCourseProject)){
|
|
|
+ item.setProjectName(sysCourseProject);
|
|
|
}
|
|
|
- // 课程名
|
|
|
- if(ObjectUtils.isNotNull(item.getCourseId())) {
|
|
|
- FsUserCourse course = fsUserCourseCacheService.selectFsUserCourseByCourseId(item.getCourseId());
|
|
|
- if(ObjectUtils.isNotNull(course)){
|
|
|
- item.setCourseName(course.getCourseName());
|
|
|
- }
|
|
|
+ }
|
|
|
+ // 课程名
|
|
|
+ if(ObjectUtils.isNotNull(item.getCourseId())) {
|
|
|
+ FsUserCourse course = fsUserCourseCacheService.selectFsUserCourseByCourseId(item.getCourseId());
|
|
|
+ if(ObjectUtils.isNotNull(course)){
|
|
|
+ item.setCourseName(course.getCourseName());
|
|
|
}
|
|
|
- // 小节名
|
|
|
- if(ObjectUtils.isNotNull(item.getVideoId())) {
|
|
|
- FsUserCourseVideo fsUserCourseVideo = fsUserCourseVideoCacheService.selectFsUserCourseVideoByVideoId(item.getVideoId());
|
|
|
- if(ObjectUtils.isNotNull(fsUserCourseVideo)){
|
|
|
- item.setVideoName(fsUserCourseVideo.getTitle());
|
|
|
- }
|
|
|
+ }
|
|
|
+ // 小节名
|
|
|
+ if(ObjectUtils.isNotNull(item.getVideoId())) {
|
|
|
+ FsUserCourseVideo fsUserCourseVideo = fsUserCourseVideoCacheService.selectFsUserCourseVideoByVideoId(item.getVideoId());
|
|
|
+ if(ObjectUtils.isNotNull(fsUserCourseVideo)){
|
|
|
+ item.setVideoName(fsUserCourseVideo.getTitle());
|
|
|
}
|
|
|
- item.setQwUserName(companyUser.getUserName());
|
|
|
- item.setCreateTime(companyUser.getCreateTime());
|
|
|
- list.add(item);
|
|
|
}
|
|
|
+ // 销售名称
|
|
|
+ CompanyUser companyUser = companyUserCacheService.selectCompanyUserById(item.getCompanyUserId());
|
|
|
|
|
|
+ item.setQwUserName(companyUser.getUserName());
|
|
|
+ item.setCreateTime(companyUser.getCreateTime());
|
|
|
+ list.add(item);
|
|
|
}
|
|
|
- return list;
|
|
|
+
|
|
|
+ Long total = qwWatchLogMapper
|
|
|
+ .selectQwWatchLogAllStatisticsListVONewCount(userIds, param.getSTime(), param.getETime(),
|
|
|
+ param.getProject(),param.getCourseId(),param.getVideoId()
|
|
|
+ );
|
|
|
+
|
|
|
+ TableDataInfo rspData = new TableDataInfo();
|
|
|
+ rspData.setCode(HttpStatus.SUCCESS);
|
|
|
+ rspData.setMsg("查询成功");
|
|
|
+ rspData.setRows(list);
|
|
|
+ rspData.setTotal(total);
|
|
|
+
|
|
|
+ return rspData;
|
|
|
}
|
|
|
|
|
|
@Override
|