Browse Source

Merge remote-tracking branch 'origin/master'

吴树波 1 month ago
parent
commit
100b7a12b5
22 changed files with 927 additions and 45 deletions
  1. 265 0
      fs-admin/src/main/java/com/fs/course/controller/FsCourseWatchLogController.java
  2. 260 0
      fs-admin/src/main/java/com/fs/course/controller/qw/QwFsCourseWatchLogController.java
  3. 123 0
      fs-company-app/src/main/java/com/fs/app/controller/WxCompanyUserController.java
  4. 34 0
      fs-company-app/src/main/java/com/fs/app/param/LoginMaWxParam.java
  5. 8 7
      fs-company/src/main/java/com/fs/course/controller/FsCourseWatchLogController.java
  6. 23 0
      fs-service-system/src/main/java/com/fs/company/domain/CompanyUser.java
  7. 10 0
      fs-service-system/src/main/java/com/fs/company/mapper/CompanyUserMapper.java
  8. 14 0
      fs-service-system/src/main/java/com/fs/company/service/ICompanyUserService.java
  9. 10 0
      fs-service-system/src/main/java/com/fs/company/service/impl/CompanyUserServiceImpl.java
  10. 1 0
      fs-service-system/src/main/java/com/fs/course/mapper/FsCourseWatchLogMapper.java
  11. 3 0
      fs-service-system/src/main/java/com/fs/course/param/FsCourseWatchLogStatisticsListParam.java
  12. 1 0
      fs-service-system/src/main/java/com/fs/course/service/IFsCourseWatchLogService.java
  13. 5 0
      fs-service-system/src/main/java/com/fs/course/service/impl/FsCourseWatchLogServiceImpl.java
  14. 12 4
      fs-service-system/src/main/java/com/fs/qw/mapper/QwWatchLogMapper.java
  15. 3 0
      fs-service-system/src/main/java/com/fs/qw/param/QwWatchLogStatisticsListParam.java
  16. 6 1
      fs-service-system/src/main/java/com/fs/qw/service/IQwWatchLogService.java
  17. 67 27
      fs-service-system/src/main/java/com/fs/qw/service/impl/QwWatchLogServiceImpl.java
  18. 1 0
      fs-service-system/src/main/java/com/fs/qw/vo/QwWatchLogStatisticsListVO.java
  19. 7 0
      fs-service-system/src/main/resources/application-config.yml
  20. 3 0
      fs-service-system/src/main/resources/mapper/company/CompanyUserMapper.xml
  21. 38 0
      fs-service-system/src/main/resources/mapper/course/FsCourseWatchLogMapper.xml
  22. 33 6
      fs-service-system/src/main/resources/mapper/qw/QwWatchLogMapper.xml

+ 265 - 0
fs-admin/src/main/java/com/fs/course/controller/FsCourseWatchLogController.java

