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
6a7dd660
Commit
6a7dd660
authored
Mar 13, 2020
by
吴博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消息顺序
parent
fb69a367
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
1000 additions
and
246 deletions
+1000
-246
.gitignore
.gitignore
+3
-2
AdNewsBizImpl.java
...n/java/com/pcloud/book/adnews/biz/impl/AdNewsBizImpl.java
+3
-1
AdvertisingSpaceBizImpl.java
...ud/book/advertising/biz/impl/AdvertisingSpaceBizImpl.java
+7
-3
BookClockBizImpl.java
...java/com/pcloud/book/clock/biz/impl/BookClockBizImpl.java
+3
-1
WechatGroupConsr.java
...om/pcloud/book/consumer/wechatgroup/WechatGroupConsr.java
+10
-0
CustomPlanBizImpl.java
...va/com/pcloud/book/custom/biz/impl/CustomPlanBizImpl.java
+2
-1
SendWeixinRequestTools.java
...a/com/pcloud/book/group/tools/SendWeixinRequestTools.java
+39
-21
PcloudRobotWakeUpBizImpl.java
.../pcloud/book/guide/biz/impl/PcloudRobotWakeUpBizImpl.java
+10
-3
PcloudGuideSilenceRunnerImpl.java
...cloud/book/guide/runner/PcloudGuideSilenceRunnerImpl.java
+31
-6
BookGuideBizImpl.java
...a/com/pcloud/book/keywords/biz/impl/BookGuideBizImpl.java
+55
-18
BookKeywordBizImpl.java
...com/pcloud/book/keywords/biz/impl/BookKeywordBizImpl.java
+127
-27
SelfRobotKeywordBizImpl.java
...cloud/book/keywords/biz/impl/SelfRobotKeywordBizImpl.java
+15
-7
UpdateWXGroupNameListener.java
...a/com/pcloud/book/mq/topic/UpdateWXGroupNameListener.java
+3
-1
WXGroupLearningReportListener.java
...m/pcloud/book/mq/topic/WXGroupLearningReportListener.java
+8
-2
PcloudRobotBizImpl.java
...cloud/book/pcloudkeyword/biz/impl/PcloudRobotBizImpl.java
+34
-17
PcloudRobotSet.java
...ava/com/pcloud/book/pcloudkeyword/set/PcloudRobotSet.java
+21
-13
PersonalStageBizImpl.java
...oud/book/personalstage/biz/impl/PersonalStageBizImpl.java
+32
-10
PersonalStageJumpBizImpl.java
...book/personalstage/biz/impl/PersonalStageJumpBizImpl.java
+49
-10
BaseDelayDTO.java
.../java/com/pcloud/book/personalstage/dto/BaseDelayDTO.java
+21
-0
LinkupDelayDTO.java
...ava/com/pcloud/book/personalstage/dto/LinkupDelayDTO.java
+1
-2
PushBizImpl.java
.../main/java/com/pcloud/book/push/biz/impl/PushBizImpl.java
+13
-6
SelfPushBizImpl.java
...n/java/com/pcloud/book/push/biz/impl/SelfPushBizImpl.java
+44
-11
ReadingActivityBizImpl.java
.../pcloud/book/reading/biz/impl/ReadingActivityBizImpl.java
+173
-35
SendWxMsg4ReadingDTO.java
...ava/com/pcloud/book/reading/dto/SendWxMsg4ReadingDTO.java
+34
-0
RiddleRecordBizImpl.java
.../com/pcloud/book/riddle/biz/impl/RiddleRecordBizImpl.java
+3
-1
PcloudGroupActivityBizImpl.java
...cloud/book/skill/biz/impl/PcloudGroupActivityBizImpl.java
+20
-2
PcloudSkillBizImpl.java
...va/com/pcloud/book/skill/biz/impl/PcloudSkillBizImpl.java
+34
-5
PcloudSubRemindBizImpl.java
...om/pcloud/book/skill/biz/impl/PcloudSubRemindBizImpl.java
+32
-7
AppOrProductReplyDTO.java
.../java/com/pcloud/book/skill/dto/AppOrProductReplyDTO.java
+52
-0
SelfPlanBizImpl.java
...com/pcloud/book/timecontrol/biz/impl/SelfPlanBizImpl.java
+2
-3
TaskBizImpl.java
...ava/com/pcloud/book/timecontrol/biz/impl/TaskBizImpl.java
+48
-10
TaskSubscribeBizImpl.java
...cloud/book/timecontrol/biz/impl/TaskSubscribeBizImpl.java
+67
-19
WeixinClockBizImpl.java
.../pcloud/book/weixinclock/biz/impl/WeixinClockBizImpl.java
+3
-1
application.yml
pcloud-service-book/src/main/resources/application.yml
+1
-1
No files found.
.gitignore
View file @
6a7dd660
...
@@ -7,4 +7,5 @@
...
@@ -7,4 +7,5 @@
*logs/
*logs/
*.idea/
*.idea/
*bin/
*bin/
*download/
*download/
\ No newline at end of file
*.log
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/adnews/biz/impl/AdNewsBizImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
adnews
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
adnews
.
biz
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.pcloud.book.adnews.biz.AdNewsBiz
;
import
com.pcloud.book.adnews.biz.AdNewsBiz
;
import
com.pcloud.book.adnews.check.AdNewsCheck
;
import
com.pcloud.book.adnews.check.AdNewsCheck
;
import
com.pcloud.book.adnews.dao.AdNewsBanDao
;
import
com.pcloud.book.adnews.dao.AdNewsBanDao
;
...
@@ -726,7 +727,8 @@ public class AdNewsBizImpl implements AdNewsBiz {
...
@@ -726,7 +727,8 @@ public class AdNewsBizImpl implements AdNewsBiz {
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setWxGroupId
(
weixinGroupId
);
sendTextMessageVO
.
setWxGroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
findIp
(
weixinGroupId
));
sendTextMessageVO
.
setIp
(
findIp
(
weixinGroupId
));
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));;
}
}
@ParamLog
(
"删除创建编辑早晚报定时任务"
)
@ParamLog
(
"删除创建编辑早晚报定时任务"
)
...
...
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/impl/AdvertisingSpaceBizImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
advertising
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
advertising
.
biz
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.pcloud.appcenter.app.dto.AppTypeDto
;
import
com.pcloud.appcenter.app.dto.AppTypeDto
;
import
com.pcloud.appcenter.app.service.AppTypeService
;
import
com.pcloud.appcenter.app.service.AppTypeService
;
import
com.pcloud.book.advertising.biz.AdvertisingSpaceBiz
;
import
com.pcloud.book.advertising.biz.AdvertisingSpaceBiz
;
...
@@ -728,7 +729,8 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -728,7 +729,8 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
sendTextMessageVO
.
setContent
(
adTitle
);
sendTextMessageVO
.
setContent
(
adTitle
);
sendTextMessageVO
.
setIp
(
findIp
(
groupId
));
sendTextMessageVO
.
setIp
(
findIp
(
groupId
));
LOGGER
.
info
(
"发送微信消息-文字链接"
+
sendTextMessageVO
.
toString
());
LOGGER
.
info
(
"发送微信消息-文字链接"
+
sendTextMessageVO
.
toString
());
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
else
if
(
AdPositionModeEnum
.
NEWS_SHARE
.
modeCode
.
equals
(
positionMode
))
{
}
else
if
(
AdPositionModeEnum
.
NEWS_SHARE
.
modeCode
.
equals
(
positionMode
))
{
String
adLink
=
jointLink
(
advertisingLink
,
classifyDTO
.
getBookGroupId
(),
group
.
getClassifyId
(),
group
.
getQrcodeId
(),
adId
,
settlementMethod
);
String
adLink
=
jointLink
(
advertisingLink
,
classifyDTO
.
getBookGroupId
(),
group
.
getClassifyId
(),
group
.
getQrcodeId
(),
adId
,
settlementMethod
);
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
...
@@ -740,7 +742,8 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -740,7 +742,8 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
sendArticleMessageVO
.
setPicUrl
(
adPic
);
sendArticleMessageVO
.
setPicUrl
(
adPic
);
sendArticleMessageVO
.
setIp
(
findIp
(
groupId
));
sendArticleMessageVO
.
setIp
(
findIp
(
groupId
));
LOGGER
.
info
(
"发送微信消息-图文分享"
+
sendArticleMessageVO
.
toString
());
LOGGER
.
info
(
"发送微信消息-图文分享"
+
sendArticleMessageVO
.
toString
());
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendArticleMessageVO
));
}
else
if
(
AdPositionModeEnum
.
JUST_PIC
.
modeCode
.
equals
(
positionMode
))
{
}
else
if
(
AdPositionModeEnum
.
JUST_PIC
.
modeCode
.
equals
(
positionMode
))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setAltId
(
altId
);
sendPicMessageVO
.
setAltId
(
altId
);
...
@@ -748,7 +751,8 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -748,7 +751,8 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
sendPicMessageVO
.
setPicUrl
(
adPic
);
sendPicMessageVO
.
setPicUrl
(
adPic
);
sendPicMessageVO
.
setIp
(
findIp
(
groupId
));
sendPicMessageVO
.
setIp
(
findIp
(
groupId
));
LOGGER
.
info
(
"发送微信消息-纯图片"
+
sendPicMessageVO
.
toString
());
LOGGER
.
info
(
"发送微信消息-纯图片"
+
sendPicMessageVO
.
toString
());
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
}
}
try
{
try
{
Thread
.
sleep
(
5000
);
Thread
.
sleep
(
5000
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/clock/biz/impl/BookClockBizImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
clock
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
clock
.
biz
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.clock.biz.BookClockBiz
;
import
com.pcloud.book.clock.biz.BookClockBiz
;
...
@@ -401,7 +402,8 @@ public class BookClockBizImpl implements BookClockBiz {
...
@@ -401,7 +402,8 @@ public class BookClockBizImpl implements BookClockBiz {
if
(!
MapUtils
.
isEmpty
(
wxQrcodeDTOMap
)
&&
wxQrcodeDTOMap
.
containsKey
(
weixinGroupId
)){
if
(!
MapUtils
.
isEmpty
(
wxQrcodeDTOMap
)
&&
wxQrcodeDTOMap
.
containsKey
(
weixinGroupId
)){
sendTextMessageVO
.
setIp
(
wxQrcodeDTOMap
.
getOrDefault
(
weixinGroupId
,
new
BookWxQrcodeDTO
()).
getWechatGroupIp
());
sendTextMessageVO
.
setIp
(
wxQrcodeDTOMap
.
getOrDefault
(
weixinGroupId
,
new
BookWxQrcodeDTO
()).
getWechatGroupIp
());
}
}
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
}
}
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/consumer/wechatgroup/WechatGroupConsr.java
View file @
6a7dd660
...
@@ -26,6 +26,7 @@ import com.pcloud.wechatgroup.monitor.service.MonitorService;
...
@@ -26,6 +26,7 @@ import com.pcloud.wechatgroup.monitor.service.MonitorService;
import
com.pcloud.wechatgroup.selfrobot.dto.*
;
import
com.pcloud.wechatgroup.selfrobot.dto.*
;
import
com.pcloud.wechatgroup.selfrobot.service.SelfRobotService
;
import
com.pcloud.wechatgroup.selfrobot.service.SelfRobotService
;
import
com.sdk.wxgroup.BaseVO
;
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.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -679,4 +680,13 @@ public class WechatGroupConsr {
...
@@ -679,4 +680,13 @@ public class WechatGroupConsr {
}
}
return
null
;
return
null
;
}
}
public
void
sendMessage
(
String
baseVO
)
throws
BizException
{
try
{
selfRobotService
.
sendMessage
(
baseVO
);
}
catch
(
Exception
e
)
{
log
.
error
(
"机器人给用户发送消息失败.[sendMessage]:"
+
e
.
getMessage
(),
e
);
}
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/custom/biz/impl/CustomPlanBizImpl.java
View file @
6a7dd660
...
@@ -365,7 +365,8 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
...
@@ -365,7 +365,8 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
sendTextMessageVO
.
setAltId
(
robotWxId
);
sendTextMessageVO
.
setAltId
(
robotWxId
);
sendTextMessageVO
.
setWxGroupId
(
wxId
);
sendTextMessageVO
.
setWxGroupId
(
wxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
}
});
});
return
maxBatchId
+
1
;
return
maxBatchId
+
1
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/tools/SendWeixinRequestTools.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
group
.
tools
;
package
com
.
pcloud
.
book
.
group
.
tools
;
import
com.alibaba.fastjson.JSON
;
import
com.pcloud.book.clock.dto.BookClockKeywordDTO
;
import
com.pcloud.book.clock.dto.BookClockKeywordDTO
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.dto.GroupClassifyQrcodeDTO
;
import
com.pcloud.book.group.dto.GroupClassifyQrcodeDTO
;
import
com.pcloud.book.group.dto.SendDefaultGuideMessageDTO
;
import
com.pcloud.book.group.dto.SendDefaultGuideMessageDTO
;
import
com.pcloud.book.group.dto.SendGuideMessageDTO
;
import
com.pcloud.book.group.dto.SendGuideMessageDTO
;
...
@@ -30,6 +32,8 @@ import com.sdk.wxgroup.WxGroupSDK;
...
@@ -30,6 +32,8 @@ import com.sdk.wxgroup.WxGroupSDK;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -43,9 +47,13 @@ import java.util.stream.Collectors;
...
@@ -43,9 +47,13 @@ import java.util.stream.Collectors;
* @author lily
* @author lily
* @date 2019/4/19 17:03
* @date 2019/4/19 17:03
*/
*/
@Component
public
class
SendWeixinRequestTools
{
public
class
SendWeixinRequestTools
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
SendWeixinRequestTools
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
SendWeixinRequestTools
.
class
);
@Autowired
private
WechatGroupConsr
wechatGroupConsr
;
@ParamLog
(
"修改微信群名称"
)
@ParamLog
(
"修改微信群名称"
)
public
static
void
changeGroupName
(
String
robotWxId
,
String
weixinGroupId
,
String
groupName
,
String
ip
)
{
public
static
void
changeGroupName
(
String
robotWxId
,
String
weixinGroupId
,
String
groupName
,
String
ip
)
{
ChangeNameVO
changeNameVO
=
new
ChangeNameVO
();
ChangeNameVO
changeNameVO
=
new
ChangeNameVO
();
...
@@ -140,7 +148,7 @@ public class SendWeixinRequestTools {
...
@@ -140,7 +148,7 @@ public class SendWeixinRequestTools {
}
}
@ParamLog
(
"推送消息"
)
@ParamLog
(
"推送消息"
)
private
static
void
sendMessage
(
SendMessageDTO
sendMessageDTO
,
String
robotId
,
String
weixinGroupId
,
String
ip
,
Integer
code
)
{
private
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
());
...
@@ -148,7 +156,8 @@ public class SendWeixinRequestTools {
...
@@ -148,7 +156,8 @@ public class SendWeixinRequestTools {
sendTextMessageVO
.
setWxGroupId
(
weixinGroupId
);
sendTextMessageVO
.
setWxGroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
code
);
sendTextMessageVO
.
setCode
(
code
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
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
.
setWxGroupId
(
weixinGroupId
);
sendPicMessageVO
.
setWxGroupId
(
weixinGroupId
);
...
@@ -156,7 +165,8 @@ public class SendWeixinRequestTools {
...
@@ -156,7 +165,8 @@ public class SendWeixinRequestTools {
sendPicMessageVO
.
setPicUrl
(
sendMessageDTO
.
getPicUrl
());
sendPicMessageVO
.
setPicUrl
(
sendMessageDTO
.
getPicUrl
());
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setCode
(
code
);
sendPicMessageVO
.
setCode
(
code
);
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
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
);
...
@@ -167,7 +177,8 @@ public class SendWeixinRequestTools {
...
@@ -167,7 +177,8 @@ public class SendWeixinRequestTools {
sendArticleMessageVO
.
setTitle
(
sendMessageDTO
.
getContent
());
sendArticleMessageVO
.
setTitle
(
sendMessageDTO
.
getContent
());
sendArticleMessageVO
.
setIp
(
ip
);
sendArticleMessageVO
.
setIp
(
ip
);
sendArticleMessageVO
.
setCode
(
code
);
sendArticleMessageVO
.
setCode
(
code
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendArticleMessageVO
));
}
}
}
}
...
@@ -197,7 +208,7 @@ public class SendWeixinRequestTools {
...
@@ -197,7 +208,7 @@ public class SendWeixinRequestTools {
@ParamLog
(
"推送公众号消息"
)
@ParamLog
(
"推送公众号消息"
)
public
static
void
sendAccountMessage
(
String
weixinGroupId
,
String
recommendLanguage
,
String
robotId
,
public
void
sendAccountMessage
(
String
weixinGroupId
,
String
recommendLanguage
,
String
robotId
,
AccountSettingDto
accountSettingDto
,
String
ip
)
{
AccountSettingDto
accountSettingDto
,
String
ip
)
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
if
(
StringUtil
.
isEmpty
(
recommendLanguage
))
{
if
(
StringUtil
.
isEmpty
(
recommendLanguage
))
{
...
@@ -207,17 +218,19 @@ public class SendWeixinRequestTools {
...
@@ -207,17 +218,19 @@ public class SendWeixinRequestTools {
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setWxGroupId
(
weixinGroupId
);
sendTextMessageVO
.
setWxGroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setWxGroupId
(
weixinGroupId
);
sendPicMessageVO
.
setWxGroupId
(
weixinGroupId
);
sendPicMessageVO
.
setAltId
(
robotId
);
sendPicMessageVO
.
setAltId
(
robotId
);
sendPicMessageVO
.
setPicUrl
(
accountSettingDto
.
getQrcodeUrl
());
sendPicMessageVO
.
setPicUrl
(
accountSettingDto
.
getQrcodeUrl
());
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
}
}
@ParamLog
(
"推送关键词回复消息"
)
@ParamLog
(
"推送关键词回复消息"
)
public
static
void
sendKeywordMessage
(
ReplyKeywordDTO
replyKeywordDTO
,
String
robotId
,
String
weixinGroupId
,
String
ip
,
Integer
code
)
{
public
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
,
code
);
sendMessage
(
sendMessageDTO
,
robotId
,
weixinGroupId
,
ip
,
code
);
...
@@ -258,7 +271,7 @@ public class SendWeixinRequestTools {
...
@@ -258,7 +271,7 @@ public class SendWeixinRequestTools {
}
}
@ParamLog
(
"群欢迎语中推送关键词信息"
)
@ParamLog
(
"群欢迎语中推送关键词信息"
)
public
static
void
sendKeywordsInfo
(
List
<
KeywordDTO
>
keywords
,
String
robotId
,
String
weixinGroupId
,
String
ip
){
public
void
sendKeywordsInfo
(
List
<
KeywordDTO
>
keywords
,
String
robotId
,
String
weixinGroupId
,
String
ip
){
if
(
ListUtils
.
isEmpty
(
keywords
))
{
if
(
ListUtils
.
isEmpty
(
keywords
))
{
return
;
return
;
}
}
...
@@ -267,7 +280,7 @@ public class SendWeixinRequestTools {
...
@@ -267,7 +280,7 @@ public class SendWeixinRequestTools {
}
}
@ParamLog
(
"个人欢迎语中推送关键词信息"
)
@ParamLog
(
"个人欢迎语中推送关键词信息"
)
public
static
void
sendKeywordsInfoToSelf
(
List
<
KeywordDTO
>
keywords
,
String
robotId
,
String
toWxId
,
String
ip
){
public
void
sendKeywordsInfoToSelf
(
List
<
KeywordDTO
>
keywords
,
String
robotId
,
String
toWxId
,
String
ip
){
if
(
ListUtils
.
isEmpty
(
keywords
))
{
if
(
ListUtils
.
isEmpty
(
keywords
))
{
return
;
return
;
}
}
...
@@ -275,7 +288,7 @@ public class SendWeixinRequestTools {
...
@@ -275,7 +288,7 @@ public class SendWeixinRequestTools {
sendTextMessageToSelf
(
content
,
robotId
,
toWxId
,
ip
);
sendTextMessageToSelf
(
content
,
robotId
,
toWxId
,
ip
);
}
}
private
static
String
processContent
(
List
<
KeywordDTO
>
keywords
,
String
robotId
,
String
toWxId
,
String
ip
)
{
private
String
processContent
(
List
<
KeywordDTO
>
keywords
,
String
robotId
,
String
toWxId
,
String
ip
)
{
StringBuilder
content
=
new
StringBuilder
();
StringBuilder
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
);
...
@@ -293,29 +306,31 @@ public class SendWeixinRequestTools {
...
@@ -293,29 +306,31 @@ public class SendWeixinRequestTools {
return
content
.
toString
();
return
content
.
toString
();
}
}
private
static
void
sendTextMessageToSelf
(
String
content
,
String
robotId
,
String
toWxId
,
String
ip
){
private
void
sendTextMessageToSelf
(
String
content
,
String
robotId
,
String
toWxId
,
String
ip
){
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setWxGroupId
(
toWxId
);
sendTextMessageVO
.
setWxGroupId
(
toWxId
);
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
}
public
static
void
sendTextMessage
(
String
content
,
String
robotId
,
String
weixinGroupId
,
String
ip
){
public
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
.
setWxGroupId
(
weixinGroupId
);
sendTextMessageVO
.
setWxGroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));;
}
}
/**
/**
* 发送默认欢迎语
* 发送默认欢迎语
*/
*/
public
static
void
sendDefaultMessage
(
SendDefaultGuideMessageDTO
dto
)
{
public
void
sendDefaultMessage
(
SendDefaultGuideMessageDTO
dto
)
{
String
groupName
=
dto
.
getGroupName
();
String
groupName
=
dto
.
getGroupName
();
String
robotId
=
dto
.
getRobotId
();
String
robotId
=
dto
.
getRobotId
();
String
weixinGroupId
=
dto
.
getWeixinGroupId
();
String
weixinGroupId
=
dto
.
getWeixinGroupId
();
...
@@ -347,7 +362,7 @@ public class SendWeixinRequestTools {
...
@@ -347,7 +362,7 @@ public class SendWeixinRequestTools {
}
}
@ParamLog
(
"发送欢迎语消息"
)
@ParamLog
(
"发送欢迎语消息"
)
public
static
void
sendGuideMessage
(
SendGuideMessageDTO
dto
)
{
public
void
sendGuideMessage
(
SendGuideMessageDTO
dto
)
{
if
(
Objects
.
isNull
(
dto
)
||
CollectionUtils
.
isEmpty
(
dto
.
getReplyMessages
()))
{
if
(
Objects
.
isNull
(
dto
)
||
CollectionUtils
.
isEmpty
(
dto
.
getReplyMessages
()))
{
return
;
return
;
}
}
...
@@ -389,7 +404,8 @@ public class SendWeixinRequestTools {
...
@@ -389,7 +404,8 @@ public class SendWeixinRequestTools {
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setWxGroupId
(
weixinGroupId
);
sendTextMessageVO
.
setWxGroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
}
// }
// }
}
}
...
@@ -512,7 +528,7 @@ public class SendWeixinRequestTools {
...
@@ -512,7 +528,7 @@ public class SendWeixinRequestTools {
}
}
@ParamLog
(
"欢迎语中推送关键词信息"
)
@ParamLog
(
"欢迎语中推送关键词信息"
)
public
static
void
sendClockKeywordsInfo
(
List
<
BookClockKeywordDTO
>
keywords
,
String
robotId
,
String
weixinGroupId
,
String
ip
)
{
public
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
.
setWxGroupId
(
weixinGroupId
);
sendTextMessageVO
.
setWxGroupId
(
weixinGroupId
);
...
@@ -526,7 +542,8 @@ public class SendWeixinRequestTools {
...
@@ -526,7 +542,8 @@ public class SendWeixinRequestTools {
String
keyword
=
"关键词【"
+
bookClockKeywordDTO
.
getKeyword
()
+
"】\n"
+
" "
+
bookClockKeywordDTO
.
getGuide
();
String
keyword
=
"关键词【"
+
bookClockKeywordDTO
.
getKeyword
()
+
"】\n"
+
" "
+
bookClockKeywordDTO
.
getGuide
();
if
(
content
.
length
()
+
keyword
.
length
()
>
1000
)
{
if
(
content
.
length
()
+
keyword
.
length
()
>
1000
)
{
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setContent
(
content
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
content
=
keyword
;
content
=
keyword
;
}
else
{
}
else
{
content
=
content
+
keyword
;
content
=
content
+
keyword
;
...
@@ -536,6 +553,7 @@ public class SendWeixinRequestTools {
...
@@ -536,6 +553,7 @@ public class SendWeixinRequestTools {
}
}
}
}
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setContent
(
content
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/guide/biz/impl/PcloudRobotWakeUpBizImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
guide
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
guide
.
biz
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.guide.biz.PcloudRobotWakeUpBiz
;
import
com.pcloud.book.guide.biz.PcloudRobotWakeUpBiz
;
import
com.pcloud.book.guide.dto.WakeUpInfoDto
;
import
com.pcloud.book.guide.dto.WakeUpInfoDto
;
import
com.pcloud.book.guide.entity.PcloudRobotWakeup
;
import
com.pcloud.book.guide.entity.PcloudRobotWakeup
;
...
@@ -68,6 +70,8 @@ public class PcloudRobotWakeUpBizImpl implements PcloudRobotWakeUpBiz {
...
@@ -68,6 +70,8 @@ public class PcloudRobotWakeUpBizImpl implements PcloudRobotWakeUpBiz {
private
PcloudRobotBiz
pcloudRobotBiz
;
private
PcloudRobotBiz
pcloudRobotBiz
;
@Autowired
@Autowired
private
PcloudRobotWakeupClassifyMapper
pcloudRobotWakeupClassifyMapper
;
private
PcloudRobotWakeupClassifyMapper
pcloudRobotWakeupClassifyMapper
;
@Autowired
private
WechatGroupConsr
wechatGroupConsr
;
@Override
@Override
public
void
robotWakeUpConfig
(
RobotWakeUpConfigVO
robotWakeUpConfigVO
)
{
public
void
robotWakeUpConfig
(
RobotWakeUpConfigVO
robotWakeUpConfigVO
)
{
...
@@ -240,7 +244,8 @@ public class PcloudRobotWakeUpBizImpl implements PcloudRobotWakeUpBiz {
...
@@ -240,7 +244,8 @@ public class PcloudRobotWakeUpBizImpl implements PcloudRobotWakeUpBiz {
txt
.
setContent
(
msg
.
getContent
());
txt
.
setContent
(
msg
.
getContent
());
txt
.
setWxGroupId
(
wxid
);
txt
.
setWxGroupId
(
wxid
);
txt
.
setIp
(
ip
);
txt
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
txt
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
txt
));
}
}
if
(
"image"
.
equals
(
msg
.
getType
()))
{
if
(
"image"
.
equals
(
msg
.
getType
()))
{
SendPicMessageVO
pic
=
new
SendPicMessageVO
();
SendPicMessageVO
pic
=
new
SendPicMessageVO
();
...
@@ -249,7 +254,8 @@ public class PcloudRobotWakeUpBizImpl implements PcloudRobotWakeUpBiz {
...
@@ -249,7 +254,8 @@ public class PcloudRobotWakeUpBizImpl implements PcloudRobotWakeUpBiz {
pic
.
setWxId
(
wxid
);
pic
.
setWxId
(
wxid
);
pic
.
setWxGroupId
(
wxid
);
pic
.
setWxGroupId
(
wxid
);
pic
.
setIp
(
ip
);
pic
.
setIp
(
ip
);
WxGroupSDK
.
sendPicMessage
(
pic
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
pic
));
}
}
if
(
"file"
.
equals
(
msg
.
getType
()))
{
if
(
"file"
.
equals
(
msg
.
getType
()))
{
SendFileVO
file
=
new
SendFileVO
();
SendFileVO
file
=
new
SendFileVO
();
...
@@ -259,7 +265,8 @@ public class PcloudRobotWakeUpBizImpl implements PcloudRobotWakeUpBiz {
...
@@ -259,7 +265,8 @@ public class PcloudRobotWakeUpBizImpl implements PcloudRobotWakeUpBiz {
file
.
setWxId
(
wxid
);
file
.
setWxId
(
wxid
);
file
.
setWxGroupId
(
wxid
);
file
.
setWxGroupId
(
wxid
);
file
.
setIp
(
ip
);
file
.
setIp
(
ip
);
WxGroupSDK
.
sendFile
(
file
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
file
));
}
}
}
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/guide/runner/PcloudGuideSilenceRunnerImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
guide
.
runner
;
package
com
.
pcloud
.
book
.
guide
.
runner
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.pcloud.book.consumer.content.ResourceConsr
;
import
com.pcloud.book.consumer.content.ResourceConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.guide.dto.PcloudGuideDelayDto
;
import
com.pcloud.book.guide.dto.PcloudGuideDelayDto
;
import
com.pcloud.book.guide.entity.PcloudGuide
;
import
com.pcloud.book.guide.entity.PcloudGuide
;
import
com.pcloud.book.guide.mapper.PcloudGuideMapper
;
import
com.pcloud.book.guide.mapper.PcloudGuideMapper
;
...
@@ -14,17 +16,22 @@ import com.pcloud.book.pcloudkeyword.dao.PcloudRobotDao;
...
@@ -14,17 +16,22 @@ import com.pcloud.book.pcloudkeyword.dao.PcloudRobotDao;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.cache.redis.JedisClusterUtils
;
import
com.pcloud.common.utils.cache.redis.JedisClusterUtils
;
import
com.pcloud.contentcenter.resource.dto.ResourceDTO
;
import
com.pcloud.contentcenter.resource.dto.ResourceDTO
;
import
com.sdk.wxgroup.RobotProcessTypeEnum
;
import
com.sdk.wxgroup.SendFileVO
;
import
com.sdk.wxgroup.SendFileVO
;
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
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.ApplicationArguments
;
import
org.springframework.boot.ApplicationArguments
;
import
org.springframework.boot.ApplicationRunner
;
import
org.springframework.boot.ApplicationRunner
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.*
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.UUID
;
import
static
com
.
pcloud
.
book
.
guide
.
constant
.
PcloudGuideRedisConstant
.
PCLOUD_GUIDE_LOCK
;
import
static
com
.
pcloud
.
book
.
guide
.
constant
.
PcloudGuideRedisConstant
.
PCLOUD_GUIDE_LOCK
;
import
static
com
.
pcloud
.
book
.
guide
.
constant
.
PcloudGuideRedisConstant
.
PCLOUD_GUIDE_SUFFIX
;
import
static
com
.
pcloud
.
book
.
guide
.
constant
.
PcloudGuideRedisConstant
.
PCLOUD_GUIDE_SUFFIX
;
...
@@ -46,6 +53,8 @@ public class PcloudGuideSilenceRunnerImpl implements ApplicationRunner {
...
@@ -46,6 +53,8 @@ public class PcloudGuideSilenceRunnerImpl implements ApplicationRunner {
private
PcloudRobotDao
pcloudRobotDao
;
private
PcloudRobotDao
pcloudRobotDao
;
@Autowired
@Autowired
private
ResourceConsr
resourceConsr
;
private
ResourceConsr
resourceConsr
;
@Autowired
private
WechatGroupConsr
wechatGroupConsr
;
@Override
@Override
public
void
run
(
ApplicationArguments
applicationArguments
)
throws
Exception
{
public
void
run
(
ApplicationArguments
applicationArguments
)
throws
Exception
{
...
@@ -81,7 +90,11 @@ public class PcloudGuideSilenceRunnerImpl implements ApplicationRunner {
...
@@ -81,7 +90,11 @@ public class PcloudGuideSilenceRunnerImpl implements ApplicationRunner {
// 超时 推送引导语
// 超时 推送引导语
if
(!
DateUtils
.
addSecond
(
pcloudGuideDelayDto
.
getSendTime
(),
pcloudGuideDelayDto
.
getSpanTime
()
+
pcloudGuideDelayDto
.
getDuration
()).
after
(
new
Date
()))
{
if
(!
DateUtils
.
addSecond
(
pcloudGuideDelayDto
.
getSendTime
(),
pcloudGuideDelayDto
.
getSpanTime
()
+
pcloudGuideDelayDto
.
getDuration
()).
after
(
new
Date
()))
{
// 发送消息
// 发送消息
for
(
PcloudGuideMessageVO
message
:
pcloudGuideDelayDto
.
getMsgList
())
{
List
<
PcloudGuideMessageVO
>
msgList
=
pcloudGuideDelayDto
.
getMsgList
();
String
groupId
=
UUID
.
randomUUID
().
toString
();
int
counts
=
msgList
.
size
();
for
(
int
i
=
0
;
i
<
msgList
.
size
();
i
++)
{
PcloudGuideMessageVO
message
=
msgList
.
get
(
i
);
Integer
replyType
=
message
.
getReplyType
();
Integer
replyType
=
message
.
getReplyType
();
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
replyType
))
{
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
replyType
))
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
...
@@ -90,7 +103,11 @@ public class PcloudGuideSilenceRunnerImpl implements ApplicationRunner {
...
@@ -90,7 +103,11 @@ public class PcloudGuideSilenceRunnerImpl implements ApplicationRunner {
sendTextMessageVO
.
setWxGroupId
(
userId
);
sendTextMessageVO
.
setWxGroupId
(
userId
);
sendTextMessageVO
.
setIp
(
pcloudGuideDelayDto
.
getIp
());
sendTextMessageVO
.
setIp
(
pcloudGuideDelayDto
.
getIp
());
sendTextMessageVO
.
setCode
(
pcloudGuideDelayDto
.
getCode
());
sendTextMessageVO
.
setCode
(
pcloudGuideDelayDto
.
getCode
());
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setMessageGroupId
(
groupId
);
sendTextMessageVO
.
setCounts
(
counts
);
sendTextMessageVO
.
setIndex
(
i
);
sendTextMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
GUIDE
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
}
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
replyType
))
{
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
replyType
))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
...
@@ -99,7 +116,11 @@ public class PcloudGuideSilenceRunnerImpl implements ApplicationRunner {
...
@@ -99,7 +116,11 @@ public class PcloudGuideSilenceRunnerImpl implements ApplicationRunner {
sendPicMessageVO
.
setWxGroupId
(
userId
);
sendPicMessageVO
.
setWxGroupId
(
userId
);
sendPicMessageVO
.
setIp
(
pcloudGuideDelayDto
.
getIp
());
sendPicMessageVO
.
setIp
(
pcloudGuideDelayDto
.
getIp
());
sendPicMessageVO
.
setCode
(
pcloudGuideDelayDto
.
getCode
());
sendPicMessageVO
.
setCode
(
pcloudGuideDelayDto
.
getCode
());
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
sendPicMessageVO
.
setMessageGroupId
(
groupId
);
sendPicMessageVO
.
setCounts
(
counts
);
sendPicMessageVO
.
setIndex
(
i
);
sendPicMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
GUIDE
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
}
}
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
replyType
))
{
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
replyType
))
{
SendFileVO
sendFileVO
=
new
SendFileVO
();
SendFileVO
sendFileVO
=
new
SendFileVO
();
...
@@ -119,7 +140,11 @@ public class PcloudGuideSilenceRunnerImpl implements ApplicationRunner {
...
@@ -119,7 +140,11 @@ public class PcloudGuideSilenceRunnerImpl implements ApplicationRunner {
sendFileVO
.
setIp
(
pcloudGuideDelayDto
.
getIp
());
sendFileVO
.
setIp
(
pcloudGuideDelayDto
.
getIp
());
sendFileVO
.
setAltId
(
pcloudGuideDelayDto
.
getRobotWxId
());
sendFileVO
.
setAltId
(
pcloudGuideDelayDto
.
getRobotWxId
());
sendFileVO
.
setWxId
(
userId
);
sendFileVO
.
setWxId
(
userId
);
WxGroupSDK
.
sendFile
(
sendFileVO
);
sendFileVO
.
setMessageGroupId
(
groupId
);
sendFileVO
.
setCounts
(
counts
);
sendFileVO
.
setIndex
(
i
);
sendFileVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
GUIDE
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendFileVO
));
}
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/BookGuideBizImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
keywords
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
keywords
.
biz
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.constant.BookConstant
;
import
com.pcloud.book.book.constant.BookConstant
;
...
@@ -69,6 +70,7 @@ import com.pcloud.common.utils.httpclient.UrlUtils;
...
@@ -69,6 +70,7 @@ import com.pcloud.common.utils.httpclient.UrlUtils;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.contentcenter.resource.dto.ResourceDTO
;
import
com.pcloud.contentcenter.resource.dto.ResourceDTO
;
import
com.pcloud.wechatgroup.message.dto.AgreeAddUserDTO
;
import
com.pcloud.wechatgroup.message.dto.AgreeAddUserDTO
;
import
com.sdk.wxgroup.RobotProcessTypeEnum
;
import
com.sdk.wxgroup.SendArticleMessageVO
;
import
com.sdk.wxgroup.SendArticleMessageVO
;
import
com.sdk.wxgroup.SendFileVO
;
import
com.sdk.wxgroup.SendFileVO
;
import
com.sdk.wxgroup.SendGroupInviteVO
;
import
com.sdk.wxgroup.SendGroupInviteVO
;
...
@@ -90,6 +92,7 @@ import java.util.Date;
...
@@ -90,6 +92,7 @@ import java.util.Date;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.UUID
;
import
static
com
.
pcloud
.
book
.
guide
.
constant
.
PcloudGuideRedisConstant
.
PCLOUD_GUIDE_SUFFIX
;
import
static
com
.
pcloud
.
book
.
guide
.
constant
.
PcloudGuideRedisConstant
.
PCLOUD_GUIDE_SUFFIX
;
...
@@ -151,6 +154,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -151,6 +154,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
private
String
wechatGroupLinkPrefix
;
private
String
wechatGroupLinkPrefix
;
@Autowired
@Autowired
private
PersonalStageJumpBiz
personalStageJumpBiz
;
private
PersonalStageJumpBiz
personalStageJumpBiz
;
@Autowired
private
SendWeixinRequestTools
sendWeixinRequestTools
;
@ParamLog
(
"同意加好友发送欢迎语"
)
@ParamLog
(
"同意加好友发送欢迎语"
)
@Override
@Override
...
@@ -184,7 +189,11 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -184,7 +189,11 @@ public class BookGuideBizImpl implements BookGuideBiz {
vo
.
setAltId
(
agreeAddUserDTO
.
getRobotWxId
());
vo
.
setAltId
(
agreeAddUserDTO
.
getRobotWxId
());
vo
.
setWxGroupId
(
agreeAddUserDTO
.
getUserWxId
());
vo
.
setWxGroupId
(
agreeAddUserDTO
.
getUserWxId
());
vo
.
setIp
(
agreeAddUserDTO
.
getIp
());
vo
.
setIp
(
agreeAddUserDTO
.
getIp
());
WxGroupSDK
.
sendTextMessage
(
vo
);
vo
.
setRobotProcessType
(
RobotProcessTypeEnum
.
WELCOME
);
vo
.
setCounts
(
1
);
vo
.
setIndex
(
0
);
vo
.
setMessageGroupId
(
UUID
.
randomUUID
().
toString
());
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
vo
));
return
;
return
;
}
}
if
(
StringUtil
.
isBlank
(
cipher
))
{
if
(
StringUtil
.
isBlank
(
cipher
))
{
...
@@ -220,7 +229,11 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -220,7 +229,11 @@ public class BookGuideBizImpl implements BookGuideBiz {
vo
.
setWxGroupId
(
agreeAddUserDTO
.
getUserWxId
());
vo
.
setWxGroupId
(
agreeAddUserDTO
.
getUserWxId
());
vo
.
setIp
(
agreeAddUserDTO
.
getIp
());
vo
.
setIp
(
agreeAddUserDTO
.
getIp
());
log
.
info
(
"[同意加好友发送欢迎语] : {}"
,
vo
);
log
.
info
(
"[同意加好友发送欢迎语] : {}"
,
vo
);
WxGroupSDK
.
sendTextMessage
(
vo
);
vo
.
setRobotProcessType
(
RobotProcessTypeEnum
.
WELCOME
);
vo
.
setCounts
(
1
);
vo
.
setIndex
(
0
);
vo
.
setMessageGroupId
(
UUID
.
randomUUID
().
toString
());
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
vo
));
}
}
// 如果不是第一次就发关键词
// 如果不是第一次就发关键词
// 根据暗号获取分类id和bookGroupId推送关键词欢迎语
// 根据暗号获取分类id和bookGroupId推送关键词欢迎语
...
@@ -228,7 +241,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -228,7 +241,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
//发主打资源
//发主打资源
sendMainKeyword
(
keywords
,
agreeAddUserDTO
,
dto
,
wxGroupId
);
sendMainKeyword
(
keywords
,
agreeAddUserDTO
,
dto
,
wxGroupId
);
//发关键词列表
//发关键词列表
S
endWeixinRequestTools
.
sendKeywordsInfoToSelf
(
keywords
,
agreeAddUserDTO
.
getRobotWxId
(),
agreeAddUserDTO
.
getUserWxId
(),
agreeAddUserDTO
.
getIp
());
s
endWeixinRequestTools
.
sendKeywordsInfoToSelf
(
keywords
,
agreeAddUserDTO
.
getRobotWxId
(),
agreeAddUserDTO
.
getUserWxId
(),
agreeAddUserDTO
.
getIp
());
// 拉群
// 拉群
// final Integer peopleCounts = wxGroup.getUserNumber();
// final Integer peopleCounts = wxGroup.getUserNumber();
// 邀请好友进群有次数限制,目前测试为每天只能拉30-40人就操作频繁,所以在此加判断,超过30人或者群人数超过30人就发送邀请链接
// 邀请好友进群有次数限制,目前测试为每天只能拉30-40人就操作频繁,所以在此加判断,超过30人或者群人数超过30人就发送邀请链接
...
@@ -307,7 +320,11 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -307,7 +320,11 @@ public class BookGuideBizImpl implements BookGuideBiz {
vo
.
setAltId
(
agreeAddUserDTO
.
getRobotWxId
());
vo
.
setAltId
(
agreeAddUserDTO
.
getRobotWxId
());
vo
.
setWxGroupId
(
agreeAddUserDTO
.
getUserWxId
());
vo
.
setWxGroupId
(
agreeAddUserDTO
.
getUserWxId
());
vo
.
setIp
(
agreeAddUserDTO
.
getIp
());
vo
.
setIp
(
agreeAddUserDTO
.
getIp
());
WxGroupSDK
.
sendTextMessage
(
vo
);
vo
.
setRobotProcessType
(
RobotProcessTypeEnum
.
WELCOME
);
vo
.
setCounts
(
1
);
vo
.
setIndex
(
0
);
vo
.
setMessageGroupId
(
UUID
.
randomUUID
().
toString
());
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
vo
));
return
;
return
;
}
}
if
(
StringUtil
.
isBlank
(
cipher
))
{
if
(
StringUtil
.
isBlank
(
cipher
))
{
...
@@ -342,8 +359,12 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -342,8 +359,12 @@ public class BookGuideBizImpl implements BookGuideBiz {
vo
.
setAltId
(
agreeAddUserDTO
.
getRobotWxId
());
vo
.
setAltId
(
agreeAddUserDTO
.
getRobotWxId
());
vo
.
setWxGroupId
(
agreeAddUserDTO
.
getUserWxId
());
vo
.
setWxGroupId
(
agreeAddUserDTO
.
getUserWxId
());
vo
.
setIp
(
agreeAddUserDTO
.
getIp
());
vo
.
setIp
(
agreeAddUserDTO
.
getIp
());
vo
.
setRobotProcessType
(
RobotProcessTypeEnum
.
WELCOME
);
vo
.
setCounts
(
1
);
vo
.
setIndex
(
0
);
vo
.
setMessageGroupId
(
UUID
.
randomUUID
().
toString
());
log
.
info
(
"[同意加好友发送欢迎语] : {}"
,
vo
);
log
.
info
(
"[同意加好友发送欢迎语] : {}"
,
vo
);
WxGroupSDK
.
sendTextMessage
(
vo
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
vo
)
);
}
}
// 如果不是第一次就发关键词
// 如果不是第一次就发关键词
// 根据暗号获取分类id和bookGroupId推送关键词欢迎语
// 根据暗号获取分类id和bookGroupId推送关键词欢迎语
...
@@ -351,7 +372,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -351,7 +372,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
//发主打资源
//发主打资源
sendMainKeyword
(
keywords
,
agreeAddUserDTO
,
dto
,
wxGroupId
);
sendMainKeyword
(
keywords
,
agreeAddUserDTO
,
dto
,
wxGroupId
);
//发关键词列表
//发关键词列表
S
endWeixinRequestTools
.
sendKeywordsInfoToSelf
(
keywords
,
agreeAddUserDTO
.
getRobotWxId
(),
agreeAddUserDTO
.
getUserWxId
(),
agreeAddUserDTO
.
getIp
());
s
endWeixinRequestTools
.
sendKeywordsInfoToSelf
(
keywords
,
agreeAddUserDTO
.
getRobotWxId
(),
agreeAddUserDTO
.
getUserWxId
(),
agreeAddUserDTO
.
getIp
());
// 拉群
// 拉群
// final Integer peopleCounts = wxGroup.getUserNumber();
// final Integer peopleCounts = wxGroup.getUserNumber();
// 邀请好友进群有次数限制,目前测试为每天只能拉30-40人就操作频繁,所以在此加判断,超过30人或者群人数超过30人就发送邀请链接
// 邀请好友进群有次数限制,目前测试为每天只能拉30-40人就操作频繁,所以在此加判断,超过30人或者群人数超过30人就发送邀请链接
...
@@ -425,12 +446,13 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -425,12 +446,13 @@ public class BookGuideBizImpl implements BookGuideBiz {
if
(
ListUtils
.
isEmpty
(
friendGuideList
)){
if
(
ListUtils
.
isEmpty
(
friendGuideList
)){
return
;
return
;
}
}
int
i
=
0
;
String
groupId
=
UUID
.
randomUUID
().
toString
();
for
(
BookGroupFriendGuide
bookGroupFriendGuide:
friendGuideList
){
int
counts
=
friendGuideList
.
size
();
i
=
i
+
1
;
for
(
int
i
=
0
;
i
<
friendGuideList
.
size
();
i
++)
{
BookGroupFriendGuide
bookGroupFriendGuide
=
friendGuideList
.
get
(
i
);
Integer
type
=
bookGroupFriendGuide
.
getType
();
Integer
type
=
bookGroupFriendGuide
.
getType
();
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
type
))
{
if
(
i
==
friendGuideList
.
size
()){
if
(
i
==
friendGuideList
.
size
()
-
1
){
String
content
=
bookGroupFriendGuide
.
getContent
();
String
content
=
bookGroupFriendGuide
.
getContent
();
if
(!
StringUtil
.
isEmpty
(
content
)){
if
(!
StringUtil
.
isEmpty
(
content
)){
String
endUrl
=
wechatGroupLinkPrefix
+
"/dialog"
+
"?book_group_id="
+
bookGroupId
+
"&wxId="
+
userWxId
+
"&robotWxId="
+
robotId
;
String
endUrl
=
wechatGroupLinkPrefix
+
"/dialog"
+
"?book_group_id="
+
bookGroupId
+
"&wxId="
+
userWxId
+
"&robotWxId="
+
robotId
;
...
@@ -445,7 +467,11 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -445,7 +467,11 @@ public class BookGuideBizImpl implements BookGuideBiz {
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
code
);
sendTextMessageVO
.
setCode
(
code
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setMessageGroupId
(
groupId
);
sendTextMessageVO
.
setCounts
(
counts
);
sendTextMessageVO
.
setIndex
(
i
);
sendTextMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
GUIDE
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
}
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
type
))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
...
@@ -454,7 +480,11 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -454,7 +480,11 @@ public class BookGuideBizImpl implements BookGuideBiz {
sendPicMessageVO
.
setPicUrl
(
bookGroupFriendGuide
.
getPicUrl
());
sendPicMessageVO
.
setPicUrl
(
bookGroupFriendGuide
.
getPicUrl
());
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setCode
(
code
);
sendPicMessageVO
.
setCode
(
code
);
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
sendPicMessageVO
.
setMessageGroupId
(
groupId
);
sendPicMessageVO
.
setCounts
(
counts
);
sendPicMessageVO
.
setIndex
(
i
);
sendPicMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
GUIDE
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
}
}
if
(
ReplyTypeEnum
.
LINK
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
LINK
.
value
.
equals
(
type
))
{
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
...
@@ -466,7 +496,11 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -466,7 +496,11 @@ public class BookGuideBizImpl implements BookGuideBiz {
sendArticleMessageVO
.
setPicUrl
(
bookGroupFriendGuide
.
getPicUrl
());
sendArticleMessageVO
.
setPicUrl
(
bookGroupFriendGuide
.
getPicUrl
());
sendArticleMessageVO
.
setTitle
(
bookGroupFriendGuide
.
getContent
());
sendArticleMessageVO
.
setTitle
(
bookGroupFriendGuide
.
getContent
());
sendArticleMessageVO
.
setIp
(
ip
);
sendArticleMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
sendArticleMessageVO
.
setMessageGroupId
(
groupId
);
sendArticleMessageVO
.
setCounts
(
counts
);
sendArticleMessageVO
.
setIndex
(
i
);
sendArticleMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
GUIDE
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendArticleMessageVO
));
}
}
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
type
))
{
return
;
return
;
...
@@ -489,7 +523,10 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -489,7 +523,10 @@ public class BookGuideBizImpl implements BookGuideBiz {
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setAltId
(
robotId
);
sendFileVO
.
setAltId
(
robotId
);
sendFileVO
.
setWxId
(
userWxId
);
sendFileVO
.
setWxId
(
userWxId
);
WxGroupSDK
.
sendFile
(
sendFileVO
);
sendFileVO
.
setMessageGroupId
(
groupId
);
sendFileVO
.
setCounts
(
counts
);
sendFileVO
.
setIndex
(
i
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendFileVO
));
}
}
}
}
log
.
info
(
"临时demo发送个人号加好友欢迎语列表信息"
+
friendGuideList
.
toString
());
log
.
info
(
"临时demo发送个人号加好友欢迎语列表信息"
+
friendGuideList
.
toString
());
...
@@ -519,7 +556,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -519,7 +556,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
String
linkUrl
=
SendWeixinRequestTools
.
splitUrlNew
(
accountSettingDto
,
replyKeywordDTO
.
getLinkUrl
(),
dto
.
getBookGroupId
(),
dto
.
getClassifyId
(),
groupQrcodeInfo
.
getId
());
String
linkUrl
=
SendWeixinRequestTools
.
splitUrlNew
(
accountSettingDto
,
replyKeywordDTO
.
getLinkUrl
(),
dto
.
getBookGroupId
(),
dto
.
getClassifyId
(),
groupQrcodeInfo
.
getId
());
replyKeywordDTO
.
setLinkUrl
(
linkUrl
);
replyKeywordDTO
.
setLinkUrl
(
linkUrl
);
}
}
S
endWeixinRequestTools
.
sendKeywordMessage
(
replyKeywordDTO
,
agreeAddUserDTO
.
getRobotWxId
(),
agreeAddUserDTO
.
getUserWxId
(),
agreeAddUserDTO
.
getIp
(),
SendMessageTypeEnum
.
SELF
.
getCode
());
s
endWeixinRequestTools
.
sendKeywordMessage
(
replyKeywordDTO
,
agreeAddUserDTO
.
getRobotWxId
(),
agreeAddUserDTO
.
getUserWxId
(),
agreeAddUserDTO
.
getIp
(),
SendMessageTypeEnum
.
SELF
.
getCode
());
}
}
}
}
}
}
...
@@ -700,7 +737,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -700,7 +737,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
sendGuideMessageDTO
.
setDto
(
dto
);
sendGuideMessageDTO
.
setDto
(
dto
);
sendGuideMessageDTO
.
setIp
(
pushAddUserMessageDTO
.
getIp
());
sendGuideMessageDTO
.
setIp
(
pushAddUserMessageDTO
.
getIp
());
sendGuideMessageDTO
.
setAccountSettingDto
(
accountSettingDto
);
sendGuideMessageDTO
.
setAccountSettingDto
(
accountSettingDto
);
S
endWeixinRequestTools
.
sendDefaultMessage
(
sendGuideMessageDTO
);
s
endWeixinRequestTools
.
sendDefaultMessage
(
sendGuideMessageDTO
);
}
else
{
}
else
{
//处理链接
//处理链接
handleUrl
(
replyMessages
,
wechatInfo
,
classifyQrcodeInfo
);
handleUrl
(
replyMessages
,
wechatInfo
,
classifyQrcodeInfo
);
...
@@ -715,13 +752,13 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -715,13 +752,13 @@ public class BookGuideBizImpl implements BookGuideBiz {
sendGuideMessageDTO
.
setIp
(
pushAddUserMessageDTO
.
getIp
());
sendGuideMessageDTO
.
setIp
(
pushAddUserMessageDTO
.
getIp
());
sendGuideMessageDTO
.
setCode
(
SendMessageTypeEnum
.
GROUP
.
getCode
());
sendGuideMessageDTO
.
setCode
(
SendMessageTypeEnum
.
GROUP
.
getCode
());
sendGuideMessageDTO
.
setAccountSettingDto
(
accountSettingDto
);
sendGuideMessageDTO
.
setAccountSettingDto
(
accountSettingDto
);
S
endWeixinRequestTools
.
sendGuideMessage
(
sendGuideMessageDTO
);
s
endWeixinRequestTools
.
sendGuideMessage
(
sendGuideMessageDTO
);
//新增欢迎语应用触发记录
//新增欢迎语应用触发记录
addGuideAppTouchRecord
(
replyMessages
,
weixinGroupId
,
classifyQrcodeInfo
.
getBookGroupId
(),
classifyQrcodeInfo
.
getClassifyId
());
addGuideAppTouchRecord
(
replyMessages
,
weixinGroupId
,
classifyQrcodeInfo
.
getBookGroupId
(),
classifyQrcodeInfo
.
getClassifyId
());
}
}
if
(
bookGuide
!=
null
&&
bookGuide
.
getIsRecommend
()
!=
null
&&
bookGuide
.
getIsRecommend
()
==
1
)
{
if
(
bookGuide
!=
null
&&
bookGuide
.
getIsRecommend
()
!=
null
&&
bookGuide
.
getIsRecommend
()
==
1
)
{
//推送公众号消息
//推送公众号消息
S
endWeixinRequestTools
.
sendAccountMessage
(
weixinGroupId
,
bookGuide
.
getRecommendLanguage
(),
robotId
,
wechatInfo
,
pushAddUserMessageDTO
.
getIp
());
s
endWeixinRequestTools
.
sendAccountMessage
(
weixinGroupId
,
bookGuide
.
getRecommendLanguage
(),
robotId
,
wechatInfo
,
pushAddUserMessageDTO
.
getIp
());
}
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/BookKeywordBizImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
keywords
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
keywords
.
biz
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
...
@@ -90,6 +91,7 @@ import com.pcloud.book.personalstage.biz.PersonalStageBiz;
...
@@ -90,6 +91,7 @@ import com.pcloud.book.personalstage.biz.PersonalStageBiz;
import
com.pcloud.book.personalstage.biz.PersonalStageJumpBiz
;
import
com.pcloud.book.personalstage.biz.PersonalStageJumpBiz
;
import
com.pcloud.book.personalstage.enums.JumpTypeEnum
;
import
com.pcloud.book.personalstage.enums.JumpTypeEnum
;
import
com.pcloud.book.reading.biz.ReadingActivityBiz
;
import
com.pcloud.book.reading.biz.ReadingActivityBiz
;
import
com.pcloud.book.skill.dto.AppOrProductReplyDTO
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.channelcenter.base.constants.ChannelEnum
;
import
com.pcloud.channelcenter.base.constants.ChannelEnum
;
import
com.pcloud.channelcenter.qrcode.service.QrcodeSceneService
;
import
com.pcloud.channelcenter.qrcode.service.QrcodeSceneService
;
...
@@ -251,6 +253,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -251,6 +253,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
private
PersonalStageBiz
personalStageBiz
;
private
PersonalStageBiz
personalStageBiz
;
@Autowired
@Autowired
private
PersonalStageJumpBiz
personalStageJumpBiz
;
private
PersonalStageJumpBiz
personalStageJumpBiz
;
@Autowired
private
SendWeixinRequestTools
sendWeixinRequestTools
;
/**
/**
* 字符串切割长度
* 字符串切割长度
...
@@ -625,6 +629,10 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -625,6 +629,10 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
String
ip
=
sendTextDTO
.
getIp
();
String
ip
=
sendTextDTO
.
getIp
();
Integer
code
=
sendTextDTO
.
getCode
();
Integer
code
=
sendTextDTO
.
getCode
();
String
robotId
=
sendTextDTO
.
getWxId
();
String
robotId
=
sendTextDTO
.
getWxId
();
String
uuid
=
UUID
.
randomUUID
().
toString
();
RobotProcessTypeEnum
robotProcessType
=
RobotProcessTypeEnum
.
USER_BOOK_SEARCH
;
int
counts
=
1
;
int
index
=
0
;
if
(
bookDto
==
null
){
if
(
bookDto
==
null
){
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
"如果这里没有你需要的,小睿深表歉意,小睿还在不断丰富阅读内容,提升阅读体验,一旦发现好东西就会快马加鞭分享给你的!"
);
sendTextMessageVO
.
setContent
(
"如果这里没有你需要的,小睿深表歉意,小睿还在不断丰富阅读内容,提升阅读体验,一旦发现好东西就会快马加鞭分享给你的!"
);
...
@@ -632,12 +640,16 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -632,12 +640,16 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
code
);
sendTextMessageVO
.
setCode
(
code
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setMessageGroupId
(
uuid
);
sendTextMessageVO
.
setRobotProcessType
(
robotProcessType
);
sendTextMessageVO
.
setIndex
(
index
);
sendTextMessageVO
.
setCounts
(
counts
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
String
h5link
=
wechatGroupLinkPrefix
+
"/dialog/search?wxId="
+
userWxId
+
"&robotWxId="
+
robotId
;
String
h5link
=
wechatGroupLinkPrefix
+
"/dialog/search?wxId="
+
userWxId
+
"&robotWxId="
+
robotId
;
String
linkUrl
=
UrlUtils
.
getShortUrl4Own
(
h5link
);
String
linkUrl
=
UrlUtils
.
getShortUrl4Own
(
h5link
);
linkUrl
=
"★"
+
linkUrl
+
"★"
;
linkUrl
=
"★"
+
linkUrl
+
"★"
;
sendTextMessageVO
.
setContent
(
"详情点击进入:"
+
linkUrl
);
sendTextMessageVO
.
setContent
(
"详情点击进入:"
+
linkUrl
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
)
);
}
else
{
}
else
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
...
@@ -648,7 +660,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -648,7 +660,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
String
linkUrl
=
UrlUtils
.
getShortUrl4Own
(
h5link
);
String
linkUrl
=
UrlUtils
.
getShortUrl4Own
(
h5link
);
linkUrl
=
"★"
+
linkUrl
+
"★"
;
linkUrl
=
"★"
+
linkUrl
+
"★"
;
sendTextMessageVO
.
setContent
(
"详情点击进入:"
+
linkUrl
);
sendTextMessageVO
.
setContent
(
"详情点击进入:"
+
linkUrl
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setMessageGroupId
(
uuid
);
sendTextMessageVO
.
setRobotProcessType
(
robotProcessType
);
sendTextMessageVO
.
setIndex
(
index
);
sendTextMessageVO
.
setCounts
(
counts
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
//插入触发记录
//插入触发记录
SearchRecord
searchRecord
=
new
SearchRecord
();
SearchRecord
searchRecord
=
new
SearchRecord
();
searchRecord
.
setContent
(
bookName
);
searchRecord
.
setContent
(
bookName
);
...
@@ -812,8 +828,10 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -812,8 +828,10 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
int
a
=
(
int
)
Math
.
floor
(
Math
.
random
()*
replies
.
size
());
int
a
=
(
int
)
Math
.
floor
(
Math
.
random
()*
replies
.
size
());
replies
=
Arrays
.
asList
(
replies
.
get
(
a
));
replies
=
Arrays
.
asList
(
replies
.
get
(
a
));
}
}
String
uuid
=
UUID
.
randomUUID
().
toString
();
RobotProcessTypeEnum
robotProcessType
=
RobotProcessTypeEnum
.
PCLOUD_KEYWORD
;
for
(
PcloudKeywordReply
reply:
replies
){
for
(
PcloudKeywordReply
reply:
replies
){
sendPcloudKeywordReply
(
reply
,
robotId
,
userWxId
,
ip
,
code
);
sendPcloudKeywordReply
(
reply
,
robotId
,
userWxId
,
ip
,
code
,
uuid
,
robotProcessType
,
replies
.
indexOf
(
reply
),
replies
.
size
()
);
}
}
//有关联技能,发送H5页面链接,取第一个技能
//有关联技能,发送H5页面链接,取第一个技能
if
(!
StringUtil
.
isEmpty
(
pcloudKeyword
.
getSkillIds
())){
if
(!
StringUtil
.
isEmpty
(
pcloudKeyword
.
getSkillIds
())){
...
@@ -827,7 +845,10 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -827,7 +845,10 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
code
);
sendTextMessageVO
.
setCode
(
code
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setMessageGroupId
(
UUID
.
randomUUID
().
toString
());
sendTextMessageVO
.
setIndex
(
0
);
sendTextMessageVO
.
setCounts
(
1
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
}
}
else
{
}
else
{
...
@@ -839,7 +860,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -839,7 +860,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
@ParamLog
(
"平台端个人号关键词回复"
)
@ParamLog
(
"平台端个人号关键词回复"
)
public
void
sendPcloudKeywordReply
(
PcloudKeywordReply
reply
,
String
robotId
,
String
userWxId
,
String
ip
,
Integer
code
){
public
void
sendPcloudKeywordReply
(
PcloudKeywordReply
reply
,
String
robotId
,
String
userWxId
,
String
ip
,
Integer
code
,
String
uuid
,
RobotProcessTypeEnum
robotProcessType
,
int
index
,
int
counts
){
Integer
type
=
reply
.
getType
();
Integer
type
=
reply
.
getType
();
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
type
))
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
...
@@ -848,7 +869,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -848,7 +869,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
code
);
sendTextMessageVO
.
setCode
(
code
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setMessageGroupId
(
uuid
);
sendTextMessageVO
.
setRobotProcessType
(
robotProcessType
);
sendTextMessageVO
.
setIndex
(
index
);
sendTextMessageVO
.
setCounts
(
counts
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
}
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
type
))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
...
@@ -857,11 +882,26 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -857,11 +882,26 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
sendPicMessageVO
.
setPicUrl
(
reply
.
getPicUrl
());
sendPicMessageVO
.
setPicUrl
(
reply
.
getPicUrl
());
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setCode
(
code
);
sendPicMessageVO
.
setCode
(
code
);
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
sendPicMessageVO
.
setMessageGroupId
(
uuid
);
sendPicMessageVO
.
setRobotProcessType
(
robotProcessType
);
sendPicMessageVO
.
setIndex
(
index
);
sendPicMessageVO
.
setCounts
(
counts
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
}
}
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
type
))
{
pcloudRobotSet
.
sendAppOrProductReply
(
reply
.
getServeType
(),
reply
.
getServeId
(),
AppOrProductReplyDTO
appOrProductReplyDTO
=
new
AppOrProductReplyDTO
();
reply
.
getLinkUrl
(),
robotId
,
userWxId
,
ip
,
code
);
appOrProductReplyDTO
.
setServeType
(
reply
.
getServeType
());
appOrProductReplyDTO
.
setServeId
(
reply
.
getServeId
());
appOrProductReplyDTO
.
setLinkUrl
(
reply
.
getLinkUrl
());
appOrProductReplyDTO
.
setRobotWxId
(
robotId
);
appOrProductReplyDTO
.
setUserWxId
(
userWxId
);
appOrProductReplyDTO
.
setIp
(
ip
);
appOrProductReplyDTO
.
setSendMessageType
(
code
);
appOrProductReplyDTO
.
setMessageGroupId
(
uuid
);
appOrProductReplyDTO
.
setRobotProcessTypeEnum
(
robotProcessType
);
appOrProductReplyDTO
.
setIndex
(
index
);
appOrProductReplyDTO
.
setCounts
(
counts
);
pcloudRobotSet
.
sendAppOrProductReply
(
appOrProductReplyDTO
);
}
}
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
))
{
SendFileVO
sendFileVO
=
new
SendFileVO
();
SendFileVO
sendFileVO
=
new
SendFileVO
();
...
@@ -881,7 +921,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -881,7 +921,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setAltId
(
robotId
);
sendFileVO
.
setAltId
(
robotId
);
sendFileVO
.
setWxId
(
userWxId
);
sendFileVO
.
setWxId
(
userWxId
);
WxGroupSDK
.
sendFile
(
sendFileVO
);
sendFileVO
.
setMessageGroupId
(
uuid
);
sendFileVO
.
setRobotProcessType
(
robotProcessType
);
sendFileVO
.
setIndex
(
index
);
sendFileVO
.
setCounts
(
counts
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendFileVO
));
}
}
if
(
ReplyTypeEnum
.
LINK
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
LINK
.
value
.
equals
(
type
))
{
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
...
@@ -893,7 +937,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -893,7 +937,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
sendArticleMessageVO
.
setPicUrl
(
reply
.
getPicUrl
());
sendArticleMessageVO
.
setPicUrl
(
reply
.
getPicUrl
());
sendArticleMessageVO
.
setTitle
(
reply
.
getContent
());
sendArticleMessageVO
.
setTitle
(
reply
.
getContent
());
sendArticleMessageVO
.
setIp
(
ip
);
sendArticleMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
sendArticleMessageVO
.
setMessageGroupId
(
uuid
);
sendArticleMessageVO
.
setRobotProcessType
(
robotProcessType
);
sendArticleMessageVO
.
setIndex
(
index
);
sendArticleMessageVO
.
setCounts
(
counts
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendArticleMessageVO
));
}
}
}
}
...
@@ -938,6 +986,10 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -938,6 +986,10 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
String
ip
=
sendTextDTO
.
getIp
();
String
ip
=
sendTextDTO
.
getIp
();
Integer
code
=
sendTextDTO
.
getCode
();
Integer
code
=
sendTextDTO
.
getCode
();
String
robotId
=
sendTextDTO
.
getWxId
();
String
robotId
=
sendTextDTO
.
getWxId
();
String
uuid
=
UUID
.
randomUUID
().
toString
();
RobotProcessTypeEnum
robotProcessType
=
RobotProcessTypeEnum
.
PCLOUD_NOT_KEYWORD
;
int
index
=
0
;
int
counts
=
1
;
for
(
NotKeywordItem
notKeywordItem:
list
){
for
(
NotKeywordItem
notKeywordItem:
list
){
Integer
type
=
notKeywordItem
.
getType
();
Integer
type
=
notKeywordItem
.
getType
();
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
type
))
{
...
@@ -947,7 +999,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -947,7 +999,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
code
);
sendTextMessageVO
.
setCode
(
code
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setMessageGroupId
(
uuid
);
sendTextMessageVO
.
setRobotProcessType
(
robotProcessType
);
sendTextMessageVO
.
setIndex
(
index
);
sendTextMessageVO
.
setCounts
(
counts
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
}
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
))
{
SendFileVO
sendFileVO
=
new
SendFileVO
();
SendFileVO
sendFileVO
=
new
SendFileVO
();
...
@@ -967,7 +1023,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -967,7 +1023,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setAltId
(
robotId
);
sendFileVO
.
setAltId
(
robotId
);
sendFileVO
.
setWxId
(
userWxId
);
sendFileVO
.
setWxId
(
userWxId
);
WxGroupSDK
.
sendFile
(
sendFileVO
);
sendFileVO
.
setMessageGroupId
(
uuid
);
sendFileVO
.
setRobotProcessType
(
robotProcessType
);
sendFileVO
.
setIndex
(
index
);
sendFileVO
.
setCounts
(
counts
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendFileVO
));
}
}
}
}
}
}
...
@@ -982,8 +1042,12 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -982,8 +1042,12 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
if
(
ListUtils
.
isEmpty
(
replyList
)){
if
(
ListUtils
.
isEmpty
(
replyList
)){
return
;
return
;
}
}
RobotProcessTypeEnum
robotProcessType
=
RobotProcessTypeEnum
.
PCLOUD_KEYWORD
;
String
uuid
=
UUID
.
randomUUID
().
toString
();
for
(
SelfRobotKeywordReply
keywordReply
:
replyList
){
for
(
SelfRobotKeywordReply
keywordReply
:
replyList
){
Integer
type
=
keywordReply
.
getType
();
Integer
type
=
keywordReply
.
getType
();
Integer
index
=
replyList
.
indexOf
(
keywordReply
);
Integer
counts
=
replyList
.
size
();
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
type
))
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
Map
<
String
,
String
>
paramMap
=
new
HashMap
<>();
Map
<
String
,
String
>
paramMap
=
new
HashMap
<>();
...
@@ -994,7 +1058,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -994,7 +1058,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
code
);
sendTextMessageVO
.
setCode
(
code
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setMessageGroupId
(
uuid
);
sendTextMessageVO
.
setRobotProcessType
(
robotProcessType
);
sendTextMessageVO
.
setIndex
(
index
);
sendTextMessageVO
.
setCounts
(
counts
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));;
}
}
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
type
))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
...
@@ -1003,7 +1071,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -1003,7 +1071,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
sendPicMessageVO
.
setPicUrl
(
keywordReply
.
getPicUrl
());
sendPicMessageVO
.
setPicUrl
(
keywordReply
.
getPicUrl
());
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setCode
(
code
);
sendPicMessageVO
.
setCode
(
code
);
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
sendPicMessageVO
.
setMessageGroupId
(
uuid
);
sendPicMessageVO
.
setRobotProcessType
(
robotProcessType
);
sendPicMessageVO
.
setIndex
(
index
);
sendPicMessageVO
.
setCounts
(
counts
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
}
}
if
(
ReplyTypeEnum
.
LINK
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
LINK
.
value
.
equals
(
type
))
{
/* SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
/* SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
...
@@ -1018,7 +1090,12 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -1018,7 +1090,12 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
sendTextMessageVO.setWxGroupId(userWxId);
sendTextMessageVO.setWxGroupId(userWxId);
sendTextMessageVO.setIp(ip);
sendTextMessageVO.setIp(ip);
sendTextMessageVO.setCode(code);
sendTextMessageVO.setCode(code);
WxGroupSDK.sendTextMessage(sendTextMessageVO);*/
sendTextMessageVO.setMessageGroupId(uuid);
sendTextMessageVO.setRobotProcessType(robotProcessType);
sendTextMessageVO.setIndex(index);
sendTextMessageVO.setCounts(counts);
wechatGroupConsr.sendMessage(sendTextMessageVO);;
*/
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
sendArticleMessageVO
.
setCode
(
code
);
sendArticleMessageVO
.
setCode
(
code
);
...
@@ -1029,7 +1106,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -1029,7 +1106,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
sendArticleMessageVO
.
setPicUrl
(
keywordReply
.
getPicUrl
());
sendArticleMessageVO
.
setPicUrl
(
keywordReply
.
getPicUrl
());
sendArticleMessageVO
.
setTitle
(
keywordReply
.
getContent
());
sendArticleMessageVO
.
setTitle
(
keywordReply
.
getContent
());
sendArticleMessageVO
.
setIp
(
ip
);
sendArticleMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
sendArticleMessageVO
.
setMessageGroupId
(
uuid
);
sendArticleMessageVO
.
setRobotProcessType
(
robotProcessType
);
sendArticleMessageVO
.
setIndex
(
index
);
sendArticleMessageVO
.
setCounts
(
counts
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendArticleMessageVO
));
}
}
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
type
))
{
BookGroupDTO
bookGroupDTO
=
bookGroupDao
.
getDTOById
(
selfRobotKeyword
.
getBookGroupId
());
BookGroupDTO
bookGroupDTO
=
bookGroupDao
.
getDTOById
(
selfRobotKeyword
.
getBookGroupId
());
...
@@ -1056,7 +1137,12 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -1056,7 +1137,12 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
sendTextMessageVO.setWxGroupId(userWxId);
sendTextMessageVO.setWxGroupId(userWxId);
sendTextMessageVO.setIp(ip);
sendTextMessageVO.setIp(ip);
sendTextMessageVO.setCode(code);
sendTextMessageVO.setCode(code);
WxGroupSDK.sendTextMessage(sendTextMessageVO);*/
sendTextMessageVO.setMessageGroupId(uuid);
sendTextMessageVO.setRobotProcessType(robotProcessType);
sendTextMessageVO.setIndex(index);
sendTextMessageVO.setCounts(counts);
wechatGroupConsr.sendMessage(sendTextMessageVO);;
*/
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
sendArticleMessageVO
.
setCode
(
code
);
sendArticleMessageVO
.
setCode
(
code
);
...
@@ -1067,7 +1153,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -1067,7 +1153,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
sendArticleMessageVO
.
setPicUrl
(
keywordReply
.
getPicUrl
());
sendArticleMessageVO
.
setPicUrl
(
keywordReply
.
getPicUrl
());
sendArticleMessageVO
.
setTitle
(
keywordReply
.
getContent
());
sendArticleMessageVO
.
setTitle
(
keywordReply
.
getContent
());
sendArticleMessageVO
.
setIp
(
ip
);
sendArticleMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
sendArticleMessageVO
.
setMessageGroupId
(
uuid
);
sendArticleMessageVO
.
setRobotProcessType
(
robotProcessType
);
sendArticleMessageVO
.
setIndex
(
index
);
sendArticleMessageVO
.
setCounts
(
counts
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendArticleMessageVO
));
}
}
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
))
{
SendFileVO
sendFileVO
=
new
SendFileVO
();
SendFileVO
sendFileVO
=
new
SendFileVO
();
...
@@ -1087,7 +1177,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -1087,7 +1177,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setAltId
(
robotId
);
sendFileVO
.
setAltId
(
robotId
);
sendFileVO
.
setWxId
(
userWxId
);
sendFileVO
.
setWxId
(
userWxId
);
WxGroupSDK
.
sendFile
(
sendFileVO
);
sendFileVO
.
setMessageGroupId
(
uuid
);
sendFileVO
.
setRobotProcessType
(
robotProcessType
);
sendFileVO
.
setIndex
(
index
);
sendFileVO
.
setCounts
(
counts
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendFileVO
));
}
}
}
}
}
}
...
@@ -1153,8 +1247,10 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -1153,8 +1247,10 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
if
(
MethodEnum
.
RANDOM
.
value
.
equals
(
pcloudNotKeyword
.
getMethod
())){
if
(
MethodEnum
.
RANDOM
.
value
.
equals
(
pcloudNotKeyword
.
getMethod
())){
replies
=
Arrays
.
asList
(
replies
.
get
(
new
Random
().
nextInt
(
replies
.
size
())));
replies
=
Arrays
.
asList
(
replies
.
get
(
new
Random
().
nextInt
(
replies
.
size
())));
}
}
String
uuid
=
UUID
.
randomUUID
().
toString
();
RobotProcessTypeEnum
robotProcessType
=
RobotProcessTypeEnum
.
PCLOUD_NOT_KEYWORD
;
for
(
PcloudKeywordReply
reply:
replies
){
for
(
PcloudKeywordReply
reply:
replies
){
sendPcloudKeywordReply
(
reply
,
robotId
,
userWxId
,
ip
,
code
);
sendPcloudKeywordReply
(
reply
,
robotId
,
userWxId
,
ip
,
code
,
uuid
,
robotProcessType
,
replies
.
indexOf
(
reply
),
replies
.
size
()
);
}
}
}
}
}
}
...
@@ -1376,7 +1472,10 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -1376,7 +1472,10 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
vo
.
setAltId
(
robotId
);
vo
.
setAltId
(
robotId
);
vo
.
setWxGroupId
(
userWxId
);
vo
.
setWxGroupId
(
userWxId
);
vo
.
setIp
(
ip
);
vo
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
vo
);
vo
.
setMessageGroupId
(
UUID
.
randomUUID
().
toString
());
vo
.
setIndex
(
0
);
vo
.
setCounts
(
1
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
vo
));
log
.
info
(
"发送收到暗号后的本书介绍 : {}"
,
vo
);
log
.
info
(
"发送收到暗号后的本书介绍 : {}"
,
vo
);
}
}
...
@@ -1434,7 +1533,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -1434,7 +1533,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
sendTextMessageVO
.
setAltId
(
sendTextDTO
.
getWxId
());
sendTextMessageVO
.
setAltId
(
sendTextDTO
.
getWxId
());
sendTextMessageVO
.
setWxGroupId
(
wxGroupId
);
sendTextMessageVO
.
setWxGroupId
(
wxGroupId
);
sendTextMessageVO
.
setIp
(
findIp
(
wxGroupId
));
sendTextMessageVO
.
setIp
(
findIp
(
wxGroupId
));
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
log
.
info
(
"发送入群邀请链接之前发冒泡消息:"
+
sendTextMessageVO
.
toString
());
log
.
info
(
"发送入群邀请链接之前发冒泡消息:"
+
sendTextMessageVO
.
toString
());
}
}
...
@@ -1579,7 +1679,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -1579,7 +1679,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
if
(
content
.
length
()
>
LE
)
{
if
(
content
.
length
()
>
LE
)
{
replyKeywordDTO
.
setReplyType
(
ReplyTypeEnum
.
TEXT
.
value
);
replyKeywordDTO
.
setReplyType
(
ReplyTypeEnum
.
TEXT
.
value
);
replyKeywordDTO
.
setContent
(
sb
.
toString
());
replyKeywordDTO
.
setContent
(
sb
.
toString
());
S
endWeixinRequestTools
.
sendKeywordMessage
(
replyKeywordDTO
,
robotId
,
weixinGroupId
,
ip
,
code
);
s
endWeixinRequestTools
.
sendKeywordMessage
(
replyKeywordDTO
,
robotId
,
weixinGroupId
,
ip
,
code
);
sb
=
toAdd
;
sb
=
toAdd
;
}
else
{
}
else
{
sb
=
content
;
sb
=
content
;
...
@@ -1589,7 +1689,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -1589,7 +1689,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
ReplyKeywordDTO
keywordDTO
=
replyKeyWords
.
get
(
0
);
ReplyKeywordDTO
keywordDTO
=
replyKeyWords
.
get
(
0
);
keywordDTO
.
setReplyType
(
ReplyTypeEnum
.
TEXT
.
value
);
keywordDTO
.
setReplyType
(
ReplyTypeEnum
.
TEXT
.
value
);
keywordDTO
.
setContent
(
sb
.
toString
());
keywordDTO
.
setContent
(
sb
.
toString
());
S
endWeixinRequestTools
.
sendKeywordMessage
(
keywordDTO
,
robotId
,
weixinGroupId
,
ip
,
code
);
s
endWeixinRequestTools
.
sendKeywordMessage
(
keywordDTO
,
robotId
,
weixinGroupId
,
ip
,
code
);
for
(
ReplyKeywordDTO
replyKeywordDTO
:
replyKeyWords
)
{
for
(
ReplyKeywordDTO
replyKeywordDTO
:
replyKeyWords
)
{
//新增关键词触发记录
//新增关键词触发记录
...
@@ -1671,7 +1771,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -1671,7 +1771,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
);
S
endWeixinRequestTools
.
sendKeywordMessage
(
replyKeywordDTO
,
robotId
,
weixinGroupId
,
ip
,
code
);
s
endWeixinRequestTools
.
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/biz/impl/SelfRobotKeywordBizImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
keywords
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
keywords
.
biz
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
...
@@ -534,7 +535,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
...
@@ -534,7 +535,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setWxGroupId
(
wxUserId
);
sendTextMessageVO
.
setWxGroupId
(
wxUserId
);
sendTextMessageVO
.
setIp
(
getIpByRobot
(
robotId
));
sendTextMessageVO
.
setIp
(
getIpByRobot
(
robotId
));
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
else
if
(
"file"
.
equals
(
skill
.
getResourceType
()))
{
}
else
if
(
"file"
.
equals
(
skill
.
getResourceType
()))
{
// 发送文件
// 发送文件
SendFileVO
sendFileVO
=
new
SendFileVO
();
SendFileVO
sendFileVO
=
new
SendFileVO
();
...
@@ -543,7 +545,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
...
@@ -543,7 +545,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
sendFileVO
.
setIp
(
getIpByRobot
(
robotId
));
sendFileVO
.
setIp
(
getIpByRobot
(
robotId
));
sendFileVO
.
setAltId
(
robotId
);
sendFileVO
.
setAltId
(
robotId
);
sendFileVO
.
setWxId
(
wxUserId
);
sendFileVO
.
setWxId
(
wxUserId
);
WxGroupSDK
.
sendFile
(
sendFileVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendFileVO
));
}
else
if
(
"img"
.
equals
(
skill
.
getResourceType
()))
{
}
else
if
(
"img"
.
equals
(
skill
.
getResourceType
()))
{
// 发送图片
// 发送图片
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
...
@@ -552,7 +555,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
...
@@ -552,7 +555,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
sendPicMessageVO
.
setWxGroupId
(
wxUserId
);
sendPicMessageVO
.
setWxGroupId
(
wxUserId
);
sendPicMessageVO
.
setPicUrl
(
skill
.
getImgUrl
());
sendPicMessageVO
.
setPicUrl
(
skill
.
getImgUrl
());
sendPicMessageVO
.
setIp
(
getIpByRobot
(
robotId
));
sendPicMessageVO
.
setIp
(
getIpByRobot
(
robotId
));
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
}
}
});
});
return
skill
.
getReplyContent
();
return
skill
.
getReplyContent
();
...
@@ -586,7 +590,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
...
@@ -586,7 +590,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
sendPicMessageVO
.
setWxGroupId
(
wxUserId
);
sendPicMessageVO
.
setWxGroupId
(
wxUserId
);
sendPicMessageVO
.
setPicUrl
(
skill
.
getImgUrl
());
sendPicMessageVO
.
setPicUrl
(
skill
.
getImgUrl
());
sendPicMessageVO
.
setIp
(
getIpByRobot
(
robotId
));
sendPicMessageVO
.
setIp
(
getIpByRobot
(
robotId
));
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
});
});
return
skill
.
getReplyContent
();
return
skill
.
getReplyContent
();
}
}
...
@@ -601,7 +606,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
...
@@ -601,7 +606,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setWxGroupId
(
wxUserId
);
sendTextMessageVO
.
setWxGroupId
(
wxUserId
);
sendTextMessageVO
.
setIp
(
getIpByRobot
(
robotId
));
sendTextMessageVO
.
setIp
(
getIpByRobot
(
robotId
));
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
else
if
(
id
==
2
){
}
else
if
(
id
==
2
){
sendTextMessageVO
.
setContent
(
"计划怎么样?我按照计划执行后效果很好哦,等你订阅后我们一起阅读"
);
sendTextMessageVO
.
setContent
(
"计划怎么样?我按照计划执行后效果很好哦,等你订阅后我们一起阅读"
);
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
...
@@ -609,7 +615,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
...
@@ -609,7 +615,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setWxGroupId
(
wxUserId
);
sendTextMessageVO
.
setWxGroupId
(
wxUserId
);
sendTextMessageVO
.
setIp
(
getIpByRobot
(
robotId
));
sendTextMessageVO
.
setIp
(
getIpByRobot
(
robotId
));
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
else
{
}
else
{
sendTextMessageVO
.
setContent
(
" 你还在犹豫吗?早起的鸟儿有虫吃,我先行动起来喽~"
);
sendTextMessageVO
.
setContent
(
" 你还在犹豫吗?早起的鸟儿有虫吃,我先行动起来喽~"
);
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
...
@@ -617,7 +624,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
...
@@ -617,7 +624,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setWxGroupId
(
wxUserId
);
sendTextMessageVO
.
setWxGroupId
(
wxUserId
);
sendTextMessageVO
.
setIp
(
getIpByRobot
(
robotId
));
sendTextMessageVO
.
setIp
(
getIpByRobot
(
robotId
));
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/mq/topic/UpdateWXGroupNameListener.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
mq
.
topic
;
package
com
.
pcloud
.
book
.
mq
.
topic
;
import
com.alibaba.fastjson.JSON
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.biz.WeixinQrcodeBiz
;
import
com.pcloud.book.group.biz.WeixinQrcodeBiz
;
import
com.pcloud.book.group.dao.GroupQrcodeDao
;
import
com.pcloud.book.group.dao.GroupQrcodeDao
;
...
@@ -70,7 +71,8 @@ public class UpdateWXGroupNameListener {
...
@@ -70,7 +71,8 @@ public class UpdateWXGroupNameListener {
sendTextMessageVO
.
setWxGroupId
(
wechatGroupId
);
sendTextMessageVO
.
setWxGroupId
(
wechatGroupId
);
LOGGER
.
info
(
"发送警告文本消息"
+
sendTextMessageVO
.
toString
());
LOGGER
.
info
(
"发送警告文本消息"
+
sendTextMessageVO
.
toString
());
sendTextMessageVO
.
setIp
(
findIp
(
wechatGroupId
));
sendTextMessageVO
.
setIp
(
findIp
(
wechatGroupId
));
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));;
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"接收修改群名称失败"
+
e
.
getMessage
(),
e
);
LOGGER
.
error
(
"接收修改群名称失败"
+
e
.
getMessage
(),
e
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/mq/topic/WXGroupLearningReportListener.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
mq
.
topic
;
package
com
.
pcloud
.
book
.
mq
.
topic
;
import
com.alibaba.fastjson.JSON
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.biz.LearningReportBiz
;
import
com.pcloud.book.group.biz.LearningReportBiz
;
import
com.pcloud.book.group.biz.WeixinQrcodeBiz
;
import
com.pcloud.book.group.biz.WeixinQrcodeBiz
;
import
com.pcloud.book.group.dao.BookGroupClassifyDao
;
import
com.pcloud.book.group.dao.BookGroupClassifyDao
;
...
@@ -56,6 +58,8 @@ public class WXGroupLearningReportListener {
...
@@ -56,6 +58,8 @@ public class WXGroupLearningReportListener {
private
QrcodeSceneConsr
qrcodeSceneConsr
;
private
QrcodeSceneConsr
qrcodeSceneConsr
;
@Autowired
@Autowired
private
WeixinQrcodeBiz
weixinQrcodeBiz
;
private
WeixinQrcodeBiz
weixinQrcodeBiz
;
@Autowired
private
WechatGroupConsr
wechatGroupConsr
;
@ParamLog
(
"接收学习报告topic"
)
@ParamLog
(
"接收学习报告topic"
)
...
@@ -108,7 +112,8 @@ public class WXGroupLearningReportListener {
...
@@ -108,7 +112,8 @@ public class WXGroupLearningReportListener {
sendTextMessageVO
.
setAltId
(
alt
);
sendTextMessageVO
.
setAltId
(
alt
);
sendTextMessageVO
.
setContent
(
"个人专属学习报告,及群成员元气排行榜。点击获取"
+
resultUrl
);
sendTextMessageVO
.
setContent
(
"个人专属学习报告,及群成员元气排行榜。点击获取"
+
resultUrl
);
sendTextMessageVO
.
setIp
(
findIp
(
wechatGroupId
));
sendTextMessageVO
.
setIp
(
findIp
(
wechatGroupId
));
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));;
LOGGER
.
info
(
"发送文字消息结束"
+
sendTextMessageVO
.
toString
());
LOGGER
.
info
(
"发送文字消息结束"
+
sendTextMessageVO
.
toString
());
if
(
ListUtils
.
isEmpty
(
learningScoreDTOS
))
{
if
(
ListUtils
.
isEmpty
(
learningScoreDTOS
))
{
LOGGER
.
info
(
"没有排行记录,不发送图片groupQrcodeId="
+
groupQrcodeId
);
LOGGER
.
info
(
"没有排行记录,不发送图片groupQrcodeId="
+
groupQrcodeId
);
...
@@ -119,7 +124,8 @@ public class WXGroupLearningReportListener {
...
@@ -119,7 +124,8 @@ public class WXGroupLearningReportListener {
sendPicMessageVO
.
setWxGroupId
(
wechatGroupId
);
sendPicMessageVO
.
setWxGroupId
(
wechatGroupId
);
sendPicMessageVO
.
setAltId
(
alt
);
sendPicMessageVO
.
setAltId
(
alt
);
sendPicMessageVO
.
setIp
(
findIp
(
wechatGroupId
));
sendPicMessageVO
.
setIp
(
findIp
(
wechatGroupId
));
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
LOGGER
.
info
(
"发送分享图消息结束"
+
sendPicMessageVO
.
toString
());
LOGGER
.
info
(
"发送分享图消息结束"
+
sendPicMessageVO
.
toString
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"接收学习报告topic失败"
+
e
.
getMessage
(),
e
);
LOGGER
.
error
(
"接收学习报告topic失败"
+
e
.
getMessage
(),
e
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/pcloudkeyword/biz/impl/PcloudRobotBizImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
pcloudkeyword
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
pcloudkeyword
.
biz
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.dao.BookDao
;
import
com.pcloud.book.book.dao.BookDao
;
...
@@ -61,11 +62,7 @@ import com.pcloud.resourcecenter.product.dto.ProductDto;
...
@@ -61,11 +62,7 @@ import com.pcloud.resourcecenter.product.dto.ProductDto;
import
com.pcloud.wechatgroup.group.dto.GroupRobotDTO
;
import
com.pcloud.wechatgroup.group.dto.GroupRobotDTO
;
import
com.pcloud.wechatgroup.message.dto.SendTextDTO
;
import
com.pcloud.wechatgroup.message.dto.SendTextDTO
;
import
com.pcloud.wechatgroup.selfrobot.dto.RobotBaseInfoDTO
;
import
com.pcloud.wechatgroup.selfrobot.dto.RobotBaseInfoDTO
;
import
com.sdk.wxgroup.SendFileVO
;
import
com.sdk.wxgroup.*
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
com.sdk.wxgroup.SendPicMessageVO
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
com.sdk.wxgroup.im.mimc.BusinessConstant
;
import
com.sdk.wxgroup.im.mimc.BusinessConstant
;
import
com.sdk.wxgroup.im.mimc.dto.SendMomentsDTO
;
import
com.sdk.wxgroup.im.mimc.dto.SendMomentsDTO
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.MapUtils
;
...
@@ -77,11 +74,7 @@ import org.springframework.stereotype.Component;
...
@@ -77,11 +74,7 @@ import org.springframework.stereotype.Component;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Component
(
"pcloudRobotBiz"
)
@Component
(
"pcloudRobotBiz"
)
...
@@ -307,6 +300,9 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz {
...
@@ -307,6 +300,9 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz {
}
}
List
<
PcloudRobotWelcome
>
robotWelcomeList
=
pcloudRobotWelcomeDao
.
getRobotWelcomeListByPcloudClassifyId
(
pcloudRobot
.
getRobotType
().
longValue
());
List
<
PcloudRobotWelcome
>
robotWelcomeList
=
pcloudRobotWelcomeDao
.
getRobotWelcomeListByPcloudClassifyId
(
pcloudRobot
.
getRobotType
().
longValue
());
pcloudRobotSet
.
fillRobotWelcome
(
robotWelcomeList
);
pcloudRobotSet
.
fillRobotWelcome
(
robotWelcomeList
);
Integer
count
=
robotWelcomeList
.
size
();
String
messageGroup
=
UUID
.
randomUUID
().
toString
();
Integer
index
=
0
;
for
(
PcloudRobotWelcome
robotWelcome
:
robotWelcomeList
)
{
for
(
PcloudRobotWelcome
robotWelcome
:
robotWelcomeList
)
{
try
{
try
{
Thread
.
sleep
(
1000
*
welcomeDuration
);
Thread
.
sleep
(
1000
*
welcomeDuration
);
...
@@ -321,7 +317,11 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz {
...
@@ -321,7 +317,11 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz {
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setMessageGroupId
(
messageGroup
);
sendTextMessageVO
.
setCounts
(
count
);
sendTextMessageVO
.
setIndex
(
index
);
sendTextMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
WELCOME
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
else
if
(
WelcomeReplyTypeEnum
.
IMAGE
.
value
.
equals
(
replyType
))
{
}
else
if
(
WelcomeReplyTypeEnum
.
IMAGE
.
value
.
equals
(
replyType
))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setWxGroupId
(
userWxId
);
sendPicMessageVO
.
setWxGroupId
(
userWxId
);
...
@@ -329,7 +329,11 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz {
...
@@ -329,7 +329,11 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz {
sendPicMessageVO
.
setPicUrl
(
robotWelcome
.
getPicUrl
());
sendPicMessageVO
.
setPicUrl
(
robotWelcome
.
getPicUrl
());
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
sendPicMessageVO
.
setMessageGroupId
(
messageGroup
);
sendPicMessageVO
.
setCounts
(
count
);
sendPicMessageVO
.
setIndex
(
index
);
sendPicMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
WELCOME
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
}
else
if
(
WelcomeReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
replyType
))
{
}
else
if
(
WelcomeReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
replyType
))
{
SendFileVO
sendFileVO
=
new
SendFileVO
();
SendFileVO
sendFileVO
=
new
SendFileVO
();
sendFileVO
.
setFileUrl
(
robotWelcome
.
getResourceUrl
());
sendFileVO
.
setFileUrl
(
robotWelcome
.
getResourceUrl
());
...
@@ -343,7 +347,11 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz {
...
@@ -343,7 +347,11 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz {
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setWxId
(
userWxId
);
sendFileVO
.
setWxId
(
userWxId
);
sendFileVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendFileVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendFile
(
sendFileVO
);
sendFileVO
.
setMessageGroupId
(
messageGroup
);
sendFileVO
.
setCounts
(
count
);
sendFileVO
.
setIndex
(
index
);
sendFileVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
WELCOME
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendFileVO
));
}
else
if
(
WelcomeReplyTypeEnum
.
AUDIO
.
value
.
equals
(
replyType
)){
}
else
if
(
WelcomeReplyTypeEnum
.
AUDIO
.
value
.
equals
(
replyType
)){
SendMomentsDTO
sendMomentsDTO
=
new
SendMomentsDTO
();
SendMomentsDTO
sendMomentsDTO
=
new
SendMomentsDTO
();
GroupRobotDTO
info
=
wechatGroupConsr
.
getGroupRobotByRobotId
(
robotWxId
);
GroupRobotDTO
info
=
wechatGroupConsr
.
getGroupRobotByRobotId
(
robotWxId
);
...
@@ -355,8 +363,13 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz {
...
@@ -355,8 +363,13 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz {
sendMomentsDTO
.
setContent
(
userWxId
);
sendMomentsDTO
.
setContent
(
userWxId
);
sendMomentsDTO
.
setLink
(
robotWelcome
.
getResourceUrl
());
sendMomentsDTO
.
setLink
(
robotWelcome
.
getResourceUrl
());
sendMomentsDTO
.
setIp
(
ip
);
sendMomentsDTO
.
setIp
(
ip
);
sendMomentsDTO
.
setMessageGroupId
(
messageGroup
);
sendMomentsDTO
.
setCounts
(
count
);
sendMomentsDTO
.
setIndex
(
index
);
sendMomentsDTO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
WELCOME
);
WxGroupSDK
.
sendMessageToPhone
(
sendMomentsDTO
);
WxGroupSDK
.
sendMessageToPhone
(
sendMomentsDTO
);
}
}
index
++;
}
}
}
}
if
(
robotClassify
!=
null
&&
robotClassify
.
getIsOpenPushH5url
()
!=
null
&&
robotClassify
.
getIsOpenPushH5url
()
==
1
)
{
if
(
robotClassify
!=
null
&&
robotClassify
.
getIsOpenPushH5url
()
!=
null
&&
robotClassify
.
getIsOpenPushH5url
()
==
1
)
{
...
@@ -370,7 +383,8 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz {
...
@@ -370,7 +383,8 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz {
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
}
}
}
});
});
...
@@ -696,7 +710,8 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz {
...
@@ -696,7 +710,8 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz {
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
else
if
(
WelcomeReplyTypeEnum
.
IMAGE
.
value
.
equals
(
replyType
))
{
}
else
if
(
WelcomeReplyTypeEnum
.
IMAGE
.
value
.
equals
(
replyType
))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setWxGroupId
(
userWxId
);
sendPicMessageVO
.
setWxGroupId
(
userWxId
);
...
@@ -704,7 +719,8 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz {
...
@@ -704,7 +719,8 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz {
sendPicMessageVO
.
setPicUrl
(
tdReplyDTO
.
getPicUrl
());
sendPicMessageVO
.
setPicUrl
(
tdReplyDTO
.
getPicUrl
());
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
}
else
if
(
WelcomeReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
replyType
))
{
}
else
if
(
WelcomeReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
replyType
))
{
String
fileName
=
tdReplyDTO
.
getResourceName
();
String
fileName
=
tdReplyDTO
.
getResourceName
();
String
fileType
=
tdReplyDTO
.
getFileType
();
String
fileType
=
tdReplyDTO
.
getFileType
();
...
@@ -718,7 +734,8 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz {
...
@@ -718,7 +734,8 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz {
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setWxId
(
userWxId
);
sendFileVO
.
setWxId
(
userWxId
);
sendFileVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendFileVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendFile
(
sendFileVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendFileVO
));
}
}
}
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/pcloudkeyword/set/PcloudRobotSet.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
pcloudkeyword
.
set
;
package
com
.
pcloud
.
book
.
pcloudkeyword
.
set
;
import
com.alibaba.fastjson.JSON
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.content.ResourceConsr
;
import
com.pcloud.book.consumer.content.ResourceConsr
;
import
com.pcloud.book.consumer.resource.ProductConsr
;
import
com.pcloud.book.consumer.resource.ProductConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.enums.AppAndProductTypeEnum
;
import
com.pcloud.book.group.enums.AppAndProductTypeEnum
;
import
com.pcloud.book.group.tools.SendWeixinRequestTools
;
import
com.pcloud.book.group.tools.SendWeixinRequestTools
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
import
com.pcloud.book.pcloudkeyword.entity.PcloudRobotWelcome
;
import
com.pcloud.book.pcloudkeyword.entity.PcloudRobotWelcome
;
import
com.pcloud.book.pcloudkeyword.enums.WelcomeReplyTypeEnum
;
import
com.pcloud.book.pcloudkeyword.enums.WelcomeReplyTypeEnum
;
import
com.pcloud.book.skill.dto.AppOrProductReplyDTO
;
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
;
...
@@ -38,6 +41,8 @@ public class PcloudRobotSet {
...
@@ -38,6 +41,8 @@ public class PcloudRobotSet {
private
AppConsr
appConsr
;
private
AppConsr
appConsr
;
@Autowired
@Autowired
private
QrcodeSceneConsr
qrcodeSceneConsr
;
private
QrcodeSceneConsr
qrcodeSceneConsr
;
@Autowired
private
WechatGroupConsr
wechatGroupConsr
;
@ParamLog
(
"填充欢迎语回复"
)
@ParamLog
(
"填充欢迎语回复"
)
public
void
fillRobotWelcome
(
List
<
PcloudRobotWelcome
>
robotWelcomeList
)
{
public
void
fillRobotWelcome
(
List
<
PcloudRobotWelcome
>
robotWelcomeList
)
{
...
@@ -72,15 +77,14 @@ public class PcloudRobotSet {
...
@@ -72,15 +77,14 @@ public class PcloudRobotSet {
}
}
}
}
}
}
public
void
sendAppOrProductReply
(
String
serveType
,
Long
serveId
,
String
linkUrl
,
public
void
sendAppOrProductReply
(
AppOrProductReplyDTO
replyDTO
)
{
String
robotWxId
,
String
userWxId
,
String
ip
,
Integer
code
)
{
AccountSettingDto
accountSettingDto
=
null
;
AccountSettingDto
accountSettingDto
=
null
;
String
typeName
=
""
;
String
typeName
=
""
;
String
picUrl
=
""
;
String
picUrl
=
""
;
String
title
=
""
;
String
title
=
""
;
String
resultUrl
=
""
;
String
resultUrl
=
""
;
if
(
AppAndProductTypeEnum
.
APP
.
value
.
equals
(
serveType
))
{
if
(
AppAndProductTypeEnum
.
APP
.
value
.
equals
(
replyDTO
.
getServeType
()
))
{
AppDto
appDto
=
appConsr
.
getBaseById
(
serveId
);
AppDto
appDto
=
appConsr
.
getBaseById
(
replyDTO
.
getServeId
()
);
if
(
appDto
!=
null
)
{
if
(
appDto
!=
null
)
{
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
appDto
.
getChannelId
());
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
appDto
.
getChannelId
());
typeName
=
appDto
.
getTypeName
();
typeName
=
appDto
.
getTypeName
();
...
@@ -88,31 +92,35 @@ public class PcloudRobotSet {
...
@@ -88,31 +92,35 @@ public class PcloudRobotSet {
title
=
appDto
.
getTitle
();
title
=
appDto
.
getTitle
();
}
}
if
(
accountSettingDto
!=
null
)
{
if
(
accountSettingDto
!=
null
)
{
String
endUrl
=
linkUrl
+
"&wxId="
+
userWxId
+
"&robotWxId="
+
robotWxId
;
String
endUrl
=
replyDTO
.
getLinkUrl
()
+
"&wxId="
+
replyDTO
.
getUserWxId
()
+
"&robotWxId="
+
replyDTO
.
getRobotWxId
()
;
String
resultLinkUrl
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
endUrl
);
String
resultLinkUrl
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
endUrl
);
resultUrl
=
UrlUtils
.
getShortUrl4Own
(
resultLinkUrl
);
resultUrl
=
UrlUtils
.
getShortUrl4Own
(
resultLinkUrl
);
}
}
}
}
if
(
AppAndProductTypeEnum
.
PRODUCT
.
value
.
equals
(
serveType
))
{
if
(
AppAndProductTypeEnum
.
PRODUCT
.
value
.
equals
(
replyDTO
.
getServeType
()
))
{
ProductDto
productDto
=
productConsr
.
getProBaseById
(
serveId
);
ProductDto
productDto
=
productConsr
.
getProBaseById
(
replyDTO
.
getServeId
()
);
if
(
productDto
!=
null
)
{
if
(
productDto
!=
null
)
{
typeName
=
productDto
.
getProductTypeDto
()
==
null
?
""
:
productDto
.
getProductTypeDto
().
getTypeName
();
typeName
=
productDto
.
getProductTypeDto
()
==
null
?
""
:
productDto
.
getProductTypeDto
().
getTypeName
();
picUrl
=
productDto
.
getCoverImg
();
picUrl
=
productDto
.
getCoverImg
();
title
=
productDto
.
getProductName
();
title
=
productDto
.
getProductName
();
resultUrl
=
UrlUtils
.
getShortUrl4Own
(
linkUrl
+
"&wxId="
+
userWxId
+
"&robotWxId="
+
robotWxId
);
resultUrl
=
UrlUtils
.
getShortUrl4Own
(
replyDTO
.
getLinkUrl
()
+
"&wxId="
+
replyDTO
.
getUserWxId
()
+
"&robotWxId="
+
replyDTO
.
getRobotWxId
()
);
}
}
}
}
if
(!
StringUtils
.
isEmpty
(
resultUrl
))
{
if
(!
StringUtils
.
isEmpty
(
resultUrl
))
{
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
sendArticleMessageVO
.
setCode
(
code
);
sendArticleMessageVO
.
setCode
(
replyDTO
.
getSendMessageType
()
);
sendArticleMessageVO
.
setAltId
(
r
obotWxId
);
sendArticleMessageVO
.
setAltId
(
r
eplyDTO
.
getRobotWxId
()
);
sendArticleMessageVO
.
setDescription
(
typeName
);
sendArticleMessageVO
.
setDescription
(
typeName
);
sendArticleMessageVO
.
setWxGroupId
(
userWxId
);
sendArticleMessageVO
.
setWxGroupId
(
replyDTO
.
getUserWxId
()
);
sendArticleMessageVO
.
setLinkUrl
(
resultUrl
);
sendArticleMessageVO
.
setLinkUrl
(
resultUrl
);
sendArticleMessageVO
.
setPicUrl
(
picUrl
);
sendArticleMessageVO
.
setPicUrl
(
picUrl
);
sendArticleMessageVO
.
setTitle
(
title
);
sendArticleMessageVO
.
setTitle
(
title
);
sendArticleMessageVO
.
setIp
(
ip
);
sendArticleMessageVO
.
setIp
(
replyDTO
.
getIp
());
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
sendArticleMessageVO
.
setCounts
(
replyDTO
.
getCounts
());
sendArticleMessageVO
.
setIndex
(
replyDTO
.
getIndex
());
sendArticleMessageVO
.
setMessageGroupId
(
replyDTO
.
getMessageGroupId
());
sendArticleMessageVO
.
setRobotProcessType
(
replyDTO
.
getRobotProcessTypeEnum
());
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendArticleMessageVO
));
}
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/personalstage/biz/impl/PersonalStageBizImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
personalstage
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
personalstage
.
biz
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
...
@@ -62,6 +63,7 @@ import com.pcloud.common.utils.string.StringUtil;
...
@@ -62,6 +63,7 @@ import com.pcloud.common.utils.string.StringUtil;
import
com.pcloud.contentcenter.resource.dto.ResourceDTO
;
import
com.pcloud.contentcenter.resource.dto.ResourceDTO
;
import
com.pcloud.wechatgroup.group.dto.GroupRobotDTO
;
import
com.pcloud.wechatgroup.group.dto.GroupRobotDTO
;
import
com.pcloud.wechatgroup.group.dto.GroupUserDTO
;
import
com.pcloud.wechatgroup.group.dto.GroupUserDTO
;
import
com.sdk.wxgroup.RobotProcessTypeEnum
;
import
com.sdk.wxgroup.SendFileVO
;
import
com.sdk.wxgroup.SendFileVO
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
com.sdk.wxgroup.SendPicMessageVO
;
import
com.sdk.wxgroup.SendPicMessageVO
;
...
@@ -86,6 +88,7 @@ import java.util.HashMap;
...
@@ -86,6 +88,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Random
;
import
java.util.Random
;
import
java.util.UUID
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Component
(
"personalStageBiz"
)
@Component
(
"personalStageBiz"
)
...
@@ -555,7 +558,8 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
...
@@ -555,7 +558,8 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
state
=
true
;
state
=
true
;
}
}
if
(!
state
){
//客服介入不发唤醒
if
(!
state
){
//客服介入不发唤醒
sendReplyItems
(
replyItems
,
robotId
,
userWxId
,
ip
,
wakeupDelayDTO
.
getPersonalStageUserId
());
String
uuId
=
UUID
.
randomUUID
().
toString
();
sendReplyItems
(
replyItems
,
robotId
,
userWxId
,
ip
,
wakeupDelayDTO
.
getPersonalStageUserId
(),
uuId
,
RobotProcessTypeEnum
.
PERSONAL_STAGE_WAKEUP
);
}
}
//下一个延时
//下一个延时
List
<
PersonalStageWakeup
>
wakeups
=
personalStageWakeupDao
.
getListByPersonalStageId
(
personalStageId
);
List
<
PersonalStageWakeup
>
wakeups
=
personalStageWakeupDao
.
getListByPersonalStageId
(
personalStageId
);
...
@@ -695,8 +699,8 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
...
@@ -695,8 +699,8 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
//替换需求定制单链接
//替换需求定制单链接
this
.
replacePaperUrl
(
items
,
robotId
,
userWxId
,
personalStageReply
.
getPaperId
(),
ip
);
this
.
replacePaperUrl
(
items
,
robotId
,
userWxId
,
personalStageReply
.
getPaperId
(),
ip
);
}
}
String
uuId
=
UUID
.
randomUUID
().
toString
();
sendReplyItems
(
items
,
robotId
,
userWxId
,
ip
,
personalStageUserId
);
sendReplyItems
(
items
,
robotId
,
userWxId
,
ip
,
personalStageUserId
,
uuId
,
RobotProcessTypeEnum
.
PERSONAL_STAGE_NOT_KEYWORD
);
}
}
@ParamLog
(
"替换用户输入内容"
)
@ParamLog
(
"替换用户输入内容"
)
...
@@ -732,7 +736,8 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
...
@@ -732,7 +736,8 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
else
{
}
else
{
Random
random
=
new
Random
();
Random
random
=
new
Random
();
Long
replyId
=
idsNotHasSpe
.
get
(
random
.
nextInt
(
idsNotHasSpe
.
size
()));
Long
replyId
=
idsNotHasSpe
.
get
(
random
.
nextInt
(
idsNotHasSpe
.
size
()));
...
@@ -912,12 +917,13 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
...
@@ -912,12 +917,13 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
return
;
return
;
}
}
this
.
replacePaperUrl
(
items
,
robotId
,
userWxId
,
paperId
,
ip
);
this
.
replacePaperUrl
(
items
,
robotId
,
userWxId
,
paperId
,
ip
);
sendReplyItems
(
items
,
robotId
,
userWxId
,
ip
,
personalStageUserId
);
String
uuId
=
UUID
.
randomUUID
().
toString
();
sendReplyItems
(
items
,
robotId
,
userWxId
,
ip
,
personalStageUserId
,
uuId
,
RobotProcessTypeEnum
.
PERSONAL_STAGE_FUSING
);
personalStageUserDao
.
updateFusingReplyCount
(
personalStageUserId
);
personalStageUserDao
.
updateFusingReplyCount
(
personalStageUserId
);
}
}
@ParamLog
(
"发送回复"
)
@ParamLog
(
"发送回复"
)
private
void
sendReplyItems
(
List
<
PersonalStageReplyItem
>
replyItems
,
String
robotId
,
String
userWxId
,
String
ip
,
Long
personalStageUserId
){
private
void
sendReplyItems
(
List
<
PersonalStageReplyItem
>
replyItems
,
String
robotId
,
String
userWxId
,
String
ip
,
Long
personalStageUserId
,
String
uuid
,
RobotProcessTypeEnum
robotProcessType
){
for
(
PersonalStageReplyItem
item:
replyItems
){
for
(
PersonalStageReplyItem
item:
replyItems
){
Integer
type
=
item
.
getReplyType
();
Integer
type
=
item
.
getReplyType
();
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
type
))
{
...
@@ -927,7 +933,11 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
...
@@ -927,7 +933,11 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setMessageGroupId
(
uuid
);
sendTextMessageVO
.
setRobotProcessType
(
robotProcessType
);
sendTextMessageVO
.
setIndex
(
replyItems
.
indexOf
(
item
));
sendTextMessageVO
.
setCounts
(
replyItems
.
size
());
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));;
}
}
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
type
))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
...
@@ -936,7 +946,11 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
...
@@ -936,7 +946,11 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
sendPicMessageVO
.
setPicUrl
(
item
.
getPicUrl
());
sendPicMessageVO
.
setPicUrl
(
item
.
getPicUrl
());
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
sendPicMessageVO
.
setMessageGroupId
(
uuid
);
sendPicMessageVO
.
setRobotProcessType
(
robotProcessType
);
sendPicMessageVO
.
setIndex
(
replyItems
.
indexOf
(
item
));
sendPicMessageVO
.
setCounts
(
replyItems
.
size
());
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
}
}
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
))
{
SendFileVO
sendFileVO
=
new
SendFileVO
();
SendFileVO
sendFileVO
=
new
SendFileVO
();
...
@@ -956,7 +970,11 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
...
@@ -956,7 +970,11 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setAltId
(
robotId
);
sendFileVO
.
setAltId
(
robotId
);
sendFileVO
.
setWxId
(
userWxId
);
sendFileVO
.
setWxId
(
userWxId
);
WxGroupSDK
.
sendFile
(
sendFileVO
);
sendFileVO
.
setMessageGroupId
(
uuid
);
sendFileVO
.
setRobotProcessType
(
robotProcessType
);
sendFileVO
.
setIndex
(
replyItems
.
indexOf
(
item
));
sendFileVO
.
setCounts
(
replyItems
.
size
());
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendFileVO
));
}
}
if
(
ReplyTypeEnum
.
AUDIO
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
AUDIO
.
value
.
equals
(
type
))
{
SendMomentsDTO
sendMomentsDTO
=
new
SendMomentsDTO
();
SendMomentsDTO
sendMomentsDTO
=
new
SendMomentsDTO
();
...
@@ -972,7 +990,11 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
...
@@ -972,7 +990,11 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
sendMomentsDTO
.
setContent
(
userWxId
);
sendMomentsDTO
.
setContent
(
userWxId
);
sendMomentsDTO
.
setLink
(
resourceDTO
.
getFileUrl
());
sendMomentsDTO
.
setLink
(
resourceDTO
.
getFileUrl
());
sendMomentsDTO
.
setIp
(
ip
);
sendMomentsDTO
.
setIp
(
ip
);
WxGroupSDK
.
sendMessageToPhone
(
sendMomentsDTO
);
sendMomentsDTO
.
setMessageGroupId
(
uuid
);
sendMomentsDTO
.
setRobotProcessType
(
robotProcessType
);
sendMomentsDTO
.
setIndex
(
replyItems
.
indexOf
(
item
));
sendMomentsDTO
.
setCounts
(
replyItems
.
size
());
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendMomentsDTO
));
}
}
}
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/personalstage/biz/impl/PersonalStageJumpBizImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
personalstage
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
personalstage
.
biz
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.pcloud.book.book.entity.Book
;
import
com.pcloud.book.consumer.content.ResourceConsr
;
import
com.pcloud.book.consumer.content.ResourceConsr
;
import
com.pcloud.book.consumer.feedback.FeedbackConsr
;
import
com.pcloud.book.consumer.feedback.FeedbackConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
...
@@ -46,10 +46,11 @@ import com.pcloud.contentcenter.resource.dto.ResourceDTO;
...
@@ -46,10 +46,11 @@ import com.pcloud.contentcenter.resource.dto.ResourceDTO;
import
com.pcloud.feedback.paper.dto.PaperAndQuestionDto
;
import
com.pcloud.feedback.paper.dto.PaperAndQuestionDto
;
import
com.pcloud.wechatgroup.group.dto.GroupRobotDTO
;
import
com.pcloud.wechatgroup.group.dto.GroupRobotDTO
;
import
com.pcloud.wechatgroup.group.dto.GroupUserDTO
;
import
com.pcloud.wechatgroup.group.dto.GroupUserDTO
;
import
com.sdk.wxgroup.BaseVO
;
import
com.sdk.wxgroup.RobotProcessTypeEnum
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
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.im.mimc.BusinessConstant
;
import
com.sdk.wxgroup.im.mimc.BusinessConstant
;
import
com.sdk.wxgroup.im.mimc.dto.SendMomentsDTO
;
import
com.sdk.wxgroup.im.mimc.dto.SendMomentsDTO
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -527,7 +528,8 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
...
@@ -527,7 +528,8 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
sendTextMessageVO
.
setWxGroupId
(
dto
.
getKey
());
sendTextMessageVO
.
setWxGroupId
(
dto
.
getKey
());
sendTextMessageVO
.
setIp
(
linkupDelayDTO
.
getIp
());
sendTextMessageVO
.
setIp
(
linkupDelayDTO
.
getIp
());
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
fillMessageBaseInfo
(
sendTextMessageVO
,
linkupDelayDTO
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));;
}
else
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
jumpLinkup
.
getReplyType
()))
{
}
else
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
jumpLinkup
.
getReplyType
()))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setWxGroupId
(
dto
.
getKey
());
sendPicMessageVO
.
setWxGroupId
(
dto
.
getKey
());
...
@@ -535,7 +537,8 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
...
@@ -535,7 +537,8 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
sendPicMessageVO
.
setPicUrl
(
jumpLinkup
.
getPicUrl
());
sendPicMessageVO
.
setPicUrl
(
jumpLinkup
.
getPicUrl
());
sendPicMessageVO
.
setIp
(
linkupDelayDTO
.
getIp
());
sendPicMessageVO
.
setIp
(
linkupDelayDTO
.
getIp
());
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
fillMessageBaseInfo
(
sendPicMessageVO
,
linkupDelayDTO
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
}
else
if
(
ReplyTypeEnum
.
AUDIO
.
value
.
equals
(
jumpLinkup
.
getReplyType
())){
}
else
if
(
ReplyTypeEnum
.
AUDIO
.
value
.
equals
(
jumpLinkup
.
getReplyType
())){
SendMomentsDTO
sendMomentsDTO
=
new
SendMomentsDTO
();
SendMomentsDTO
sendMomentsDTO
=
new
SendMomentsDTO
();
Map
<
Long
,
ResourceDTO
>
map
=
resourceConsr
.
mapByIds
(
Arrays
.
asList
(
jumpLinkup
.
getResourceId
()));
Map
<
Long
,
ResourceDTO
>
map
=
resourceConsr
.
mapByIds
(
Arrays
.
asList
(
jumpLinkup
.
getResourceId
()));
...
@@ -550,11 +553,20 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
...
@@ -550,11 +553,20 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
sendMomentsDTO
.
setContent
(
dto
.
getKey
());
sendMomentsDTO
.
setContent
(
dto
.
getKey
());
sendMomentsDTO
.
setLink
(
resourceDTO
.
getFileUrl
());
sendMomentsDTO
.
setLink
(
resourceDTO
.
getFileUrl
());
sendMomentsDTO
.
setIp
(
linkupDelayDTO
.
getIp
());
sendMomentsDTO
.
setIp
(
linkupDelayDTO
.
getIp
());
WxGroupSDK
.
sendMessageToPhone
(
sendMomentsDTO
);
fillMessageBaseInfo
(
sendMomentsDTO
,
linkupDelayDTO
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendMomentsDTO
));
}
}
}
}
}
}
@ParamLog
(
"填充消息基本属性"
)
private
void
fillMessageBaseInfo
(
BaseVO
baseVO
,
BaseDelayDTO
baseDelayDTO
){
baseVO
.
setRobotProcessType
(
baseDelayDTO
.
getRobotProcessType
());
baseVO
.
setMessageGroupId
(
baseDelayDTO
.
getMessageGroupId
());
baseVO
.
setIndex
(
baseDelayDTO
.
getIndex
());
baseVO
.
setCounts
(
baseDelayDTO
.
getCounts
());
}
@ParamLog
(
"处理用户提交表单阶段跳转"
)
@ParamLog
(
"处理用户提交表单阶段跳转"
)
public
boolean
handlePersonalStagePaperJump
(
String
userWxId
,
String
robotWxId
,
Long
paperId
,
String
emailContent
){
public
boolean
handlePersonalStagePaperJump
(
String
userWxId
,
String
robotWxId
,
Long
paperId
,
String
emailContent
){
if
(
null
==
paperId
){
if
(
null
==
paperId
){
...
@@ -850,7 +862,10 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
...
@@ -850,7 +862,10 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
return
;
return
;
}
}
this
.
replacePaperUrl
(
linkups
,
robotWxId
,
userWxId
,
jumpId
,
ip
);
this
.
replacePaperUrl
(
linkups
,
robotWxId
,
userWxId
,
jumpId
,
ip
);
String
messageGroupId
=
UUID
.
randomUUID
().
toString
();
int
count
=
linkups
.
size
();
for
(
PersonalStageJumpLinkup
jumpLinkup
:
linkups
){
for
(
PersonalStageJumpLinkup
jumpLinkup
:
linkups
){
int
i
=
linkups
.
indexOf
(
jumpLinkup
);
if
(
jumpLinkup
.
getToStageStartTime
()!=
null
&&
jumpLinkup
.
getToStageStartTime
()>
0
){
if
(
jumpLinkup
.
getToStageStartTime
()!=
null
&&
jumpLinkup
.
getToStageStartTime
()>
0
){
LinkupDelayDTO
linkupDelayDTO
=
new
LinkupDelayDTO
();
LinkupDelayDTO
linkupDelayDTO
=
new
LinkupDelayDTO
();
linkupDelayDTO
.
setPersonalStageJumpLinkupId
(
jumpLinkup
.
getId
());
linkupDelayDTO
.
setPersonalStageJumpLinkupId
(
jumpLinkup
.
getId
());
...
@@ -858,6 +873,10 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
...
@@ -858,6 +873,10 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
linkupDelayDTO
.
setWxId
(
userWxId
);
linkupDelayDTO
.
setWxId
(
userWxId
);
linkupDelayDTO
.
setIp
(
ip
);
linkupDelayDTO
.
setIp
(
ip
);
linkupDelayDTO
.
setPersonalStageUserId
(
personalStageUserId
);
linkupDelayDTO
.
setPersonalStageUserId
(
personalStageUserId
);
linkupDelayDTO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
PERSONAL_STAGE_JUMP
);
linkupDelayDTO
.
setMessageGroupId
(
messageGroupId
);
linkupDelayDTO
.
setIndex
(
i
);
linkupDelayDTO
.
setCounts
(
count
);
DelayQueueDTO
delayQueueDTO
=
DelayQueueDTO
.
builder
().
key
(
userWxId
).
type
(
PersonalStageConstant
.
PERSONALSTAGE_DELAY_LINKUP
).
msg
(
linkupDelayDTO
).
timeout
(
jumpLinkup
.
getToStageStartTime
()*
1000
).
build
();
DelayQueueDTO
delayQueueDTO
=
DelayQueueDTO
.
builder
().
key
(
userWxId
).
type
(
PersonalStageConstant
.
PERSONALSTAGE_DELAY_LINKUP
).
msg
(
linkupDelayDTO
).
timeout
(
jumpLinkup
.
getToStageStartTime
()*
1000
).
build
();
delayMessageSender
.
send
(
delayQueueDTO
);
delayMessageSender
.
send
(
delayQueueDTO
);
LOGGER
.
info
(
"增加跳转衔接语延时"
+
delayQueueDTO
.
toString
());
LOGGER
.
info
(
"增加跳转衔接语延时"
+
delayQueueDTO
.
toString
());
...
@@ -869,7 +888,11 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
...
@@ -869,7 +888,11 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
PERSONAL_STAGE_JUMP
);
sendTextMessageVO
.
setMessageGroupId
(
messageGroupId
);
sendTextMessageVO
.
setIndex
(
i
);
sendTextMessageVO
.
setCounts
(
count
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));;
}
else
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
jumpLinkup
.
getReplyType
()))
{
}
else
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
jumpLinkup
.
getReplyType
()))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setWxGroupId
(
userWxId
);
sendPicMessageVO
.
setWxGroupId
(
userWxId
);
...
@@ -877,7 +900,11 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
...
@@ -877,7 +900,11 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
sendPicMessageVO
.
setPicUrl
(
jumpLinkup
.
getPicUrl
());
sendPicMessageVO
.
setPicUrl
(
jumpLinkup
.
getPicUrl
());
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
sendPicMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
PERSONAL_STAGE_JUMP
);
sendPicMessageVO
.
setMessageGroupId
(
messageGroupId
);
sendPicMessageVO
.
setIndex
(
i
);
sendPicMessageVO
.
setCounts
(
count
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
}
else
if
(
ReplyTypeEnum
.
AUDIO
.
value
.
equals
(
jumpLinkup
.
getReplyType
())){
}
else
if
(
ReplyTypeEnum
.
AUDIO
.
value
.
equals
(
jumpLinkup
.
getReplyType
())){
SendMomentsDTO
sendMomentsDTO
=
new
SendMomentsDTO
();
SendMomentsDTO
sendMomentsDTO
=
new
SendMomentsDTO
();
Map
<
Long
,
ResourceDTO
>
map
=
resourceConsr
.
mapByIds
(
Arrays
.
asList
(
jumpLinkup
.
getResourceId
()));
Map
<
Long
,
ResourceDTO
>
map
=
resourceConsr
.
mapByIds
(
Arrays
.
asList
(
jumpLinkup
.
getResourceId
()));
...
@@ -892,7 +919,11 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
...
@@ -892,7 +919,11 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
sendMomentsDTO
.
setContent
(
userWxId
);
sendMomentsDTO
.
setContent
(
userWxId
);
sendMomentsDTO
.
setLink
(
resourceDTO
.
getFileUrl
());
sendMomentsDTO
.
setLink
(
resourceDTO
.
getFileUrl
());
sendMomentsDTO
.
setIp
(
ip
);
sendMomentsDTO
.
setIp
(
ip
);
WxGroupSDK
.
sendMessageToPhone
(
sendMomentsDTO
);
sendMomentsDTO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
PERSONAL_STAGE_JUMP
);
sendMomentsDTO
.
setMessageGroupId
(
messageGroupId
);
sendMomentsDTO
.
setIndex
(
i
);
sendMomentsDTO
.
setCounts
(
count
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendMomentsDTO
));
}
}
}
}
}
}
...
@@ -1013,7 +1044,11 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
...
@@ -1013,7 +1044,11 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
PERSONAL_STAGE_DELAY_PROGRESS
);
sendTextMessageVO
.
setMessageGroupId
(
UUID
.
randomUUID
().
toString
());
sendTextMessageVO
.
setIndex
(
0
);
sendTextMessageVO
.
setCounts
(
1
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));;
}
}
@Override
@Override
...
@@ -1081,7 +1116,11 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
...
@@ -1081,7 +1116,11 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
PERSONAL_STAGE_DELAY_PAPER
);
sendTextMessageVO
.
setMessageGroupId
(
UUID
.
randomUUID
().
toString
());
sendTextMessageVO
.
setIndex
(
0
);
sendTextMessageVO
.
setCounts
(
1
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));;
JedisClusterUtils
.
setJson
(
sendKey
,
userWxId
,
30
);
JedisClusterUtils
.
setJson
(
sendKey
,
userWxId
,
30
);
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/personalstage/dto/BaseDelayDTO.java
0 → 100644
View file @
6a7dd660
package
com
.
pcloud
.
book
.
personalstage
.
dto
;
import
com.sdk.wxgroup.RobotProcessTypeEnum
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
@ApiModel
(
"基础延时DTO (消息顺序使用)"
)
public
class
BaseDelayDTO
implements
Serializable
{
@ApiModelProperty
(
"消息类型"
)
private
RobotProcessTypeEnum
robotProcessType
;
@ApiModelProperty
(
"消息组id"
)
private
String
messageGroupId
;
@ApiModelProperty
(
"当前消息下标"
)
private
int
index
;
@ApiModelProperty
(
"消息总数"
)
private
int
counts
;
}
pcloud-service-book/src/main/java/com/pcloud/book/personalstage/dto/LinkupDelayDTO.java
View file @
6a7dd660
...
@@ -8,7 +8,7 @@ import java.io.Serializable;
...
@@ -8,7 +8,7 @@ import java.io.Serializable;
@Data
@Data
@ApiModel
(
"衔接语延时dto"
)
@ApiModel
(
"衔接语延时dto"
)
public
class
LinkupDelayDTO
implements
Serializable
{
public
class
LinkupDelayDTO
extends
BaseDelayDTO
{
@ApiModelProperty
(
"衔接语id"
)
@ApiModelProperty
(
"衔接语id"
)
private
Long
personalStageJumpLinkupId
;
private
Long
personalStageJumpLinkupId
;
...
@@ -20,5 +20,4 @@ public class LinkupDelayDTO implements Serializable {
...
@@ -20,5 +20,4 @@ public class LinkupDelayDTO implements Serializable {
private
String
ip
;
private
String
ip
;
@ApiModelProperty
(
"用户阶段记录id"
)
@ApiModelProperty
(
"用户阶段记录id"
)
private
Long
personalStageUserId
;
private
Long
personalStageUserId
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/push/biz/impl/PushBizImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
push
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
push
.
biz
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.app.AppConsr
;
...
@@ -367,7 +368,8 @@ public class PushBizImpl implements PushBiz {
...
@@ -367,7 +368,8 @@ public class PushBizImpl implements PushBiz {
sendTextMessageVO
.
setContent
(
pushItem
.
getTextContent
());
sendTextMessageVO
.
setContent
(
pushItem
.
getTextContent
());
sendTextMessageVO
.
setPushGroupRecordId
(
pushGroupRecordId
);
sendTextMessageVO
.
setPushGroupRecordId
(
pushGroupRecordId
);
sendTextMessageVO
.
setIp
(
findIp
(
groupId
));
sendTextMessageVO
.
setIp
(
findIp
(
groupId
));
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));;
}
}
if
(
ItemTypeEnum
.
LINK
.
value
.
equals
(
itemType
))
{
if
(
ItemTypeEnum
.
LINK
.
value
.
equals
(
itemType
))
{
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
...
@@ -385,7 +387,8 @@ public class PushBizImpl implements PushBiz {
...
@@ -385,7 +387,8 @@ public class PushBizImpl implements PushBiz {
sendArticleMessageVO
.
setTitle
(
pushItem
.
getLinkTitle
());
sendArticleMessageVO
.
setTitle
(
pushItem
.
getLinkTitle
());
sendArticleMessageVO
.
setPushGroupRecordId
(
pushGroupRecordId
);
sendArticleMessageVO
.
setPushGroupRecordId
(
pushGroupRecordId
);
sendArticleMessageVO
.
setIp
(
findIp
(
groupId
));
sendArticleMessageVO
.
setIp
(
findIp
(
groupId
));
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendArticleMessageVO
));
}
}
if
(
ItemTypeEnum
.
APP
.
value
.
equals
(
itemType
))
{
if
(
ItemTypeEnum
.
APP
.
value
.
equals
(
itemType
))
{
//通过群id获取对应基本信息
//通过群id获取对应基本信息
...
@@ -411,7 +414,8 @@ public class PushBizImpl implements PushBiz {
...
@@ -411,7 +414,8 @@ public class PushBizImpl implements PushBiz {
sendArticleMessageVO
.
setTitle
(
appDto
.
getTitle
());
sendArticleMessageVO
.
setTitle
(
appDto
.
getTitle
());
sendArticleMessageVO
.
setPushGroupRecordId
(
pushGroupRecordId
);
sendArticleMessageVO
.
setPushGroupRecordId
(
pushGroupRecordId
);
sendArticleMessageVO
.
setIp
(
findIp
(
groupId
));
sendArticleMessageVO
.
setIp
(
findIp
(
groupId
));
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendArticleMessageVO
));
//新增群发应用作品触发记录
//新增群发应用作品触发记录
addPushAppTouchRecord
(
pushItem
,
groupId
,
classifyDTO
.
getId
(),
classifyDTO
.
getBookGroupId
());
addPushAppTouchRecord
(
pushItem
,
groupId
,
classifyDTO
.
getId
(),
classifyDTO
.
getBookGroupId
());
}
}
...
@@ -433,7 +437,8 @@ public class PushBizImpl implements PushBiz {
...
@@ -433,7 +437,8 @@ public class PushBizImpl implements PushBiz {
sendArticleMessageVO
.
setTitle
(
productDto
.
getProductName
());
sendArticleMessageVO
.
setTitle
(
productDto
.
getProductName
());
sendArticleMessageVO
.
setPushGroupRecordId
(
pushGroupRecordId
);
sendArticleMessageVO
.
setPushGroupRecordId
(
pushGroupRecordId
);
sendArticleMessageVO
.
setIp
(
findIp
(
groupId
));
sendArticleMessageVO
.
setIp
(
findIp
(
groupId
));
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendArticleMessageVO
));
//新增群发应用作品触发记录
//新增群发应用作品触发记录
addPushAppTouchRecord
(
pushItem
,
groupId
,
classifyDTO
.
getId
(),
classifyDTO
.
getBookGroupId
());
addPushAppTouchRecord
(
pushItem
,
groupId
,
classifyDTO
.
getId
(),
classifyDTO
.
getBookGroupId
());
}
}
...
@@ -446,7 +451,8 @@ public class PushBizImpl implements PushBiz {
...
@@ -446,7 +451,8 @@ public class PushBizImpl implements PushBiz {
sendPicMessageVO
.
setPicUrl
(
pushItem
.
getImageUrl
());
sendPicMessageVO
.
setPicUrl
(
pushItem
.
getImageUrl
());
sendPicMessageVO
.
setPushGroupRecordId
(
pushGroupRecordId
);
sendPicMessageVO
.
setPushGroupRecordId
(
pushGroupRecordId
);
sendPicMessageVO
.
setIp
(
findIp
(
groupId
));
sendPicMessageVO
.
setIp
(
findIp
(
groupId
));
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
}
}
}
}
}
}
...
@@ -1028,7 +1034,8 @@ public class PushBizImpl implements PushBiz {
...
@@ -1028,7 +1034,8 @@ public class PushBizImpl implements PushBiz {
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setWxGroupId
(
weixinGroupId
);
sendTextMessageVO
.
setWxGroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
findIp
(
weixinGroupId
));
sendTextMessageVO
.
setIp
(
findIp
(
weixinGroupId
));
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));;
LOGGER
.
info
(
"发送早晚报"
+
sendTextMessageVO
.
toString
());
LOGGER
.
info
(
"发送早晚报"
+
sendTextMessageVO
.
toString
());
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/push/biz/impl/SelfPushBizImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
push
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
push
.
biz
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.content.ResourceConsr
;
import
com.pcloud.book.consumer.content.ResourceConsr
;
...
@@ -34,6 +35,7 @@ import com.pcloud.book.push.entity.SelfPushItem;
...
@@ -34,6 +35,7 @@ import com.pcloud.book.push.entity.SelfPushItem;
import
com.pcloud.book.push.entity.SelfPushUser
;
import
com.pcloud.book.push.entity.SelfPushUser
;
import
com.pcloud.book.push.enums.ItemTypeEnum
;
import
com.pcloud.book.push.enums.ItemTypeEnum
;
import
com.pcloud.book.push.enums.PushStatusEnum
;
import
com.pcloud.book.push.enums.PushStatusEnum
;
import
com.pcloud.book.skill.dto.AppOrProductReplyDTO
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
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
;
...
@@ -303,8 +305,9 @@ public class SelfPushBizImpl implements SelfPushBiz {
...
@@ -303,8 +305,9 @@ public class SelfPushBizImpl implements SelfPushBiz {
sendUserIds
.
addAll
(
userIdList
);
sendUserIds
.
addAll
(
userIdList
);
ThreadPoolUtils
.
SEND_MESSAGE_THREAD_POOL
.
execute
(()
->
{
ThreadPoolUtils
.
SEND_MESSAGE_THREAD_POOL
.
execute
(()
->
{
for
(
String
userId
:
sendUserIds
)
{
for
(
String
userId
:
sendUserIds
)
{
String
uuid
=
UUID
.
randomUUID
().
toString
();
for
(
SelfPushItem
pushItem
:
itemList
)
{
for
(
SelfPushItem
pushItem
:
itemList
)
{
sendSelfMsg
(
userId
,
altId
,
pushItem
);
sendSelfMsg
(
userId
,
altId
,
pushItem
,
uuid
,
itemList
.
indexOf
(
pushItem
),
itemList
.
size
()
);
}
}
}
}
selfPushItemDao
.
updatePushStatusByPushId
(
PushStatusEnum
.
SUCCESS
.
value
,
pushId
);
selfPushItemDao
.
updatePushStatusByPushId
(
PushStatusEnum
.
SUCCESS
.
value
,
pushId
);
...
@@ -324,8 +327,9 @@ public class SelfPushBizImpl implements SelfPushBiz {
...
@@ -324,8 +327,9 @@ public class SelfPushBizImpl implements SelfPushBiz {
//查好友对应的小号
//查好友对应的小号
SelfRobotBookGroupDTO
bookGroupDTO
=
bookGroupCipherUserDao
.
getSelfRobotBookGroupInfoByUser
(
userId
,
bookGroupId
);
SelfRobotBookGroupDTO
bookGroupDTO
=
bookGroupCipherUserDao
.
getSelfRobotBookGroupInfoByUser
(
userId
,
bookGroupId
);
String
altId
=
bookGroupDTO
.
getWxId
();
String
altId
=
bookGroupDTO
.
getWxId
();
String
uuid
=
UUID
.
randomUUID
().
toString
();
for
(
SelfPushItem
pushItem
:
itemList
)
{
for
(
SelfPushItem
pushItem
:
itemList
)
{
sendSelfMsg
(
userId
,
altId
,
pushItem
);
sendSelfMsg
(
userId
,
altId
,
pushItem
,
uuid
,
itemList
.
indexOf
(
pushItem
),
itemList
.
size
()
);
}
}
}
}
selfPushItemDao
.
updatePushStatusByPushId
(
PushStatusEnum
.
SUCCESS
.
value
,
pushId
);
selfPushItemDao
.
updatePushStatusByPushId
(
PushStatusEnum
.
SUCCESS
.
value
,
pushId
);
...
@@ -376,13 +380,14 @@ public class SelfPushBizImpl implements SelfPushBiz {
...
@@ -376,13 +380,14 @@ public class SelfPushBizImpl implements SelfPushBiz {
* @param altId
* @param altId
* @param selfPushItem
* @param selfPushItem
*/
*/
public
void
sendSelfMsg
(
String
userWxId
,
String
altId
,
SelfPushItem
selfPushItem
)
{
public
void
sendSelfMsg
(
String
userWxId
,
String
altId
,
SelfPushItem
selfPushItem
,
String
uuid
,
Integer
index
,
Integer
counts
)
{
if
(
StringUtil
.
isEmpty
(
userWxId
)
||
StringUtil
.
isEmpty
(
altId
)){
if
(
StringUtil
.
isEmpty
(
userWxId
)
||
StringUtil
.
isEmpty
(
altId
)){
return
;
return
;
}
}
if
(
pcloudRobotBiz
.
getUserTdState
(
altId
,
userWxId
)
==
1
)
{
if
(
pcloudRobotBiz
.
getUserTdState
(
altId
,
userWxId
)
==
1
)
{
return
;
return
;
}
}
RobotProcessTypeEnum
robotProcessType
=
RobotProcessTypeEnum
.
SELF_PUSH
;
Integer
code
=
SendMessageTypeEnum
.
SELF
.
getCode
();
Integer
code
=
SendMessageTypeEnum
.
SELF
.
getCode
();
Integer
itemType
=
selfPushItem
.
getItemType
();
Integer
itemType
=
selfPushItem
.
getItemType
();
if
(
ItemTypeEnum
.
TEXT
.
value
.
equals
(
itemType
))
{
if
(
ItemTypeEnum
.
TEXT
.
value
.
equals
(
itemType
))
{
...
@@ -393,7 +398,11 @@ public class SelfPushBizImpl implements SelfPushBiz {
...
@@ -393,7 +398,11 @@ public class SelfPushBizImpl implements SelfPushBiz {
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
getIpByRobot
(
altId
));
sendTextMessageVO
.
setIp
(
getIpByRobot
(
altId
));
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setMessageGroupId
(
uuid
);
sendTextMessageVO
.
setRobotProcessType
(
robotProcessType
);
sendTextMessageVO
.
setIndex
(
index
);
sendTextMessageVO
.
setCounts
(
counts
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
return
;
return
;
}
}
if
(
ItemTypeEnum
.
LINK
.
value
.
equals
(
itemType
))
{
if
(
ItemTypeEnum
.
LINK
.
value
.
equals
(
itemType
))
{
...
@@ -407,19 +416,35 @@ public class SelfPushBizImpl implements SelfPushBiz {
...
@@ -407,19 +416,35 @@ public class SelfPushBizImpl implements SelfPushBiz {
sendArticleMessageVO
.
setPicUrl
(
selfPushItem
.
getLinkImageUrl
());
sendArticleMessageVO
.
setPicUrl
(
selfPushItem
.
getLinkImageUrl
());
sendArticleMessageVO
.
setTitle
(
selfPushItem
.
getLinkTitle
());
sendArticleMessageVO
.
setTitle
(
selfPushItem
.
getLinkTitle
());
sendArticleMessageVO
.
setIp
(
getIpByRobot
(
altId
));
sendArticleMessageVO
.
setIp
(
getIpByRobot
(
altId
));
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
sendArticleMessageVO
.
setMessageGroupId
(
uuid
);
sendArticleMessageVO
.
setRobotProcessType
(
robotProcessType
);
sendArticleMessageVO
.
setIndex
(
index
);
sendArticleMessageVO
.
setCounts
(
counts
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendArticleMessageVO
));
return
;
return
;
}
}
if
(
ItemTypeEnum
.
APP
.
value
.
equals
(
itemType
))
{
if
(
ItemTypeEnum
.
APP
.
value
.
equals
(
itemType
))
{
AppOrProductReplyDTO
appOrProductReplyDTO
=
new
AppOrProductReplyDTO
();
appOrProductReplyDTO
.
setIp
(
getIpByRobot
(
altId
));
appOrProductReplyDTO
.
setLinkUrl
(
selfPushItem
.
getLinkUrl
());
appOrProductReplyDTO
.
setRobotWxId
(
altId
);
appOrProductReplyDTO
.
setUserWxId
(
userWxId
);
appOrProductReplyDTO
.
setSendMessageType
(
code
);
appOrProductReplyDTO
.
setRobotProcessTypeEnum
(
robotProcessType
);
appOrProductReplyDTO
.
setCounts
(
counts
);
appOrProductReplyDTO
.
setIndex
(
index
);
appOrProductReplyDTO
.
setMessageGroupId
(
uuid
);
//发送应用
//发送应用
if
(
selfPushItem
.
getAppId
()
!=
null
)
{
if
(
selfPushItem
.
getAppId
()
!=
null
)
{
pcloudRobotSet
.
sendAppOrProductReply
(
AppAndProductTypeEnum
.
APP
.
value
,
selfPushItem
.
getAppId
(),
appOrProductReplyDTO
.
setServeType
(
AppAndProductTypeEnum
.
APP
.
value
);
selfPushItem
.
getLinkUrl
(),
altId
,
userWxId
,
getIpByRobot
(
altId
),
code
);
appOrProductReplyDTO
.
setServeId
(
selfPushItem
.
getAppId
());
pcloudRobotSet
.
sendAppOrProductReply
(
appOrProductReplyDTO
);
}
}
//发送作品
//发送作品
if
(
selfPushItem
.
getProductId
()
!=
null
)
{
if
(
selfPushItem
.
getProductId
()
!=
null
)
{
pcloudRobotSet
.
sendAppOrProductReply
(
AppAndProductTypeEnum
.
PRODUCT
.
value
,
selfPushItem
.
getProductId
(),
appOrProductReplyDTO
.
setServeType
(
AppAndProductTypeEnum
.
PRODUCT
.
value
);
selfPushItem
.
getLinkUrl
(),
altId
,
userWxId
,
getIpByRobot
(
altId
),
code
);
appOrProductReplyDTO
.
setServeId
(
selfPushItem
.
getProductId
());
pcloudRobotSet
.
sendAppOrProductReply
(
appOrProductReplyDTO
);
}
}
return
;
//应用类型参与群发C1002391
return
;
//应用类型参与群发C1002391
}
}
...
@@ -430,7 +455,11 @@ public class SelfPushBizImpl implements SelfPushBiz {
...
@@ -430,7 +455,11 @@ public class SelfPushBizImpl implements SelfPushBiz {
sendPicMessageVO
.
setWxGroupId
(
userWxId
);
sendPicMessageVO
.
setWxGroupId
(
userWxId
);
sendPicMessageVO
.
setPicUrl
(
selfPushItem
.
getImageUrl
());
sendPicMessageVO
.
setPicUrl
(
selfPushItem
.
getImageUrl
());
sendPicMessageVO
.
setIp
(
getIpByRobot
(
altId
));
sendPicMessageVO
.
setIp
(
getIpByRobot
(
altId
));
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
sendPicMessageVO
.
setMessageGroupId
(
uuid
);
sendPicMessageVO
.
setRobotProcessType
(
robotProcessType
);
sendPicMessageVO
.
setIndex
(
index
);
sendPicMessageVO
.
setCounts
(
counts
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
return
;
return
;
}
}
if
(
ItemTypeEnum
.
RESOURCE
.
value
.
equals
(
itemType
))
{
if
(
ItemTypeEnum
.
RESOURCE
.
value
.
equals
(
itemType
))
{
...
@@ -451,7 +480,11 @@ public class SelfPushBizImpl implements SelfPushBiz {
...
@@ -451,7 +480,11 @@ public class SelfPushBizImpl implements SelfPushBiz {
sendFileVO
.
setIp
(
getIpByRobot
(
altId
));
sendFileVO
.
setIp
(
getIpByRobot
(
altId
));
sendFileVO
.
setAltId
(
altId
);
sendFileVO
.
setAltId
(
altId
);
sendFileVO
.
setWxId
(
userWxId
);
sendFileVO
.
setWxId
(
userWxId
);
WxGroupSDK
.
sendFile
(
sendFileVO
);
sendFileVO
.
setMessageGroupId
(
uuid
);
sendFileVO
.
setRobotProcessType
(
robotProcessType
);
sendFileVO
.
setIndex
(
index
);
sendFileVO
.
setCounts
(
counts
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendFileVO
));
}
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/reading/biz/impl/ReadingActivityBizImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
reading
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
reading
.
biz
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.pcloud.book.advertising.dao.AdvertisingBrandDao
;
import
com.pcloud.book.advertising.dao.AdvertisingBrandDao
;
import
com.pcloud.book.advertising.dto.AdvertisingBrandDTO
;
import
com.pcloud.book.advertising.dto.AdvertisingBrandDTO
;
import
com.pcloud.book.advertising.entity.AdvertisingBrand
;
import
com.pcloud.book.advertising.entity.AdvertisingBrand
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.constant.BookConstant
;
import
com.pcloud.book.consumer.convert.ConvertConsr
;
import
com.pcloud.book.consumer.convert.ConvertConsr
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
...
@@ -28,6 +30,7 @@ import com.pcloud.book.reading.dto.GroupingUserDTO;
...
@@ -28,6 +30,7 @@ import com.pcloud.book.reading.dto.GroupingUserDTO;
import
com.pcloud.book.reading.dto.ReadingActivityAdditionParamDTO
;
import
com.pcloud.book.reading.dto.ReadingActivityAdditionParamDTO
;
import
com.pcloud.book.reading.dto.ReadingActivityBaseParamDTO
;
import
com.pcloud.book.reading.dto.ReadingActivityBaseParamDTO
;
import
com.pcloud.book.reading.dto.ReadingActivityDTO
;
import
com.pcloud.book.reading.dto.ReadingActivityDTO
;
import
com.pcloud.book.reading.dto.SendWxMsg4ReadingDTO
;
import
com.pcloud.book.reading.dto.UserBaseDTO
;
import
com.pcloud.book.reading.dto.UserBaseDTO
;
import
com.pcloud.book.reading.entity.*
;
import
com.pcloud.book.reading.entity.*
;
import
com.pcloud.book.reading.enums.ContentTypeEnum
;
import
com.pcloud.book.reading.enums.ContentTypeEnum
;
...
@@ -162,7 +165,8 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
...
@@ -162,7 +165,8 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
sendText
.
setAltId
(
vo
.
getAltId
());
sendText
.
setAltId
(
vo
.
getAltId
());
sendText
.
setWxGroupId
(
vo
.
getWxId
());
sendText
.
setWxGroupId
(
vo
.
getWxId
());
sendText
.
setIp
(
getIP
(
vo
.
getAltId
()));
sendText
.
setIp
(
getIP
(
vo
.
getAltId
()));
WxGroupSDK
.
sendTextMessage
(
sendText
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendText
));
return
;
return
;
}
}
// 转账金额不正确
// 转账金额不正确
...
@@ -171,7 +175,8 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
...
@@ -171,7 +175,8 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
sendText
.
setAltId
(
vo
.
getAltId
());
sendText
.
setAltId
(
vo
.
getAltId
());
sendText
.
setWxGroupId
(
vo
.
getWxId
());
sendText
.
setWxGroupId
(
vo
.
getWxId
());
sendText
.
setIp
(
getIP
(
vo
.
getAltId
()));
sendText
.
setIp
(
getIP
(
vo
.
getAltId
()));
WxGroupSDK
.
sendTextMessage
(
sendText
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendText
));
return
;
return
;
}
}
if
(
Objects
.
isNull
(
byTransferId
))
{
if
(
Objects
.
isNull
(
byTransferId
))
{
...
@@ -209,9 +214,24 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
...
@@ -209,9 +214,24 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
byTransferId
.
setStatus
(
BookBusinessConstants
.
CollectionStatus
.
COLLECTION_SUCCESSFUL
.
getCode
());
byTransferId
.
setStatus
(
BookBusinessConstants
.
CollectionStatus
.
COLLECTION_SUCCESSFUL
.
getCode
());
this
.
bookGroupCollectionDao
.
update
(
byTransferId
);
this
.
bookGroupCollectionDao
.
update
(
byTransferId
);
}
}
String
messageGroupId
=
UUID
.
randomUUID
().
toString
();
//发群规
//发群规
this
.
sendWxMsg
(
SendMessageTypeEnum
.
SELF
.
getCode
(),
byTheme
.
getRuleType
(),
vo
.
getAltId
(),
vo
.
getWxId
(),
byTheme
.
getRule
(),
byTheme
.
getRuleResourceId
(),
null
);
SendWxMsg4ReadingDTO
sendWxMsg4ReadingDTO
=
new
SendWxMsg4ReadingDTO
();
sendWxMsg4ReadingDTO
.
setCounts
(
1
);
sendWxMsg4ReadingDTO
.
setIndex
(
0
);
sendWxMsg4ReadingDTO
.
setMessageGroupId
(
messageGroupId
);
sendWxMsg4ReadingDTO
.
setRobotProcessTypeEnum
(
RobotProcessTypeEnum
.
READING_ACTIVITY
);
sendWxMsg4ReadingDTO
.
setSendMessageType
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendWxMsg4ReadingDTO
.
setRuleType
(
byTheme
.
getRuleType
());
sendWxMsg4ReadingDTO
.
setRobotId
(
vo
.
getAltId
());
sendWxMsg4ReadingDTO
.
setWxUserId
(
vo
.
getWxId
());
sendWxMsg4ReadingDTO
.
setContent
(
byTheme
.
getRule
());
sendWxMsg4ReadingDTO
.
setResourceId
(
byTheme
.
getRuleResourceId
());
sendWxMsg4ReadingDTO
.
setWxGroupId
(
null
);
this
.
sendWxMsg
(
sendWxMsg4ReadingDTO
);
// 发送邀请进群链接
// 发送邀请进群链接
String
messageGroupId4Link
=
UUID
.
randomUUID
().
toString
();
if
(
JoinTypeEnum
.
LINK
.
value
.
equals
(
byTheme
.
getJoinType
()))
{
if
(
JoinTypeEnum
.
LINK
.
value
.
equals
(
byTheme
.
getJoinType
()))
{
List
<
ReadingGroup
>
groupList
=
readingGroupDao
.
getByActivityId
(
byTheme
.
getId
());
List
<
ReadingGroup
>
groupList
=
readingGroupDao
.
getByActivityId
(
byTheme
.
getId
());
if
(
CollectionUtils
.
isEmpty
(
groupList
))
{
if
(
CollectionUtils
.
isEmpty
(
groupList
))
{
...
@@ -233,6 +253,11 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
...
@@ -233,6 +253,11 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
inviteVO
.
setWxId
(
vo
.
getWxId
());
inviteVO
.
setWxId
(
vo
.
getWxId
());
inviteVO
.
setIp
(
getIP
(
vo
.
getAltId
()));
inviteVO
.
setIp
(
getIP
(
vo
.
getAltId
()));
WxGroupSDK
.
sendGroupInvite
(
inviteVO
);
WxGroupSDK
.
sendGroupInvite
(
inviteVO
);
// inviteVO.setMessageGroupId(messageGroupId4Link);
// inviteVO.setCounts(1);
// inviteVO.setIndex(0);
// inviteVO.setRobotProcessType(RobotProcessTypeEnum.READING_ACTIVITY);
// wechatGroupConsr.sendMessage(JSON.toJSONString(inviteVO));
}
}
// 发送群二维码图片
// 发送群二维码图片
if
(
JoinTypeEnum
.
QRCODE
.
value
.
equals
(
byTheme
.
getJoinType
()))
{
if
(
JoinTypeEnum
.
QRCODE
.
value
.
equals
(
byTheme
.
getJoinType
()))
{
...
@@ -241,7 +266,11 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
...
@@ -241,7 +266,11 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
picMessageVO
.
setWxGroupId
(
vo
.
getWxId
());
picMessageVO
.
setWxGroupId
(
vo
.
getWxId
());
picMessageVO
.
setPicUrl
(
byTheme
.
getJoinQrcodePic
());
picMessageVO
.
setPicUrl
(
byTheme
.
getJoinQrcodePic
());
picMessageVO
.
setIp
(
getIP
(
vo
.
getAltId
()));
picMessageVO
.
setIp
(
getIP
(
vo
.
getAltId
()));
WxGroupSDK
.
sendPicMessage
(
picMessageVO
);
picMessageVO
.
setCounts
(
1
);
picMessageVO
.
setIndex
(
0
);
picMessageVO
.
setMessageGroupId
(
messageGroupId
);
picMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
READING_ACTIVITY
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
picMessageVO
));
}
}
}
}
...
@@ -613,27 +642,79 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
...
@@ -613,27 +642,79 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
String
altId
=
readingUser
.
getAltId
();
String
altId
=
readingUser
.
getAltId
();
String
wxUserId
=
readingUser
.
getWxUserId
();
String
wxUserId
=
readingUser
.
getWxUserId
();
//邀请语
//邀请语
String
messageGroupId4invite
=
UUID
.
randomUUID
().
toString
();
Integer
counts4invite
=
inviteList
.
size
();
Integer
index4invite
=
0
;
for
(
ReadingInvite
invite
:
inviteList
)
{
for
(
ReadingInvite
invite
:
inviteList
)
{
sendWxMsg
(
SendMessageTypeEnum
.
SELF
.
getCode
(),
invite
.
getInviteType
(),
altId
,
wxUserId
,
invite
.
getInviteContent
(),
invite
.
getInviteResourceId
(),
null
);
SendWxMsg4ReadingDTO
sendWxMsg4ReadingDTO
=
new
SendWxMsg4ReadingDTO
();
sendWxMsg4ReadingDTO
.
setCounts
(
counts4invite
);
sendWxMsg4ReadingDTO
.
setIndex
(
index4invite
);
sendWxMsg4ReadingDTO
.
setMessageGroupId
(
messageGroupId4invite
);
sendWxMsg4ReadingDTO
.
setRobotProcessTypeEnum
(
RobotProcessTypeEnum
.
READING_ACTIVITY
);
sendWxMsg4ReadingDTO
.
setSendMessageType
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendWxMsg4ReadingDTO
.
setRuleType
(
invite
.
getInviteType
());
sendWxMsg4ReadingDTO
.
setRobotId
(
altId
);
sendWxMsg4ReadingDTO
.
setWxUserId
(
wxUserId
);
sendWxMsg4ReadingDTO
.
setContent
(
invite
.
getInviteContent
());
sendWxMsg4ReadingDTO
.
setResourceId
(
invite
.
getInviteResourceId
());
sendWxMsg4ReadingDTO
.
setWxGroupId
(
null
);
sendWxMsg
(
sendWxMsg4ReadingDTO
);
index4invite
++;
}
}
//无进群条件
//无进群条件
if
(
JoinConditionEnum
.
NO
.
value
.
equals
(
readingActivity
.
getJoinCondition
())){
if
(
JoinConditionEnum
.
NO
.
value
.
equals
(
readingActivity
.
getJoinCondition
())){
//发群规
//发群规
this
.
sendWxMsg
(
SendMessageTypeEnum
.
SELF
.
getCode
(),
readingActivity
.
getRuleType
(),
altId
,
wxUserId
,
readingActivity
.
getRule
(),
readingActivity
.
getRuleResourceId
(),
null
);
SendWxMsg4ReadingDTO
sendWxMsg4ReadingDTO
=
new
SendWxMsg4ReadingDTO
();
sendWxMsg4ReadingDTO
.
setCounts
(
1
);
sendWxMsg4ReadingDTO
.
setIndex
(
0
);
sendWxMsg4ReadingDTO
.
setMessageGroupId
(
UUID
.
randomUUID
().
toString
());
sendWxMsg4ReadingDTO
.
setRobotProcessTypeEnum
(
RobotProcessTypeEnum
.
READING_ACTIVITY
);
sendWxMsg4ReadingDTO
.
setSendMessageType
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendWxMsg4ReadingDTO
.
setRuleType
(
readingActivity
.
getRuleType
());
sendWxMsg4ReadingDTO
.
setRobotId
(
altId
);
sendWxMsg4ReadingDTO
.
setWxUserId
(
wxUserId
);
sendWxMsg4ReadingDTO
.
setContent
(
readingActivity
.
getRule
());
sendWxMsg4ReadingDTO
.
setResourceId
(
readingActivity
.
getRuleResourceId
());
sendWxMsg4ReadingDTO
.
setWxGroupId
(
null
);
this
.
sendWxMsg
(
sendWxMsg4ReadingDTO
);
//发群链接/群二维码
//发群链接/群二维码
sendGroupInviteToUser
(
altId
,
wxUserId
,
readingActivity
);
sendGroupInviteToUser
(
altId
,
wxUserId
,
readingActivity
);
}
}
//关键词入群
//关键词入群
else
if
(
JoinConditionEnum
.
KEYWORD
.
value
.
equals
(
readingActivity
.
getJoinCondition
())){
else
if
(
JoinConditionEnum
.
KEYWORD
.
value
.
equals
(
readingActivity
.
getJoinCondition
())){
String
content
=
"请回复:“"
+
readingActivity
.
getJoinKeyword
()
+
"”,我会将入群链接发送给您。"
;
String
content
=
"请回复:“"
+
readingActivity
.
getJoinKeyword
()
+
"”,我会将入群链接发送给您。"
;
this
.
sendWxMsg
(
SendMessageTypeEnum
.
SELF
.
getCode
(),
ContentTypeEnum
.
TEXT
.
value
,
altId
,
wxUserId
,
content
,
null
,
null
);
SendWxMsg4ReadingDTO
sendWxMsg4ReadingDTO
=
new
SendWxMsg4ReadingDTO
();
sendWxMsg4ReadingDTO
.
setCounts
(
1
);
sendWxMsg4ReadingDTO
.
setIndex
(
0
);
sendWxMsg4ReadingDTO
.
setMessageGroupId
(
UUID
.
randomUUID
().
toString
());
sendWxMsg4ReadingDTO
.
setRobotProcessTypeEnum
(
RobotProcessTypeEnum
.
READING_ACTIVITY
);
sendWxMsg4ReadingDTO
.
setSendMessageType
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendWxMsg4ReadingDTO
.
setRuleType
(
ContentTypeEnum
.
TEXT
.
value
);
sendWxMsg4ReadingDTO
.
setRobotId
(
altId
);
sendWxMsg4ReadingDTO
.
setWxUserId
(
wxUserId
);
sendWxMsg4ReadingDTO
.
setContent
(
content
);
sendWxMsg4ReadingDTO
.
setResourceId
(
null
);
sendWxMsg4ReadingDTO
.
setWxGroupId
(
null
);
this
.
sendWxMsg
(
sendWxMsg4ReadingDTO
);
}
}
//转账入群
//转账入群
else
if
(
JoinConditionEnum
.
TRANSFER
.
value
.
equals
(
readingActivity
.
getJoinCondition
())){
else
if
(
JoinConditionEnum
.
TRANSFER
.
value
.
equals
(
readingActivity
.
getJoinCondition
())){
String
content
=
"活动名称:"
+
readingActivity
.
getTheme
()
+
"\n活动费用:¥"
+
readingActivity
.
getJoinAmount
()+
String
content
=
"活动名称:"
+
readingActivity
.
getTheme
()
+
"\n活动费用:¥"
+
readingActivity
.
getJoinAmount
()+
"\n若想参加本次活动,可直接转账给我,转账说明请填写活动名称。当转账金额与活动名称都符合时,我才会接受转账,"
+
"\n若想参加本次活动,可直接转账给我,转账说明请填写活动名称。当转账金额与活动名称都符合时,我才会接受转账,"
+
"接受后我将发送入群链接(若人数较多,可能会有延迟)。"
;
"接受后我将发送入群链接(若人数较多,可能会有延迟)。"
;
this
.
sendWxMsg
(
SendMessageTypeEnum
.
SELF
.
getCode
(),
ContentTypeEnum
.
TEXT
.
value
,
altId
,
wxUserId
,
content
,
null
,
null
);
SendWxMsg4ReadingDTO
sendWxMsg4ReadingDTO
=
new
SendWxMsg4ReadingDTO
();
sendWxMsg4ReadingDTO
.
setCounts
(
1
);
sendWxMsg4ReadingDTO
.
setIndex
(
0
);
sendWxMsg4ReadingDTO
.
setMessageGroupId
(
UUID
.
randomUUID
().
toString
());
sendWxMsg4ReadingDTO
.
setRobotProcessTypeEnum
(
RobotProcessTypeEnum
.
READING_ACTIVITY
);
sendWxMsg4ReadingDTO
.
setSendMessageType
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendWxMsg4ReadingDTO
.
setRuleType
(
ContentTypeEnum
.
TEXT
.
value
);
sendWxMsg4ReadingDTO
.
setRobotId
(
altId
);
sendWxMsg4ReadingDTO
.
setWxUserId
(
wxUserId
);
sendWxMsg4ReadingDTO
.
setContent
(
content
);
sendWxMsg4ReadingDTO
.
setResourceId
(
null
);
sendWxMsg4ReadingDTO
.
setWxGroupId
(
null
);
this
.
sendWxMsg
(
sendWxMsg4ReadingDTO
);
}
}
try
{
try
{
Thread
.
sleep
(
3000
);
Thread
.
sleep
(
3000
);
...
@@ -674,7 +755,19 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
...
@@ -674,7 +755,19 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
String
altId
=
readingUser
.
getAltId
();
String
altId
=
readingUser
.
getAltId
();
String
wxUserId
=
readingUser
.
getWxUserId
();
String
wxUserId
=
readingUser
.
getWxUserId
();
if
(!
StringUtil
.
isEmpty
(
readingActivity
.
getAwardText
()))
{
if
(!
StringUtil
.
isEmpty
(
readingActivity
.
getAwardText
()))
{
sendWxMsg
(
SendMessageTypeEnum
.
SELF
.
getCode
(),
ContentTypeEnum
.
TEXT
.
value
,
altId
,
wxUserId
,
readingActivity
.
getAwardText
(),
null
,
null
);
SendWxMsg4ReadingDTO
sendWxMsg4ReadingDTO
=
new
SendWxMsg4ReadingDTO
();
sendWxMsg4ReadingDTO
.
setCounts
(
1
);
sendWxMsg4ReadingDTO
.
setIndex
(
0
);
sendWxMsg4ReadingDTO
.
setMessageGroupId
(
UUID
.
randomUUID
().
toString
());
sendWxMsg4ReadingDTO
.
setRobotProcessTypeEnum
(
RobotProcessTypeEnum
.
READING_ACTIVITY
);
sendWxMsg4ReadingDTO
.
setSendMessageType
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendWxMsg4ReadingDTO
.
setRuleType
(
ContentTypeEnum
.
TEXT
.
value
);
sendWxMsg4ReadingDTO
.
setRobotId
(
altId
);
sendWxMsg4ReadingDTO
.
setWxUserId
(
wxUserId
);
sendWxMsg4ReadingDTO
.
setContent
(
readingActivity
.
getAwardText
());
sendWxMsg4ReadingDTO
.
setResourceId
(
null
);
sendWxMsg4ReadingDTO
.
setWxGroupId
(
null
);
sendWxMsg
(
sendWxMsg4ReadingDTO
);
}
}
if
(!
StringUtil
.
isEmpty
(
readingActivity
.
getAwardPic
()))
{
if
(!
StringUtil
.
isEmpty
(
readingActivity
.
getAwardPic
()))
{
sendSelfPic
(
altId
,
wxUserId
,
readingActivity
.
getAwardPic
());
sendSelfPic
(
altId
,
wxUserId
,
readingActivity
.
getAwardPic
());
...
@@ -697,34 +790,50 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
...
@@ -697,34 +790,50 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
if
(
StringUtil
.
isEmpty
(
altId
))
{
if
(
StringUtil
.
isEmpty
(
altId
))
{
continue
;
continue
;
}
}
sendWxMsg
(
SendMessageTypeEnum
.
GROUP
.
getCode
(),
contentType
,
altId
,
null
,
content
,
resourceId
,
wxGroupId
);
SendWxMsg4ReadingDTO
sendWxMsg4ReadingDTO
=
new
SendWxMsg4ReadingDTO
();
sendWxMsg4ReadingDTO
.
setCounts
(
1
);
sendWxMsg4ReadingDTO
.
setIndex
(
0
);
sendWxMsg4ReadingDTO
.
setMessageGroupId
(
UUID
.
randomUUID
().
toString
());
sendWxMsg4ReadingDTO
.
setRobotProcessTypeEnum
(
RobotProcessTypeEnum
.
READING_ACTIVITY
);
sendWxMsg4ReadingDTO
.
setSendMessageType
(
SendMessageTypeEnum
.
GROUP
.
getCode
());
sendWxMsg4ReadingDTO
.
setRuleType
(
contentType
);
sendWxMsg4ReadingDTO
.
setRobotId
(
altId
);
sendWxMsg4ReadingDTO
.
setWxUserId
(
null
);
sendWxMsg4ReadingDTO
.
setContent
(
content
);
sendWxMsg4ReadingDTO
.
setResourceId
(
resourceId
);
sendWxMsg4ReadingDTO
.
setWxGroupId
(
wxGroupId
);
this
.
sendWxMsg
(
sendWxMsg4ReadingDTO
);
}
}
});
});
}
}
@ParamLog
(
"发送文本或文件"
)
@ParamLog
(
"发送文本或文件"
)
public
void
sendWxMsg
(
Integer
code
,
Integer
type
,
String
altId
,
String
userWxId
,
String
content
,
String
resourceId
,
String
wxGroupId
)
{
public
void
sendWxMsg
(
SendWxMsg4ReadingDTO
readingDTO
)
{
String
ip
=
getIP
(
altId
);
String
ip
=
getIP
(
readingDTO
.
getRobotId
()
);
if
(
ContentTypeEnum
.
TEXT
.
value
.
equals
(
type
))
{
if
(
ContentTypeEnum
.
TEXT
.
value
.
equals
(
readingDTO
.
getRuleType
()
))
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setContent
(
readingDTO
.
getContent
()
);
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setAltId
(
readingDTO
.
getRobotId
()
);
if
(
SendMessageTypeEnum
.
SELF
.
getCode
().
equals
(
code
))
{
if
(
SendMessageTypeEnum
.
SELF
.
getCode
().
equals
(
readingDTO
.
getSendMessageType
()
))
{
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setWxGroupId
(
readingDTO
.
getWxUserId
()
);
}
else
if
(
SendMessageTypeEnum
.
GROUP
.
getCode
().
equals
(
code
))
{
}
else
if
(
SendMessageTypeEnum
.
GROUP
.
getCode
().
equals
(
readingDTO
.
getSendMessageType
()
))
{
sendTextMessageVO
.
setWxGroupId
(
wxGroupId
);
sendTextMessageVO
.
setWxGroupId
(
readingDTO
.
getWxGroupId
()
);
}
}
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
code
);
sendTextMessageVO
.
setCode
(
readingDTO
.
getSendMessageType
());
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setCounts
(
readingDTO
.
getCounts
());
sendTextMessageVO
.
setIndex
(
readingDTO
.
getIndex
());
sendTextMessageVO
.
setMessageGroupId
(
readingDTO
.
getMessageGroupId
());
sendTextMessageVO
.
setRobotProcessType
(
readingDTO
.
getRobotProcessTypeEnum
());
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
log
.
info
(
"发送文本 sendTextMessageVO:{}"
,
sendTextMessageVO
);
log
.
info
(
"发送文本 sendTextMessageVO:{}"
,
sendTextMessageVO
);
return
;
return
;
}
}
if
(
ContentTypeEnum
.
FILE
.
value
.
equals
(
type
))
{
if
(
ContentTypeEnum
.
FILE
.
value
.
equals
(
readingDTO
.
getRuleType
()
))
{
SendFileVO
sendFileVO
=
new
SendFileVO
();
SendFileVO
sendFileVO
=
new
SendFileVO
();
FileUploadInfo
fileUploadInfo
=
convertConsr
.
getByFileId
(
re
sourceId
);
FileUploadInfo
fileUploadInfo
=
convertConsr
.
getByFileId
(
re
adingDTO
.
getResourceId
()
);
if
(
null
==
fileUploadInfo
)
{
if
(
null
==
fileUploadInfo
)
{
log
.
error
(
"文件路径为空,resourceId"
+
re
sourceId
);
log
.
error
(
"文件路径为空,resourceId"
+
re
adingDTO
.
getResourceId
()
);
return
;
return
;
}
}
String
fileName
=
fileUploadInfo
.
getName
();
String
fileName
=
fileUploadInfo
.
getName
();
...
@@ -736,15 +845,19 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
...
@@ -736,15 +845,19 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
sendFileVO
.
setFileName
(
fileName
);
sendFileVO
.
setFileName
(
fileName
);
sendFileVO
.
setFileUrl
(
fileUploadInfo
.
getUrl
());
sendFileVO
.
setFileUrl
(
fileUploadInfo
.
getUrl
());
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setAltId
(
altId
);
sendFileVO
.
setAltId
(
readingDTO
.
getRobotId
()
);
if
(
SendMessageTypeEnum
.
SELF
.
getCode
().
equals
(
code
))
{
if
(
SendMessageTypeEnum
.
SELF
.
getCode
().
equals
(
readingDTO
.
getSendMessageType
()
))
{
sendFileVO
.
setWxId
(
userWxId
);
sendFileVO
.
setWxId
(
readingDTO
.
getWxUserId
()
);
}
else
if
(
SendMessageTypeEnum
.
GROUP
.
getCode
().
equals
(
code
))
{
}
else
if
(
SendMessageTypeEnum
.
GROUP
.
getCode
().
equals
(
readingDTO
.
getSendMessageType
()
))
{
sendFileVO
.
setWxGroupId
(
wxGroupId
);
sendFileVO
.
setWxGroupId
(
readingDTO
.
getWxGroupId
()
);
sendFileVO
.
setWxId
(
wxGroupId
);
sendFileVO
.
setWxId
(
readingDTO
.
getWxGroupId
()
);
}
}
sendFileVO
.
setCode
(
code
);
sendFileVO
.
setCode
(
readingDTO
.
getSendMessageType
());
WxGroupSDK
.
sendFile
(
sendFileVO
);
sendFileVO
.
setCounts
(
readingDTO
.
getCounts
());
sendFileVO
.
setIndex
(
readingDTO
.
getIndex
());
sendFileVO
.
setMessageGroupId
(
readingDTO
.
getMessageGroupId
());
sendFileVO
.
setRobotProcessType
(
readingDTO
.
getRobotProcessTypeEnum
());
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendFileVO
));
log
.
info
(
"发送文件 sendFileVO:{}"
,
sendFileVO
);
log
.
info
(
"发送文件 sendFileVO:{}"
,
sendFileVO
);
return
;
return
;
}
}
...
@@ -775,7 +888,19 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
...
@@ -775,7 +888,19 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
return
;
return
;
}
}
//发群规
//发群规
this
.
sendWxMsg
(
SendMessageTypeEnum
.
SELF
.
getCode
(),
readingActivity
.
getRuleType
(),
wxId
,
wxUserId
,
readingActivity
.
getRule
(),
readingActivity
.
getRuleResourceId
(),
null
);
SendWxMsg4ReadingDTO
sendWxMsg4ReadingDTO
=
new
SendWxMsg4ReadingDTO
();
sendWxMsg4ReadingDTO
.
setCounts
(
1
);
sendWxMsg4ReadingDTO
.
setIndex
(
0
);
sendWxMsg4ReadingDTO
.
setMessageGroupId
(
UUID
.
randomUUID
().
toString
());
sendWxMsg4ReadingDTO
.
setRobotProcessTypeEnum
(
RobotProcessTypeEnum
.
READING_ACTIVITY
);
sendWxMsg4ReadingDTO
.
setSendMessageType
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendWxMsg4ReadingDTO
.
setRuleType
(
readingActivity
.
getRuleType
());
sendWxMsg4ReadingDTO
.
setRobotId
(
wxId
);
sendWxMsg4ReadingDTO
.
setWxUserId
(
wxUserId
);
sendWxMsg4ReadingDTO
.
setContent
(
readingActivity
.
getRule
());
sendWxMsg4ReadingDTO
.
setResourceId
(
readingActivity
.
getRuleResourceId
());
sendWxMsg4ReadingDTO
.
setWxGroupId
(
null
);
this
.
sendWxMsg
(
sendWxMsg4ReadingDTO
);
//入群链接/群二维码
//入群链接/群二维码
this
.
sendGroupInviteToUser
(
wxId
,
wxUserId
,
readingActivity
);
this
.
sendGroupInviteToUser
(
wxId
,
wxUserId
,
readingActivity
);
}
}
...
@@ -805,6 +930,11 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
...
@@ -805,6 +930,11 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
sendGroupInviteVO
.
setWxGroupId
(
min
);
sendGroupInviteVO
.
setWxGroupId
(
min
);
sendGroupInviteVO
.
setIp
(
getIP
(
altId
));
sendGroupInviteVO
.
setIp
(
getIP
(
altId
));
WxGroupSDK
.
sendGroupInvite
(
sendGroupInviteVO
);
WxGroupSDK
.
sendGroupInvite
(
sendGroupInviteVO
);
// sendGroupInviteVO.setCounts(1);
// sendGroupInviteVO.setIndex(0);
// sendGroupInviteVO.setMessageGroupId(UUID.randomUUID().toString());
// sendGroupInviteVO.setRobotProcessType(RobotProcessTypeEnum.READING_ACTIVITY);
// wechatGroupConsr.sendMessage(sendGroupInviteVO);
log
.
info
(
"发送进群链接 sendGroupInviteVO:{}"
,
sendGroupInviteVO
);
log
.
info
(
"发送进群链接 sendGroupInviteVO:{}"
,
sendGroupInviteVO
);
return
;
return
;
}
}
...
@@ -822,7 +952,11 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
...
@@ -822,7 +952,11 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
sendPicMessageVO
.
setWxGroupId
(
userWxId
);
sendPicMessageVO
.
setWxGroupId
(
userWxId
);
sendPicMessageVO
.
setPicUrl
(
pic
);
sendPicMessageVO
.
setPicUrl
(
pic
);
sendPicMessageVO
.
setIp
(
getIP
(
altId
));
sendPicMessageVO
.
setIp
(
getIP
(
altId
));
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
sendPicMessageVO
.
setCounts
(
1
);
sendPicMessageVO
.
setIndex
(
0
);
sendPicMessageVO
.
setMessageGroupId
(
UUID
.
randomUUID
().
toString
());
sendPicMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
READING_ACTIVITY
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
log
.
info
(
"发送图片sendPicMessage:"
+
sendPicMessageVO
);
log
.
info
(
"发送图片sendPicMessage:"
+
sendPicMessageVO
);
}
}
...
@@ -1147,7 +1281,11 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
...
@@ -1147,7 +1281,11 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
sendTextMessageVO
.
setAltId
(
addWXGroupDTO
.
getWxId
());
sendTextMessageVO
.
setAltId
(
addWXGroupDTO
.
getWxId
());
sendTextMessageVO
.
setWxGroupId
(
weixinGroupId
);
sendTextMessageVO
.
setWxGroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
addWXGroupDTO
.
getIp
());
sendTextMessageVO
.
setIp
(
addWXGroupDTO
.
getIp
());
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setCounts
(
1
);
sendTextMessageVO
.
setIndex
(
0
);
sendTextMessageVO
.
setMessageGroupId
(
UUID
.
randomUUID
().
toString
());
sendTextMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
READING_ACTIVITY
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
}
}
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/reading/dto/SendWxMsg4ReadingDTO.java
0 → 100644
View file @
6a7dd660
package
com
.
pcloud
.
book
.
reading
.
dto
;
import
com.sdk.wxgroup.RobotProcessTypeEnum
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
SendWxMsg4ReadingDTO
{
private
Integer
sendMessageType
;
@ApiModelProperty
(
"群规类型(1文本2文件)"
)
private
Integer
ruleType
;
private
String
robotId
;
private
String
wxUserId
;
@ApiModelProperty
(
"群规"
)
private
String
content
;
private
String
resourceId
;
private
String
wxGroupId
;
private
Integer
counts
;
private
Integer
index
;
private
String
messageGroupId
;
private
RobotProcessTypeEnum
robotProcessTypeEnum
;
}
pcloud-service-book/src/main/java/com/pcloud/book/riddle/biz/impl/RiddleRecordBizImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
riddle
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
riddle
.
biz
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.biz.BookGroupClassifyBiz
;
import
com.pcloud.book.group.biz.BookGroupClassifyBiz
;
...
@@ -203,7 +204,8 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
...
@@ -203,7 +204,8 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
logger
.
info
(
"发送文本消息,"
+
sendTextMessageVO
);
logger
.
info
(
"发送文本消息,"
+
sendTextMessageVO
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
}
@ParamLog
(
"发送下一题"
)
@ParamLog
(
"发送下一题"
)
...
...
pcloud-service-book/src/main/java/com/pcloud/book/skill/biz/impl/PcloudGroupActivityBizImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
skill
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
skill
.
biz
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.label.LabelConsr
;
import
com.pcloud.book.consumer.label.LabelConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.biz.GroupQrcodeBiz
;
import
com.pcloud.book.group.biz.GroupQrcodeBiz
;
import
com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO
;
import
com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO
;
import
com.pcloud.book.reading.biz.ReadingActivityBiz
;
import
com.pcloud.book.reading.biz.ReadingActivityBiz
;
...
@@ -21,10 +23,12 @@ import com.pcloud.common.core.aspect.ParamLog;
...
@@ -21,10 +23,12 @@ import com.pcloud.common.core.aspect.ParamLog;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.string.StringUtilParent
;
import
com.pcloud.common.utils.string.StringUtilParent
;
import
com.sdk.wxgroup.RobotProcessTypeEnum
;
import
com.sdk.wxgroup.SendGroupInviteVO
;
import
com.sdk.wxgroup.SendGroupInviteVO
;
import
com.sdk.wxgroup.SendPicMessageVO
;
import
com.sdk.wxgroup.SendPicMessageVO
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
...
@@ -32,6 +36,7 @@ import java.util.Date;
...
@@ -32,6 +36,7 @@ import java.util.Date;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.UUID
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -51,6 +56,8 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
...
@@ -51,6 +56,8 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
private
ReadingActivityBiz
readingActivityBiz
;
private
ReadingActivityBiz
readingActivityBiz
;
@Resource
@Resource
private
LabelConsr
labelConsr
;
private
LabelConsr
labelConsr
;
@Autowired
private
WechatGroupConsr
wechatGroupConsr
;
@ParamLog
(
"保存共读活动"
)
@ParamLog
(
"保存共读活动"
)
@Override
@Override
...
@@ -101,6 +108,9 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
...
@@ -101,6 +108,9 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
log
.
error
(
"[processGroup] error 共读不存在"
);
log
.
error
(
"[processGroup] error 共读不存在"
);
return
;
return
;
}
}
Integer
count
=
1
;
String
messageGroup
=
UUID
.
randomUUID
().
toString
();
Integer
index
=
0
;
if
(
0
==
byId
.
getJoinType
())
{
if
(
0
==
byId
.
getJoinType
())
{
GroupQrcodeBaseInfoVO
groupQrcode
=
groupQrcodeBiz
.
getBaseById
(
byId
.
getBookGroupQrcodeId
());
GroupQrcodeBaseInfoVO
groupQrcode
=
groupQrcodeBiz
.
getBaseById
(
byId
.
getBookGroupQrcodeId
());
if
(
Objects
.
isNull
(
groupQrcode
))
{
if
(
Objects
.
isNull
(
groupQrcode
))
{
...
@@ -112,7 +122,11 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
...
@@ -112,7 +122,11 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
vo
.
setAltId
(
robotWxId
);
vo
.
setAltId
(
robotWxId
);
vo
.
setIp
(
readingActivityBiz
.
getIP
(
robotWxId
));
vo
.
setIp
(
readingActivityBiz
.
getIP
(
robotWxId
));
vo
.
setWxGroupId
(
groupQrcode
.
getWeixinGroupId
());
vo
.
setWxGroupId
(
groupQrcode
.
getWeixinGroupId
());
WxGroupSDK
.
sendGroupInvite
(
vo
);
vo
.
setCounts
(
count
);
vo
.
setMessageGroupId
(
messageGroup
);
vo
.
setIndex
(
index
);
vo
.
setRobotProcessType
(
RobotProcessTypeEnum
.
SKILL_REPLY
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
vo
));
log
.
info
(
"[processGroup] sendGroupInvite:{}"
,
vo
);
log
.
info
(
"[processGroup] sendGroupInvite:{}"
,
vo
);
}
}
if
(
1
==
byId
.
getJoinType
())
{
if
(
1
==
byId
.
getJoinType
())
{
...
@@ -121,7 +135,11 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
...
@@ -121,7 +135,11 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
vo
.
setWxGroupId
(
wxId
);
vo
.
setWxGroupId
(
wxId
);
vo
.
setAltId
(
robotWxId
);
vo
.
setAltId
(
robotWxId
);
vo
.
setIp
(
readingActivityBiz
.
getIP
(
robotWxId
));
vo
.
setIp
(
readingActivityBiz
.
getIP
(
robotWxId
));
WxGroupSDK
.
sendPicMessage
(
vo
);
vo
.
setCounts
(
count
);
vo
.
setMessageGroupId
(
messageGroup
);
vo
.
setIndex
(
index
);
vo
.
setRobotProcessType
(
RobotProcessTypeEnum
.
SKILL_REPLY
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
vo
));
}
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/skill/biz/impl/PcloudSkillBizImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
skill
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
skill
.
biz
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.app.AppConsr
;
...
@@ -19,6 +20,7 @@ import com.pcloud.book.skill.dao.PcloudGroupActivityDao;
...
@@ -19,6 +20,7 @@ import com.pcloud.book.skill.dao.PcloudGroupActivityDao;
import
com.pcloud.book.skill.dao.PcloudResourceDao
;
import
com.pcloud.book.skill.dao.PcloudResourceDao
;
import
com.pcloud.book.skill.dao.PcloudSkillDao
;
import
com.pcloud.book.skill.dao.PcloudSkillDao
;
import
com.pcloud.book.skill.dao.PcloudSubReplyDao
;
import
com.pcloud.book.skill.dao.PcloudSubReplyDao
;
import
com.pcloud.book.skill.dto.AppOrProductReplyDTO
;
import
com.pcloud.book.skill.entity.PcloudGroupActivity
;
import
com.pcloud.book.skill.entity.PcloudGroupActivity
;
import
com.pcloud.book.skill.entity.PcloudResource
;
import
com.pcloud.book.skill.entity.PcloudResource
;
import
com.pcloud.book.skill.entity.PcloudSkill
;
import
com.pcloud.book.skill.entity.PcloudSkill
;
...
@@ -442,6 +444,9 @@ public class PcloudSkillBizImpl implements PcloudSkillBiz {
...
@@ -442,6 +444,9 @@ public class PcloudSkillBizImpl implements PcloudSkillBiz {
}
}
private
void
sendSubReplyMessage
(
List
<
PcloudSubReply
>
subReplyList
,
String
robotWxId
,
String
userWxId
)
{
private
void
sendSubReplyMessage
(
List
<
PcloudSubReply
>
subReplyList
,
String
robotWxId
,
String
userWxId
)
{
this
.
fillRelies
(
subReplyList
);
this
.
fillRelies
(
subReplyList
);
Integer
count
=
subReplyList
.
size
();
Integer
index
=
0
;
String
messageGroupId
=
UUID
.
randomUUID
().
toString
();
for
(
PcloudSubReply
reply
:
subReplyList
)
{
for
(
PcloudSubReply
reply
:
subReplyList
)
{
Integer
type
=
reply
.
getType
();
Integer
type
=
reply
.
getType
();
GroupRobotDTO
groupRobotDTO
=
wechatGroupConsr
.
getGroupRobotByWxId
(
robotWxId
);
GroupRobotDTO
groupRobotDTO
=
wechatGroupConsr
.
getGroupRobotByWxId
(
robotWxId
);
...
@@ -453,7 +458,11 @@ public class PcloudSkillBizImpl implements PcloudSkillBiz {
...
@@ -453,7 +458,11 @@ public class PcloudSkillBizImpl implements PcloudSkillBiz {
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setCounts
(
count
);
sendTextMessageVO
.
setIndex
(
index
);
sendTextMessageVO
.
setMessageGroupId
(
messageGroupId
);
sendTextMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
SKILL_REPLY
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
else
if
(
WelcomeReplyTypeEnum
.
IMAGE
.
value
.
equals
(
type
))
{
}
else
if
(
WelcomeReplyTypeEnum
.
IMAGE
.
value
.
equals
(
type
))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setWxGroupId
(
userWxId
);
sendPicMessageVO
.
setWxGroupId
(
userWxId
);
...
@@ -461,7 +470,11 @@ public class PcloudSkillBizImpl implements PcloudSkillBiz {
...
@@ -461,7 +470,11 @@ public class PcloudSkillBizImpl implements PcloudSkillBiz {
sendPicMessageVO
.
setPicUrl
(
reply
.
getPicUrl
());
sendPicMessageVO
.
setPicUrl
(
reply
.
getPicUrl
());
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
sendPicMessageVO
.
setCounts
(
count
);
sendPicMessageVO
.
setIndex
(
index
);
sendPicMessageVO
.
setMessageGroupId
(
messageGroupId
);
sendPicMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
SKILL_REPLY
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
}
else
if
(
WelcomeReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
))
{
}
else
if
(
WelcomeReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
))
{
SendFileVO
sendFileVO
=
new
SendFileVO
();
SendFileVO
sendFileVO
=
new
SendFileVO
();
sendFileVO
.
setFileUrl
(
reply
.
getResourceUrl
());
sendFileVO
.
setFileUrl
(
reply
.
getResourceUrl
());
...
@@ -472,11 +485,27 @@ public class PcloudSkillBizImpl implements PcloudSkillBiz {
...
@@ -472,11 +485,27 @@ public class PcloudSkillBizImpl implements PcloudSkillBiz {
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setWxId
(
userWxId
);
sendFileVO
.
setWxId
(
userWxId
);
sendFileVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendFileVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendFile
(
sendFileVO
);
sendFileVO
.
setCounts
(
count
);
sendFileVO
.
setIndex
(
index
);
sendFileVO
.
setMessageGroupId
(
messageGroupId
);
sendFileVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
SKILL_REPLY
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendFileVO
));
}
else
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
type
))
{
}
else
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
type
))
{
pcloudRobotSet
.
sendAppOrProductReply
(
reply
.
getServeType
(),
reply
.
getServeId
(),
AppOrProductReplyDTO
appOrProductReplyDTO
=
new
AppOrProductReplyDTO
();
reply
.
getLinkUrl
(),
robotWxId
,
userWxId
,
ip
,
SendMessageTypeEnum
.
SELF
.
getCode
());
appOrProductReplyDTO
.
setCounts
(
count
);
appOrProductReplyDTO
.
setIndex
(
index
);
appOrProductReplyDTO
.
setIp
(
ip
);
appOrProductReplyDTO
.
setLinkUrl
(
reply
.
getLinkUrl
());
appOrProductReplyDTO
.
setMessageGroupId
(
messageGroupId
);
appOrProductReplyDTO
.
setRobotWxId
(
robotWxId
);
appOrProductReplyDTO
.
setRobotProcessTypeEnum
(
RobotProcessTypeEnum
.
SKILL_REPLY
);
appOrProductReplyDTO
.
setServeId
(
reply
.
getServeId
());
appOrProductReplyDTO
.
setServeType
(
reply
.
getServeType
());
appOrProductReplyDTO
.
setUserWxId
(
userWxId
);
appOrProductReplyDTO
.
setSendMessageType
(
SendMessageTypeEnum
.
SELF
.
getCode
());
pcloudRobotSet
.
sendAppOrProductReply
(
appOrProductReplyDTO
);
}
}
index
++;
}
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/skill/biz/impl/PcloudSubRemindBizImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
skill
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
skill
.
biz
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
...
@@ -80,11 +81,15 @@ public class PcloudSubRemindBizImpl implements PcloudSubRemindBiz {
...
@@ -80,11 +81,15 @@ public class PcloudSubRemindBizImpl implements PcloudSubRemindBiz {
if
(
ListUtils
.
isEmpty
(
replyMsgList
)){
if
(
ListUtils
.
isEmpty
(
replyMsgList
)){
continue
;
continue
;
}
}
Integer
count
=
1
;
String
messageGroup
=
UUID
.
randomUUID
().
toString
();
Integer
index
=
0
;
for
(
PcloudSubReply
pcloudSubReply
:
replyMsgList
)
{
for
(
PcloudSubReply
pcloudSubReply
:
replyMsgList
)
{
Date
sendTime
=
DateUtils
.
addMinute
(
createTime
,
pcloudSubReply
.
getRemindIntervalTime
());
Date
sendTime
=
DateUtils
.
addMinute
(
createTime
,
pcloudSubReply
.
getRemindIntervalTime
());
if
(
format
.
format
(
sendTime
).
equals
(
format
.
format
(
compareTime
))){
if
(
format
.
format
(
sendTime
).
equals
(
format
.
format
(
compareTime
))){
this
.
sendSubReplyMessage
(
Arrays
.
asList
(
pcloudSubReply
),
pcloudSubRemind
.
getRobotWxId
(),
pcloudSubRemind
.
getWxUserId
(),
pcloudSubRemind
.
getRelSkillId
(),
pcloudSubRemind
.
getSkillType
());
this
.
sendSubReplyMessage
(
Arrays
.
asList
(
pcloudSubReply
),
pcloudSubRemind
.
getRobotWxId
(),
pcloudSubRemind
.
getWxUserId
(),
pcloudSubRemind
.
getRelSkillId
(),
pcloudSubRemind
.
getSkillType
()
,
messageGroup
,
count
,
index
);
}
}
// index++;
}
}
// System.out.println(22);
// System.out.println(22);
}
}
...
@@ -147,7 +152,7 @@ public class PcloudSubRemindBizImpl implements PcloudSubRemindBiz {
...
@@ -147,7 +152,7 @@ public class PcloudSubRemindBizImpl implements PcloudSubRemindBiz {
}
}
}
}
private
void
sendSubReplyMessage
(
List
<
PcloudSubReply
>
subReplyList
,
String
robotWxId
,
String
userWxId
,
Integer
relSkillId
,
Integer
skillType
)
{
private
void
sendSubReplyMessage
(
List
<
PcloudSubReply
>
subReplyList
,
String
robotWxId
,
String
userWxId
,
Integer
relSkillId
,
Integer
skillType
,
String
messageGroupId
,
Integer
count
,
Integer
index
)
{
this
.
fillRelies
(
subReplyList
);
this
.
fillRelies
(
subReplyList
);
for
(
PcloudSubReply
reply
:
subReplyList
)
{
for
(
PcloudSubReply
reply
:
subReplyList
)
{
Integer
type
=
reply
.
getType
();
Integer
type
=
reply
.
getType
();
...
@@ -160,7 +165,11 @@ public class PcloudSubRemindBizImpl implements PcloudSubRemindBiz {
...
@@ -160,7 +165,11 @@ public class PcloudSubRemindBizImpl implements PcloudSubRemindBiz {
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setCounts
(
count
);
sendTextMessageVO
.
setMessageGroupId
(
messageGroupId
);
sendTextMessageVO
.
setIndex
(
index
);
sendTextMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
PCLOUD_SUB_REMIND
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
else
if
(
WelcomeReplyTypeEnum
.
IMAGE
.
value
.
equals
(
type
))
{
}
else
if
(
WelcomeReplyTypeEnum
.
IMAGE
.
value
.
equals
(
type
))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setWxGroupId
(
userWxId
);
sendPicMessageVO
.
setWxGroupId
(
userWxId
);
...
@@ -168,7 +177,11 @@ public class PcloudSubRemindBizImpl implements PcloudSubRemindBiz {
...
@@ -168,7 +177,11 @@ public class PcloudSubRemindBizImpl implements PcloudSubRemindBiz {
sendPicMessageVO
.
setPicUrl
(
reply
.
getPicUrl
());
sendPicMessageVO
.
setPicUrl
(
reply
.
getPicUrl
());
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
sendPicMessageVO
.
setCounts
(
count
);
sendPicMessageVO
.
setMessageGroupId
(
messageGroupId
);
sendPicMessageVO
.
setIndex
(
index
);
sendPicMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
PCLOUD_SUB_REMIND
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
}
else
if
(
WelcomeReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
))
{
}
else
if
(
WelcomeReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
))
{
SendFileVO
sendFileVO
=
new
SendFileVO
();
SendFileVO
sendFileVO
=
new
SendFileVO
();
sendFileVO
.
setFileUrl
(
reply
.
getResourceUrl
());
sendFileVO
.
setFileUrl
(
reply
.
getResourceUrl
());
...
@@ -179,7 +192,11 @@ public class PcloudSubRemindBizImpl implements PcloudSubRemindBiz {
...
@@ -179,7 +192,11 @@ public class PcloudSubRemindBizImpl implements PcloudSubRemindBiz {
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setWxId
(
userWxId
);
sendFileVO
.
setWxId
(
userWxId
);
sendFileVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendFileVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendFile
(
sendFileVO
);
sendFileVO
.
setCounts
(
count
);
sendFileVO
.
setMessageGroupId
(
messageGroupId
);
sendFileVO
.
setIndex
(
index
);
sendFileVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
PCLOUD_SUB_REMIND
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendFileVO
));
}
else
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
type
))
{
}
else
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
type
))
{
Long
serveId
=
reply
.
getServeId
();
Long
serveId
=
reply
.
getServeId
();
if
(
AppAndProductTypeEnum
.
APP
.
value
.
equals
(
reply
.
getServeType
()))
{
if
(
AppAndProductTypeEnum
.
APP
.
value
.
equals
(
reply
.
getServeType
()))
{
...
@@ -198,7 +215,11 @@ public class PcloudSubRemindBizImpl implements PcloudSubRemindBiz {
...
@@ -198,7 +215,11 @@ public class PcloudSubRemindBizImpl implements PcloudSubRemindBiz {
sendArticleMessageVO
.
setPicUrl
(
reply
.
getPicUrl
());
sendArticleMessageVO
.
setPicUrl
(
reply
.
getPicUrl
());
sendArticleMessageVO
.
setTitle
(
reply
.
getContent
());
sendArticleMessageVO
.
setTitle
(
reply
.
getContent
());
sendArticleMessageVO
.
setIp
(
ip
);
sendArticleMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
sendArticleMessageVO
.
setCounts
(
count
);
sendArticleMessageVO
.
setMessageGroupId
(
messageGroupId
);
sendArticleMessageVO
.
setIndex
(
index
);
sendArticleMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
PCLOUD_SUB_REMIND
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendArticleMessageVO
));
}
}
}
}
}
}
...
@@ -216,7 +237,11 @@ public class PcloudSubRemindBizImpl implements PcloudSubRemindBiz {
...
@@ -216,7 +237,11 @@ public class PcloudSubRemindBizImpl implements PcloudSubRemindBiz {
String
resultUrl
=
UrlUtils
.
getShortUrl4Own
(
finishLinkUrl
);
String
resultUrl
=
UrlUtils
.
getShortUrl4Own
(
finishLinkUrl
);
content
=
content
+
"\n"
+
resultUrl
;
content
=
content
+
"\n"
+
resultUrl
;
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setContent
(
content
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setCounts
(
count
);
sendTextMessageVO
.
setMessageGroupId
(
messageGroupId
);
sendTextMessageVO
.
setIndex
(
index
);
sendTextMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
PCLOUD_SUB_REMIND
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
}
}
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/skill/dto/AppOrProductReplyDTO.java
0 → 100644
View file @
6a7dd660
package
com
.
pcloud
.
book
.
skill
.
dto
;
import
com.sdk.wxgroup.RobotProcessTypeEnum
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
AppOrProductReplyDTO
{
@ApiModelProperty
(
"应用或作品类型"
)
private
String
serveType
;
@ApiModelProperty
(
"应用或作品id"
)
private
Long
serveId
;
@ApiModelProperty
(
"链接地址"
)
private
String
linkUrl
;
private
String
robotWxId
;
private
String
userWxId
;
private
String
ip
;
private
Integer
sendMessageType
;
private
Integer
counts
;
private
Integer
index
;
private
String
messageGroupId
;
private
RobotProcessTypeEnum
robotProcessTypeEnum
;
public
AppOrProductReplyDTO
(
String
serveType
,
Long
serveId
,
String
linkUrl
,
String
robotWxId
,
String
userWxId
,
String
ip
,
Integer
sendMessageType
,
Integer
counts
,
Integer
index
,
String
messageGroupId
,
RobotProcessTypeEnum
robotProcessTypeEnum
)
{
this
.
serveType
=
serveType
;
this
.
serveId
=
serveId
;
this
.
linkUrl
=
linkUrl
;
this
.
robotWxId
=
robotWxId
;
this
.
userWxId
=
userWxId
;
this
.
ip
=
ip
;
this
.
sendMessageType
=
sendMessageType
;
this
.
counts
=
counts
;
this
.
index
=
index
;
this
.
messageGroupId
=
messageGroupId
;
this
.
robotProcessTypeEnum
=
robotProcessTypeEnum
;
}
public
AppOrProductReplyDTO
()
{
}
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/biz/impl/SelfPlanBizImpl.java
View file @
6a7dd660
...
@@ -42,7 +42,6 @@ import com.pcloud.wechatgroup.group.dto.GroupRobotDTO;
...
@@ -42,7 +42,6 @@ import com.pcloud.wechatgroup.group.dto.GroupRobotDTO;
import
com.pcloud.wechatgroup.group.dto.GroupUserDTO
;
import
com.pcloud.wechatgroup.group.dto.GroupUserDTO
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -226,7 +225,7 @@ public class SelfPlanBizImpl implements SelfPlanBiz {
...
@@ -226,7 +225,7 @@ public class SelfPlanBizImpl implements SelfPlanBiz {
sendTextMessageVO
.
setAltId
(
robotWxId
);
sendTextMessageVO
.
setAltId
(
robotWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
//
WxGroupSDK.sendTextMessage(sendTextMessageVO);
});
});
}
}
}
}
...
@@ -368,7 +367,7 @@ public class SelfPlanBizImpl implements SelfPlanBiz {
...
@@ -368,7 +367,7 @@ public class SelfPlanBizImpl implements SelfPlanBiz {
sendTextMessageVO
.
setAltId
(
robotWxId
);
sendTextMessageVO
.
setAltId
(
robotWxId
);
sendTextMessageVO
.
setWxGroupId
(
wxId
);
sendTextMessageVO
.
setWxGroupId
(
wxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
//
WxGroupSDK.sendTextMessage(sendTextMessageVO);
}
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/biz/impl/TaskBizImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
timecontrol
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
timecontrol
.
biz
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.app.AppConsr
;
...
@@ -61,12 +62,12 @@ import com.pcloud.contentcenter.resource.dto.ResourceDTO;
...
@@ -61,12 +62,12 @@ import com.pcloud.contentcenter.resource.dto.ResourceDTO;
import
com.pcloud.labelcenter.label.service.LabelService
;
import
com.pcloud.labelcenter.label.service.LabelService
;
import
com.pcloud.wechatgroup.base.exception.WechatGroupBizException
;
import
com.pcloud.wechatgroup.base.exception.WechatGroupBizException
;
import
com.pcloud.wechatgroup.group.dto.GroupRobotDTO
;
import
com.pcloud.wechatgroup.group.dto.GroupRobotDTO
;
import
com.sdk.wxgroup.RobotProcessTypeEnum
;
import
com.sdk.wxgroup.SendArticleMessageVO
;
import
com.sdk.wxgroup.SendArticleMessageVO
;
import
com.sdk.wxgroup.SendFileVO
;
import
com.sdk.wxgroup.SendFileVO
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
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
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -83,6 +84,7 @@ import java.util.List;
...
@@ -83,6 +84,7 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.UUID
;
/**
/**
* @date: 2020年01月30日 14:20
* @date: 2020年01月30日 14:20
...
@@ -616,6 +618,7 @@ public class TaskBizImpl implements TaskBiz {
...
@@ -616,6 +618,7 @@ public class TaskBizImpl implements TaskBiz {
}
}
private
void
sendMessage
(
TimeControlPrizeItem
timeControlPrizeItem
,
String
ip
,
String
wxUserId
,
String
robotWxId
)
{
private
void
sendMessage
(
TimeControlPrizeItem
timeControlPrizeItem
,
String
ip
,
String
wxUserId
,
String
robotWxId
)
{
String
groupId
=
UUID
.
randomUUID
().
toString
();
if
(
timeControlPrizeItem
.
getPrizeType
()
==
1
)
{
if
(
timeControlPrizeItem
.
getPrizeType
()
==
1
)
{
//优惠券
//优惠券
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
...
@@ -625,7 +628,11 @@ public class TaskBizImpl implements TaskBiz {
...
@@ -625,7 +628,11 @@ public class TaskBizImpl implements TaskBiz {
sendTextMessageVO
.
setAltId
(
robotWxId
);
sendTextMessageVO
.
setAltId
(
robotWxId
);
sendTextMessageVO
.
setWxGroupId
(
wxUserId
);
sendTextMessageVO
.
setWxGroupId
(
wxUserId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setIndex
(
0
);
sendTextMessageVO
.
setCounts
(
1
);
sendTextMessageVO
.
setMessageGroupId
(
groupId
);
sendTextMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
TIME_CONTROL
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));;
}
else
if
(
timeControlPrizeItem
.
getPrizeType
()
==
2
)
{
}
else
if
(
timeControlPrizeItem
.
getPrizeType
()
==
2
)
{
//应用
//应用
if
(
AppAndProductTypeEnum
.
APP
.
value
.
equals
(
timeControlPrizeItem
.
getServeType
()))
{
if
(
AppAndProductTypeEnum
.
APP
.
value
.
equals
(
timeControlPrizeItem
.
getServeType
()))
{
...
@@ -645,7 +652,11 @@ public class TaskBizImpl implements TaskBiz {
...
@@ -645,7 +652,11 @@ public class TaskBizImpl implements TaskBiz {
sendArticleMessageVO
.
setPicUrl
(
appDto
.
getSquareImg
());
sendArticleMessageVO
.
setPicUrl
(
appDto
.
getSquareImg
());
sendArticleMessageVO
.
setTitle
(
appDto
.
getTitle
());
sendArticleMessageVO
.
setTitle
(
appDto
.
getTitle
());
sendArticleMessageVO
.
setIp
(
ip
);
sendArticleMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
sendArticleMessageVO
.
setIndex
(
0
);
sendArticleMessageVO
.
setCounts
(
1
);
sendArticleMessageVO
.
setMessageGroupId
(
groupId
);
sendArticleMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
TIME_CONTROL
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendArticleMessageVO
));
}
}
}
}
}
else
if
(
timeControlPrizeItem
.
getPrizeType
()
==
3
)
{
}
else
if
(
timeControlPrizeItem
.
getPrizeType
()
==
3
)
{
...
@@ -657,7 +668,11 @@ public class TaskBizImpl implements TaskBiz {
...
@@ -657,7 +668,11 @@ public class TaskBizImpl implements TaskBiz {
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setWxId
(
wxUserId
);
sendFileVO
.
setWxId
(
wxUserId
);
WxGroupSDK
.
sendFile
(
sendFileVO
);
sendFileVO
.
setIndex
(
0
);
sendFileVO
.
setCounts
(
1
);
sendFileVO
.
setMessageGroupId
(
groupId
);
sendFileVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
TIME_CONTROL
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendFileVO
));
}
}
}
}
}
}
...
@@ -669,9 +684,12 @@ public class TaskBizImpl implements TaskBiz {
...
@@ -669,9 +684,12 @@ public class TaskBizImpl implements TaskBiz {
@Override
@Override
public
void
sendReplyMessage
(
List
<
TimeControlReplyMessage
>
replyMessages
,
String
wxUserId
,
String
robotWxId
,
String
ip
)
{
public
void
sendReplyMessage
(
List
<
TimeControlReplyMessage
>
replyMessages
,
String
wxUserId
,
String
robotWxId
,
String
ip
)
{
String
groupId
=
UUID
.
randomUUID
().
toString
();
int
counts
=
replyMessages
.
size
();
if
(!
ListUtils
.
isEmpty
(
replyMessages
))
{
if
(!
ListUtils
.
isEmpty
(
replyMessages
))
{
LOGGER
.
info
(
"开始发送完成信息"
);
LOGGER
.
info
(
"开始发送完成信息"
);
for
(
TimeControlReplyMessage
replyMessage
:
replyMessages
)
{
for
(
int
i
=
0
;
i
<
replyMessages
.
size
();
i
++)
{
TimeControlReplyMessage
replyMessage
=
replyMessages
.
get
(
i
);
if
(
replyMessage
!=
null
)
{
if
(
replyMessage
!=
null
)
{
Integer
replyType
=
replyMessage
.
getReplyType
();
Integer
replyType
=
replyMessage
.
getReplyType
();
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
replyType
))
{
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
replyType
))
{
...
@@ -683,7 +701,11 @@ public class TaskBizImpl implements TaskBiz {
...
@@ -683,7 +701,11 @@ public class TaskBizImpl implements TaskBiz {
sendTextMessageVO
.
setAltId
(
robotWxId
);
sendTextMessageVO
.
setAltId
(
robotWxId
);
sendTextMessageVO
.
setWxGroupId
(
wxUserId
);
sendTextMessageVO
.
setWxGroupId
(
wxUserId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setIndex
(
i
);
sendTextMessageVO
.
setCounts
(
counts
);
sendTextMessageVO
.
setMessageGroupId
(
groupId
);
sendTextMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
TIME_CONTROL
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));;
}
else
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
replyType
))
{
}
else
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
replyType
))
{
// 发送图片
// 发送图片
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
...
@@ -692,7 +714,11 @@ public class TaskBizImpl implements TaskBiz {
...
@@ -692,7 +714,11 @@ public class TaskBizImpl implements TaskBiz {
sendPicMessageVO
.
setWxGroupId
(
wxUserId
);
sendPicMessageVO
.
setWxGroupId
(
wxUserId
);
sendPicMessageVO
.
setPicUrl
(
replyMessage
.
getPicUrl
());
sendPicMessageVO
.
setPicUrl
(
replyMessage
.
getPicUrl
());
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
sendPicMessageVO
.
setIndex
(
i
);
sendPicMessageVO
.
setCounts
(
counts
);
sendPicMessageVO
.
setMessageGroupId
(
groupId
);
sendPicMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
TIME_CONTROL
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
}
else
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
replyType
))
{
}
else
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
replyType
))
{
Long
serveId
=
replyMessage
.
getServeId
();
Long
serveId
=
replyMessage
.
getServeId
();
String
completeLink
=
null
;
String
completeLink
=
null
;
...
@@ -718,7 +744,11 @@ public class TaskBizImpl implements TaskBiz {
...
@@ -718,7 +744,11 @@ public class TaskBizImpl implements TaskBiz {
sendArticleMessageVO
.
setPicUrl
(
replyMessage
.
getPicUrl
());
sendArticleMessageVO
.
setPicUrl
(
replyMessage
.
getPicUrl
());
sendArticleMessageVO
.
setTitle
(
replyMessage
.
getContent
());
sendArticleMessageVO
.
setTitle
(
replyMessage
.
getContent
());
sendArticleMessageVO
.
setIp
(
ip
);
sendArticleMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
sendArticleMessageVO
.
setIndex
(
i
);
sendArticleMessageVO
.
setCounts
(
counts
);
sendArticleMessageVO
.
setMessageGroupId
(
groupId
);
sendArticleMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
TIME_CONTROL
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendArticleMessageVO
));
}
else
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
replyType
))
{
}
else
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
replyType
))
{
SendFileVO
sendFileVO
=
new
SendFileVO
();
SendFileVO
sendFileVO
=
new
SendFileVO
();
Map
<
Long
,
ResourceDTO
>
map
=
resourceConsr
.
mapByIds
(
Arrays
.
asList
(
replyMessage
.
getResourceId
()));
Map
<
Long
,
ResourceDTO
>
map
=
resourceConsr
.
mapByIds
(
Arrays
.
asList
(
replyMessage
.
getResourceId
()));
...
@@ -738,7 +768,11 @@ public class TaskBizImpl implements TaskBiz {
...
@@ -738,7 +768,11 @@ public class TaskBizImpl implements TaskBiz {
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setWxId
(
wxUserId
);
sendFileVO
.
setWxId
(
wxUserId
);
sendFileVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendFileVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendFile
(
sendFileVO
);
sendFileVO
.
setIndex
(
i
);
sendFileVO
.
setCounts
(
counts
);
sendFileVO
.
setMessageGroupId
(
groupId
);
sendFileVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
TIME_CONTROL
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendFileVO
));
}
else
if
(
ReplyTypeEnum
.
LINK
.
value
.
equals
(
replyType
))
{
}
else
if
(
ReplyTypeEnum
.
LINK
.
value
.
equals
(
replyType
))
{
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
sendArticleMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendArticleMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
...
@@ -749,7 +783,11 @@ public class TaskBizImpl implements TaskBiz {
...
@@ -749,7 +783,11 @@ public class TaskBizImpl implements TaskBiz {
sendArticleMessageVO
.
setPicUrl
(
replyMessage
.
getPicUrl
());
sendArticleMessageVO
.
setPicUrl
(
replyMessage
.
getPicUrl
());
sendArticleMessageVO
.
setTitle
(
replyMessage
.
getContent
());
sendArticleMessageVO
.
setTitle
(
replyMessage
.
getContent
());
sendArticleMessageVO
.
setIp
(
ip
);
sendArticleMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
sendArticleMessageVO
.
setIndex
(
i
);
sendArticleMessageVO
.
setCounts
(
counts
);
sendArticleMessageVO
.
setMessageGroupId
(
groupId
);
sendArticleMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
TIME_CONTROL
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendArticleMessageVO
));
}
}
}
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/biz/impl/TaskSubscribeBizImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
timecontrol
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
timecontrol
.
biz
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.util.concurrent.ThreadFactoryBuilder
;
import
com.google.common.util.concurrent.ThreadFactoryBuilder
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
...
@@ -7,13 +8,13 @@ import com.pcloud.book.consumer.content.ResourceConsr;
...
@@ -7,13 +8,13 @@ import com.pcloud.book.consumer.content.ResourceConsr;
import
com.pcloud.book.consumer.resource.ProductConsr
;
import
com.pcloud.book.consumer.resource.ProductConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.biz.WeixinQrcodeBiz
;
import
com.pcloud.book.group.biz.WeixinQrcodeBiz
;
import
com.pcloud.book.keywords.entity.RobotSkillDetail
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
import
com.pcloud.book.pcloudkeyword.set.PcloudRobotSet
;
import
com.pcloud.book.pcloudkeyword.set.PcloudRobotSet
;
import
com.pcloud.book.personal.dao.PcloudSkillRecordDao
;
import
com.pcloud.book.personal.dao.PcloudSkillRecordDao
;
import
com.pcloud.book.skill.biz.PcloudSubRemindBiz
;
import
com.pcloud.book.skill.biz.PcloudSubRemindBiz
;
import
com.pcloud.book.skill.dao.PcloudSkillDao
;
import
com.pcloud.book.skill.dao.PcloudSkillDao
;
import
com.pcloud.book.skill.dao.PcloudSubReplyDao
;
import
com.pcloud.book.skill.dao.PcloudSubReplyDao
;
import
com.pcloud.book.skill.dto.AppOrProductReplyDTO
;
import
com.pcloud.book.skill.entity.PcloudSkill
;
import
com.pcloud.book.skill.entity.PcloudSkill
;
import
com.pcloud.book.skill.entity.PcloudSubReply
;
import
com.pcloud.book.skill.entity.PcloudSubReply
;
import
com.pcloud.book.skill.enums.SkillTypeEnum
;
import
com.pcloud.book.skill.enums.SkillTypeEnum
;
...
@@ -38,19 +39,18 @@ import com.pcloud.book.util.common.YesOrNoEnums;
...
@@ -38,19 +39,18 @@ import com.pcloud.book.util.common.YesOrNoEnums;
import
com.pcloud.channelcenter.base.constants.ChannelConstants
;
import
com.pcloud.channelcenter.base.constants.ChannelConstants
;
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.page.PageBeanNew
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.httpclient.UrlUtils
;
import
com.pcloud.common.utils.httpclient.UrlUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.contentcenter.resource.dto.ResourceDTO
;
import
com.pcloud.contentcenter.resource.dto.ResourceDTO
;
import
com.pcloud.wechatgroup.group.dto.GroupRobotDTO
;
import
com.pcloud.wechatgroup.group.dto.GroupRobotDTO
;
import
com.sdk.wxgroup.RobotProcessTypeEnum
;
import
com.sdk.wxgroup.SendArticleMessageVO
;
import
com.sdk.wxgroup.SendArticleMessageVO
;
import
com.sdk.wxgroup.SendFileVO
;
import
com.sdk.wxgroup.SendFileVO
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
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
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -64,6 +64,7 @@ import java.util.Arrays;
...
@@ -64,6 +64,7 @@ import java.util.Arrays;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.UUID
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.ThreadFactory
;
import
java.util.concurrent.ThreadFactory
;
...
@@ -186,9 +187,13 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
...
@@ -186,9 +187,13 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
GroupRobotDTO
groupRobotDTO
=
wechatGroupConsr
.
getGroupRobotByWxId
(
robotWxId
);
GroupRobotDTO
groupRobotDTO
=
wechatGroupConsr
.
getGroupRobotByWxId
(
robotWxId
);
String
ip
=
weixinQrcodeBiz
.
getRobotIpByGeneration
(
groupRobotDTO
.
getVersion
());
String
ip
=
weixinQrcodeBiz
.
getRobotIpByGeneration
(
groupRobotDTO
.
getVersion
());
if
(!
ListUtils
.
isEmpty
(
bySkillIdAndType
))
{
if
(!
ListUtils
.
isEmpty
(
bySkillIdAndType
))
{
bySkillIdAndType
.
forEach
(
pcloudSubReply
->
{
Integer
count
=
bySkillIdAndType
.
size
();
sendReply
(
pcloudSubReply
,
wxUserId
,
robotWxId
,
ip
);
String
messageGroup
=
UUID
.
randomUUID
().
toString
();
});
Integer
index
=
0
;
for
(
PcloudSubReply
pcloudSubReply
:
bySkillIdAndType
)
{
sendReply
(
pcloudSubReply
,
wxUserId
,
robotWxId
,
ip
,
messageGroup
,
count
,
index
);
index
++;
}
}
}
});
});
//修改pcloud_sub_remind表状态
//修改pcloud_sub_remind表状态
...
@@ -197,7 +202,7 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
...
@@ -197,7 +202,7 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
}
}
@ParamLog
@ParamLog
private
void
sendReply
(
PcloudSubReply
pcloudSubReply
,
String
userWxId
,
String
robotWxId
,
String
ip
)
{
private
void
sendReply
(
PcloudSubReply
pcloudSubReply
,
String
userWxId
,
String
robotWxId
,
String
ip
,
String
messageGroupId
,
Integer
count
,
Integer
index
)
{
Integer
type
=
pcloudSubReply
.
getType
();
Integer
type
=
pcloudSubReply
.
getType
();
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
type
))
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
...
@@ -206,7 +211,11 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
...
@@ -206,7 +211,11 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
1
);
sendTextMessageVO
.
setCode
(
1
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setCounts
(
count
);
sendTextMessageVO
.
setMessageGroupId
(
messageGroupId
);
sendTextMessageVO
.
setIndex
(
index
);
sendTextMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
SKILL_REPLY
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));;
}
}
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
type
))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
...
@@ -215,11 +224,26 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
...
@@ -215,11 +224,26 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
sendPicMessageVO
.
setPicUrl
(
pcloudSubReply
.
getPicUrl
());
sendPicMessageVO
.
setPicUrl
(
pcloudSubReply
.
getPicUrl
());
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setCode
(
1
);
sendPicMessageVO
.
setCode
(
1
);
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
sendPicMessageVO
.
setCounts
(
count
);
sendPicMessageVO
.
setMessageGroupId
(
messageGroupId
);
sendPicMessageVO
.
setIndex
(
index
);
sendPicMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
SKILL_REPLY
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendPicMessageVO
));
}
}
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
type
))
{
pcloudRobotSet
.
sendAppOrProductReply
(
pcloudSubReply
.
getServeType
(),
pcloudSubReply
.
getServeId
(),
AppOrProductReplyDTO
appOrProductReplyDTO
=
new
AppOrProductReplyDTO
();
pcloudSubReply
.
getLinkUrl
(),
robotWxId
,
userWxId
,
ip
,
1
);
appOrProductReplyDTO
.
setServeType
(
pcloudSubReply
.
getServeType
());
appOrProductReplyDTO
.
setServeId
(
pcloudSubReply
.
getServeId
());
appOrProductReplyDTO
.
setLinkUrl
(
pcloudSubReply
.
getLinkUrl
());
appOrProductReplyDTO
.
setRobotWxId
(
robotWxId
);
appOrProductReplyDTO
.
setRobotWxId
(
userWxId
);
appOrProductReplyDTO
.
setIp
(
ip
);
appOrProductReplyDTO
.
setSendMessageType
(
SendMessageTypeEnum
.
SELF
.
getCode
());
appOrProductReplyDTO
.
setCounts
(
count
);
appOrProductReplyDTO
.
setIndex
(
index
);
appOrProductReplyDTO
.
setMessageGroupId
(
messageGroupId
);
appOrProductReplyDTO
.
setRobotProcessTypeEnum
(
RobotProcessTypeEnum
.
SKILL_REPLY
);
pcloudRobotSet
.
sendAppOrProductReply
(
appOrProductReplyDTO
);
}
}
if
(
ReplyTypeEnum
.
LINK
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
LINK
.
value
.
equals
(
type
))
{
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
...
@@ -231,7 +255,11 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
...
@@ -231,7 +255,11 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
sendArticleMessageVO
.
setPicUrl
(
pcloudSubReply
.
getPicUrl
());
sendArticleMessageVO
.
setPicUrl
(
pcloudSubReply
.
getPicUrl
());
sendArticleMessageVO
.
setTitle
(
pcloudSubReply
.
getContent
());
sendArticleMessageVO
.
setTitle
(
pcloudSubReply
.
getContent
());
sendArticleMessageVO
.
setIp
(
ip
);
sendArticleMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
sendArticleMessageVO
.
setCounts
(
count
);
sendArticleMessageVO
.
setIndex
(
index
);
sendArticleMessageVO
.
setMessageGroupId
(
messageGroupId
);
sendArticleMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
SKILL_REPLY
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendArticleMessageVO
));
}
}
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
))
{
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
))
{
SendFileVO
sendFileVO
=
new
SendFileVO
();
SendFileVO
sendFileVO
=
new
SendFileVO
();
...
@@ -249,7 +277,11 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
...
@@ -249,7 +277,11 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setWxId
(
userWxId
);
sendFileVO
.
setWxId
(
userWxId
);
WxGroupSDK
.
sendFile
(
sendFileVO
);
sendFileVO
.
setCounts
(
count
);
sendFileVO
.
setIndex
(
index
);
sendFileVO
.
setMessageGroupId
(
messageGroupId
);
sendFileVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
SKILL_REPLY
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendFileVO
));
}
}
}
}
...
@@ -282,9 +314,13 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
...
@@ -282,9 +314,13 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
GroupRobotDTO
groupRobotDTO
=
wechatGroupConsr
.
getGroupRobotByWxId
(
taskSubscribe
.
getRobotWxId
());
GroupRobotDTO
groupRobotDTO
=
wechatGroupConsr
.
getGroupRobotByWxId
(
taskSubscribe
.
getRobotWxId
());
String
ip
=
weixinQrcodeBiz
.
getRobotIpByGeneration
(
groupRobotDTO
.
getVersion
());
String
ip
=
weixinQrcodeBiz
.
getRobotIpByGeneration
(
groupRobotDTO
.
getVersion
());
if
(!
ListUtils
.
isEmpty
(
bySkillIdAndType
))
{
if
(!
ListUtils
.
isEmpty
(
bySkillIdAndType
))
{
bySkillIdAndType
.
forEach
(
pcloudSubReply
->
{
Integer
count
=
bySkillIdAndType
.
size
();
sendReply
(
pcloudSubReply
,
wxUserId
,
taskSubscribe
.
getRobotWxId
(),
ip
);
String
messageGroupId
=
UUID
.
randomUUID
().
toString
();
});
Integer
index
=
0
;
for
(
PcloudSubReply
pcloudSubReply
:
bySkillIdAndType
)
{
sendReply
(
pcloudSubReply
,
wxUserId
,
taskSubscribe
.
getRobotWxId
(),
ip
,
messageGroupId
,
count
,
index
);
index
++;
}
}
}
});
});
}
}
...
@@ -336,7 +372,11 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
...
@@ -336,7 +372,11 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
String
content
=
"消息发送时间("
+
DateUtils
.
formatDate
(
new
Date
())+
")"
;
String
content
=
"消息发送时间("
+
DateUtils
.
formatDate
(
new
Date
())+
")"
;
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setContent
(
content
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setIndex
(
0
);
sendTextMessageVO
.
setCounts
(
1
);
sendTextMessageVO
.
setMessageGroupId
(
UUID
.
randomUUID
().
toString
());
sendTextMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
TIME_CONTROL
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));
}
}
if
(
YesOrNoEnums
.
YES
.
getValue
().
equals
(
timeControlTaskItem
.
getFinishConfirm
())
||
YesOrNoEnums
.
YES
.
getValue
().
equals
(
timeControlTaskItem
.
getTdConfirm
())){
if
(
YesOrNoEnums
.
YES
.
getValue
().
equals
(
timeControlTaskItem
.
getFinishConfirm
())
||
YesOrNoEnums
.
YES
.
getValue
().
equals
(
timeControlTaskItem
.
getTdConfirm
())){
//封装退订提醒
//封装退订提醒
...
@@ -364,7 +404,11 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
...
@@ -364,7 +404,11 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
}
}
}
}
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setContent
(
content
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setIndex
(
0
);
sendTextMessageVO
.
setCounts
(
1
);
sendTextMessageVO
.
setMessageGroupId
(
UUID
.
randomUUID
().
toString
());
sendTextMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
TIME_CONTROL
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));;
}
}
if
(
YesOrNoEnums
.
YES
.
getValue
().
equals
(
timeControlTaskItem
.
getProgressGuidance
()))
{
if
(
YesOrNoEnums
.
YES
.
getValue
().
equals
(
timeControlTaskItem
.
getProgressGuidance
()))
{
//封装任务进度
//封装任务进度
...
@@ -378,7 +422,11 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
...
@@ -378,7 +422,11 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
+
"&taskItemId="
+
taskItemId
+
"&wxUserId="
+
wxUserId
;
+
"&taskItemId="
+
taskItemId
+
"&wxUserId="
+
wxUserId
;
String
content
=
"当前任务进度→\n"
+
UrlUtils
.
getShortUrl4Own
(
link
)
+
""
;
String
content
=
"当前任务进度→\n"
+
UrlUtils
.
getShortUrl4Own
(
link
)
+
""
;
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setContent
(
content
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
sendTextMessageVO
.
setIndex
(
0
);
sendTextMessageVO
.
setCounts
(
1
);
sendTextMessageVO
.
setMessageGroupId
(
UUID
.
randomUUID
().
toString
());
sendTextMessageVO
.
setRobotProcessType
(
RobotProcessTypeEnum
.
TIME_CONTROL
);
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
sendTextMessageVO
));;
}
}
//更新发送状态
//更新发送状态
Integer
completeState
=
null
;
Integer
completeState
=
null
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/biz/impl/WeixinClockBizImpl.java
View file @
6a7dd660
package
com
.
pcloud
.
book
.
weixinclock
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
weixinclock
.
biz
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.google.common.util.concurrent.ThreadFactoryBuilder
;
import
com.google.common.util.concurrent.ThreadFactoryBuilder
;
...
@@ -711,7 +712,8 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
...
@@ -711,7 +712,8 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
}
}
vo
.
setContent
(
sendContent
);
vo
.
setContent
(
sendContent
);
LOGGER
.
info
(
"微信群内加入并打卡:发送微信消息vo="
+
vo
);
LOGGER
.
info
(
"微信群内加入并打卡:发送微信消息vo="
+
vo
);
WxGroupSDK
.
sendTextMessage
(
vo
);
// TODO sdk.message
wechatGroupConsr
.
sendMessage
(
JSON
.
toJSONString
(
vo
));
return
true
;
return
true
;
}
}
...
...
pcloud-service-book/src/main/resources/application.yml
View file @
6a7dd660
...
@@ -22,7 +22,7 @@ spring:
...
@@ -22,7 +22,7 @@ spring:
removeAbandonedTimeout
:
180
removeAbandonedTimeout
:
180
logAbandoned
:
true
logAbandoned
:
true
timeBetweenEvictionRunsMillis
:
3000
timeBetweenEvictionRunsMillis
:
3000
minEvictableIdleTimeMillis
:
3600000
minEvictableIdleTimeMillis
:
3600000
git
validationQuery
:
SELECT 'x' FROM DUAL
validationQuery
:
SELECT 'x' FROM DUAL
testWhileIdle
:
true
testWhileIdle
:
true
testOnBorrow
:
false
testOnBorrow
:
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