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
7178fbbd
Commit
7178fbbd
authored
Sep 16, 2019
by
裴大威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat 1001695 微信群关键词多于x时加推关键词列表
parent
2f5076af
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
17 deletions
+25
-17
SendWeixinRequestTools.java
...a/com/pcloud/book/group/tools/SendWeixinRequestTools.java
+19
-12
BookGuideBizImpl.java
...a/com/pcloud/book/keywords/biz/impl/BookGuideBizImpl.java
+1
-1
BookKeywordBizImpl.java
...com/pcloud/book/keywords/biz/impl/BookKeywordBizImpl.java
+4
-3
BookKeyword.Mapper.xml
...src/main/resources/mapper/keywords/BookKeyword.Mapper.xml
+1
-1
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/group/tools/SendWeixinRequestTools.java
View file @
7178fbbd
...
@@ -140,14 +140,6 @@ public class SendWeixinRequestTools {
...
@@ -140,14 +140,6 @@ public class SendWeixinRequestTools {
if
(
ListUtils
.
isEmpty
(
replyMessages
))
{
if
(
ListUtils
.
isEmpty
(
replyMessages
))
{
return
;
return
;
}
}
StringBuilder
sb
=
new
StringBuilder
();
if
(!
CollectionUtils
.
isEmpty
(
keywords
)
&&
isGroupRobot
)
{
sb
.
append
(
"\n\n在群内回复以下关键词,领取任务或资源:\n"
);
for
(
KeywordDTO
keyword
:
keywords
)
{
sb
.
append
(
"【"
).
append
(
keyword
.
getKeywords
()).
append
(
"】 "
);
}
}
StringBuilder
groupKeyword
=
getGroupKeyword
(
dto
,
sb
);
int
i
=
0
;
int
i
=
0
;
for
(
ReplyMessageVO
replyMessageVO
:
replyMessages
)
{
for
(
ReplyMessageVO
replyMessageVO
:
replyMessages
)
{
SendMessageDTO
sendMessageDTO
=
new
SendMessageDTO
();
SendMessageDTO
sendMessageDTO
=
new
SendMessageDTO
();
...
@@ -158,6 +150,18 @@ public class SendWeixinRequestTools {
...
@@ -158,6 +150,18 @@ public class SendWeixinRequestTools {
if
(
StringUtils
.
isNotEmpty
(
nickNameStr
))
{
if
(
StringUtils
.
isNotEmpty
(
nickNameStr
))
{
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
String
s
=
nickNameStr
+
" "
+
sendMessageDTO
.
getContent
();
String
s
=
nickNameStr
+
" "
+
sendMessageDTO
.
getContent
();
StringBuilder
sb
=
new
StringBuilder
();
if
(!
CollectionUtils
.
isEmpty
(
keywords
)
&&
isGroupRobot
)
{
sb
.
append
(
"\n\n在群内回复以下关键词,领取任务或资源:\n"
);
for
(
KeywordDTO
keyword
:
keywords
)
{
// 关键词长度和欢迎语长度之和超过300会拆分成两条,若拆分之后关键词长度还是大于300则只发300以内的部分
if
((
s
.
length
()
+
sb
.
length
())
>=
300
&&
(
sb
.
length
()
+
(
keyword
.
getKeywords
()
+
"\n"
).
length
())
>=
277
)
{
break
;
}
sb
.
append
(
"【"
).
append
(
keyword
.
getKeywords
()).
append
(
"】"
);
}
}
StringBuilder
groupKeyword
=
getGroupKeyword
(
dto
,
sb
);
// 1001692 自定义欢迎语+关键词文案,如果超过300字,关键词拆分出来发
// 1001692 自定义欢迎语+关键词文案,如果超过300字,关键词拆分出来发
if
(
s
.
length
()
+
groupKeyword
.
length
()
>=
300
)
{
if
(
s
.
length
()
+
groupKeyword
.
length
()
>=
300
)
{
sendMessageDTO
.
setContent
(
s
);
sendMessageDTO
.
setContent
(
s
);
...
@@ -381,7 +385,10 @@ public class SendWeixinRequestTools {
...
@@ -381,7 +385,10 @@ public class SendWeixinRequestTools {
if
(!
CollectionUtils
.
isEmpty
(
keywords
)
&&
isGroupRobot
)
{
if
(!
CollectionUtils
.
isEmpty
(
keywords
)
&&
isGroupRobot
)
{
sb
.
append
(
"\n\n在群内回复以下关键词,领取任务或资源:\n"
);
sb
.
append
(
"\n\n在群内回复以下关键词,领取任务或资源:\n"
);
for
(
KeywordDTO
keyword
:
keywords
)
{
for
(
KeywordDTO
keyword
:
keywords
)
{
sb
.
append
(
"【"
).
append
(
keyword
.
getKeywords
()).
append
(
"】 "
);
if
((
content
.
length
()
+
sb
.
length
())
>=
300
&&
(
sb
.
length
()
+
(
keyword
.
getKeywords
()
+
"\n"
).
length
())
>=
277
)
{
break
;
}
sb
.
append
(
"【"
).
append
(
keyword
.
getKeywords
()).
append
(
"】"
);
}
}
}
}
StringBuilder
groupKeyword
=
getGroupKeyword
(
dto
,
sb
);
StringBuilder
groupKeyword
=
getGroupKeyword
(
dto
,
sb
);
...
@@ -399,13 +406,13 @@ public class SendWeixinRequestTools {
...
@@ -399,13 +406,13 @@ public class SendWeixinRequestTools {
sb
.
append
(
"\n\n在群内回复以下关键词:\n"
);
sb
.
append
(
"\n\n在群内回复以下关键词:\n"
);
}
}
if
(
dto
.
getReportOpen
())
{
if
(
dto
.
getReportOpen
())
{
sb
.
append
(
"【学习报告】
"
);
sb
.
append
(
"【学习报告】"
);
}
}
if
(
dto
.
getRiddleOpen
())
{
if
(
dto
.
getRiddleOpen
())
{
sb
.
append
(
"【猜谜语】
"
);
sb
.
append
(
"【猜谜语】"
);
}
}
if
(
dto
.
getClockOpen
())
{
if
(
dto
.
getClockOpen
())
{
sb
.
append
(
"【"
).
append
(
dto
.
getClockKeyword
()).
append
(
"】
"
);
sb
.
append
(
"【"
).
append
(
dto
.
getClockKeyword
()).
append
(
"】"
);
}
}
return
sb
;
return
sb
;
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/BookGuideBizImpl.java
View file @
7178fbbd
...
@@ -368,7 +368,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -368,7 +368,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
}
}
//获取公众号基本信息
//获取公众号基本信息
AccountSettingDto
wechatInfo
=
qrcodeSceneConsr
.
getWechatInfo
(
classifyQrcodeInfo
.
getChannelId
());
AccountSettingDto
wechatInfo
=
qrcodeSceneConsr
.
getWechatInfo
(
classifyQrcodeInfo
.
getChannelId
());
//获取关键词信息(改成10个了) 刘娜需求 1001282 群不推送关键词
//获取关键词信息(改成10个了
,20190911周磊改成不限制了,但是开发要求必须要加限制,所以先限制40个
) 刘娜需求 1001282 群不推送关键词
List
<
KeywordDTO
>
keywords
=
bookKeywordBiz
.
listFiveKeyword
(
classifyQrcodeInfo
.
getClassifyId
(),
classifyQrcodeInfo
.
getBookGroupId
());
List
<
KeywordDTO
>
keywords
=
bookKeywordBiz
.
listFiveKeyword
(
classifyQrcodeInfo
.
getClassifyId
(),
classifyQrcodeInfo
.
getBookGroupId
());
Boolean
isHaveKeywords
=
!
ListUtils
.
isEmpty
(
keywords
);
Boolean
isHaveKeywords
=
!
ListUtils
.
isEmpty
(
keywords
);
final
Boolean
groupRobot
=
wechatGroupConsr
.
isGroupRobot
(
robotId
);
final
Boolean
groupRobot
=
wechatGroupConsr
.
isGroupRobot
(
robotId
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/BookKeywordBizImpl.java
View file @
7178fbbd
...
@@ -430,7 +430,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -430,7 +430,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
}
}
@Override
@Override
@ParamLog
(
"获取5个关键词(改成10个了)"
)
@ParamLog
(
"获取5个关键词(改成10个了
,20190911周磊改成不限制了,但是开发要求必须要加限制,所以先限制40个
)"
)
public
List
<
KeywordDTO
>
listFiveKeyword
(
Long
classifyId
,
Long
bookGroupId
)
{
public
List
<
KeywordDTO
>
listFiveKeyword
(
Long
classifyId
,
Long
bookGroupId
)
{
//获取是否单独设置关键词
//获取是否单独设置关键词
List
<
KeywordDTO
>
keywords
=
bookKeywordDao
.
listFiveKeyword
(
classifyId
,
bookGroupId
);
List
<
KeywordDTO
>
keywords
=
bookKeywordDao
.
listFiveKeyword
(
classifyId
,
bookGroupId
);
...
@@ -569,7 +569,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -569,7 +569,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
log
.
info
(
"[关键词消息回复] redisContent:{} insertBookKeywordRecord return"
,
redisContent
);
log
.
info
(
"[关键词消息回复] redisContent:{} insertBookKeywordRecord return"
,
redisContent
);
return
true
;
return
true
;
}
else
{
}
else
{
JedisClusterUtils
.
setJson
(
"BOOK:KEYWORD:"
+
weixinGroupId
+
"-"
+
replyKeywordDTO
.
getKeywordId
(),
replyKeywordDTO
.
getKeywordId
(),
30
);
// 60s不回复同一关键词 20190916降低消息量方案之一
JedisClusterUtils
.
setJson
(
"BOOK:KEYWORD:"
+
weixinGroupId
+
"-"
+
replyKeywordDTO
.
getKeywordId
(),
replyKeywordDTO
.
getKeywordId
(),
60
);
insertBookKeywordRecord
(
dto
,
replyKeywordDTO
.
getKeywordId
(),
userWxId
,
weixinGroupId
,
true
);
insertBookKeywordRecord
(
dto
,
replyKeywordDTO
.
getKeywordId
(),
userWxId
,
weixinGroupId
,
true
);
}
}
return
false
;
return
false
;
...
@@ -627,7 +628,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -627,7 +628,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
replyKeywordDTO
.
setLinkUrl
(
linkUrl
);
replyKeywordDTO
.
setLinkUrl
(
linkUrl
);
}
}
String
redisContent
=
JedisClusterUtils
.
getJson
(
"BOOK:KEYWORD:"
+
weixinGroupId
+
"-"
+
replyKeywordDTO
.
getKeywordId
(),
String
.
class
);
String
redisContent
=
JedisClusterUtils
.
getJson
(
"BOOK:KEYWORD:"
+
weixinGroupId
+
"-"
+
replyKeywordDTO
.
getKeywordId
(),
String
.
class
);
// 同一群10秒内不回复同一关键词
// 同一群10秒内不回复同一关键词
,60s不回复同一关键词 20190916降低消息量方案之一
if
(
insertBookKeywordRecord
(
weixinGroupId
,
userWxId
,
replyKeywordDTO
,
classifyQrcodeInfo
,
redisContent
))
{
if
(
insertBookKeywordRecord
(
weixinGroupId
,
userWxId
,
replyKeywordDTO
,
classifyQrcodeInfo
,
redisContent
))
{
return
;
return
;
}
}
...
...
pcloud-service-book/src/main/resources/mapper/keywords/BookKeyword.Mapper.xml
View file @
7178fbbd
...
@@ -149,7 +149,7 @@
...
@@ -149,7 +149,7 @@
AND
AND
k.is_delete = 0
k.is_delete = 0
AND classify_id = #{classifyId}
AND classify_id = #{classifyId}
AND book_group_id = #{bookGroupId} order by bk.rank, bk.id desc limit
1
0
AND book_group_id = #{bookGroupId} order by bk.rank, bk.id desc limit
4
0
</select>
</select>
<select
id=
"getKeywordId"
resultType=
"ReplyKeywordDTO"
parameterType=
"map"
>
<select
id=
"getKeywordId"
resultType=
"ReplyKeywordDTO"
parameterType=
"map"
>
...
...
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