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
535f5cff
Commit
535f5cff
authored
Feb 24, 2022
by
程飞祥
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into master
parents
7ae6947b
ca81aa76
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
209 additions
and
2 deletions
+209
-2
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
+2
-2
order-application-service/pom.xml
+15
-0
order-application-service/src/main/java/cn/freemud/service/impl/OrderServiceImpl.java
+3
-0
order-application-service/src/test/spock/cn/freemud/service/impl/OrderAdapterServiceImplTest.groovy
+189
-0
No files found.
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
View file @
535f5cff
...
...
@@ -3064,12 +3064,12 @@ public class OrderSdkAdapter {
if
(
ProductTypeEnum
.
WEIGHT_PRODUCT
.
getCode
().
equals
(
product
.
getProductType
()))
{
Double
weight
=
(
product
.
getWeight
()
==
null
||
product
.
getWeight
()
<=
0
)
?
0
:
product
.
getWeight
();
Double
weightPrice
=
product
.
getPrice
()
*
weight
;
Long
settlementPrice
=
weightPrice
==
0
?
0
:
weightPrice
.
longValue
()
-
totalDiscountAmount
;
Long
settlementPrice
=
weightPrice
==
0
?
0
:
weightPrice
.
longValue
()
-
Math
.
abs
(
totalDiscountAmount
)
;
orderItemCreateReq
.
setSalePrice
(
settlementPrice
);
orderItemCreateReq
.
setSettlementPrice
(
settlementPrice
);
totalOriginalProductAmount
=
weightPrice
.
longValue
();
}
else
{
Long
settlementPrice
=
product
.
getPrice
()
*
product
.
getNumber
()
-
totalDiscountAmount
;
Long
settlementPrice
=
product
.
getPrice
()
*
product
.
getNumber
()
-
Math
.
abs
(
totalDiscountAmount
)
;
orderItemCreateReq
.
setSalePrice
(
settlementPrice
/
product
.
getNumber
());
orderItemCreateReq
.
setSettlementPrice
(
settlementPrice
);
/**
...
...
order-application-service/pom.xml
View file @
535f5cff
...
...
@@ -12,11 +12,26 @@
<properties>
<jacoco.version>
0.7.5.201505241946
</jacoco.version>
<junit.version>
4.12
</junit.version>
<spock.version>
1.3-groovy-2.5
</spock.version>
</properties>
<artifactId>
order-application-service
</artifactId>
<dependencies>
<!--引入spock 核心包-->
<dependency>
<groupId>
org.spockframework
</groupId>
<artifactId>
spock-core
</artifactId>
<version>
${spock.version}
</version>
<scope>
test
</scope>
</dependency>
<!--引入spock 与 spring 集成包-->
<dependency>
<groupId>
org.spockframework
</groupId>
<artifactId>
spock-spring
</artifactId>
<version>
${spock.version}
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
com.freemud.thirdparty.sdk
</groupId>
...
...
order-application-service/src/main/java/cn/freemud/service/impl/OrderServiceImpl.java
View file @
535f5cff
...
...
@@ -2377,6 +2377,9 @@ public class OrderServiceImpl implements Orderservice {
spuIds
.
add
(
productDto
.
getProductId
());
}
Map
<
String
,
GetProductsVo
>
products
=
itemService
.
getSpuProducts
(
spuIds
,
createOrderDto
.
getCompanyId
(),
createOrderDto
.
getShopId
(),
createOrderDto
.
getMenuType
());
if
(
products
==
null
)
{
return
createOrderDto
;
}
if
(
products
.
isEmpty
())
{
return
createOrderDto
;
}
...
...
order-application-service/src/test/spock/cn/freemud/service/impl/OrderAdapterServiceImplTest.groovy
0 → 100644
View file @
535f5cff
package
cn.freemud.service.impl
import
cn.freemud.adapter.OrderAdapter
import
cn.freemud.entities.bo.CreateOrderBONew
import
cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto
import
cn.freemud.entities.dto.store.StoreMixResponseDto
import
cn.freemud.entities.vo.CreateOrderVo
import
cn.freemud.service.business.impl.OrderBusinessServiceImpl
import
com.alibaba.fastjson.JSON
import
com.freemud.api.assortment.datamanager.entity.vo.AssortmentCustomerInfoVo
import
com.freemud.application.sdk.api.ordercenter.request.OrderExtInfoDto
import
com.freemud.sdk.api.assortment.order.adapter.OrderSdkAdapter
import
spock.lang.Specification
/**
* @author : xh.Z
* @email : fisherman0510@163.com
* @Date : 2022/2/23 17:17
* @description :
*/
class
OrderAdapterServiceImplTest
extends
Specification
{
def
orderServiceImpl
=
new
OrderServiceImpl
()
def
orderAdapter
=
new
OrderAdapter
(
mcCafePartnerId:
[
"9999"
],
cocoPartnerId:
[
"9999"
])
def
itemService
=
Mock
(
ItemServiceImpl
.
class
)
def
orderBusinessService
=
new
OrderBusinessServiceImpl
()
def
orderSdkAdapter
=
new
OrderSdkAdapter
()
void
setup
()
{
orderServiceImpl
.
orderAdapter
=
orderAdapter
orderServiceImpl
.
itemService
=
itemService
orderBusinessService
.
orderSdkAdapter
=
orderSdkAdapter
orderServiceImpl
.
orderBusinessService
=
orderBusinessService
}
def
"测试华莱士订单问题"
()
{
given:
"参数设置"
def
createOrderBO
=
new
CreateOrderBONew
()
// 接口请求信息
String
createVOStr
=
"{\"buyType\":0,\"channel\":\"1\",\"channelType\":\"saas\",\"couponCode\":\"88709227085491207040\",\"couponCodes\":[{\"couponCode\":\"88709227085491207040\",\"couponType\":7}],\"expectTime\":\"\",\"latitude\":\"31.293401421440972\",\"longitude\":\"121.30461995442708\",\"menuType\":\"saas\",\"mobile\":\"17327190802\",\"orderRemark\":\"测试单,请勿制作出餐,谢谢!\",\"orderType\":1,\"partnerId\":\"2581\",\"payChannelType\":1,\"reachStoreType\":5,\"sessionId\":\"cef46527f632a961af7a84209bdb8fcd0997c936\",\"sessionKey\":\"hZtQ1Usx/NhEUyoyduF+FQ==\",\"shopId\":\"229830\",\"storeAddress\":\"河南省驻马店市西平县经贸路步行街西段小广场华莱士\",\"storeName\":\"华莱士(西平步行街店)\",\"storeNameEn\":\"\",\"tableNumber\":\"\",\"takeMealFlag\":\"0\",\"takeMealTime\":\"\",\"thirdShopId\":\"EA23\",\"useCustomerScore\":2,\"userId\":\"3614319825989629832\",\"userName\":\"SWEET SUGA\",\"version\":\"2.0.60.6\"}"
;
def
createOrderVo
=
JSON
.
parseObject
(
createVOStr
,
CreateOrderVo
.
class
)
createOrderBO
.
setCreateOrderVo
(
createOrderVo
)
// 登录信息
def
userLoginInfoDto
=
JSON
.
parseObject
(
"{\"accessToken\":\"\",\"alipayUserId\":\"\",\"appId\":\"wx3f7ca0c75b213380\",\"appSecret\":\"\",\"appsecret\":\"\",\"channel\":\"1\",\"customerId\":\"\",\"devBrand\":\"\",\"devModel\":\"\",\"iappId\":\"7\",\"memberId\":\"3614319825989629832\",\"mobile\":\"17327190802\",\"newMember\":false,\"nickName\":\"SWEET SUGA\",\"openId\":\"o98fP4qjUo7xm-nT-JAaVEk9yBqM\",\"openid\":\"o98fP4qjUo7xm-nT-JAaVEk9yBqM\",\"partnerId\":\"2581\",\"photoUrl\":\"https://thirdwx.qlogo.cn/mmopen/vi_32/zahIlicTNSM0IA0qjOryv6s0SzIhlwW9EpQKvL63GbPhBwficMAibDohDEibSCQU0I5KohibIpp0yL57TWRcVKrRH2A/132\",\"registerTime\":\"2021-02-26 14:10:26\",\"sessionId\":\"cef46527f632a961af7a84209bdb8fcd0997c936\",\"sessionKey\":\"hZtQ1Usx/NhEUyoyduF+FQ==\",\"session_key\":\"hZtQ1Usx/NhEUyoyduF+FQ==\",\"storeId\":\"\",\"tableNumber\":\"\",\"thirdPartyMemberID\":\"\",\"thirdPartyPartnerID\":\"\",\"unionId\":\"o7cEm68JPFhbrzqb0a0BcQE-dDVA\",\"wxAppId\":\"wx3f7ca0c75b213380\",\"wxAppid\":\"wx3f7ca0c75b213380\"}"
,
AssortmentCustomerInfoVo
.
class
)
createOrderBO
.
setUserLoginInfoDto
(
userLoginInfoDto
)
// 购物车信息
def
shoppingCartGoodsDto
=
JSON
.
parseObject
(
"{\"activityDiscountsDtos\":[{\"activityCode\":\"88709227085491207040\",\"activityName\":\"鸡米花买一送一券\",\"activityType\":32,\"discountAmount\":-800,\"priority\":0}],\"isDiscountDelivery\":false,\"originalTotalAmount\":2400,\"products\":[{\"activityDiscountsDtos\":[{\"activityCode\":\"88709227085491207040\",\"activityName\":\"鸡米花买一送一券\",\"activityType\":32,\"actualActivityGoodsNumber\":1,\"cartGoodsUid\":\"09b125d6-603d-4783-ba01-287073d08e2b\",\"discountAmount\":800}],\"cartGoodsUid\":\"09b125d6-603d-4783-ba01-287073d08e2b\",\"couponCode\":\"88709227085491207040\",\"extraList\":[],\"hasProductCoupon\":false,\"isB3S1Coupon\":0,\"isB3S1CouponGoods\":0,\"isMonthCard\":0,\"isSendGoods\":false,\"isTableware\":0,\"linkedId\":\"\",\"materialList\":[],\"originalPrice\":800,\"originalProductType\":1,\"packPrice\":0,\"picture\":\"https://picture.sandload.cn/1619081297921.jpg\",\"qty\":2,\"salePrice\":800,\"skuId\":\"201889966261817090\",\"skuName\":\"鸡米花T\",\"spuId\":\"201889966261817090\",\"spuName\":\"鸡米花T\",\"stockLimit\":false,\"totalDiscountAmount\":-800,\"unit\":\"\",\"weight\":0.0},{\"activityDiscountsDtos\":[],\"cartGoodsUid\":\"02537906-b09d-4a76-b5b7-2a5842a31a6c\",\"categoryName\":\"缤纷小食\",\"classificationId\":\"0102\",\"classificationName\":\"正价单品\",\"customerCode\":\"hn80017\",\"extraList\":[],\"hasProductCoupon\":false,\"isB3S1Coupon\":0,\"isB3S1CouponGoods\":0,\"isMonthCard\":0,\"isSendGoods\":false,\"isTableware\":0,\"linkedId\":\"\",\"materialList\":[],\"originalPrice\":800,\"originalProductType\":1,\"packPrice\":0,\"picture\":\"https://picture.sandload.cn/1619080995048.jpg\",\"productCode\":\"hn80017\",\"qty\":1,\"salePrice\":800,\"skuForeignName\":\"\",\"skuId\":\"201889966070976307\",\"skuName\":\"薯条(大)T\",\"spuForeignName\":\"\",\"spuId\":\"201889966070976307\",\"spuName\":\"薯条(大)T\",\"stockLimit\":false,\"tax\":0.01,\"taxId\":\"\",\"totalDiscountAmount\":0,\"unit\":\"\",\"weight\":0.0}],\"reduceScore\":0,\"scoreReduceAmount\":0,\"shareDiscountActivityDtos\":[],\"totalAmount\":1600,\"totalDiscountAmount\":800,\"totalScore\":0}"
,
ShoppingCartGoodsDto
.
class
)
createOrderBO
.
setShoppingCartGoodsDto
(
shoppingCartGoodsDto
)
//拓展信息
def
extInfo
=
new
OrderExtInfoDto
()
createOrderBO
.
setExtInfo
(
extInfo
)
// 门店信息
def
storeMixResponseDto
=
JSON
.
parseObject
(
"{\n"
+
" \"storeInfo\": {\n"
+
" \"storeId\": \"32f47616-6e78-42c3-b5ee-768d9983fc69\",\n"
+
" \"storeCode\": \"229830\",\n"
+
" \"storeName\": \"华莱士(西平步行街店)\",\n"
+
" \"storeNameEn\": null,\n"
+
" \"parentId\": \"16dc665e-8e03-41a8-83ae-95e92666d266\",\n"
+
" \"parentCode\": \"05Y\",\n"
+
" \"parentName\": \"湖北(豫)\",\n"
+
" \"partnerId\": \"2581\",\n"
+
" \"briefName\": null,\n"
+
" \"longitude\": \"114.02106387473609\",\n"
+
" \"latitude\": \"33.383438776512136\",\n"
+
" \"geohash\": \"wtcjft\",\n"
+
" \"businessHours\": \"00:00-24:00\",\n"
+
" \"state\": \"1\",\n"
+
" \"phone\": \"17719196597\",\n"
+
" \"address\": \"河南省驻马店市西平县经贸路步行街西段小广场华莱士\",\n"
+
" \"addressEn\": null,\n"
+
" \"activeFlag\": 1,\n"
+
" \"remark\": null,\n"
+
" \"province\": \"河南省\",\n"
+
" \"city\": \"驻马店市\",\n"
+
" \"region\": \"西平县\",\n"
+
" \"delivery\": \"2\",\n"
+
" \"deliveryHours\": \"\",\n"
+
" \"freeDeliveryPrice\": 20.0,\n"
+
" \"distributionScope\": \"\",\n"
+
" \"businessHoursDay\": \"00:00-24:00\",\n"
+
" \"deliveryHoursDay\": null,\n"
+
" \"storeNotice\": null,\n"
+
" \"logoUrl\": null,\n"
+
" \"isBusinessOpen\": \"1\",\n"
+
" \"businessType\": \"1\",\n"
+
" \"isSelfMention\": 1,\n"
+
" \"showDiscount\": null,\n"
+
" \"thirdPartCode\": \"EA23\",\n"
+
" \"status\": 1,\n"
+
" \"deliveryRemark\": null\n"
+
" },\n"
+
" \"deliveryInfo\": null,\n"
+
" \"businessInfo\": {\n"
+
" \"id\": 203735268043408939,\n"
+
" \"templateName\": \"【河南】无外卖 无预定单\",\n"
+
" \"templateType\": 1,\n"
+
" \"partnerId\": \"2581\",\n"
+
" \"orderWarnTime\": \"1\",\n"
+
" \"deliveryOrderWarnTime\": \"1\",\n"
+
" \"orderPrintConfig\": \"2\",\n"
+
" \"maxOrderQuantity\": 10000,\n"
+
" \"isAutoTakeOrder\": 1,\n"
+
" \"pickupAutomaticOrderTime\": 1,\n"
+
" \"takeoutAutomaticOrderTime\": 1,\n"
+
" \"autoChargebackOrderType\": 1,\n"
+
" \"autoChargebackOrderTime\": 1,\n"
+
" \"overTimeCloseOrder\": 1,\n"
+
" \"overTimeCloseOrderTime\": 30,\n"
+
" \"autoSelfmentionTakeOrderWorkflowFinishTime\": 3,\n"
+
" \"autoSelfmentionMakerWorkflowFinishTime\": 4,\n"
+
" \"autoTakeOutTakeOrderWorkflowFinishTime\": 4,\n"
+
" \"autoDeliveryTakeOrderWorkflowFinishTime\": 3,\n"
+
" \"appointAutoSelfmentionTakeOrderWorkflowFinishTime\": 4,\n"
+
" \"appointAutoSelfmentionMakerWorkflowFinishTime\": 4,\n"
+
" \"appointAutoTakeOutTakeOrderWorkflowFinishTime\": 4,\n"
+
" \"appointAutoDeliveryTakeOrderWorkflowFinishTime\": 3,\n"
+
" \"autoThirdDeliveryTakeOrderWorkflowFinishTime\": 5,\n"
+
" \"appointThirdDeliveryTakeOrderWorkflowFinishTime\": 6,\n"
+
" \"orderType\": \"pickup\",\n"
+
" \"invoice\": 0,\n"
+
" \"deliveryHours\": \"\",\n"
+
" \"expectedTime\": 0,\n"
+
" \"takePartInSettleAccounts\": 2,\n"
+
" \"automaticRefund\": 1,\n"
+
" \"minPriceForInvoice\": 0,\n"
+
" \"invoiceExplain\": \"\",\n"
+
" \"deliveryAppoint\": 0,\n"
+
" \"deliveryAppointTime\": null,\n"
+
" \"tableware\": 0,\n"
+
" \"selfMentionSwitch\": 0,\n"
+
" \"autoThirdDeliveryPickCompleteWorkflowFinishTime\": 5,\n"
+
" \"appointThirdDeliveryPickCompleteWorkflowFinishTime\": 5,\n"
+
" \"timeOfRefund\": \"48\",\n"
+
" \"timeTypeOfRefund\": 2,\n"
+
" \"turnOnTimeOfMaking\": 2,\n"
+
" \"goodsAvgTimeOfMaking\": 5,\n"
+
" \"deliveryFinishedAfterMinute\": 45,\n"
+
" \"deliveryProcessingAfterMinute\": 30,\n"
+
" \"deliveryProcessingBeforeMinute\": 30,\n"
+
" \"orderProgressBarStatus\": 2,\n"
+
" \"expandFields\": {\n"
+
" \"dispatchType\": \"0\",\n"
+
" \"monthlySalesShow\": \"0\",\n"
+
" \"progressBarStatus\": 2,\n"
+
" \"progressBarOrderNumber\": 0,\n"
+
" \"preOrderSwitch\": \"0\",\n"
+
" \"pickupPackageFeeSwitch\": \"1\",\n"
+
" \"dispatchConfig\": [],\n"
+
" \"deliveryPackageFeeSwitch\": \"1\",\n"
+
" \"monthlySalesConfigValue\": \"0\",\n"
+
" \"likesShow\": \"0\",\n"
+
" \"likesConfigValue\": \"0\",\n"
+
" \"processBarColorList\": \"\",\n"
+
" \"scanOrderSwitch\": \"0\",\n"
+
" \"progressBarProductUnit\": 1,\n"
+
" \"peakTimeDelivery\": [],\n"
+
" \"progressBarDetailStatus\": 1,\n"
+
" \"appendMinutePerKilometer\": \"0\",\n"
+
" \"progressBarPageList\": \"\"\n"
+
" },\n"
+
" \"orgIds\": null,\n"
+
" \"supportCashierPay\": 2,\n"
+
" \"processBarResponse\": null\n"
+
" },\n"
+
" \"parentUntilTop\": null,\n"
+
" \"storeImageList\": null,\n"
+
" \"storeBusyTimeInfoList\": null\n"
+
" }"
,
StoreMixResponseDto
.
class
)
createOrderBO
.
setStoreMixResponseDto
(
storeMixResponseDto
)
when:
"调用方法"
def
order
=
orderServiceImpl
.
sdkCreateOrder
(
createOrderBO
)
then:
"验证"
}
}
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