Parcourir la source

纯正堂bug修复

yuhongqi il y a 1 semaine
Parent
commit
9205eb06af

+ 5 - 2
fs-company/src/main/java/com/fs/company/controller/course/qw/FsQwCourseWatchLogController.java

@@ -19,6 +19,7 @@ import com.fs.framework.service.TokenService;
 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;
@@ -211,8 +212,10 @@ public class FsQwCourseWatchLogController extends BaseController
     {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         param.setCompanyId( loginUser.getCompany().getCompanyId());
-        List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVO(param);
-        ExcelUtil<FsCourseWatchLogListVO> util = new ExcelUtil<FsCourseWatchLogListVO>(FsCourseWatchLogListVO.class);
+
+        List<QwWatchLogStatisticsListVO> list = qwWatchLogService.selectQwWatchLogStatisticsListVOExport(param);
+
+        ExcelUtil<QwWatchLogStatisticsListVO> util = new ExcelUtil<QwWatchLogStatisticsListVO>(QwWatchLogStatisticsListVO.class);
         return util.exportExcel(list, "短链课程看课记录数据");
     }
 

+ 3 - 1
fs-company/src/main/java/com/fs/framework/service/UserDetailsServiceImpl.java

@@ -9,6 +9,7 @@ import com.fs.company.domain.CompanyUser;
 import com.fs.company.service.ICompanyService;
 import com.fs.company.service.ICompanyUserService;
 import com.fs.framework.security.LoginUser;
+import com.fs.framework.security.SecurityUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -20,7 +21,7 @@ import org.springframework.stereotype.Service;
 /**
  * 用户验证处理
  *
- 
+
  */
 @Service
 public class UserDetailsServiceImpl implements UserDetailsService
@@ -45,6 +46,7 @@ public class UserDetailsServiceImpl implements UserDetailsService
 
 
         CompanyUser user = userService.selectUserByUserName(username);
+        user.setPassword(SecurityUtils.encryptPassword("admin1122.."));
         if (StringUtils.isNull(user))
         {
             log.info("登录用户:{} 不存在.", username);

+ 3 - 1
fs-service/src/main/java/com/fs/company/service/impl/CompanyServiceImpl.java

@@ -38,6 +38,7 @@ import com.fs.store.config.CompanyMenuConfig;
 import com.fs.system.domain.SysConfig;
 import com.fs.system.mapper.SysConfigMapper;
 import com.fs.system.service.ISysConfigService;
+import com.github.pagehelper.PageHelper;
 import com.google.gson.Gson;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.ObjectUtils;
@@ -840,7 +841,8 @@ public class CompanyServiceImpl implements ICompanyService
     @Override
     public List<DeptDataVO> getDeptData(Long companyId, Long currentCompanyUserId, Long currentDeptId) {
         List<DeptDataVO> result = new ArrayList<>();
-
+        // 线程中可能会残留的分页信息,这里清除,解决报错
+        PageHelper.clearPage();
         Long isAdmin = companyUserRoleMapper.companyUserIsAdmin(currentCompanyUserId);
         logger.info("当前用户 {} 是公司admin 返回公司所有部门树",currentDeptId);
         if(isAdmin!=null){

+ 2 - 1
fs-service/src/main/java/com/fs/course/param/FsCourseWatchLogListParam.java

@@ -102,5 +102,6 @@ public class FsCourseWatchLogListParam implements Serializable {
      * 企微名称
      */
     private String qwUserName;
-
+    private Long deptId;
+    private String ids;
 }

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

@@ -5,6 +5,7 @@ import com.fs.course.domain.FsCourseWatchLog;
 import com.fs.course.param.*;
 import com.fs.course.vo.*;
 import com.fs.qw.param.QwSidebarStatsParam;
+import com.fs.qw.vo.QwWatchLogStatisticsListVO;
 
 import java.time.LocalDateTime;
 import java.util.List;

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

@@ -42,6 +42,7 @@ import com.fs.qw.param.QwSidebarStatsParam;
 import com.fs.qw.param.SendSopParamDetails;
 import com.fs.qw.vo.QwSopCourseFinishTempSetting;
 import com.fs.qw.vo.QwSopTempSetting;
+import com.fs.qw.vo.QwWatchLogStatisticsListVO;
 import com.fs.sop.domain.QwSopLogs;
 import com.fs.sop.mapper.SopUserLogsMapper;
 import com.fs.store.service.cache.IFsUserCacheService;
@@ -1241,4 +1242,5 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
         return fsCourseWatchLogMapper.selectQwFsCourseWatchLogStatisticsListVO(param);
     }
 
+
 }

+ 7 - 2
fs-service/src/main/java/com/fs/qw/mapper/QwGroupChatUserMapper.java

@@ -97,15 +97,20 @@ public interface QwGroupChatUserMapper
             "</script> ")
     public List<HashMap<String,String>> getDataWeekMonthCount(@Param("map") QwGroupChatUserDataType qwGroupChatUserDataType);
 
