Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
order-group-application
order-group
Commits
01661807
Commit
01661807
authored
Apr 20, 2021
by
chongfu.liang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加料支持多份
parent
b5639e26
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
8 deletions
+33
-8
shopping-cart-application-service/src/main/java/cn/freemud/demo/adapter/manager/ProductDTO2BOAdapter.java
+2
-1
shopping-cart-application-service/src/main/java/cn/freemud/demo/adapter/service/CalculationSharingAdapter.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/demo/entities/bo/goods/ProductBO.java
+4
-0
shopping-cart-application-service/src/main/java/cn/freemud/demo/manager/product/KgdProductServiceImpl.java
+3
-6
shopping-cart-application-service/src/main/java/cn/freemud/demo/service/impl/AbstractAddGoodsService.java
+23
-0
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/demo/adapter/manager/ProductDTO2BOAdapter.java
View file @
01661807
...
...
@@ -3,6 +3,7 @@ package cn.freemud.demo.adapter.manager;
import
cn.freemud.demo.entities.bo.product.ProductStockBO
;
import
cn.freemud.demo.entities.bo.goods.ValiadShopProductBO
;
import
cn.freemud.demo.entities.bo.goods.ProductBO
;
import
cn.freemud.entities.dto.GetMenuResponseDto
;
import
cn.freemud.entities.dto.GetProductStockResponseDto
;
import
cn.freemud.utils.BeanUtil
;
import
com.freemud.application.sdk.api.productcenter.domain.ProductBeanDTO
;
...
...
@@ -19,7 +20,7 @@ public class ProductDTO2BOAdapter {
@Resource
private
MapperFacade
mapperFacade
;
public
ProductBO
convert2ProductBO
(
ProductBeanDTO
productBeanDTO
)
{
public
ProductBO
convert2ProductBO
(
GetMenuResponseDto
.
DataBean
.
RootNodeBean
.
ChildrenBeanFirst
.
ChildrenBeanSecond
.
ProductBean
productBeanDTO
)
{
ProductBO
productBO
=
BeanUtil
.
convertBean
(
productBeanDTO
,
ProductBO:
:
new
);
productBO
.
setGoodsId
(
productBeanDTO
.
getPid
());
...
...
shopping-cart-application-service/src/main/java/cn/freemud/demo/adapter/service/CalculationSharingAdapter.java
View file @
01661807
...
...
@@ -206,7 +206,7 @@ public class CalculationSharingAdapter {
GetCalculationDiscountBO
.
CalculationDiscountGoods
.
Material
material
=
new
GetCalculationDiscountBO
.
CalculationDiscountGoods
.
Material
();
material
.
setType
(
1
);
material
.
setGoodsId
(
materialGoods
.
getSpuId
());
material
.
setGoodsQuantity
(
1
);
material
.
setGoodsQuantity
(
materialGoods
.
getQty
()
);
material
.
setOriginalPrice
(
materialGoods
.
getFinalPrice
());
materials
.
add
(
material
);
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/demo/entities/bo/goods/ProductBO.java
View file @
01661807
...
...
@@ -39,6 +39,10 @@ public class ProductBO {
* 数量
*/
private
Integer
qty
;
/**
* 加料最大限购
*/
private
Integer
maxNum
;
private
String
category
;
/**
* 分类名
...
...
shopping-cart-application-service/src/main/java/cn/freemud/demo/manager/product/KgdProductServiceImpl.java
View file @
01661807
...
...
@@ -12,10 +12,7 @@ import cn.freemud.demo.entities.bo.product.GetProductBySkuIdBO;
import
cn.freemud.demo.entities.bo.product.GetProductStock
;
import
cn.freemud.demo.entities.bo.product.GetRequiredProductListBO
;
import
cn.freemud.demo.entities.bo.product.ProductStockBO
;
import
cn.freemud.entities.dto.GetProductStockRequestDto
;
import
cn.freemud.entities.dto.GetProductStockResponseDto
;
import
cn.freemud.entities.dto.ProductBaseResponse
;
import
cn.freemud.entities.dto.RequiredProductRequest
;
import
cn.freemud.entities.dto.*
;
import
cn.freemud.enums.ResponseResult
;
import
cn.freemud.interceptor.ServiceException
;
import
cn.freemud.service.ItemService
;
...
...
@@ -67,11 +64,11 @@ public class KgdProductServiceImpl implements ProductService {
public
List
<
ProductBO
>
getProductInfo
(
GetProductBO
getProductBO
)
{
// 获取添加商品的详细信息
List
<
ProductBeanDTO
>
productBeanListSpuClass
=
assortmentSdkService
.
getProductsInfoSdk
(
getProductBO
.
getPartnerId
(),
List
<
GetMenuResponseDto
.
DataBean
.
RootNodeBean
.
ChildrenBeanFirst
.
ChildrenBeanSecond
.
ProductBean
>
productBeanListSpuClass
=
assortmentSdkService
.
getProductsInfo
(
getProductBO
.
getPartnerId
(),
getProductBO
.
getStoreId
(),
getProductBO
.
getGoodsId
(),
getProductBO
.
getMenuType
(),
shoppingCartBaseService
);
List
<
ProductBO
>
productList
=
new
ArrayList
<>();
for
(
ProductBeanDTO
dto
:
productBeanListSpuClass
){
for
(
GetMenuResponseDto
.
DataBean
.
RootNodeBean
.
ChildrenBeanFirst
.
ChildrenBeanSecond
.
ProductBean
dto
:
productBeanListSpuClass
){
ProductBO
platformProductBO
=
productDTO2BOAdapter
.
convert2ProductBO
(
dto
);
productList
.
add
(
platformProductBO
);
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/demo/service/impl/AbstractAddGoodsService.java
View file @
01661807
...
...
@@ -360,6 +360,10 @@ public abstract class AbstractAddGoodsService implements AddGoodsService {
this
.
checkStocks
(
baseRequestDTO
,
checkBussinessRulesBO
);
// 校验套餐
this
.
checkMeal
(
checkBussinessRulesBO
.
getCartGoods
(),
baseRequestDTO
.
getAddGoods
());
// 检查商品小料数量
this
.
checkMaterialQty
(
addGoods
,
checkBussinessRulesBO
.
getProduct
());
// 检查校验购物车商品(是否合法,上下架,点餐方式,是否在当前菜单中...),并移除非法商品
ShoppingCartContext
cartContext
=
convert2ShopingCartContext
(
baseRequestDTO
);
...
...
@@ -378,6 +382,25 @@ public abstract class AbstractAddGoodsService implements AddGoodsService {
return
bo
;
}
private
void
checkMaterialQty
(
CartGoods
addGoods
,
ProductBO
product
){
Integer
materialMaxQty
=
product
.
getMaxNum
();
Integer
addProductqty
=
0
;
if
(
CollectionUtils
.
isNotEmpty
(
addGoods
.
getProductMaterialList
())){
for
(
CartGoods
.
MaterialGoods
materialRequestVo
:
addGoods
.
getProductMaterialList
()){
addProductqty
=
addProductqty
+
(
materialRequestVo
.
getQty
()
==
null
?
0
:
materialRequestVo
.
getQty
());
}
}
if
(
materialMaxQty
==
null
||
ObjectUtils
.
equals
(
materialMaxQty
,
0
)
||
addProductqty
==
null
||
ObjectUtils
.
equals
(
addProductqty
,
0
)){
return
;
}
if
(
materialMaxQty
.
intValue
()
<
addProductqty
.
intValue
()){
return
;
}
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_MATERIA_QTY_LIMIT_ERR
);
};
private
DiscountResultBO
commAddGoodsToShoppingCart
(
BaseAddGoodsBO
baseRequestDTO
,
AddGoodsToShoppingCartBO
addGoodsToShoppingCartBO
)
{
DiscountResultBO
calCostBO
=
new
DiscountResultBO
();
List
<
CartGoods
>
cartGoods
=
shoppingBaseService
.
updateAndGetShoppingCart
(
addGoodsToShoppingCartBO
.
getCartGoods
(),
baseRequestDTO
.
getAddGoods
(),
addGoodsToShoppingCartBO
.
getShoppingCartContext
());
...
...
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