@@ -0,0 +1,265 @@
+package com.fs.course.controller;
+
+import com.fs.common.annotation.Log;
+import com.fs.common.constant.HttpStatus;
+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.FsCourseWatchLog;
+import com.fs.course.param.FsCourseOverParam;
+import com.fs.course.param.FsCourseUserStatisticsListParam;
+import com.fs.course.param.FsCourseWatchLogListParam;
+import com.fs.course.param.FsCourseWatchLogStatisticsListParam;
+import com.fs.course.service.IFsCourseWatchLogService;
+import com.fs.course.vo.FsCourseOverVO;
+import com.fs.course.vo.FsCourseUserStatisticsListVO;
+import com.fs.course.vo.FsCourseWatchLogListVO;
+import com.fs.course.vo.FsCourseWatchLogStatisticsListVO;
+import com.fs.qw.param.QwWatchLogStatisticsListParam;
+import com.fs.qw.service.IQwWatchLogService;
+import com.fs.qw.vo.QwWatchLogAllStatisticsListVO;
+import com.fs.qw.vo.QwWatchLogStatisticsListVO;
+import com.fs.sop.mapper.SopUserLogsMapper;
+import com.github.pagehelper.PageInfo;
+import org.aspectj.weaver.ast.Var;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 短链课程看课记录Controller
+ *
+ * @author fs
+ * @date 2024-10-24
+ */
+@RestController
+@RequestMapping("/course/courseWatchLog")
+public class FsCourseWatchLogController extends BaseController
+{
+    @Autowired
+    private IFsCourseWatchLogService fsCourseWatchLogService;
+    @Autowired
+    private TokenService tokenService;
+    @Autowired
+    private SopUserLogsMapper sopUserLogsMapper;
+    @Autowired
+    private IQwWatchLogService qwWatchLogService;
+    /**
+     * 查询短链课程看课记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(FsCourseWatchLogListParam param)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVONew(param);
+        TableDataInfo rspData = new TableDataInfo();
+        rspData.setCode(HttpStatus.SUCCESS);
+        rspData.setMsg("查询成功");
+        rspData.setRows(list);
+        rspData.setTotal(fsCourseWatchLogService.selectFsCourseWatchLogListVOCount(param));
+        return rspData;
+    }
+
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:statisticsList')")
+    @GetMapping("/statisticsList")
+    public TableDataInfo statisticsList(FsCourseWatchLogStatisticsListParam param)
+    {
+        if(param.getCompanyId() == null){
+            throw new IllegalArgumentException("必须选择公司!");
+        }
+        if (param.getSTime()==null||param.getETime()==null){
+            return getDataTable(new ArrayList<>());
+        }
+        List<FsCourseWatchLogStatisticsListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogStatisticsListVONew(param);
+        TableDataInfo rspData = new TableDataInfo();
+        rspData.setCode(HttpStatus.SUCCESS);
+        rspData.setMsg("查询成功");
+        rspData.setRows(list);
+        rspData.setTotal(fsCourseWatchLogService.selectFsCourseWatchLogStatisticsListVONewCount(param));
+        return rspData;
+    }
+
+    @GetMapping("/qwWatchLogStatisticsList")
+    public TableDataInfo qwWatchLogStatisticsList(QwWatchLogStatisticsListParam param)
+    {
+        if(param.getPageNum() == null){
+            param.setPageNum(1L);
+        }
+        if(param.getPageSize() == null){
+            param.setPageSize(10L);
+        }
+        if (param.getSTime()==null||param.getETime()==null){
+            return getDataTable(new ArrayList<>());
+        }
+        return qwWatchLogService.selectQwWatchLogStatisticsListVONew(param);
+    }
+    @GetMapping("/myQwWatchLogStatisticsList")
+    public TableDataInfo myQwWatchLogStatisticsList(QwWatchLogStatisticsListParam param)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        param.setCompanyUserId(loginUser.getUser().getUserId());
+        if (param.getSTime()==null||param.getETime()==null){
+            return getDataTable(new ArrayList<>());
+        }
+        return qwWatchLogService.selectQwWatchLogStatisticsListVONew(param);
+    }
+
+
+    @GetMapping("/qwWatchLogAllStatisticsList")
+    public TableDataInfo qwWatchLogAllStatisticsList(QwWatchLogStatisticsListParam param)
+    {
+        startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        if (param.getSTime()==null||param.getETime()==null){
+            return getDataTable(new ArrayList<>());
+        }
+        List<QwWatchLogAllStatisticsListVO> list = qwWatchLogService.selectQwWatchLogAllStatisticsListVONew(param);
+        return getDataTable(list);
+    }
+    @GetMapping("/myQwWatchLogAllStatisticsList")
+    public TableDataInfo myQwWatchLogAllStatisticsList(QwWatchLogStatisticsListParam param)
+    {
+        startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+
+        param.setCompanyUserId(loginUser.getUser().getUserId());
+        if (param.getSTime()==null||param.getETime()==null){
+            return getDataTable(new ArrayList<>());
+        }
+        List<QwWatchLogAllStatisticsListVO> list = qwWatchLogService.selectQwWatchLogAllStatisticsListVONew(param);
+        return getDataTable(list);
+    }
+    @GetMapping("/watchLogStatistics")
+    public TableDataInfo watchLogStatistics(FsCourseOverParam param)
+    {
+        startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        if (param.getSTime()==null||param.getETime()==null){
+            return getDataTable(new ArrayList<>());
+        }
+        List<FsCourseOverVO> list = fsCourseWatchLogService.selectFsCourseWatchLogOverStatisticsListVONew(param);
+        return getDataTable(list);
+    }
+    @GetMapping("/watchLogStatisticsExport")
+    public AjaxResult watchLogStatisticsExport(FsCourseOverParam param)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        if (param.getSTime()==null||param.getETime()==null){
+            return AjaxResult.error("请选择时间");
+        }
+        List<FsCourseOverVO> list = fsCourseWatchLogService.selectFsCourseWatchLogOverStatisticsListVO(param);
+        ExcelUtil<FsCourseOverVO> util = new ExcelUtil<FsCourseOverVO>(FsCourseOverVO.class);
+        return util.exportExcel(list, "完课数据");
+    }
+
+
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:userStatisticsList')")
+    @GetMapping("/userStatisticsList")
+    public TableDataInfo userStatisticsList(FsCourseUserStatisticsListParam param)
+    {
+        startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        if (param.getSTime()==null||param.getETime()==null){
+            return getDataTable(new ArrayList<>());
+        }
+        List<FsCourseUserStatisticsListVO> list = fsCourseWatchLogService.selectFsCourseUserStatisticsListVO(param);
+        return getDataTable(list);
+    }
+
+
+
+    /**
+     * 查询短链课程看课记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:myList')")
+    @GetMapping("/myList")
+    public TableDataInfo myList(FsCourseWatchLogListParam param)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVONew(param);
+        TableDataInfo rspData = new TableDataInfo();
+        rspData.setCode(HttpStatus.SUCCESS);
+        rspData.setMsg("查询成功");
+        rspData.setRows(list);
+        rspData.setTotal(fsCourseWatchLogService.selectFsCourseWatchLogListVOCount(param));
+        return rspData;
+    }
+
+    /**
+     * 导出短链课程看课记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:export')")
+    @Log(title = "短链课程看课记录", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(FsCourseWatchLogListParam param)
+    {
+        List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVO(param);
+        ExcelUtil<FsCourseWatchLogListVO> util = new ExcelUtil<FsCourseWatchLogListVO>(FsCourseWatchLogListVO.class);
+        return util.exportExcel(list, "短链课程看课记录数据");
+    }
+
+    /**
+     * 导出短链课程看课记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:myExport')")
+    @Log(title = "短链课程看课记录", businessType = BusinessType.EXPORT)
+    @GetMapping("/myExport")
+    public AjaxResult myExport(FsCourseWatchLogListParam param)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVO(param);
+        ExcelUtil<FsCourseWatchLogListVO> util = new ExcelUtil<FsCourseWatchLogListVO>(FsCourseWatchLogListVO.class);
+        return util.exportExcel(list, "短链课程看课记录数据");
+    }
+    /**
+     * 获取短链课程看课记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:query')")
+    @GetMapping(value = "/{logId}")
+    public AjaxResult getInfo(@PathVariable("logId") Long logId)
+    {
+        return AjaxResult.success(fsCourseWatchLogService.selectFsCourseWatchLogByLogId(logId));
+    }
+
+    /**
+     * 新增短链课程看课记录
+     */
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:add')")
+    @Log(title = "短链课程看课记录", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody FsCourseWatchLog fsCourseWatchLog)
+    {
+        return toAjax(fsCourseWatchLogService.insertFsCourseWatchLog(fsCourseWatchLog));
+    }
+
+    /**
+     * 修改短链课程看课记录
+     */
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:edit')")
+    @Log(title = "短链课程看课记录", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody FsCourseWatchLog fsCourseWatchLog)
+    {
+        return toAjax(fsCourseWatchLogService.updateFsCourseWatchLog(fsCourseWatchLog));
+    }
+
+    /**
+     * 删除短链课程看课记录
+     */
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:remove')")
+    @Log(title = "短链课程看课记录", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{logIds}")
+    public AjaxResult remove(@PathVariable Long[] logIds)
+    {
+        return toAjax(fsCourseWatchLogService.deleteFsCourseWatchLogByLogIds(logIds));
+    }
+}

+ 260 - 0
fs-admin/src/main/java/com/fs/course/controller/qw/QwFsCourseWatchLogController.java

@@ -0,0 +1,260 @@
+package com.fs.course.controller.qw;
+
+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.FsCourseWatchLog;
+import com.fs.course.param.FsCourseOverParam;
+import com.fs.course.param.FsCourseUserStatisticsListParam;
+import com.fs.course.param.FsCourseWatchLogListParam;
+import com.fs.course.param.FsCourseWatchLogStatisticsListParam;
+import com.fs.course.service.IFsCourseWatchLogService;
+import com.fs.course.vo.FsCourseOverVO;
+import com.fs.course.vo.FsCourseUserStatisticsListVO;
+import com.fs.course.vo.FsCourseWatchLogListVO;
+import com.fs.course.vo.FsCourseWatchLogStatisticsListVO;
+import com.fs.qw.param.QwWatchLogStatisticsListParam;
+import com.fs.qw.service.IQwWatchLogService;
+import com.fs.qw.vo.QwWatchLogAllStatisticsListVO;
+import com.fs.qw.vo.QwWatchLogStatisticsListVO;
+import com.fs.sop.mapper.SopUserLogsMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 短链课程看课记录Controller
+ *
+ * @author fs
+ * @date 2024-10-24
+ */
+@RestController
+@RequestMapping("/qw/course/courseWatchLog")
+public class QwFsCourseWatchLogController extends BaseController
+{
+    @Autowired
+    private IFsCourseWatchLogService fsCourseWatchLogService;
+    @Autowired
+    private TokenService tokenService;
+    @Autowired
+    private SopUserLogsMapper sopUserLogsMapper;
+    @Autowired
+    private IQwWatchLogService qwWatchLogService;
+    /**
+     * 查询短链课程看课记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(FsCourseWatchLogListParam param)
+    {
+
+//        if (param.getScheduleStartTime() != null && param.getScheduleEndTime() != null){
+//            List<String> sopUserLogsVOS = sopUserLogsMapper.selectSopUserLogsByDate(param.getScheduleStartTime(), param.getScheduleEndTime());
+//            param.setSopIds(sopUserLogsVOS);
+//            if (sopUserLogsVOS==null||sopUserLogsVOS.size()==0){
+//                return getDataTable(new ArrayList<>());
+//            }
+//        }
+        startPage();
+        List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVO(param);
+        return getDataTable(list);
+    }
+
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:statisticsList')")
+    @GetMapping("/statisticsList")
+    public TableDataInfo statisticsList(FsCourseWatchLogStatisticsListParam param)
+    {
+        startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        if (param.getSTime()==null||param.getETime()==null){
+            return getDataTable(new ArrayList<>());
+        }
+        List<FsCourseWatchLogStatisticsListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogStatisticsListVO(param);
+        return getDataTable(list);
+    }
+
+    @GetMapping("/qwWatchLogStatisticsList")
+    public TableDataInfo qwWatchLogStatisticsList(QwWatchLogStatisticsListParam param)
+    {
+        startPage();
+        if (param.getSTime()==null||param.getETime()==null){
+            return getDataTable(new ArrayList<>());
+        }
+        List<QwWatchLogStatisticsListVO> list = qwWatchLogService.selectQwWatchLogStatisticsListVO(param);
+        return getDataTable(list);
+    }
+    @GetMapping("/myQwWatchLogStatisticsList")
+    public TableDataInfo myQwWatchLogStatisticsList(QwWatchLogStatisticsListParam param)
+    {
+        startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+
+        param.setCompanyUserId(loginUser.getUser().getUserId());
+        if (param.getSTime()==null||param.getETime()==null){
+            return getDataTable(new ArrayList<>());
+        }
+        List<QwWatchLogStatisticsListVO> list = qwWatchLogService.selectQwWatchLogStatisticsListVO(param);
+        return getDataTable(list);
+    }
+
+
+    @GetMapping("/qwWatchLogAllStatisticsList")
+    public TableDataInfo qwWatchLogAllStatisticsList(QwWatchLogStatisticsListParam param)
+    {
+        startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+
+        if (param.getSTime()==null||param.getETime()==null){
+            return getDataTable(new ArrayList<>());
+        }
+        List<QwWatchLogAllStatisticsListVO> list = qwWatchLogService.selectQwWatchLogAllStatisticsListVO(param);
+        return getDataTable(list);
+    }
+    @GetMapping("/myQwWatchLogAllStatisticsList")
+    public TableDataInfo myQwWatchLogAllStatisticsList(QwWatchLogStatisticsListParam param)
+    {
+        startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+
+        param.setCompanyUserId(loginUser.getUser().getUserId());
+        if (param.getSTime()==null||param.getETime()==null){
+            return getDataTable(new ArrayList<>());
+        }
+        List<QwWatchLogAllStatisticsListVO> list = qwWatchLogService.selectQwWatchLogAllStatisticsListVO(param);
+        return getDataTable(list);
+    }
+    @GetMapping("/watchLogStatistics")
+    public TableDataInfo watchLogStatistics(FsCourseOverParam param)
+    {
+        startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+
+        if (param.getSTime()==null||param.getETime()==null){
+            return getDataTable(new ArrayList<>());
+        }
+        List<FsCourseOverVO> list = fsCourseWatchLogService.selectFsCourseWatchLogOverStatisticsListVO(param);
+        return getDataTable(list);
+    }
+    @GetMapping("/watchLogStatisticsExport")
+    public AjaxResult watchLogStatisticsExport(FsCourseOverParam param)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+
+        if (param.getSTime()==null||param.getETime()==null){
+            return AjaxResult.error("请选择时间");
+        }
+        List<FsCourseOverVO> list = fsCourseWatchLogService.selectFsCourseWatchLogOverStatisticsListVO(param);
+        ExcelUtil<FsCourseOverVO> util = new ExcelUtil<FsCourseOverVO>(FsCourseOverVO.class);
+        return util.exportExcel(list, "完课数据");
+    }
+
+
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:userStatisticsList')")
+    @GetMapping("/userStatisticsList")
+    public TableDataInfo userStatisticsList(FsCourseUserStatisticsListParam param)
+    {
+        startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+
+        if (param.getSTime()==null||param.getETime()==null){
+            return getDataTable(new ArrayList<>());
+        }
+        List<FsCourseUserStatisticsListVO> list = fsCourseWatchLogService.selectFsCourseUserStatisticsListVO(param);
+        return getDataTable(list);
+    }
+
+
+
+    /**
+     * 查询短链课程看课记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:myList')")
+    @GetMapping("/myList")
+    public TableDataInfo myList(FsCourseWatchLogListParam param)
+    {
+        startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        param.setCompanyUserId( loginUser.getUser().getUserId());
+        List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVO(param);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出短链课程看课记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:export')")
+    @Log(title = "短链课程看课记录", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(FsCourseWatchLogListParam param)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+
+        List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVO(param);
+        ExcelUtil<FsCourseWatchLogListVO> util = new ExcelUtil<FsCourseWatchLogListVO>(FsCourseWatchLogListVO.class);
+        return util.exportExcel(list, "短链课程看课记录数据");
+    }
+
+    /**
+     * 导出短链课程看课记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:myExport')")
+    @Log(title = "短链课程看课记录", businessType = BusinessType.EXPORT)
+    @GetMapping("/myExport")
+    public AjaxResult myExport(FsCourseWatchLogListParam param)
+    {
+        List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVO(param);
+        ExcelUtil<FsCourseWatchLogListVO> util = new ExcelUtil<FsCourseWatchLogListVO>(FsCourseWatchLogListVO.class);
+        return util.exportExcel(list, "短链课程看课记录数据");
+    }
+    /**
+     * 获取短链课程看课记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:query')")
+    @GetMapping(value = "/{logId}")
+    public AjaxResult getInfo(@PathVariable("logId") Long logId)
+    {
+        return AjaxResult.success(fsCourseWatchLogService.selectFsCourseWatchLogByLogId(logId));
+    }
+
+    /**
+     * 新增短链课程看课记录
+     */
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:add')")
+    @Log(title = "短链课程看课记录", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody FsCourseWatchLog fsCourseWatchLog)
+    {
+        return toAjax(fsCourseWatchLogService.insertFsCourseWatchLog(fsCourseWatchLog));
+    }
+
+    /**
+     * 修改短链课程看课记录
+     */
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:edit')")
+    @Log(title = "短链课程看课记录", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody FsCourseWatchLog fsCourseWatchLog)
+    {
+        return toAjax(fsCourseWatchLogService.updateFsCourseWatchLog(fsCourseWatchLog));
+    }
+
+    /**
+     * 删除短链课程看课记录
+     */
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:remove')")
+    @Log(title = "短链课程看课记录", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{logIds}")
+    public AjaxResult remove(@PathVariable Long[] logIds)
+    {
+        return toAjax(fsCourseWatchLogService.deleteFsCourseWatchLogByLogIds(logIds));
+    }
+}

+ 123 - 0
fs-company-app/src/main/java/com/fs/app/controller/WxCompanyUserController.java

@@ -0,0 +1,123 @@
+package com.fs.app.controller;
+
+import cn.binarywang.wx.miniapp.api.WxMaService;
+import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
+import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
+import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
+import cn.hutool.core.date.DateTime;
+import com.fs.app.param.LoginMaWxParam;
+import com.fs.app.utils.JwtUtils;
+import com.fs.common.core.domain.R;
+import com.fs.common.exception.CustomException;
+import com.fs.common.utils.IpUtil;
+import com.fs.company.domain.CompanyDept;
+import com.fs.company.domain.CompanyUser;
+import com.fs.company.service.ICompanyDeptService;
+import com.fs.company.service.ICompanyUserService;
+import com.fs.core.security.SecurityUtils;
+import com.fs.store.service.IFsUserService;
+import com.fs.wx.miniapp.config.WxMaConfiguration;
+import com.fs.wx.miniapp.config.WxMaProperties;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import me.chanjar.weixin.common.error.WxErrorException;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Date;
+import java.util.Objects;
+
+@Api("微信小程序相关接口")
+@RestController
+@RequestMapping(value = "/app/wx/miniapp")
+public class WxCompanyUserController extends AppBaseController {
+    private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    @Autowired
+    private WxMaProperties maProperties;
+
+    @Autowired
+    JwtUtils jwtUtils;
+
+    @Autowired
+    private ICompanyUserService companyUserService;
+
+    @Autowired
+    private ICompanyDeptService companyDeptService;
+
+    @ApiOperation("授权登录")
+    @PostMapping("/login")
+    public R login(@RequestBody LoginMaWxParam param) {
+        if (StringUtils.isBlank(param.getCode())) {
+            return R.error("code不存在");
+        }
+        //获取第二个小程序配置,序号从0开始
+        final WxMaService wxService = WxMaConfiguration.getMaService(maProperties.getConfigs().get(1).getAppid());
+        try {
+            WxMaJscode2SessionResult session = wxService.getUserService().getSessionInfo(param.getCode());
+            this.logger.info(session.getSessionKey());
+            this.logger.info(session.getOpenid());
+            // 解密
+            WxMaPhoneNumberInfo phoneNoInfo = wxService.getUserService().getPhoneNoInfo(session.getSessionKey(), param.getEncryptedData(), param.getIv());
+            WxMaUserInfo userInfo = wxService.getUserService().getUserInfo(session.getSessionKey(), param.getEncryptedData(), param.getIv());
+            CompanyUser companyUser = companyUserService.getCompanyUserByOpenId(session.getOpenid());
+            String ip = IpUtil.getRequestIp();
+            if (companyUser == null) {
+                //查询用户手机号是否存在,如果存在则更新
+//                FsUser checkPhone = userService.selectFsUserByPhone(phoneNoInfo.getPhoneNumber());
+                CompanyUser checkPhone = companyUserService.getCompanyUserByPhone(phoneNoInfo.getPhoneNumber());
+                if (checkPhone != null) {
+                    if (checkPhone.getMaOpenId() == null) {
+                        companyUser = checkPhone;
+                        companyUser.setMaOpenId(session.getOpenid());
+                        companyUser.setUserId(companyUser.getUserId());
+                        companyUser.setUpdateTime(new DateTime());
+                        companyUser.setLoginIp(ip);
+                        companyUserService.updateUser(companyUser);
+                    } else {
+                        throw new CustomException("此手机号用户已存在");
+                    }
+                } else {
+                    //新增
+                    companyUser = new CompanyUser();
+                    companyUser.setUserName(param.getPhoneNumber());
+                    companyUser.setNickName(param.getNickName());
+                    companyUser.setPhonenumber(param.getPhoneNumber());
+                    companyUser.setSex(userInfo != null ? userInfo.getGender() : "0");
+                    companyUser.setPassword(SecurityUtils.encryptPassword(companyUser.getPassword()));
+                    companyUser.setCreateTime(new Date());
+                    companyUser.setCompanyId(param.getCompanyId());
+                    companyUser.setParentId(param.getParentId());
+                    companyUser.setMaOpenId(session.getOpenid());
+
+                    //部门信息
+                    CompanyDept dept = companyDeptService.getDefaultCompanyDeptByCompanyId(param.getCompanyId());
+                    if (Objects.nonNull(dept)) {
+                        companyUser.setDeptId(dept.getDeptId());
+                    }
+                    companyUserService.insertUser(companyUser);
+                }
+            } else {
+                CompanyUser companyUserMp = new CompanyUser();
+                companyUserMp.setPhonenumber(phoneNoInfo.getPhoneNumber());
+                companyUserMp.setUserId(companyUser.getUserId());
+                companyUserMp.setUpdateTime(new DateTime());
+                companyUserMp.setLoginIp(ip);
+                companyUserService.updateUser(companyUser);
+            }
+            String token = jwtUtils.generateToken(companyUser.getUserId());
+            return R.ok("登录成功").put("token", token).put("companyUser", companyUser);
+        } catch (WxErrorException e) {
+            this.logger.error(e.getMessage(), e);
+            return R.error("授权失败," + e.getMessage());
+        }
+    }
+
+
+}

+ 34 - 0
fs-company-app/src/main/java/com/fs/app/param/LoginMaWxParam.java

@@ -0,0 +1,34 @@
+package com.fs.app.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+@Data
+public class LoginMaWxParam implements Serializable {
+
+    @NotBlank(message = "code参数缺失")
+    @ApiModelProperty(value = "小程序登陆code")
+    private String code;
+
+    @ApiModelProperty(value = "小程序完整用户信息的加密数据")
+    private String encryptedData;
+
+    @ApiModelProperty(value = "小程序加密算法的初始向量")
+    private String iv;
+
+    @ApiModelProperty(value = "公司id")
+    private Long companyId;
+
+    @ApiModelProperty(value = "电话号码")
+    private String phoneNumber;
+
+    @ApiModelProperty(value = "昵称")
+    private String nickName;
+
+    @ApiModelProperty(value = "上级销售id")
+    private Long parentId;
+
+}

+ 8 - 7
fs-company/src/main/java/com/fs/course/controller/FsCourseWatchLogController.java

@@ -81,33 +81,34 @@ public class FsCourseWatchLogController extends BaseController
             return getDataTable(new ArrayList<>());
         }
         List<FsCourseWatchLogStatisticsListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogStatisticsListVONew(param);
-        return getDataTable(list);
+        TableDataInfo rspData = new TableDataInfo();
+        rspData.setCode(HttpStatus.SUCCESS);
+        rspData.setMsg("查询成功");
+        rspData.setRows(list);
+        rspData.setTotal(fsCourseWatchLogService.selectFsCourseWatchLogStatisticsListVONewCount(param));
+        return rspData;
     }
 
     @GetMapping("/qwWatchLogStatisticsList")
     public TableDataInfo qwWatchLogStatisticsList(QwWatchLogStatisticsListParam param)
     {
-        startPage();
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         param.setCompanyId( loginUser.getCompany().getCompanyId());
         if (param.getSTime()==null||param.getETime()==null){
             return getDataTable(new ArrayList<>());
         }
-        List<QwWatchLogStatisticsListVO> list = qwWatchLogService.selectQwWatchLogStatisticsListVONew(param);
-        return getDataTable(list);
+        return qwWatchLogService.selectQwWatchLogStatisticsListVONew(param);
     }
     @GetMapping("/myQwWatchLogStatisticsList")
     public TableDataInfo myQwWatchLogStatisticsList(QwWatchLogStatisticsListParam param)
     {
-        startPage();
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         param.setCompanyId( loginUser.getCompany().getCompanyId());
         param.setCompanyUserId(loginUser.getUser().getUserId());
         if (param.getSTime()==null||param.getETime()==null){
             return getDataTable(new ArrayList<>());
         }
-        List<QwWatchLogStatisticsListVO> list = qwWatchLogService.selectQwWatchLogStatisticsListVONew(param);
-        return getDataTable(list);
+        return qwWatchLogService.selectQwWatchLogStatisticsListVONew(param);
     }
 
 

