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
cac7a5f7
Commit
cac7a5f7
authored
Feb 06, 2020
by
高鹏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat-1002267' into 'master'
多条引导语 See merge request rays/pcloud-book!350
parents
c327e35a
a8a935c3
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
264 additions
and
44 deletions
+264
-44
SelfRobotKeywordBiz.java
...ava/com/pcloud/book/keywords/biz/SelfRobotKeywordBiz.java
+2
-0
BookGuideBizImpl.java
...a/com/pcloud/book/keywords/biz/impl/BookGuideBizImpl.java
+5
-2
BookKeywordBizImpl.java
...com/pcloud/book/keywords/biz/impl/BookKeywordBizImpl.java
+8
-5
SelfRobotKeywordBizImpl.java
...cloud/book/keywords/biz/impl/SelfRobotKeywordBizImpl.java
+41
-1
SelfRobotGuideDao.java
.../java/com/pcloud/book/keywords/dao/SelfRobotGuideDao.java
+16
-0
SelfRobotKeywordReplyDao.java
...om/pcloud/book/keywords/dao/SelfRobotKeywordReplyDao.java
+0
-2
SelfRobotGuideDaoImpl.java
.../pcloud/book/keywords/dao/impl/SelfRobotGuideDaoImpl.java
+25
-0
SelfRobotKeywordReplyDaoImpl.java
.../book/keywords/dao/impl/SelfRobotKeywordReplyDaoImpl.java
+0
-5
SelfRobotGuide.java
.../java/com/pcloud/book/keywords/entity/SelfRobotGuide.java
+39
-0
SelfRobotKeyword.java
...ava/com/pcloud/book/keywords/entity/SelfRobotKeyword.java
+4
-1
SelfRobotKeywordFacadeImpl.java
...book/keywords/facade/impl/SelfRobotKeywordFacadeImpl.java
+0
-1
KeyWordDelayRunner.java
...a/com/pcloud/book/keywords/runner/KeyWordDelayRunner.java
+32
-14
SelfRobotGuide.xml
...e-book/src/main/resources/mapper/group/SelfRobotGuide.xml
+79
-0
SelfRobotKeyword.xml
...book/src/main/resources/mapper/group/SelfRobotKeyword.xml
+13
-13
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/SelfRobotKeywordBiz.java
View file @
cac7a5f7
...
@@ -36,4 +36,6 @@ public interface SelfRobotKeywordBiz {
...
@@ -36,4 +36,6 @@ public interface SelfRobotKeywordBiz {
String
joinGroup
(
Integer
id
,
String
robotId
,
String
wxUserId
);
String
joinGroup
(
Integer
id
,
String
robotId
,
String
wxUserId
);
void
sendWhenNoReply
(
Integer
id
,
String
robotId
,
String
wxUserId
);
void
sendWhenNoReply
(
Integer
id
,
String
robotId
,
String
wxUserId
);
List
<
SelfRobotKeyword
>
getListByBookGroupId
(
Long
bookGroupId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/BookGuideBizImpl.java
View file @
cac7a5f7
...
@@ -27,6 +27,7 @@ import com.pcloud.book.group.tools.SendWeixinRequestTools;
...
@@ -27,6 +27,7 @@ import com.pcloud.book.group.tools.SendWeixinRequestTools;
import
com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO
;
import
com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO
;
import
com.pcloud.book.keywords.biz.BookGuideBiz
;
import
com.pcloud.book.keywords.biz.BookGuideBiz
;
import
com.pcloud.book.keywords.biz.BookKeywordBiz
;
import
com.pcloud.book.keywords.biz.BookKeywordBiz
;
import
com.pcloud.book.keywords.biz.SelfRobotKeywordBiz
;
import
com.pcloud.book.keywords.dao.*
;
import
com.pcloud.book.keywords.dao.*
;
import
com.pcloud.book.keywords.dto.GuideDTO
;
import
com.pcloud.book.keywords.dto.GuideDTO
;
import
com.pcloud.book.keywords.dto.KeywordDTO
;
import
com.pcloud.book.keywords.dto.KeywordDTO
;
...
@@ -122,6 +123,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -122,6 +123,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
private
BookGroupFriendGuideDao
bookGroupFriendGuideDao
;
private
BookGroupFriendGuideDao
bookGroupFriendGuideDao
;
@Autowired
@Autowired
private
ResourceConsr
resourceConsr
;
private
ResourceConsr
resourceConsr
;
@Autowired
private
SelfRobotKeywordBiz
selfRobotKeywordBiz
;
@Value
(
"${system.env}"
)
@Value
(
"${system.env}"
)
private
String
envStr
;
private
String
envStr
;
...
@@ -169,8 +172,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -169,8 +172,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
if
(
envStr
.
toUpperCase
().
equals
(
"TEST"
)
&&
agreeAddUserDTO
.
getRobotWxId
().
equals
(
"wxid_zus32xb5ukjn22"
)
if
(
envStr
.
toUpperCase
().
equals
(
"TEST"
)
&&
agreeAddUserDTO
.
getRobotWxId
().
equals
(
"wxid_zus32xb5ukjn22"
)
||
envStr
.
toUpperCase
().
equals
(
"UAT"
)
&&
agreeAddUserDTO
.
getRobotWxId
().
equals
(
"wxid_p7gywuxkk89112"
)
||
envStr
.
toUpperCase
().
equals
(
"UAT"
)
&&
agreeAddUserDTO
.
getRobotWxId
().
equals
(
"wxid_p7gywuxkk89112"
)
||
envStr
.
toUpperCase
().
equals
(
"PRO"
)
&&
agreeAddUserDTO
.
getRobotWxId
().
equals
(
"wxid_x8i897ryabo722"
))
{
||
envStr
.
toUpperCase
().
equals
(
"PRO"
)
&&
agreeAddUserDTO
.
getRobotWxId
().
equals
(
"wxid_x8i897ryabo722"
))
{
List
<
SelfRobotKeyword
>
selfRobotKeywords
=
selfRobotKeyword
Dao
.
getListByBookGroupId
(
bookGroupId
);
List
<
SelfRobotKeyword
>
selfRobotKeywords
=
selfRobotKeyword
Biz
.
getListByBookGroupId
(
bookGroupId
);
List
<
SelfRobotKeyword
>
hasGuideKeywords
=
selfRobotKeywords
.
stream
().
filter
(
s
->
s
.
getGuide
()!=
null
&&
s
.
getDelayTime
()!=
null
).
collect
(
Collectors
.
toList
());
List
<
SelfRobotKeyword
>
hasGuideKeywords
=
selfRobotKeywords
.
stream
().
filter
(
s
->
!
ListUtils
.
isEmpty
(
s
.
getGuideList
())
&&
s
.
getDelayTime
()!=
null
).
collect
(
Collectors
.
toList
());
int
time
=
hasGuideKeywords
.
get
(
0
).
getDelayTime
();
int
time
=
hasGuideKeywords
.
get
(
0
).
getDelayTime
();
BookGuideDelayDto
delayDto
=
new
BookGuideDelayDto
(
agreeAddUserDTO
.
getUserWxId
(),
DateUtils
.
addSecond
(
new
Date
(),
time
),
hasGuideKeywords
.
get
(
0
).
getKeyword
(),
agreeAddUserDTO
.
getIp
());
BookGuideDelayDto
delayDto
=
new
BookGuideDelayDto
(
agreeAddUserDTO
.
getUserWxId
(),
DateUtils
.
addSecond
(
new
Date
(),
time
),
hasGuideKeywords
.
get
(
0
).
getKeyword
(),
agreeAddUserDTO
.
getIp
());
log
.
info
(
"[向缓存中写入相关信息 延迟推送时间]:{}"
,
JSONObject
.
toJSONString
(
delayDto
));
log
.
info
(
"[向缓存中写入相关信息 延迟推送时间]:{}"
,
JSONObject
.
toJSONString
(
delayDto
));
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/BookKeywordBizImpl.java
View file @
cac7a5f7
...
@@ -598,7 +598,10 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -598,7 +598,10 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
}
}
}
}
}
else
{
}
else
{
sendText
(
sendTextDTO
,
"抱歉呀!小睿不太明白你在说什么。嘿嘿!你的语言太高级了,待小睿深度解析一下,我还在不断学习呢!或者你看看,是不是关键词输错了呢?麻烦你再输一遍正确的关键词?比如回复我背单词。"
);
BookGroup
bookGroup
=
bookGroupDao
.
getByShortBookName
(
content
);
if
(
bookGroup
==
null
)
{
sendText
(
sendTextDTO
,
"抱歉呀!小睿不太明白你在说什么。嘿嘿!你的语言太高级了,待小睿深度解析一下,我还在不断学习呢!或者你看看,是不是关键词输错了呢?麻烦你再输一遍正确的关键词?比如回复我背单词。"
);
}
}
}
}
}
}
}
...
@@ -800,11 +803,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -800,11 +803,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
SelfRobotKeyword
selfRobotKeyword
=
selfRobotKeywords
.
get
(
i
);
SelfRobotKeyword
selfRobotKeyword
=
selfRobotKeywords
.
get
(
i
);
String
toAddIn
;
String
toAddIn
;
if
(!
StringUtil
.
isEmpty
(
selfRobotKeyword
.
getGuide
())){
// if (!StringUtil.isEmpty(selfRobotKeyword.getGuide())){//改为多个引导语了1002267
toAddIn
=
selfRobotKeyword
.
getGuide
()
+
",请回复“"
+
selfRobotKeyword
.
getKeyword
()
+
"”\n"
;
//
toAddIn = selfRobotKeyword.getGuide() + ",请回复“" + selfRobotKeyword.getKeyword() + "”\n";
}
else
{
//
}else {
toAddIn
=
"请回复“"
+
selfRobotKeyword
.
getKeyword
()
+
"”\n"
;
toAddIn
=
"请回复“"
+
selfRobotKeyword
.
getKeyword
()
+
"”\n"
;
}
//
}
//最后一个
//最后一个
if
(
i
+
1
==
size
)
{
if
(
i
+
1
==
size
)
{
// 拼接反馈链接
// 拼接反馈链接
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/SelfRobotKeywordBizImpl.java
View file @
cac7a5f7
...
@@ -15,11 +15,13 @@ import com.pcloud.book.group.entity.WeixinQrcodeGeneration;
...
@@ -15,11 +15,13 @@ import com.pcloud.book.group.entity.WeixinQrcodeGeneration;
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.biz.SelfRobotKeywordBiz
;
import
com.pcloud.book.keywords.biz.SelfRobotKeywordBiz
;
import
com.pcloud.book.keywords.dao.SelfRobotGuideDao
;
import
com.pcloud.book.keywords.dao.SelfRobotKeywordDao
;
import
com.pcloud.book.keywords.dao.SelfRobotKeywordDao
;
import
com.pcloud.book.keywords.dao.SelfRobotKeywordReplyDao
;
import
com.pcloud.book.keywords.dao.SelfRobotKeywordReplyDao
;
import
com.pcloud.book.keywords.entity.SelfRobotGuide
;
import
com.pcloud.book.keywords.entity.SelfRobotKeyword
;
import
com.pcloud.book.keywords.mapper.TempRobotSkillDao
;
import
com.pcloud.book.keywords.mapper.TempRobotSkillDao
;
import
com.pcloud.book.keywords.dto.MaxSeqNAndBGDTO
;
import
com.pcloud.book.keywords.dto.MaxSeqNAndBGDTO
;
import
com.pcloud.book.keywords.entity.SelfRobotKeyword
;
import
com.pcloud.book.keywords.entity.SelfRobotKeywordReply
;
import
com.pcloud.book.keywords.entity.SelfRobotKeywordReply
;
import
com.pcloud.book.keywords.entity.TempRobotSkill
;
import
com.pcloud.book.keywords.entity.TempRobotSkill
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
...
@@ -87,6 +89,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
...
@@ -87,6 +89,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
private
WechatGroupConsr
wechatGroupConsr
;
private
WechatGroupConsr
wechatGroupConsr
;
@Autowired
@Autowired
private
WeixinQrcodeGenerationDao
weixinQrcodeGenerationDao
;
private
WeixinQrcodeGenerationDao
weixinQrcodeGenerationDao
;
@Autowired
private
SelfRobotGuideDao
selfRobotGuideDao
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
"批量新增个人号关键词"
)
@ParamLog
(
"批量新增个人号关键词"
)
...
@@ -126,6 +130,14 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
...
@@ -126,6 +130,14 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
selfRobotKeywordReply
.
setCreateUser
(
partyId
);
selfRobotKeywordReply
.
setCreateUser
(
partyId
);
});
});
selfRobotKeywordReplyDao
.
insert
(
replyList
);
selfRobotKeywordReplyDao
.
insert
(
replyList
);
List
<
SelfRobotGuide
>
guides
=
selfRobotKeyword
.
getGuideList
();
if
(!
ListUtils
.
isEmpty
(
guides
)){
guides
.
forEach
(
selfRobotGuide
->
{
selfRobotGuide
.
setKeywordId
(
keywordId
);
selfRobotGuide
.
setCreateUser
(
partyId
);
});
}
selfRobotGuideDao
.
insert
(
guides
);
}
}
//将作品应用关键词加到社群书应用
//将作品应用关键词加到社群书应用
bookGroupAppBiz
.
addSelfKeywordToBookGroupApp
(
selfRobotKeywords
);
bookGroupAppBiz
.
addSelfKeywordToBookGroupApp
(
selfRobotKeywords
);
...
@@ -164,6 +176,15 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
...
@@ -164,6 +176,15 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
selfRobotKeywordReply
.
setCreateUser
(
partyId
);
selfRobotKeywordReply
.
setCreateUser
(
partyId
);
});
});
selfRobotKeywordReplyDao
.
insert
(
replyList
);
selfRobotKeywordReplyDao
.
insert
(
replyList
);
selfRobotGuideDao
.
deleteByKeywordId
(
selfRobotKeyword
.
getId
());
List
<
SelfRobotGuide
>
guides
=
selfRobotKeyword
.
getGuideList
();
if
(!
ListUtils
.
isEmpty
(
guides
)){
guides
.
forEach
(
selfRobotGuide
->
{
selfRobotGuide
.
setKeywordId
(
selfRobotKeyword
.
getId
());
selfRobotGuide
.
setCreateUser
(
partyId
);
});
}
selfRobotGuideDao
.
insert
(
guides
);
for
(
SelfRobotKeywordReply
selfRobotKeywordReply:
replyList
){
for
(
SelfRobotKeywordReply
selfRobotKeywordReply:
replyList
){
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
selfRobotKeywordReply
.
getType
())
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
selfRobotKeywordReply
.
getType
())
&&
AppAndProductTypeEnum
.
PRODUCT
.
value
.
equals
(
selfRobotKeywordReply
.
getServeType
()))
{
&&
AppAndProductTypeEnum
.
PRODUCT
.
value
.
equals
(
selfRobotKeywordReply
.
getServeType
()))
{
...
@@ -179,6 +200,7 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
...
@@ -179,6 +200,7 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
public
void
deleteSelfRobotKeyword
(
Long
id
)
{
public
void
deleteSelfRobotKeyword
(
Long
id
)
{
selfRobotKeywordDao
.
deleteById
(
id
);
selfRobotKeywordDao
.
deleteById
(
id
);
selfRobotKeywordReplyDao
.
deleteByKeywordId
(
id
);
selfRobotKeywordReplyDao
.
deleteByKeywordId
(
id
);
selfRobotGuideDao
.
deleteByKeywordId
(
id
);
}
}
@ParamLog
(
"获取个人号关键词列表"
)
@ParamLog
(
"获取个人号关键词列表"
)
...
@@ -490,6 +512,20 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
...
@@ -490,6 +512,20 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
}
}
}
}
@Override
public
List
<
SelfRobotKeyword
>
getListByBookGroupId
(
Long
bookGroupId
)
{
List
<
SelfRobotKeyword
>
list
=
selfRobotKeywordDao
.
getListByBookGroupId
(
bookGroupId
);
if
(!
ListUtils
.
isEmpty
(
list
)){
for
(
SelfRobotKeyword
keyword
:
list
){
List
<
SelfRobotGuide
>
guides
=
selfRobotGuideDao
.
getListByKeywordId
(
keyword
.
getId
());
if
(!
ListUtils
.
isEmpty
(
guides
)){
keyword
.
setGuideList
(
guides
);
}
}
}
return
list
;
}
@ParamLog
(
"填充列表"
)
@ParamLog
(
"填充列表"
)
private
void
fillSelfRobotKeyword
(
List
<
SelfRobotKeyword
>
selfRobotKeywords
)
{
private
void
fillSelfRobotKeyword
(
List
<
SelfRobotKeyword
>
selfRobotKeywords
)
{
if
(
ListUtils
.
isEmpty
(
selfRobotKeywords
)){
if
(
ListUtils
.
isEmpty
(
selfRobotKeywords
)){
...
@@ -499,6 +535,10 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
...
@@ -499,6 +535,10 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
List
<
Long
>
productIds
=
new
ArrayList
<>();
List
<
Long
>
productIds
=
new
ArrayList
<>();
List
<
Long
>
resourceIds
=
new
ArrayList
<>();
List
<
Long
>
resourceIds
=
new
ArrayList
<>();
for
(
SelfRobotKeyword
selfRobotKeyword
:
selfRobotKeywords
){
for
(
SelfRobotKeyword
selfRobotKeyword
:
selfRobotKeywords
){
List
<
SelfRobotGuide
>
guides
=
selfRobotGuideDao
.
getListByKeywordId
(
selfRobotKeyword
.
getId
());
if
(!
ListUtils
.
isEmpty
(
guides
)){
selfRobotKeyword
.
setGuideList
(
guides
);
}
List
<
SelfRobotKeywordReply
>
replyList
=
selfRobotKeywordReplyDao
.
getListByKeywordId
(
selfRobotKeyword
.
getId
());
List
<
SelfRobotKeywordReply
>
replyList
=
selfRobotKeywordReplyDao
.
getListByKeywordId
(
selfRobotKeyword
.
getId
());
if
(
ListUtils
.
isEmpty
(
replyList
)){
if
(
ListUtils
.
isEmpty
(
replyList
)){
continue
;
continue
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/dao/SelfRobotGuideDao.java
0 → 100644
View file @
cac7a5f7
package
com
.
pcloud
.
book
.
keywords
.
dao
;
import
com.pcloud.book.keywords.entity.SelfRobotGuide
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* 个人号关键词引导语
*/
public
interface
SelfRobotGuideDao
extends
BaseDao
<
SelfRobotGuide
>
{
void
deleteByKeywordId
(
Long
keywordId
);
public
List
<
SelfRobotGuide
>
getListByKeywordId
(
Long
keywordId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/keywords/dao/SelfRobotKeywordReplyDao.java
View file @
cac7a5f7
package
com
.
pcloud
.
book
.
keywords
.
dao
;
package
com
.
pcloud
.
book
.
keywords
.
dao
;
import
com.pcloud.book.keywords.dto.MaxSeqNAndBGDTO
;
import
com.pcloud.book.keywords.entity.SelfRobotKeyword
;
import
com.pcloud.book.keywords.entity.SelfRobotKeywordReply
;
import
com.pcloud.book.keywords.entity.SelfRobotKeywordReply
;
import
com.pcloud.common.core.dao.BaseDao
;
import
com.pcloud.common.core.dao.BaseDao
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/dao/impl/SelfRobotGuideDaoImpl.java
0 → 100644
View file @
cac7a5f7
package
com
.
pcloud
.
book
.
keywords
.
dao
.
impl
;
import
com.pcloud.book.keywords.dao.SelfRobotGuideDao
;
import
com.pcloud.book.keywords.entity.SelfRobotGuide
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
* 个人号关键词引导语
*/
@Component
(
"selfRobotGuideDao"
)
public
class
SelfRobotGuideDaoImpl
extends
BaseDaoImpl
<
SelfRobotGuide
>
implements
SelfRobotGuideDao
{
@Override
public
void
deleteByKeywordId
(
Long
keywordId
)
{
getSessionTemplate
().
delete
(
getStatement
(
"deleteByKeywordId"
),
keywordId
);
}
@Override
public
List
<
SelfRobotGuide
>
getListByKeywordId
(
Long
keywordId
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getListByKeywordId"
),
keywordId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/keywords/dao/impl/SelfRobotKeywordReplyDaoImpl.java
View file @
cac7a5f7
package
com
.
pcloud
.
book
.
keywords
.
dao
.
impl
;
package
com
.
pcloud
.
book
.
keywords
.
dao
.
impl
;
import
com.pcloud.book.keywords.dao.SelfRobotKeywordDao
;
import
com.pcloud.book.keywords.dao.SelfRobotKeywordReplyDao
;
import
com.pcloud.book.keywords.dao.SelfRobotKeywordReplyDao
;
import
com.pcloud.book.keywords.dto.MaxSeqNAndBGDTO
;
import
com.pcloud.book.keywords.entity.SelfRobotKeyword
;
import
com.pcloud.book.keywords.entity.SelfRobotKeywordReply
;
import
com.pcloud.book.keywords.entity.SelfRobotKeywordReply
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @Description
* @Description
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/entity/SelfRobotGuide.java
0 → 100644
View file @
cac7a5f7
package
com
.
pcloud
.
book
.
keywords
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
com.pcloud.contentcenter.resource.dto.ResourceOfficeItemDTO
;
import
com.pcloud.contentcenter.resource.dto.ResourcePdfItemDTO
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
/**
* @Description
* @Author zhuyajie
* @Date 2020/02/05 13:39
**/
@Data
@ApiModel
(
"个人号关键词引导语"
)
public
class
SelfRobotGuide
extends
BaseEntity
{
@ApiModelProperty
(
"关键词id"
)
private
Long
keywordId
;
@ApiModelProperty
(
"类型 1 文字 2 图片 3 链接 4应用 5素材"
)
private
Integer
type
;
@ApiModelProperty
(
"内容"
)
private
String
content
;
@ApiModelProperty
(
"图片地址"
)
private
String
picUrl
;
@ApiModelProperty
(
"排序值"
)
private
Integer
seqNum
;
@ApiModelProperty
(
"创建人"
)
private
Long
createUser
;
}
pcloud-service-book/src/main/java/com/pcloud/book/keywords/entity/SelfRobotKeyword.java
View file @
cac7a5f7
...
@@ -21,7 +21,7 @@ public class SelfRobotKeyword extends BaseEntity {
...
@@ -21,7 +21,7 @@ public class SelfRobotKeyword extends BaseEntity {
@ApiModelProperty
(
"社群码id"
)
@ApiModelProperty
(
"社群码id"
)
private
Long
bookGroupId
;
private
Long
bookGroupId
;
@ApiModelProperty
(
"引导语"
)
//
@ApiModelProperty("引导语")
private
String
guide
;
private
String
guide
;
@ApiModelProperty
(
"关键词"
)
@ApiModelProperty
(
"关键词"
)
...
@@ -38,4 +38,7 @@ public class SelfRobotKeyword extends BaseEntity {
...
@@ -38,4 +38,7 @@ public class SelfRobotKeyword extends BaseEntity {
@ApiModelProperty
(
"关键词回复列表"
)
@ApiModelProperty
(
"关键词回复列表"
)
private
List
<
SelfRobotKeywordReply
>
keywordReplyList
;
private
List
<
SelfRobotKeywordReply
>
keywordReplyList
;
@ApiModelProperty
(
"引导语列表"
)
private
List
<
SelfRobotGuide
>
guideList
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/keywords/facade/impl/SelfRobotKeywordFacadeImpl.java
View file @
cac7a5f7
...
@@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/runner/KeyWordDelayRunner.java
View file @
cac7a5f7
...
@@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSONObject;
import
com.pcloud.book.book.dto.BookGuideDelayDto
;
import
com.pcloud.book.book.dto.BookGuideDelayDto
;
import
com.pcloud.book.consumer.content.ResourceConsr
;
import
com.pcloud.book.consumer.content.ResourceConsr
;
import
com.pcloud.book.keywords.biz.BookKeywordBiz
;
import
com.pcloud.book.keywords.biz.BookKeywordBiz
;
import
com.pcloud.book.keywords.dao.SelfRobotGuideDao
;
import
com.pcloud.book.keywords.dao.SelfRobotKeywordDao
;
import
com.pcloud.book.keywords.dao.SelfRobotKeywordDao
;
import
com.pcloud.book.keywords.dao.SelfRobotKeywordReplyDao
;
import
com.pcloud.book.keywords.dao.SelfRobotKeywordReplyDao
;
import
com.pcloud.book.keywords.entity.SelfRobotGuide
;
import
com.pcloud.book.keywords.entity.SelfRobotKeyword
;
import
com.pcloud.book.keywords.entity.SelfRobotKeyword
;
import
com.pcloud.book.keywords.entity.SelfRobotKeywordReply
;
import
com.pcloud.book.keywords.entity.SelfRobotKeywordReply
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
...
@@ -13,11 +15,7 @@ import com.pcloud.common.utils.DateUtils;
...
@@ -13,11 +15,7 @@ import com.pcloud.common.utils.DateUtils;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ListUtils
;
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.SendFileVO
;
import
com.sdk.wxgroup.*
;
import
com.sdk.wxgroup.SendGroupInviteVO
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
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.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
...
@@ -55,6 +53,8 @@ public class KeyWordDelayRunner implements ApplicationRunner {
...
@@ -55,6 +53,8 @@ public class KeyWordDelayRunner implements ApplicationRunner {
@Autowired
@Autowired
private
SelfRobotKeywordReplyDao
selfRobotKeywordReplyDao
;
private
SelfRobotKeywordReplyDao
selfRobotKeywordReplyDao
;
@Autowired
private
SelfRobotGuideDao
selfRobotGuideDao
;
@Override
@Override
...
@@ -103,15 +103,33 @@ public class KeyWordDelayRunner implements ApplicationRunner {
...
@@ -103,15 +103,33 @@ public class KeyWordDelayRunner implements ApplicationRunner {
// 查询当前关键词
// 查询当前关键词
SelfRobotKeyword
currentKeyword
=
selfRobotKeywordDao
.
getByBookGroupIdAndKeyword
(
finalBookGroupId
,
bookGuideDelayDto
.
getKeyword
());
SelfRobotKeyword
currentKeyword
=
selfRobotKeywordDao
.
getByBookGroupIdAndKeyword
(
finalBookGroupId
,
bookGuideDelayDto
.
getKeyword
());
// 发送当前关键词引导语
// 发送当前关键词引导语
SendTextMessageVO
vo
=
new
SendTextMessageVO
();
List
<
SelfRobotGuide
>
guides
=
selfRobotGuideDao
.
getListByKeywordId
(
currentKeyword
.
getId
());
vo
.
setContent
(
currentKeyword
.
getGuide
());
if
(!
ListUtils
.
isEmpty
(
guides
)){
vo
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
for
(
SelfRobotGuide
selfRobotGuide:
guides
){
vo
.
setWxId
(
bookGuideDelayDto
.
getUserWxId
());
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
selfRobotGuide
.
getType
())){
vo
.
setAltId
(
finalWxid
);
SendTextMessageVO
vo
=
new
SendTextMessageVO
();
vo
.
setWxGroupId
(
bookGuideDelayDto
.
getUserWxId
());
vo
.
setContent
(
selfRobotGuide
.
getContent
());
vo
.
setIp
(
bookGuideDelayDto
.
getIp
());
vo
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendTextMessage
(
vo
);
vo
.
setWxId
(
bookGuideDelayDto
.
getUserWxId
());
log
.
info
(
"[发送当前关键词]:{}"
,
JSONObject
.
toJSONString
(
vo
));
vo
.
setAltId
(
finalWxid
);
vo
.
setWxGroupId
(
bookGuideDelayDto
.
getUserWxId
());
vo
.
setIp
(
bookGuideDelayDto
.
getIp
());
WxGroupSDK
.
sendTextMessage
(
vo
);
log
.
info
(
"[发送当前关键词引导语]:{}"
,
JSONObject
.
toJSONString
(
vo
));
}
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
selfRobotGuide
.
getType
())){
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setWxGroupId
(
bookGuideDelayDto
.
getUserWxId
());
sendPicMessageVO
.
setWxId
(
bookGuideDelayDto
.
getUserWxId
());
sendPicMessageVO
.
setAltId
(
finalWxid
);
sendPicMessageVO
.
setPicUrl
(
selfRobotGuide
.
getPicUrl
());
sendPicMessageVO
.
setIp
(
bookGuideDelayDto
.
getIp
());
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
log
.
info
(
"[发送当前关键词引导语]:{}"
,
JSONObject
.
toJSONString
(
sendPicMessageVO
));
}
}
}
if
(
"学前"
.
equals
(
currentKeyword
.
getKeyword
())
if
(
"学前"
.
equals
(
currentKeyword
.
getKeyword
())
&&
envStr
.
toUpperCase
().
equals
(
"PRO"
)
&&
finalWxid
.
equals
(
"wxid_x8i897ryabo722"
))
{
&&
envStr
.
toUpperCase
().
equals
(
"PRO"
)
&&
finalWxid
.
equals
(
"wxid_x8i897ryabo722"
))
{
SendGroupInviteVO
sendGroupInviteVO
=
new
SendGroupInviteVO
();
SendGroupInviteVO
sendGroupInviteVO
=
new
SendGroupInviteVO
();
...
...
pcloud-service-book/src/main/resources/mapper/group/SelfRobotGuide.xml
0 → 100644
View file @
cac7a5f7
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.keywords.dao.impl.SelfRobotGuideDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.keywords.entity.SelfRobotGuide"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"keyword_id"
property=
"keywordId"
jdbcType=
"BIGINT"
/>
<result
column=
"type"
property=
"type"
jdbcType=
"INTEGER"
/>
<result
column=
"content"
property=
"content"
jdbcType=
"VARCHAR"
/>
<result
column=
"pic_url"
property=
"picUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"seq_num"
property=
"seqNum"
jdbcType=
"INTEGER"
/>
<result
column=
"create_user"
property=
"createUser"
jdbcType=
"BIGINT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, keyword_id, type, content, pic_url, seq_num, create_user, create_time
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.keywords.entity.SelfRobotGuide"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into self_robot_guide
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
keyword_id,
type,
content,
pic_url,
seq_num,
create_user,
create_time
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{keywordId,jdbcType=BIGINT},
#{type,jdbcType=INTEGER},
#{content,jdbcType=VARCHAR},
#{picUrl,jdbcType=VARCHAR},
#{seqNum,jdbcType=INTEGER},
#{createUser,jdbcType=BIGINT},
NOW()
</trim>
</insert>
<!--批量插入-->
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.keywords.entity.SelfRobotGuide"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into self_robot_guide (
keyword_id,
type,
content,
pic_url,
seq_num,
create_user,
create_time
) values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.keywordId,jdbcType=BIGINT},
#{item.type,jdbcType=INTEGER},
#{item.content,jdbcType=VARCHAR},
#{item.picUrl,jdbcType=VARCHAR},
#{item.seqNum,jdbcType=INTEGER},
#{item.createUser,jdbcType=BIGINT},
NOW()
)
</foreach>
</insert>
<delete
id=
"deleteByKeywordId"
parameterType=
"map"
>
delete from self_robot_guide
where keyword_id = #{keywordId}
</delete>
<select
id=
"getListByKeywordId"
parameterType=
"long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from self_robot_guide
where keyword_id = #{keywordId}
order by seq_num, id
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/group/SelfRobotKeyword.xml
View file @
cac7a5f7
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.keywords.entity.SelfRobotKeyword"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.keywords.entity.SelfRobotKeyword"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"book_group_id"
property=
"bookGroupId"
jdbcType=
"BIGINT"
/>
<result
column=
"book_group_id"
property=
"bookGroupId"
jdbcType=
"BIGINT"
/>
<result
column=
"guide"
property=
"guide"
jdbcType=
"VARCHAR"
/>
<result
column=
"keyword"
property=
"keyword"
jdbcType=
"VARCHAR"
/>
<result
column=
"keyword"
property=
"keyword"
jdbcType=
"VARCHAR"
/>
<result
column=
"seq_num"
property=
"seqNum"
jdbcType=
"INTEGER"
/>
<result
column=
"seq_num"
property=
"seqNum"
jdbcType=
"INTEGER"
/>
<result
column=
"delay_time"
property=
"delayTime"
jdbcType=
"INTEGER"
/>
<result
column=
"delay_time"
property=
"delayTime"
jdbcType=
"INTEGER"
/>
...
@@ -14,7 +13,7 @@
...
@@ -14,7 +13,7 @@
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
id, book_group_id,
guide,
keyword, seq_num, delay_time, create_user, create_time
id, book_group_id, keyword, seq_num, delay_time, create_user, create_time
</sql>
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.keywords.entity.SelfRobotKeyword"
useGeneratedKeys=
"true"
<insert
id=
"insert"
parameterType=
"com.pcloud.book.keywords.entity.SelfRobotKeyword"
useGeneratedKeys=
"true"
...
@@ -22,7 +21,6 @@
...
@@ -22,7 +21,6 @@
insert into self_robot_keyword
insert into self_robot_keyword
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
book_group_id,
book_group_id,
guide,
keyword,
keyword,
seq_num,
seq_num,
delay_time,
delay_time,
...
@@ -31,7 +29,6 @@
...
@@ -31,7 +29,6 @@
</trim>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{bookGroupId,jdbcType=BIGINT},
#{bookGroupId,jdbcType=BIGINT},
#{guide,jdbcType=VARCHAR},
#{keyword,jdbcType=VARCHAR},
#{keyword,jdbcType=VARCHAR},
#{seqNum,jdbcType=INTEGER},
#{seqNum,jdbcType=INTEGER},
#{delayTime,jdbcType=INTEGER},
#{delayTime,jdbcType=INTEGER},
...
@@ -44,7 +41,6 @@
...
@@ -44,7 +41,6 @@
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.keywords.entity.SelfRobotKeyword"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.keywords.entity.SelfRobotKeyword"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into self_robot_keyword (
insert into self_robot_keyword (
book_group_id,
book_group_id,
guide,
keyword,
keyword,
seq_num,
seq_num,
delay_time,
delay_time,
...
@@ -54,7 +50,6 @@
...
@@ -54,7 +50,6 @@
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
(
#{item.bookGroupId,jdbcType=BIGINT},
#{item.bookGroupId,jdbcType=BIGINT},
#{item.guide,jdbcType=VARCHAR},
#{item.keyword,jdbcType=VARCHAR},
#{item.keyword,jdbcType=VARCHAR},
#{item.seqNum,jdbcType=INTEGER},
#{item.seqNum,jdbcType=INTEGER},
#{item.delayTime,jdbcType=INTEGER},
#{item.delayTime,jdbcType=INTEGER},
...
@@ -68,7 +63,6 @@
...
@@ -68,7 +63,6 @@
update self_robot_keyword
update self_robot_keyword
<set>
<set>
book_group_id = #{bookGroupId,jdbcType=BIGINT},
book_group_id = #{bookGroupId,jdbcType=BIGINT},
guide = #{guide,jdbcType=VARCHAR},
keyword = #{keyword,jdbcType=VARCHAR},
keyword = #{keyword,jdbcType=VARCHAR},
seq_num = #{seqNum,jdbcType=INTEGER},
seq_num = #{seqNum,jdbcType=INTEGER},
delay_time = #{delayTime,jdbcType=INTEGER}
delay_time = #{delayTime,jdbcType=INTEGER}
...
@@ -100,12 +94,18 @@
...
@@ -100,12 +94,18 @@
</select>
</select>
<select
id=
"getNextKeyWord"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
<select
id=
"getNextKeyWord"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
SELECT * FROM self_robot_keyword
SELECT
WHERE book_group_id=#{bookGroupId}
k.id, k.book_group_id, k.keyword, k.seq_num, k.delay_time, k.create_user, k.create_time
AND seq_num > (SELECT seq_num FROM self_robot_keyword WHERE keyword = #{keyword} AND book_group_id=#{bookGroupId} LIMIT 1)
FROM
and delay_time is not null
self_robot_keyword k
and guide is not null
LEFT JOIN self_robot_guide g ON k.id = g.keyword_id
ORDER BY seq_num
WHERE
k.book_group_id = #{bookGroupId}
AND k.seq_num > (SELECT seq_num FROM self_robot_keyword WHERE keyword = #{keyword} AND book_group_id=#{bookGroupId} LIMIT 1)
AND k.delay_time IS NOT NULL
AND g.id > 0
ORDER BY
k.seq_num
LIMIT 1
LIMIT 1
</select>
</select>
...
...
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