15376779826 преди 1 месец
родител
ревизия
9d8c610d8b

+ 13 - 0
fs-ipad-task/src/main/java/com/fs/app/task/SendMsg.java

@@ -15,6 +15,7 @@ import com.fs.qw.mapper.QwIpadServerMapper;
 import com.fs.qw.mapper.QwUserMapper;
 import com.fs.qw.service.impl.AsyncSopTestService;
 import com.fs.qw.vo.QwSopCourseFinishTempSetting;
+import com.fs.qw.vo.QwSopTempSetting;
 import com.fs.sop.domain.QwSopLogs;
 import com.fs.sop.mapper.QwSopLogsMapper;
 import com.fs.sop.service.IQwSopLogsService;
@@ -36,6 +37,7 @@ import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
 
 @Component
 @Slf4j
@@ -185,6 +187,17 @@ public class SendMsg {
                     log.error("线程等待错误!");
                 }
             }
+            // 推送 APP
+            if (!setting.getSetting().isEmpty()) {
+                new Thread(() -> {
+                    try {
+                        List<QwSopTempSetting.Content.Setting> settings = JSON.parseArray(JSON.toJSONString(setting.getSetting()), QwSopTempSetting.Content.Setting.class).stream().filter(e -> "9".equals(e.getContentType())).collect(Collectors.toList());
+                        asyncSopTestService.asyncSendMsgBySopAppLinkNormalIM(settings, qwSopLogs.getCorpId(), user.getCompanyUserId(), qwSopLogs.getFsUserId());
+                    } catch (Exception e) {
+                        log.error("推送APP失败", e);
+                    }
+                }).start();
+            }
             qwSopLogs.setSend(true);
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             QwSopLogs updateQwSop = new QwSopLogs();

+ 13 - 0
fs-service/src/main/java/com/fs/gtPush/service/impl/uniPush2ServiceImpl.java

@@ -2,14 +2,19 @@ package com.fs.gtPush.service.impl;
 
 import cn.hutool.http.HttpUtil;
 import cn.hutool.json.JSONUtil;
+import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fs.common.core.domain.R;
 import com.fs.gtPush.domain.PushReqBean;
 import com.fs.gtPush.domain.PushResult;
 import com.fs.gtPush.service.uniPush2Service;
+import com.fs.im.service.OpenIMService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 @Service
 public class uniPush2ServiceImpl implements uniPush2Service {
+    @Autowired
+    private OpenIMService openIMService;
     private static final String url = "https://fc-mp-de6e03a9-c1a3-439b-9eec-d0dc3c565e4e.next.bspapp.com/push";
     @Override
     public PushResult pushMessage(PushReqBean push) {
@@ -17,4 +22,12 @@ public class uniPush2ServiceImpl implements uniPush2Service {
         PushResult pushResult = JSONUtil.toBean(result, PushResult.class);
         return pushResult;
     }
+    @Override
+    public void pushSopAppLinkMsgByExternalIM(String cropId, String linkTile, String linkDescribe,String linkImageUrl, String link, Long companyUserId,Long fsUserId) throws JsonProcessingException {
+
+        if (companyUserId!=null&&fsUserId!=null && fsUserId!=0){
+            openIMService.sendCourse(fsUserId,companyUserId,link,linkDescribe,linkImageUrl,cropId);
+        }
+
+    }
 }

+ 3 - 0
fs-service/src/main/java/com/fs/gtPush/service/uniPush2Service.java

@@ -1,9 +1,12 @@
 package com.fs.gtPush.service;
 
+import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fs.common.core.domain.R;
 import com.fs.gtPush.domain.PushReqBean;
 import com.fs.gtPush.domain.PushResult;
 
 public interface uniPush2Service {
     PushResult pushMessage(PushReqBean push);
+    void pushSopAppLinkMsgByExternalIM(String cropId,String linkTile,String linkDescribe,String linkImageUrl,String link,Long companyUserId,Long fsUserId) throws JsonProcessingException;
+
 }

+ 17 - 0
fs-service/src/main/java/com/fs/qw/service/impl/AsyncSopTestService.java

@@ -1,6 +1,7 @@
 package com.fs.qw.service.impl;
 
 import com.alibaba.fastjson.JSON;
+import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fs.common.utils.PubFun;
 import com.fs.course.domain.FsCourseSopAppLink;
 import com.fs.course.mapper.FsCourseSopAppLinkMapper;
@@ -501,6 +502,22 @@ public class AsyncSopTestService {
 //        push2Service.pushSopAppLinkMsgByExternal(externalId,linkTile,linkDescribe,link);
     }
 
+    /**
+     * 异步录入 发送有app的客户 之 正常sop版
+     */
+    @Async("scheduledExecutorService")
+    public void  asyncSendMsgBySopAppLinkNormalIM(List<QwSopTempSetting.Content.Setting> setting,String cropId,Long companyUserId,Long fsUserId){
+
+        setting.forEach(item->{
+            try {
+                push2Service.pushSopAppLinkMsgByExternalIM(cropId,item.getLinkTitle(),item.getLinkDescribe(),item.getLinkImageUrl(),item.getAppLinkUrl(),companyUserId,fsUserId);
+            } catch (JsonProcessingException e) {
+                e.printStackTrace();
+            }
+        });
+
+    }
+
     /**
      * 异步录入 发送有app的客户 之 正常sop版
      */

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

@@ -854,7 +854,8 @@ public class QwSopLogsServiceImpl extends ServiceImpl<QwSopLogsMapper, QwSopLogs
 
                                 //有app的异步推送消息
                                 if (!setting.isEmpty()) {
-                                    asyncSopTestService.asyncSendMsgBySopAppLinkNormal(setting, param.getExternalId());
+                                    //asyncSopTestService.asyncSendMsgBySopAppLinkNormal(setting, Long.parseLong(log.getExternalId()));
+                                    asyncSopTestService.asyncSendMsgBySopAppLinkNormalIM(setting, param.getCorpId(),qwUser.getCompanyUserId(),log.getFsUserId());
                                 }
 
                                 if (log.getExpiryTime() == null) {