+ 23 - 0
fs-service-system/src/main/java/com/fs/company/domain/CompanyUser.java

@@ -127,9 +127,15 @@ public class CompanyUser extends BaseEntity
 
     private Integer qwStatus;
 
+    /** 用户上级id */
+    private Long parentId;
+
     /** 是否审核 */
     private Integer isAudit;
 
+    /** 微信小程序OPENID(如果有小程序授权) */
+    private String  maOpenId;
+
     public Integer getIsAudit() {
         return isAudit;
     }
@@ -451,4 +457,21 @@ public class CompanyUser extends BaseEntity
     public void setStatusText(String statusText) {
         this.statusText = statusText;
     }
+
+    public Long getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Long parentId) {
+        this.parentId = parentId;
+    }
+
+    public String getMaOpenId() {
+        return maOpenId;
+    }
+
+    public void setMaOpenId(String maOpenId) {
+        this.maOpenId = maOpenId;
+    }
+
 }

+ 10 - 0
fs-service-system/src/main/java/com/fs/company/mapper/CompanyUserMapper.java

@@ -7,6 +7,7 @@ import com.fs.company.vo.CompanyQwUserByIdsVo;
 import com.fs.company.vo.CompanyUserQwListVO;
 import com.fs.company.vo.CompanyUserVO;
 import com.fs.company.vo.DocCompanyUserVO;
