Bladeren bron

看课记录

xdd 1 maand geleden
bovenliggende
commit
81eee75b7e

+ 5 - 0
fs-service-system/src/main/java/com/fs/course/param/FsCourseWatchLogListParam.java

@@ -32,6 +32,11 @@ public class FsCourseWatchLogListParam implements Serializable {
 
     private String sopDate;
 
+    /**
+     * 归属发送方式:1 个微  2 企微
+     */
+    private Integer sourceType;
+
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date eTime;
 

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

@@ -31,6 +31,8 @@ import com.fs.course.vo.*;
 import com.fs.his.config.FsSysConfig;
 import com.fs.his.utils.ConfigUtil;
 import com.fs.qw.Bean.MsgBean;
+import com.fs.qw.cache.IQwExternalContactCacheService;
+import com.fs.qw.cache.IQwUserCacheService;
 import com.fs.qw.domain.QwExternalContact;
 import com.fs.qw.domain.QwUser;
 import com.fs.qw.domain.QwWatchLog;
@@ -114,7 +116,11 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
     @Autowired
     private ICompanyCacheService companyCacheService;
 
+    @Autowired
+    private IQwUserCacheService qwUserCacheService;
 
+    @Autowired
+    private IQwExternalContactCacheService qwExternalContactCacheService;
 
     /**
      * 查询短链课程看课记录
@@ -346,6 +352,22 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
                 }
             }
 
+            // 企微用户名
+            if(ObjectUtils.isNotNull(item.getQwUserId())){
+                String qwUserName = qwUserCacheService.queryQwUserNameByUserId(item.getQwUserId());
+                if(StringUtils.isNotBlank(qwUserName)){
+                    item.setQwUserName(qwUserName);
+                }
+            }
+
+            // 企微外部联系人
+            if(ObjectUtils.isNotNull(item.getQwExternalContactId())){
+                String qwExternalContactName = qwExternalContactCacheService.selectQwExternalContactById(item.getQwExternalContactId());
+                if(StringUtils.isNotBlank(qwExternalContactName)){
+                    item.setExternalUserName(qwExternalContactName);
+                }
+            }
+
         }
         return list;
     }

+ 1 - 1
fs-service-system/src/main/java/com/fs/course/vo/FsCourseWatchLogListVO.java

@@ -48,7 +48,7 @@ public class FsCourseWatchLogListVO extends BaseEntity
     private Integer logType;
 
     @Excel(name = "企微外部联系人id")
-    private String qwExternalContactId;
+    private Long qwExternalContactId;
 
 
     @Excel(name = "播放时长")

+ 11 - 0
fs-service-system/src/main/java/com/fs/qw/cache/IQwExternalContactCacheService.java

@@ -0,0 +1,11 @@
+package com.fs.qw.cache;
+
+public interface IQwExternalContactCacheService {
+    /**
+     * 查询企业微信客户
+     *
+     * @param id 企业微信客户主键
+     * @return 企业微信客户
+     */
+    String selectQwExternalContactById(Long id);
+}

+ 5 - 0
fs-service-system/src/main/java/com/fs/qw/cache/IQwUserCacheService.java

@@ -0,0 +1,5 @@
+package com.fs.qw.cache;
+
+public interface IQwUserCacheService {
+    String queryQwUserNameByUserId(String userId);
+}

+ 37 - 0
fs-service-system/src/main/java/com/fs/qw/cache/impl/QwExternalContactCacheServiceImpl.java

@@ -0,0 +1,37 @@
+package com.fs.qw.cache.impl;
+
+import com.fs.qw.cache.IQwExternalContactCacheService;
+import com.fs.qw.domain.QwExternalContact;
+import com.fs.qw.service.IQwExternalContactService;
+import com.github.benmanes.caffeine.cache.Cache;
+import com.github.benmanes.caffeine.cache.Caffeine;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.concurrent.TimeUnit;
+
+@Service
+public class QwExternalContactCacheServiceImpl implements IQwExternalContactCacheService {
+
+    @Autowired
+    private IQwExternalContactService qwExternalContactService;
+    /**
+     * 企微用户名昵称缓存类
+     */
+    private static final Cache<Long, String> QW_EXTERNAL_CONTACT_CACHE = Caffeine.newBuilder()
+            .maximumSize(5000)
+            .expireAfterWrite(12, TimeUnit.HOURS)
+            .build();
+
+
+    @Override
+    public String selectQwExternalContactById(Long id) {
+        return QW_EXTERNAL_CONTACT_CACHE.get(id,e->{
+            QwExternalContact qwExternalContact = qwExternalContactService.selectQwExternalContactById(id);
+            if(qwExternalContact != null) {
+                return qwExternalContact.getName();
+            }
+            return "-";
+        });
+    }
+}

+ 35 - 0
fs-service-system/src/main/java/com/fs/qw/cache/impl/QwUserCacheServiceImpl.java

@@ -0,0 +1,35 @@
+package com.fs.qw.cache.impl;
+
+import com.fs.qw.cache.IQwUserCacheService;
+import com.fs.qw.domain.QwUser;
+import com.fs.qw.service.IQwUserService;
+import com.fs.store.domain.FsUser;
+import com.github.benmanes.caffeine.cache.Cache;
+import com.github.benmanes.caffeine.cache.Caffeine;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.concurrent.TimeUnit;
+
+@Service
+public class QwUserCacheServiceImpl implements IQwUserCacheService {
+    @Autowired
+    private IQwUserService qwUserService;
+    /**
+     * 企微用户名昵称缓存类
+     */
+    private static final Cache<String, String> QW_USER_CACHE = Caffeine.newBuilder()
+            .maximumSize(5000)
+            .expireAfterWrite(12, TimeUnit.HOURS)
+            .build();
+    @Override
+    public String queryQwUserNameByUserId(String userId) {
+        return QW_USER_CACHE.get(userId,e-> {
+            QwUser qwUser = qwUserService.selectQwUserByQwUserId(userId);
+            if(qwUser != null) {
+                return String.format("%s_%s",qwUser.getQwUserId(),qwUser.getQwUserName());
+            }
+            return "-";
+        });
+    }
+}

+ 6 - 1
fs-service-system/src/main/resources/mapper/course/FsCourseWatchLogMapper.xml

@@ -504,7 +504,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         l.company_id,
         l.company_user_id,
         l.course_id,
-        l.video_id
+        l.video_id,
+        l.qw_user_id,
+        l.qw_external_contact_id
         FROM
         fs_course_watch_log l
         INNER JOIN (
@@ -547,6 +549,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test='maps.upETime != null '>
                 and DATE(l.update_time) &lt;= DATE(#{maps.upETime})
             </if>
+            <if test="maps.sourceType != null">
+                and send_type = #{maps.sourceType}
+            </if>
             <if test="maps.sopIds != null and maps.sopIds.size() > 0">
             and l.sop_id in
                 AND sop_id IN