Pārlūkot izejas kodu

看课记录的导出

三七 3 dienas atpakaļ
vecāks
revīzija
915c00267e

+ 0 - 77
fs-admin/src/test/java/com/fs/task/StoreTaskTest.java

@@ -1,77 +0,0 @@
-package com.fs.task;
-
-
-import com.alibaba.fastjson.JSON;
-import com.fs.FSAdminApplication;
-import com.fs.common.core.page.TableDataInfo;
-import com.fs.company.service.ICompanyService;
-import com.fs.company.service.ICompanyTagService;
-import com.fs.company.vo.RedPacketMoneyVO;
-import com.fs.course.mapper.FsCourseRedPacketLogMapper;
-import com.fs.course.service.IFsCourseWatchLogService;
-import com.fs.statis.service.FsStatisSalerWatchService;
-import com.fs.store.param.h5.FsUserPageListParam;
-import com.fs.store.service.IFsUserService;
-import lombok.extern.slf4j.Slf4j;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import java.util.List;
-
-@RunWith(value = org.springframework.test.context.junit4.SpringRunner.class)
-@SpringBootTest(classes = FSAdminApplication.class)
-@Slf4j
-public class StoreTaskTest {
-    @Autowired
-    private IFsCourseWatchLogService fsCourseWatchLogService;
-    @Autowired
-    private FsCourseTask fsCourseTask;
-    @Autowired
-    private FsStatisSalerWatchService fsStatisSalerWatchService;
-
-    @Autowired
-    private FsCourseRedPacketLogMapper fsCourseRedPacketLogMapper;
-
-    @Autowired
-    private ICompanyService companyService;
-    @Autowired
-    private ICompanyTagService companyTagService;
-
-    @Autowired
-    private IFsUserService fsUserService;
-    @Test
-    public void addQwWatchLog() {
-        fsCourseWatchLogService.addCourseWatchLogDayNew();
-    }
-    @Test
-    public void test() throws Exception {
-        fsCourseTask.hyWorkTask();
-    }
-
-    @Test
-    public void testWriteData(){
-        fsStatisSalerWatchService.writeData();
-    }
-
-    @Test
-    public void tag(){
-//        log.info("tag: {}",companyTagService.queryAllTagMap());
-        FsUserPageListParam param = new FsUserPageListParam();
-        param.setPageNum(1);
-        param.setPageSize(10);
-
-        TableDataInfo tableDataInfo = fsUserService.selectFsUserPageListNew(param);
-        log.info("数据:{}", JSON.toJSONString(tableDataInfo));
-    }
-
-    @Test
-    public void redPacketSubMoney() throws Exception
-    {
-        List<RedPacketMoneyVO> redPacketMoneyVOS = fsCourseRedPacketLogMapper.selectFsCourseRedPacketLogByCompanyFix();
-        for (RedPacketMoneyVO redPacketMoneyVO : redPacketMoneyVOS) {
-            companyService.subtractCompanyMoney(redPacketMoneyVO.getMoney(),redPacketMoneyVO.getCompanyId());
-        }
-    }
-}

+ 7 - 0
fs-company/src/main/java/com/fs/course/controller/FsCourseAnswerLogsController.java

@@ -49,6 +49,10 @@ public class FsCourseAnswerLogsController extends BaseController
         if (param.getPhoneMk() != null && param.getPhoneMk() != "") {
             param.setPhone(param.getPhoneMk());
         }
+
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        param.setCompanyId( loginUser.getCompany().getCompanyId());
+
         List<FsCourseAnswerLogsListVO> list = fsCourseAnswerLogsService.selectFsCourseAnswerLogsListVONew(param);
         TableDataInfo rspData = new TableDataInfo();
         rspData.setCode(HttpStatus.SUCCESS);
