|
@@ -728,10 +728,14 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
|
//文本
|
|
|
TencentRequest.MessageBody body1 = CustomerServiceBatchSendingServiceImpl.getTimTextElem(jsonObject.getString("content"));
|
|
|
list.add(body1);
|
|
|
- } else if (i.getClassname().equals("RC:ImgMsg") || i.getClassname().equals("RC:GIFMsg")) {
|
|
|
- //图片 GIf
|
|
|
+ } else if (i.getClassname().equals("RC:ImgMsg")) {
|
|
|
+ //图片
|
|
|
TencentRequest.MessageBody body1 = CustomerServiceBatchSendingServiceImpl.getTimImageElem(jsonObject.getString("imageUri"));
|
|
|
list.add(body1);
|
|
|
+ } else if (i.getClassname().equals("RC:GIFMsg")) {
|
|
|
+ //GIf
|
|
|
+ TencentRequest.MessageBody body1 = CustomerServiceBatchSendingServiceImpl.getTimImageElem(jsonObject.getString("remoteUrl"));
|
|
|
+ list.add(body1);
|
|
|
} else if (i.getClassname().equals("RC:HQVCMsg")){
|
|
|
//语音
|
|
|
String remoteUrl = jsonObject.getString("remoteUrl");
|
|
@@ -845,10 +849,18 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
|
//文本
|
|
|
TencentRequest.MessageBody body1 = CustomerServiceBatchSendingServiceImpl.getTimTextElem(jsonObject.getString("content"));
|
|
|
bodyList.add(body1);
|
|
|
- } else if (i.getClassname().equals("RC:ImgMsg") || i.getClassname().equals("RC:GIFMsg")) {
|
|
|
+ } else if (i.getClassname().equals("RC:ImgMsg")) {
|
|
|
//图片 GIf
|
|
|
TencentRequest.MessageBody body1 = CustomerServiceBatchSendingServiceImpl.getTimImageElem(jsonObject.getString("imageUri"));
|
|
|
bodyList.add(body1);
|
|
|
+ } else if (i.getClassname().equals("RC:GIFMsg")) {
|
|
|
+ //GIf
|
|
|
+ String remoteUrl = jsonObject.getString("remoteUrl");
|
|
|
+ int gifDataSize = jsonObject.getInteger("gifDataSize");
|
|
|
+ int width = jsonObject.getInteger("width");
|
|
|
+ int height = jsonObject.getInteger("height");
|
|
|
+ TencentRequest.MessageBody body1 = getTimGifElem(remoteUrl,gifDataSize,width,height);
|
|
|
+ bodyList.add(body1);
|
|
|
} else if (i.getClassname().equals("RC:HQVCMsg")){
|
|
|
//语音
|
|
|
String remoteUrl = jsonObject.getString("remoteUrl");
|
|
@@ -922,6 +934,44 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ private TencentRequest.MessageBody getTimGifElem(String remoteUr,int size,int width,int height) {
|
|
|
+ if (StringUtils.isEmpty(remoteUr) && size == 0 && width == 0 && height == 0) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 腾讯云消息
|
|
|
+ // 腾讯云消息
|
|
|
+ ImageUtil.ImageInfo imageReq = ImageUtil.ImageInfo.builder()
|
|
|
+ .imgUrl(remoteUr)
|
|
|
+ .suffix(remoteUr.substring(remoteUr.lastIndexOf(".") + 1))
|
|
|
+ .build();
|
|
|
+
|
|
|
+ // 获取图片基本信息
|
|
|
+ ImageUtil.imageToBase64(imageReq);
|
|
|
+
|
|
|
+ // 图片格式。 JPG = 1 GIF = 2 PNG = 3 BMP = 4 其他 = 255
|
|
|
+ // 图片类型。原图 = 1,大图 = 2,缩略图 = 3
|
|
|
+ int imageFormat = 1;
|
|
|
+ if ("PNG".equalsIgnoreCase(imageReq.getSuffix())) {
|
|
|
+ imageFormat = 3;
|
|
|
+ }
|
|
|
+ if ("GIF".equalsIgnoreCase(imageReq.getSuffix())) {
|
|
|
+ imageFormat = 2;
|
|
|
+ }
|
|
|
+ return TencentRequest.MessageBody.builder()
|
|
|
+ .msgType("TIMImageElem")
|
|
|
+ .msgContent(TencentRequest.ImageMessageBody.builder()
|
|
|
+ .uuid(imageReq.getMd5())
|
|
|
+ .imageFormat(imageFormat)
|
|
|
+ .type(1)
|
|
|
+ .height(height)
|
|
|
+ .width(width)
|
|
|
+ .url(remoteUr)
|
|
|
+ .size(imageReq.getSize()).build())
|
|
|
+ .build();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
//构建合并转发请求体
|
|
|
private TencentRequest.MessageBody getTimRelayElem() {
|
|
|
ImHistoryMessageWrapper.TimRelayElem timRelayElem = new ImHistoryMessageWrapper.TimRelayElem();
|