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
b5c11382
Commit
b5c11382
authored
Aug 07, 2019
by
裴大威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add TODO
parent
a02a2f45
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
15 deletions
+60
-15
WechatGroupConsr.java
...om/pcloud/book/consumer/wechatgroup/WechatGroupConsr.java
+41
-0
BookGuideBizImpl.java
...a/com/pcloud/book/keywords/biz/impl/BookGuideBizImpl.java
+13
-2
BookKeywordBizImpl.java
...com/pcloud/book/keywords/biz/impl/BookKeywordBizImpl.java
+6
-13
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/consumer/wechatgroup/WechatGroupConsr.java
View file @
b5c11382
...
@@ -2,6 +2,7 @@ package com.pcloud.book.consumer.wechatgroup;
...
@@ -2,6 +2,7 @@ package com.pcloud.book.consumer.wechatgroup;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
...
@@ -13,8 +14,10 @@ import com.pcloud.wechatgroup.group.service.GroupMemberService;
...
@@ -13,8 +14,10 @@ import com.pcloud.wechatgroup.group.service.GroupMemberService;
import
com.pcloud.wechatgroup.message.dto.GroupChatCountDTO
;
import
com.pcloud.wechatgroup.message.dto.GroupChatCountDTO
;
import
com.pcloud.wechatgroup.message.service.MessageService
;
import
com.pcloud.wechatgroup.message.service.MessageService
;
import
com.pcloud.wechatgroup.monitor.service.MonitorService
;
import
com.pcloud.wechatgroup.monitor.service.MonitorService
;
import
com.pcloud.wechatgroup.selfrobot.service.SelfRobotService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
...
@@ -35,6 +38,44 @@ public class WechatGroupConsr {
...
@@ -35,6 +38,44 @@ public class WechatGroupConsr {
private
MessageService
messageService
;
private
MessageService
messageService
;
@Autowired
@Autowired
private
MonitorService
monitorService
;
private
MonitorService
monitorService
;
@Autowired
private
SelfRobotService
selfRobotService
;
@ParamLog
(
"根据机器人id和用户微信id获取最新暗号"
)
public
String
getCipherByRobotAndUserWxId
(
String
robotWxId
,
String
userWxId
)
{
if
(
StringUtil
.
isBlank
(
robotWxId
)
||
StringUtil
.
isBlank
(
userWxId
))
{
return
null
;
}
try
{
return
ResponseHandleUtil
.
parseResponse
(
selfRobotService
.
getCipherByRobotAndUserWxId
(
robotWxId
,
userWxId
),
String
.
class
);
}
catch
(
BizException
e
)
{
log
.
warn
(
"根据机器人id和用户微信id获取最新暗号失败:"
+
e
.
getMessage
(),
e
);
throw
new
BizException
(
e
.
getCode
(),
e
.
getMessage
());
}
catch
(
Exception
e
)
{
log
.
error
(
"根据机器人id和用户微信id获取最新暗号.[getCipherByRobotAndUserWxId]:"
+
e
.
getMessage
(),
e
);
throw
new
BookBizException
(
BookBizException
.
INVOKE_RES_ERROR
,
"服务内部错误,请稍后重试"
);
}
finally
{
log
.
info
(
"【根据机器人id和用户微信id获取最新暗号,<END>"
);
}
}
@ParamLog
(
"是否群机器人"
)
public
Boolean
isGroupRobot
(
String
robotWxId
)
{
if
(
StringUtil
.
isBlank
(
robotWxId
))
{
return
null
;
}
try
{
return
ResponseHandleUtil
.
parseResponse
(
selfRobotService
.
isGroupRobot
(
robotWxId
),
Boolean
.
class
);
}
catch
(
BizException
e
)
{
log
.
warn
(
"是否群机器人失败:"
+
e
.
getMessage
(),
e
);
throw
new
BizException
(
e
.
getCode
(),
e
.
getMessage
());
}
catch
(
Exception
e
)
{
log
.
error
(
"是否群机器人.[isGroupRobot]:"
+
e
.
getMessage
(),
e
);
throw
new
BookBizException
(
BookBizException
.
INVOKE_RES_ERROR
,
"服务内部错误,请稍后重试"
);
}
finally
{
log
.
info
(
"【是否群机器人,<END>"
);
}
}
/**
/**
* 是否黑名单
* 是否黑名单
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/BookGuideBizImpl.java
View file @
b5c11382
...
@@ -37,6 +37,8 @@ import com.pcloud.book.keywords.vo.UpdateGuideVO;
...
@@ -37,6 +37,8 @@ import com.pcloud.book.keywords.vo.UpdateGuideVO;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.UUIDUitl
;
import
com.pcloud.common.utils.rsa.AESCodec
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.wechatgroup.message.dto.AgreeAddUserDTO
;
import
com.pcloud.wechatgroup.message.dto.AgreeAddUserDTO
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
...
@@ -95,6 +97,15 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -95,6 +97,15 @@ public class BookGuideBizImpl implements BookGuideBiz {
@ParamLog
(
"同意加好友发送欢迎语"
)
@ParamLog
(
"同意加好友发送欢迎语"
)
@Override
@Override
public
void
sendGuide
(
AgreeAddUserDTO
agreeAddUserDTO
)
{
public
void
sendGuide
(
AgreeAddUserDTO
agreeAddUserDTO
)
{
if
(
null
==
agreeAddUserDTO
||
StringUtil
.
isBlank
(
agreeAddUserDTO
.
getRobotWxId
())
||
StringUtil
.
isBlank
(
agreeAddUserDTO
.
getUserWxId
()))
{
log
.
info
(
"[同意加好友发送欢迎语] 参数为空 agreeAddUserDTO:{}"
,
agreeAddUserDTO
);
return
;
}
final
String
cipher
=
wechatGroupConsr
.
getCipherByRobotAndUserWxId
(
agreeAddUserDTO
.
getRobotWxId
(),
agreeAddUserDTO
.
getUserWxId
());
if
(
StringUtil
.
isBlank
(
cipher
))
{
log
.
info
(
"[同意加好友发送欢迎语] 暗号为空 agreeAddUserDTO:{}"
,
agreeAddUserDTO
);
return
;
}
SendTextMessageVO
vo
=
new
SendTextMessageVO
();
SendTextMessageVO
vo
=
new
SendTextMessageVO
();
vo
.
setContent
(
"你好,我是本书智能小助手,请回复你的进群暗号,获取本书资源服务,以及入群链接如果忘了进群暗号,请重新扫描书上的二维码,点击入群即可获取"
);
vo
.
setContent
(
"你好,我是本书智能小助手,请回复你的进群暗号,获取本书资源服务,以及入群链接如果忘了进群暗号,请重新扫描书上的二维码,点击入群即可获取"
);
vo
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
vo
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
...
@@ -102,8 +113,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -102,8 +113,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
vo
.
setGroupId
(
agreeAddUserDTO
.
getUserWxId
());
vo
.
setGroupId
(
agreeAddUserDTO
.
getUserWxId
());
WxGroupSDK
.
sendTextMessage
(
vo
);
WxGroupSDK
.
sendTextMessage
(
vo
);
// TODO 推送关键词欢迎语
// TODO 推送关键词欢迎语
//
List<KeywordDTO> keywords = bookKeywordBiz.listFiveKeyword(classifyQrcodeInfo.getClassifyId(), classifyQrcodeInfo.getBookGroupId());
List
<
KeywordDTO
>
keywords
=
bookKeywordBiz
.
listFiveKeyword
(
classifyQrcodeInfo
.
getClassifyId
(),
classifyQrcodeInfo
.
getBookGroupId
());
//
SendWeixinRequestTools.sendKeywordsInfo(keywords, agreeAddUserDTO.getRobotWxId(), agreeAddUserDTO.getUserWxId(), agreeAddUserDTO.getIp());
SendWeixinRequestTools
.
sendKeywordsInfo
(
keywords
,
agreeAddUserDTO
.
getRobotWxId
(),
agreeAddUserDTO
.
getUserWxId
(),
agreeAddUserDTO
.
getIp
());
}
}
@Override
@Override
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/BookKeywordBizImpl.java
View file @
b5c11382
...
@@ -462,19 +462,6 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -462,19 +462,6 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
SendWeixinRequestTools
.
sendKeywordMessage
(
replyKeywordDTO
,
robotId
,
weixinGroupId
,
ip
,
code
);
SendWeixinRequestTools
.
sendKeywordMessage
(
replyKeywordDTO
,
robotId
,
weixinGroupId
,
ip
,
code
);
//新增关键词触发记录
//新增关键词触发记录
addKeywordAppTouchRecord
(
replyKeywordDTO
,
weixinGroupId
,
classifyQrcodeInfo
.
getClassifyId
(),
classifyQrcodeInfo
.
getBookGroupId
());
addKeywordAppTouchRecord
(
replyKeywordDTO
,
weixinGroupId
,
classifyQrcodeInfo
.
getClassifyId
(),
classifyQrcodeInfo
.
getBookGroupId
());
//第一推送关键词消息埋点
String
keywordsKey
=
"BOOK:FIRSTKEYWORD:"
+
DateUtils
.
getShortDateStr
()
+
"-"
+
weixinGroupId
;
Boolean
isSend
=
JedisClusterUtils
.
getJson
(
keywordsKey
,
Boolean
.
class
);
if
(
isSend
!=
null
&&
isSend
)
{
return
;
}
JedisClusterUtils
.
setJson
(
keywordsKey
,
true
);
JedisClusterUtils
.
expire
(
keywordsKey
,
86400
);
RobotReplyDTO
robotReplyDTO
=
new
RobotReplyDTO
();
robotReplyDTO
.
setKeyWord
(
content
);
robotReplyDTO
.
setWxGroupId
(
weixinGroupId
);
robotReplyDTO
.
setWxUserId
(
userWxId
);
wechatGroupConsr
.
addFirstRobotReplyRecord
(
robotReplyDTO
);
}
}
/**
/**
...
@@ -486,6 +473,12 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -486,6 +473,12 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
if
(
StringUtil
.
isEmpty
(
content
)
||
content
.
length
()
>
20
)
{
if
(
StringUtil
.
isEmpty
(
content
)
||
content
.
length
()
>
20
)
{
return
;
return
;
}
}
// 若非之前的机器人则不回复普通关键词
final
Boolean
groupRobot
=
wechatGroupConsr
.
isGroupRobot
(
robotId
);
log
.
info
(
"[wechatGroupConsr.isGroupRobot] robotId:{} groupRobot:{}"
,
robotId
,
groupRobot
);
if
(!
groupRobot
)
{
return
;
}
//通过群id获取对应基本信息
//通过群id获取对应基本信息
GroupClassifyQrcodeDTO
classifyQrcodeInfo
=
bookGroupClassifyBiz
.
getClassifyQrcodeInfo
(
weixinGroupId
);
GroupClassifyQrcodeDTO
classifyQrcodeInfo
=
bookGroupClassifyBiz
.
getClassifyQrcodeInfo
(
weixinGroupId
);
if
(
classifyQrcodeInfo
==
null
)
{
if
(
classifyQrcodeInfo
==
null
)
{
...
...
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