@@ -93,6 +97,9 @@ public class FsCourseAnswerLogsController extends BaseController
     public AjaxResult export(FsCourseAnswerLogsParam param)
     {
 
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        param.setCompanyId( loginUser.getCompany().getCompanyId());
+
         if (param.getPhoneMk() != null && param.getPhoneMk() != "") {
             param.setPhone(param.getPhoneMk());
         }

+ 6 - 3
fs-company/src/main/java/com/fs/course/controller/FsCourseRedPacketLogController.java

@@ -53,11 +53,14 @@ public class FsCourseRedPacketLogController extends BaseController
     @GetMapping("/list")
     public TableDataInfo list(FsCourseRedPacketLogParam fsCourseRedPacketLog)
     {
-        startPage();
+
         if (fsCourseRedPacketLog.getPhoneMk() != null && fsCourseRedPacketLog.getPhoneMk() != "") {
             fsCourseRedPacketLog.setPhone(fsCourseRedPacketLog.getPhoneMk());
         }
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        fsCourseRedPacketLog.setCompanyId( loginUser.getCompany().getCompanyId());
 
+        startPage();
         List<FsCourseRedPacketLogListPVO> list = fsCourseRedPacketLogService.selectFsCourseRedPacketLogListVO(fsCourseRedPacketLog);
         return getDataTable(list);
     }
@@ -90,8 +93,8 @@ public class FsCourseRedPacketLogController extends BaseController
     @GetMapping("/export")
     public AjaxResult export(FsCourseRedPacketLogParam fsCourseRedPacketLog)
     {
-//        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
-//        fsCourseRedPacketLog.setCompanyId( loginUser.getCompany().getCompanyId());
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        fsCourseRedPacketLog.setCompanyId( loginUser.getCompany().getCompanyId());
 
         if (fsCourseRedPacketLog.getPhoneMk()!=null&&fsCourseRedPacketLog.getPhoneMk()!=""){
             fsCourseRedPacketLog.setPhone(fsCourseRedPacketLog.getPhoneMk());

+ 4 - 2
fs-company/src/main/java/com/fs/course/controller/FsCourseWatchLogController.java

@@ -202,7 +202,9 @@ public class FsCourseWatchLogController extends BaseController
     @GetMapping("/export")
     public AjaxResult export(FsCourseWatchLogListParam param)
     {
-        List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVO(param);
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        param.setCompanyId( loginUser.getCompany().getCompanyId());
+        List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVOexport(param);
         ExcelUtil<FsCourseWatchLogListVO> util = new ExcelUtil<FsCourseWatchLogListVO>(FsCourseWatchLogListVO.class);
         return util.exportExcel(list, "短链课程看课记录数据");
     }
@@ -217,7 +219,7 @@ public class FsCourseWatchLogController extends BaseController
     {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         param.setCompanyId( loginUser.getCompany().getCompanyId());
-        List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVO(param);
+        List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVOexport(param);
         ExcelUtil<FsCourseWatchLogListVO> util = new ExcelUtil<FsCourseWatchLogListVO>(FsCourseWatchLogListVO.class);
         return util.exportExcel(list, "短链课程看课记录数据");
     }

+ 3 - 1
fs-company/src/main/java/com/fs/course/controller/FsUserCourseVideoController.java

@@ -70,7 +70,9 @@ public class FsUserCourseVideoController extends BaseController
     @GetMapping(value = "/{videoId}")
     public AjaxResult getInfo(@PathVariable("videoId") Long videoId)
     {
-        return AjaxResult.success(fsUserCourseVideoService.selectFsUserCourseVideoByVideoIdVO(videoId));
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+
+        return AjaxResult.success(fsUserCourseVideoService.selectFsUserCourseVideoByVideoIdVO(videoId,loginUser.getUser().getUserId()));
     }
 
     /**

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

@@ -124,7 +124,12 @@ public interface FsCourseWatchLogMapper extends BaseMapper<FsCourseWatchLog> {
                                                  @Param("externalId") Long externalId);
 
     List<FsCourseWatchLogListVO> selectFsCourseWatchLogListVO(@Param("maps") FsCourseWatchLogListParam param);
+
+    List<FsCourseWatchLogListVO> selectFsCourseWatchLogListVOexport(@Param("maps") FsCourseWatchLogListParam param);
+
     List<FsCourseWatchLogListVO> selectFsCourseWatchLogListVONew(@Param("maps") FsCourseWatchLogListParam param);
+
+
     Long selectFsCourseWatchLogListVONewCount(@Param("maps") FsCourseWatchLogListParam param);
 
     List<FsCourseWatchLogListVO> selectFsCourseWatchLogListByParam(FsCourseWatchLogListParam param);

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

@@ -82,6 +82,7 @@ public interface IFsCourseWatchLogService extends IService<FsCourseWatchLog> {
 
 
     List<FsCourseWatchLogListVO> selectFsCourseWatchLogListVO(FsCourseWatchLogListParam param);
+    List<FsCourseWatchLogListVO> selectFsCourseWatchLogListVOexport(FsCourseWatchLogListParam param);
     List<FsCourseWatchLogListVO> selectFsCourseWatchLogListVONew(FsCourseWatchLogListParam param);
     Long selectFsCourseWatchLogListVOCount(FsCourseWatchLogListParam param);
     List<FsCourseWatchLogListVO> selectFsCourseWatchLogListVOExport(FsCourseWatchLogListParam param);

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

@@ -295,6 +295,11 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
         return list;
     }
 
+    @Override
+    public List<FsCourseWatchLogListVO> selectFsCourseWatchLogListVOexport(FsCourseWatchLogListParam param) {
+        return fsCourseWatchLogMapper.selectFsCourseWatchLogListVOexport(param);
+    }
+
     @Override
     public List<FsCourseWatchLogListVO> selectFsCourseWatchLogListVONew(FsCourseWatchLogListParam param) {
         if(ObjectUtils.isNull(param.getPageNum())){

+ 80 - 2
fs-service-system/src/main/resources/mapper/course/FsCourseWatchLogMapper.xml

@@ -51,6 +51,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectFsCourseWatchLogVo"/>
         where log_id = #{logId}
     </select>
+
+
     <select id="selectFsCourseWatchLogListVO" resultType="com.fs.course.vo.FsCourseWatchLogListVO">
         select l.log_id,
                l.project as project,
@@ -126,7 +128,83 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </if>
         </where>
          order by l.log_id desc
-        limit ${(pageNum-1)*pageSize},${pageSize}
+        limit ${(maps.pageNum-1)*maps.pageSize},${maps.pageSize}
+    </select>
+
+
+    <select id="selectFsCourseWatchLogListVOexport" resultType="com.fs.course.vo.FsCourseWatchLogListVO">
+        select l.log_id,l.user_id,uc.course_name,v.title as video_name,qec.avatar as external_user_avatar,
+        l.log_type,SEC_TO_TIME(l.duration) as duration,c.company_name,l.camp_period_time,l.finish_time,
+        cu.nick_name as company_user_name ,l.send_type,l.create_time,l.update_time,l.last_heartbeat_time,
+        qu.qw_user_name,qec.name as external_user_name,c.company_id
+        from fs_course_watch_log l
+        left join fs_user_course_video v on v.video_id = l.video_id
+        left join fs_user_course uc on uc.course_id = l.course_id
+        left join fs_user u on u.user_id = l.user_id
+        left join company_user cu on cu.user_id = l.company_user_id
+        left join company c on c.company_id = l.company_id
+        LEFT JOIN qw_user qu on qu.id= l.qw_user_id
+        LEFT JOIN qw_external_contact qec on l.qw_external_contact_id = qec.id
+        <where>
+            <if test ='maps.userId !=null'>
+                and l.user_id = #{maps.userId}
+            </if>
+            <if test ='maps.qwExternalContactId !=null'>
+                and l.qw_external_contact_id = #{maps.qwExternalContactId}
+            </if>
+            <if test ='maps.qwUserId !=null'>
+                and l.qw_user_id = #{maps.qwUserId}
+            </if>
+            <if test ='maps.courseId !=null'>
+                and l.course_id = #{maps.courseId}
+            </if>
+            <if test ='maps.videoId !=null'>
+                and l.video_id = #{maps.videoId}
+            </if>
+            <if test ='maps.logType !=null'>
+                and l.log_type = #{maps.logType}
+            </if>
+            <if test ='maps.companyId !=null'>
+                and l.company_id = #{maps.companyId}
+            </if>
+            <if test ='maps.companyUserId !=null'>
+                and l.company_user_id = #{maps.companyUserId}
+            </if>
+            <if test ='maps.companyUserName !=null and maps.companyUserName!=""'>
+                and cu.nick_name  like concat('%', #{maps.companyUserName}, '%')
+            </if>
+            <if test ='maps.nickName !=null and maps.nickName!=""'>
+                and u.nick_name  like concat('%', #{maps.nickName}, '%')
+            </if>
+            <if test ='maps.externalUserName !=null and maps.externalUserName!=""'>
+                and qec.name  like concat('%', #{maps.externalUserName}, '%')
+            </if>
+            <if test= 'maps.sTime != null '>
+                and DATE(l.create_time) &gt;= DATE(#{maps.sTime})
+            </if>
+            <if test='maps.eTime != null '>
+                and DATE(l.create_time) &lt;= DATE(#{maps.eTime})
+            </if>
+            <if test= 'maps.scheduleStartTime != null '>
+                and DATE(l.camp_period_time) &gt;= DATE(#{maps.scheduleStartTime})
+            </if>
+            <if test='maps.scheduleEndTime != null '>
+                and DATE(l.camp_period_time) &lt;= DATE(#{maps.scheduleEndTime})
+            </if>
+            <if test= 'maps.upSTime != null '>
+                and DATE(l.update_time) &gt;= DATE(#{maps.upSTime})
+            </if>
+            <if test='maps.upETime != null '>
+                and DATE(l.update_time) &lt;= DATE(#{maps.upETime})
+            </if>
+            <if test="maps.sopIds != null and maps.sopIds.size() > 0">
+                and l.sop_id in
+                <foreach item="sopId" index="index" collection="maps.sopIds" open="(" separator="," close=")">
+                    #{sopId}
+                </foreach>
+            </if>
+        </where>
+        order by l.finish_time asc,l.update_time desc
     </select>
 
     <select id="selectFsCourseWatchLogListByParam" resultType="com.fs.course.vo.FsCourseWatchLogListVO">
@@ -492,7 +570,7 @@ 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}
+        limit ${(maps.pageNum-1)*maps.pageSize},${maps.pageSize}
     </select>
     <select id="selectFsCourseWatchLogListVONew" resultType="com.fs.course.vo.FsCourseWatchLogListVO">
         SELECT

+ 4 - 0
fs-user-app/src/main/java/com/fs/app/controller/WxPayController.java

@@ -122,5 +122,9 @@ public class WxPayController {
         return storePaymentService.v3TransferNotify(notifyData,request);
     }
 
+    @GetMapping("/get")
+    public void setLogger(){
+        iSopUserLogsInfoService.updateSopUserInfoByExternalId(200L,123456L);
+    }
 
 }