xdd 3 tygodni temu
rodzic
commit
1d51bf9796

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

@@ -63,7 +63,7 @@ public class FsCourseAnswerLogsController extends BaseController
 
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         param.setCompanyId( loginUser.getCompany().getCompanyId());
-
+        param.setCompanyUserId(loginUser.getUser().getUserId());
         if (param.getPhoneMk() != null && param.getPhoneMk() != "") {
             param.setPhone(param.getPhoneMk());
         }

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

@@ -75,7 +75,7 @@ public class FsCourseWatchLogController extends BaseController
         if (param.getSTime()==null||param.getETime()==null){
             return getDataTable(new ArrayList<>());
         }
-        List<FsCourseWatchLogStatisticsListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogStatisticsListVO(param);
+        List<FsCourseWatchLogStatisticsListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogStatisticsListVONew(param);
         return getDataTable(list);
     }
 

+ 12 - 3
fs-company/src/main/java/com/fs/users/controller/FsUserController.java

@@ -75,9 +75,18 @@ public class FsUserController extends BaseController
         return R.ok().put("data", list);
     }
 
-
-
-
+    /**
+     * 查询企业内的用户,每次只返回5条
+     * @param fsUser 查询参数
+     * @return R
+     */
+    @GetMapping("/getUserListLimit")
+    public R getUserListLimit( FsUser fsUser)
+    {
+        fsUser.setIsDel(0);
+        List<FsUser> list=fsUserService.getUserListLimit(fsUser);
+        return R.ok().put("data", list);
+    }
 
     /**
      * 新增用户

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

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

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

@@ -9,6 +9,8 @@ import java.util.Date;
 public class FsCourseWatchLogStatisticsListParam {
 
     private Long companyId;
+    private Long companyUserId;
+    private Long userId;
 
     private String nickName;
 
@@ -20,4 +22,6 @@ public class FsCourseWatchLogStatisticsListParam {
     private Date eTime;
     @JsonFormat(pattern = "yyyy-MM-dd")
     private Date sTime;
+
+    private Long project;
 }

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

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

+ 0 - 1
fs-service-system/src/main/java/com/fs/course/service/cache/impl/FsUserCourseVideoCacheServiceImpl.java

@@ -9,7 +9,6 @@ import com.github.benmanes.caffeine.cache.Cache;
 import com.github.benmanes.caffeine.cache.Caffeine;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.concurrent.TimeUnit;

+ 59 - 4
fs-service-system/src/main/java/com/fs/course/service/impl/FsCourseWatchLogServiceImpl.java

@@ -6,9 +6,11 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fs.common.core.redis.RedisCache;
 import com.fs.common.utils.DateUtils;
+import com.fs.common.utils.DictUtils;
 import com.fs.company.cache.ICompanyUserCacheService;
 import com.fs.company.domain.CompanyUser;
 import com.fs.course.config.CourseConfig;
@@ -22,6 +24,7 @@ import com.fs.course.mapper.FsUserCourseMapper;
 import com.fs.course.mapper.FsUserCourseVideoMapper;
 import com.fs.course.param.*;
 import com.fs.course.service.IFsCourseWatchLogService;
+import com.fs.course.service.cache.IFsUserCourseVideoCacheService;
 import com.fs.course.vo.*;
 import com.fs.his.config.FsSysConfig;
 import com.fs.his.utils.ConfigUtil;
@@ -39,7 +42,10 @@ import com.fs.sop.domain.QwSopLogs;
 import com.fs.sop.mapper.SopUserLogsMapper;
 import com.fs.store.domain.FsUser;
 import com.fs.store.service.IFsUserService;
+import com.fs.store.service.cache.IFsUserCacheService;
+import com.fs.store.service.cache.IFsUserCourseCacheService;
 import com.fs.system.service.ISysConfigService;
+import com.hc.openapi.tool.util.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -53,10 +59,7 @@ import java.time.LocalDateTime;
 import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.ChronoUnit;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 /**
  * 短链课程看课记录Service业务层处理
@@ -96,6 +99,15 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
     @Autowired
     private IFsUserService fsUserService;
 
+    @Autowired
+    private IFsUserCourseCacheService fsUserCourseCacheService;
+
+    @Autowired
+    private IFsUserCourseVideoCacheService fsUserCourseVideoCacheService;
+
+    @Autowired
+    private IFsUserCacheService fsUserCacheService;
+
 
     /**
      * 查询短链课程看课记录
@@ -283,6 +295,49 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
         return fsCourseWatchLogMapper.selectFsCourseWatchLogStatisticsListVO(param);
     }
 
+    @Override
+    public List<FsCourseWatchLogStatisticsListVO> selectFsCourseWatchLogStatisticsListVONew(FsCourseWatchLogStatisticsListParam param) {
+        List<FsCourseWatchLogStatisticsListVO> list = fsCourseWatchLogMapper.selectFsCourseWatchLogStatisticsListVONew(param);
+        for (FsCourseWatchLogStatisticsListVO item : list) {
+            // 项目名
+            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.getVideoId())) {
+                FsUserCourseVideo fsUserCourseVideo = fsUserCourseVideoCacheService.selectFsUserCourseVideoByVideoId(item.getVideoId());
+                if(ObjectUtils.isNotNull(fsUserCourseVideo)){
+                    item.setVideoName(fsUserCourseVideo.getTitle());
+                }
+            }
+            // 用户名
+            if(ObjectUtils.isNotNull(item.getUserId())) {
+                FsUser fsUser = fsUserCacheService.selectFsUserById(item.getUserId());
+                if(ObjectUtils.isNotNull(fsUser)){
+                    item.setUserName(String.format("%s_%d",fsUser.getNickname(),fsUser.getUserId()));
+                }
+            }
+            // 销售名
+            if(ObjectUtils.isNotNull(item.getCompanyUserId())) {
+                CompanyUser companyUser = companyUserCacheService.selectCompanyUserById(item.getCompanyUserId());
+                if(ObjectUtils.isNotNull(companyUser)){
+                    item.setCompanyUserName(String.format("%s_%d", companyUser.getUserName(), companyUser.getUserId()));
+                }
+            }
+        }
+        return list;
+    }
+
 
     public void sendSocket(String cmd,String message,String appKey){
         MsgBean msgBean=new MsgBean();

+ 16 - 2
fs-service-system/src/main/java/com/fs/course/vo/FsCourseWatchLogStatisticsListVO.java

@@ -10,9 +10,15 @@ import java.util.Date;
 public class FsCourseWatchLogStatisticsListVO {
 
 
+    private Integer project;
+    @Excel(name = "项目名称")
+    private String projectName;
+
+    private Long courseId;
     @Excel(name = "课程名称")
     private String courseName;
 
+    private Long videoId;
     @Excel(name = "小节名称")
     private String videoName;
 
@@ -24,10 +30,18 @@ public class FsCourseWatchLogStatisticsListVO {
     private String type3;
     @Excel(name = "看课中断")
     private String type4;
-    @Excel(name = "企业微信员工名称")
-    private String qwUserName;
+//    @Excel(name = "企业微信员工名称")
+//    private String qwUserName;
+
+    private Long userId;
+    @Excel(name = "员工名称")
+    private String userName;
 
     @Excel(name = "创建时间")
     @JsonFormat(pattern = "yyyy-MM-dd")
     private Date createTime;
+
+    private Long companyUserId;
+    @Excel(name = "销售名称")
+    private String companyUserName;
 }

+ 3 - 0
fs-service-system/src/main/java/com/fs/store/mapper/FsUserMapper.java

@@ -200,4 +200,7 @@ public interface FsUserMapper
 
     @Select("select * from fs_user where union_id=#{unionid} limit 1")
     FsUser selectFsUserByUnionid(String unionId);
+
+
+    List<FsUser> selectFsUserListLimit(FsUser fsUser);
 }

+ 2 - 0
fs-service-system/src/main/java/com/fs/store/service/IFsUserService.java

@@ -121,4 +121,6 @@ public interface IFsUserService
     R clearUserVip(Long l);
 
     FsUser selectFsUserByUnionid(String unionId);
+
+    List<FsUser> getUserListLimit(FsUser fsUser);
 }

+ 5 - 0
fs-service-system/src/main/java/com/fs/store/service/impl/FsUserServiceImpl.java

@@ -347,4 +347,9 @@ public class FsUserServiceImpl implements IFsUserService
     public FsUser selectFsUserByUnionid(String unionId) {
         return fsUserMapper.selectFsUserByUnionid(unionId);
     }
+
+    @Override
+    public List<FsUser> getUserListLimit(FsUser fsUser) {
+        return fsUserMapper.selectFsUserListLimit(fsUser);
+    }
 }

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

@@ -381,6 +381,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           and fcwl.camp_period_time is not NULL
         ]]>
     </select>
+    <select id="selectFsCourseWatchLogStatisticsListVONew"
+            resultType="com.fs.course.vo.FsCourseWatchLogStatisticsListVO">
+        SELECT
+        o.company_user_id,o.user_id,DATE(o.create_time) create_time,
+        SUM(CASE WHEN o.log_type = '1' THEN 1 ELSE 0 END) AS type1,
+        SUM(CASE WHEN o.log_type = '2' THEN 1 ELSE 0 END) AS type2,
+        SUM(CASE WHEN o.log_type = '3' THEN 1 ELSE 0 END) AS type3,
+        SUM(CASE WHEN o.log_type = '4' THEN 1 ELSE 0 END) AS type4,
+        o.project as project,
+        o.course_id as course_id,
+        o.video_id as video_id
+        FROM fs_course_watch_log o
+        <where>
+            <if test="companyId != null">
+                o.company_id=#{companyId}
+            </if>
+            <if test= 'sTime != null '>
+                and DATE(o.create_time) &gt;= DATE(#{sTime})
+            </if>
+            <if test='eTime != null '>
+                and DATE(o.create_time) &lt;= DATE(#{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)
+        ORDER BY o.video_id ,DATE(o.create_time)
+    </select>
 
     <update id="batchUpdateWatchLog" parameterType="java.util.List">
         UPDATE fs_course_watch_log

+ 41 - 0
fs-service-system/src/main/resources/mapper/store/FsUserMapper.xml

@@ -89,6 +89,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectFsUserVo"/>
         where user_id = #{userId}
     </select>
+    <select id="selectFsUserListLimit" resultType="com.fs.store.domain.FsUser">
+        <include refid="selectFsUserVo"/>
+        <where>
+            <if test="password != null  and password != ''"> and password = #{password}</if>
+            <if test="realName != null  and realName != ''"> and real_name like concat('%', #{realName}, '%')</if>
+            <if test="birthday != null "> and birthday = #{birthday}</if>
+            <if test="idCard != null  and idCard != ''"> and id_card = #{idCard}</if>
+            <if test="remark != null  and remark != ''"> and remark = #{remark}</if>
+            <if test="avatar != null  and avatar != ''"> and avatar = #{avatar}</if>
+            <if test="lastIp != null  and lastIp != ''"> and last_ip = #{lastIp}</if>
+            <if test="nowMoney != null "> and now_money = #{nowMoney}</if>
+            <if test="brokeragePrice != null "> and brokerage_price = #{brokeragePrice}</if>
+            <if test="integral != null "> and integral = #{integral}</if>
+            <if test="signNum != null "> and sign_num = #{signNum}</if>
+            <if test="status != null "> and status = #{status}</if>
+            <if test="level != null "> and level = #{level}</if>
+            <if test="spreadUserId != null "> and spread_user_id = #{spreadUserId}</if>
+            <if test="spreadTime != null "> and spread_time = #{spreadTime}</if>
+            <if test="userType != null  and userType != ''"> and user_type = #{userType}</if>
+            <if test="isPromoter != null "> and is_promoter = #{isPromoter}</if>
+            <if test="payCount != null "> and pay_count = #{payCount}</if>
+            <if test="spreadCount != null "> and spread_count = #{spreadCount}</if>
+            <if test="addres != null  and addres != ''"> and addres = #{addres}</if>
+            <if test="isDel != null "> and is_del = #{isDel}</if>
+            <if test="companyId != null "> and company_id = #{companyId}</if>
+            <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
+            <if test="registerDate != null "> and DATE_FORMAT(register_date,'%Y-%m-%d') = DATE_FORMAT(#{registerDate},'%Y-%m-%d')</if>
+            <if test="registerCode != null   and registerCode != '' "> and register_code = #{registerCode}</if>
+            <if test="source != null  and source != '' "> and source = #{source}</if>
+            <if test="isShow != null  "> and is_show = #{isShow}</if>
+             <if test="(username != null  and username != '') or (nickname != null  and nickname != '') or (phone != null  and phone != '')">
+                 and (
+                 <if test="username != null  and username != ''"> username like concat('%', #{username}, '%')</if>
+                 <if test="nickname != null  and nickname != ''"> or nickname like concat('%', #{nickname}, '%')</if>
+                 <if test="phone != null  and phone != ''"> or phone like concat('%',#{phone},'%')</if>
+                 )
+             </if>
+        </where>
+        order by user_id desc
+        limit 10
+    </select>
 
     <insert id="insertFsUser" parameterType="FsUser" useGeneratedKeys="true" keyProperty="userId">
         insert into fs_user