|
@@ -0,0 +1,126 @@
|
|
|
+package com.fs.course.controller;
|
|
|
+
|
|
|
+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.page.TableDataInfo;
|
|
|
+import com.fs.common.enums.BusinessType;
|
|
|
+import com.fs.common.utils.ServletUtils;
|
|
|
+import com.fs.common.utils.poi.ExcelUtil;
|
|
|
+import com.fs.core.security.LoginUser;
|
|
|
+import com.fs.core.web.service.TokenService;
|
|
|
+import com.fs.course.domain.FsUserWatchCourseStatistics;
|
|
|
+import com.fs.course.service.IFsUserWatchCourseStatisticsService;
|
|
|
+import com.fs.course.vo.FsUserWatchCourseStatisticsExportVO;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 会员看课统计-按课程统计Controller
|
|
|
+ *
|
|
|
+ * @author fs
|
|
|
+ * @date 2025-06-16
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/course/userWatchCourseStatistics")
|
|
|
+public class FsUserWatchCourseStatisticsController extends BaseController
|
|
|
+{
|
|
|
+ @Autowired
|
|
|
+ private IFsUserWatchCourseStatisticsService fsUserWatchCourseStatisticsService;
|
|
|
+ @Autowired
|
|
|
+ private TokenService tokenService;
|
|
|
+ /**
|
|
|
+ * 查询会员看课统计-按课程统计列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:userWatchCourseStatistics:list')")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo list(FsUserWatchCourseStatistics fsUserWatchCourseStatistics)
|
|
|
+ {
|
|
|
+ startPage();
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ fsUserWatchCourseStatistics.setCompanyId( loginUser.getCompany().getCompanyId());
|
|
|
+ List<FsUserWatchCourseStatistics> list = fsUserWatchCourseStatisticsService.selectFsUserWatchCourseStatisticsList(fsUserWatchCourseStatistics);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:userWatchCourseStatistics:export')")
|
|
|
+ @Log(title = "会员看课统计-按课程统计", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/export")
|
|
|
+ public AjaxResult export(FsUserWatchCourseStatistics fsUserWatchCourseStatistics)
|
|
|
+ {
|
|
|
+ List<FsUserWatchCourseStatistics> list = fsUserWatchCourseStatisticsService.selectFsUserWatchCourseStatisticsList(fsUserWatchCourseStatistics);
|
|
|
+ ExcelUtil<FsUserWatchCourseStatistics> util = new ExcelUtil<FsUserWatchCourseStatistics>(FsUserWatchCourseStatistics.class);
|
|
|
+ return util.exportExcel(list, "会员观看数据明细");
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 导出会员看课统计-按课程汇总统计列表
|
|
|
+ */
|
|
|
+ @Log(title = "会员看课统计-按课程汇总统计", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/exportTotal")
|
|
|
+ public AjaxResult exportTotal(FsUserWatchCourseStatistics fsUserWatchCourseStatistics)
|
|
|
+ {
|
|
|
+ List<FsUserWatchCourseStatistics> list = fsUserWatchCourseStatisticsService.selectFsUserWatchCourseStatisticsList(fsUserWatchCourseStatistics);
|
|
|
+ List<FsUserWatchCourseStatisticsExportVO> listVO = list.stream().map(v -> {
|
|
|
+ FsUserWatchCourseStatisticsExportVO vo = new FsUserWatchCourseStatisticsExportVO();
|
|
|
+ BeanUtils.copyProperties(v, vo);
|
|
|
+ return vo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ ExcelUtil<FsUserWatchCourseStatisticsExportVO> util = new ExcelUtil<FsUserWatchCourseStatisticsExportVO>(FsUserWatchCourseStatisticsExportVO.class);
|
|
|
+ return util.exportExcel(listVO, "会员观看数据明细汇总");
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 获取会员看课统计-按课程统计详细信息
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:userWatchCourseStatistics:query')")
|
|
|
+ @GetMapping(value = "/{id}")
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
+ {
|
|
|
+ return AjaxResult.success(fsUserWatchCourseStatisticsService.selectFsUserWatchCourseStatisticsById(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增会员看课统计-按课程统计
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:userWatchCourseStatistics:add')")
|
|
|
+ @Log(title = "会员看课统计-按课程统计", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping
|
|
|
+ public AjaxResult add(@RequestBody FsUserWatchCourseStatistics fsUserWatchCourseStatistics)
|
|
|
+ {
|
|
|
+ return toAjax(fsUserWatchCourseStatisticsService.insertFsUserWatchCourseStatistics(fsUserWatchCourseStatistics));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改会员看课统计-按课程统计
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:userWatchCourseStatistics:edit')")
|
|
|
+ @Log(title = "会员看课统计-按课程统计", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping
|
|
|
+ public AjaxResult edit(@RequestBody FsUserWatchCourseStatistics fsUserWatchCourseStatistics)
|
|
|
+ {
|
|
|
+ return toAjax(fsUserWatchCourseStatisticsService.updateFsUserWatchCourseStatistics(fsUserWatchCourseStatistics));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除会员看课统计-按课程统计
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:userWatchCourseStatistics:remove')")
|
|
|
+ @Log(title = "会员看课统计-按课程统计", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ public AjaxResult remove(@PathVariable Long[] ids)
|
|
|
+ {
|
|
|
+ return toAjax(fsUserWatchCourseStatisticsService.deleteFsUserWatchCourseStatisticsByIds(ids));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("/test")
|
|
|
+ @ApiOperation("测试看课统计明细定时任务")
|
|
|
+ public void userCourseCountTask() {
|
|
|
+ fsUserWatchCourseStatisticsService.insertWatchCourseStatistics();
|
|
|
+ }
|
|
|
+}
|