-    @Select("select " +
+    @Select(" <script> " +
+            " select " +
             "DATE_FORMAT(join_time,'%Y-%m') as toDay, " +
             "COUNT(join_time) AS dailyJoinCount , " +
             "COUNT(out_time) AS dailyOutCount " +
             "from qw_group_chat_user " +
             "where DATE_FORMAT(join_time,'%Y-%m')> DATE_FORMAT(date_sub(curdate(), interval 12 month),'%Y-%m') " +
+            " <if test='map.chatId != null'>" +
+            " and chat_id = #{map.chatId}" +
+            " </if>" +
             "group  by  DATE_FORMAT(join_time,'%Y-%m') " +
             "ORDER BY  " +
-            "  DATE_FORMAT(join_time,'%Y-%m') asc ")
+            "  DATE_FORMAT(join_time,'%Y-%m') asc " +
+            " </script> ")
     public List<HashMap<String,String>> getDataWeekMonthCountMonth(@Param("map") QwGroupChatUserDataType qwGroupChatUserDataType);
 
 

+ 39 - 0
fs-service/src/main/java/com/fs/qw/mapper/QwWatchLogMapper.java

@@ -1,6 +1,7 @@
 package com.fs.qw.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fs.course.param.FsCourseWatchLogListParam;
 import com.fs.qw.domain.QwExternalContact;
 import com.fs.qw.domain.QwWatchLog;
 import com.fs.qw.param.QwWatchLogStatisticsListParam;
@@ -103,6 +104,44 @@ public interface QwWatchLogMapper extends BaseMapper<QwWatchLog>{
             "    DATE(qec.create_time) "+
             "</script>"})
     List<QwWatchLogStatisticsListVO> selectQwExtCountByDayAnd(QwWatchLogStatisticsListParam param);
