|
|
@@ -1,5 +1,6 @@
|
|
|
package com.fs.qw.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.fs.common.utils.PubFun;
|
|
|
@@ -7,6 +8,8 @@ import com.fs.course.domain.FsCourseSopAppLink;
|
|
|
import com.fs.course.mapper.FsCourseSopAppLinkMapper;
|
|
|
import com.fs.gtPush.service.uniPush2Service;
|
|
|
import com.fs.his.mapper.FsUserMapper;
|
|
|
+import com.fs.im.dto.OpenImMsgDTO;
|
|
|
+import com.fs.im.service.OpenIMService;
|
|
|
import com.fs.qw.domain.QwSopUpdateStatus;
|
|
|
import com.fs.qw.domain.QwUser;
|
|
|
import com.fs.qw.mapper.QwExternalContactMapper;
|
|
|
@@ -29,6 +32,7 @@ import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -58,7 +62,7 @@ public class AsyncSopTestService {
|
|
|
private final SopUserLogsMapper sopUserLogsMapper;
|
|
|
private final FsCourseSopAppLinkMapper fsCourseSopAppLinkMapper;
|
|
|
private final uniPush2Service push2Service;
|
|
|
-
|
|
|
+ private final OpenIMService openIMService;
|
|
|
/**
|
|
|
* 立即执行SOP任务
|
|
|
*/
|
|
|
@@ -527,6 +531,64 @@ public class AsyncSopTestService {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Async("scheduledExecutorService")
|
|
|
+ public void asyncSendMsgBySopAppTxtNormalIM(List<QwSopTempSetting.Content.Setting> setting,String cropId,Long companyUserId,Long fsUserId){
|
|
|
+
|
|
|
+ setting.forEach(item->{
|
|
|
+ try {
|
|
|
+ log.info("执行发送app文本消息:{}",item);
|
|
|
+ OpenImMsgDTO openImMsgDTO = new OpenImMsgDTO();
|
|
|
+ openImMsgDTO.setSendID("C"+companyUserId);
|
|
|
+ openImMsgDTO.setRecvID("U"+fsUserId);
|
|
|
+ openImMsgDTO.setContentType(101);
|
|
|
+ openImMsgDTO.setSessionType(1);
|
|
|
+ OpenImMsgDTO.Content imContent = new OpenImMsgDTO.Content();
|
|
|
+ imContent.setContent(item.getValue());
|
|
|
+ openImMsgDTO.setContent(imContent);
|
|
|
+ openIMService.openIMSendMsg(openImMsgDTO);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Async("scheduledExecutorService")
|
|
|
+ public void asyncSendMsgBySopAppMP3NormalIM(List<QwSopTempSetting.Content.Setting> setting,String cropId,Long companyUserId,Long fsUserId){
|
|
|
+
|
|
|
+ setting.forEach(item->{
|
|
|
+ try {
|
|
|
+ if(StrUtil.isEmpty(item.getVoiceUrl())){
|
|
|
+ log.info("执行发送app文本消息:{}",item);
|
|
|
+ OpenImMsgDTO openImMsgDTO = new OpenImMsgDTO();
|
|
|
+ openImMsgDTO.setSendID("C"+companyUserId);
|
|
|
+ openImMsgDTO.setRecvID("U"+fsUserId);
|
|
|
+ openImMsgDTO.setContentType(101);
|
|
|
+ openImMsgDTO.setSessionType(1);
|
|
|
+ OpenImMsgDTO.Content imContent = new OpenImMsgDTO.Content();
|
|
|
+ imContent.setContent(item.getValue());
|
|
|
+ openImMsgDTO.setContent(imContent);
|
|
|
+ openIMService.openIMSendMsg(openImMsgDTO);
|
|
|
+ }else {
|
|
|
+ log.info("执行发送app语音消息:{}",item);
|
|
|
+ OpenImMsgDTO openImMsgDTO = new OpenImMsgDTO();
|
|
|
+ openImMsgDTO.setSendID("C"+companyUserId);
|
|
|
+ openImMsgDTO.setRecvID("U"+fsUserId);
|
|
|
+ openImMsgDTO.setContentType(103);
|
|
|
+ openImMsgDTO.setSessionType(1);
|
|
|
+ OpenImMsgDTO.Content imContent = new OpenImMsgDTO.Content();
|
|
|
+ imContent.setSourceUrl(item.getVoiceUrl());
|
|
|
+ imContent.setDuration(Integer.parseInt(item.getVoiceDuration()));
|
|
|
+ openImMsgDTO.setContent(imContent);
|
|
|
+ openIMService.openIMSendMsg(openImMsgDTO);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 异步录入 发送有app的客户 之 正常sop版
|
|
|
*/
|