|
@@ -6,6 +6,7 @@ import com.fs.common.BeanCopyUtils;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.exception.CustomException;
|
|
|
import com.fs.common.utils.DateUtils;
|
|
|
+import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.course.domain.FsCourseWatchLog;
|
|
|
import com.fs.course.mapper.FsCourseWatchLogMapper;
|
|
|
import com.fs.course.param.FsCourseLinkCreateParam;
|
|
@@ -371,10 +372,9 @@ public class QwContactWayServiceImpl implements IQwContactWayService
|
|
|
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public boolean sendWelcomeMsg(QwContactWay qwContactWay, String corpId, String welcomeCode,QwUser qwUser,Long qwExternalId) {
|
|
|
-
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean sendWelcomeMsg(QwContactWay qwContactWay, String corpId, String welcomeCode, QwUser qwUser, Long qwExternalId) {
|
|
|
if (qwContactWay.getIsSpanWelcome()==1){
|
|
|
String welcomeJson = qwContactWay.getWelcomeJson();
|
|
|
if (welcomeJson!=null&&welcomeJson!=""){
|
|
@@ -395,9 +395,7 @@ public class QwContactWayServiceImpl implements IQwContactWayService
|
|
|
|
|
|
SendWelcomeMsgParam copy = BeanCopyUtils.copy(qwWelcomeJsonFrom, SendWelcomeMsgParam.class);
|
|
|
copy.setWelcome_code(welcomeCode);
|
|
|
-
|
|
|
QwResult qwResult = qwApiService.sendWelcomeMsg(copy, corpId);
|
|
|
-
|
|
|
if (qwResult.getErrcode()==0){
|
|
|
return false;
|
|
|
}else {
|
|
@@ -411,23 +409,45 @@ public class QwContactWayServiceImpl implements IQwContactWayService
|
|
|
|
|
|
|
|
|
}
|
|
|
+
|
|
|
SendWelcomeMsgParam sendWelcomeMsgParam = new SendWelcomeMsgParam();
|
|
|
sendWelcomeMsgParam.setWelcome_code(welcomeCode);
|
|
|
- TextMessage textMessage = new TextMessage();
|
|
|
- textMessage.setContent(qwContactWay.getTextContent());
|
|
|
- sendWelcomeMsgParam.setText(textMessage);
|
|
|
- SendWelcomeMsgParam.Attachment attachment = new SendWelcomeMsgParam.Attachment();
|
|
|
- SendWelcomeMsgParam.Attachment.ImageAttachment imageAttachment = new SendWelcomeMsgParam.Attachment.ImageAttachment();
|
|
|
- imageAttachment.setPic_url(qwContactWay.getImagePicUrl());
|
|
|
- attachment.setMsgtype("image");
|
|
|
- attachment.setImage(imageAttachment);
|
|
|
- sendWelcomeMsgParam.setAttachments(Arrays.asList(attachment));
|
|
|
+
|
|
|
+ // 构建文本消息
|
|
|
+ if (StringUtils.isNotBlank(qwContactWay.getTextContent())) {
|
|
|
+ TextMessage textMessage = new TextMessage();
|
|
|
+ textMessage.setContent(qwContactWay.getTextContent());
|
|
|
+ sendWelcomeMsgParam.setText(textMessage);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 构建图片附件 - 修正结构
|
|
|
+ List<SendWelcomeMsgParam.Attachment> attachments = new ArrayList<>();
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(qwContactWay.getImagePicUrl())) {
|
|
|
+ SendWelcomeMsgParam.Attachment imageAttachment = new SendWelcomeMsgParam.Attachment();
|
|
|
+ imageAttachment.setMsgtype("image");
|
|
|
+
|
|
|
+ // 创建图片内容对象
|
|
|
+ SendWelcomeMsgParam.Attachment.ImageAttachment imageContent = new SendWelcomeMsgParam.Attachment.ImageAttachment();
|
|
|
+ imageContent.setPic_url(qwContactWay.getImagePicUrl());
|
|
|
+ imageAttachment.setImage(imageContent);
|
|
|
+
|
|
|
+ attachments.add(imageAttachment);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!attachments.isEmpty()) {
|
|
|
+ sendWelcomeMsgParam.setAttachments(attachments);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 发送请求
|
|
|
QwResult qwResult = qwApiService.sendWelcomeMsg(sendWelcomeMsgParam, corpId);
|
|
|
- if (qwResult.getErrcode()==0){
|
|
|
- return false;
|
|
|
- }else {
|
|
|
- return true;
|
|
|
+
|
|
|
+ if ("levent".equals(qwUser.getQwUserId())) {
|
|
|
+ log.debug("发送结果: {}", qwResult);
|
|
|
}
|
|
|
+
|
|
|
+ // 修正返回值逻辑 - 0表示成功
|
|
|
+ return qwResult.getErrcode() == 0;
|
|
|
}
|
|
|
|
|
|
public List<QwWelcomeJsonFrom.Attachment> attachmentsTools( List<QwWelcomeJsonFrom.Attachment> attachments,
|