记得上下班打卡 | 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
db8a1120
Commit
db8a1120
authored
Jan 19, 2022
by
zhengfuxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改购物车
parent
7c6b08a0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
GoblinFrontLoginController.java
...service/goblin/controller/GoblinFrontLoginController.java
+4
-4
GoblinFrontServiceImpl.java
...t/service/goblin/service/impl/GoblinFrontServiceImpl.java
+8
-8
No files found.
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/controller/GoblinFrontLoginController.java
View file @
db8a1120
...
@@ -43,9 +43,9 @@ public class GoblinFrontLoginController {
...
@@ -43,9 +43,9 @@ public class GoblinFrontLoginController {
@GetMapping
(
"getShopCartCount"
)
@GetMapping
(
"getShopCartCount"
)
@ApiOperation
(
"获取购物车数量"
)
@ApiOperation
(
"获取购物车数量"
)
public
ResponseDto
getShopCartCount
()
{
public
ResponseDto
getShopCartCount
(
@RequestParam
(
name
=
"type"
,
required
=
false
)
Integer
type
)
{
String
userId
=
CurrentUtil
.
getCurrentUid
();
String
userId
=
CurrentUtil
.
getCurrentUid
();
return
ResponseDto
.
success
(
goblinFrontService
.
getShopCartCount
(
userId
));
return
ResponseDto
.
success
(
goblinFrontService
.
getShopCartCount
(
userId
,
type
));
}
}
@PostMapping
(
"deleteShopCart"
)
@PostMapping
(
"deleteShopCart"
)
@ApiOperation
(
"删除购物车"
)
@ApiOperation
(
"删除购物车"
)
...
@@ -69,9 +69,9 @@ public class GoblinFrontLoginController {
...
@@ -69,9 +69,9 @@ public class GoblinFrontLoginController {
@GetMapping
(
"getShopCart"
)
@GetMapping
(
"getShopCart"
)
@ApiOperation
(
"获得购物车列表"
)
@ApiOperation
(
"获得购物车列表"
)
public
ResponseDto
<
GoblinShoppingCartVoo
>
getShopCart
()
{
public
ResponseDto
<
GoblinShoppingCartVoo
>
getShopCart
(
@RequestParam
(
name
=
"type"
,
required
=
false
)
Integer
type
)
{
String
userId
=
CurrentUtil
.
getCurrentUid
();
String
userId
=
CurrentUtil
.
getCurrentUid
();
return
ResponseDto
.
success
(
goblinFrontService
.
getShoppCart
(
userId
));
return
ResponseDto
.
success
(
goblinFrontService
.
getShoppCart
(
userId
,
type
));
}
}
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinFrontServiceImpl.java
View file @
db8a1120
...
@@ -714,10 +714,10 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
...
@@ -714,10 +714,10 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
return
true
;
return
true
;
}
}
public
int
getShopCartCount
(
String
userId
){
public
int
getShopCartCount
(
String
userId
,
Integer
type
){
log
.
info
(
"获取商品数量{}"
,
userId
);
log
.
info
(
"获取商品数量{}"
,
userId
);
int
count
=
0
;
int
count
=
0
;
GoblinShoppingCartVoo
goblinShoppingCartVoo
=
(
GoblinShoppingCartVoo
)
redisUtil
.
get
(
GoblinRedisConst
.
FRONT_SHOPCART
.
concat
(
userId
));
GoblinShoppingCartVoo
goblinShoppingCartVoo
=
(
GoblinShoppingCartVoo
)
redisUtil
.
get
(
GoblinRedisConst
.
FRONT_SHOPCART
.
concat
(
userId
)
.
concat
(
type
.
toString
())
);
if
(
null
!=
goblinShoppingCartVoo
){
if
(
null
!=
goblinShoppingCartVoo
){
List
<
GoblinShoppingCartVo
>
shopList
=
goblinShoppingCartVoo
.
getShopList
();
List
<
GoblinShoppingCartVo
>
shopList
=
goblinShoppingCartVoo
.
getShopList
();
for
(
GoblinShoppingCartVo
goblinShoppingCartVo:
shopList
){
for
(
GoblinShoppingCartVo
goblinShoppingCartVo:
shopList
){
...
@@ -772,7 +772,7 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
...
@@ -772,7 +772,7 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
}
}
}
}
if
(
shopList
.
size
()==
0
){
if
(
shopList
.
size
()==
0
){
deleteRedisMongodbMysqlShop
(
goblinShoppingCartVoo
,
userId
,
skuIds
);
deleteRedisMongodbMysqlShop
(
goblinShoppingCartVoo
,
userId
,
skuIds
,
type
);
deleteMysql
(
userId
,
skuIds
);
deleteMysql
(
userId
,
skuIds
);
}
else
{
}
else
{
saveRedisMongodbMysqlShop
(
goblinShoppingCartVoo
,
userId
,
type
);
saveRedisMongodbMysqlShop
(
goblinShoppingCartVoo
,
userId
,
type
);
...
@@ -794,9 +794,9 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
...
@@ -794,9 +794,9 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
* @Description: 获得购物车列表
* @Description: 获得购物车列表
* @date 2022/1/12 下午2:36
* @date 2022/1/12 下午2:36
*/
*/
public
GoblinShoppingCartVoo
getShoppCart
(
String
userId
){
public
GoblinShoppingCartVoo
getShoppCart
(
String
userId
,
Integer
type
){
//判断该用户 redis里是否有购物车
//判断该用户 redis里是否有购物车
GoblinShoppingCartVoo
goblinShoppingCartVoo
=
(
GoblinShoppingCartVoo
)
redisUtil
.
get
(
GoblinRedisConst
.
FRONT_SHOPCART
.
concat
(
userId
));
GoblinShoppingCartVoo
goblinShoppingCartVoo
=
(
GoblinShoppingCartVoo
)
redisUtil
.
get
(
GoblinRedisConst
.
FRONT_SHOPCART
.
concat
(
userId
)
.
concat
(
type
.
toString
())
);
if
(
null
==
goblinShoppingCartVoo
){
if
(
null
==
goblinShoppingCartVoo
){
return
null
;
return
null
;
}
}
...
@@ -811,7 +811,7 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
...
@@ -811,7 +811,7 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
goblinShoppingCartVoDetail
.
setGoblinGoodsSkuInfoVo
(
goblinGoodsSkuInfoVo
);
goblinShoppingCartVoDetail
.
setGoblinGoodsSkuInfoVo
(
goblinGoodsSkuInfoVo
);
}
}
}
}
goblinShoppingCartVoo
.
setShoopingCount
(
this
.
getShopCartCount
(
userId
));
goblinShoppingCartVoo
.
setShoopingCount
(
this
.
getShopCartCount
(
userId
,
type
));
return
goblinShoppingCartVoo
;
return
goblinShoppingCartVoo
;
}
}
public
GoblinShoppingCartVoDetail
setValue
(
String
userId
,
String
storeId
,
String
spuId
,
String
skuId
,
Integer
number
){
public
GoblinShoppingCartVoDetail
setValue
(
String
userId
,
String
storeId
,
String
spuId
,
String
skuId
,
Integer
number
){
...
@@ -846,9 +846,9 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
...
@@ -846,9 +846,9 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
//mysql 消息队列
//mysql 消息队列
}
}
//删除redis 删除mongodb
//删除redis 删除mongodb
public
void
deleteRedisMongodbMysqlShop
(
GoblinShoppingCartVoo
goblinShoppingCartVoo
,
String
userId
,
String
[]
skuIds
){
public
void
deleteRedisMongodbMysqlShop
(
GoblinShoppingCartVoo
goblinShoppingCartVoo
,
String
userId
,
String
[]
skuIds
,
Integer
type
){
//redis存储
//redis存储
redisUtil
.
del
(
GoblinRedisConst
.
FRONT_SHOPCART
.
concat
(
userId
));
redisUtil
.
del
(
GoblinRedisConst
.
FRONT_SHOPCART
.
concat
(
userId
)
.
concat
(
type
.
toString
())
);
//mongodb 删除
//mongodb 删除
mongoTemplate
.
remove
(
Query
.
query
(
Criteria
.
where
(
"goblinShoppingCartId"
).
is
(
goblinShoppingCartVoo
.
getGoblinShoppingCartId
())),
GoblinShoppingCartVoo
.
class
,
GoblinShoppingCartVoo
.
class
.
getSimpleName
());
mongoTemplate
.
remove
(
Query
.
query
(
Criteria
.
where
(
"goblinShoppingCartId"
).
is
(
goblinShoppingCartVoo
.
getGoblinShoppingCartId
())),
GoblinShoppingCartVoo
.
class
,
GoblinShoppingCartVoo
.
class
.
getSimpleName
());
//mysql 删除 按照 userid 、skuid
//mysql 删除 按照 userid 、skuid
...
...
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