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
756a9160
Commit
756a9160
authored
Feb 26, 2020
by
郑永强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
衔接语增加进度链接
parent
25f4d685
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
28 deletions
+26
-28
PersonalStageBiz.java
...a/com/pcloud/book/personalstage/biz/PersonalStageBiz.java
+4
-1
PersonalStageBizImpl.java
...oud/book/personalstage/biz/impl/PersonalStageBizImpl.java
+10
-22
PersonalStageJumpBizImpl.java
...book/personalstage/biz/impl/PersonalStageJumpBizImpl.java
+6
-5
PersonalStageConstant.java
...ud/book/personalstage/constant/PersonalStageConstant.java
+4
-0
LinkupDelayDTO.java
...ava/com/pcloud/book/personalstage/dto/LinkupDelayDTO.java
+2
-0
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/personalstage/biz/PersonalStageBiz.java
View file @
756a9160
...
...
@@ -4,6 +4,7 @@ import com.pcloud.book.personalstage.dto.PersonalStageDTO;
import
com.pcloud.book.personalstage.dto.PersonalStageProgressDTO
;
import
com.pcloud.book.personalstage.entity.PersonalStage
;
import
com.pcloud.book.personalstage.entity.PersonalStageUser
;
import
com.pcloud.common.core.mq.DelayQueueDTO
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBean
;
...
...
@@ -47,12 +48,14 @@ public interface PersonalStageBiz {
void
dealDelayWakeup
(
DelayQueueDTO
dto
);
void
nextStageAddStageUserAndWakeupDelay
(
String
robotId
,
String
userWxId
,
String
ip
,
Long
personalStageId
);
PersonalStageUser
nextStageAddStageUserAndWakeupDelay
(
String
robotId
,
String
userWxId
,
String
ip
,
Long
personalStageId
);
void
sendNotKeywordReply
(
String
robotId
,
String
userWxId
,
String
ip
,
Long
personalStageId
,
Long
personalStageUserId
);
void
sendNotKeywordFusingReply
(
String
robotId
,
String
userWxId
,
String
ip
,
Long
personalStageId
,
Long
personalStageUserId
);
String
replaceProjectProgressUrl
(
String
content
,
String
robotId
,
String
userWxId
,
Long
personalStageUserId
);
void
dealDelayFusingFinish
(
DelayQueueDTO
dto
);
PersonalStageProgressDTO
getPersonalProgress
(
String
wxUserId
,
Long
personalStageUserId
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/personalstage/biz/impl/PersonalStageBizImpl.java
View file @
756a9160
...
...
@@ -104,11 +104,6 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
@Value
(
"${wechat.group.link.prefix}"
)
private
String
wechatLinkPrefix
;
private
final
static
String
PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE
=
"${PROGRESS_URL}"
;
// 项目进度路由
private
final
static
String
PERSONAL_STAGE_PROJECT_PROGRESS
=
"/personalCenter/projectProgress"
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
"新增阶段"
)
...
...
@@ -475,7 +470,7 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
@ParamLog
(
"下一阶段新增定制化阶段用户记录和唤醒延时"
)
@Override
public
void
nextStageAddStageUserAndWakeupDelay
(
String
robotId
,
String
userWxId
,
String
ip
,
Long
personalStageId
)
{
public
PersonalStageUser
nextStageAddStageUserAndWakeupDelay
(
String
robotId
,
String
userWxId
,
String
ip
,
Long
personalStageId
)
{
PersonalStageWakeup
wakeup
=
personalStageWakeupDao
.
getFirstWakeup
(
personalStageId
);
PersonalStageUser
personalStageUser
=
new
PersonalStageUser
();
personalStageUser
.
setRobotId
(
robotId
);
...
...
@@ -497,7 +492,7 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
//同时插入唤醒队列
//查询第一个唤醒时长
if
(
wakeup
==
null
){
return
;
return
personalStageUser
;
}
Integer
toStageStartTime
=
wakeup
.
getToStageStartTime
();
WakeupDelayDTO
wakeupDelayDTO
=
new
WakeupDelayDTO
();
...
...
@@ -509,6 +504,7 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
wakeupDelayDTO
.
setPersonalStageUserId
(
personalStageUser
.
getId
());
DelayQueueDTO
delayQueueDTO
=
DelayQueueDTO
.
builder
().
key
(
userWxId
).
type
(
PersonalStageConstant
.
PERSONALSTAGE_DELAY_WAKEUP
).
msg
(
wakeupDelayDTO
).
timeout
(
toStageStartTime
*
60
*
1000
).
build
();
delayMessageSender
.
send
(
delayQueueDTO
);
return
personalStageUser
;
}
@ParamLog
(
"非关键词回复"
)
...
...
@@ -533,21 +529,15 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
personalStageUserDao
.
updateRequireNumber
(
personalStageUserId
,
requireNumber
);
}
@Override
@ParamLog
(
"替换进度链接"
)
private
void
replaceProjectProgressUrl
(
List
<
PersonalStageReplyItem
>
items
,
String
robotId
,
String
userWxId
,
Long
personalStageUserId
)
{
boolean
insertNumber
=
false
;
for
(
PersonalStageReplyItem
item
:
items
){
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
item
.
getReplyType
())){
if
(!
insertNumber
&&
item
.
getContent
().
indexOf
(
PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE
)
>
-
1
){
insertNumber
=
true
;
}
String
longUrl
=
wechatLinkPrefix
.
concat
(
PERSONAL_STAGE_PROJECT_PROGRESS
).
concat
(
"?wxUserId="
+
userWxId
+
"&robotId="
+
robotId
+
"&personalStageUserId="
+
personalStageUserId
);
item
.
setContent
(
item
.
getContent
().
replace
(
PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE
,
UrlUtils
.
getShortUrl4Own
(
longUrl
)));
}
}
if
(
insertNumber
){
public
String
replaceProjectProgressUrl
(
String
content
,
String
robotId
,
String
userWxId
,
Long
personalStageUserId
)
{
if
(
content
.
indexOf
(
PersonalStageConstant
.
PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE
)
>
-
1
){
tryInsertNumber
(
personalStageUserId
);
String
longUrl
=
wechatLinkPrefix
.
concat
(
PersonalStageConstant
.
PERSONAL_STAGE_PROJECT_PROGRESS
).
concat
(
"?wxUserId="
+
userWxId
+
"&robotId="
+
robotId
+
"&personalStageUserId="
+
personalStageUserId
);
return
content
.
replace
(
PersonalStageConstant
.
PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE
,
UrlUtils
.
getShortUrl4Own
(
longUrl
));
}
return
content
;
}
@ParamLog
(
"非关键词熔断回复"
)
...
...
@@ -568,13 +558,11 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
@ParamLog
(
"发送回复"
)
private
void
sendReplyItems
(
List
<
PersonalStageReplyItem
>
replyItems
,
String
robotId
,
String
userWxId
,
String
ip
,
Long
personalStageUserId
){
// 替换进度链接
replaceProjectProgressUrl
(
replyItems
,
robotId
,
userWxId
,
personalStageUserId
);
for
(
PersonalStageReplyItem
item:
replyItems
){
Integer
type
=
item
.
getReplyType
();
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
type
))
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
item
.
getContent
(
));
sendTextMessageVO
.
setContent
(
replaceProjectProgressUrl
(
item
.
getContent
(),
robotId
,
userWxId
,
personalStageUserId
));
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/personalstage/biz/impl/PersonalStageJumpBizImpl.java
View file @
756a9160
...
...
@@ -327,9 +327,9 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
// 发送邮件
sendEmail
(
userWxId
,
robotWxId
,
content
,
jumpKeywordDto
);
// 将用户置为下个阶段
personalStageBiz
.
nextStageAddStageUserAndWakeupDelay
(
robotWxId
,
userWxId
,
ip
,
jumpKeywordDto
.
getAfterPersonalStageId
());
PersonalStageUser
nextPersonalStageUser
=
personalStageBiz
.
nextStageAddStageUserAndWakeupDelay
(
robotWxId
,
userWxId
,
ip
,
jumpKeywordDto
.
getAfterPersonalStageId
());
// 发送内容衔接语
sendJumpLinkups
(
userWxId
,
robotWxId
,
ip
,
jumpKeywordDto
.
getPersonalStageJumpId
());
sendJumpLinkups
(
userWxId
,
robotWxId
,
ip
,
jumpKeywordDto
.
getPersonalStageJumpId
()
,
nextPersonalStageUser
.
getId
()
);
// 停止发送引导语
pcloudGuideBiz
.
stopPcloudGuidePush
(
robotWxId
,
userWxId
);
return
true
;
...
...
@@ -345,7 +345,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
return
;
}
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
jumpLinkup
.
getLinkupContent
(
));
sendTextMessageVO
.
setContent
(
personalStageBiz
.
replaceProjectProgressUrl
(
jumpLinkup
.
getLinkupContent
(),
linkupDelayDTO
.
getRobotId
(),
linkupDelayDTO
.
getWxId
(),
linkupDelayDTO
.
getPersonalStageUserId
()
));
sendTextMessageVO
.
setAltId
(
linkupDelayDTO
.
getRobotId
());
sendTextMessageVO
.
setWxGroupId
(
dto
.
getKey
());
sendTextMessageVO
.
setIp
(
linkupDelayDTO
.
getIp
());
...
...
@@ -417,7 +417,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
}
@ParamLog
(
"发送内容衔接语"
)
private
void
sendJumpLinkups
(
String
userWxId
,
String
robotWxId
,
String
ip
,
Long
jumpId
)
{
private
void
sendJumpLinkups
(
String
userWxId
,
String
robotWxId
,
String
ip
,
Long
jumpId
,
Long
personalStageUserId
)
{
List
<
PersonalStageJumpLinkup
>
linkups
=
personalStageJumpLinkupDao
.
getByJumpId
(
jumpId
);
if
(
ListUtils
.
isEmpty
(
linkups
)){
return
;
...
...
@@ -429,12 +429,13 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
linkupDelayDTO
.
setRobotId
(
robotWxId
);
linkupDelayDTO
.
setWxId
(
userWxId
);
linkupDelayDTO
.
setIp
(
ip
);
linkupDelayDTO
.
setPersonalStageUserId
(
personalStageUserId
);
DelayQueueDTO
delayQueueDTO
=
DelayQueueDTO
.
builder
().
key
(
userWxId
).
type
(
PersonalStageConstant
.
PERSONALSTAGE_DELAY_LINKUP
).
msg
(
linkupDelayDTO
).
timeout
(
jumpLinkup
.
getToStageStartTime
()*
60
*
1000
).
build
();
delayMessageSender
.
send
(
delayQueueDTO
);
LOGGER
.
info
(
"增加跳转衔接语延时"
+
delayQueueDTO
.
toString
());
}
else
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
jumpLinkup
.
getLinkupContent
(
));
sendTextMessageVO
.
setContent
(
personalStageBiz
.
replaceProjectProgressUrl
(
jumpLinkup
.
getLinkupContent
(),
robotWxId
,
userWxId
,
personalStageUserId
));
sendTextMessageVO
.
setAltId
(
robotWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/personalstage/constant/PersonalStageConstant.java
View file @
756a9160
...
...
@@ -10,5 +10,9 @@ public class PersonalStageConstant {
public
static
final
String
USER_SEND_KEYWORD_COUNT_LOCK
=
"USER_SEND_KEYWORD_COUNT_LOCK"
;
public
static
final
String
PERSONALSTAGE_DELAY_LINKUP
=
"PERSONALSTAGE_DELAY_LINKUP"
;
// 进度模板字符串
public
static
final
String
PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE
=
"${PROGRESS_URL}"
;
// 项目进度页面路由
public
static
final
String
PERSONAL_STAGE_PROJECT_PROGRESS
=
"/personalCenter/projectProgress"
;
}
pcloud-service-book/src/main/java/com/pcloud/book/personalstage/dto/LinkupDelayDTO.java
View file @
756a9160
...
...
@@ -18,5 +18,7 @@ public class LinkupDelayDTO implements Serializable {
private
String
wxId
;
@ApiModelProperty
(
"ip地址"
)
private
String
ip
;
@ApiModelProperty
(
"用户阶段记录id"
)
private
Long
personalStageUserId
;
}
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