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
3431424d
Commit
3431424d
authored
Sep 05, 2019
by
裴大威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat edit operation keyword in guide
parent
1ffad909
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
31 deletions
+81
-31
SendWeixinRequestTools.java
...a/com/pcloud/book/group/tools/SendWeixinRequestTools.java
+23
-6
BookGuideBizImpl.java
...a/com/pcloud/book/keywords/biz/impl/BookGuideBizImpl.java
+32
-25
KeywordStatusDTO.java
...n/java/com/pcloud/book/keywords/dto/KeywordStatusDTO.java
+26
-0
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/group/tools/SendWeixinRequestTools.java
View file @
3431424d
...
...
@@ -4,6 +4,7 @@ import com.pcloud.book.clock.dto.BookClockKeywordDTO;
import
com.pcloud.book.group.dto.SyncWeixinGroupIdRequestDTO
;
import
com.pcloud.book.group.dto.UpdateQrDTO
;
import
com.pcloud.book.keywords.dto.KeywordDTO
;
import
com.pcloud.book.keywords.dto.KeywordStatusDTO
;
import
com.pcloud.book.keywords.dto.ReplyKeywordDTO
;
import
com.pcloud.book.keywords.dto.SendMessageDTO
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
...
...
@@ -134,7 +135,7 @@ public class SendWeixinRequestTools {
}
@ParamLog
(
"发送欢迎语消息"
)
public
static
void
sendGuideMessage
(
List
<
ReplyMessageVO
>
replyMessages
,
String
robotId
,
String
weixinGroupId
,
Boolean
isGroupRobot
,
List
<
KeywordDTO
>
keywords
,
String
ip
,
Integer
code
)
{
public
static
void
sendGuideMessage
(
List
<
ReplyMessageVO
>
replyMessages
,
String
robotId
,
String
weixinGroupId
,
Boolean
isGroupRobot
,
List
<
KeywordDTO
>
keywords
,
KeywordStatusDTO
dto
,
String
ip
,
Integer
code
)
{
//JedisClusterUtils.del("BOOK:WEIXINGROUP:GUIDEUSER" + weixinGroupId);
if
(
ListUtils
.
isEmpty
(
replyMessages
))
{
return
;
...
...
@@ -145,8 +146,8 @@ public class SendWeixinRequestTools {
for
(
KeywordDTO
keyword
:
keywords
)
{
sb
.
append
(
"【"
).
append
(
keyword
.
getKeywords
()).
append
(
"】 "
);
}
sb
.
append
(
",领取任务或资源"
);
}
StringBuilder
groupKeyword
=
getGroupKeyword
(
dto
,
sb
);
int
i
=
0
;
for
(
ReplyMessageVO
replyMessageVO
:
replyMessages
)
{
SendMessageDTO
sendMessageDTO
=
new
SendMessageDTO
();
...
...
@@ -156,7 +157,7 @@ public class SendWeixinRequestTools {
LOGGER
.
info
(
"发送欢迎语"
+
nickNameStr
);
if
(
StringUtils
.
isNotEmpty
(
nickNameStr
))
{
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
sendMessageDTO
.
setContent
(
nickNameStr
+
" "
+
sendMessageDTO
.
getContent
()
+
sb
.
toString
());
sendMessageDTO
.
setContent
(
nickNameStr
+
" "
+
sendMessageDTO
.
getContent
()
+
groupKeyword
.
toString
());
}
else
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
nickNameStr
);
...
...
@@ -354,7 +355,7 @@ public class SendWeixinRequestTools {
// WxGroupSDK.sendTextMessage(sendTextMessageVO);
}
public
static
void
sendDefaultMessage
(
String
groupName
,
String
robotId
,
String
weixinGroupId
,
Boolean
isHaveKeywords
,
Boolean
isGroupRobot
,
List
<
KeywordDTO
>
keywords
,
String
ip
)
{
public
static
void
sendDefaultMessage
(
String
groupName
,
String
robotId
,
String
weixinGroupId
,
Boolean
isHaveKeywords
,
Boolean
isGroupRobot
,
List
<
KeywordDTO
>
keywords
,
KeywordStatusDTO
dto
,
String
ip
)
{
StringBuilder
content
=
new
StringBuilder
(
getNickNameStr
(
weixinGroupId
));
if
(
StringUtil
.
isEmpty
(
groupName
))
{
content
.
append
(
" 欢迎加入本群!"
);
...
...
@@ -370,8 +371,24 @@ public class SendWeixinRequestTools {
content
.
append
(
"【"
).
append
(
keyword
.
getKeywords
()).
append
(
"】 "
);
}
}
content
.
append
(
",领取任务或资源"
);
sendTextMessage
(
content
.
toString
(),
robotId
,
weixinGroupId
,
ip
);
StringBuilder
groupKeyword
=
getGroupKeyword
(
dto
,
content
);
sendTextMessage
(
groupKeyword
.
toString
(),
robotId
,
weixinGroupId
,
ip
);
}
private
static
StringBuilder
getGroupKeyword
(
KeywordStatusDTO
dto
,
StringBuilder
sb
)
{
if
(
dto
.
getReportOpen
())
{
sb
.
append
(
"【学习报告】 "
);
}
if
(
dto
.
getRiddleOpen
())
{
sb
.
append
(
"【猜谜语】 "
);
}
if
(
dto
.
getClockOpen
())
{
sb
.
append
(
"【"
).
append
(
dto
.
getClockKeyword
()).
append
(
"】 "
);
}
if
(
StringUtil
.
isNotBlank
(
sb
))
{
sb
.
append
(
",领取任务或资源"
);
}
return
sb
;
}
private
static
String
getNickNameStr
(
String
weixinGroupId
)
{
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/BookGuideBizImpl.java
View file @
3431424d
...
...
@@ -28,6 +28,7 @@ import com.pcloud.book.keywords.dao.BookGuideReplyDao;
import
com.pcloud.book.keywords.dao.KeywordDao
;
import
com.pcloud.book.keywords.dto.GuideDTO
;
import
com.pcloud.book.keywords.dto.KeywordDTO
;
import
com.pcloud.book.keywords.dto.KeywordStatusDTO
;
import
com.pcloud.book.keywords.dto.ReplyKeywordDTO
;
import
com.pcloud.book.keywords.entity.BookGuide
;
import
com.pcloud.book.keywords.entity.BookGuideReply
;
...
...
@@ -371,22 +372,22 @@ public class BookGuideBizImpl implements BookGuideBiz {
Boolean
isHaveKeywords
=
!
ListUtils
.
isEmpty
(
keywords
);
final
Boolean
groupRobot
=
wechatGroupConsr
.
isGroupRobot
(
robotId
);
log
.
info
(
"[wechatGroupConsr.isGroupRobot] robotId:{} groupRobot:{}"
,
robotId
,
groupRobot
);
//如果设置了群学习报告,加一个群学习报告的关键词
KeywordStatusDTO
dto
=
pushLearningReport
(
classifyQrcodeInfo
,
robotId
,
weixinGroupId
,
pushAddUserMessageDTO
.
getIp
());
if
(
ListUtils
.
isEmpty
(
replyMessages
))
{
//获取群名称
GroupQrcodeBaseInfoVO
groupInfo
=
groupQrcodeBiz
.
getBaseById
(
classifyQrcodeInfo
.
getGroupQrcodeId
());
//推送消息 刘娜需求 1001282 群不推送关键词
// 若非之前的机器人则不回复普通关键词
SendWeixinRequestTools
.
sendDefaultMessage
(
groupInfo
==
null
?
""
:
groupInfo
.
getGroupName
(),
robotId
,
weixinGroupId
,
isHaveKeywords
,
groupRobot
,
keywords
,
pushAddUserMessageDTO
.
getIp
());
SendWeixinRequestTools
.
sendDefaultMessage
(
groupInfo
==
null
?
""
:
groupInfo
.
getGroupName
(),
robotId
,
weixinGroupId
,
isHaveKeywords
,
groupRobot
,
keywords
,
dto
,
pushAddUserMessageDTO
.
getIp
());
}
else
{
//处理链接
handleUrl
(
replyMessages
,
wechatInfo
,
classifyQrcodeInfo
);
//推送消息
SendWeixinRequestTools
.
sendGuideMessage
(
replyMessages
,
robotId
,
weixinGroupId
,
groupRobot
,
keywords
,
pushAddUserMessageDTO
.
getIp
(),
SendMessageTypeEnum
.
GROUP
.
getCode
());
SendWeixinRequestTools
.
sendGuideMessage
(
replyMessages
,
robotId
,
weixinGroupId
,
groupRobot
,
keywords
,
dto
,
pushAddUserMessageDTO
.
getIp
(),
SendMessageTypeEnum
.
GROUP
.
getCode
());
//新增欢迎语应用触发记录
addGuideAppTouchRecord
(
replyMessages
,
weixinGroupId
,
classifyQrcodeInfo
.
getBookGroupId
(),
classifyQrcodeInfo
.
getClassifyId
());
}
//如果设置了群学习报告,加一个群学习报告的关键词
pushLearningReport
(
classifyQrcodeInfo
,
robotId
,
weixinGroupId
,
pushAddUserMessageDTO
.
getIp
());
if
(
bookGuide
!=
null
&&
bookGuide
.
getIsRecommend
()
!=
null
&&
bookGuide
.
getIsRecommend
()
==
1
)
{
//推送公众号消息
SendWeixinRequestTools
.
sendAccountMessage
(
weixinGroupId
,
bookGuide
.
getRecommendLanguage
(),
robotId
,
wechatInfo
,
pushAddUserMessageDTO
.
getIp
());
...
...
@@ -394,7 +395,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
}
@ParamLog
(
"推关学习报告/猜谜语关键词消息"
)
private
void
pushLearningReport
(
GroupClassifyQrcodeDTO
classifyQrcodeInfo
,
String
robotId
,
String
weixinGroupId
,
String
ip
)
{
private
KeywordStatusDTO
pushLearningReport
(
GroupClassifyQrcodeDTO
classifyQrcodeInfo
,
String
robotId
,
String
weixinGroupId
,
String
ip
)
{
Boolean
reportOpen
=
false
;
Boolean
riddleOpen
=
false
;
Boolean
clockOpen
=
false
;
...
...
@@ -409,26 +410,32 @@ public class BookGuideBizImpl implements BookGuideBiz {
if
(
null
!=
weixinClockDto
&&
!
StringUtil
.
isEmpty
(
weixinClockDto
.
getClockGuide
())
&&
!
StringUtil
.
isEmpty
(
weixinClockDto
.
getClockKeyword
()))
{
clockOpen
=
true
;
}
if
(
reportOpen
&&
riddleOpen
&&
clockOpen
)
{
SendWeixinRequestTools
.
sendTextMessage
(
"关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值\n"
+
"关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666\n"
+
"关键词【"
+
weixinClockDto
.
getClockKeyword
()
+
"】\n "
+
weixinClockDto
.
getClockGuide
(),
robotId
,
weixinGroupId
,
ip
);
}
else
if
(
reportOpen
&&
riddleOpen
)
{
SendWeixinRequestTools
.
sendTextMessage
(
"关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值\n"
+
"关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666"
,
robotId
,
weixinGroupId
,
ip
);
}
else
if
(
reportOpen
&&
clockOpen
)
{
SendWeixinRequestTools
.
sendTextMessage
(
"关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值\n"
+
"关键词【"
+
weixinClockDto
.
getClockKeyword
()
+
"】\n "
+
weixinClockDto
.
getClockGuide
(),
robotId
,
weixinGroupId
,
ip
);
}
else
if
(
riddleOpen
&&
clockOpen
)
{
SendWeixinRequestTools
.
sendTextMessage
(
"关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666"
+
"关键词【"
+
weixinClockDto
.
getClockKeyword
()
+
"】\n "
+
weixinClockDto
.
getClockGuide
(),
robotId
,
weixinGroupId
,
ip
);
}
else
if
(
clockOpen
)
{
SendWeixinRequestTools
.
sendTextMessage
(
"关键词【"
+
weixinClockDto
.
getClockKeyword
()
+
"】\n "
+
weixinClockDto
.
getClockGuide
(),
robotId
,
weixinGroupId
,
ip
);
}
else
if
(
reportOpen
)
{
SendWeixinRequestTools
.
sendTextMessage
(
"关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值"
,
robotId
,
weixinGroupId
,
ip
);
}
else
if
(
riddleOpen
)
{
SendWeixinRequestTools
.
sendTextMessage
(
"关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666"
,
robotId
,
weixinGroupId
,
ip
);
}
KeywordStatusDTO
dto
=
new
KeywordStatusDTO
();
dto
.
setReportOpen
(
reportOpen
);
dto
.
setRiddleOpen
(
riddleOpen
);
dto
.
setClockOpen
(
clockOpen
);
dto
.
setClockKeyword
(
null
==
weixinClockDto
?
StringUtil
.
EMPTY
:
weixinClockDto
.
getClockKeyword
());
return
dto
;
// if (reportOpen && riddleOpen && clockOpen) {
// SendWeixinRequestTools.sendTextMessage("关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值\n" +
// "关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666\n" +
// "关键词【" + weixinClockDto.getClockKeyword() + "】\n " + weixinClockDto.getClockGuide(), robotId, weixinGroupId, ip);
// } else if (reportOpen && riddleOpen) {
// SendWeixinRequestTools.sendTextMessage("关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值\n" +
// "关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666", robotId, weixinGroupId, ip);
// } else if (reportOpen && clockOpen) {
// SendWeixinRequestTools.sendTextMessage("关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值\n" +
// "关键词【" + weixinClockDto.getClockKeyword() + "】\n " + weixinClockDto.getClockGuide(), robotId, weixinGroupId, ip);
// } else if (riddleOpen && clockOpen) {
// SendWeixinRequestTools.sendTextMessage("关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666" +
// "关键词【" + weixinClockDto.getClockKeyword() + "】\n " + weixinClockDto.getClockGuide(), robotId, weixinGroupId, ip);
// } else if (clockOpen) {
// SendWeixinRequestTools.sendTextMessage("关键词【" + weixinClockDto.getClockKeyword() + "】\n " + weixinClockDto.getClockGuide(), robotId, weixinGroupId, ip);
// } else if (reportOpen) {
// SendWeixinRequestTools.sendTextMessage("关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值", robotId, weixinGroupId, ip);
// } else if (riddleOpen) {
// SendWeixinRequestTools.sendTextMessage("关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666", robotId, weixinGroupId, ip);
// }
}
@Override
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/dto/KeywordStatusDTO.java
0 → 100644
View file @
3431424d
package
com
.
pcloud
.
book
.
keywords
.
dto
;
import
lombok.Data
;
@Data
public
class
KeywordStatusDTO
{
/**
* 学习报告是否开启
*/
private
Boolean
reportOpen
;
/**
* 猜谜语是否开启
*/
private
Boolean
riddleOpen
;
/**
* 打卡是否开启
*/
private
Boolean
clockOpen
;
/**
* 打卡关键词
*/
private
String
clockKeyword
;
}
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