+import com.fs.qw.param.QwWatchLogStatisticsListParam;
 import com.fs.qw.vo.CompanyUserQwVO;
 import com.fs.qw.vo.QwUserVO;
 import com.fs.wxUser.domain.CompanyWxUser;
@@ -269,4 +270,13 @@ public interface CompanyUserMapper
 
     @Select("select domain from company_user where user_id = #{userId}")
     String selectDomainByUserId(Long userId);
+
+    Long selectQwWatchLogStatisticsListVONewCount(QwWatchLogStatisticsListParam param);
+
+    @Select("select * from company_user where ma_open_id = #{maOpenId}")
+    CompanyUser getCompanyUserByOpenId(String openId);
+
+    @Select("select * from company_user where phonenumber = #{phoneNumber}")
+    CompanyUser getCompanyUserByPhone(String phoneNumber);
+
 }

+ 14 - 0
fs-service-system/src/main/java/com/fs/company/service/ICompanyUserService.java

@@ -160,4 +160,18 @@ public interface ICompanyUserService {
     List<CitysAreaVO> getCitysAreaList();
 
     R updateCompanyUserAreaList(CompanyUserAreaParam param);
+
+    /**
+     * 根据openid获取销售
+     * @param openId 微信小程序标识
+     * @return
+     */
+    CompanyUser getCompanyUserByOpenId(String openId);
+
+    /**
+     * 根据电话获取销售信息
+     * @param phoneNumber 用户电话
+     * @return
+     */
+    CompanyUser getCompanyUserByPhone(String phoneNumber);
 }

+ 10 - 0
fs-service-system/src/main/java/com/fs/company/service/impl/CompanyUserServiceImpl.java

@@ -434,6 +434,16 @@ public class CompanyUserServiceImpl implements ICompanyUserService
         }
     }
 
+    @Override
+    public CompanyUser getCompanyUserByOpenId(String openId) {
+        return companyUserMapper.getCompanyUserByOpenId(openId);
+    }
+
+    @Override
+    public CompanyUser getCompanyUserByPhone(String phoneNumber) {
+        return companyUserMapper.getCompanyUserByPhone(phoneNumber);
+    }
+
     /**
      * 批量审核用户
      * @param userIds 用户ID集合

+ 1 - 0
fs-service-system/src/main/java/com/fs/course/mapper/FsCourseWatchLogMapper.java

@@ -279,6 +279,7 @@ public interface FsCourseWatchLogMapper extends BaseMapper<FsCourseWatchLog> {
     List<Integer> selectFsCourseWatchLog7DayByExtId(Long extId);
 
     List<FsCourseWatchLogStatisticsListVO> selectFsCourseWatchLogStatisticsListVONew(FsCourseWatchLogStatisticsListParam param);
+    Long selectFsCourseWatchLogStatisticsListVONewCount(FsCourseWatchLogStatisticsListParam param);
 
     @Select("SELECT min(create_time) FROM fs_course_watch_log WHERE user_id=#{userId} limit 1")
     Date queryFirstWatchDateLogByVideoId(@Param("userId") Long userId);

+ 3 - 0
fs-service-system/src/main/java/com/fs/course/param/FsCourseWatchLogStatisticsListParam.java

@@ -24,4 +24,7 @@ public class FsCourseWatchLogStatisticsListParam {
     private Date sTime;
 
     private Long project;
+
+    private Long pageNum;
+    private Long pageSize;
 }

+ 1 - 0
fs-service-system/src/main/java/com/fs/course/service/IFsCourseWatchLogService.java

@@ -92,6 +92,7 @@ public interface IFsCourseWatchLogService extends IService<FsCourseWatchLog> {
 
     List<FsCourseWatchLogStatisticsListVO> selectFsCourseWatchLogStatisticsListVO(FsCourseWatchLogStatisticsListParam param);
     List<FsCourseWatchLogStatisticsListVO> selectFsCourseWatchLogStatisticsListVONew(FsCourseWatchLogStatisticsListParam param);
+    Long selectFsCourseWatchLogStatisticsListVONewCount(FsCourseWatchLogStatisticsListParam param);
 
     void scheduleBatchUpdateToDatabase();
 

+ 5 - 0
fs-service-system/src/main/java/com/fs/course/service/impl/FsCourseWatchLogServiceImpl.java

@@ -505,6 +505,11 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
         return list;
     }
 
+    @Override
+    public Long selectFsCourseWatchLogStatisticsListVONewCount(FsCourseWatchLogStatisticsListParam param) {
+        return fsCourseWatchLogMapper.selectFsCourseWatchLogStatisticsListVONewCount(param);
+    }
+
 
     public void sendSocket(String cmd,String message,String appKey){
         MsgBean msgBean=new MsgBean();

+ 12 - 4
fs-service-system/src/main/java/com/fs/qw/mapper/QwWatchLogMapper.java

@@ -106,15 +106,23 @@ public interface QwWatchLogMapper extends BaseMapper<QwWatchLog>{
     QwWatchLogStatisticsListVO selectQwWatchLogByQwUserId(@Param("id")Long id,@Param("createTime") Date createTime);
 
     List<QwWatchLogStatisticsListVO> selectQwWatchLogByCompanyUserId(
-            @Param("companyId") Long companyId,
-            @Param("companyUserId") Long companyUserId,
+                                            @Param("companyUserIds") List<Long> companyUserIds,
                                                                      @Param("sTime") Date sTime,
                                                                      @Param("dTime") Date dTime,
                                                                      @Param("project") Long project,
                                                                      @Param("courseId") Long courseId,
-                                                                     @Param("videoId") Long videoId
+                                                                     @Param("videoId") Long videoId,
+                                            @Param("pageNum") Long pageNum,
+                                            @Param("pageSize") Long pageSize
+    );
+    Long selectQwWatchLogByCompanyUserIdCount(
+            @Param("companyUserIds") List<Long> companyUserIds,
+            @Param("sTime") Date sTime,
+            @Param("dTime") Date dTime,
+            @Param("project") Long project,
+            @Param("courseId") Long courseId,
+            @Param("videoId") Long videoId
     );
-
 
     @Select("SELECT count(1) from qw_watch_log where ext_id=#{id} and `day`=0 ")
     int selectQwWatchLogIsFirst(Long id);

+ 3 - 0
fs-service-system/src/main/java/com/fs/qw/param/QwWatchLogStatisticsListParam.java

@@ -20,4 +20,7 @@ public class QwWatchLogStatisticsListParam {
     private Long project;
     private Long courseId;
     private Long videoId;
+
+    private Long pageNum;
+    private Long pageSize;
 }

+ 6 - 1
fs-service-system/src/main/java/com/fs/qw/service/IQwWatchLogService.java

@@ -1,6 +1,7 @@
 package com.fs.qw.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fs.common.core.page.TableDataInfo;
 import com.fs.qw.domain.QwWatchLog;
 import com.fs.qw.param.QwWatchLogStatisticsListParam;
 import com.fs.qw.vo.QwWatchLogAllStatisticsListVO;
@@ -64,8 +65,12 @@ public interface IQwWatchLogService extends IService<QwWatchLog>{
     int deleteQwWatchLogById(Long id);
 
     List<QwWatchLogStatisticsListVO> selectQwWatchLogStatisticsListVO(QwWatchLogStatisticsListParam param);
-    List<QwWatchLogStatisticsListVO> selectQwWatchLogStatisticsListVONew(QwWatchLogStatisticsListParam param);
+    TableDataInfo selectQwWatchLogStatisticsListVONew(QwWatchLogStatisticsListParam param);
+    Long selectQwWatchLogStatisticsListVONewCount(QwWatchLogStatisticsListParam param);
 
     List<QwWatchLogAllStatisticsListVO> selectQwWatchLogAllStatisticsListVO(QwWatchLogStatisticsListParam param);
     List<QwWatchLogAllStatisticsListVO> selectQwWatchLogAllStatisticsListVONew(QwWatchLogStatisticsListParam param);
+
+
+
 }

+ 67 - 27
fs-service-system/src/main/java/com/fs/qw/service/impl/QwWatchLogServiceImpl.java

@@ -2,8 +2,12 @@ package com.fs.qw.service.impl;
 
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fs.common.constant.HttpStatus;
+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.domain.Company;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.mapper.CompanyUserMapper;
 import com.fs.course.domain.FsUserCourse;
@@ -18,11 +22,13 @@ import com.fs.qw.service.IQwWatchLogService;
 import com.fs.qw.vo.QwWatchLogAllStatisticsListVO;
 import com.fs.qw.vo.QwWatchLogStatisticsListVO;
 import com.fs.store.service.cache.IFsUserCourseCacheService;
+import com.github.pagehelper.PageInfo;
 import com.hc.openapi.tool.util.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 企微看课Service业务层处理
@@ -44,6 +50,9 @@ public class QwWatchLogServiceImpl extends ServiceImpl<QwWatchLogMapper, QwWatch
 
     @Autowired
     private IFsUserCourseVideoCacheService fsUserCourseVideoCacheService;
+
+    @Autowired
+    private ICompanyCacheService companyCacheService;
     /**
      * 查询企微看课
      *
@@ -143,43 +152,68 @@ public class QwWatchLogServiceImpl extends ServiceImpl<QwWatchLogMapper, QwWatch
         return vos;
     }
 
+
     @Override
-    public List<QwWatchLogStatisticsListVO> selectQwWatchLogStatisticsListVONew(QwWatchLogStatisticsListParam param) {
+    public TableDataInfo selectQwWatchLogStatisticsListVONew(QwWatchLogStatisticsListParam param) {
         // 获取当前公司下的所有销售
         List<CompanyUser> companyUsers = companyUserMapper.selectCompanyUserByCompanyId(param.getCompanyId());
 
+        List<Long> userIds = companyUsers.stream()
+                .map(CompanyUser::getUserId)
+                .filter(Objects::nonNull)
+                .collect(Collectors.toList());
+
         List<QwWatchLogStatisticsListVO> list = new ArrayList<>();
-        for (CompanyUser companyUser : companyUsers) {
-            // 统计销售下面的所有记录
-            List<QwWatchLogStatisticsListVO> vos = qwWatchLogMapper.selectQwWatchLogByCompanyUserId(companyUser.getCompanyId(),companyUser.getUserId()
-                    , param.getSTime(),param.getETime(),param.getProject(),param.getCourseId(),param.getVideoId());
-            for (QwWatchLogStatisticsListVO item : vos) {
-                item.setCompanyUserName(String.format("%s_%d",companyUser.getUserName(),companyUser.getUserId()));
-                item.setCreateTime(companyUser.getCreateTime());
-                if(ObjectUtils.isNotNull(item.getProject())){
-                    String sysCourseProject = DictUtils.getDictLabel("sys_course_project", String.valueOf(item.getProject()));
-                    if(StringUtils.isNotBlank(sysCourseProject)){
-                        item.setProjectName(sysCourseProject);
-                    }
+
+        // 统计销售下面的所有记录
+        List<QwWatchLogStatisticsListVO> vos = qwWatchLogMapper
+                .selectQwWatchLogByCompanyUserId(userIds
+                , param.getSTime(),param.getETime(),param.getProject(),param.getCourseId(),param.getVideoId(),param.getPageNum(),param.getPageSize());
+
+        for (QwWatchLogStatisticsListVO item : vos) {
+            Company company = companyCacheService.selectCompanyById(item.getCompanyId());
+            if(ObjectUtils.isNotNull(company)){
+                item.setCompanyUserName(company.getCompanyName());
+                item.setCreateTime(company.getCreateTime());
+            }
+
+            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());
                 }
-                list.add(item);
             }
+            list.add(item);
         }
-        return list;
+
+        // 获取总记录数
+        Long total = qwWatchLogMapper
+                .selectQwWatchLogByCompanyUserIdCount(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
@@ -250,6 +284,12 @@ public class QwWatchLogServiceImpl extends ServiceImpl<QwWatchLogMapper, QwWatch
         return list;
     }
 
+    @Override
+    public Long selectQwWatchLogStatisticsListVONewCount(QwWatchLogStatisticsListParam param) {
+
+        return companyUserMapper.selectQwWatchLogStatisticsListVONewCount(param);
+    }
+
     public List<Date> getDatesBetween(Date sTime, Date eTime) {
         List<Date> dates = new ArrayList<>();
         Calendar calendar = Calendar.getInstance();

+ 1 - 0
fs-service-system/src/main/java/com/fs/qw/vo/QwWatchLogStatisticsListVO.java

@@ -10,6 +10,7 @@ public class QwWatchLogStatisticsListVO {
     private Long id;
     private String qwUserName;
     private String companyUserName;
+    private Long companyId;
     @JsonFormat(pattern = "yyyy-MM-dd")
     private Date createTime;
     /**

+ 7 - 0
fs-service-system/src/main/resources/application-config.yml

@@ -63,6 +63,13 @@ wx:
         aesKey: HlEiBB55eaWUaeBVAQO3cWKWPYv1vOVQSq7nFNICw4E
         msgDataFormat: JSON
 
+#  云联融智优选小程序,暂时使用
+      - appid: wxd70f99287830cb51   #云联融智优选(暂时用于测试销售app)
+        secret: 6e2684b3d48e6363018d4eedb8dae3e5
+        token: Ncbnd7lJvkripVOpyTFAna6NAWCxCrvC
+        aesKey:
+        msgDataFormat: JSON
+
   pay:
     appId: wx11a2ce7c2bbc4521 #微信公众号或者小程序等的appid
     mchId: 1703311381 #微信支付商户号

+ 3 - 0
fs-service-system/src/main/resources/mapper/company/CompanyUserMapper.xml

@@ -435,5 +435,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             del_flag = 0
           AND (company_user.user_id = #{userId} or company_user.parent_id = #{userId})
     </select>
+    <select id="selectQwWatchLogStatisticsListVONewCount" resultType="java.lang.Long">
+
+    </select>
 
 </mapper>

+ 38 - 0
fs-service-system/src/main/resources/mapper/course/FsCourseWatchLogMapper.xml

@@ -126,6 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </if>
         </where>
          order by l.log_id desc
+        limit ${(pageNum-1)*pageSize},${pageSize}
     </select>
 
     <select id="selectFsCourseWatchLogListByParam" resultType="com.fs.course.vo.FsCourseWatchLogListVO">
@@ -487,6 +488,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
         GROUP BY o.video_id,o.user_id,DATE(o.create_time),o.project,o.course_id
         ORDER BY o.video_id ,DATE(o.create_time)
+
+        limit ${(pageNum-1)*pageSize},${pageSize}
     </select>
     <select id="selectFsCourseWatchLogListVONew" resultType="com.fs.course.vo.FsCourseWatchLogListVO">
         SELECT
@@ -673,5 +676,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND video_id = #{videoId}
           AND user_id = #{fsUserId}
     </select>
+    <select id="selectFsCourseWatchLogStatisticsListVONewCount"
+            resultType="java.lang.Long">
+        SELECT COUNT(*)
+        FROM (
+        SELECT 1
+        FROM fs_course_watch_log o
+        <where>
+            <if test="companyId != null">
+                o.company_id=#{companyId}
+            </if>
+            <if test= 'sTime != null '>
+                and o.create_time &gt;= #{sTime}
+            </if>
+            <if test='eTime != null '>
+                and o.create_time &lt;= #{eTime}
+            </if>
+            <if test ='courseId !=null'>
+                and o.course_id = #{courseId}
+            </if>
+            <if test ='videoId !=null'>
+                and o.video_id = #{videoId}
+            </if>
+            <if test="companyUserId != null">
+                and o.company_user_id = #{companyUserId}
+            </if>
+            <if test="project != null">
+                and o.project = #{project}
+            </if>
+            <if test="userId != null">
+                and o.user_id = #{userId}
+            </if>
+        </where>
+        GROUP BY o.video_id, o.user_id, DATE(o.create_time), o.project, o.course_id
+        ) AS grouped_results_count
+    </select>
 
 </mapper>

+ 33 - 6
fs-service-system/src/main/resources/mapper/qw/QwWatchLogMapper.xml

@@ -40,14 +40,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             COUNT(CASE WHEN day = 0 and status=2 THEN 1 END) AS firstOver,
             COUNT(CASE WHEN day = 1 and status in (1,2) THEN 1 END) AS d1Online,
             COUNT(CASE WHEN day = 1 and status=2 THEN 1 END) AS d1Over,
-            COUNT(1) AS line,project,course_id,video_id
+            COUNT(1) AS line,project,course_id,video_id,company_id
              from qw_watch_log
              <where>
-                 <if test="companyUserId">
-                     and company_user_id = #{companyUserId}
-                 </if>
-                 <if test="companyId">
-                     and company_id = #{companyId}
+                 <if test="companyUserIds != null and companyUserIds.size() != 0">
+                     and company_user_id in
+                     <foreach collection="companyUserIds" item="item" open="(" close=")" separator=",">
+                         ${item}
+                     </foreach>
                  </if>
                  <if test="project != null">
                      and project=#{project}
@@ -61,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                  and DATE(line_time) between #{sTime} and #{dTime}
              </where>
             group by project,course_id,video_id
+            limit ${(pageNum-1)*pageSize},${pageSize}
     </select>
     <select id="selectQwWatchLogAllStatisticsListVONew"
             resultType="com.fs.qw.vo.QwWatchLogAllStatisticsListVO">
@@ -148,6 +149,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 and DATE(line_time) between #{sDate} AND #{eDate} group by project,course_id,video_id
             </where>
     </select>
+    <select id="selectQwWatchLogByCompanyUserIdCount" resultType="java.lang.Long">
+        SELECT COUNT(*)
+        FROM (
+        SELECT 1
+        FROM qw_watch_log
+        <where>
+            <if test="companyUserIds != null and companyUserIds.size() != 0">
+                and company_user_id in
+                <foreach collection="companyUserIds" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="project != null">
+                and project=#{project}
+            </if>
+            <if test="courseId != null">
+                and course_id=#{courseId}
+            </if>
+            <if test="videoId != null">
+                and video_id=#{videoId}
+            </if>
+            and DATE(line_time) between #{sTime} and #{dTime}
+        </where>
+        GROUP BY project, course_id, video_id
+        ) AS count_temp_table
+    </select>
 
     <insert id="insertQwWatchLog" parameterType="QwWatchLog" useGeneratedKeys="true" keyProperty="id">
         insert into qw_watch_log