|
|
@@ -1,14 +1,19 @@
|
|
|
package com.fs.course.controller;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import com.fs.common.annotation.Log;
|
|
|
+import com.fs.common.core.controller.BaseController;
|
|
|
+import com.fs.common.core.domain.AjaxResult;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
+import com.fs.common.core.page.TableDataInfo;
|
|
|
+import com.fs.common.enums.BusinessType;
|
|
|
import com.fs.common.exception.CustomException;
|
|
|
+import com.fs.common.utils.poi.ExcelUtil;
|
|
|
+import com.fs.course.domain.FsCourseWatchLog;
|
|
|
import com.fs.course.param.FsCourseOverParam;
|
|
|
import com.fs.course.param.FsCourseWatchLogListParam;
|
|
|
import com.fs.course.param.FsCourseWatchLogStatisticsListParam;
|
|
|
-import com.fs.course.service.IFsUserCoursePeriodDaysService;
|
|
|
-import com.fs.course.service.IFsUserCoursePeriodService;
|
|
|
+import com.fs.course.service.IFsCourseWatchLogService;
|
|
|
import com.fs.course.vo.FsCourseOverVO;
|
|
|
import com.fs.course.vo.FsCourseWatchLogListVO;
|
|
|
import com.fs.course.vo.FsCourseWatchLogStatisticsListVO;
|
|
|
@@ -16,24 +21,13 @@ import com.fs.qw.param.QwWatchLogStatisticsListParam;
|
|
|
import com.fs.qw.service.IQwWatchLogService;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.PutMapping;
|
|
|
-import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-import com.fs.common.annotation.Log;
|
|
|
-import com.fs.common.core.controller.BaseController;
|
|
|
-import com.fs.common.core.domain.AjaxResult;
|
|
|
-import com.fs.common.enums.BusinessType;
|
|
|
-import com.fs.course.domain.FsCourseWatchLog;
|
|
|
-import com.fs.course.service.IFsCourseWatchLogService;
|
|
|
-import com.fs.common.utils.poi.ExcelUtil;
|
|
|
-import com.fs.common.core.page.TableDataInfo;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 短链课程看课记录Controller
|
|
|
@@ -50,34 +44,28 @@ public class FsCourseWatchLogController extends BaseController
|
|
|
|
|
|
@Autowired
|
|
|
private IQwWatchLogService qwWatchLogService;
|
|
|
- @Autowired
|
|
|
- private IFsUserCoursePeriodDaysService userCoursePeriodDaysService;
|
|
|
- @Autowired
|
|
|
- private IFsUserCoursePeriodService userCoursePeriodService;
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 查询短链课程看课记录列表
|
|
|
+ */
|
|
|
@PreAuthorize("@ss.hasPermi('course:courseWatchLog:list')")
|
|
|
- @PostMapping("/list")
|
|
|
- public R list(@RequestBody FsCourseWatchLogListParam param)
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo list(FsCourseWatchLogListParam param)
|
|
|
{
|
|
|
- if (param.getSendType()==1&& param.getPeriodETime()!=null && param.getPeriodSTime()!=null) {
|
|
|
- List<Long> periodIds = userCoursePeriodDaysService.selectFsUserCoursePeriodDaysByTime(param.getPeriodSTime(), param.getPeriodETime());
|
|
|
-
|
|
|
- if (!periodIds.isEmpty()){
|
|
|
- List<Long> longs = userCoursePeriodService.selectFsUserCoursePeriodListByPeriodId(periodIds, param.getCompanyId());
|
|
|
- if (!longs.isEmpty()){
|
|
|
- param.setPeriodIds(longs);
|
|
|
- }else {
|
|
|
- return R.ok().put("data", new PageInfo<>(new ArrayList<>()));
|
|
|
- }
|
|
|
- }else {
|
|
|
- return R.ok().put("data", new PageInfo<>(new ArrayList<>()));
|
|
|
- }
|
|
|
+ startPage();
|
|
|
+ if(CollectionUtil.isNotEmpty(param.getUserIds())){
|
|
|
+ param.setUserIds(param.getUserIds().stream()
|
|
|
+ .filter(userId -> userId != null && userId.startsWith("user_"))
|
|
|
+ .map(userId -> userId.substring(5))
|
|
|
+ .collect(Collectors.toList())
|
|
|
+ );
|
|
|
}
|
|
|
-
|
|
|
- PageHelper.startPage(param.getPageNum(), param.getPageSize());
|
|
|
- return R.ok().put("data", new PageInfo<>(fsCourseWatchLogService.selectFsCourseWatchLogListVO(param)));
|
|
|
+ List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVO(param);
|
|
|
+ return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询短链课程看课记录列表
|
|
|
+ */
|
|
|
@PreAuthorize("@ss.hasPermi('course:courseWatchLog:pageList')")
|
|
|
@PostMapping("/pageList")
|
|
|
public R pageList(@RequestBody FsCourseWatchLogListParam param)
|
|
|
@@ -90,45 +78,44 @@ public class FsCourseWatchLogController extends BaseController
|
|
|
@GetMapping("/qwWatchLogAllStatisticsList")
|
|
|
public TableDataInfo qwWatchLogAllStatisticsList(QwWatchLogStatisticsListParam param)
|
|
|
{
|
|
|
- logger.info("会员课程数据汇总 参数: {}", param);
|
|
|
+ logger.info("会员课程数据汇总 参数: {}",param);
|
|
|
|
|
|
- if (param.getCompanyId() == null && (param.getUserIds() == null || param.getUserIds().isEmpty())) {
|
|
|
+ if(param.getCompanyId() == null){
|
|
|
throw new CustomException("必须选择公司!");
|
|
|
}
|
|
|
- if (param.getSTime() == null || param.getETime() == null) {
|
|
|
+ if (param.getSTime()==null||param.getETime()==null){
|
|
|
return getDataTable(new ArrayList<>());
|
|
|
}
|
|
|
return qwWatchLogService.selectQwWatchLogAllStatisticsListVONew(param);
|
|
|
}
|
|
|
-
|
|
|
@GetMapping("/qwWatchLogStatisticsList")
|
|
|
public TableDataInfo qwWatchLogStatisticsList(QwWatchLogStatisticsListParam param)
|
|
|
{
|
|
|
- if (param.getPageNum() == null) {
|
|
|
+ if(param.getPageNum() == null){
|
|
|
param.setPageNum(1L);
|
|
|
}
|
|
|
- if (param.getPageSize() == null) {
|
|
|
+ if(param.getPageSize() == null){
|
|
|
param.setPageSize(10L);
|
|
|
}
|
|
|
- if (param.getSTime() == null || param.getETime() == null) {
|
|
|
+ if (param.getSTime()==null||param.getETime()==null){
|
|
|
return getDataTable(new ArrayList<>());
|
|
|
}
|
|
|
-// if (param.getCompanyId() == null) {
|
|
|
-// throw new CustomException("必须选择公司!");
|
|
|
-// }
|
|
|
+ if(param.getCompanyId() == null){
|
|
|
+ throw new CustomException("必须选择公司!");
|
|
|
+ }
|
|
|
return qwWatchLogService.selectQwWatchLogStatisticsListVONew(param);
|
|
|
}
|
|
|
-
|
|
|
@PreAuthorize("@ss.hasPermi('course:courseWatchLog:statisticsList')")
|
|
|
@GetMapping("/statisticsList")
|
|
|
public TableDataInfo statisticsList(FsCourseWatchLogStatisticsListParam param)
|
|
|
{
|
|
|
-// if (param.getCompanyId() == null) {
|
|
|
-// if (param.getUserId() == null) {
|
|
|
-// throw new CustomException("查看公司或者用户必填!");
|
|
|
-// }
|
|
|
-// }
|
|
|
- if (param.getSTime() == null || param.getETime() == null) {
|
|
|
+ // 如果看指定用户就不用设置公司
|
|
|
+ if(param.getCompanyId() == null){
|
|
|
+ if(param.getUserId() == null) {
|
|
|
+ throw new CustomException("查看公司或者用户必填!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (param.getSTime()==null||param.getETime()==null){
|
|
|
throw new CustomException("必须选择开始时间和结束时间!");
|
|
|
}
|
|
|
startPage();
|
|
|
@@ -137,17 +124,22 @@ public class FsCourseWatchLogController extends BaseController
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 会员看课统计导出
|
|
|
+ */
|
|
|
@PreAuthorize("@ss.hasPermi('course:courseWatchLog:statisticsExport')")
|
|
|
@Log(title = "会员看课统计导出", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/statisticsExport")
|
|
|
public AjaxResult statisticsExport(@RequestBody FsCourseWatchLogStatisticsListParam param)
|
|
|
{
|
|
|
-// if (param.getCompanyId() == null) {
|
|
|
-// if (param.getUserId() == null) {
|
|
|
-// throw new CustomException("查看公司或者用户必填!");
|
|
|
-// }
|
|
|
-// }
|
|
|
- if (param.getSTime() == null || param.getETime() == null) {
|
|
|
+
|
|
|
+ // 如果看指定用户就不用设置公司
|
|
|
+ if(param.getCompanyId() == null){
|
|
|
+ if(param.getUserId() == null) {
|
|
|
+ throw new CustomException("查看公司或者用户必填!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (param.getSTime()==null||param.getETime()==null){
|
|
|
throw new CustomException("必须选择开始时间和结束时间!");
|
|
|
}
|
|
|
|
|
|
@@ -157,6 +149,10 @@ public class FsCourseWatchLogController extends BaseController
|
|
|
return util.exportExcel(list, "会员看课统计");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出短链课程看课记录列表
|
|
|
+ */
|
|
|
@PreAuthorize("@ss.hasPermi('course:courseWatchLog:export')")
|
|
|
@Log(title = "短链课程看课记录", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/export")
|
|
|
@@ -167,6 +163,9 @@ public class FsCourseWatchLogController extends BaseController
|
|
|
return util.exportExcel(list, "短链课程看课记录数据");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取短链课程看课记录详细信息
|
|
|
+ */
|
|
|
@PreAuthorize("@ss.hasPermi('course:courseWatchLog:query')")
|
|
|
@GetMapping(value = "/{logId}")
|
|
|
public AjaxResult getInfo(@PathVariable("logId") Long logId)
|
|
|
@@ -174,6 +173,9 @@ public class FsCourseWatchLogController extends BaseController
|
|
|
return AjaxResult.success(fsCourseWatchLogService.selectFsCourseWatchLogByLogId(logId));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 新增短链课程看课记录
|
|
|
+ */
|
|
|
@PreAuthorize("@ss.hasPermi('course:courseWatchLog:add')")
|
|
|
@Log(title = "短链课程看课记录", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
@@ -182,6 +184,9 @@ public class FsCourseWatchLogController extends BaseController
|
|
|
return toAjax(fsCourseWatchLogService.insertFsCourseWatchLog(fsCourseWatchLog));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改短链课程看课记录
|
|
|
+ */
|
|
|
@PreAuthorize("@ss.hasPermi('course:courseWatchLog:edit')")
|
|
|
@Log(title = "短链课程看课记录", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
@@ -190,9 +195,12 @@ public class FsCourseWatchLogController extends BaseController
|
|
|
return toAjax(fsCourseWatchLogService.updateFsCourseWatchLog(fsCourseWatchLog));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 删除短链课程看课记录
|
|
|
+ */
|
|
|
@PreAuthorize("@ss.hasPermi('course:courseWatchLog:remove')")
|
|
|
@Log(title = "短链课程看课记录", businessType = BusinessType.DELETE)
|
|
|
- @DeleteMapping("/{logIds}")
|
|
|
+ @DeleteMapping("/{logIds}")
|
|
|
public AjaxResult remove(@PathVariable Long[] logIds)
|
|
|
{
|
|
|
return toAjax(fsCourseWatchLogService.deleteFsCourseWatchLogByLogIds(logIds));
|
|
|
@@ -202,7 +210,7 @@ public class FsCourseWatchLogController extends BaseController
|
|
|
public TableDataInfo watchLogStatistics(FsCourseOverParam param)
|
|
|
{
|
|
|
startPage();
|
|
|
- if (param.getSTime() == null || param.getETime() == null) {
|
|
|
+ if (param.getSTime()==null||param.getETime()==null){
|
|
|
return getDataTable(new ArrayList<>());
|
|
|
}
|
|
|
List<FsCourseOverVO> list = fsCourseWatchLogService.selectFsCourseWatchLogOverStatisticsListVO(param);
|