Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
徐少华
midjourney-proxy
Commits
fc7e2e6d
Commit
fc7e2e6d
authored
Aug 12, 2019
by
阮思源
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改下关键词回复
parent
5b8352ef
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
5 deletions
+28
-5
BookKeywordBizImpl.java
...com/pcloud/book/keywords/biz/impl/BookKeywordBizImpl.java
+28
-5
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/BookKeywordBizImpl.java
View file @
fc7e2e6d
...
...
@@ -437,12 +437,24 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
}
final
Set
<
Long
>
cIds
=
Sets
.
newHashSet
();
final
Set
<
Long
>
bIds
=
Sets
.
newHashSet
();
Map
<
Long
,
Long
>
classifyToBookGroupMap
=
new
HashMap
<>();
for
(
JoinGroupCipherDTO
dto
:
dtos
)
{
cIds
.
add
(
dto
.
getClassifyId
());
bIds
.
add
(
dto
.
getBookGroupId
());
classifyToBookGroupMap
.
put
(
dto
.
getClassifyId
(),
dto
.
getBookGroupId
());
}
final
List
<
Long
>
classifyIds
=
Lists
.
newArrayList
(
cIds
);
final
List
<
ReplyKeywordDTO
>
replyKeywordDTOs
=
bookKeywordDao
.
getKeywordIds
(
classifyIds
,
Lists
.
newArrayList
(
bIds
),
content
);
List
<
ReplyKeywordDTO
>
replyKeywordDTOs
=
new
ArrayList
<>();
Map
<
Long
,
Long
>
keywordClassifyIdMap
=
new
HashMap
<>();
for
(
Long
classifyId
:
classifyIds
)
{
//获取匹配关键词
ReplyKeywordDTO
replyKeywordDTO
=
bookKeywordDao
.
getKeywordId
(
classifyId
,
classifyToBookGroupMap
.
get
(
classifyId
),
content
);
if
(
replyKeywordDTO
==
null
)
{
continue
;
}
keywordClassifyIdMap
.
put
(
replyKeywordDTO
.
getKeywordId
(),
classifyId
);
replyKeywordDTOs
.
add
(
replyKeywordDTO
);
}
final
List
<
GroupClassifyQrcodeDTO
>
qrcodeDTOS
=
bookGroupClassifyBiz
.
listClassifyQrcodeInfo
(
classifyIds
);
if
(
CollectionUtils
.
isEmpty
(
replyKeywordDTOs
))
{
log
.
info
(
"[关键词消息回复] keywordIds is null"
);
...
...
@@ -457,15 +469,19 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
for
(
ReplyKeywordDTO
replyKeywordDTO
:
replyKeywordDTOs
)
{
log
.
info
(
"[关键词回复原始数据] : sendKeywordMessage replyKeywordDTO :{}, robotId:{}, weixinGroupId:{}"
,
replyKeywordDTO
,
robotId
,
weixinGroupId
);
// 处理链接地址
final
GroupClassifyQrcodeDTO
dto
=
classifyMap
.
get
(
replyKeywordDTO
.
getClassifyId
());
Long
classifyId
=
keywordClassifyIdMap
.
get
(
replyKeywordDTO
.
getKeywordId
());
final
GroupClassifyQrcodeDTO
dto
=
classifyMap
.
get
(
classifyId
);
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
replyKeywordDTO
.
getReplyType
())
||
ReplyTypeEnum
.
LINK
.
value
.
equals
(
replyKeywordDTO
.
getReplyType
()))
{
if
(
null
==
dto
)
{
log
.
info
(
"[关键词消息回复] 分类信息为空 replyKeywordDTO:{}; classifyMap:{}"
,
replyKeywordDTO
,
classifyMap
);
continue
;
}
AccountSettingDto
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
dto
.
getChannelId
());
String
linkUrl
=
SendWeixinRequestTools
.
splitUrlNew
(
accountSettingDto
,
replyKeywordDTO
.
getLinkUrl
(),
replyKeywordDTO
.
getBookGroupId
(),
replyKeywordDTO
.
getClassifyId
(),
null
);
String
linkUrl
=
SendWeixinRequestTools
.
splitUrlNew
(
accountSettingDto
,
replyKeywordDTO
.
getLinkUrl
(),
dto
.
getBookGroupId
(),
dto
.
getClassifyId
(),
null
);
replyKeywordDTO
.
setLinkUrl
(
linkUrl
);
if
(!
StringUtil
.
isEmpty
(
linkUrl
))
{
replyKeywordDTO
.
setShortLinkUrl
(
UrlUtils
.
getShortUrl4Own
(
linkUrl
));
}
}
String
redisContent
=
JedisClusterUtils
.
getJson
(
"BOOK:KEYWORD:"
+
weixinGroupId
+
"-"
+
replyKeywordDTO
.
getKeywordId
(),
String
.
class
);
// 同一群10秒内不回复同一关键词
...
...
@@ -486,11 +502,18 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
if
(
replyKeywordDTOs
.
size
()
<=
1
)
{
SendWeixinRequestTools
.
sendKeywordMessage
(
replyKeywordDTOs
.
get
(
0
),
robotId
,
weixinGroupId
,
ip
,
code
);
}
else
{
// 多条时组装成一条发送
// 多条时
文字,应用,链接
组装成一条发送
ReplyKeywordDTO
d
=
new
ReplyKeywordDTO
();
final
StringBuilder
sb
=
new
StringBuilder
();
for
(
ReplyKeywordDTO
dto
:
replyKeywordDTOs
)
{
sb
.
append
(
dto
.
getContent
()).
append
(
":"
).
append
(
dto
.
getShortLinkUrl
()).
append
(
"\n"
);
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
dto
.
getReplyType
())
||
ReplyTypeEnum
.
LINK
.
value
.
equals
(
dto
.
getReplyType
()))
{
sb
.
append
(
dto
.
getKeywords
()).
append
(
":"
).
append
(
dto
.
getShortLinkUrl
()).
append
(
"\n"
);
}
else
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
dto
.
getReplyType
())){
sb
.
append
(
dto
.
getKeywords
()).
append
(
":"
).
append
(
dto
.
getContent
()).
append
(
"\n"
);
}
else
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
dto
.
getReplyType
()))
{
SendWeixinRequestTools
.
sendKeywordMessage
(
d
,
robotId
,
weixinGroupId
,
ip
,
code
);
continue
;
}
}
d
.
setContent
(
sb
.
toString
());
d
.
setReplyType
(
ReplyTypeEnum
.
TEXT
.
value
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment