记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
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
董敬伟
liquidnet-bus-v1
Commits
9961ef97
Commit
9961ef97
authored
Jan 17, 2022
by
zhengfuxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
音乐人标签
parent
15085883
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
4 deletions
+68
-4
GoblinFrontController.java
...dnet/service/goblin/controller/GoblinFrontController.java
+6
-0
GoblinFrontServiceImpl.java
...t/service/goblin/service/impl/GoblinFrontServiceImpl.java
+62
-4
No files found.
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/controller/GoblinFrontController.java
View file @
9961ef97
...
...
@@ -87,6 +87,12 @@ public class GoblinFrontController {
return
ResponseDto
.
success
(
goblinFrontService
.
getCategoryList
(
type
,
categoryId
,
page
,
pageSize
));
}
@GetMapping
(
"getMusicList"
)
@ApiOperation
(
"获取音乐标签列表( 1、销量优先、2、新品优先、3、价格降序、4、价格升序)"
)
public
ResponseDto
<
GoblinFrontCategoryListVo
>
getMusicList
(
@RequestParam
(
name
=
"type"
,
required
=
true
)
String
type
,
@RequestParam
(
name
=
"musicId"
,
required
=
true
)
String
musicId
,
@RequestParam
(
name
=
"page"
,
required
=
true
)
int
page
,
@RequestParam
(
name
=
"pageSize"
,
required
=
true
)
int
pageSize
)
throws
ParseException
{
return
ResponseDto
.
success
(
goblinFrontService
.
getMusic
(
musicId
,
type
,
page
,
pageSize
));
}
@GetMapping
(
"getCategory"
)
@ApiOperation
(
"获取分类子集"
)
public
ResponseDto
getCategory
(
@RequestParam
(
name
=
"categoryId"
,
required
=
true
)
String
categoryId
)
throws
ParseException
{
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinFrontServiceImpl.java
View file @
9961ef97
...
...
@@ -316,6 +316,57 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
}
/**
*音乐人列表
*/
public
GoblinFrontCategoryListVo
getMusic
(
String
tagId
,
String
type
,
int
page
,
int
pageSize
){
//
Query
query
=
new
Query
();
query
.
addCriteria
(
new
Criteria
().
orOperator
(
Criteria
.
where
(
"extagVoList.tagId"
).
is
(
tagId
)
));
Pageable
pageable
=
null
;
//
boolean
isRe
=
false
;
if
(
type
.
equals
(
"1"
)){
isRe
=
true
;
}
else
if
(
type
.
equals
(
"2"
)){
pageable
=
PageRequest
.
of
(
page
,
pageSize
,
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"shelvesAt"
));
}
else
if
(
type
.
equals
(
"3"
)){
pageable
=
PageRequest
.
of
(
page
,
pageSize
,
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"priceGe"
));
}
else
if
(
type
.
equals
(
"4"
)){
pageable
=
PageRequest
.
of
(
page
,
pageSize
,
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"priceGe"
));
}
// 排序 分页
// Query query = Query.query(Criteria.where("status").ne(1).and("status").ne(0));
// 查询总数
long
count
=
mongoTemplate
.
count
(
query
,
GoblinGoodsInfoVo
.
class
,
GoblinGoodsInfoVo
.
class
.
getSimpleName
());
if
(!
isRe
){
query
.
with
(
pageable
);
}
List
<
GoblinGoodsInfoVo
>
list
=
mongoTemplate
.
find
(
query
,
GoblinGoodsInfoVo
.
class
,
GoblinGoodsInfoVo
.
class
.
getSimpleName
());
if
(
list
.
size
()>
0
&&
isRe
){
//找到 销量
for
(
GoblinGoodsInfoVo
goblinGoodsInfoVo:
list
){
Integer
counts
=
goblinRedisUtils
.
getSpuSaleCount
(
goblinGoodsInfoVo
.
getSpuId
());
if
(
counts
==
null
){
goblinGoodsInfoVo
.
setCount
(
0
);
}
else
{
goblinGoodsInfoVo
.
setCount
(
counts
);
}
}
Collections
.
sort
(
list
,
new
Comparator
<
GoblinGoodsInfoVo
>()
{
public
int
compare
(
GoblinGoodsInfoVo
arg0
,
GoblinGoodsInfoVo
arg1
)
{
return
-(
arg0
.
getCount
().
compareTo
(
arg1
.
getCount
()));
}});
}
GoblinFrontCategoryListVo
goblinFrontCategoryListVo
=
GoblinFrontCategoryListVo
.
getNew
();
goblinFrontCategoryListVo
.
setCount
(
count
);
goblinFrontCategoryListVo
.
setSpuList
(
list
);
return
goblinFrontCategoryListVo
;
}
/**
* 获取分类列表
* 1、销量优先、2、新品优先、3、价格降序、4、价格升序
...
...
@@ -451,6 +502,9 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
* @date 2022/1/11 下午4:16
*/
public
boolean
addShoopCart
(
String
spuId
,
String
storeId
,
String
skuId
,
Integer
number
,
String
userId
){
if
(
null
==
number
||
number
<=
0
){
return
false
;
}
boolean
isGoods
=
false
;
String
cardId
=
""
;
//判断该用户 redis里是否有购物车
...
...
@@ -465,7 +519,7 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
//该商铺下的所有商品
ArrayList
<
GoblinShoppingCartVoDetail
>
list1
=
ObjectUtil
.
goblinShoppingCartVoDetailArrayList
();
//创建 购物车vo
GoblinShoppingCartVoDetail
goblinShoppingCartVoDetail
=
this
.
setValue
(
userId
,
storeId
,
spuId
,
skuId
,
1
);
GoblinShoppingCartVoDetail
goblinShoppingCartVoDetail
=
this
.
setValue
(
userId
,
storeId
,
spuId
,
skuId
,
number
);
list1
.
add
(
goblinShoppingCartVoDetail
);
goblinShoppingCartVo
.
setSkuList
(
list1
);
list
.
add
(
goblinShoppingCartVo
);
...
...
@@ -486,7 +540,7 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
for
(
GoblinShoppingCartVoDetail
goblinShoppingCartVoDetail:
list1
){
if
(
skuId
.
equals
(
goblinShoppingCartVoDetail
.
getSkuId
())){
isGoods
=
true
;
goblinShoppingCartVoDetail
.
setNumber
((
goblinShoppingCartVoDetail
.
getNumber
()+
1
));
goblinShoppingCartVoDetail
.
setNumber
((
goblinShoppingCartVoDetail
.
getNumber
()+
number
));
cardId
=
goblinShoppingCartVoDetail
.
getCarId
();
}
}
...
...
@@ -495,7 +549,7 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
//不需要做
}
else
{
//创建商品放入到list
GoblinShoppingCartVoDetail
goblinShoppingCartVoDetail
=
this
.
setValue
(
userId
,
storeId
,
spuId
,
skuId
,
1
);
GoblinShoppingCartVoDetail
goblinShoppingCartVoDetail
=
this
.
setValue
(
userId
,
storeId
,
spuId
,
skuId
,
number
);
cardId
=
goblinShoppingCartVoDetail
.
getCarId
();
list1
.
add
(
goblinShoppingCartVoDetail
);
}
...
...
@@ -517,7 +571,7 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
if
(
isGoods
){
updateShopCartMysql
(
cardId
,
number
,
userId
);
}
else
{
insertShopCartMysql
(
cardId
,
spuId
,
storeId
,
skuId
,
1
,
userId
);
insertShopCartMysql
(
cardId
,
spuId
,
storeId
,
skuId
,
number
,
userId
);
}
}
return
true
;
...
...
@@ -528,6 +582,9 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
* @date 2022/1/11 下午6:24
*/
public
boolean
updateShopCart
(
String
spuId
,
String
storeId
,
String
skuId
,
Integer
number
,
String
userId
){
if
(
null
==
number
||
number
<=
0
){
return
false
;
}
GoblinShoppingCartVoo
goblinShoppingCartVoo
=
(
GoblinShoppingCartVoo
)
redisUtil
.
get
(
GoblinRedisConst
.
FRONT_SHOPCART
.
concat
(
userId
));
String
cardId
=
""
;
if
(
null
!=
goblinShoppingCartVoo
){
...
...
@@ -553,6 +610,7 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
}
public
int
getShopCartCount
(
String
userId
){
log
.
info
(
"获取商品数量{}"
,
userId
);
int
count
=
0
;
GoblinShoppingCartVoo
goblinShoppingCartVoo
=
(
GoblinShoppingCartVoo
)
redisUtil
.
get
(
GoblinRedisConst
.
FRONT_SHOPCART
.
concat
(
userId
));
if
(
null
!=
goblinShoppingCartVoo
){
...
...
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