记得上下班打卡 | 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
c8db1641
Commit
c8db1641
authored
Mar 05, 2022
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 添加购物车接口
parent
28e4abab
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
32 deletions
+62
-32
GoblinFrontLoginController.java
...service/goblin/controller/GoblinFrontLoginController.java
+62
-32
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 @
c8db1641
...
@@ -4,6 +4,7 @@ import com.liquidnet.common.cache.redis.util.RedisUtil;
...
@@ -4,6 +4,7 @@ import com.liquidnet.common.cache.redis.util.RedisUtil;
import
com.liquidnet.commons.lang.util.CurrentUtil
;
import
com.liquidnet.commons.lang.util.CurrentUtil
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.goblin.constant.GoblinRedisConst
;
import
com.liquidnet.service.goblin.constant.GoblinRedisConst
;
import
com.liquidnet.service.goblin.constant.GoblinStatusConst
;
import
com.liquidnet.service.goblin.dto.vo.GoblinShoppingCartVoo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinShoppingCartVoo
;
import
com.liquidnet.service.goblin.service.impl.GoblinFrontServiceImpl
;
import
com.liquidnet.service.goblin.service.impl.GoblinFrontServiceImpl
;
import
com.liquidnet.service.goblin.util.GoblinRedisUtils
;
import
com.liquidnet.service.goblin.util.GoblinRedisUtils
;
...
@@ -30,65 +31,94 @@ public class GoblinFrontLoginController {
...
@@ -30,65 +31,94 @@ public class GoblinFrontLoginController {
@GetMapping
(
"addShopCart"
)
@GetMapping
(
"addShopCart"
)
@ApiOperation
(
"加入购物车"
)
@ApiOperation
(
"加入购物车"
)
public
ResponseDto
addShopCart
(
@RequestParam
(
name
=
"spuId"
,
required
=
true
)
String
spuId
,
@RequestParam
(
name
=
"storeId"
,
required
=
true
)
String
storeId
,
@RequestParam
(
name
=
"skuId"
,
required
=
true
)
String
skuId
,
@RequestParam
(
name
=
"number"
,
required
=
false
)
Integer
number
,
@RequestParam
(
name
=
"type"
,
required
=
true
)
String
type
)
{
public
ResponseDto
addShopCart
(
@RequestParam
(
name
=
"spuId"
,
required
=
true
)
String
spuId
,
@RequestParam
(
name
=
"storeId"
,
required
=
true
)
String
storeId
,
@RequestParam
(
name
=
"skuId"
,
required
=
true
)
String
skuId
,
@RequestParam
(
name
=
"number"
,
required
=
false
)
Integer
number
,
@RequestParam
(
name
=
"type"
,
required
=
true
)
String
type
)
{
String
userId
=
CurrentUtil
.
getCurrentUid
();
String
userId
=
CurrentUtil
.
getCurrentUid
();
return
goblinFrontService
.
addShoopCart
(
spuId
,
storeId
,
skuId
,
number
,
userId
,
type
);
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
type
);
if
(
pre
!=
null
)
{
type
=
type
.
split
(
pre
)[
0
];
}
}
return
goblinFrontService
.
addShoopCart
(
spuId
,
storeId
,
skuId
,
number
,
userId
,
type
);
}
@GetMapping
(
"updateShopCart"
)
@GetMapping
(
"updateShopCart"
)
@ApiOperation
(
"修改购物车"
)
@ApiOperation
(
"修改购物车"
)
public
ResponseDto
updateShopCart
(
@RequestParam
(
name
=
"spuId"
,
required
=
true
)
String
spuId
,
@RequestParam
(
name
=
"storeId"
,
required
=
true
)
String
storeId
,
@RequestParam
(
name
=
"skuId"
,
required
=
true
)
String
skuId
,
@RequestParam
(
name
=
"number"
,
required
=
false
)
Integer
number
,
@RequestParam
(
name
=
"type"
,
required
=
true
)
String
type
)
{
public
ResponseDto
updateShopCart
(
@RequestParam
(
name
=
"spuId"
,
required
=
true
)
String
spuId
,
@RequestParam
(
name
=
"storeId"
,
required
=
true
)
String
storeId
,
@RequestParam
(
name
=
"skuId"
,
required
=
true
)
String
skuId
,
@RequestParam
(
name
=
"number"
,
required
=
false
)
Integer
number
,
@RequestParam
(
name
=
"type"
,
required
=
true
)
String
type
)
{
String
userId
=
CurrentUtil
.
getCurrentUid
();
String
userId
=
CurrentUtil
.
getCurrentUid
();
return
ResponseDto
.
success
(
goblinFrontService
.
updateShopCart
(
spuId
,
storeId
,
skuId
,
number
,
userId
,
type
));
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
type
);
if
(
pre
!=
null
)
{
type
=
type
.
split
(
pre
)[
0
];
}
return
ResponseDto
.
success
(
goblinFrontService
.
updateShopCart
(
spuId
,
storeId
,
skuId
,
number
,
userId
,
type
));
}
}
@GetMapping
(
"getShopCartCount"
)
@GetMapping
(
"getShopCartCount"
)
@ApiOperation
(
"获取购物车数量"
)
@ApiOperation
(
"获取购物车数量"
)
public
ResponseDto
getShopCartCount
(
@RequestParam
(
name
=
"type"
,
required
=
true
)
String
type
)
{
public
ResponseDto
getShopCartCount
(
@RequestParam
(
name
=
"type"
,
required
=
true
)
String
type
)
{
String
userId
=
CurrentUtil
.
getCurrentUid
();
String
userId
=
CurrentUtil
.
getCurrentUid
();
return
ResponseDto
.
success
(
goblinFrontService
.
getShopCartCount
(
userId
,
type
));
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
type
);
if
(
pre
!=
null
)
{
type
=
type
.
split
(
pre
)[
0
];
}
}
return
ResponseDto
.
success
(
goblinFrontService
.
getShopCartCount
(
userId
,
type
));
}
@PostMapping
(
"deleteShopCart"
)
@PostMapping
(
"deleteShopCart"
)
@ApiOperation
(
"删除购物车"
)
@ApiOperation
(
"删除购物车"
)
public
ResponseDto
deleteShopCart
(
@RequestParam
(
name
=
"skuIds"
,
required
=
false
)
String
skuIds
,
@RequestParam
(
name
=
"type"
,
required
=
true
)
String
type
)
{
public
ResponseDto
deleteShopCart
(
@RequestParam
(
name
=
"skuIds"
,
required
=
false
)
String
skuIds
,
@RequestParam
(
name
=
"type"
,
required
=
true
)
String
type
)
{
String
userId
=
CurrentUtil
.
getCurrentUid
();
String
userId
=
CurrentUtil
.
getCurrentUid
();
return
ResponseDto
.
success
(
goblinFrontService
.
delteShoppingCart
(
skuIds
.
split
(
","
),
userId
,
type
));
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
type
);
if
(
pre
!=
null
)
{
type
=
type
.
split
(
pre
)[
0
];
}
return
ResponseDto
.
success
(
goblinFrontService
.
delteShoppingCart
(
skuIds
.
split
(
","
),
userId
,
type
));
}
}
@PostMapping
(
"saveData"
)
@PostMapping
(
"saveData"
)
@ApiOperation
(
"保存数据购物车过度"
)
@ApiOperation
(
"保存数据购物车过度"
)
public
ResponseDto
saveData
(
@RequestParam
(
name
=
"data"
,
required
=
false
)
String
data
,
@RequestParam
(
name
=
"type"
,
required
=
true
)
String
type
)
{
public
ResponseDto
saveData
(
@RequestParam
(
name
=
"data"
,
required
=
false
)
String
data
,
@RequestParam
(
name
=
"type"
,
required
=
true
)
String
type
)
{
String
userId
=
CurrentUtil
.
getCurrentUid
();
String
userId
=
CurrentUtil
.
getCurrentUid
();
return
ResponseDto
.
success
(
goblinFrontService
.
saveDate
(
data
,
userId
,
type
));
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
type
);
if
(
pre
!=
null
)
{
type
=
type
.
split
(
pre
)[
0
];
}
return
ResponseDto
.
success
(
goblinFrontService
.
saveDate
(
data
,
userId
,
type
));
}
}
@PostMapping
(
"getData"
)
@PostMapping
(
"getData"
)
@ApiOperation
(
"获得购物车过度"
)
@ApiOperation
(
"获得购物车过度"
)
public
ResponseDto
getData
(
@RequestParam
(
name
=
"type"
,
required
=
true
)
String
type
)
{
public
ResponseDto
getData
(
@RequestParam
(
name
=
"type"
,
required
=
true
)
String
type
)
{
String
userId
=
CurrentUtil
.
getCurrentUid
();
String
userId
=
CurrentUtil
.
getCurrentUid
();
return
goblinFrontService
.
getDate
(
userId
,
type
);
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
type
);
if
(
pre
!=
null
)
{
type
=
type
.
split
(
pre
)[
0
];
}
return
goblinFrontService
.
getDate
(
userId
,
type
);
}
}
@GetMapping
(
"getShopCart"
)
@GetMapping
(
"getShopCart"
)
@ApiOperation
(
"获得购物车列表"
)
@ApiOperation
(
"获得购物车列表"
)
public
ResponseDto
<
GoblinShoppingCartVoo
>
getShopCart
(
@RequestParam
(
name
=
"type"
,
required
=
true
)
String
type
)
{
public
ResponseDto
<
GoblinShoppingCartVoo
>
getShopCart
(
@RequestParam
(
name
=
"type"
,
required
=
true
)
String
type
)
{
String
userId
=
CurrentUtil
.
getCurrentUid
();
String
userId
=
CurrentUtil
.
getCurrentUid
();
return
ResponseDto
.
success
(
goblinFrontService
.
getShoppCart
(
userId
,
type
));
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
type
);
if
(
pre
!=
null
)
{
type
=
type
.
split
(
pre
)[
0
];
}
return
ResponseDto
.
success
(
goblinFrontService
.
getShoppCart
(
userId
,
type
));
}
}
@GetMapping
(
"deleteShopCartTest"
)
@GetMapping
(
"deleteShopCartTest"
)
@ApiOperation
(
"请勿调用,测试用"
)
@ApiOperation
(
"请勿调用,测试用"
)
public
ResponseDto
<
GoblinShoppingCartVoo
>
deleteShopCart
(
@RequestParam
(
name
=
"type"
,
required
=
true
)
String
type
)
{
public
ResponseDto
<
GoblinShoppingCartVoo
>
deleteShopCart
(
@RequestParam
(
name
=
"type"
,
required
=
true
)
String
type
)
{
String
userId
=
CurrentUtil
.
getCurrentUid
();
String
userId
=
CurrentUtil
.
getCurrentUid
();
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
type
);
if
(
pre
!=
null
)
{
type
=
type
.
split
(
pre
)[
0
];
}
redisUtil
.
del
(
GoblinRedisConst
.
FRONT_SHOPCART
.
concat
(
userId
).
concat
(
type
));
redisUtil
.
del
(
GoblinRedisConst
.
FRONT_SHOPCART
.
concat
(
userId
).
concat
(
type
));
return
ResponseDto
.
success
(
null
);
return
ResponseDto
.
success
(
null
);
}
}
}
}
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