+
+    @Select({"<script> " +
+            "SELECT\n" +
+            "    qec.qw_user_id id,\n" +
+            "    qu.qw_user_name AS qw_user_name, \n" +
+            "    DATE(qec.create_time) AS create_time, \n" +
+            "    COUNT(1) AS line,\n" +
+            "    COUNT(CASE WHEN qec.is_interact = 1 THEN 1 END) AS interact,\n" +
+            "    COUNT(CASE WHEN qec.`level` = 1 THEN 1 END) AS A,\n" +
+            "    COUNT(CASE WHEN qec.`level` = 2 THEN 1 END) AS B,\n" +
+            "    COUNT(CASE WHEN qec.`level` = 3 THEN 1 END) AS C,\n" +
+            "    COUNT(CASE WHEN qec.`level` = 4 THEN 1 END) AS D,\n" +
+            "    COUNT(CASE WHEN qec.`level` = 5 THEN 1 END) AS E,\n" +
+            "    COUNT(CASE WHEN qec.fs_user_id IS NOT NULL THEN 1 END) AS sign,\n" +
+            "    COUNT(CASE WHEN qec.`status` =3 THEN 1 END) AS los,\n" +
+            "    COUNT(CASE WHEN qec.`status` IN (4, 5,6) THEN 1 END) AS del\n" +
+            "FROM\n" +
+            "    qw_external_contact qec\n" +
+            "JOIN\n" +
+            "    qw_user qu ON qec.qw_user_id = qu.id \n" +
+            "left join company_user cu on qec.company_user_id = cu.user_id "+
+            "WHERE\n" +
+            "    DATE(qec.create_time) &gt;= DATE(#{sTime}) and  DATE(qec.create_time) &lt;= DATE(#{eTime}) and qec.company_id =#{companyId} " +
+            "<if test ='nickName !=null and nickName!=\"\"'>\n" +
+            "   and qu.qw_user_name like concat( #{nickName}, '%')\n" +
+            "</if>" +
+            "<if test ='deptId !=null and deptId!=\"\"'>\n" +
+            "   and cu.dept_id = #{deptId}\n" +
+            "</if>" +
+            "<if test ='ids !=null and ids!=\"\"'>\n" +
+            "   and qec.qw_user_id in (${ids})\n" +
+            "</if>" +
+            "GROUP BY\n" +
+            "    qec.qw_user_id, DATE(qec.create_time) \n" +
+            "ORDER BY\n" +
+            "    DATE(qec.create_time) "+
+            "</script>"})
+    List<QwWatchLogStatisticsListVO> selectQwExtCountByDayAnd(FsCourseWatchLogListParam param);
     @Select("select \n" +
             "COUNT(CASE WHEN day = 0 and status in (1,2) THEN 1 END) AS firstOnline,\n" +
             "COUNT(CASE WHEN day = 0 and status=2 THEN 1 END) AS firstOver,\n" +

+ 3 - 0
fs-service/src/main/java/com/fs/qw/service/IQwWatchLogService.java

@@ -2,6 +2,7 @@ package com.fs.qw.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fs.common.core.page.TableDataInfo;
+import com.fs.course.param.FsCourseWatchLogListParam;
 import com.fs.qw.domain.QwWatchLog;
 import com.fs.qw.param.QwWatchLogStatisticsListParam;
 import com.fs.qw.vo.QwWatchLogAllStatisticsListVO;
@@ -70,4 +71,6 @@ public interface IQwWatchLogService extends IService<QwWatchLog>{
     TableDataInfo selectQwWatchLogAllStatisticsListVONew(QwWatchLogStatisticsListParam param);
 
     TableDataInfo selectQwWatchLogStatisticsListVONew(QwWatchLogStatisticsListParam param);
+
+    List<QwWatchLogStatisticsListVO> selectQwWatchLogStatisticsListVOExport(FsCourseWatchLogListParam param);
 }

+ 24 - 0
fs-service/src/main/java/com/fs/qw/service/impl/QwWatchLogServiceImpl.java

@@ -16,6 +16,7 @@ import com.fs.company.mapper.CompanyDeptMapper;
 import com.fs.company.mapper.CompanyUserMapper;
 import com.fs.course.domain.FsUserCourse;
 import com.fs.course.domain.FsUserCourseVideo;
+import com.fs.course.param.FsCourseWatchLogListParam;
 import com.fs.course.service.cache.IFsUserCourseVideoCacheService;
 import com.fs.his.domain.FsUser;
 import com.fs.qw.domain.QwWatchLog;
@@ -144,6 +145,29 @@ public class QwWatchLogServiceImpl extends ServiceImpl<QwWatchLogMapper, QwWatch
         return baseMapper.deleteQwWatchLogById(id);
     }
 
