Parcourir la source

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

caoliqin il y a 1 semaine
Parent
commit
e8ee40ba45

+ 2 - 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;
@@ -339,6 +340,7 @@ 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>";
 

+ 9 - 1
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());
         // 对每个模板执行同步操作

+ 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>