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
ff26d761
Commit
ff26d761
authored
Sep 22, 2023
by
muhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 收藏浏览量
parent
1d77f013
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1870 additions
and
9 deletions
+1870
-9
ch-dao/src/main/java/com/wwdz/ch/db/dao/UserCollectBrowseNumDao.java
...main/java/com/wwdz/ch/db/dao/UserCollectBrowseNumDao.java
+9
-0
ch-dao/src/main/java/com/wwdz/ch/db/domain/UserCollectBrowseNum.java
...main/java/com/wwdz/ch/db/domain/UserCollectBrowseNum.java
+273
-0
ch-dao/src/main/java/com/wwdz/ch/db/domain/UserCollectBrowseNumExample.java
...va/com/wwdz/ch/db/domain/UserCollectBrowseNumExample.java
+1095
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/UserCollectBrowseNumDaoImpl.java
...java/com/wwdz/ch/db/impl/UserCollectBrowseNumDaoImpl.java
+32
-0
ch-dao/src/main/java/com/wwdz/ch/db/mapper/UserCollectBrowseNumMapper.java
...ava/com/wwdz/ch/db/mapper/UserCollectBrowseNumMapper.java
+69
-0
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/UserCollectBrowseNumMapper.xml
...rces/com/wwdz/ch/db/mapper/UserCollectBrowseNumMapper.xml
+321
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
...c/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
+14
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemCommonServiceImpl.java
.../main/java/com/wwdz/ch/wx/impl/ItemCommonServiceImpl.java
+28
-7
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
+28
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
+1
-1
No files found.
ch-dao/src/main/java/com/wwdz/ch/db/dao/UserCollectBrowseNumDao.java
0 → 100644
View file @
ff26d761
package
com.wwdz.ch.db.dao
;
import
com.wwdz.ch.db.domain.UserCollectBrowseNum
;
public
interface
UserCollectBrowseNumDao
{
UserCollectBrowseNum
findByUserId
(
Long
userId
);
int
insert
(
UserCollectBrowseNum
record
);
int
update
(
UserCollectBrowseNum
record
);
}
ch-dao/src/main/java/com/wwdz/ch/db/domain/UserCollectBrowseNum.java
0 → 100644
View file @
ff26d761
package
com.wwdz.ch.db.domain
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
lombok.Data
;
/**
* @author shiyu
* @date 2023/09/22
*/
@Data
public
class
UserCollectBrowseNum
implements
Serializable
{
private
Integer
id
;
/**
* 用户id
*/
private
Long
userId
;
/**
* 被收藏数
*/
private
Integer
collectNum
;
/**
* 被浏览量
*/
private
Integer
browseNum
;
/**
* 创建时间
*/
private
Date
addTime
;
/**
* 更新时间
*/
private
Date
updateTime
;
private
static
final
long
serialVersionUID
=
1L
;
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
getClass
().
getSimpleName
());
sb
.
append
(
" ["
);
sb
.
append
(
"Hash = "
).
append
(
hashCode
());
sb
.
append
(
", id="
).
append
(
id
);
sb
.
append
(
", userId="
).
append
(
userId
);
sb
.
append
(
", collectNum="
).
append
(
collectNum
);
sb
.
append
(
", browseNum="
).
append
(
browseNum
);
sb
.
append
(
", addTime="
).
append
(
addTime
);
sb
.
append
(
", updateTime="
).
append
(
updateTime
);
sb
.
append
(
", serialVersionUID="
).
append
(
serialVersionUID
);
sb
.
append
(
"]"
);
return
sb
.
toString
();
}
@Override
public
boolean
equals
(
Object
that
)
{
if
(
this
==
that
)
{
return
true
;
}
if
(
that
==
null
)
{
return
false
;
}
if
(
getClass
()
!=
that
.
getClass
())
{
return
false
;
}
UserCollectBrowseNum
other
=
(
UserCollectBrowseNum
)
that
;
return
(
this
.
getId
()
==
null
?
other
.
getId
()
==
null
:
this
.
getId
().
equals
(
other
.
getId
()))
&&
(
this
.
getUserId
()
==
null
?
other
.
getUserId
()
==
null
:
this
.
getUserId
().
equals
(
other
.
getUserId
()))
&&
(
this
.
getCollectNum
()
==
null
?
other
.
getCollectNum
()
==
null
:
this
.
getCollectNum
().
equals
(
other
.
getCollectNum
()))
&&
(
this
.
getBrowseNum
()
==
null
?
other
.
getBrowseNum
()
==
null
:
this
.
getBrowseNum
().
equals
(
other
.
getBrowseNum
()))
&&
(
this
.
getAddTime
()
==
null
?
other
.
getAddTime
()
==
null
:
this
.
getAddTime
().
equals
(
other
.
getAddTime
()))
&&
(
this
.
getUpdateTime
()
==
null
?
other
.
getUpdateTime
()
==
null
:
this
.
getUpdateTime
().
equals
(
other
.
getUpdateTime
()));
}
@Override
public
int
hashCode
()
{
final
int
prime
=
31
;
int
result
=
1
;
result
=
prime
*
result
+
((
getId
()
==
null
)
?
0
:
getId
().
hashCode
());
result
=
prime
*
result
+
((
getUserId
()
==
null
)
?
0
:
getUserId
().
hashCode
());
result
=
prime
*
result
+
((
getCollectNum
()
==
null
)
?
0
:
getCollectNum
().
hashCode
());
result
=
prime
*
result
+
((
getBrowseNum
()
==
null
)
?
0
:
getBrowseNum
().
hashCode
());
result
=
prime
*
result
+
((
getAddTime
()
==
null
)
?
0
:
getAddTime
().
hashCode
());
result
=
prime
*
result
+
((
getUpdateTime
()
==
null
)
?
0
:
getUpdateTime
().
hashCode
());
return
result
;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
enum
Column
{
id
(
"id"
,
"id"
,
"INTEGER"
,
false
),
userId
(
"user_id"
,
"userId"
,
"BIGINT"
,
false
),
collectNum
(
"collect_num"
,
"collectNum"
,
"INTEGER"
,
false
),
browseNum
(
"browse_num"
,
"browseNum"
,
"INTEGER"
,
false
),
addTime
(
"add_time"
,
"addTime"
,
"TIMESTAMP"
,
false
),
updateTime
(
"update_time"
,
"updateTime"
,
"TIMESTAMP"
,
false
);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
static
final
String
BEGINNING_DELIMITER
=
"`"
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
static
final
String
ENDING_DELIMITER
=
"`"
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
final
String
column
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
final
boolean
isColumnNameDelimited
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
final
String
javaProperty
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
final
String
jdbcType
;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
value
()
{
return
this
.
column
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
getValue
()
{
return
this
.
column
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
getJavaProperty
()
{
return
this
.
javaProperty
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
getJdbcType
()
{
return
this
.
jdbcType
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Column
(
String
column
,
String
javaProperty
,
String
jdbcType
,
boolean
isColumnNameDelimited
)
{
this
.
column
=
column
;
this
.
javaProperty
=
javaProperty
;
this
.
jdbcType
=
jdbcType
;
this
.
isColumnNameDelimited
=
isColumnNameDelimited
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
desc
()
{
return
this
.
getEscapedColumnName
()
+
" DESC"
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
asc
()
{
return
this
.
getEscapedColumnName
()
+
" ASC"
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
static
Column
[]
excludes
(
Column
...
excludes
)
{
ArrayList
<
Column
>
columns
=
new
ArrayList
<>(
Arrays
.
asList
(
Column
.
values
()));
if
(
excludes
!=
null
&&
excludes
.
length
>
0
)
{
columns
.
removeAll
(
new
ArrayList
<>(
Arrays
.
asList
(
excludes
)));
}
return
columns
.
toArray
(
new
Column
[]{});
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
getEscapedColumnName
()
{
if
(
this
.
isColumnNameDelimited
)
{
return
new
StringBuilder
().
append
(
BEGINNING_DELIMITER
).
append
(
this
.
column
).
append
(
ENDING_DELIMITER
).
toString
();
}
else
{
return
this
.
column
;
}
}
}
}
\ No newline at end of file
ch-dao/src/main/java/com/wwdz/ch/db/domain/UserCollectBrowseNumExample.java
0 → 100644
View file @
ff26d761
This diff is collapsed.
Click to expand it.
ch-dao/src/main/java/com/wwdz/ch/db/impl/UserCollectBrowseNumDaoImpl.java
0 → 100644
View file @
ff26d761
package
com.wwdz.ch.db.impl
;
import
com.wwdz.ch.db.dao.UserCollectBrowseNumDao
;
import
com.wwdz.ch.db.domain.UserCollectBrowseNum
;
import
com.wwdz.ch.db.domain.UserCollectBrowseNumExample
;
import
com.wwdz.ch.db.mapper.UserCollectBrowseNumMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
@Repository
public
class
UserCollectBrowseNumDaoImpl
implements
UserCollectBrowseNumDao
{
@Autowired
private
UserCollectBrowseNumMapper
userCollectBrowseNumMapper
;
@Override
public
UserCollectBrowseNum
findByUserId
(
Long
userId
)
{
UserCollectBrowseNumExample
example
=
new
UserCollectBrowseNumExample
();
UserCollectBrowseNumExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andUserIdEqualTo
(
userId
);
return
userCollectBrowseNumMapper
.
selectOneByExample
(
example
);
}
@Override
public
int
insert
(
UserCollectBrowseNum
record
)
{
return
userCollectBrowseNumMapper
.
insert
(
record
);
}
@Override
public
int
update
(
UserCollectBrowseNum
record
)
{
return
userCollectBrowseNumMapper
.
updateByPrimaryKey
(
record
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/mapper/UserCollectBrowseNumMapper.java
0 → 100644
View file @
ff26d761
package
com.wwdz.ch.db.mapper
;
import
com.wwdz.ch.db.domain.UserCollectBrowseNum
;
import
com.wwdz.ch.db.domain.UserCollectBrowseNumExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
@Mapper
public
interface
UserCollectBrowseNumMapper
{
long
countByExample
(
UserCollectBrowseNumExample
example
);
int
deleteByExample
(
UserCollectBrowseNumExample
example
);
int
deleteByPrimaryKey
(
Integer
id
);
int
insert
(
UserCollectBrowseNum
record
);
int
insertSelective
(
UserCollectBrowseNum
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UserCollectBrowseNum
selectOneByExample
(
UserCollectBrowseNumExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UserCollectBrowseNum
selectOneByExampleSelective
(
@Param
(
"example"
)
UserCollectBrowseNumExample
example
,
@Param
(
"selective"
)
UserCollectBrowseNum
.
Column
...
selective
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List
<
UserCollectBrowseNum
>
selectByExampleSelective
(
@Param
(
"example"
)
UserCollectBrowseNumExample
example
,
@Param
(
"selective"
)
UserCollectBrowseNum
.
Column
...
selective
);
List
<
UserCollectBrowseNum
>
selectByExample
(
UserCollectBrowseNumExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_collect_browse_num
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UserCollectBrowseNum
selectByPrimaryKeySelective
(
@Param
(
"id"
)
Integer
id
,
@Param
(
"selective"
)
UserCollectBrowseNum
.
Column
...
selective
);
UserCollectBrowseNum
selectByPrimaryKey
(
Integer
id
);
int
updateByExampleSelective
(
@Param
(
"record"
)
UserCollectBrowseNum
record
,
@Param
(
"example"
)
UserCollectBrowseNumExample
example
);
int
updateByExample
(
@Param
(
"record"
)
UserCollectBrowseNum
record
,
@Param
(
"example"
)
UserCollectBrowseNumExample
example
);
int
updateByPrimaryKeySelective
(
UserCollectBrowseNum
record
);
int
updateByPrimaryKey
(
UserCollectBrowseNum
record
);
}
\ No newline at end of file
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/UserCollectBrowseNumMapper.xml
0 → 100644
View file @
ff26d761
This diff is collapsed.
Click to expand it.
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
View file @
ff26d761
...
...
@@ -44,6 +44,8 @@ public class FavoritesServiceImpl implements FavoritesService {
@Autowired
private
FootPrintDao
footPrintDao
;
@Autowired
private
UserCollectBrowseNumDao
userCollectBrowseNumDao
;
@Autowired
private
ItemCommonService
itemCommonService
;
@Autowired
private
UserTokenManager
userTokenManager
;
...
...
@@ -364,6 +366,18 @@ public class FavoritesServiceImpl implements FavoritesService {
// 更新收藏册id
favoritesItemsRelationDao
.
updateFavoritesId
(
favorites
.
getUserId
(),
dto
.
getFavoritesId
(),
dto
.
getItemIds
());
// 更新藏品发布者的收藏数
for
(
Long
itemId
:
dto
.
getItemIds
())
{
UserItemsRelation
userItemsRelation
=
userItemsRelationDao
.
find
(
itemId
);
if
(
Objects
.
nonNull
(
userItemsRelation
))
{
UserCollectBrowseNum
userCollectBrowseNum
=
userCollectBrowseNumDao
.
findByUserId
(
userItemsRelation
.
getUserId
());
if
(
Objects
.
nonNull
(
userCollectBrowseNum
))
{
userCollectBrowseNum
.
setCollectNum
(
userCollectBrowseNum
.
getCollectNum
()
+
1
);
userCollectBrowseNumDao
.
update
(
userCollectBrowseNum
);
}
}
}
// 更新收藏册操作时间
favoritesDao
.
updateTime
(
dto
.
getFavoritesId
(),
null
);
logger
.
info
(
"【请求结束】收藏藏品成功"
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemCommonServiceImpl.java
View file @
ff26d761
...
...
@@ -3,10 +3,7 @@ package com.wwdz.ch.wx.impl;
import
com.wwdz.ch.core.consts.ViewPermissionEnum
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dao.*
;
import
com.wwdz.ch.db.domain.Item
;
import
com.wwdz.ch.db.domain.ItemsOfficialUsersRelation
;
import
com.wwdz.ch.db.domain.User
;
import
com.wwdz.ch.db.domain.UserItemsRelation
;
import
com.wwdz.ch.db.domain.*
;
import
com.wwdz.ch.db.dto.request.CoinRequestDto
;
import
com.wwdz.ch.db.dto.request.FollowFansRecordRequestDto
;
import
com.wwdz.ch.wx.dao.UserInfo
;
...
...
@@ -19,6 +16,7 @@ import org.apache.commons.collections.CollectionUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
...
...
@@ -38,6 +36,8 @@ public class ItemCommonServiceImpl implements ItemCommonService {
private
UserDao
userDao
;
@Autowired
private
ItemDao
itemDao
;
@Autowired
private
UserCollectBrowseNumDao
userCollectBrowseNumDao
;
@Autowired
private
UserTokenManager
userTokenManager
;
...
...
@@ -85,21 +85,42 @@ public class ItemCommonServiceImpl implements ItemCommonService {
followersNumber
=
(
long
)
map
.
get
(
"followerNum"
);
fansNumber
=
(
long
)
map
.
get
(
"fansNum"
);
}
// 收藏和浏览量、所有人私密数量
UserCollectBrowseNum
userCollectBrowseNum
=
userCollectBrowseNumDao
.
findByUserId
(
userInfo
.
getUserId
());
// 所有人私密数量
List
<
UserItemsRelation
>
userItemsRelations
=
userItemsRelationDao
.
listByUserIds
(
userInfo
.
getUserId
(),
null
);
if
(
CollectionUtils
.
isNotEmpty
(
userItemsRelations
))
{
List
<
Long
>
itemIds
=
userItemsRelations
.
stream
()
.
map
(
UserItemsRelation:
:
getItemId
).
collect
(
Collectors
.
toList
());
collectionsNumber
=
favoritesItemsRelationDao
.
countByItemIds
(
itemIds
);
CoinRequestDto
coinRequestDto
=
new
CoinRequestDto
();
coinRequestDto
.
setIds
(
itemIds
);
List
<
Item
>
itemList
=
itemDao
.
findListNotDeleted
(
coinRequestDto
);
List
<
Item
>
allItemList
=
itemList
.
stream
().
filter
(
s
->
s
.
getViewPermission
().
equals
(
ViewPermissionEnum
.
ALL
.
getCode
())).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
allItemList
))
{
allNumber
=
allItemList
.
size
();
viewsNumber
=
footPrintDao
.
countByItemIds
(
userInfo
.
getUserId
(),
null
,
allItemList
.
stream
().
map
(
Item:
:
getId
).
collect
(
Collectors
.
toList
()));
// 初始浏览量
if
(
Objects
.
isNull
(
userCollectBrowseNum
))
{
viewsNumber
=
footPrintDao
.
countByItemIds
(
userInfo
.
getUserId
(),
null
,
allItemList
.
stream
().
map
(
Item:
:
getId
).
collect
(
Collectors
.
toList
()));
}
}
privacyNumber
=
itemList
.
stream
().
filter
(
s
->
s
.
getViewPermission
().
equals
(
ViewPermissionEnum
.
ONLY_ONESELF
.
getCode
())).
count
();
// 初始收藏量
if
(
Objects
.
isNull
(
userCollectBrowseNum
))
{
collectionsNumber
=
favoritesItemsRelationDao
.
countByItemIds
(
itemIds
);
}
}
// 收藏和浏览量
if
(
Objects
.
isNull
(
userCollectBrowseNum
))
{
UserCollectBrowseNum
record
=
new
UserCollectBrowseNum
();
record
.
setUserId
(
userInfo
.
getUserId
());
record
.
setCollectNum
(
Integer
.
parseInt
(
String
.
valueOf
(
collectionsNumber
)));
record
.
setBrowseNum
(
Integer
.
parseInt
(
String
.
valueOf
(
viewsNumber
)));
Date
date
=
new
Date
();
record
.
setAddTime
(
date
);
record
.
setUpdateTime
(
date
);
userCollectBrowseNumDao
.
insert
(
record
);
}
else
{
collectionsNumber
=
Long
.
parseLong
(
userCollectBrowseNum
.
getCollectNum
().
toString
());
viewsNumber
=
Long
.
parseLong
(
userCollectBrowseNum
.
getBrowseNum
().
toString
());
}
userInfo
.
setCollectionsNumber
(
collectionsNumber
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
View file @
ff26d761
...
...
@@ -75,6 +75,8 @@ public class ItemServiceImpl implements ItemService {
@Autowired
private
ItemsOfficialUsersRelationDao
itemsOfficialUsersRelationDao
;
@Autowired
private
UserCollectBrowseNumDao
userCollectBrowseNumDao
;
@Autowired
private
ItemEsDao
itemEsDao
;
@Autowired
...
...
@@ -343,6 +345,10 @@ public class ItemServiceImpl implements ItemService {
result
.
setList
(
new
ArrayList
<>());
result
.
setHasNextPage
(
false
);
// 获取仅自己可见的藏品列表
Long
userId
=
userTokenManager
.
getUserId
(
request
.
getHeader
(
"Authorization"
));
// 是否客态
boolean
isGuest
=
!
dto
.
getUserId
().
equals
(
userId
);
// 获取仅自己可见的藏品列表
List
<
Long
>
onlyOneselfItemIds
=
itemCommonService
.
getOnlyOneselfItemIds
(
request
.
getHeader
(
"Authorization"
));
// 分页查询
...
...
@@ -376,7 +382,10 @@ public class ItemServiceImpl implements ItemService {
itemResponseVo
.
setPrice
(
getPrice
(
item
.
getPrice
()));
// 设置是否收藏或是否是自己发布的
itemResponseVo
.
setIsCollected
(
1
);
itemResponseVo
.
setIsMine
(
userItemsRelationDao
.
isExisted
(
dto
.
getUserId
(),
item
.
getId
())
?
1
:
0
);
itemResponseVo
.
setIsMine
(
0
);
if
(!
isGuest
)
{
itemResponseVo
.
setIsMine
(
userItemsRelationDao
.
isExisted
(
dto
.
getUserId
(),
item
.
getId
())
?
1
:
0
);
}
// 设置收藏数
long
count
=
favoritesItemsRelationDao
.
countByItemId
(
item
.
getId
());
itemResponseVo
.
setCollectCount
(
StringUtil
.
formatCount
(
count
));
...
...
@@ -574,6 +583,15 @@ public class ItemServiceImpl implements ItemService {
newVo
.
setAddTime
(
now
);
newVo
.
setUpdateTime
(
now
);
footPrintDao
.
insert
(
newVo
);
// 更新藏品发布者的浏览量
if
(
Objects
.
nonNull
(
userItemsRelation
))
{
UserCollectBrowseNum
userCollectBrowseNum
=
userCollectBrowseNumDao
.
findByUserId
(
userItemsRelation
.
getUserId
());
if
(
Objects
.
nonNull
(
userCollectBrowseNum
))
{
userCollectBrowseNum
.
setBrowseNum
(
userCollectBrowseNum
.
getBrowseNum
()
+
1
);
userCollectBrowseNumDao
.
update
(
userCollectBrowseNum
);
}
}
}
else
{
footprint
.
setUpdateTime
(
now
);
footPrintDao
.
upateTime
(
footprint
);
...
...
@@ -653,6 +671,15 @@ public class ItemServiceImpl implements ItemService {
long
count
=
favoritesItemsRelationDao
.
countByItemId
(
item
.
getId
());
String
collectCount
=
StringUtil
.
formatCount
(
count
);
// 更新藏品发布者的收藏数
if
(
Objects
.
nonNull
(
userItemsRelation
))
{
UserCollectBrowseNum
userCollectBrowseNum
=
userCollectBrowseNumDao
.
findByUserId
(
userItemsRelation
.
getUserId
());
if
(
Objects
.
nonNull
(
userCollectBrowseNum
))
{
userCollectBrowseNum
.
setCollectNum
(
userCollectBrowseNum
.
getCollectNum
()
+
1
);
userCollectBrowseNumDao
.
update
(
userCollectBrowseNum
);
}
}
// 发送收藏消息
sendMessage
(
item
.
getId
(),
dto
.
getUserId
(),
MessageEnum
.
TypeEnum
.
COLLECT
.
getCode
(),
MessageEnum
.
ContentIdTypeEnum
.
ITEM
.
getCode
());
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
View file @
ff26d761
...
...
@@ -410,7 +410,7 @@ public class UserServiceImpl implements UserService {
userInfo
.
setFollowedId
((
Integer
)
map
.
get
(
"id"
));
}
}
itemCommonService
.
getPageViews
(
userInfo
);
logger
.
info
(
"【请求结束】查询用户信息(客态)成功"
);
return
Result
.
success
(
userInfo
);
}
catch
(
Exception
e
)
{
...
...
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