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
9d93379c
Commit
9d93379c
authored
Mar 30, 2020
by
阮思源
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1002652 图书服务等级判断与0级图书服务推送
parent
7c40ddd5
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
116 additions
and
5 deletions
+116
-5
pom.xml
pcloud-service-book/pom.xml
+6
-0
ErpConsr.java
.../src/main/java/com/pcloud/book/consumer/erp/ErpConsr.java
+34
-0
PersonalStageBizImpl.java
...oud/book/personalstage/biz/impl/PersonalStageBizImpl.java
+45
-0
PersonalStageJumpBizImpl.java
...book/personalstage/biz/impl/PersonalStageJumpBizImpl.java
+2
-4
UserReplaceCodeDao.java
...com/pcloud/book/personalstage/dao/UserReplaceCodeDao.java
+3
-0
UserReplaceCodeDaoImpl.java
...d/book/personalstage/dao/impl/UserReplaceCodeDaoImpl.java
+9
-0
JumpTypeEnum.java
...ava/com/pcloud/book/personalstage/enums/JumpTypeEnum.java
+3
-1
UserReplaceCode.xml
...c/main/resources/mapper/personalstage/UserReplaceCode.xml
+14
-0
No files found.
pcloud-service-book/pom.xml
View file @
9d93379c
...
@@ -216,6 +216,12 @@
...
@@ -216,6 +216,12 @@
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.pcloud.facade
</groupId>
<artifactId>
pcloud-facade-erp
</artifactId>
<version>
${pcloud-facade.version}
</version>
</dependency>
<dependency>
<groupId>
fakepath
</groupId>
<groupId>
fakepath
</groupId>
<artifactId>
jbarcode
</artifactId>
<artifactId>
jbarcode
</artifactId>
<version>
0.2.8
</version>
<version>
0.2.8
</version>
...
...
pcloud-service-book/src/main/java/com/pcloud/book/consumer/erp/ErpConsr.java
0 → 100644
View file @
9d93379c
package
com
.
pcloud
.
book
.
consumer
.
erp
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.erp.project.service.ProjectService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
@Repository
(
"erpConsr"
)
public
class
ErpConsr
{
/**
* logger
*/
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ErpConsr
.
class
);
@Autowired
private
ProjectService
projectService
;
@ParamLog
(
"根据书名获取等级"
)
public
Integer
getBookServiceLevel
(
String
bookName
)
throws
BizException
{
try
{
return
ResponseHandleUtil
.
parseResponse
(
projectService
.
getBookServiceLevel
(
bookName
),
Integer
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"获取资源基本信息[resourceService.mapByPass]:"
+
e
.
getMessage
(),
e
);
throw
new
BookBizException
(
BookBizException
.
INVOKE_CONTENT_ERROR
,
"获取资源基本信息失败~!"
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/personalstage/biz/impl/PersonalStageBizImpl.java
View file @
9d93379c
...
@@ -6,6 +6,7 @@ import com.google.common.collect.Maps;
...
@@ -6,6 +6,7 @@ import com.google.common.collect.Maps;
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
;
import
com.pcloud.book.consumer.content.ResourceConsr
;
import
com.pcloud.book.consumer.content.ResourceConsr
;
import
com.pcloud.book.consumer.erp.ErpConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.custom.mapper.CustomPlanModuleSuggestionMapper
;
import
com.pcloud.book.custom.mapper.CustomPlanModuleSuggestionMapper
;
import
com.pcloud.book.custom.vo.AddBookNameVO
;
import
com.pcloud.book.custom.vo.AddBookNameVO
;
...
@@ -63,6 +64,7 @@ import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
...
@@ -63,6 +64,7 @@ import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
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.erp.project.enums.ServiceLevelEnum
;
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.RobotProcessTypeEnum
;
...
@@ -140,6 +142,9 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
...
@@ -140,6 +142,9 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
@Autowired
@Autowired
private
PersonalAppletsDao
personalAppletsDao
;
private
PersonalAppletsDao
personalAppletsDao
;
@Autowired
private
ErpConsr
erpConsr
;
@Value
(
"${wechat.group.link.prefix}"
)
@Value
(
"${wechat.group.link.prefix}"
)
private
String
wechatLinkPrefix
;
private
String
wechatLinkPrefix
;
...
@@ -384,6 +389,15 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
...
@@ -384,6 +389,15 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
PersonalStageUser
last
=
personalStageUserDao
.
getLast
(
userWxId
,
robotId
,
null
);
PersonalStageUser
last
=
personalStageUserDao
.
getLast
(
userWxId
,
robotId
,
null
);
PersonalStage
personalStage
;
PersonalStage
personalStage
;
if
(
last
!=
null
){
if
(
last
!=
null
){
//如果之前有书的时候判断这个阶段的跳转方式是否踩中有0级和非0级的跳转关键词
//先判断0级
if
(
dealZeroBook
(
userWxId
,
robotId
,
content
,
last
,
JumpTypeEnum
.
ZERO_BOOK
)){
return
;
}
//再判断非0级
if
(
dealZeroBook
(
userWxId
,
robotId
,
content
,
last
,
JumpTypeEnum
.
NO_ZERO_BOOK
)){
return
;
}
hasRecord
=
true
;
hasRecord
=
true
;
personalStage
=
personalStageDao
.
getById
(
last
.
getPersonalStageId
());
personalStage
=
personalStageDao
.
getById
(
last
.
getPersonalStageId
());
}
else
{
}
else
{
...
@@ -464,6 +478,37 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
...
@@ -464,6 +478,37 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
}
}
}
}
@ParamLog
(
"处理0级书和非0级书"
)
private
Boolean
dealZeroBook
(
String
userWxId
,
String
robotId
,
String
content
,
PersonalStageUser
last
,
JumpTypeEnum
jumpTypeEnum
)
{
PersonalStageJumpKeywordDto
dto
=
personalStageJumpKeywordDao
.
getByKeyword
(
last
.
getPersonalStageId
(),
content
,
jumpTypeEnum
.
key
);
if
(
dto
==
null
){
return
false
;
}
List
<
ReplaceCode
>
all
=
replaceCodeDao
.
getAll
();
Long
replaceCodeId
=
null
;
for
(
ReplaceCode
replaceCode:
all
){
if
(
"${bookName}"
.
equals
(
replaceCode
.
getReplaceCode
())){
replaceCodeId
=
replaceCode
.
getId
();
break
;
}
}
UserReplaceCode
record
=
userReplaceCodeDao
.
getLastUserReplaceByCodeId
(
userWxId
,
robotId
,
replaceCodeId
);
if
(
record
==
null
){
return
false
;
}
//查询书名等级,阶段跳转
Integer
level
=
erpConsr
.
getBookServiceLevel
(
record
.
getContent
());
if
(
jumpTypeEnum
.
key
.
equals
(
JumpTypeEnum
.
ZERO_BOOK
.
key
)&&
ServiceLevelEnum
.
ZERO_BOOK
.
value
.
equals
(
level
)){
personalStageJumpBiz
.
handlePersonalStageJump
(
userWxId
,
robotId
,
content
,
jumpTypeEnum
);
return
true
;
}
if
(
jumpTypeEnum
.
key
.
equals
(
JumpTypeEnum
.
NO_ZERO_BOOK
.
key
)&&
ServiceLevelEnum
.
NOT_ZERO_BOOK
.
value
.
equals
(
level
)){
personalStageJumpBiz
.
handlePersonalStageJump
(
userWxId
,
robotId
,
content
,
jumpTypeEnum
);
return
true
;
}
return
false
;
}
@ParamLog
(
"从缓存中获取发送非关键词次数"
)
@ParamLog
(
"从缓存中获取发送非关键词次数"
)
private
synchronized
Integer
getSendNKeywordCountFromCache
(
Long
personalStageId
,
String
wxId
,
String
robotId
)
{
private
synchronized
Integer
getSendNKeywordCountFromCache
(
Long
personalStageId
,
String
wxId
,
String
robotId
)
{
...
...
pcloud-service-book/src/main/java/com/pcloud/book/personalstage/biz/impl/PersonalStageJumpBizImpl.java
View file @
9d93379c
...
@@ -131,8 +131,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
...
@@ -131,8 +131,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
createPersonalStageJump
(
CreateStageJumpRequestVO
vo
)
{
public
void
createPersonalStageJump
(
CreateStageJumpRequestVO
vo
)
{
//校验关键词是否重复
//校验关键词是否重复
if
(!
JumpTypeEnum
.
PAY_TRIGGER
.
key
.
equals
(
vo
.
getJumpType
())
&&
!
JumpTypeEnum
.
PAPER_TRIGGER
.
key
.
equals
(
vo
.
getJumpType
())
if
(
JumpTypeEnum
.
READER_TRIGGER
.
key
.
equals
(
vo
.
getJumpType
())||
JumpTypeEnum
.
ROBOT_TRIGGER
.
key
.
equals
(
vo
.
getJumpType
())){
&&!
JumpTypeEnum
.
END_SERVICE
.
key
.
equals
(
vo
.
getJumpType
())&&!
JumpTypeEnum
.
PLAN_TRIGGER
.
key
.
equals
(
vo
.
getJumpType
())){
this
.
checkKeywords
(
vo
.
getKeywords
(),
vo
.
getPersonalStageId
(),
null
);
this
.
checkKeywords
(
vo
.
getKeywords
(),
vo
.
getPersonalStageId
(),
null
);
}
}
if
(
JumpTypeEnum
.
PAPER_TRIGGER
.
key
.
equals
(
vo
.
getJumpType
())){
if
(
JumpTypeEnum
.
PAPER_TRIGGER
.
key
.
equals
(
vo
.
getJumpType
())){
...
@@ -313,8 +312,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
...
@@ -313,8 +312,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
@ParamLog
(
"修改跳转阶段"
)
@ParamLog
(
"修改跳转阶段"
)
public
void
updatePersonalStageJump
(
UpdateStageJumpRequestVO
vo
)
{
public
void
updatePersonalStageJump
(
UpdateStageJumpRequestVO
vo
)
{
//校验关键词是否重复
//校验关键词是否重复
if
(!
JumpTypeEnum
.
PAY_TRIGGER
.
key
.
equals
(
vo
.
getJumpType
())
&&
!
JumpTypeEnum
.
PAPER_TRIGGER
.
key
.
equals
(
vo
.
getJumpType
())
if
(
JumpTypeEnum
.
READER_TRIGGER
.
key
.
equals
(
vo
.
getJumpType
())||
JumpTypeEnum
.
ROBOT_TRIGGER
.
key
.
equals
(
vo
.
getJumpType
())){
&&!
JumpTypeEnum
.
END_SERVICE
.
key
.
equals
(
vo
.
getJumpType
())
&&!
JumpTypeEnum
.
PLAN_TRIGGER
.
key
.
equals
(
vo
.
getJumpType
())){
this
.
checkKeywords
(
vo
.
getKeywords
(),
vo
.
getPersonalStageId
(),
vo
.
getPersonalStageJumpId
());
this
.
checkKeywords
(
vo
.
getKeywords
(),
vo
.
getPersonalStageId
(),
vo
.
getPersonalStageJumpId
());
}
}
if
(
JumpTypeEnum
.
PAPER_TRIGGER
.
key
.
equals
(
vo
.
getJumpType
())){
if
(
JumpTypeEnum
.
PAPER_TRIGGER
.
key
.
equals
(
vo
.
getJumpType
())){
...
...
pcloud-service-book/src/main/java/com/pcloud/book/personalstage/dao/UserReplaceCodeDao.java
View file @
9d93379c
...
@@ -10,4 +10,6 @@ public interface UserReplaceCodeDao extends BaseDao<UserReplaceCode> {
...
@@ -10,4 +10,6 @@ public interface UserReplaceCodeDao extends BaseDao<UserReplaceCode> {
List
<
UserReplaceCode
>
getLastUserReplace
(
String
wxId
,
String
robotId
);
List
<
UserReplaceCode
>
getLastUserReplace
(
String
wxId
,
String
robotId
);
List
<
String
>
getUserReplaceRecordByCodeId
(
String
wxId
,
String
robotId
,
Long
codeId
);
List
<
String
>
getUserReplaceRecordByCodeId
(
String
wxId
,
String
robotId
,
Long
codeId
);
UserReplaceCode
getLastUserReplaceByCodeId
(
String
wxId
,
String
robotId
,
Long
replaceCodeId
);
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/personalstage/dao/impl/UserReplaceCodeDaoImpl.java
View file @
9d93379c
...
@@ -28,4 +28,13 @@ public class UserReplaceCodeDaoImpl extends BaseDaoImpl<UserReplaceCode> impleme
...
@@ -28,4 +28,13 @@ public class UserReplaceCodeDaoImpl extends BaseDaoImpl<UserReplaceCode> impleme
map
.
put
(
"replaceCodeId"
,
codeId
);
map
.
put
(
"replaceCodeId"
,
codeId
);
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getUserReplaceRecordByCodeId"
),
map
);
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getUserReplaceRecordByCodeId"
),
map
);
}
}
@Override
public
UserReplaceCode
getLastUserReplaceByCodeId
(
String
wxId
,
String
robotId
,
Long
replaceCodeId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wxId"
,
wxId
);
map
.
put
(
"robotId"
,
robotId
);
map
.
put
(
"replaceCodeId"
,
replaceCodeId
);
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getLastUserReplaceByCodeId"
),
map
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/personalstage/enums/JumpTypeEnum.java
View file @
9d93379c
...
@@ -7,7 +7,9 @@ public enum JumpTypeEnum {
...
@@ -7,7 +7,9 @@ public enum JumpTypeEnum {
PAY_TRIGGER
(
3
,
"转账触发"
),
PAY_TRIGGER
(
3
,
"转账触发"
),
PAPER_TRIGGER
(
4
,
"需求定制单触发"
),
PAPER_TRIGGER
(
4
,
"需求定制单触发"
),
END_SERVICE
(
5
,
"人工客服结束触发"
),
END_SERVICE
(
5
,
"人工客服结束触发"
),
PLAN_TRIGGER
(
6
,
"方案定制单触发"
);
PLAN_TRIGGER
(
6
,
"方案定制单触发"
),
ZERO_BOOK
(
8
,
"0级书跳转"
),
NO_ZERO_BOOK
(
9
,
"非0级书跳转"
);
public
final
Integer
key
;
public
final
Integer
key
;
public
final
String
desc
;
public
final
String
desc
;
...
...
pcloud-service-book/src/main/resources/mapper/personalstage/UserReplaceCode.xml
View file @
9d93379c
...
@@ -83,4 +83,17 @@
...
@@ -83,4 +83,17 @@
create_time DESC
create_time DESC
</select>
</select>
<select
id=
"getLastUserReplaceByCodeId"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM
user_replace_code
WHERE robot_id = #{robotId}
AND wx_id = #{wxId}
AND replace_code_id = #{replaceCodeId}
ORDER BY
create_time DESC
limit 1
</select>
</mapper>
</mapper>
\ No newline at end of file
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