Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
soss
Overview
Overview
Details
Activity
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
hooloo
ms
soss
Commits
abbf0ad4
Commit
abbf0ad4
authored
Mar 03, 2023
by
weijiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化店铺距离限制
parent
9ca18783
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
11 deletions
+12
-11
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderController.java
+1
-1
soss-system/src/main/java/com/soss/system/mapper/GoodsSkuMapper.java
+1
-1
soss-system/src/main/java/com/soss/system/service/ICouponUserService.java
+1
-1
soss-system/src/main/java/com/soss/system/service/impl/CouponUserServiceImpl.java
+5
-5
soss-system/src/main/resources/mapper/system/GoodsSkuMapper.xml
+4
-3
No files found.
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderController.java
View file @
abbf0ad4
...
...
@@ -162,7 +162,7 @@ public class OrderController extends BaseController {
order
.
setPaidAmount
(
order
.
getAmount
().
add
(
order
.
getCouponAmount
()));
order
.
setCouponId
(
couponVo
.
getCouponId
());
}
else
{
couponUserService
.
orderDetailCheckAndAssign
(
order
.
getOrderDetails
());
couponUserService
.
orderDetailCheckAndAssign
(
order
.
get
ShopId
(),
order
.
get
OrderDetails
());
}
AjaxResult
ajaxResult
=
orderService
.
insertOrder
(
loginUser
,
order
,
couponUserId
);
...
...
soss-system/src/main/java/com/soss/system/mapper/GoodsSkuMapper.java
View file @
abbf0ad4
...
...
@@ -36,7 +36,7 @@ public interface GoodsSkuMapper
* @param ids
* @return
*/
List
<
GoodsSku
>
selectSkuListForOrder
(
@Param
(
"ids"
)
List
<
Long
>
ids
);
List
<
GoodsSku
>
selectSkuListForOrder
(
@Param
(
"
shopId"
)
Long
shopId
,
@Param
(
"
ids"
)
List
<
Long
>
ids
);
/**
* 新增由规格选项组合生成商品sku
...
...
soss-system/src/main/java/com/soss/system/service/ICouponUserService.java
View file @
abbf0ad4
...
...
@@ -31,5 +31,5 @@ public interface ICouponUserService {
void
resovleCouponFitable
(
List
<
CouponVo
>
couponVos
,
Order
order
);
List
<
GoodsSku
>
orderDetailCheckAndAssign
(
List
<
OrderDetail
>
orderDetails
);
List
<
GoodsSku
>
orderDetailCheckAndAssign
(
L
ong
shopId
,
L
ist
<
OrderDetail
>
orderDetails
);
}
soss-system/src/main/java/com/soss/system/service/impl/CouponUserServiceImpl.java
View file @
abbf0ad4
...
...
@@ -178,11 +178,11 @@ public class CouponUserServiceImpl implements ICouponUserService {
/** 可用门店和时段的校验 */
this
.
checkShopAndWeeklyFitable
(
couponVos
,
order
.
getShopId
());
/** 可用饮品范围的判断 */
checkGoodsFitable
(
couponVos
,
order
.
getOrderDetails
());
checkGoodsFitable
(
order
.
getShopId
(),
couponVos
,
order
.
getOrderDetails
());
}
private
void
checkGoodsFitable
(
List
<
CouponVo
>
couponVos
,
List
<
OrderDetail
>
orderDetails
)
{
List
<
GoodsSku
>
goodsSkus
=
this
.
orderDetailCheckAndAssign
(
orderDetails
);
private
void
checkGoodsFitable
(
L
ong
shopId
,
L
ist
<
CouponVo
>
couponVos
,
List
<
OrderDetail
>
orderDetails
)
{
List
<
GoodsSku
>
goodsSkus
=
this
.
orderDetailCheckAndAssign
(
shopId
,
orderDetails
);
List
<
Long
>
goodsIds
=
goodsSkus
.
stream
().
map
(
GoodsSku:
:
getGoodsId
).
collect
(
Collectors
.
toList
());
List
<
Goods
>
goods
=
goodsMapper
.
selectGoodsByIds
(
goodsIds
);
Assert
.
notEmpty
(
goods
,
"未查询到匹配的商品信息[id="
+
goodsIds
+
"]"
);
...
...
@@ -234,11 +234,11 @@ public class CouponUserServiceImpl implements ICouponUserService {
}
@Override
public
List
<
GoodsSku
>
orderDetailCheckAndAssign
(
List
<
OrderDetail
>
orderDetails
)
{
public
List
<
GoodsSku
>
orderDetailCheckAndAssign
(
L
ong
shopId
,
L
ist
<
OrderDetail
>
orderDetails
)
{
Assert
.
notEmpty
(
orderDetails
,
"商品明细还未传递"
);
List
<
Long
>
skuIds
=
orderDetails
.
stream
().
map
(
OrderDetail:
:
getSkuId
).
collect
(
Collectors
.
toList
());
Assert
.
notEmpty
(
skuIds
,
"skuId还未传递"
);
List
<
GoodsSku
>
goodsSkus
=
goodsSkuMapper
.
selectSkuListForOrder
(
skuIds
);
List
<
GoodsSku
>
goodsSkus
=
goodsSkuMapper
.
selectSkuListForOrder
(
s
hopId
,
s
kuIds
);
log
.
info
(
"sku id size is {} and query size is {}"
,
skuIds
.
size
(),
goodsSkus
.
size
());
Assert
.
isTrue
(
goodsSkus
.
size
()
==
skuIds
.
size
(),
"未查询到匹配的sku记录"
);
// sku的ID和价格字典
...
...
soss-system/src/main/resources/mapper/system/GoodsSkuMapper.xml
View file @
abbf0ad4
...
...
@@ -21,10 +21,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"selectSkuListForOrder"
resultMap=
"GoodsSkuResult"
>
select gs.id, gs.goods_id, gs.price,
case when sgs.discount>=0 then sgs.discount else gs.discount end as discount,
gs.is_deleted
from goods_sku gs
case when sgs.discount>=0 then sgs.discount else gs.discount end as discount,
gs.is_deleted
from goods_sku gs
left join shop_goods_sku sgs on gs.goods_id = sgs.goods_id and gs.id = sgs.sku_id
where gs.id in
where sgs.shop_id = #{shopId}
and gs.id in
<foreach
collection=
"ids"
item=
"id"
separator=
","
open=
"("
close=
")"
>
#{id}
</foreach>
</select>
...
...
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