Prechádzať zdrojové kódy

Merge branch 'master' of http://1.14.104.71:10880/root/ylrz_his_scrm_java

15376779826 1 týždeň pred
rodič
commit
b15ced0c9d

+ 3 - 0
fs-admin/src/main/java/com/fs/course/controller/FsUserCourseController.java

@@ -3,6 +3,7 @@ package com.fs.course.controller;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.json.JSONUtil;
 import com.fs.common.annotation.Log;
+import com.fs.common.annotation.RepeatSubmit;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
@@ -337,7 +338,9 @@ public class FsUserCourseController extends BaseController {
     /**
      * 同步课程模板
      */
+    @PreAuthorize("@ss.hasPermi('course:userCourseVideo:sync')")
     @Log(title = "同步课程模板", businessType = BusinessType.UPDATE)
+    @RepeatSubmit
     @PostMapping("/syncTemplate/{courseId}")
     public AjaxResult syncTemplate(@PathVariable Long courseId) {
         sopTempService.syncTemplate(courseId);

+ 18 - 4
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -687,10 +687,13 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
     private R handleRoom(FsUserCourseVideoAddKfUParam param,FsUser user) {
         //查询客户列表
         List<QwExternalContact> contacts = qwExternalContactMapper.selectQwExternalContactListVOByfsUserId(user.getUserId());
-        log.info("查出来的企微客户数量:"+contacts.size());
-        if (!contacts.isEmpty()){
+        List<QwExternalContact> nonNullContacts = contacts.stream()
+                .filter(Objects::nonNull)
+                .collect(Collectors.toList());
+        log.info("查出来的企微客户数量:"+nonNullContacts.size());
+        if (!nonNullContacts.isEmpty()){
             //找出对应销售匹配的客户
-            QwExternalContact matchedContact = contacts.stream()
+            QwExternalContact matchedContact = nonNullContacts.stream()
                     .filter(contact -> contact.getQwUserId().equals(Long.parseLong(param.getQwUserId())))
                     .findFirst()
                     .orElse(null);
@@ -706,9 +709,20 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
                     createWatchLog(param);
                 }
                 return R.error(567,"群聊通用链接").put("qwExternalId", matchedContact.getId());
+            }else {
+                QwExternalContact contact = nonNullContacts.get(0);
+                log.info("匹配到的第一个企微用户:"+contact.getUserId());
+                log.info("企微id:"+contact.getId());
+                log.info("用户:"+param.getVideoId());
+                log.info("企微用户:"+param.getQwUserId());
+                param.setQwExternalId(contact.getId());
+                FsCourseWatchLog log = courseWatchLogMapper.getWatchCourseVideoByExt(contact.getId(), param.getVideoId(),param.getQwUserId());
+                if (log==null){
+                    createWatchLog(param);
+                }
+                return R.error(567,"群聊通用链接").put("qwExternalId", contact.getId());
             }
         }
-
         String msg = "<div style=\"color: red;margin-bottom: 15px;font-weight: bold;\">本课程为群会员独享<br>请长按二维码</div>\n" +
                 "\t\t\t\t\t<div style=\"color: #999;font-size: 14px;font-weight: bold;\">添加伴学助手免费领取会员权限</div>";
 

+ 6 - 1
fs-service/src/main/java/com/fs/course/vo/FsCourseWatchLogStatisticsListVO.java

@@ -39,7 +39,7 @@ public class FsCourseWatchLogStatisticsListVO {
     @Excel(name = "员工名称")
     private String userName;
 
-    @Excel(name = "创建时间")
+    @Excel(name = "创建时间" ,dateFormat = "yyyy-MM-dd")
     @JsonFormat(pattern = "yyyy-MM-dd")
     private Date createTime;
 
@@ -48,18 +48,23 @@ public class FsCourseWatchLogStatisticsListVO {
     private String companyUserName;
 
     /** 发课数 */
+    @Excel(name = "发课数")
     private String  sendNumber;
 
     /** 已注册用户待看课数 */
+    @Excel(name = "已注册用户待看课数")
     private String  isUserWaitNumber;
 
     /** 未注册用户待看课数 */
+    @Excel(name = "未注册用户待看课数")
     private String  noUserWaitNumber;
 
     /** 上线率 */
+    @Excel(name = "上线率")
     private String  onLineRate;
 
     /** 完课率 */
+    @Excel(name = "完课率")
     private String  finishedRate;
 
     /** 消耗红包金额 */

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

@@ -89,5 +89,5 @@ public class FsUserCoursePeriodVO implements Serializable {
     @Excel(name = "营期线", width = 31, dateFormat = "yyyy-MM-dd")
     private Date periodLine;
     /** 是否需要单独注册会员,1-是,0-否(用于个微销售分享看课) */
-    private Integer isNeedRegisterMember;
+    private String isNeedRegisterMember;
 }

+ 0 - 3
fs-service/src/main/java/com/fs/sop/mapper/QwSopTempRulesMapper.java

@@ -80,7 +80,4 @@ public interface QwSopTempRulesMapper extends BaseMapper<QwSopTempRules> {
     List<QwSopTempRules> listByTempIdAndNameAndDayNum(@Param("id") String id, @Param("dayNum") Integer dayNum);
 
     void deleteByIdList(@Param("ids") List<String> ids);
-
-    @Select("select * from qw_sop_temp_rules where course_id = #{courseId} ")
-    List<QwSopTempRules> selectQwSopTempRulesListByCourseId(@Param("courseId")Long courseId);
 }

+ 1 - 1
fs-service/src/main/java/com/fs/sop/service/impl/QwSopTempRulesServiceImpl.java

@@ -244,7 +244,7 @@ public class QwSopTempRulesServiceImpl extends ServiceImpl<QwSopTempRulesMapper,
     @Override
     @DataSource(DataSourceType.SOP)
     public List<QwSopTempRules> listByCourseId(Long courseId) {
-        return qwSopTempRulesMapper.selectQwSopTempRulesListByCourseId(courseId);
+        return list(new QueryWrapper<QwSopTempRules>().eq("course_id", courseId));
     }
 
     @Override

+ 19 - 3
fs-service/src/main/java/com/fs/sop/service/impl/QwSopTempServiceImpl.java

@@ -638,12 +638,20 @@ public class QwSopTempServiceImpl implements IQwSopTempService {
         if (CollectionUtils.isEmpty(tempIds)) {
             return;
         }
+        // 只弄课程模板的
         List<QwSopTemp> tempList = qwSopTempMapper.selectListByIds(tempIds);
         tempList = tempList.stream().filter(f -> Objects.equals(f.getStatus(), "1")).collect(Collectors.toList());
         if (CollectionUtils.isEmpty(tempList)) {
             return;
         }
-        List<QwSopTempContent> contentList = qwSopTempContentService.listByTempIds(tempIds);
+
+        // 获取这些规则关联的模板ID集合
+        Set<String> sopTempIds = tempList.stream()
+                .map(QwSopTemp::getId)
+                .filter(Objects::nonNull)
+                .collect(Collectors.toSet());
+
+        List<QwSopTempContent> contentList = qwSopTempContentService.listByTempIds(sopTempIds);
 
         CountDownLatch latch = new CountDownLatch(tempList.size());
         // 对每个模板执行同步操作
@@ -681,8 +689,16 @@ public class QwSopTempServiceImpl implements IQwSopTempService {
             temp.setId(UUID.randomUUID().toString());
             qwSopTempMapper.insertQwSopTemp(temp);
             // 重新生成该模板的规则和内容
-            threadPoolTaskExecutor.execute(() -> createSopTempRules(temp));
-            latch.countDown();
+            threadPoolTaskExecutor.execute(() -> {
+                try {
+                    createSopTempRules(temp);
+                } catch (Exception e) {
+                    log.error("同步模板规则和内容失败", e);
+                } finally {
+                    latch.countDown();
+                }
+            });
+
         }
 
         try {

+ 1 - 1
fs-service/src/main/resources/mapper/sop/QwSopTempMapper.xml

@@ -68,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select * from qw_sop_temp_temp
     </select>
     <select id="selectListByIds" resultType="com.fs.sop.domain.QwSopTemp">
-        select * from qw_sop_temp  where id in
+        select * from qw_sop_temp  where send_type = 11 and id in
         <foreach item="id" collection="ids" open="(" separator="," close=")">
             #{id}
         </foreach>