Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
6d35c40e
Commit
6d35c40e
authored
Feb 15, 2020
by
Junling Bu
Browse files
fix: #341
parent
5e0bd4c0
Changes
12
Hide whitespace changes
Inline
Side-by-side
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallAddressService.java
View file @
6d35c40e
...
...
@@ -39,10 +39,8 @@ public class LitemallAddressService {
return
addressMapper
.
updateByPrimaryKeySelective
(
address
);
}
public
void
delete
(
Integer
userId
,
Integer
id
)
{
LitemallAddressExample
example
=
new
LitemallAddressExample
();
example
.
or
().
andUserIdEqualTo
(
userId
).
andIdEqualTo
(
id
).
andDeletedEqualTo
(
false
);
addressMapper
.
logicalDeleteByExample
(
example
);
public
void
delete
(
Integer
id
)
{
addressMapper
.
logicalDeleteByPrimaryKey
(
id
);
}
public
LitemallAddress
findDefault
(
Integer
userId
)
{
...
...
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallAftersaleService.java
View file @
6d35c40e
...
...
@@ -23,6 +23,12 @@ public class LitemallAftersaleService {
return
aftersaleMapper
.
selectByPrimaryKey
(
id
);
}
public
LitemallAftersale
findById
(
Integer
userId
,
Integer
id
)
{
LitemallAftersaleExample
example
=
new
LitemallAftersaleExample
();
example
.
or
().
andIdEqualTo
(
id
).
andUserIdEqualTo
(
userId
).
andDeletedEqualTo
(
false
);
return
aftersaleMapper
.
selectOneByExample
(
example
);
}
public
List
<
LitemallAftersale
>
queryList
(
Integer
userId
,
Short
status
,
Integer
page
,
Integer
limit
,
String
sort
,
String
order
)
{
LitemallAftersaleExample
example
=
new
LitemallAftersaleExample
();
LitemallAftersaleExample
.
Criteria
criteria
=
example
.
or
();
...
...
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallCartService.java
View file @
6d35c40e
...
...
@@ -57,6 +57,12 @@ public class LitemallCartService {
return
cartMapper
.
selectByPrimaryKey
(
id
);
}
public
LitemallCart
findById
(
Integer
userId
,
Integer
id
)
{
LitemallCartExample
example
=
new
LitemallCartExample
();
example
.
or
().
andUserIdEqualTo
(
userId
).
andIdEqualTo
(
id
).
andDeletedEqualTo
(
false
);
return
cartMapper
.
selectOneByExample
(
example
);
}
public
int
updateCheck
(
Integer
userId
,
List
<
Integer
>
idsList
,
Boolean
checked
)
{
LitemallCartExample
example
=
new
LitemallCartExample
();
example
.
or
().
andUserIdEqualTo
(
userId
).
andProductIdIn
(
idsList
).
andDeletedEqualTo
(
false
);
...
...
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallFootprintService.java
View file @
6d35c40e
...
...
@@ -28,6 +28,12 @@ public class LitemallFootprintService {
return
footprintMapper
.
selectByPrimaryKey
(
id
);
}
public
LitemallFootprint
findById
(
Integer
userId
,
Integer
id
)
{
LitemallFootprintExample
example
=
new
LitemallFootprintExample
();
example
.
or
().
andIdEqualTo
(
id
).
andUserIdEqualTo
(
userId
).
andDeletedEqualTo
(
false
);
return
footprintMapper
.
selectOneByExample
(
example
);
}
public
void
deleteById
(
Integer
id
)
{
footprintMapper
.
logicalDeleteByPrimaryKey
(
id
);
}
...
...
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallGrouponService.java
View file @
6d35c40e
...
...
@@ -80,6 +80,19 @@ public class LitemallGrouponService {
return
mapper
.
selectOneByExample
(
example
);
}
/**
* 根据ID查询记录
*
* @param userId
* @param id
* @return
*/
public
LitemallGroupon
queryById
(
Integer
userId
,
Integer
id
)
{
LitemallGrouponExample
example
=
new
LitemallGrouponExample
();
example
.
or
().
andIdEqualTo
(
id
).
andUserIdEqualTo
(
id
).
andDeletedEqualTo
(
false
);
return
mapper
.
selectOneByExample
(
example
);
}
/**
* 返回某个发起的团购参与人数
*
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/service/WxOrderService.java
View file @
6d35c40e
...
...
@@ -289,7 +289,7 @@ public class WxOrderService {
return
ResponseUtil
.
fail
(
GROUPON_JOIN
,
"团购活动已经参加!"
);
}
// (2)不允许参加自己开团的团购
LitemallGroupon
groupon
=
grouponService
.
queryById
(
grouponLinkId
);
LitemallGroupon
groupon
=
grouponService
.
queryById
(
userId
,
grouponLinkId
);
if
(
groupon
.
getCreatorUserId
().
equals
(
userId
)){
return
ResponseUtil
.
fail
(
GROUPON_JOIN
,
"团购活动已经参加!"
);
}
...
...
@@ -912,6 +912,10 @@ public class WxOrderService {
if
(
userId
==
null
)
{
return
ResponseUtil
.
unlogin
();
}
LitemallOrder
order
=
orderService
.
findById
(
userId
,
orderId
);
if
(
order
==
null
)
{
return
ResponseUtil
.
badArgument
();
}
List
<
LitemallOrderGoods
>
orderGoodsList
=
orderGoodsService
.
findByOidAndGid
(
orderId
,
goodsId
);
int
size
=
orderGoodsList
.
size
();
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxAddressController.java
View file @
6d35c40e
...
...
@@ -133,20 +133,28 @@ public class WxAddressController extends GetRegionService {
return
error
;
}
if
(
address
.
getIsDefault
())
{
// 重置其他收货地址的默认选项
addressService
.
resetDefault
(
userId
);
}
if
(
address
.
getId
()
==
null
||
address
.
getId
().
equals
(
0
))
{
if
(
address
.
getIsDefault
())
{
// 重置其他收货地址的默认选项
addressService
.
resetDefault
(
userId
);
}
address
.
setId
(
null
);
address
.
setUserId
(
userId
);
addressService
.
add
(
address
);
}
else
{
address
.
setUserId
(
userId
);
if
(
addressService
.
update
(
a
ddress
)
==
0
)
{
return
ResponseUtil
.
updatedDataFailed
();
LitemallAddress
litemallAddress
=
addressService
.
query
(
userId
,
address
.
getId
()
);
if
(
litemallA
ddress
==
null
)
{
return
ResponseUtil
.
badArgumentValue
();
}
if
(
address
.
getIsDefault
())
{
// 重置其他收货地址的默认选项
addressService
.
resetDefault
(
userId
);
}
address
.
setUserId
(
userId
);
addressService
.
update
(
address
);
}
return
ResponseUtil
.
ok
(
address
.
getId
());
}
...
...
@@ -167,8 +175,12 @@ public class WxAddressController extends GetRegionService {
if
(
id
==
null
)
{
return
ResponseUtil
.
badArgument
();
}
LitemallAddress
litemallAddress
=
addressService
.
query
(
userId
,
id
);
if
(
litemallAddress
==
null
)
{
return
ResponseUtil
.
badArgumentValue
();
}
addressService
.
delete
(
userId
,
id
);
addressService
.
delete
(
id
);
return
ResponseUtil
.
ok
();
}
}
\ No newline at end of file
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxAftersaleController.java
View file @
6d35c40e
...
...
@@ -94,6 +94,9 @@ public class WxAftersaleController {
}
LitemallOrder
order
=
orderService
.
findById
(
userId
,
orderId
);
if
(
order
==
null
){
return
ResponseUtil
.
badArgumentValue
();
}
List
<
LitemallOrderGoods
>
orderGoodsList
=
orderGoodsService
.
queryByOid
(
orderId
);
LitemallAftersale
aftersale
=
aftersaleService
.
findByOrderId
(
userId
,
orderId
);
...
...
@@ -129,9 +132,6 @@ public class WxAftersaleController {
if
(
order
==
null
){
return
ResponseUtil
.
badArgumentValue
();
}
if
(!
order
.
getUserId
().
equals
(
userId
)){
return
ResponseUtil
.
badArgumentValue
();
}
// 订单必须完成才能进入售后流程。
if
(!
OrderUtil
.
isConfirmStatus
(
order
)
&&
!
OrderUtil
.
isAutoConfirmStatus
(
order
)){
...
...
@@ -177,7 +177,7 @@ public class WxAftersaleController {
if
(
id
==
null
){
return
ResponseUtil
.
badArgument
();
}
LitemallAftersale
aftersaleOne
=
aftersaleService
.
findById
(
id
);
LitemallAftersale
aftersaleOne
=
aftersaleService
.
findById
(
userId
,
id
);
if
(
aftersaleOne
==
null
){
return
ResponseUtil
.
badArgument
();
}
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxCartController.java
View file @
6d35c40e
...
...
@@ -258,9 +258,6 @@ public class WxCartController {
if
(
userId
==
null
)
{
return
ResponseUtil
.
unlogin
();
}
if
(
cart
==
null
)
{
return
ResponseUtil
.
badArgument
();
}
Integer
productId
=
cart
.
getProductId
();
Integer
number
=
cart
.
getNumber
().
intValue
();
Integer
goodsId
=
cart
.
getGoodsId
();
...
...
@@ -274,7 +271,7 @@ public class WxCartController {
//判断是否存在该订单
// 如果不存在,直接返回错误
LitemallCart
existCart
=
cartService
.
findById
(
id
);
LitemallCart
existCart
=
cartService
.
findById
(
userId
,
id
);
if
(
existCart
==
null
)
{
return
ResponseUtil
.
badArgumentValue
();
}
...
...
@@ -448,7 +445,7 @@ public class WxCartController {
if
(
cartId
==
null
||
cartId
.
equals
(
0
))
{
checkedGoodsList
=
cartService
.
queryByUidAndChecked
(
userId
);
}
else
{
LitemallCart
cart
=
cartService
.
findById
(
cartId
);
LitemallCart
cart
=
cartService
.
findById
(
userId
,
cartId
);
if
(
cart
==
null
)
{
return
ResponseUtil
.
badArgumentValue
();
}
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxCouponController.java
View file @
6d35c40e
...
...
@@ -139,7 +139,7 @@ public class WxCouponController {
if
(
cartId
==
null
||
cartId
.
equals
(
0
))
{
checkedGoodsList
=
cartService
.
queryByUidAndChecked
(
userId
);
}
else
{
LitemallCart
cart
=
cartService
.
findById
(
cartId
);
LitemallCart
cart
=
cartService
.
findById
(
userId
,
cartId
);
if
(
cart
==
null
)
{
return
ResponseUtil
.
badArgumentValue
();
}
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxFootprintController.java
View file @
6d35c40e
...
...
@@ -54,7 +54,7 @@ public class WxFootprintController {
if
(
footprintId
==
null
)
{
return
ResponseUtil
.
badArgument
();
}
LitemallFootprint
footprint
=
footprintService
.
findById
(
footprintId
);
LitemallFootprint
footprint
=
footprintService
.
findById
(
userId
,
footprintId
);
if
(
footprint
==
null
)
{
return
ResponseUtil
.
badArgumentValue
();
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxGrouponController.java
View file @
6d35c40e
...
...
@@ -87,7 +87,7 @@ public class WxGrouponController {
return
ResponseUtil
.
unlogin
();
}
LitemallGroupon
groupon
=
grouponService
.
queryById
(
grouponId
);
LitemallGroupon
groupon
=
grouponService
.
queryById
(
userId
,
grouponId
);
if
(
groupon
==
null
)
{
return
ResponseUtil
.
badArgumentValue
();
}
...
...
Write
Preview
Supports
Markdown
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