Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
向汉
/
uc-engine
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
c177b36a
...
c177b36aabeed59d792e310817bf15e71372b5d1
authored
2022-06-15 13:15:57 +0800
by
xianghan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.修复添加观影记录时同样的观影记录重复添加的bug
1 parent
15ff56ea
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
member-service-impl/src/main/resources/config/application-dev.yml
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
View file @
c177b36
...
...
@@ -829,9 +829,9 @@ public class UserOperationServiceImpl implements UserOperationService {
//处理接口调用 中文不显示问题
content
=
new
String
(
Base64
.
getDecoder
().
decode
(
content
.
getBytes
(
StandardCharsets
.
UTF_8
)));
log
.
info
(
"receive addCollection add message, content {}"
,
content
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
content
);
log
.
info
(
"receive addCollection add message, content {}"
,
jsonObject
);
String
platformAccount
=
jsonObject
.
getString
(
"platformAccount"
);
String
data
=
jsonObject
.
getString
(
"data"
);
...
...
@@ -840,6 +840,7 @@ public class UserOperationServiceImpl implements UserOperationService {
UserTvDTO
userTvDTO
=
this
.
userTvService
.
findByPlatformAccount
(
platformAccount
);
log
.
info
(
"大屏账号信息 userTvDTO ==>> {}"
,
userTvDTO
);
Long
tvUserId
=
userTvDTO
.
getId
();
List
<
UserCollectionMq
>
userCollectionMqList
=
JSONObject
.
parseArray
(
data
,
UserCollectionMq
.
class
);
...
...
@@ -859,7 +860,8 @@ public class UserOperationServiceImpl implements UserOperationService {
UserCollection
userCollection
=
this
.
userCollectionService
.
findFirstByUserIdAndTypeAndName
(
tvUserId
,
userCollectionMq
.
getType
(),
userCollectionMq
.
getName
());
log
.
info
(
"收藏夹信息,大屏账号(uc_user_tv)id ==>> {} || 收藏夹name ==>> {} || 收藏夹type ==>> {}"
,
tvUserId
,
userCollectionMq
.
getName
(),
userCollectionMq
.
getType
());
if
(
Objects
.
isNull
(
userCollection
.
getId
()))
{
userCollection
.
setAppId
(
userCollectionMq
.
getAppId
())
...
...
@@ -879,7 +881,11 @@ public class UserOperationServiceImpl implements UserOperationService {
.
findByDetailIdAndDetailTypeAndUserCollectionId
(
userCollectionDetail
.
getDetailId
(),
userCollectionDetail
.
getDetailType
(),
userCollection
.
getId
());
log
.
info
(
"检查观影记录是否存在,内容id ==>> {} || 内容type ==>> {} || 收藏夹id ==>> {}"
,
userCollectionDetail
.
getDetailId
(),
userCollectionDetail
.
getDetailType
(),
userCollection
.
getId
());
if
(
CollectionUtils
.
isEmpty
(
userCollectionDetailOptional
))
{
log
.
info
(
"观影记录不存在,直接新增"
);
userCollectionDetail
.
setId
(
null
)
.
setUserCollectionId
(
userCollection
.
getId
());
...
...
@@ -890,11 +896,14 @@ public class UserOperationServiceImpl implements UserOperationService {
//观影记录同一天只存一条记录
boolean
sameDay
=
DateUtil
.
isSameDay
(
new
Date
(
userCollectionDetail
.
getCreateTime
().
getTime
()),
new
Date
());
if
(
sameDay
)
{
continue
;
}
else
{
userCollectionDetail
.
setId
(
null
)
log
.
info
(
"传过来的观影时间 ==>> {} 和今天的时间 ==>> {} 相同,修改观影记录,id ==>> {}"
,
userCollectionDetail
.
getCreateTime
().
getTime
(),
new
Date
(),
userCollectionDetailOptional
.
get
(
0
).
getId
());
userCollectionDetail
.
setId
(
userCollectionDetailOptional
.
get
(
0
).
getId
()
)
.
setUserCollectionId
(
userCollection
.
getId
());
userCollectionDetailRepository
.
save
(
userCollectionDetail
);
}
else
{
log
.
info
(
"传过来的观影时间 ==>> {} 和今天的时间 ==>> {} 不相同,不做处理"
,
userCollectionDetail
.
getCreateTime
().
getTime
(),
new
Date
().
toInstant
().
getEpochSecond
());
continue
;
}
...
...
member-service-impl/src/main/resources/config/application-dev.yml
View file @
c177b36
...
...
@@ -45,7 +45,7 @@ spring:
hibernate
:
# 生产环境设置成 none,避免程序运行时自动更新数据库结构
ddl-auto
:
none
show-sql
:
fals
e
show-sql
:
tru
e
servlet
:
multipart
:
file-size-threshold
:
2KB
...
...
Please
register
or
sign in
to post a comment