Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
dafbbb50
Commit
dafbbb50
authored
Sep 21, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/quanku_0930' into quanku_0930
parents
4148de28
a5603a11
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
10 deletions
+18
-10
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/FavoritesResponseVo.java
...in/java/com/wwdz/ch/wx/entity/vo/FavoritesResponseVo.java
+1
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
...c/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
+13
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
+4
-9
No files found.
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/FavoritesResponseVo.java
View file @
dafbbb50
...
...
@@ -17,4 +17,5 @@ public class FavoritesResponseVo implements Entity {
private
Boolean
deleted
;
private
List
<
String
>
images
;
private
long
count
;
private
Boolean
isGuest
;
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
View file @
dafbbb50
...
...
@@ -13,6 +13,7 @@ import com.wwdz.ch.wx.entity.request.ItemRequestDto;
import
com.wwdz.ch.wx.entity.vo.AgentTranceResponseVo
;
import
com.wwdz.ch.wx.entity.vo.FavoritesResponseVo
;
import
com.wwdz.ch.wx.entity.vo.ItemResponseVo
;
import
com.wwdz.ch.wx.manager.UserTokenManager
;
import
com.wwdz.ch.wx.service.FavoritesService
;
import
com.wwdz.ch.wx.service.ItemCommonService
;
import
com.wwdz.ch.wx.util.StringUtil
;
...
...
@@ -44,6 +45,8 @@ public class FavoritesServiceImpl implements FavoritesService {
private
FootPrintDao
footPrintDao
;
@Autowired
private
ItemCommonService
itemCommonService
;
@Autowired
private
UserTokenManager
userTokenManager
;
@Override
public
Result
page
(
FavoritesRequestDto
dto
,
HttpServletRequest
request
)
{
...
...
@@ -189,6 +192,10 @@ public class FavoritesServiceImpl implements FavoritesService {
vo
.
setCount
(
favoritesItemsRelationDao
.
countByFavoritesId
(
favorites
.
getId
()));
// 设置封面图
vo
.
setImages
(
getFavoritesImage
(
favorites
.
getId
(),
request
.
getHeader
(
"Authorization"
)));
// 是否客态
Long
userId
=
userTokenManager
.
getUserId
(
request
.
getHeader
(
"Authorization"
));
boolean
isGuest
=
!
favorites
.
getUserId
().
equals
(
userId
);
vo
.
setIsGuest
(
isGuest
);
logger
.
info
(
"【请求结束】查看收藏册详情成功"
);
return
Result
.
success
(
vo
);
}
catch
(
Exception
e
)
{
...
...
@@ -223,6 +230,9 @@ public class FavoritesServiceImpl implements FavoritesService {
page
.
setList
(
new
ArrayList
<>());
// 获取仅自己可见的藏品列表
Long
userId
=
userTokenManager
.
getUserId
(
request
.
getHeader
(
"Authorization"
));
// 是否客态
boolean
isGuest
=
!
dto
.
getUserId
().
equals
(
userId
);
List
<
Long
>
onlyOneselfItemIds
=
itemCommonService
.
getOnlyOneselfItemIds
(
request
.
getHeader
(
"Authorization"
));
// 分页查询
PageInfo
<
FavoritesItemsRelation
>
relationPage
=
favoritesItemsRelationDao
.
pageByFavoritesId
(
dto
.
getId
(),
onlyOneselfItemIds
,
dto
.
getPage
(),
dto
.
getSize
());
...
...
@@ -252,8 +262,10 @@ public class FavoritesServiceImpl implements FavoritesService {
vo
.
setIsMine
(
0
);
if
(
Objects
.
nonNull
(
dto
.
getUserId
())
&&
dto
.
getUserId
()
!=
0L
)
{
vo
.
setIsCollected
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
relation
.
getItemId
(),
null
)
?
1
:
0
);
if
(!
isGuest
)
{
vo
.
setIsMine
(
userItemsRelationDao
.
isExisted
(
dto
.
getUserId
(),
item
.
getId
())
?
1
:
0
);
}
}
// 设置收藏数
long
count
=
favoritesItemsRelationDao
.
countByItemId
(
item
.
getId
());
vo
.
setCollectCount
(
StringUtil
.
formatCount
(
count
));
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
View file @
dafbbb50
...
...
@@ -213,7 +213,8 @@ public class ItemServiceImpl implements ItemService {
nickname
=
user
.
getNickname
();
avatar
=
user
.
getAvatar
();
}
boolean
isGuest
=
dto
.
getUserId
().
equals
(
userId
);
// 是否客态
boolean
isGuest
=
!
dto
.
getUserId
().
equals
(
userId
);
if
(!
officialUserIds
.
contains
(
dto
.
getUserId
()))
{
// 查询用户和藏品关联表
List
<
UserItemsRelation
>
userItemsRelations
=
userItemsRelationDao
.
listByUserIds
(
dto
.
getUserId
(),
null
);
...
...
@@ -250,10 +251,7 @@ public class ItemServiceImpl implements ItemService {
vo
.
setHomePageImage
(
MediaUtil
.
getHomePageImage
(
item
.
getImages
(),
item
.
getVideos
()));
// 设置是否收藏和是否是自己发布的
vo
.
setIsCollected
(
0
);
vo
.
setIsMine
(
1
);
if
(
isGuest
)
{
vo
.
setIsMine
(
0
);
}
vo
.
setIsMine
(
isGuest
?
0
:
1
);
vo
.
setIsCollected
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
item
.
getId
(),
null
)
?
1
:
0
);
// 设置收藏数
long
count
=
favoritesItemsRelationDao
.
countByItemId
(
item
.
getId
());
...
...
@@ -301,10 +299,7 @@ public class ItemServiceImpl implements ItemService {
// 设置图片或视频
vo
.
setHomePageImage
(
MediaUtil
.
getHomePageImage
(
es
.
getImages
(),
es
.
getVideos
()));
// 设置是否收藏和是否是自己发布的
vo
.
setIsMine
(
1
);
if
(
isGuest
)
{
vo
.
setIsMine
(
0
);
}
vo
.
setIsMine
(
isGuest
?
0
:
1
);
vo
.
setIsCollected
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
es
.
getId
(),
null
)
?
1
:
0
);
// 设置收藏数
long
count
=
favoritesItemsRelationDao
.
countByItemId
(
es
.
getId
());
...
...
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