소스 검색

修复发送主备,更具时间来

吴树波 2 일 전
부모
커밋
181b430e14
2개의 변경된 파일29개의 추가작업 그리고 4개의 파일을 삭제
  1. 27 3
      fs-ipad-task/src/main/java/com/fs/app/service/IpadSendServer.java
  2. 2 1
      fs-service/src/main/java/com/fs/ipad/vo/BaseVo.java

+ 27 - 3
fs-ipad-task/src/main/java/com/fs/app/service/IpadSendServer.java

@@ -1,5 +1,6 @@
 package com.fs.app.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.fs.common.core.redis.RedisCache;
 import com.fs.common.exception.base.BaseException;
@@ -12,6 +13,7 @@ import com.fs.course.domain.FsCourseWatchLog;
 import com.fs.course.service.IFsCourseWatchLogService;
 import com.fs.ipad.IpadSendUtils;
 import com.fs.ipad.vo.*;
+import com.fs.qw.domain.QwExternalContact;
 import com.fs.qw.domain.QwUser;
 import com.fs.qw.domain.QwUserVideo;
 import com.fs.qw.mapper.QwExternalContactMapper;
@@ -31,6 +33,7 @@ import org.springframework.stereotype.Service;
 import java.time.LocalDateTime;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 @Slf4j
 @Service
@@ -50,9 +53,29 @@ public class IpadSendServer {
     private void sendMiniProgram(BaseVo vo, QwSopCourseFinishTempSetting.Setting content, Map<String, FsCoursePlaySourceConfig> miniMap, Long companyId) {
         String appid = content.getMiniprogramAppid();
         if(companyId != null && content.getMiniType() != null){
-            List<CompanyMiniapp> list = companyMiniappService.list(new QueryWrapper<CompanyMiniapp>().eq("company_id", companyId).eq("type", content.getMiniType()));
-            if(!list.isEmpty() && list.get(0) != null && StringUtils.isNotEmpty(list.get(0).getAppId())){
-                appid = list.get(0).getAppId();
+            log.info("打印企業信息------------------》:{}",companyId);
+            List<CompanyMiniapp> list = companyMiniappService.list(new QueryWrapper<CompanyMiniapp>().eq("company_id", companyId));
+            List<CompanyMiniapp> collect = list.stream().filter(e -> e.getType().equals(content.getMiniType())).collect(Collectors.toList());
+            if(!collect.isEmpty() && collect.get(0) != null && StringUtils.isNotEmpty(collect.get(0).getAppId())){
+                appid = collect.get(0).getAppId();
+            }
+            if(!vo.isRoom()){
+             try {
+                 log.error("打印查詢數據-------------------》{}",vo.getExId());
+                 QwExternalContact qwExternalContact = qwExternalContactMapper.selectOne(new LambdaQueryWrapper<QwExternalContact>().eq(QwExternalContact::getQwUserId,vo.getQwUserId()).eq(QwExternalContact::getExternalUserId,vo.getExId()));
+                 log.error("打印外部聯係人ID-------------------》{}",qwExternalContact.getId());
+                 LocalDateTime createTime = qwExternalContact.getCreateTime() == null ? LocalDateTime.now() : DateUtil.dateToLocalDateTime(qwExternalContact.getCreateTime());
+                 LocalDateTime lastTime = LocalDateTime.of(2025, 11, 6, 23, 59, 59);
+                 int listIndex = createTime.isAfter(lastTime) ? 1 : 0 ;
+                 List<CompanyMiniapp> collect2 = list.stream().filter(e -> e.getType().equals(listIndex)).collect(Collectors.toList());
+                 if(!collect2.isEmpty() && collect2.get(0) != null && StringUtils.isNotEmpty(collect2.get(0).getAppId())){
+                     appid = collect2.get(0).getAppId();
+                 }
+             } catch (Exception e) {
+                 e.printStackTrace();
+                 log.error("输出外部联系人ID-------------->{}",vo.getExId());
+                 log.error("数据异常----------------------》{}",e.getMessage());
+             }
             }
         }
         FsCoursePlaySourceConfig courseMaConfig = miniMap.get(appid);
@@ -340,6 +363,7 @@ public class IpadSendServer {
         vo.setServerId(qwUser.getServerId());
         vo.setCorpCode(parentVo.getCorpCode());
         vo.setCorpId(parentVo.getCorpId());
+        vo.setQwUserId(qwUser.getId());
         try {
             content.setSendStatus(1);
             switch (content.getContentType()) {

+ 2 - 1
fs-service/src/main/java/com/fs/ipad/vo/BaseVo.java

@@ -12,7 +12,7 @@ public class BaseVo{
     private String corpId;
     private String corpCode;
     private boolean isRoom;
-
+    private Long qwUserId;
 
     public void setBase(BaseVo vo){
         this.uuid = vo.getUuid();
@@ -21,5 +21,6 @@ public class BaseVo{
         this.corpCode = vo.getCorpCode();
         this.exId = vo.getExId();
         this.isRoom = vo.isRoom();
+        this.qwUserId = vo.qwUserId;
     }
 }