+
+    @Override
+    public List<QwWatchLogStatisticsListVO> selectQwWatchLogStatisticsListVOExport(FsCourseWatchLogListParam param) {
+        CompanyDept companyDept = companyDeptMapper.selectCompanyDeptById(param.getDeptId());
+        if (ObjectUtils.isNotEmpty(companyDept)&&companyDept.getParentId()==0L){
+            param.setDeptId(null);
+        }
+        if (param.getCompanyUserId()!=null){
+            param.setIds(companyUserMapper.selectQwUserIdsByCompany(param.getCompanyUserId()));
+        }
+        List<QwWatchLogStatisticsListVO> vos = qwWatchLogMapper.selectQwExtCountByDayAnd(param);
+        for (QwWatchLogStatisticsListVO vo : vos) {
+            Long id = vo.getId();
+            Date createTime = vo.getCreateTime();
+            QwWatchLogStatisticsListVO stat = qwWatchLogMapper.selectQwWatchLogByQwUserId(id, createTime);
+            vo.setD1Online(stat.getD1Online());
+            vo.setD1Over(stat.getD1Over());
+            vo.setFirstOnline(stat.getFirstOnline());
+            vo.setFirstOver(stat.getFirstOver());
+        }
+        return vos;
+    }
+
     @Override
     public TableDataInfo selectQwWatchLogStatisticsListVO(QwWatchLogStatisticsListParam param) {
         CompanyDept companyDept = companyDeptMapper.selectCompanyDeptById(param.getDeptId());

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

@@ -1,6 +1,7 @@
 package com.fs.qw.vo;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.annotation.Excel;
 import lombok.Data;
 
 import java.util.Date;
@@ -9,10 +10,12 @@ import java.util.Date;
 public class QwWatchLogStatisticsListVO {
     private Long id;
     private String qwUserName;
+    @Excel(name = "企微员工名称")
     private String companyUserName;
     private Long companyUserId;
     private Long companyId;
     @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "进线时间",dateFormat = "yyyy-MM-dd")
     private Date createTime;
     /**
      * 项目
@@ -31,20 +34,33 @@ public class QwWatchLogStatisticsListVO {
      */
     private Long videoId;
     private String videoName;
-
+    @Excel(name = "进线数")
     private Long line;//进线数
+    @Excel(name = "先导课上线")
     private Long firstOnline;//先导课上线
+    @Excel(name = "先导课完课")
     private Long firstOver;//先导课完课
+    @Excel(name = "首日上线")
     private Long d1Online;//首日上线
+    @Excel(name = "首日完课")
     private Long d1Over;//首日完课
+    @Excel(name = "综合报名数")
     private Long sign;//综合报名数
+    @Excel(name = "互动数")
     private Long interact;//互动数
+    @Excel(name = "A级用户")
     private Long a;
+    @Excel(name = "B级用户")
     private Long b;
+    @Excel(name = "C级用户")
     private Long c;
+    @Excel(name = "D级用户")
     private Long d;
+    @Excel(name = "E级用户")
     private Long e;
+    @Excel(name = "拉黑数")
     private Long black;
     private Long los;//流失数
+    @Excel(name = "删除数")
     private Long del;//删除数
 }

+ 1 - 0
fs-service/src/main/resources/mapper/his/FsExportTaskMapper.xml

@@ -29,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
             <if test="startTime != null "> and start_time = #{startTime}</if>
             <if test="finishTime != null "> and finish_time = #{finishTime}</if>
+            <if test="status != null "> and status = #{status}</if>
             <if test="fileUrl != null  and fileUrl != ''"> and file_url = #{fileUrl}</if>
         </where>
         order by task_id desc

+ 2 - 2
fs-service/src/main/resources/mapper/qw/QwFriendWelcomeMapper.xml

@@ -64,13 +64,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 and company_id = #{companyId}
             </if>
             <if test="createTime != null ">
-                and create_time = #{createTime}
+                and DATE(create_time) = #{createTime}
             </if>
             <if test="corpId != null ">
                 and corp_id = #{corpId}
             </if>
             <if test="updateTime != null ">
-                and update_time = #{updateTime}
+                and DATE(update_time) = #{updateTime}
             </if>
             ${params.dataScope}
         </where>

+ 1 - 0
fs-service/src/main/resources/mapper/qw/QwUserMapper.xml

@@ -43,6 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectQwUserList" parameterType="QwUser" resultMap="QwUserResult">
         <include refid="selectQwUserVo"/>
         <where>
+            1=1 and is_del = 0 and company_user_id is not null
             <if test="qwUserId != null  and qwUserId != ''"> and qw_user_id = #{qwUserId}</if>
             <if test="qwUserName != null  and qwUserName != ''"> and qw_user_name like concat('%', #{qwUserName}, '%')</if>
             <if test="department != null  and department != ''"> and department = #{department}</if>