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
1ffad909
Commit
1ffad909
authored
Sep 05, 2019
by
裴大威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat edit msg frequency
parent
3242cb51
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
54 deletions
+46
-54
SendWeixinRequestTools.java
...a/com/pcloud/book/group/tools/SendWeixinRequestTools.java
+43
-22
BookGuideBizImpl.java
...a/com/pcloud/book/keywords/biz/impl/BookGuideBizImpl.java
+2
-31
BookKeywordBizImpl.java
...com/pcloud/book/keywords/biz/impl/BookKeywordBizImpl.java
+1
-1
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/group/tools/SendWeixinRequestTools.java
View file @
1ffad909
...
...
@@ -25,6 +25,7 @@ import com.sdk.wxgroup.WxGroupSDK;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
...
...
@@ -133,11 +134,19 @@ public class SendWeixinRequestTools {
}
@ParamLog
(
"发送欢迎语消息"
)
public
static
void
sendGuideMessage
(
List
<
ReplyMessageVO
>
replyMessages
,
String
robotId
,
String
weixinGroupId
,
String
ip
,
Integer
code
)
{
public
static
void
sendGuideMessage
(
List
<
ReplyMessageVO
>
replyMessages
,
String
robotId
,
String
weixinGroupId
,
Boolean
isGroupRobot
,
List
<
KeywordDTO
>
keywords
,
String
ip
,
Integer
code
)
{
//JedisClusterUtils.del("BOOK:WEIXINGROUP:GUIDEUSER" + weixinGroupId);
if
(
ListUtils
.
isEmpty
(
replyMessages
))
{
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
(
"】 "
);
}
sb
.
append
(
",领取任务或资源"
);
}
int
i
=
0
;
for
(
ReplyMessageVO
replyMessageVO
:
replyMessages
)
{
SendMessageDTO
sendMessageDTO
=
new
SendMessageDTO
();
...
...
@@ -147,9 +156,14 @@ public class SendWeixinRequestTools {
LOGGER
.
info
(
"发送欢迎语"
+
nickNameStr
);
if
(
StringUtils
.
isNotEmpty
(
nickNameStr
))
{
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
sendMessageDTO
.
setContent
(
nickNameStr
+
" "
+
sendMessageDTO
.
getContent
());
sendMessageDTO
.
setContent
(
nickNameStr
+
" "
+
sendMessageDTO
.
getContent
()
+
sb
.
toString
()
);
}
else
{
sendAtMessage
(
nickNameStr
,
robotId
,
weixinGroupId
,
ip
);
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
nickNameStr
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setWxGroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
}
}
...
...
@@ -191,16 +205,16 @@ public class SendWeixinRequestTools {
}
}
private
static
void
sendAtMessage
(
String
nickNameStr
,
String
robotId
,
String
weixinGroupId
,
String
ip
){
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
nickNameStr
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setWxGroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
//
private static void sendAtMessage(String nickNameStr,String robotId,String weixinGroupId, String ip){
//
//
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
//
sendTextMessageVO.setContent(nickNameStr);
//
sendTextMessageVO.setAltId(robotId);
//
sendTextMessageVO.setWxGroupId(weixinGroupId);
//
sendTextMessageVO.setIp(ip);
//
WxGroupSDK.sendTextMessage(sendTextMessageVO);
//
//
}
private
static
String
addLinkParam
(
String
url
,
Long
groupQrcodeId
,
Long
classifyId
,
Long
bookGroupId
)
{
if
(
StringUtil
.
isEmpty
(
url
))
{
...
...
@@ -340,21 +354,28 @@ public class SendWeixinRequestTools {
// WxGroupSDK.sendTextMessage(sendTextMessageVO);
}
public
static
void
sendDefaultMessage
(
String
groupName
,
String
robotId
,
String
weixinGroupId
,
Boolean
isHaveKeywords
,
String
ip
)
{
String
content
=
getNickNameStr
(
weixinGroupId
);
public
static
void
sendDefaultMessage
(
String
groupName
,
String
robotId
,
String
weixinGroupId
,
Boolean
isHaveKeywords
,
Boolean
isGroupRobot
,
List
<
KeywordDTO
>
keywords
,
String
ip
)
{
String
Builder
content
=
new
StringBuilder
(
getNickNameStr
(
weixinGroupId
)
);
if
(
StringUtil
.
isEmpty
(
groupName
))
{
content
+=
" 欢迎加入本群!"
;
content
.
append
(
" 欢迎加入本群!"
)
;
}
else
{
content
+=
" 欢迎加入"
+
groupName
+
"!"
;
content
.
append
(
" 欢迎加入"
).
append
(
groupName
).
append
(
"!"
)
;
}
if
(
isHaveKeywords
){
content
=
content
+
"本群目的为学习交流和学习辅导,线上资源和工具为图书的增值服务,可根据实际情况配合图书一起使用。在群内回复以下关键词领取任务或资源:"
;
// content = content + "本群目的为学习交流和学习辅导,线上资源和工具为图书的增值服务,可根据实际情况配合图书一起使用。在群内回复以下关键词领取任务或资源:";
content
.
append
(
"本群目的为学习交流和学习辅导,线上资源和工具为图书的增值服务,可根据实际情况配合图书一起使用。\n\n在群内回复以下关键词:\n"
);
}
sendTextMessage
(
content
,
robotId
,
weixinGroupId
,
ip
);
if
(!
CollectionUtils
.
isEmpty
(
keywords
)
&&
isGroupRobot
)
{
for
(
KeywordDTO
keyword
:
keywords
)
{
content
.
append
(
"【"
).
append
(
keyword
.
getKeywords
()).
append
(
"】 "
);
}
}
content
.
append
(
",领取任务或资源"
);
sendTextMessage
(
content
.
toString
(),
robotId
,
weixinGroupId
,
ip
);
}
private
static
String
getNickNameStr
(
String
weixinGroupId
)
{
String
nameStr
=
""
;
String
Builder
nameStr
=
new
StringBuilder
()
;
Map
<
String
,
Integer
>
nickNames
=
JedisClusterUtils
.
getJson
(
"BOOK:WEIXINGROUP:GUIDEUSER"
+
weixinGroupId
,
Map
.
class
);
int
i
=
0
;
List
<
String
>
names
=
new
ArrayList
<>();
...
...
@@ -371,11 +392,11 @@ public class SendWeixinRequestTools {
for
(
String
nickName
:
names
)
{
nickNames
.
remove
(
nickName
);
if
(
StringUtils
.
isNotEmpty
(
nickName
))
{
nameStr
=
nameStr
+
"@"
+
nickName
+
" "
;
nameStr
.
append
(
"@"
).
append
(
nickName
).
append
(
" "
)
;
}
}
JedisClusterUtils
.
setJson
(
"BOOK:WEIXINGROUP:GUIDEUSER"
+
weixinGroupId
,
nickNames
,
600
);
return
nameStr
;
return
nameStr
.
toString
()
;
}
@ParamLog
(
"欢迎语中推送关键词信息"
)
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/BookGuideBizImpl.java
View file @
1ffad909
...
...
@@ -376,50 +376,21 @@ public class BookGuideBizImpl implements BookGuideBiz {
GroupQrcodeBaseInfoVO
groupInfo
=
groupQrcodeBiz
.
getBaseById
(
classifyQrcodeInfo
.
getGroupQrcodeId
());
//推送消息 刘娜需求 1001282 群不推送关键词
// 若非之前的机器人则不回复普通关键词
SendWeixinRequestTools
.
sendDefaultMessage
(
groupInfo
==
null
?
""
:
groupInfo
.
getGroupName
(),
robotId
,
weixinGroupId
,
isHaveKeywords
,
pushAddUserMessageDTO
.
getIp
());
SendWeixinRequestTools
.
sendDefaultMessage
(
groupInfo
==
null
?
""
:
groupInfo
.
getGroupName
(),
robotId
,
weixinGroupId
,
isHaveKeywords
,
groupRobot
,
keywords
,
pushAddUserMessageDTO
.
getIp
());
}
else
{
//处理链接
handleUrl
(
replyMessages
,
wechatInfo
,
classifyQrcodeInfo
);
//推送消息
SendWeixinRequestTools
.
sendGuideMessage
(
replyMessages
,
robotId
,
weixinGroupId
,
pushAddUserMessageDTO
.
getIp
(),
SendMessageTypeEnum
.
GROUP
.
getCode
());
SendWeixinRequestTools
.
sendGuideMessage
(
replyMessages
,
robotId
,
weixinGroupId
,
groupRobot
,
keywords
,
pushAddUserMessageDTO
.
getIp
(),
SendMessageTypeEnum
.
GROUP
.
getCode
());
//新增欢迎语应用触发记录
addGuideAppTouchRecord
(
replyMessages
,
weixinGroupId
,
classifyQrcodeInfo
.
getBookGroupId
(),
classifyQrcodeInfo
.
getClassifyId
());
}
//获取关键词信息(改成10个了)刘娜需求 1001282 群不推送关键词
if
(
groupRobot
)
{
SendWeixinRequestTools
.
sendKeywordsInfo
(
keywords
,
robotId
,
weixinGroupId
,
pushAddUserMessageDTO
.
getIp
());
}
//如果设置了群学习报告,加一个群学习报告的关键词
pushLearningReport
(
classifyQrcodeInfo
,
robotId
,
weixinGroupId
,
pushAddUserMessageDTO
.
getIp
());
if
(
bookGuide
!=
null
&&
bookGuide
.
getIsRecommend
()
!=
null
&&
bookGuide
.
getIsRecommend
()
==
1
)
{
//推送公众号消息
SendWeixinRequestTools
.
sendAccountMessage
(
weixinGroupId
,
bookGuide
.
getRecommendLanguage
(),
robotId
,
wechatInfo
,
pushAddUserMessageDTO
.
getIp
());
}
//校验该群是否与微信群打卡有关
/*List<Long> bookClockInfoIdList = bookClockCheck.checkGroupIsClock(classifyQrcodeInfo);
if(!ListUtils.isEmpty(bookClockInfoIdList)){
Map<String,Object> paramMap = new HashMap<>();
int i = 0;
List<BookClockKeywordDTO> bookClockKeywordDTOList = new ArrayList<>();
for (Long bookClockInfoId:bookClockInfoIdList) {
i++;
if(i >= 5){
break;
}
paramMap.put("bookClockInfoId",bookClockInfoId);
List<BookClockKeywordDTO> bookClockKeywordDTOS = bookClockKeywordDao.getKeywordsByInfoId(paramMap);
bookClockKeywordDTOList.addAll(bookClockKeywordDTOS);
if(i%2 == 0){
log.info("欢迎语中推送关键词信息,bookClockKeywordDTOList="+bookClockKeywordDTOList);
SendWeixinRequestTools.sendClockKeywordsInfo(bookClockKeywordDTOList, robotId, weixinGroupId, pushAddUserMessageDTO.getIp());
bookClockKeywordDTOList.clear();
}else if(i == bookClockInfoIdList.size()){
SendWeixinRequestTools.sendClockKeywordsInfo(bookClockKeywordDTOList, robotId, weixinGroupId, pushAddUserMessageDTO.getIp());
bookClockKeywordDTOList.clear();
}
}
}*/
}
@ParamLog
(
"推关学习报告/猜谜语关键词消息"
)
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/BookKeywordBizImpl.java
View file @
1ffad909
...
...
@@ -545,7 +545,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
log
.
info
(
"[关键词消息回复] redisContent:{} insertBookKeywordRecord return"
,
redisContent
);
return
true
;
}
else
{
JedisClusterUtils
.
setJson
(
"BOOK:KEYWORD:"
+
weixinGroupId
+
"-"
+
replyKeywordDTO
.
getKeywordId
(),
replyKeywordDTO
.
getKeywordId
(),
1
0
);
JedisClusterUtils
.
setJson
(
"BOOK:KEYWORD:"
+
weixinGroupId
+
"-"
+
replyKeywordDTO
.
getKeywordId
(),
replyKeywordDTO
.
getKeywordId
(),
3
0
);
insertBookKeywordRecord
(
dto
,
replyKeywordDTO
.
getKeywordId
(),
userWxId
,
weixinGroupId
,
true
);
}
return
false
;
...
...
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