Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d84083d9
authored
Apr 24, 2021
by
danmo
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改群发入参
1 parent
8a4d4f9a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
28 deletions
linkwe-common/src/main/java/com/linkwechat/common/enums/GroupMessageType.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/message/CustomerMessagePushDto.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/message/VideoDto.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/message/WeCustomerMessagePushDto.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessageServiceImpl.java
linkwe-common/src/main/java/com/linkwechat/common/enums/GroupMessageType.java
View file @
d84083d
...
...
@@ -33,6 +33,11 @@ public enum GroupMessageType {
*/
TEXT_IMAGE
(
"4"
,
"text_image"
),
/**
* 视频
*/
VIDEO
(
"5"
,
"video"
)
;
/**
* 媒体类型
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/message/CustomerMessagePushDto.java
View file @
d84083d
...
...
@@ -68,6 +68,11 @@ public class CustomerMessagePushDto {
*/
private
MiniprogramMessageDto
miniprogramMessage
;
/**
* 视频
*/
private
VideoDto
videoDto
;
/**
* 消息内容
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/message/VideoDto.java
0 → 100644
View file @
d84083d
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
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/message/WeCustomerMessagePushDto.java
View file @
d84083d
...
...
@@ -28,18 +28,22 @@ 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;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessageServiceImpl.java
View file @
d84083d
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
);
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment