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
25a952fd
Commit
25a952fd
authored
Aug 09, 2019
by
阮思源
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat-dw' of
http://begitlab.chubanyun.me/rays/pcloud-book
into ruansiyuan
parents
a73c67b3
45a46305
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
373 additions
and
108 deletions
+373
-108
BookApplication.java
...e-book/src/main/java/com/pcloud/book/BookApplication.java
+13
-0
AdNewsBizImpl.java
...n/java/com/pcloud/book/adnews/biz/impl/AdNewsBizImpl.java
+1
-1
AdvertisingSpaceBizImpl.java
...ud/book/advertising/biz/impl/AdvertisingSpaceBizImpl.java
+3
-3
BookClockBizImpl.java
...java/com/pcloud/book/clock/biz/impl/BookClockBizImpl.java
+1
-1
WechatGroupConsr.java
...om/pcloud/book/consumer/wechatgroup/WechatGroupConsr.java
+39
-0
BookGroupClassifyBiz.java
.../java/com/pcloud/book/group/biz/BookGroupClassifyBiz.java
+5
-0
BookGroupClassifyBizImpl.java
.../pcloud/book/group/biz/impl/BookGroupClassifyBizImpl.java
+13
-0
JoinGroupCipherDao.java
...in/java/com/pcloud/book/group/dao/JoinGroupCipherDao.java
+3
-0
JoinGroupCipherDaoImpl.java
...om/pcloud/book/group/dao/impl/JoinGroupCipherDaoImpl.java
+6
-0
JoinGroupCiperDTO.java
...ain/java/com/pcloud/book/group/dto/JoinGroupCiperDTO.java
+20
-0
SendWeixinRequestTools.java
...a/com/pcloud/book/group/tools/SendWeixinRequestTools.java
+38
-22
GroupQrcodeBaseInfoVO.java
.../java/com/pcloud/book/group/vo/GroupQrcodeBaseInfoVO.java
+5
-32
BookGuideBiz.java
.../main/java/com/pcloud/book/keywords/biz/BookGuideBiz.java
+6
-0
BookKeywordBiz.java
...ain/java/com/pcloud/book/keywords/biz/BookKeywordBiz.java
+2
-1
BookGuideBizImpl.java
...a/com/pcloud/book/keywords/biz/impl/BookGuideBizImpl.java
+61
-33
BookKeywordBizImpl.java
...com/pcloud/book/keywords/biz/impl/BookKeywordBizImpl.java
+65
-2
BookGuideFacadeImpl.java
...pcloud/book/keywords/facade/impl/BookGuideFacadeImpl.java
+21
-0
MQTopicConumer.java
...c/main/java/com/pcloud/book/mq/config/MQTopicConumer.java
+5
-0
UpdateWXGroupNameListener.java
...a/com/pcloud/book/mq/topic/UpdateWXGroupNameListener.java
+1
-1
WXGroupLearningReportListener.java
...m/pcloud/book/mq/topic/WXGroupLearningReportListener.java
+5
-3
WxAgreeAddUserListener.java
...java/com/pcloud/book/mq/topic/WxAgreeAddUserListener.java
+40
-0
WxGroupSendTextListener.java
...ava/com/pcloud/book/mq/topic/WxGroupSendTextListener.java
+3
-2
PushBizImpl.java
.../main/java/com/pcloud/book/push/biz/impl/PushBizImpl.java
+6
-6
BookGroupMapper.xml
...-book/src/main/resources/mapper/group/BookGroupMapper.xml
+1
-0
GroupQrcode.Mapper.xml
...ok/src/main/resources/mapper/group/GroupQrcode.Mapper.xml
+1
-1
JoinGroupCipher.xml
...-book/src/main/resources/mapper/group/JoinGroupCipher.xml
+9
-0
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/BookApplication.java
View file @
25a952fd
...
@@ -198,4 +198,17 @@ public class BookApplication {
...
@@ -198,4 +198,17 @@ public class BookApplication {
public
Binding
wxGroupLearningReportBind
()
{
public
Binding
wxGroupLearningReportBind
()
{
return
RabbitMQFactory
.
bindingExchange
(
wxGroupLearningReportQueue
(),
MQTopicProducer
.
WXGROUP_LEARNING_REPORT
);
return
RabbitMQFactory
.
bindingExchange
(
wxGroupLearningReportQueue
(),
MQTopicProducer
.
WXGROUP_LEARNING_REPORT
);
}
}
/**
* 微信个人机器人同意加好友
*/
@Bean
public
Queue
wxGroupAgreeAddUserQueue
()
{
return
RabbitMQFactory
.
queueBuilder
(
MQTopicConumer
.
WX_AGREE_ADD_USER
);
}
@Bean
public
Binding
wxGroupAgreeAddUserBind
()
{
return
RabbitMQFactory
.
bindingExchange
(
wxGroupAgreeAddUserQueue
(),
MQTopicProducer
.
WX_AGREE_ADD_USER
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/adnews/biz/impl/AdNewsBizImpl.java
View file @
25a952fd
...
@@ -312,7 +312,7 @@ public class AdNewsBizImpl implements AdNewsBiz {
...
@@ -312,7 +312,7 @@ public class AdNewsBizImpl implements AdNewsBiz {
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setGroupId
(
weixinGroupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
findIp
(
weixinGroupId
));
sendTextMessageVO
.
setIp
(
findIp
(
weixinGroupId
));
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
LOGGER
.
info
(
"发送编辑端早晚报"
+
sendTextMessageVO
.
toString
());
LOGGER
.
info
(
"发送编辑端早晚报"
+
sendTextMessageVO
.
toString
());
...
...
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/impl/AdvertisingSpaceBizImpl.java
View file @
25a952fd
...
@@ -719,7 +719,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -719,7 +719,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
}
}
}
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setGroupId
(
groupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
groupId
);
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setContent
(
adTitle
);
sendTextMessageVO
.
setContent
(
adTitle
);
sendTextMessageVO
.
setIp
(
findIp
(
groupId
));
sendTextMessageVO
.
setIp
(
findIp
(
groupId
));
...
@@ -730,7 +730,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -730,7 +730,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
sendArticleMessageVO
.
setAltId
(
altId
);
sendArticleMessageVO
.
setAltId
(
altId
);
sendArticleMessageVO
.
setTitle
(
advertisingSpace
.
getAdTitle
());
sendArticleMessageVO
.
setTitle
(
advertisingSpace
.
getAdTitle
());
sendArticleMessageVO
.
setDescription
(
advertisingSpace
.
getAdSlogan
());
sendArticleMessageVO
.
setDescription
(
advertisingSpace
.
getAdSlogan
());
sendArticleMessageVO
.
setGroupId
(
groupId
);
sendArticleMessageVO
.
set
Wx
GroupId
(
groupId
);
String
adLink
=
""
;
String
adLink
=
""
;
if
(!
StringUtil
.
isEmpty
(
advertisingSpace
.
getAdLink
()))
{
if
(!
StringUtil
.
isEmpty
(
advertisingSpace
.
getAdLink
()))
{
if
(
advertisingSpace
.
getAdLink
().
contains
(
"?"
))
{
if
(
advertisingSpace
.
getAdLink
().
contains
(
"?"
))
{
...
@@ -752,7 +752,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -752,7 +752,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
else
if
(
AdPositionModeEnum
.
JUST_PIC
.
modeCode
.
equals
(
advertisingSpace
.
getAdPositionMode
()))
{
}
else
if
(
AdPositionModeEnum
.
JUST_PIC
.
modeCode
.
equals
(
advertisingSpace
.
getAdPositionMode
()))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setAltId
(
altId
);
sendPicMessageVO
.
setAltId
(
altId
);
sendPicMessageVO
.
setGroupId
(
groupId
);
sendPicMessageVO
.
set
Wx
GroupId
(
groupId
);
sendPicMessageVO
.
setPicUrl
(
advertisingSpace
.
getAdPic
());
sendPicMessageVO
.
setPicUrl
(
advertisingSpace
.
getAdPic
());
sendPicMessageVO
.
setIp
(
findIp
(
groupId
));
sendPicMessageVO
.
setIp
(
findIp
(
groupId
));
LOGGER
.
info
(
"发送微信消息-纯图片"
+
sendPicMessageVO
.
toString
());
LOGGER
.
info
(
"发送微信消息-纯图片"
+
sendPicMessageVO
.
toString
());
...
...
pcloud-service-book/src/main/java/com/pcloud/book/clock/biz/impl/BookClockBizImpl.java
View file @
25a952fd
...
@@ -377,7 +377,7 @@ public class BookClockBizImpl implements BookClockBiz {
...
@@ -377,7 +377,7 @@ public class BookClockBizImpl implements BookClockBiz {
//获取机器人微信号
//获取机器人微信号
String
altId
=
wechatGroupConsr
.
getRobotIdByGroupId
(
weixinGroupId
);
String
altId
=
wechatGroupConsr
.
getRobotIdByGroupId
(
weixinGroupId
);
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setGroupId
(
weixinGroupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setContent
(
bookClockInfoDTO
.
getNoticeContent
());
sendTextMessageVO
.
setContent
(
bookClockInfoDTO
.
getNoticeContent
());
if
(!
MapUtils
.
isEmpty
(
wxQrcodeDTOMap
)
&&
wxQrcodeDTOMap
.
containsKey
(
weixinGroupId
)){
if
(!
MapUtils
.
isEmpty
(
wxQrcodeDTOMap
)
&&
wxQrcodeDTOMap
.
containsKey
(
weixinGroupId
)){
...
...
pcloud-service-book/src/main/java/com/pcloud/book/consumer/wechatgroup/WechatGroupConsr.java
View file @
25a952fd
...
@@ -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,10 +14,12 @@ import com.pcloud.wechatgroup.group.service.GroupMemberService;
...
@@ -13,10 +14,12 @@ 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
com.pcloud.wechatgroup.selfrobot.dto.SelfRobotDTO
;
import
com.pcloud.wechatgroup.selfrobot.dto.SelfRobotDTO
;
import
com.pcloud.wechatgroup.selfrobot.service.SelfRobotService
;
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
;
...
@@ -40,6 +43,42 @@ public class WechatGroupConsr {
...
@@ -40,6 +43,42 @@ public class WechatGroupConsr {
@Autowired
@Autowired
private
SelfRobotService
selfRobotService
;
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/group/biz/BookGroupClassifyBiz.java
View file @
25a952fd
...
@@ -113,6 +113,11 @@ public interface BookGroupClassifyBiz {
...
@@ -113,6 +113,11 @@ public interface BookGroupClassifyBiz {
GroupQrcode4ClassifyVO
getGroupQrcode4ClassifyWechat
(
Long
classifyId
,
Long
wechatUserId
);
GroupQrcode4ClassifyVO
getGroupQrcode4ClassifyWechat
(
Long
classifyId
,
Long
wechatUserId
);
/**
/**
* 用户获取具体进群id
*/
String
getWxGroupIdByClassifyIdAndWechatId
(
Long
classifyId
,
Long
wechatUserId
);
/**
* @Author:lili
* @Author:lili
* @Desr:获取编辑所有的分类
* @Desr:获取编辑所有的分类
* @Date:2019/4/30 15:33
* @Date:2019/4/30 15:33
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/impl/BookGroupClassifyBizImpl.java
View file @
25a952fd
...
@@ -511,6 +511,19 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
...
@@ -511,6 +511,19 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
return
groupQrcode4ClassifyVO
;
return
groupQrcode4ClassifyVO
;
}
}
@Override
public
String
getWxGroupIdByClassifyIdAndWechatId
(
Long
classifyId
,
Long
wechatUserId
)
{
if
(
null
==
classifyId
||
null
==
wechatUserId
)
{
return
null
;
}
final
GroupQrcode4ClassifyVO
wechat
=
this
.
getGroupQrcode4ClassifyWechat
(
classifyId
,
wechatUserId
);
if
(
null
==
wechat
)
{
return
null
;
}
final
GroupQrcodeBaseInfoVO
baseById
=
this
.
groupQrcodeBiz
.
getBaseById
(
wechat
.
getGroupQrcodeId
());
return
(
null
==
baseById
)
?
null
:
baseById
.
getWeixinGroupId
();
}
@ParamLog
(
"获取备用二维码"
)
@ParamLog
(
"获取备用二维码"
)
private
String
getSpareQr
(
Long
bookGroupId
)
{
private
String
getSpareQr
(
Long
bookGroupId
)
{
//获取备用二维码
//获取备用二维码
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/JoinGroupCipherDao.java
View file @
25a952fd
package
com
.
pcloud
.
book
.
group
.
dao
;
package
com
.
pcloud
.
book
.
group
.
dao
;
import
com.pcloud.book.group.dto.JoinGroupCiperDTO
;
import
com.pcloud.book.group.entity.JoinGroupCipher
;
import
com.pcloud.book.group.entity.JoinGroupCipher
;
import
com.pcloud.common.core.dao.BaseDao
;
import
com.pcloud.common.core.dao.BaseDao
;
...
@@ -10,6 +11,8 @@ public interface JoinGroupCipherDao extends BaseDao<JoinGroupCipher> {
...
@@ -10,6 +11,8 @@ public interface JoinGroupCipherDao extends BaseDao<JoinGroupCipher> {
JoinGroupCipher
getByCipher
(
String
cipher
);
JoinGroupCipher
getByCipher
(
String
cipher
);
JoinGroupCiperDTO
getDTOByCipher
(
String
cipher
);
void
updateCipherStateToUsed
(
String
cipher
,
String
wxId
);
void
updateCipherStateToUsed
(
String
cipher
,
String
wxId
);
List
<
Long
>
getClassifyIdsByWxIdAndAltId
(
String
wxId
,
String
altId
);
List
<
Long
>
getClassifyIdsByWxIdAndAltId
(
String
wxId
,
String
altId
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/JoinGroupCipherDaoImpl.java
View file @
25a952fd
package
com
.
pcloud
.
book
.
group
.
dao
.
impl
;
package
com
.
pcloud
.
book
.
group
.
dao
.
impl
;
import
com.pcloud.book.group.dao.JoinGroupCipherDao
;
import
com.pcloud.book.group.dao.JoinGroupCipherDao
;
import
com.pcloud.book.group.dto.JoinGroupCiperDTO
;
import
com.pcloud.book.group.entity.JoinGroupCipher
;
import
com.pcloud.book.group.entity.JoinGroupCipher
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -30,6 +31,11 @@ public class JoinGroupCipherDaoImpl extends BaseDaoImpl<JoinGroupCipher> impleme
...
@@ -30,6 +31,11 @@ public class JoinGroupCipherDaoImpl extends BaseDaoImpl<JoinGroupCipher> impleme
}
}
@Override
@Override
public
JoinGroupCiperDTO
getDTOByCipher
(
String
cipher
)
{
return
this
.
getSqlSession
().
selectOne
(
this
.
getStatement
(
"getDTOByCipher"
),
cipher
);
}
@Override
public
void
updateCipherStateToUsed
(
String
cipher
,
String
wxId
)
{
public
void
updateCipherStateToUsed
(
String
cipher
,
String
wxId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"cipher"
,
cipher
);
map
.
put
(
"cipher"
,
cipher
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/dto/JoinGroupCiperDTO.java
0 → 100644
View file @
25a952fd
package
com
.
pcloud
.
book
.
group
.
dto
;
import
lombok.Data
;
@Data
public
class
JoinGroupCiperDTO
{
private
String
cipher
;
private
Long
classifyId
;
private
Long
wechatUserId
;
private
String
wxId
;
private
Boolean
hasUsed
;
private
Long
bookGroupId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/group/tools/SendWeixinRequestTools.java
View file @
25a952fd
...
@@ -18,6 +18,7 @@ import com.pcloud.common.utils.string.StringUtil;
...
@@ -18,6 +18,7 @@ import com.pcloud.common.utils.string.StringUtil;
import
com.sdk.wxgroup.ChangeNameVO
;
import
com.sdk.wxgroup.ChangeNameVO
;
import
com.sdk.wxgroup.QrcodeVO
;
import
com.sdk.wxgroup.QrcodeVO
;
import
com.sdk.wxgroup.SendArticleMessageVO
;
import
com.sdk.wxgroup.SendArticleMessageVO
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
com.sdk.wxgroup.SendPicMessageVO
;
import
com.sdk.wxgroup.SendPicMessageVO
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
com.sdk.wxgroup.WxGroupSDK
;
...
@@ -127,8 +128,8 @@ public class SendWeixinRequestTools {
...
@@ -127,8 +128,8 @@ public class SendWeixinRequestTools {
}*/
}*/
}
}
@ParamLog
(
"
修改微信群名称
"
)
@ParamLog
(
"
发送欢迎语消息
"
)
public
static
void
sendGuideMessage
(
List
<
ReplyMessageVO
>
replyMessages
,
String
robotId
,
String
weixinGroupId
,
String
ip
)
{
public
static
void
sendGuideMessage
(
List
<
ReplyMessageVO
>
replyMessages
,
String
robotId
,
String
weixinGroupId
,
String
ip
,
Integer
code
)
{
//JedisClusterUtils.del("BOOK:WEIXINGROUP:GUIDEUSER" + weixinGroupId);
//JedisClusterUtils.del("BOOK:WEIXINGROUP:GUIDEUSER" + weixinGroupId);
if
(
ListUtils
.
isEmpty
(
replyMessages
))
{
if
(
ListUtils
.
isEmpty
(
replyMessages
))
{
return
;
return
;
...
@@ -148,37 +149,40 @@ public class SendWeixinRequestTools {
...
@@ -148,37 +149,40 @@ public class SendWeixinRequestTools {
}
}
}
}
}
}
sendMessage
(
sendMessageDTO
,
robotId
,
weixinGroupId
,
ip
);
sendMessage
(
sendMessageDTO
,
robotId
,
weixinGroupId
,
ip
,
code
);
i
++;
i
++;
}
}
}
}
@ParamLog
(
"推送消息"
)
@ParamLog
(
"推送消息"
)
private
static
void
sendMessage
(
SendMessageDTO
sendMessageDTO
,
String
robotId
,
String
weixinGroupId
,
String
ip
)
{
private
static
void
sendMessage
(
SendMessageDTO
sendMessageDTO
,
String
robotId
,
String
weixinGroupId
,
String
ip
,
Integer
code
)
{
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
sendMessageDTO
.
getContent
());
sendTextMessageVO
.
setContent
(
sendMessageDTO
.
getContent
());
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setGroupId
(
weixinGroupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
code
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
else
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
}
else
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setGroupId
(
weixinGroupId
);
sendPicMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendPicMessageVO
.
setAltId
(
robotId
);
sendPicMessageVO
.
setAltId
(
robotId
);
sendPicMessageVO
.
setPicUrl
(
sendMessageDTO
.
getPicUrl
());
sendPicMessageVO
.
setPicUrl
(
sendMessageDTO
.
getPicUrl
());
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setCode
(
code
);
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
}
else
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
sendMessageDTO
.
getReplyType
())
||
ReplyTypeEnum
.
LINK
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
}
else
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
sendMessageDTO
.
getReplyType
())
||
ReplyTypeEnum
.
LINK
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
sendArticleMessageVO
.
setAltId
(
robotId
);
sendArticleMessageVO
.
setAltId
(
robotId
);
sendArticleMessageVO
.
setDescription
(
sendMessageDTO
.
getDescription
());
sendArticleMessageVO
.
setDescription
(
sendMessageDTO
.
getDescription
());
sendArticleMessageVO
.
setLinkUrl
(
sendMessageDTO
.
getLinkUrl
());
sendArticleMessageVO
.
setLinkUrl
(
sendMessageDTO
.
getLinkUrl
());
sendArticleMessageVO
.
setGroupId
(
weixinGroupId
);
sendArticleMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendArticleMessageVO
.
setPicUrl
(
sendMessageDTO
.
getPicUrl
());
sendArticleMessageVO
.
setPicUrl
(
sendMessageDTO
.
getPicUrl
());
sendArticleMessageVO
.
setTitle
(
sendMessageDTO
.
getContent
());
sendArticleMessageVO
.
setTitle
(
sendMessageDTO
.
getContent
());
sendArticleMessageVO
.
setIp
(
ip
);
sendArticleMessageVO
.
setIp
(
ip
);
sendArticleMessageVO
.
setCode
(
code
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
}
}
}
}
...
@@ -188,7 +192,7 @@ public class SendWeixinRequestTools {
...
@@ -188,7 +192,7 @@ public class SendWeixinRequestTools {
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
nickNameStr
);
sendTextMessageVO
.
setContent
(
nickNameStr
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setGroupId
(
weixinGroupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
...
@@ -216,11 +220,11 @@ public class SendWeixinRequestTools {
...
@@ -216,11 +220,11 @@ public class SendWeixinRequestTools {
}
}
sendTextMessageVO
.
setContent
(
recommendLanguage
);
sendTextMessageVO
.
setContent
(
recommendLanguage
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setGroupId
(
weixinGroupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setGroupId
(
weixinGroupId
);
sendPicMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendPicMessageVO
.
setAltId
(
robotId
);
sendPicMessageVO
.
setAltId
(
robotId
);
sendPicMessageVO
.
setPicUrl
(
accountSettingDto
.
getQrcodeUrl
());
sendPicMessageVO
.
setPicUrl
(
accountSettingDto
.
getQrcodeUrl
());
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setIp
(
ip
);
...
@@ -228,10 +232,10 @@ public class SendWeixinRequestTools {
...
@@ -228,10 +232,10 @@ public class SendWeixinRequestTools {
}
}
@ParamLog
(
"推送关键词回复消息"
)
@ParamLog
(
"推送关键词回复消息"
)
public
static
void
sendKeywordMessage
(
ReplyKeywordDTO
replyKeywordDTO
,
String
robotId
,
String
weixinGroupId
,
String
ip
)
{
public
static
void
sendKeywordMessage
(
ReplyKeywordDTO
replyKeywordDTO
,
String
robotId
,
String
weixinGroupId
,
String
ip
,
Integer
code
)
{
SendMessageDTO
sendMessageDTO
=
new
SendMessageDTO
();
SendMessageDTO
sendMessageDTO
=
new
SendMessageDTO
();
BeanUtils
.
copyProperties
(
replyKeywordDTO
,
sendMessageDTO
);
BeanUtils
.
copyProperties
(
replyKeywordDTO
,
sendMessageDTO
);
sendMessage
(
sendMessageDTO
,
robotId
,
weixinGroupId
,
ip
);
sendMessage
(
sendMessageDTO
,
robotId
,
weixinGroupId
,
ip
,
code
);
}
}
@ParamLog
(
"补充域名"
)
@ParamLog
(
"补充域名"
)
...
@@ -269,32 +273,44 @@ public class SendWeixinRequestTools {
...
@@ -269,32 +273,44 @@ public class SendWeixinRequestTools {
}
}
@ParamLog
(
"欢迎语中推送关键词信息"
)
@ParamLog
(
"欢迎语中推送关键词信息"
)
public
static
void
sendKeywordsInfo
(
List
<
KeywordDTO
>
keywords
,
String
robotId
,
String
weixinGroup
Id
,
String
ip
){
public
static
void
sendKeywordsInfo
(
List
<
KeywordDTO
>
keywords
,
String
robotId
,
String
toWx
Id
,
String
ip
){
if
(
ListUtils
.
isEmpty
(
keywords
))
{
if
(
ListUtils
.
isEmpty
(
keywords
))
{
return
;
return
;
}
}
String
content
=
""
;
String
Builder
content
=
new
StringBuilder
()
;
for
(
int
i
=
0
;
i
<
keywords
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
keywords
.
size
();
i
++)
{
KeywordDTO
keywordDTO
=
keywords
.
get
(
i
);
KeywordDTO
keywordDTO
=
keywords
.
get
(
i
);
String
keyword
=
"关键词【"
+
keywordDTO
.
getKeywords
()
+
"】\n"
+
" "
+
keywordDTO
.
getGuide
();
String
keyword
=
"关键词【"
+
keywordDTO
.
getKeywords
()
+
"】\n"
+
" "
+
keywordDTO
.
getGuide
();
if
(
content
.
length
()
+
keyword
.
length
()
>
300
)
{
if
(
content
.
length
()
+
keyword
.
length
()
>
300
)
{
sendTextMessage
(
content
,
robotId
,
weixinGroup
Id
,
ip
);
sendTextMessage
ToSelf
(
content
.
toString
(),
robotId
,
toWx
Id
,
ip
);
content
=
keyword
;
content
=
new
StringBuilder
(
keyword
)
;
}
else
{
}
else
{
content
=
content
+
keyword
;
content
.
append
(
keyword
)
;
}
}
if
(
i
!=
keywords
.
size
()
-
1
)
{
if
(
i
!=
keywords
.
size
()
-
1
)
{
content
=
content
+
"\n"
;
content
.
append
(
"\n"
)
;
}
}
}
}
sendTextMessage
(
content
,
robotId
,
weixinGroupId
,
ip
);
// 1001282-施总需求,群不推送关键词,个人欢迎语推送关键词
// sendTextMessage(content, robotId, weixinGroupId, ip);
sendTextMessageToSelf
(
content
.
toString
(),
robotId
,
toWxId
,
ip
);
}
private
static
void
sendTextMessageToSelf
(
String
content
,
String
robotId
,
String
toWxId
,
String
ip
){
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setWxGroupId
(
toWxId
);
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
}
public
static
void
sendTextMessage
(
String
content
,
String
robotId
,
String
weixinGroupId
,
String
ip
){
public
static
void
sendTextMessage
(
String
content
,
String
robotId
,
String
weixinGroupId
,
String
ip
){
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setGroupId
(
weixinGroupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
}
...
@@ -303,7 +319,7 @@ public class SendWeixinRequestTools {
...
@@ -303,7 +319,7 @@ public class SendWeixinRequestTools {
// SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
// SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
// sendTextMessageVO.setContent("关键词1:a" + "\n" + "换行换行换行" + "\n");
// sendTextMessageVO.setContent("关键词1:a" + "\n" + "换行换行换行" + "\n");
// sendTextMessageVO.setAltId("wxid_qj200bf0key022");
// sendTextMessageVO.setAltId("wxid_qj200bf0key022");
// sendTextMessageVO.setGroupId("14108963419@chatroom");
// sendTextMessageVO.set
Wx
GroupId("14108963419@chatroom");
// WxGroupSDK.sendTextMessage(sendTextMessageVO);
// WxGroupSDK.sendTextMessage(sendTextMessageVO);
}
}
...
@@ -349,7 +365,7 @@ public class SendWeixinRequestTools {
...
@@ -349,7 +365,7 @@ public class SendWeixinRequestTools {
public
static
void
sendClockKeywordsInfo
(
List
<
BookClockKeywordDTO
>
keywords
,
String
robotId
,
String
weixinGroupId
,
String
ip
)
{
public
static
void
sendClockKeywordsInfo
(
List
<
BookClockKeywordDTO
>
keywords
,
String
robotId
,
String
weixinGroupId
,
String
ip
)
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setGroupId
(
weixinGroupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
if
(
ListUtils
.
isEmpty
(
keywords
))
{
if
(
ListUtils
.
isEmpty
(
keywords
))
{
return
;
return
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/vo/GroupQrcodeBaseInfoVO.java
View file @
25a952fd
...
@@ -5,11 +5,13 @@ import com.fasterxml.jackson.annotation.JsonInclude;
...
@@ -5,11 +5,13 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
/**
* @author lily
* @author lily
* @date 2019/5/6 16:08
* @date 2019/5/6 16:08
*/
*/
@Data
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
GroupQrcodeBaseInfoVO
implements
Serializable
{
public
class
GroupQrcodeBaseInfoVO
implements
Serializable
{
...
@@ -22,36 +24,7 @@ public class GroupQrcodeBaseInfoVO implements Serializable {
...
@@ -22,36 +24,7 @@ public class GroupQrcodeBaseInfoVO implements Serializable {
@ApiModelProperty
(
"二维码地址"
)
@ApiModelProperty
(
"二维码地址"
)
private
String
qrcodeUrl
;
private
String
qrcodeUrl
;
public
Long
getGroupQrcodeId
()
{
@ApiModelProperty
(
value
=
"二维码地址"
,
hidden
=
true
)
return
groupQrcodeId
;
private
String
weixinGroupId
;
}
public
void
setGroupQrcodeId
(
Long
groupQrcodeId
)
{
this
.
groupQrcodeId
=
groupQrcodeId
;
}
public
String
getGroupName
()
{
return
groupName
;
}
public
void
setGroupName
(
String
groupName
)
{
this
.
groupName
=
groupName
;
}
public
String
getQrcodeUrl
()
{
return
qrcodeUrl
;
}
public
void
setQrcodeUrl
(
String
qrcodeUrl
)
{
this
.
qrcodeUrl
=
qrcodeUrl
;
}
@Override
public
String
toString
()
{
return
"GroupQrcodeBaseInfoVO{"
+
"groupQrcodeId="
+
groupQrcodeId
+
", groupName='"
+
groupName
+
'\''
+
", qrcodeUrl='"
+
qrcodeUrl
+
'\''
+
'}'
;
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/BookGuideBiz.java
View file @
25a952fd
...
@@ -5,6 +5,7 @@ import com.pcloud.book.keywords.vo.GuideVO;
...
@@ -5,6 +5,7 @@ import com.pcloud.book.keywords.vo.GuideVO;
import
com.pcloud.book.keywords.vo.ReplyMessageVO
;
import
com.pcloud.book.keywords.vo.ReplyMessageVO
;
import
com.pcloud.book.keywords.vo.SetGuideVO
;
import
com.pcloud.book.keywords.vo.SetGuideVO
;
import
com.pcloud.book.keywords.vo.UpdateGuideVO
;
import
com.pcloud.book.keywords.vo.UpdateGuideVO
;
import
com.pcloud.wechatgroup.message.dto.AgreeAddUserDTO
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -14,6 +15,11 @@ import java.util.Map;
...
@@ -14,6 +15,11 @@ import java.util.Map;
* @date 2019/4/23 15:46
* @date 2019/4/23 15:46
*/
*/
public
interface
BookGuideBiz
{
public
interface
BookGuideBiz
{
/**
* 同意加好友发送欢迎语
*/
void
sendGuide
(
AgreeAddUserDTO
agreeAddUserDTO
);
/**
/**
* @Author:lili
* @Author:lili
* @Desr:新增欢迎语
* @Desr:新增欢迎语
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/BookKeywordBiz.java
View file @
25a952fd
...
@@ -6,6 +6,7 @@ import com.pcloud.book.keywords.dto.ReplyKeywordDTO;
...
@@ -6,6 +6,7 @@ import com.pcloud.book.keywords.dto.ReplyKeywordDTO;
import
com.pcloud.book.keywords.dto.ServiceResourceDTO
;
import
com.pcloud.book.keywords.dto.ServiceResourceDTO
;
import
com.pcloud.book.keywords.vo.*
;
import
com.pcloud.book.keywords.vo.*
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
java.util.List
;
import
java.util.List
;
...
@@ -70,7 +71,7 @@ public interface BookKeywordBiz {
...
@@ -70,7 +71,7 @@ public interface BookKeywordBiz {
* @Desr: 回复关键词消息
* @Desr: 回复关键词消息
* @Date:2019/5/5 16:28
* @Date:2019/5/5 16:28
*/
*/
void
sendKeywordMessage
(
String
content
,
String
weixinGroupId
,
String
userWxId
,
String
robotId
,
String
ip
);
void
sendKeywordMessage
(
String
content
,
String
weixinGroupId
,
String
userWxId
,
String
robotId
,
String
ip
,
Integer
code
);
/**
/**
* 关键词统计
* 关键词统计
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/BookGuideBizImpl.java
View file @
25a952fd
...
@@ -13,13 +13,16 @@ import com.pcloud.book.group.dao.AppTouchRecordDao;
...
@@ -13,13 +13,16 @@ import com.pcloud.book.group.dao.AppTouchRecordDao;
import
com.pcloud.book.group.dao.BookGroupClassifyDao
;
import
com.pcloud.book.group.dao.BookGroupClassifyDao
;
import
com.pcloud.book.group.dao.BookGroupDao
;
import
com.pcloud.book.group.dao.BookGroupDao
;
import
com.pcloud.book.group.dao.GroupQrcodeDao
;
import
com.pcloud.book.group.dao.GroupQrcodeDao
;
import
com.pcloud.book.group.dao.JoinGroupCipherDao
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.dto.GroupClassifyQrcodeDTO
;
import
com.pcloud.book.group.dto.GroupClassifyQrcodeDTO
;
import
com.pcloud.book.group.dto.JoinGroupCiperDTO
;
import
com.pcloud.book.group.dto.PushAddUserMessageDTO
;
import
com.pcloud.book.group.dto.PushAddUserMessageDTO
;
import
com.pcloud.book.group.entity.AppTouchRecord
;
import
com.pcloud.book.group.entity.AppTouchRecord
;
import
com.pcloud.book.group.entity.GroupQrcode
;
import
com.pcloud.book.group.entity.GroupQrcode
;
import
com.pcloud.book.group.enums.TouchTypeEnum
;
import
com.pcloud.book.group.enums.TouchTypeEnum
;
import
com.pcloud.book.group.tools.SendWeixinRequestTools
;
import
com.pcloud.book.group.tools.SendWeixinRequestTools
;
import
com.pcloud.book.group.vo.GroupQrcode4ClassifyVO
;
import
com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO
;
import
com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO
;
import
com.pcloud.book.keywords.biz.BookGuideBiz
;
import
com.pcloud.book.keywords.biz.BookGuideBiz
;
import
com.pcloud.book.keywords.biz.BookKeywordBiz
;
import
com.pcloud.book.keywords.biz.BookKeywordBiz
;
...
@@ -37,7 +40,14 @@ import com.pcloud.book.keywords.vo.UpdateGuideVO;
...
@@ -37,7 +40,14 @@ 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.sdk.wxgroup.AddToGroupVO
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -87,6 +97,48 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -87,6 +97,48 @@ public class BookGuideBizImpl implements BookGuideBiz {
private
GroupQrcodeDao
groupQrcodeDao
;
private
GroupQrcodeDao
groupQrcodeDao
;
@Autowired
@Autowired
private
BookGroupClassifyDao
bookGroupClassifyDao
;
private
BookGroupClassifyDao
bookGroupClassifyDao
;
@Autowired
private
JoinGroupCipherDao
joinGroupCipherDao
;
@ParamLog
(
"同意加好友发送欢迎语"
)
@Override
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
();
vo
.
setContent
(
"你好,我是本书智能小助手,请回复你的进群暗号,获取本书资源服务,以及入群链接如果忘了进群暗号,请重新扫描书上的二维码,点击入群即可获取"
);
vo
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
vo
.
setWxId
(
agreeAddUserDTO
.
getRobotWxId
());
vo
.
setAltId
(
agreeAddUserDTO
.
getRobotWxId
());
vo
.
setWxGroupId
(
agreeAddUserDTO
.
getUserWxId
());
vo
.
setIp
(
agreeAddUserDTO
.
getIp
());
log
.
info
(
"[同意加好友发送欢迎语] : {}"
,
vo
);
WxGroupSDK
.
sendTextMessage
(
vo
);
// 根据暗号获取分类id和bookGroupId推送关键词欢迎语
final
JoinGroupCiperDTO
dto
=
joinGroupCipherDao
.
getDTOByCipher
(
cipher
);
List
<
KeywordDTO
>
keywords
=
bookKeywordBiz
.
listFiveKeyword
(
dto
.
getClassifyId
(),
dto
.
getBookGroupId
());
SendWeixinRequestTools
.
sendKeywordsInfo
(
keywords
,
agreeAddUserDTO
.
getRobotWxId
(),
agreeAddUserDTO
.
getUserWxId
(),
agreeAddUserDTO
.
getIp
());
// 拉群
final
String
wxGroupId
=
bookGroupClassifyBiz
.
getWxGroupIdByClassifyIdAndWechatId
(
dto
.
getClassifyId
(),
dto
.
getWechatUserId
());
if
(
StringUtil
.
isBlank
(
wxGroupId
))
{
log
.
info
(
"[同意加好友发送欢迎语] 拉群 没有找到群 bookGroupClassifyBiz.getGroupQrcode4ClassifyWechat JoinGroupCiperDTO :{}"
,
dto
);
return
;
}
AddToGroupVO
vo1
=
new
AddToGroupVO
();
vo1
.
setWxGroupId
(
wxGroupId
);
vo1
.
setWxId
(
agreeAddUserDTO
.
getUserWxId
());
vo1
.
setAltId
(
agreeAddUserDTO
.
getRobotWxId
());
vo1
.
setIp
(
agreeAddUserDTO
.
getIp
());
log
.
info
(
"[同意加好友发送欢迎语 拉群] AddToGroupVO :{}"
,
vo1
);
WxGroupSDK
.
addToGroup
(
vo1
);
}
@Override
@Override
@ParamLog
(
"新增欢迎语"
)
@ParamLog
(
"新增欢迎语"
)
...
@@ -223,33 +275,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -223,33 +275,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
log
.
info
(
"[关键词消息回复] robotId is null robotId:{},weixinGroupId:{}"
,
robotId
,
weixinGroupId
);
log
.
info
(
"[关键词消息回复] robotId is null robotId:{},weixinGroupId:{}"
,
robotId
,
weixinGroupId
);
robotId
=
wechatGroupConsr
.
getRobotIdByGroupId
(
weixinGroupId
);
robotId
=
wechatGroupConsr
.
getRobotIdByGroupId
(
weixinGroupId
);
}
}
//String robotId = "wxid_e6zsl8oohcnl22";
// 判断是否需要发送
// boolean canSend = false;
// // 查看群成员
// GroupInfoVO groupInfoVO = WxGroupSDK.getGroupInfo(weixinGroupId, robotId);
// log.info("[查看群成员] : groupInfoVO:{}",groupInfoVO);
// if (!CollectionUtils.isEmpty(groupInfoVO.getIdList())) {
// // 查看该用户weixinid
// final List<String> nickName = wechatGroupConsr.getWxUserIdsByNickName(pushAddUserMessageDTO.getNickName());
// log.info("[查看该用户weixinid] : nickName:{}",nickName);
// if(!CollectionUtils.isEmpty(nickName)) {
// final Map<String, Boolean> map = Maps.newHashMap();
// for (String s : groupInfoVO.getIdList()) {
// map.put(s, true);
// }
// for (String s : nickName) {
// if (null != map.get(s) && map.get(s)) {
// // 若在群设置true
// canSend = true;
// break;
// }
// }
// }
// }
// 判断是否黑名单
// 判断是否黑名单
final
Boolean
kickUser
=
wechatGroupConsr
.
isKickUser
(
pushAddUserMessageDTO
.
getNickName
(),
weixinGroupId
);
final
Boolean
kickUser
=
wechatGroupConsr
.
isKickUser
(
pushAddUserMessageDTO
.
getNickName
(),
weixinGroupId
);
// log.info("[推送欢迎语消息]:pushAddUserMessageDTO:{},kickUser:{},canSend:{}", pushAddUserMessageDTO, kickUser,canSend);
log
.
info
(
"[推送欢迎语消息]:pushAddUserMessageDTO:{},kickUser:{}"
,
pushAddUserMessageDTO
,
kickUser
);
log
.
info
(
"[推送欢迎语消息]:pushAddUserMessageDTO:{},kickUser:{}"
,
pushAddUserMessageDTO
,
kickUser
);
// 在群,且非黑名单
// 在群,且非黑名单
// canSend = canSend && !kickUser;
// canSend = canSend && !kickUser;
...
@@ -265,24 +292,25 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -265,24 +292,25 @@ public class BookGuideBizImpl implements BookGuideBiz {
}
}
//获取公众号基本信息
//获取公众号基本信息
AccountSettingDto
wechatInfo
=
qrcodeSceneConsr
.
getWechatInfo
(
classifyQrcodeInfo
.
getChannelId
());
AccountSettingDto
wechatInfo
=
qrcodeSceneConsr
.
getWechatInfo
(
classifyQrcodeInfo
.
getChannelId
());
//获取关键词信息(改成10个了)
//获取关键词信息(改成10个了)
刘娜需求 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);
if
(
ListUtils
.
isEmpty
(
replyMessages
))
{
if
(
ListUtils
.
isEmpty
(
replyMessages
))
{
//获取群名称
//获取群名称
GroupQrcodeBaseInfoVO
groupInfo
=
groupQrcodeBiz
.
getBaseById
(
classifyQrcodeInfo
.
getGroupQrcodeId
());
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, pushAddUserMessageDTO.getIp());
SendWeixinRequestTools
.
sendDefaultMessage
(
groupInfo
==
null
?
""
:
groupInfo
.
getGroupName
(),
robotId
,
weixinGroupId
,
false
,
pushAddUserMessageDTO
.
getIp
());
}
else
{
}
else
{
//处理链接
//处理链接
handleUrl
(
replyMessages
,
wechatInfo
,
classifyQrcodeInfo
);
handleUrl
(
replyMessages
,
wechatInfo
,
classifyQrcodeInfo
);
//推送消息
//推送消息
SendWeixinRequestTools
.
sendGuideMessage
(
replyMessages
,
robotId
,
weixinGroupId
,
pushAddUserMessageDTO
.
getIp
());
SendWeixinRequestTools
.
sendGuideMessage
(
replyMessages
,
robotId
,
weixinGroupId
,
pushAddUserMessageDTO
.
getIp
()
,
SendMessageTypeEnum
.
GROUP
.
getCode
()
);
//新增欢迎语应用触发记录
//新增欢迎语应用触发记录
addGuideAppTouchRecord
(
replyMessages
,
weixinGroupId
,
classifyQrcodeInfo
.
getBookGroupId
(),
classifyQrcodeInfo
.
getClassifyId
());
addGuideAppTouchRecord
(
replyMessages
,
weixinGroupId
,
classifyQrcodeInfo
.
getBookGroupId
(),
classifyQrcodeInfo
.
getClassifyId
());
}
}
//获取关键词信息(改成10个了)
//获取关键词信息(改成10个了)
刘娜需求 1001282 群不推送关键词
SendWeixinRequestTools
.
sendKeywordsInfo
(
keywords
,
robotId
,
weixinGroupId
,
pushAddUserMessageDTO
.
getIp
());
//
SendWeixinRequestTools.sendKeywordsInfo(keywords, robotId, weixinGroupId, pushAddUserMessageDTO.getIp());
//如果设置了群学习报告,加一个群学习报告的关键词
//如果设置了群学习报告,加一个群学习报告的关键词
pushLearningReport
(
classifyQrcodeInfo
,
robotId
,
weixinGroupId
,
pushAddUserMessageDTO
.
getIp
());
pushLearningReport
(
classifyQrcodeInfo
,
robotId
,
weixinGroupId
,
pushAddUserMessageDTO
.
getIp
());
if
(
bookGuide
!=
null
&&
bookGuide
.
getIsRecommend
()
!=
null
&&
bookGuide
.
getIsRecommend
()
==
1
)
{
if
(
bookGuide
!=
null
&&
bookGuide
.
getIsRecommend
()
!=
null
&&
bookGuide
.
getIsRecommend
()
==
1
)
{
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/BookKeywordBizImpl.java
View file @
25a952fd
...
@@ -53,6 +53,7 @@ import com.pcloud.common.utils.string.StringUtil;
...
@@ -53,6 +53,7 @@ import com.pcloud.common.utils.string.StringUtil;
import
com.pcloud.resourcecenter.product.dto.ProductDto
;
import
com.pcloud.resourcecenter.product.dto.ProductDto
;
import
com.pcloud.resourcecenter.product.dto.ProductTypeDto
;
import
com.pcloud.resourcecenter.product.dto.ProductTypeDto
;
import
com.pcloud.wechatgroup.group.dto.RobotReplyDTO
;
import
com.pcloud.wechatgroup.group.dto.RobotReplyDTO
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
...
@@ -411,11 +412,73 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -411,11 +412,73 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
@Override
@Override
@ParamLog
(
"关键词消息回复"
)
@ParamLog
(
"关键词消息回复"
)
public
void
sendKeywordMessage
(
String
content
,
String
weixinGroupId
,
String
userWxId
,
String
robotId
,
String
ip
)
{
public
void
sendKeywordMessage
(
String
content
,
String
weixinGroupId
,
String
userWxId
,
String
robotId
,
String
ip
,
Integer
code
)
{
// 刘娜需求 1001282 群不推送关键词
if
(
SendMessageTypeEnum
.
GROUP
.
getCode
().
equals
(
code
))
{
this
.
sendKeywordMessageToGroup
(
content
,
weixinGroupId
,
userWxId
,
robotId
,
ip
,
code
);
return
;
}
//简单过滤非关键词的词
if
(
StringUtil
.
isEmpty
(
content
)
||
content
.
length
()
>
20
)
{
return
;
}
//通过群id获取对应基本信息
GroupClassifyQrcodeDTO
classifyQrcodeInfo
=
bookGroupClassifyBiz
.
getClassifyQrcodeInfo
(
weixinGroupId
);
if
(
classifyQrcodeInfo
==
null
)
{
log
.
info
(
"[关键词消息回复] classifyQrcodeInfo is null"
);
return
;
}
ReplyKeywordDTO
replyKeywordDTO
;
//获取匹配关键词
replyKeywordDTO
=
bookKeywordDao
.
getKeywordId
(
classifyQrcodeInfo
.
getClassifyId
(),
classifyQrcodeInfo
.
getBookGroupId
(),
content
);
if
(
replyKeywordDTO
==
null
)
{
log
.
info
(
"[关键词消息回复] replyKeywordDTO is null"
);
return
;
}
log
.
info
(
"[关键词回复原始数据] : sendKeywordMessage replyKeywordDTO :{}, robotId:{}, weixinGroupId:{}"
,
replyKeywordDTO
,
robotId
,
weixinGroupId
);
// 处理链接地址
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
replyKeywordDTO
.
getReplyType
())
||
ReplyTypeEnum
.
LINK
.
value
.
equals
(
replyKeywordDTO
.
getReplyType
()))
{
AccountSettingDto
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
classifyQrcodeInfo
.
getChannelId
());
String
linkUrl
=
SendWeixinRequestTools
.
splitUrlNew
(
accountSettingDto
,
replyKeywordDTO
.
getLinkUrl
(),
classifyQrcodeInfo
.
getBookGroupId
(),
classifyQrcodeInfo
.
getClassifyId
(),
classifyQrcodeInfo
.
getGroupQrcodeId
());
replyKeywordDTO
.
setLinkUrl
(
linkUrl
);
}
String
redisContent
=
JedisClusterUtils
.
getJson
(
"BOOK:KEYWORD:"
+
weixinGroupId
+
"-"
+
replyKeywordDTO
.
getKeywordId
(),
String
.
class
);
// 同一群10秒内不回复同一关键词
if
(
redisContent
!=
null
)
{
insertBookKeywordRecord
(
classifyQrcodeInfo
,
replyKeywordDTO
.
getKeywordId
(),
userWxId
,
weixinGroupId
,
false
);
log
.
info
(
"[关键词消息回复] redisContent:{} insertBookKeywordRecord return"
,
redisContent
);
return
;
}
else
{
JedisClusterUtils
.
setJson
(
"BOOK:KEYWORD:"
+
weixinGroupId
+
"-"
+
replyKeywordDTO
.
getKeywordId
(),
replyKeywordDTO
.
getKeywordId
(),
10
);
insertBookKeywordRecord
(
classifyQrcodeInfo
,
replyKeywordDTO
.
getKeywordId
(),
userWxId
,
weixinGroupId
,
true
);
}
//获取推送消息机器人
// 20190704改为收发一体
if
(
StringUtil
.
isBlank
(
robotId
))
{
log
.
info
(
"[关键词消息回复] robotId is null content:{}, robotId:{},weixinGroupId:{}"
,
content
,
robotId
,
weixinGroupId
);
robotId
=
wechatGroupConsr
.
getRobotIdByGroupId
(
weixinGroupId
);
}
log
.
info
(
"[关键词回复发送数据] : sendKeywordMessage replyKeywordDTO :{}, robotId:{}, weixinGroupId:{}"
,
replyKeywordDTO
,
robotId
,
weixinGroupId
);
SendWeixinRequestTools
.
sendKeywordMessage
(
replyKeywordDTO
,
robotId
,
weixinGroupId
,
ip
,
code
);
//新增关键词触发记录
addKeywordAppTouchRecord
(
replyKeywordDTO
,
weixinGroupId
,
classifyQrcodeInfo
.
getClassifyId
(),
classifyQrcodeInfo
.
getBookGroupId
());
}
/**
* 原有的推送群关键词改为推送个人关键词
*/
@ParamLog
(
"群关键词消息回复"
)
private
void
sendKeywordMessageToGroup
(
String
content
,
String
weixinGroupId
,
String
userWxId
,
String
robotId
,
String
ip
,
Integer
code
)
{
//简单过滤非关键词的词
//简单过滤非关键词的词
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
)
{
...
@@ -458,7 +521,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -458,7 +521,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
robotId
=
wechatGroupConsr
.
getRobotIdByGroupId
(
weixinGroupId
);
robotId
=
wechatGroupConsr
.
getRobotIdByGroupId
(
weixinGroupId
);
}
}
log
.
info
(
"[关键词回复发送数据] : sendKeywordMessage replyKeywordDTO :{}, robotId:{}, weixinGroupId:{}"
,
replyKeywordDTO
,
robotId
,
weixinGroupId
);
log
.
info
(
"[关键词回复发送数据] : sendKeywordMessage replyKeywordDTO :{}, robotId:{}, weixinGroupId:{}"
,
replyKeywordDTO
,
robotId
,
weixinGroupId
);
SendWeixinRequestTools
.
sendKeywordMessage
(
replyKeywordDTO
,
robotId
,
weixinGroupId
,
ip
);
SendWeixinRequestTools
.
sendKeywordMessage
(
replyKeywordDTO
,
robotId
,
weixinGroupId
,
ip
,
code
);
//新增关键词触发记录
//新增关键词触发记录
addKeywordAppTouchRecord
(
replyKeywordDTO
,
weixinGroupId
,
classifyQrcodeInfo
.
getClassifyId
(),
classifyQrcodeInfo
.
getBookGroupId
());
addKeywordAppTouchRecord
(
replyKeywordDTO
,
weixinGroupId
,
classifyQrcodeInfo
.
getClassifyId
(),
classifyQrcodeInfo
.
getBookGroupId
());
//第一推送关键词消息埋点
//第一推送关键词消息埋点
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/facade/impl/BookGuideFacadeImpl.java
View file @
25a952fd
...
@@ -6,12 +6,15 @@ import com.pcloud.book.keywords.vo.GuideVO;
...
@@ -6,12 +6,15 @@ import com.pcloud.book.keywords.vo.GuideVO;
import
com.pcloud.book.keywords.vo.ReplyMessageVO
;
import
com.pcloud.book.keywords.vo.ReplyMessageVO
;
import
com.pcloud.book.keywords.vo.SetGuideVO
;
import
com.pcloud.book.keywords.vo.SetGuideVO
;
import
com.pcloud.book.keywords.vo.UpdateGuideVO
;
import
com.pcloud.book.keywords.vo.UpdateGuideVO
;
import
com.pcloud.common.core.constant.MQTopicProducer
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.common.utils.SessionUtil
;
import
com.pcloud.common.utils.SessionUtil
;
import
com.pcloud.wechatgroup.message.dto.AgreeAddUserDTO
;
import
org.springframework.amqp.core.AmqpTemplate
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
@@ -26,16 +29,34 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -26,16 +29,34 @@ import org.springframework.web.bind.annotation.RestController;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
lombok.extern.slf4j.Slf4j
;
/**
/**
* @author lily
* @author lily
* @date 2019/4/23 15:24
* @date 2019/4/23 15:24
*/
*/
@Slf4j
@RestController
(
"bookGuideFacade"
)
@RestController
(
"bookGuideFacade"
)
@RequestMapping
(
"bookGuide"
)
@RequestMapping
(
"bookGuide"
)
public
class
BookGuideFacadeImpl
implements
BookGuideFacade
{
public
class
BookGuideFacadeImpl
implements
BookGuideFacade
{
@Autowired
@Autowired
private
BookGuideBiz
bookGuidBiz
;
private
BookGuideBiz
bookGuidBiz
;
@Autowired
private
AmqpTemplate
amqpTemplate
;
@PostMapping
(
"test"
)
public
void
test
()
{
final
AgreeAddUserDTO
agreeAddUserDTO
=
new
AgreeAddUserDTO
();
agreeAddUserDTO
.
setNickName
(
"大威"
);
agreeAddUserDTO
.
setRobotWxId
(
"wxid_arjobo1bbk2i22"
);
// 当消息为个人消息时,wechatGroupId为发送人id
agreeAddUserDTO
.
setUserWxId
(
"p867263500"
);
agreeAddUserDTO
.
setIp
(
"http://192.168.92.122:8081"
);
log
.
info
(
"[processSelfMessage] start convertAndSend agreeAddUserDTO:{}"
,
agreeAddUserDTO
);
// 发送topic book处理后续欢迎语,关键词和拉群操作
amqpTemplate
.
convertAndSend
(
MQTopicProducer
.
EXCHAGE
,
MQTopicProducer
.
WX_AGREE_ADD_USER
,
agreeAddUserDTO
);
}
@Override
@Override
@PostMapping
(
"insertGuide"
)
@PostMapping
(
"insertGuide"
)
...
...
pcloud-service-book/src/main/java/com/pcloud/book/mq/config/MQTopicConumer.java
View file @
25a952fd
...
@@ -70,4 +70,9 @@ public class MQTopicConumer {
...
@@ -70,4 +70,9 @@ public class MQTopicConumer {
*/
*/
public
static
final
String
WXGROUP_LEARNING_REPORT
=
PREFIX
+
MQTopicProducer
.
WXGROUP_LEARNING_REPORT
;
public
static
final
String
WXGROUP_LEARNING_REPORT
=
PREFIX
+
MQTopicProducer
.
WXGROUP_LEARNING_REPORT
;
/**
* 微信群同意添加好友成功
*/
public
static
final
String
WX_AGREE_ADD_USER
=
PREFIX
+
MQTopicProducer
.
WX_AGREE_ADD_USER
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/mq/topic/UpdateWXGroupNameListener.java
View file @
25a952fd
...
@@ -67,7 +67,7 @@ public class UpdateWXGroupNameListener {
...
@@ -67,7 +67,7 @@ public class UpdateWXGroupNameListener {
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
"@"
+
groupNameDTO
.
getNickName
()+
",为方便群友入群分享好的助学方法,请不要随意修改群名。如再修改,会将您移出群聊。谢谢配合。"
);
sendTextMessageVO
.
setContent
(
"@"
+
groupNameDTO
.
getNickName
()+
",为方便群友入群分享好的助学方法,请不要随意修改群名。如再修改,会将您移出群聊。谢谢配合。"
);
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setGroupId
(
wechatGroupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
wechatGroupId
);
LOGGER
.
info
(
"发送警告文本消息"
+
sendTextMessageVO
.
toString
());
LOGGER
.
info
(
"发送警告文本消息"
+
sendTextMessageVO
.
toString
());
sendTextMessageVO
.
setIp
(
findIp
(
wechatGroupId
));
sendTextMessageVO
.
setIp
(
findIp
(
wechatGroupId
));
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/mq/topic/WXGroupLearningReportListener.java
View file @
25a952fd
...
@@ -25,6 +25,7 @@ import com.pcloud.wechatgroup.message.dto.GroupLearningReportDTO;
...
@@ -25,6 +25,7 @@ import com.pcloud.wechatgroup.message.dto.GroupLearningReportDTO;
import
com.sdk.wxgroup.SendPicMessageVO
;
import
com.sdk.wxgroup.SendPicMessageVO
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.amqp.rabbit.annotation.RabbitHandler
;
import
org.springframework.amqp.rabbit.annotation.RabbitHandler
;
...
@@ -63,8 +64,9 @@ public class WXGroupLearningReportListener {
...
@@ -63,8 +64,9 @@ public class WXGroupLearningReportListener {
try
{
try
{
if
(
groupLearningReportDTO
==
null
if
(
groupLearningReportDTO
==
null
||
groupLearningReportDTO
.
getWechatGroupId
()
==
null
||
groupLearningReportDTO
.
getWechatGroupId
()
==
null
||
groupLearningReportDTO
.
getWechatUserId
()
==
null
)
||
groupLearningReportDTO
.
getWechatUserId
()
==
null
)
{
return
;
return
;
}
String
wechatUserId
=
groupLearningReportDTO
.
getWechatUserId
();
String
wechatUserId
=
groupLearningReportDTO
.
getWechatUserId
();
String
wechatGroupId
=
groupLearningReportDTO
.
getWechatGroupId
();
String
wechatGroupId
=
groupLearningReportDTO
.
getWechatGroupId
();
//新增触发记录
//新增触发记录
...
@@ -102,7 +104,7 @@ public class WXGroupLearningReportListener {
...
@@ -102,7 +104,7 @@ public class WXGroupLearningReportListener {
return
;
return
;
}
}
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setGroupId
(
wechatGroupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
wechatGroupId
);
sendTextMessageVO
.
setAltId
(
alt
);
sendTextMessageVO
.
setAltId
(
alt
);
sendTextMessageVO
.
setContent
(
"个人专属学习报告,及群成员元气排行榜。点击获取"
+
resultUrl
);
sendTextMessageVO
.
setContent
(
"个人专属学习报告,及群成员元气排行榜。点击获取"
+
resultUrl
);
sendTextMessageVO
.
setIp
(
findIp
(
wechatGroupId
));
sendTextMessageVO
.
setIp
(
findIp
(
wechatGroupId
));
...
@@ -115,7 +117,7 @@ public class WXGroupLearningReportListener {
...
@@ -115,7 +117,7 @@ public class WXGroupLearningReportListener {
}
}
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setPicUrl
(
imageUrl
);
sendPicMessageVO
.
setPicUrl
(
imageUrl
);
sendPicMessageVO
.
setGroupId
(
wechatGroupId
);
sendPicMessageVO
.
set
Wx
GroupId
(
wechatGroupId
);
sendPicMessageVO
.
setAltId
(
alt
);
sendPicMessageVO
.
setAltId
(
alt
);
sendPicMessageVO
.
setIp
(
findIp
(
wechatGroupId
));
sendPicMessageVO
.
setIp
(
findIp
(
wechatGroupId
));
LOGGER
.
info
(
"发送分享图消息开始"
+
sendPicMessageVO
.
toString
());
LOGGER
.
info
(
"发送分享图消息开始"
+
sendPicMessageVO
.
toString
());
...
...
pcloud-service-book/src/main/java/com/pcloud/book/mq/topic/WxAgreeAddUserListener.java
0 → 100644
View file @
25a952fd
package
com
.
pcloud
.
book
.
mq
.
topic
;
import
com.pcloud.book.keywords.biz.BookGuideBiz
;
import
com.pcloud.book.mq.config.MQTopicConumer
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.wechatgroup.message.dto.AgreeAddUserDTO
;
import
org.springframework.amqp.rabbit.annotation.RabbitHandler
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
lombok.extern.slf4j.Slf4j
;
/**
* @author lily
* @date 2019/5/6 11:01
*/
@Slf4j
@Component
public
class
WxAgreeAddUserListener
{
@Resource
private
BookGuideBiz
bookGuideBiz
;
/**
* 接收微信用户进群消息
*/
@ParamLog
(
"同意加好友发送欢迎语"
)
@RabbitListener
(
queues
=
MQTopicConumer
.
WX_AGREE_ADD_USER
)
public
void
onMessage
(
AgreeAddUserDTO
agreeAddUserDTO
)
throws
BizException
{
try
{
bookGuideBiz
.
sendGuide
(
agreeAddUserDTO
);
}
catch
(
Exception
e
)
{
log
.
error
(
"同意加好友发送欢迎语"
+
e
.
getMessage
(),
e
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/mq/topic/WxGroupSendTextListener.java
View file @
25a952fd
...
@@ -11,6 +11,7 @@ import com.pcloud.common.exceptions.BizException;
...
@@ -11,6 +11,7 @@ import com.pcloud.common.exceptions.BizException;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.wechatgroup.message.dto.SendTextDTO
;
import
com.pcloud.wechatgroup.message.dto.SendTextDTO
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -59,9 +60,9 @@ public class WxGroupSendTextListener {
...
@@ -59,9 +60,9 @@ public class WxGroupSendTextListener {
BookClockInfoDTO
bookClockInfoDTO
=
bookClockCheck
.
checkKeywordIsClock
(
sendTextDTO
.
getTextContent
().
trim
(),
sendTextDTO
.
getWechatGroupId
());
BookClockInfoDTO
bookClockInfoDTO
=
bookClockCheck
.
checkKeywordIsClock
(
sendTextDTO
.
getTextContent
().
trim
(),
sendTextDTO
.
getWechatGroupId
());
if
(
null
!=
bookClockInfoDTO
){
if
(
null
!=
bookClockInfoDTO
){
bookClockKeywordBiz
.
sendKeywordMessage
(
bookClockInfoDTO
,
wechatUserId
,
sendTextDTO
.
getWechatGroupId
(),
sendTextDTO
.
getWxId
(),
sendTextDTO
.
getIp
());
bookClockKeywordBiz
.
sendKeywordMessage
(
bookClockInfoDTO
,
wechatUserId
,
sendTextDTO
.
getWechatGroupId
(),
sendTextDTO
.
getWxId
(),
sendTextDTO
.
getIp
());
}
else
{
}
else
{
final
long
l
=
System
.
currentTimeMillis
();
final
long
l
=
System
.
currentTimeMillis
();
bookKeywordBiz
.
sendKeywordMessage
(
sendTextDTO
.
getTextContent
().
trim
(),
sendTextDTO
.
getWechatGroupId
(),
wechatUserId
,
sendTextDTO
.
getWxId
(),
sendTextDTO
.
getIp
());
bookKeywordBiz
.
sendKeywordMessage
(
sendTextDTO
.
getTextContent
().
trim
(),
sendTextDTO
.
getWechatGroupId
(),
wechatUserId
,
sendTextDTO
.
getWxId
(),
sendTextDTO
.
getIp
()
,
sendTextDTO
.
getCode
()
);
log
.
info
(
"[接收用户发送文本消息] 总耗时:{}ms "
,
System
.
currentTimeMillis
()
-
l
);
log
.
info
(
"[接收用户发送文本消息] 总耗时:{}ms "
,
System
.
currentTimeMillis
()
-
l
);
}
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/push/biz/impl/PushBizImpl.java
View file @
25a952fd
...
@@ -320,7 +320,7 @@ public class PushBizImpl implements PushBiz {
...
@@ -320,7 +320,7 @@ public class PushBizImpl implements PushBiz {
Integer
itemType
=
pushItem
.
getItemType
();
Integer
itemType
=
pushItem
.
getItemType
();
if
(
ItemTypeEnum
.
TEXT
.
value
.
equals
(
itemType
))
{
if
(
ItemTypeEnum
.
TEXT
.
value
.
equals
(
itemType
))
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setGroupId
(
groupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
groupId
);
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setContent
(
pushItem
.
getTextContent
());
sendTextMessageVO
.
setContent
(
pushItem
.
getTextContent
());
sendTextMessageVO
.
setPushGroupRecordId
(
pushGroupRecordId
);
sendTextMessageVO
.
setPushGroupRecordId
(
pushGroupRecordId
);
...
@@ -331,7 +331,7 @@ public class PushBizImpl implements PushBiz {
...
@@ -331,7 +331,7 @@ public class PushBizImpl implements PushBiz {
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
sendArticleMessageVO
.
setAltId
(
altId
);
sendArticleMessageVO
.
setAltId
(
altId
);
sendArticleMessageVO
.
setDescription
(
pushItem
.
getLinkDescription
());
sendArticleMessageVO
.
setDescription
(
pushItem
.
getLinkDescription
());
sendArticleMessageVO
.
setGroupId
(
groupId
);
sendArticleMessageVO
.
set
Wx
GroupId
(
groupId
);
String
url
=
pushItem
.
getLinkUrl
();
String
url
=
pushItem
.
getLinkUrl
();
if
(
url
.
contains
(
"?"
))
{
if
(
url
.
contains
(
"?"
))
{
url
=
url
+
"&"
+
otherUrl
;
url
=
url
+
"&"
+
otherUrl
;
...
@@ -359,7 +359,7 @@ public class PushBizImpl implements PushBiz {
...
@@ -359,7 +359,7 @@ public class PushBizImpl implements PushBiz {
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
sendArticleMessageVO
.
setAltId
(
altId
);
sendArticleMessageVO
.
setAltId
(
altId
);
sendArticleMessageVO
.
setDescription
(
appDto
.
getTypeName
());
sendArticleMessageVO
.
setDescription
(
appDto
.
getTypeName
());
sendArticleMessageVO
.
setGroupId
(
groupId
);
sendArticleMessageVO
.
set
Wx
GroupId
(
groupId
);
// 处理链接地址
// 处理链接地址
String
endUrl
=
pushItem
.
getAppUrl
()
+
"&"
+
otherUrl
;
String
endUrl
=
pushItem
.
getAppUrl
()
+
"&"
+
otherUrl
;
String
linkUrl
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
endUrl
);
String
linkUrl
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
endUrl
);
...
@@ -381,7 +381,7 @@ public class PushBizImpl implements PushBiz {
...
@@ -381,7 +381,7 @@ public class PushBizImpl implements PushBiz {
if
(
productDto
.
getProductTypeDto
()
!=
null
)
{
if
(
productDto
.
getProductTypeDto
()
!=
null
)
{
sendArticleMessageVO
.
setDescription
(
productDto
.
getProductTypeDto
().
getTypeName
());
sendArticleMessageVO
.
setDescription
(
productDto
.
getProductTypeDto
().
getTypeName
());
}
}
sendArticleMessageVO
.
setGroupId
(
groupId
);
sendArticleMessageVO
.
set
Wx
GroupId
(
groupId
);
// 处理链接地址
// 处理链接地址
String
endUrl
=
pushItem
.
getProductUrl
()
+
"&"
+
otherUrl
;
String
endUrl
=
pushItem
.
getProductUrl
()
+
"&"
+
otherUrl
;
String
linkUrl
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
endUrl
);
String
linkUrl
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
endUrl
);
...
@@ -399,7 +399,7 @@ public class PushBizImpl implements PushBiz {
...
@@ -399,7 +399,7 @@ public class PushBizImpl implements PushBiz {
if
(
ItemTypeEnum
.
IMAGE
.
value
.
equals
(
itemType
))
{
if
(
ItemTypeEnum
.
IMAGE
.
value
.
equals
(
itemType
))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setAltId
(
altId
);
sendPicMessageVO
.
setAltId
(
altId
);
sendPicMessageVO
.
setGroupId
(
groupId
);
sendPicMessageVO
.
set
Wx
GroupId
(
groupId
);
sendPicMessageVO
.
setPicUrl
(
pushItem
.
getImageUrl
());
sendPicMessageVO
.
setPicUrl
(
pushItem
.
getImageUrl
());
sendPicMessageVO
.
setPushGroupRecordId
(
pushGroupRecordId
);
sendPicMessageVO
.
setPushGroupRecordId
(
pushGroupRecordId
);
sendPicMessageVO
.
setIp
(
findIp
(
groupId
));
sendPicMessageVO
.
setIp
(
findIp
(
groupId
));
...
@@ -980,7 +980,7 @@ public class PushBizImpl implements PushBiz {
...
@@ -980,7 +980,7 @@ public class PushBizImpl implements PushBiz {
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setGroupId
(
weixinGroupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
findIp
(
weixinGroupId
));
sendTextMessageVO
.
setIp
(
findIp
(
weixinGroupId
));
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
LOGGER
.
info
(
"发送早晚报"
+
sendTextMessageVO
.
toString
());
LOGGER
.
info
(
"发送早晚报"
+
sendTextMessageVO
.
toString
());
...
...
pcloud-service-book/src/main/resources/mapper/group/BookGroupMapper.xml
View file @
25a952fd
...
@@ -88,6 +88,7 @@
...
@@ -88,6 +88,7 @@
and book_id = #{bookId,jdbcType=BIGINT}
and book_id = #{bookId,jdbcType=BIGINT}
and channel_id = #{channelId,jdbcType=BIGINT}
and channel_id = #{channelId,jdbcType=BIGINT}
and create_user = #{adviserId,jdbcType=BIGINT}
and create_user = #{adviserId,jdbcType=BIGINT}
ORDER BY create_time ASC limit 1
</select>
</select>
<select
id=
"getBookGroupCount"
resultType=
"Integer"
parameterType=
"Long"
>
<select
id=
"getBookGroupCount"
resultType=
"Integer"
parameterType=
"Long"
>
...
...
pcloud-service-book/src/main/resources/mapper/group/GroupQrcode.Mapper.xml
View file @
25a952fd
...
@@ -176,7 +176,7 @@
...
@@ -176,7 +176,7 @@
<select
id=
"getBaseById"
parameterType=
"Long"
resultType=
"GroupQrcodeBaseInfoVO"
>
<select
id=
"getBaseById"
parameterType=
"Long"
resultType=
"GroupQrcodeBaseInfoVO"
>
select
select
id groupQrcodeId, group_name groupName,qrcode_url qrcodeUrl
id groupQrcodeId, group_name groupName,qrcode_url qrcodeUrl
, weixin_group_id as weixinGroupId
from
from
book_group_qrcode
book_group_qrcode
where
where
...
...
pcloud-service-book/src/main/resources/mapper/group/JoinGroupCipher.xml
View file @
25a952fd
...
@@ -51,6 +51,15 @@
...
@@ -51,6 +51,15 @@
where cipher=#{cipher} limit 1
where cipher=#{cipher} limit 1
</select>
</select>
<!--根据暗号获取包含bookGroupId-->
<select
id=
"getDTOByCipher"
parameterType=
"String"
resultType=
"com.pcloud.book.group.dto.JoinGroupCiperDTO"
>
select
a.id, cipher, a.classify_id as classifyId, a.wechat_user_id as wechatUserId, a.wx_id as wxId,
a.has_used as hasUsed, b.book_group_id as bookGroupId
from join_group_cipher a left join book_group_classify b on a.classify_id = b.id
where a.cipher=#{cipher} limit 1
</select>
<!--更新暗号状态为已使用-->
<!--更新暗号状态为已使用-->
<update
id=
"updateCipherStateToUsed"
parameterType=
"map"
>
<update
id=
"updateCipherStateToUsed"
parameterType=
"map"
>
update join_group_cipher set
update join_group_cipher set
...
...
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