提交 6bab0519 编写于 作者: 孙喜旺

修改群发入参

上级 d5dcedbb
......@@ -33,6 +33,11 @@ public enum GroupMessageType {
*/
TEXT_IMAGE("4", "text_image"),
/**
* 视频
*/
VIDEO("5", "video")
;
/**
* 媒体类型
......
......@@ -68,6 +68,11 @@ public class CustomerMessagePushDto {
*/
private MiniprogramMessageDto miniprogramMessage;
/**
* 视频
*/
private VideoDto videoDto;
/**
* 消息内容
......
package com.linkwechat.wecom.domain.dto.message;
import lombok.Data;
/**
* @author danmo
* @description 视频
* @date 2021/4/24 16:01
**/
@Data
public class VideoDto {
/**
* 视频素材id
*/
private String media_id;
}
......@@ -27,19 +27,23 @@ public class WeCustomerMessagePushDto {
*/
private TextMessageDto text;
/**
* 附件
*/
private List attachments;
/**
* 图片消息
*/
private ImageMessageDto image;
//private ImageMessageDto image;
/**
* 链接消息
*/
private LinkMessageDto link;
//private LinkMessageDto link;
/**
* 小程序消息
*/
private MiniprogramMessageDto miniprogram;
//private MiniprogramMessageDto miniprogram;
}
package com.linkwechat.wecom.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
......@@ -139,46 +140,46 @@ public class WeCustomerMessageServiceImpl extends ServiceImpl<WeCustomerMessageM
* @param customerMessagePushDto 群发消息
*/
public void childMessage(WeCustomerMessagePushDto weCustomerMessagePushDto, CustomerMessagePushDto customerMessagePushDto) {
List list = new ArrayList();
// 消息类型 0 文本消息 1 图片消息 2 链接消息 3 小程序消息
if (customerMessagePushDto.getMessageType().equals(GroupMessageType.TEXT.getType())) {
weCustomerMessagePushDto.setImage(null);
weCustomerMessagePushDto.setLink(null);
weCustomerMessagePushDto.setMiniprogram(null);
weCustomerMessagePushDto.setText(customerMessagePushDto.getTextMessage());
}
if (customerMessagePushDto.getMessageType().equals(GroupMessageType.IMAGE.getType())) {
weCustomerMessagePushDto.setImage(customerMessagePushDto.getImageMessage());
weCustomerMessagePushDto.setLink(null);
weCustomerMessagePushDto.setMiniprogram(null);
weCustomerMessagePushDto.setText(null);
JSONObject jsonObject = new JSONObject();
jsonObject.put("msgtype","image");
jsonObject.put("image",customerMessagePushDto.getImageMessage());
list.add(jsonObject);
}
if (customerMessagePushDto.getMessageType().equals(GroupMessageType.LINK.getType())) {
weCustomerMessagePushDto.setImage(null);
weCustomerMessagePushDto.setLink(customerMessagePushDto.getLinkMessage());
weCustomerMessagePushDto.setMiniprogram(null);
weCustomerMessagePushDto.setText(null);
JSONObject jsonObject = new JSONObject();
jsonObject.put("msgtype","link");
jsonObject.put("link",customerMessagePushDto.getLinkMessage());
list.add(jsonObject);
}
if (customerMessagePushDto.getMessageType().equals(GroupMessageType.MINIPROGRAM.getType())) {
weCustomerMessagePushDto.setImage(null);
weCustomerMessagePushDto.setLink(null);
weCustomerMessagePushDto.setMiniprogram(customerMessagePushDto.getMiniprogramMessage());
weCustomerMessagePushDto.setText(null);
JSONObject jsonObject = new JSONObject();
jsonObject.put("msgtype","miniprogram");
jsonObject.put("miniprogram",customerMessagePushDto.getMiniprogramMessage());
list.add(jsonObject);
}
if(customerMessagePushDto.getMessageType().equals(GroupMessageType.TEXT_IMAGE.getType())){
weCustomerMessagePushDto.setImage(customerMessagePushDto.getImageMessage());
weCustomerMessagePushDto.setLink(null);
weCustomerMessagePushDto.setMiniprogram(null);
weCustomerMessagePushDto.setText(customerMessagePushDto.getTextMessage());
JSONObject jsonObject = new JSONObject();
jsonObject.put("msgtype","text_image");
jsonObject.put("text_image",customerMessagePushDto.getTextMessage());
list.add(jsonObject);
}
if(customerMessagePushDto.getMessageType().equals(GroupMessageType.VIDEO.getType())){
JSONObject jsonObject = new JSONObject();
jsonObject.put("msgtype","video");
jsonObject.put("video",customerMessagePushDto.getVideoDto());
list.add(jsonObject);
}
weCustomerMessagePushDto.setAttachments(list);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册