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
2383db62
Commit
2383db62
authored
Aug 10, 2020
by
huiyang.chen
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
parents
1f00783a
41358dfe
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
237 additions
and
243 deletions
+237
-243
assortment-ordercenter-sdk/pom.xml
+1
-1
assortment-ordercenter-sdk/readme.md
+3
-2
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
+25
-147
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/enums/OrderSourceType.java
+96
-31
assortment-ordercenter-sdk/src/test/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapterTest.java
+15
-3
assortment-shoppingcart-sdk/pom.xml
+2
-2
assortment-shoppingcart-sdk/readme.md
+2
-2
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/adapter/ShoppingCartAdapter.java
+3
-2
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/domain/CartGoods.java
+5
-0
shopping-cart-application-service/pom.xml
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
+17
-8
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/shoppingCart/ShoppingCartGoodsDto.java
+5
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
+7
-1
shopping-cart-application-service/src/main/java/cn/freemud/enums/ActivityTypeEnum.java
+1
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/DefaultPromotionService.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/MaterialPromotionService.java
+30
-26
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
+0
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
+11
-5
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
+9
-9
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/TimeSaleCalculation.java
+3
-2
No files found.
assortment-ordercenter-sdk/pom.xml
View file @
2383db62
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
assortment-ordercenter-sdk
</artifactId>
<artifactId>
assortment-ordercenter-sdk
</artifactId>
<version>
2.0.1
1
-SNAPSHOT
</version>
<version>
2.0.1
2
-SNAPSHOT
</version>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
...
...
assortment-ordercenter-sdk/readme.md
View file @
2383db62
...
@@ -79,4 +79,5 @@
...
@@ -79,4 +79,5 @@
| 2.0.7-SNAPSHOT| 围餐添加支付渠道字段 | 谌会阳 | 2020-07-23 |
| 2.0.7-SNAPSHOT| 围餐添加支付渠道字段 | 谌会阳 | 2020-07-23 |
| 2.0.8-SNAPSHOT| 加料商品 | 梁崇福 | 2020-07-27 |
| 2.0.8-SNAPSHOT| 加料商品 | 梁崇福 | 2020-07-27 |
| 2.0.9-SNAPSHOT| 新增修改取餐码接口| 谌会阳 |2020-08-08
| 2.0.9-SNAPSHOT| 新增修改取餐码接口| 谌会阳 |2020-08-08
| 2.0.11-SNAPSHOT| 麦咖啡| 谌会阳 |2020-08-08
| 2.0.11-SNAPSHOT| 麦咖啡| 谌会阳 |2020-08-08
\ No newline at end of file
| 2.0.12-SNAPSHOT| OrderSourceType 调整 | 谌会阳 |2020-08-10
\ No newline at end of file
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
View file @
2383db62
...
@@ -1284,161 +1284,39 @@ public class OrderSdkAdapter {
...
@@ -1284,161 +1284,39 @@ public class OrderSdkAdapter {
return
typeList
;
return
typeList
;
}
}
/**
* 字符串渠道码转对应数字类型渠道码
* saas->2
*
* @param name
* @return
*/
public
Integer
getNewOrderClient
(
String
name
)
{
public
Integer
getNewOrderClient
(
String
name
)
{
String
_name
=
OrderSourceType
.
SAAS
.
getCode
();
Integer
clientType
=
OrderSourceType
.
getClientByCode
(
name
);
Integer
orderClientType
;
return
clientType
;
switch
(
name
)
{
case
"saas"
:
orderClientType
=
2
;
break
;
case
"alipay"
:
orderClientType
=
3
;
break
;
case
"jdwm"
:
orderClientType
=
10
;
break
;
case
"mtwm"
:
orderClientType
=
11
;
break
;
case
"eleme"
:
orderClientType
=
8
;
break
;
case
"bdwm"
:
orderClientType
=
9
;
break
;
case
"ebwm"
:
orderClientType
=
9
;
break
;
case
"saas_member"
:
orderClientType
=
13
;
break
;
case
"saas_order"
:
orderClientType
=
14
;
break
;
case
"pos"
:
orderClientType
=
15
;
break
;
case
"meal"
:
orderClientType
=
19
;
break
;
case
"saasmall"
:
orderClientType
=
23
;
break
;
case
"app"
:
orderClientType
=
12
;
break
;
case
"fmwd"
:
orderClientType
=
25
;
break
;
case
"parking"
:
orderClientType
=
99
;
break
;
default
:
orderClientType
=
OrderClientType
.
SAAS
.
getIndex
();
break
;
}
return
orderClientType
;
}
}
/**
* 数字类型渠道码转字符类型渠道码
* 2->saas
*
* @param orderClientType
* @return
*/
public
String
getOldSource
(
Integer
orderClientType
)
{
public
String
getOldSource
(
Integer
orderClientType
)
{
String
name
=
""
;
String
name
=
OrderSourceType
.
getCodeByClientType
(
orderClientType
);
switch
(
orderClientType
)
{
case
2
:
name
=
"saas"
;
break
;
case
3
:
name
=
"alipay"
;
break
;
case
10
:
name
=
"jdwm"
;
break
;
case
11
:
name
=
"mtwm"
;
break
;
case
8
:
name
=
"eleme"
;
break
;
case
9
:
name
=
"bdwm"
;
break
;
case
13
:
name
=
"saas_member"
;
break
;
case
14
:
name
=
"saas_order"
;
break
;
case
15
:
name
=
"pos"
;
break
;
case
19
:
name
=
"meals"
;
break
;
case
23
:
name
=
"saasmall"
;
break
;
case
12
:
name
=
"app"
;
break
;
case
25
:
name
=
"fmwd"
;
break
;
case
99
:
name
=
"parking"
;
break
;
default
:
name
=
orderClientType
.
toString
();
break
;
}
return
name
;
return
name
;
}
}
/**
* 数字类型渠道码转字符类型渠道码注释
* 2-> saas 点餐
*
* @param orderClientType
* @return
*/
public
String
getOldSourceName
(
Integer
orderClientType
)
{
public
String
getOldSourceName
(
Integer
orderClientType
)
{
String
name
=
""
;
String
name
=
OrderSourceType
.
getDescByClientType
(
orderClientType
);
switch
(
orderClientType
)
{
case
2
:
name
=
"saas 点餐"
;
break
;
case
3
:
name
=
"支付宝"
;
break
;
case
10
:
name
=
"京东"
;
break
;
case
11
:
name
=
"美团外卖"
;
break
;
case
8
:
name
=
"饿了么"
;
break
;
case
9
:
name
=
"饿百"
;
break
;
case
13
:
name
=
"i 会员订单"
;
break
;
case
15
:
name
=
"pos"
;
break
;
case
19
:
name
=
"saas 围餐"
;
break
;
case
23
:
name
=
"saas 商城"
;
break
;
case
12
:
name
=
"APP"
;
break
;
case
25
:
name
=
"非码微店"
;
break
;
case
99
:
name
=
"农工商停车"
;
break
;
default
:
break
;
}
return
name
;
return
name
;
}
}
...
...
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/enums/OrderSourceType.java
View file @
2383db62
...
@@ -12,44 +12,101 @@
...
@@ -12,44 +12,101 @@
*/
*/
package
com
.
freemud
.
sdk
.
api
.
assortment
.
order
.
enums
;
package
com
.
freemud
.
sdk
.
api
.
assortment
.
order
.
enums
;
public
enum
OrderSourceType
{
import
org.apache.commons.lang.StringUtils
;
BDWM
(
"bdwm"
,
"百度外卖"
),
JDWM
(
"jdwm"
,
"京东到家"
),
MTWM
(
"mtwm"
,
"美团外卖"
),
SDG
(
"sdg"
,
"闪电购"
),
ELEME
(
"eleme"
,
"饿了么外卖"
),
FMWD
(
"fmwd"
,
"非码微店"
),
MALL
(
"mall"
,
"非码Mall"
),
SAAS
(
"saas"
,
"saas 点餐"
),
POS
(
"pos"
,
"线下 POS"
),
MEAL
(
"meal"
,
"i围餐"
),
ALIPAY
(
"alipay"
,
"支付宝"
),
SAASMALL
(
"saasmall"
,
"微商城"
),
APP
(
"app"
,
"APP"
),
public
enum
OrderSourceType
{
WE_CHAT
(
"we_chat"
,
"自营微信小程序"
,
1
),
PARKING
(
"parking"
,
"农工商停车"
),
SAAS
(
"saas"
,
"saas 点餐"
,
2
),
;
ALIPAY
(
"alipay"
,
"支付宝"
,
3
),
HTML5
(
"html5"
,
"自营H5"
,
4
),
ANDROID
(
"android"
,
"自营安卓APP"
,
5
),
IOS
(
"ios"
,
"自营苹果APP"
,
6
),
PC_WEB
(
"pcweb"
,
"自营PC-WEB"
,
7
),
ELEME
(
"eleme"
,
"饿了么外卖"
,
8
),
EBAI
(
"ebwm"
,
"饿百外卖"
,
9
),
JDWM
(
"jdwm"
,
"京东到家"
,
10
),
MTWM
(
"mtwm"
,
"美团外卖"
,
11
),
APP
(
"app"
,
"APP"
,
12
),
I_MEMBER
(
"imember"
,
"i 会员订单"
,
13
),
I_CARGO
(
"icargo"
,
"i应用订货"
,
14
),
POS
(
"pos"
,
"线下 POS"
,
15
),
BDWM
(
"bdwm"
,
"百度外卖"
,
16
),
IPINTUAN
(
"ipintuan"
,
"i拼团"
,
18
),
MEAL
(
"meal"
,
"i围餐"
,
19
),
JUBAOPEN
(
"jbp"
,
"美团聚宝盆"
,
20
),
DIANPING
(
"dp"
,
"美团点评"
,
21
),
KOUBEI
(
"koubeiwaimai"
,
"口碑外卖"
,
22
),
MALL
(
"mall"
,
"非码Mall"
,
23
),
SAASMALL
(
"saasmall"
,
"微商城"
,
23
),
DPZHCT
(
"dpzhct"
,
"美团点评智慧餐厅"
,
24
),
FMWD
(
"fmwd"
,
"非码微店"
,
25
),
Y_POS
(
"ypos"
,
"非码云POS"
,
26
),
parkingmanual
(
"parkingmanual"
,
"农工商停车手工录单"
,
98
),
PARKING
(
"parking"
,
"农工商停车"
,
99
),
SDG
(
"sdg"
,
"闪电购"
,
1000
);
private
String
code
;
private
String
code
;
private
String
desc
;
private
String
desc
;
private
Integer
clientType
;
OrderSourceType
(
String
code
,
String
desc
)
{
OrderSourceType
(
String
code
,
String
desc
,
Integer
clientType
)
{
this
.
code
=
code
;
this
.
code
=
code
;
this
.
desc
=
desc
;
this
.
desc
=
desc
;
this
.
clientType
=
clientType
;
}
/**
* 字符串渠道码转对应数字类型渠道码
*
* @param code
* @return
*/
static
public
Integer
getClientByCode
(
String
code
)
{
Integer
client
=
OrderSourceType
.
SAAS
.
getClientType
();
if
(
StringUtils
.
isBlank
(
code
))
return
client
;
for
(
OrderSourceType
value
:
OrderSourceType
.
values
())
{
if
(
value
.
getCode
().
equals
(
code
.
toLowerCase
()))
{
client
=
value
.
getClientType
();
break
;
}
}
return
client
;
}
/**
* 数字类型渠道码转字符类型渠道码
*
* @param clientType
* @return
*/
static
public
String
getCodeByClientType
(
Integer
clientType
)
{
String
name
=
""
;
for
(
OrderSourceType
value
:
OrderSourceType
.
values
())
{
if
(
value
.
getClientType
().
equals
(
clientType
))
{
name
=
value
.
getCode
();
break
;
}
}
if
(
StringUtils
.
isBlank
(
name
))
name
=
clientType
.
toString
();
return
name
;
}
/**
* 数字类型渠道码转字符类型渠道码注释
*
* @param clientType
* @return
*/
static
public
String
getDescByClientType
(
Integer
clientType
)
{
String
name
=
""
;
for
(
OrderSourceType
value
:
OrderSourceType
.
values
())
{
if
(
value
.
getClientType
().
equals
(
clientType
))
{
name
=
value
.
getDesc
();
break
;
}
}
if
(
StringUtils
.
isBlank
(
name
))
name
=
clientType
.
toString
();
return
name
;
}
}
public
String
getCode
()
{
public
String
getCode
()
{
...
@@ -67,4 +124,12 @@ public enum OrderSourceType {
...
@@ -67,4 +124,12 @@ public enum OrderSourceType {
public
void
setDesc
(
String
desc
)
{
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
this
.
desc
=
desc
;
}
}
public
Integer
getClientType
()
{
return
clientType
;
}
public
void
setClientType
(
Integer
clientType
)
{
this
.
clientType
=
clientType
;
}
}
}
assortment-ordercenter-sdk/src/test/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapterTest.java
View file @
2383db62
...
@@ -3,6 +3,7 @@ package com.freemud.sdk.api.assortment.order.adapter;
...
@@ -3,6 +3,7 @@ package com.freemud.sdk.api.assortment.order.adapter;
import
com.freemud.application.sdk.api.ordercenter.request.OrderTraceInfoResp
;
import
com.freemud.application.sdk.api.ordercenter.request.OrderTraceInfoResp
;
import
com.freemud.application.sdk.api.ordercenter.response.BaseResponse
;
import
com.freemud.application.sdk.api.ordercenter.response.BaseResponse
;
import
com.freemud.application.sdk.api.ordercenter.response.orderInfo.*
;
import
com.freemud.application.sdk.api.ordercenter.response.orderInfo.*
;
import
com.freemud.sdk.api.assortment.order.enums.OrderSourceType
;
import
com.freemud.sdk.api.assortment.order.response.order.QueryOrdersResponse
;
import
com.freemud.sdk.api.assortment.order.response.order.QueryOrdersResponse
;
import
com.freemud.sdk.api.assortment.order.response.order.QueryRelatedOrderByCodeResp
;
import
com.freemud.sdk.api.assortment.order.response.order.QueryRelatedOrderByCodeResp
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -137,12 +138,22 @@ public class OrderSdkAdapterTest {
...
@@ -137,12 +138,22 @@ public class OrderSdkAdapterTest {
List
<
QueryOrdersResponse
.
DataBean
.
OrderBean
>
lists
=
queryRelatedOrderByCodeResp
.
getOrderBeanList
();
List
<
QueryOrdersResponse
.
DataBean
.
OrderBean
>
lists
=
queryRelatedOrderByCodeResp
.
getOrderBeanList
();
assert
(
lists
.
size
()
==
1
);
assert
(
lists
.
size
()
==
1
);
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
=
lists
.
get
(
0
);
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
=
lists
.
get
(
0
);
assert
(
"12314123"
.
equals
(
orderBean
.
getThirdOrderCode
()));
assert
(
"12314123"
.
equals
(
orderBean
.
getThirdOrderCode
()));
assert
(
orderBean
.
getAfterSalesOrderResp
()
!=
null
);
assert
(
orderBean
.
getAfterSalesOrderResp
()
!=
null
);
}
@Test
public
void
orderSourceType
()
{
//通过字符渠道码获取数字类型渠道码
System
.
out
.
println
(
"通过字符渠道码获取数字类型渠道码:"
+
OrderSourceType
.
getClientByCode
(
"1saas"
));
//通过数字渠道码获取对应的字符渠道码
System
.
out
.
println
(
"通过数字渠道码获取对应的字符渠道码:"
+
OrderSourceType
.
getCodeByClientType
(
10
));
//通过数字渠道码获取对应的注释
System
.
out
.
println
(
"通过数字渠道码获取对应的注释:"
+
OrderSourceType
.
getDescByClientType
(
12
));
}
}
}
}
\ No newline at end of file
assortment-shoppingcart-sdk/pom.xml
View file @
2383db62
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
assortment-shoppingcart-sdk
</artifactId>
<artifactId>
assortment-shoppingcart-sdk
</artifactId>
<version>
1.
1.9
-SNAPSHOT
</version>
<version>
1.
2.0
-SNAPSHOT
</version>
<dependencies>
<dependencies>
<dependency>
<dependency>
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
<dependency>
<dependency>
<groupId>
com.freemud.application.service.sdk
</groupId>
<groupId>
com.freemud.application.service.sdk
</groupId>
<artifactId>
productcenter-sdk
</artifactId>
<artifactId>
productcenter-sdk
</artifactId>
<version>
3.
5.4-
SNAPSHOT
</version>
<version>
3.
6.4.
SNAPSHOT
</version>
<scope>
provided
</scope>
<scope>
provided
</scope>
</dependency>
</dependency>
<dependency>
<dependency>
...
...
assortment-shoppingcart-sdk/readme.md
View file @
2383db62
...
@@ -6,4 +6,4 @@
...
@@ -6,4 +6,4 @@
| 1.1.2-SNAPSHOT| 券码接口新增参数:channelCodeList | 梁崇福 | 2020-05-13 |
| 1.1.2-SNAPSHOT| 券码接口新增参数:channelCodeList | 梁崇福 | 2020-05-13 |
| 1.1.4-SNAPSHOT| 券码接口修改为channel_codes | 梁崇福 | 2020-06-08 |
| 1.1.4-SNAPSHOT| 券码接口修改为channel_codes | 梁崇福 | 2020-06-08 |
| 1.1.5-SNAPSHOT| 增加统计分类编号:classificationId,classificationName | | 2020-06-12 |
| 1.1.5-SNAPSHOT| 增加统计分类编号:classificationId,classificationName | | 2020-06-12 |
| 1.1.9-SNAPSHOT| 加料 | 李小二 | 2020-07-30 |
| 1.2.0-SNAPSHOT| 加料 | 李小二 | 2020-07-30 |
\ No newline at end of file
\ No newline at end of file
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/adapter/ShoppingCartAdapter.java
View file @
2383db62
...
@@ -283,6 +283,7 @@ public class ShoppingCartAdapter {
...
@@ -283,6 +283,7 @@ public class ShoppingCartAdapter {
cartGoods
.
setMemberDiscount
(
spuProduct
.
getMemberDiscountResult
());
cartGoods
.
setMemberDiscount
(
spuProduct
.
getMemberDiscountResult
());
cartGoods
.
setClassificationId
(
spuProduct
.
getCategory
());
cartGoods
.
setClassificationId
(
spuProduct
.
getCategory
());
cartGoods
.
setClassificationName
(
spuProduct
.
getCategoryName
());
cartGoods
.
setClassificationName
(
spuProduct
.
getCategoryName
());
cartGoods
.
setTax
(
spuProduct
.
getTax
());
String
skuSpecName
=
""
;
String
skuSpecName
=
""
;
if
(
isSkuProduct
&&
CollectionUtils
.
isNotEmpty
(
skuProduct
.
getSkuSpecValues
()))
{
if
(
isSkuProduct
&&
CollectionUtils
.
isNotEmpty
(
skuProduct
.
getSkuSpecValues
()))
{
List
<
String
>
skuSpecValus
=
skuProduct
.
getSkuSpecValues
().
stream
().
map
(
p
->
p
.
getSpecValue
()).
collect
(
Collectors
.
toList
());
List
<
String
>
skuSpecValus
=
skuProduct
.
getSkuSpecValues
().
stream
().
map
(
p
->
p
.
getSpecValue
()).
collect
(
Collectors
.
toList
());
...
@@ -378,8 +379,8 @@ public class ShoppingCartAdapter {
...
@@ -378,8 +379,8 @@ public class ShoppingCartAdapter {
cartGoods
.
setMaterialAmount
(
materialAmount
);
cartGoods
.
setMaterialAmount
(
materialAmount
);
//加料行记录原价总价
//加料行记录原价总价
cartGoods
.
setOriginalMaterialAmount
(
originalMaterAmount
);
cartGoods
.
setOriginalMaterialAmount
(
originalMaterAmount
);
cartGoods
.
setOriginalAmount
(
cartGoods
.
getOriginalAmount
()
+
originalMaterAmount
);
//
cartGoods.setOriginalAmount(cartGoods.getOriginalAmount() + originalMaterAmount);
cartGoods
.
setSubName
(
StringUtils
.
strip
(
materialSubName
,
"/"
));
//
cartGoods.setSubName(StringUtils.strip(materialSubName, "/"));
}
}
private
boolean
updateComboxGoodsInfo
(
CartGoods
cartGoods
,
CartGoods
.
ComboxGoods
comboxGoods
,
ProductBeanDTO
parentProductBean
,
List
<
ProductBeanDTO
>
productBeans
,
CartGoodsStates
cartGoodsStates
,
List
<
String
>
invalidGoodsIdList
)
{
private
boolean
updateComboxGoodsInfo
(
CartGoods
cartGoods
,
CartGoods
.
ComboxGoods
comboxGoods
,
ProductBeanDTO
parentProductBean
,
List
<
ProductBeanDTO
>
productBeans
,
CartGoodsStates
cartGoodsStates
,
List
<
String
>
invalidGoodsIdList
)
{
...
...
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/domain/CartGoods.java
View file @
2383db62
...
@@ -164,6 +164,11 @@ public class CartGoods {
...
@@ -164,6 +164,11 @@ public class CartGoods {
private
Integer
memberDiscount
;
private
Integer
memberDiscount
;
/**
/**
* 税率 缓存
*/
private
Double
tax
;
/**
* 套餐固定商品
* 套餐固定商品
*/
*/
private
List
<
ComboxGoods
>
productComboList
;
private
List
<
ComboxGoods
>
productComboList
;
...
...
shopping-cart-application-service/pom.xml
View file @
2383db62
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
<dependency>
<dependency>
<groupId>
cn.freemud
</groupId>
<groupId>
cn.freemud
</groupId>
<artifactId>
assortment-shoppingcart-sdk
</artifactId>
<artifactId>
assortment-shoppingcart-sdk
</artifactId>
<version>
1.
1.9
-SNAPSHOT
</version>
<version>
1.
2.0
-SNAPSHOT
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.freemud.application.service.sdk
</groupId>
<groupId>
com.freemud.application.service.sdk
</groupId>
...
...
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
View file @
2383db62
...
@@ -85,7 +85,8 @@ public class ShoppingCartConvertAdapter {
...
@@ -85,7 +85,8 @@ public class ShoppingCartConvertAdapter {
// 设置基础信息
// 设置基础信息
ShoppingCartGoodsDto
.
CartGoodsDetailDto
cartGoodsDetailDto
=
new
ShoppingCartGoodsDto
.
CartGoodsDetailDto
();
ShoppingCartGoodsDto
.
CartGoodsDetailDto
cartGoodsDetailDto
=
new
ShoppingCartGoodsDto
.
CartGoodsDetailDto
();
cartGoodsDetailDto
.
setCartGoodsUid
(
cartGoods
.
getCartGoodsUid
());
cartGoodsDetailDto
.
setCartGoodsUid
(
cartGoods
.
getCartGoodsUid
());
cartGoodsDetailDto
.
setTas
(
0.02d
);
cartGoodsDetailDto
.
setTasId
(
"1234"
);
cartGoodsDetailDto
.
setTas
(
cartGoods
.
getTax
());
cartGoodsDetailDto
.
setSpuId
(
cartGoods
.
getSpuId
());
cartGoodsDetailDto
.
setSpuId
(
cartGoods
.
getSpuId
());
cartGoodsDetailDto
.
setSpuName
(
cartGoods
.
getSpuName
());
cartGoodsDetailDto
.
setSpuName
(
cartGoods
.
getSpuName
());
cartGoodsDetailDto
.
setSkuId
(
StringUtils
.
isEmpty
(
cartGoods
.
getSkuId
())
?
cartGoods
.
getSpuId
()
:
cartGoods
.
getSkuId
());
cartGoodsDetailDto
.
setSkuId
(
StringUtils
.
isEmpty
(
cartGoods
.
getSkuId
())
?
cartGoods
.
getSpuId
()
:
cartGoods
.
getSkuId
());
...
@@ -135,7 +136,8 @@ public class ShoppingCartConvertAdapter {
...
@@ -135,7 +136,8 @@ public class ShoppingCartConvertAdapter {
||
ObjectUtils
.
equals
(
ActivityTypeEnum
.
TYPE_62
.
getCode
(),
cartGoods
.
getActivityType
()))
{
||
ObjectUtils
.
equals
(
ActivityTypeEnum
.
TYPE_62
.
getCode
(),
cartGoods
.
getActivityType
()))
{
cartGoodsDetailDto
.
setTotalDiscountAmount
(
cartGoods
.
getOriginalAmount
().
intValue
()
-
cartGoods
.
getAmount
().
intValue
());
cartGoodsDetailDto
.
setTotalDiscountAmount
(
cartGoods
.
getOriginalAmount
().
intValue
()
-
cartGoods
.
getAmount
().
intValue
());
}
else
{
}
else
{
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
>
collect
=
apportionGoodsList
.
stream
().
filter
(
a
->
ObjectUtils
.
equals
(
cartGoods
.
getSkuId
(),
a
.
getGoodsId
())
||
ObjectUtils
.
equals
(
cartGoods
.
getSpuId
(),
a
.
getGoodsId
())).
collect
(
Collectors
.
toList
());
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
>
collect
=
apportionGoodsList
.
stream
().
filter
(
a
->
ObjectUtils
.
equals
(
cartGoods
.
getCartGoodsUid
(),
a
.
getCartGoodsUid
())).
collect
(
Collectors
.
toList
());
//List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.ApportionGoods> collect = apportionGoodsList.stream().filter(a -> ObjectUtils.equals(cartGoods.getSkuId(), a.getGoodsId()) || ObjectUtils.equals(cartGoods.getSpuId(), a.getGoodsId())).collect(Collectors.toList());
if
(
CollectionUtils
.
isNotEmpty
(
collect
))
{
if
(
CollectionUtils
.
isNotEmpty
(
collect
))
{
setTotalDiscountAndSalePrice
(
collect
,
cartGoodsDetailDto
,
duplicateGoodsMap
);
setTotalDiscountAndSalePrice
(
collect
,
cartGoodsDetailDto
,
duplicateGoodsMap
);
// 设置商品行,优惠活动均摊
// 设置商品行,优惠活动均摊
...
@@ -173,6 +175,7 @@ public class ShoppingCartConvertAdapter {
...
@@ -173,6 +175,7 @@ public class ShoppingCartConvertAdapter {
}
}
/**
/**
* 活动级别的促销均摊
* 获取当前商品的售后价格
* 获取当前商品的售后价格
*
*
* @param apportionGoodsList 促销均摊列表
* @param apportionGoodsList 促销均摊列表
...
@@ -188,19 +191,19 @@ public class ShoppingCartConvertAdapter {
...
@@ -188,19 +191,19 @@ public class ShoppingCartConvertAdapter {
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
apportionGoods
:
apportionGoodsList
)
{
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
apportionGoods
:
apportionGoodsList
)
{
//折扣=所有折扣和*百分比(当前行商品数量/购物车总商品数量)
//折扣=所有折扣和*百分比(当前行商品数量/购物车总商品数量)
discountPrice
+=
apportionGoods
.
getApportionDetails
().
stream
().
filter
(
d
->
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_32
.
getCode
(),
d
.
getActivityType
())
discountPrice
+=
apportionGoods
.
getApportionDetails
().
stream
().
filter
(
d
->
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_32
.
getCode
(),
d
.
getActivityType
())
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_104
.
getCode
(),
d
.
getActivityType
())
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_104
.
getCode
(),
d
.
getActivityType
())
//X件Y折
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_2
.
getCode
(),
d
.
getActivityType
())
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_2
.
getCode
(),
d
.
getActivityType
())
//单品特价
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_21
.
getCode
(),
d
.
getActivityType
())
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_21
.
getCode
(),
d
.
getActivityType
())
//单品折扣
).
mapToLong
(
t
->
t
.
getActivityApportionAmount
()
*
apportionGoods
.
getGoodsQuantity
()).
sum
()
*
cartGoodsDetailDto
.
getQty
()
/
goodsTotalQty
;
).
mapToLong
(
t
->
t
.
getActivityApportionAmount
()
*
apportionGoods
.
getGoodsQuantity
()).
sum
()
*
cartGoodsDetailDto
.
getQty
()
/
goodsTotalQty
;
}
}
String
currentGoodsIdMap
=
duplicateGoodsMap
.
get
(
cartGoodsDetailDto
.
get
SkuI
d
());
String
currentGoodsIdMap
=
duplicateGoodsMap
.
get
(
cartGoodsDetailDto
.
get
CartGoodsUi
d
());
if
(
currentGoodsIdMap
!=
null
)
{
if
(
currentGoodsIdMap
!=
null
)
{
String
[]
value
=
currentGoodsIdMap
.
split
(
","
);
String
[]
value
=
currentGoodsIdMap
.
split
(
","
);
//不是最后一行商品,折扣为discountPrice
//不是最后一行商品,折扣为discountPrice
if
(
Integer
.
parseInt
(
value
[
0
])
>
1
)
{
if
(
Integer
.
parseInt
(
value
[
0
])
>
1
)
{
int
totalDiscountPrice
=
Integer
.
parseInt
(
value
[
1
])
+
discountPrice
.
intValue
();
int
totalDiscountPrice
=
Integer
.
parseInt
(
value
[
1
])
+
discountPrice
.
intValue
();
int
index
=
Integer
.
parseInt
(
value
[
0
])
-
1
;
int
index
=
Integer
.
parseInt
(
value
[
0
])
-
1
;
duplicateGoodsMap
.
put
(
cartGoodsDetailDto
.
get
SkuI
d
(),
String
.
format
(
"%s,%s"
,
index
,
totalDiscountPrice
));
duplicateGoodsMap
.
put
(
cartGoodsDetailDto
.
get
CartGoodsUi
d
(),
String
.
format
(
"%s,%s"
,
index
,
totalDiscountPrice
));
}
else
{
}
else
{
//最后一行
//最后一行
Long
totalDiscountAmount
=
0L
;
Long
totalDiscountAmount
=
0L
;
...
@@ -445,4 +448,9 @@ public class ShoppingCartConvertAdapter {
...
@@ -445,4 +448,9 @@ public class ShoppingCartConvertAdapter {
String
skuId
=
StringUtils
.
isNotBlank
(
addShoppingCartGoodsRequestVo
.
getSkuId
())
?
addShoppingCartGoodsRequestVo
.
getSkuId
()
:
""
;
String
skuId
=
StringUtils
.
isNotBlank
(
addShoppingCartGoodsRequestVo
.
getSkuId
())
?
addShoppingCartGoodsRequestVo
.
getSkuId
()
:
""
;
addShoppingCartGoodsRequestVo
.
setSkuId
(
skuId
);
addShoppingCartGoodsRequestVo
.
setSkuId
(
skuId
);
}
}
}
public
String
jointPk
(
String
a
,
String
b
)
{
StringBuffer
stringBuffer
=
new
StringBuffer
();
return
stringBuffer
.
append
(
a
).
append
(
b
).
toString
();
}
}
\ No newline at end of file
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/shoppingCart/ShoppingCartGoodsDto.java
View file @
2383db62
...
@@ -228,6 +228,11 @@ public class ShoppingCartGoodsDto {
...
@@ -228,6 +228,11 @@ public class ShoppingCartGoodsDto {
private
String
classificationName
;
private
String
classificationName
;
/**
/**
* 税率代码
*/
private
String
tasId
;
/**
* 税率
* 税率
*/
*/
private
Double
tas
;
private
Double
tas
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
View file @
2383db62
...
@@ -163,6 +163,12 @@ public class CartGoods {
...
@@ -163,6 +163,12 @@ public class CartGoods {
* 例如8折为80
* 例如8折为80
*/
*/
private
Integer
memberDiscount
;
private
Integer
memberDiscount
;
/**
* 费率
*/
private
Double
tax
;
/**
/**
* 套餐固定商品
* 套餐固定商品
*/
*/
...
@@ -173,7 +179,7 @@ public class CartGoods {
...
@@ -173,7 +179,7 @@ public class CartGoods {
private
List
<
ComboxGoods
>
productGroupList
;
private
List
<
ComboxGoods
>
productGroupList
;
/**
/**
* 商品
加料
* 商品
原始加料数据
*/
*/
private
List
<
MaterialGoods
>
productMaterialList
;
private
List
<
MaterialGoods
>
productMaterialList
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/enums/ActivityTypeEnum.java
View file @
2383db62
...
@@ -25,6 +25,7 @@ public enum ActivityTypeEnum {
...
@@ -25,6 +25,7 @@ public enum ActivityTypeEnum {
*/
*/
TYPE_2
(
2
,
"单品特价"
),
TYPE_2
(
2
,
"单品特价"
),
TYPE_21
(
21
,
"单品折扣"
),
TYPE_21
(
21
,
"单品折扣"
),
TYPE_23
(
23
,
"超值加购"
),
/**
/**
* 优惠券
* 优惠券
*/
*/
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/DefaultPromotionService.java
View file @
2383db62
...
@@ -86,7 +86,7 @@ public class DefaultPromotionService implements IPromotionService {
...
@@ -86,7 +86,7 @@ public class DefaultPromotionService implements IPromotionService {
calculationDiscountResult
==
null
?
new
ArrayList
<>()
:
calculationDiscountResult
.
getApportionGoods
();
calculationDiscountResult
==
null
?
new
ArrayList
<>()
:
calculationDiscountResult
.
getApportionGoods
();
Map
<
String
,
String
>
duplicateGoodsMap
=
new
HashMap
<>();
Map
<
String
,
String
>
duplicateGoodsMap
=
new
HashMap
<>();
cartGoodsList
.
stream
().
collect
(
Collectors
.
groupingBy
(
CartGoods:
:
get
GoodsI
d
,
Collectors
.
counting
())).
forEach
((
goodsId
,
count
)
->
{
cartGoodsList
.
stream
().
collect
(
Collectors
.
groupingBy
(
CartGoods:
:
get
CartGoodsUi
d
,
Collectors
.
counting
())).
forEach
((
goodsId
,
count
)
->
{
duplicateGoodsMap
.
put
(
goodsId
,
String
.
format
(
"%s,0"
,
count
));
duplicateGoodsMap
.
put
(
goodsId
,
String
.
format
(
"%s,0"
,
count
));
});
});
for
(
int
i
=
0
,
len
=
cartGoodsList
.
size
();
i
<
len
;
i
++)
{
for
(
int
i
=
0
,
len
=
cartGoodsList
.
size
();
i
<
len
;
i
++)
{
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/MaterialPromotionService.java
View file @
2383db62
package
cn
.
freemud
.
service
.
impl
;
package
cn
.
freemud
.
service
.
impl
;
import
cn.freemud.adapter.ShoppingCartConvertAdapter
;
import
cn.freemud.entities.dto.ActivityCalculationDiscountResponseDto
;
import
cn.freemud.entities.dto.ActivityCalculationDiscountResponseDto
;
import
cn.freemud.entities.dto.UserLoginInfoDto
;
import
cn.freemud.entities.dto.UserLoginInfoDto
;
import
cn.freemud.entities.dto.activity.ActivityDiscountsDto
;
import
cn.freemud.entities.dto.activity.ActivityDiscountsDto
;
...
@@ -10,6 +11,7 @@ import cn.freemud.enums.GoodsTypeEnum;
...
@@ -10,6 +11,7 @@ import cn.freemud.enums.GoodsTypeEnum;
import
cn.freemud.service.IPromotionService
;
import
cn.freemud.service.IPromotionService
;
import
lombok.Data
;
import
lombok.Data
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -28,7 +30,8 @@ import java.util.List;
...
@@ -28,7 +30,8 @@ import java.util.List;
*/
*/
@Service
(
"MaterialPromotionService"
)
@Service
(
"MaterialPromotionService"
)
public
class
MaterialPromotionService
implements
IPromotionService
{
public
class
MaterialPromotionService
implements
IPromotionService
{
@Autowired
private
ShoppingCartConvertAdapter
shoppingCartConvertAdapter
;
/**
/**
* 总优惠和总原价促进已经计算过了,这里只需要累积行记录
* 总优惠和总原价促进已经计算过了,这里只需要累积行记录
* 加料优惠金额
* 加料优惠金额
...
@@ -43,31 +46,22 @@ public class MaterialPromotionService implements IPromotionService {
...
@@ -43,31 +46,22 @@ public class MaterialPromotionService implements IPromotionService {
*/
*/
@Override
@Override
public
void
updateShoppingCartGoodsDiscount
(
CouponPromotionVO
couponPromotionVO
,
ActivityQueryDto
activityQueryDto
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
,
List
<
CartGoods
>
cartGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
,
UserLoginInfoDto
userLoginInfoDto
,
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
)
{
public
void
updateShoppingCartGoodsDiscount
(
CouponPromotionVO
couponPromotionVO
,
ActivityQueryDto
activityQueryDto
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
,
List
<
CartGoods
>
cartGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
,
UserLoginInfoDto
userLoginInfoDto
,
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
)
{
HashMap
<
String
,
MaterialApportion
>
map
=
getApportionGoodsDetail
(
calculationDiscountResult
);
if
(
map
.
size
()
>
0
)
{
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
if
(
CollectionUtils
.
isEmpty
(
cartGoods
.
getProductMaterialList
()))
continue
;
for
(
CartGoods
.
MaterialGoods
materialGoods
:
cartGoods
.
getProductMaterialList
())
{
MaterialApportion
apportion
=
map
.
get
(
materialGoods
.
getSpuId
());
//设置小料行单价和行总价
materialGoods
.
setFinalPrice
(
apportion
.
getSalePrice
());
materialGoods
.
setAmount
(
apportion
.
getAmount
());
}
}
}
long
materialAmount
=
0L
,
materialOriginal
=
0L
;
long
materialAmount
=
0L
,
materialOriginal
=
0L
;
//todo : 加料和商品成交价不需要累计 分开显示
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
if
(
CollectionUtils
.
isEmpty
(
cartGoods
.
getProductMaterialList
()))
continue
;
if
(
CollectionUtils
.
isEmpty
(
cartGoods
.
getProductMaterialList
()))
continue
;
materialAmount
=
0L
;
materialAmount
=
0L
;
materialOriginal
=
0L
;
materialOriginal
=
0L
;
for
(
CartGoods
.
MaterialGoods
materialGoods
:
cartGoods
.
getProductMaterialList
())
{
for
(
CartGoods
.
MaterialGoods
materialGoods
:
cartGoods
.
getProductMaterialList
())
{
materialAmount
+=
materialGoods
.
getAmount
();
//materialAmount += materialGoods.getFinalPrice()*cartGoods.getQty();
materialOriginal
+=
materialGoods
.
getOriginalPrice
()
*
cartGoods
.
getQty
();
//materialOriginal += materialGoods.getOriginalPrice() * cartGoods.getQty();
materialGoods
.
setAmount
(
materialGoods
.
getFinalPrice
()
*
cartGoods
.
getQty
());
materialGoods
.
setOriginalAmount
(
materialGoods
.
getOriginalPrice
()
*
cartGoods
.
getQty
());
}
}
//设置商品行现总价\行原价 商品总价+小料商品总价
//设置商品行现总价\行原价 商品总价+小料商品总价
cartGoods
.
setAmount
(
cartGoods
.
getAmount
()
+
materialAmount
);
//
cartGoods.setAmount(cartGoods.getAmount() + materialAmount);
cartGoods
.
setOriginalAmount
(
cartGoods
.
getOriginalAmount
()
+
materialOriginal
);
//
cartGoods.setOriginalAmount(cartGoods.getOriginalAmount() + materialOriginal);
}
}
}
}
...
@@ -85,11 +79,13 @@ public class MaterialPromotionService implements IPromotionService {
...
@@ -85,11 +79,13 @@ public class MaterialPromotionService implements IPromotionService {
HashMap
<
String
,
MaterialApportion
>
map
=
getApportionGoodsDetail
(
calculationDiscountResult
);
HashMap
<
String
,
MaterialApportion
>
map
=
getApportionGoodsDetail
(
calculationDiscountResult
);
List
<
ShoppingCartGoodsDto
.
CartGoodsDetailDto
>
products
=
shoppingCartGoodsDto
.
getProducts
();
List
<
ShoppingCartGoodsDto
.
CartGoodsDetailDto
>
products
=
shoppingCartGoodsDto
.
getProducts
();
if
(
map
.
size
()
>
0
)
{
if
(
map
.
size
()
>
0
)
{
String
pk
=
""
;
for
(
ShoppingCartGoodsDto
.
CartGoodsDetailDto
product
:
products
)
{
for
(
ShoppingCartGoodsDto
.
CartGoodsDetailDto
product
:
products
)
{
if
(
CollectionUtils
.
isEmpty
(
product
.
getMaterialList
()))
continue
;
if
(
CollectionUtils
.
isEmpty
(
product
.
getMaterialList
()))
continue
;
for
(
ShoppingCartGoodsDto
.
CartGoodsDetailDto
.
MaterialGoods
materialGoods
:
product
.
getMaterialList
())
{
for
(
ShoppingCartGoodsDto
.
CartGoodsDetailDto
.
MaterialGoods
materialGoods
:
product
.
getMaterialList
())
{
MaterialApportion
material
=
map
.
get
(
materialGoods
.
getSpuId
());
pk
=
shoppingCartConvertAdapter
.
jointPk
(
product
.
getCartGoodsUid
(),
materialGoods
.
getSpuId
());
if
(
material
.
getApportionAmount
().
intValue
()
==
0
)
continue
;
MaterialApportion
material
=
map
.
get
(
pk
);
if
(
material
!=
null
&&
material
.
getApportionAmount
().
intValue
()
==
0
)
continue
;
//设置行记录参加的活动及总优惠
//设置行记录参加的活动及总优惠
ActivityDiscountsDto
activityDiscountsDto
=
new
ActivityDiscountsDto
();
ActivityDiscountsDto
activityDiscountsDto
=
new
ActivityDiscountsDto
();
List
<
ActivityDiscountsDto
>
activityDiscountsDtoList
=
new
ArrayList
<>();
List
<
ActivityDiscountsDto
>
activityDiscountsDtoList
=
new
ArrayList
<>();
...
@@ -100,7 +96,8 @@ public class MaterialPromotionService implements IPromotionService {
...
@@ -100,7 +96,8 @@ public class MaterialPromotionService implements IPromotionService {
activityDiscountsDtoList
.
add
(
activityDiscountsDto
);
activityDiscountsDtoList
.
add
(
activityDiscountsDto
);
materialGoods
.
setActivityDiscountsDtos
(
activityDiscountsDtoList
);
materialGoods
.
setActivityDiscountsDtos
(
activityDiscountsDtoList
);
materialGoods
.
setTotalDiscountAmount
((
materialGoods
.
getOriginalPrice
().
intValue
()
-
materialGoods
.
getSalePrice
().
intValue
())
*
product
.
getQty
());
//materialGoods.setTotalDiscountAmount((materialGoods.getOriginalPrice().intValue() - materialGoods.getSalePrice().intValue()) * product.getQty());
materialGoods
.
setTotalDiscountAmount
(
material
.
getTotalDiscountAmount
());
product
.
setProductType
(
GoodsTypeEnum
.
MATERIAL
.
getGoodsType
());
product
.
setProductType
(
GoodsTypeEnum
.
MATERIAL
.
getGoodsType
());
}
}
}
}
...
@@ -129,16 +126,21 @@ public class MaterialPromotionService implements IPromotionService {
...
@@ -129,16 +126,21 @@ public class MaterialPromotionService implements IPromotionService {
if
(
calculationDiscountResult
==
null
||
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
getApportionGoods
()))
{
if
(
calculationDiscountResult
==
null
||
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
getApportionGoods
()))
{
return
mApportion
;
return
mApportion
;
}
}
String
pk
=
""
;
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
apportionGood
:
calculationDiscountResult
.
getApportionGoods
())
{
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
apportionGood
:
calculationDiscountResult
.
getApportionGoods
())
{
if
(
CollectionUtils
.
isEmpty
(
apportionGood
.
getSmallMaterial
()))
continue
;
if
(
CollectionUtils
.
isEmpty
(
apportionGood
.
getSmallMaterial
()))
continue
;
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
.
Material
material
:
apportionGood
.
getSmallMaterial
())
{
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
.
Material
material
:
apportionGood
.
getSmallMaterial
())
{
if
(
material
.
getApportionAmount
()
==
0
)
continue
;
if
(
material
.
getApportionAmount
()
==
0
)
continue
;
if
(
mApportion
.
get
(
material
.
getGoodsId
())
==
null
)
{
pk
=
shoppingCartConvertAdapter
.
jointPk
(
material
.
getCartGoodsUid
(),
material
.
getGoodsId
());
if
(
mApportion
.
get
(
pk
)
==
null
)
{
MaterialApportion
materialApportion
=
new
MaterialApportion
();
MaterialApportion
materialApportion
=
new
MaterialApportion
();
materialApportion
.
setSalePrice
(
material
.
getNowPrice
());
materialApportion
.
setSalePrice
(
material
.
getNowPrice
());
materialApportion
.
setAmount
(
material
.
getNowPrice
()
*
material
.
getGoodsQuantity
());
materialApportion
.
setAmount
(
material
.
getNowPrice
()
*
material
.
getGoodsQuantity
());
materialApportion
.
setApportionAmount
(
material
.
getApportionAmount
()
*
material
.
getGoodsQuantity
());
materialApportion
.
setApportionAmount
(
material
.
getApportionAmount
()
*
material
.
getGoodsQuantity
());
materialApportion
.
setGoodsId
(
material
.
getGoodsId
());
materialApportion
.
setGoodsId
(
material
.
getGoodsId
());
materialApportion
.
setTotalDiscountAmount
(
material
.
getApportionAmount
()*
material
.
getGoodsQuantity
());
materialApportion
.
setPk
(
pk
);
ApportionDetails
apportionDetails
=
new
ApportionDetails
();
ApportionDetails
apportionDetails
=
new
ApportionDetails
();
if
(
CollectionUtils
.
isNotEmpty
(
material
.
getApportionDetails
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
material
.
getApportionDetails
()))
{
apportionDetails
.
setActivityCode
(
material
.
getApportionDetails
().
get
(
0
).
getActivityCode
());
apportionDetails
.
setActivityCode
(
material
.
getApportionDetails
().
get
(
0
).
getActivityCode
());
...
@@ -146,15 +148,15 @@ public class MaterialPromotionService implements IPromotionService {
...
@@ -146,15 +148,15 @@ public class MaterialPromotionService implements IPromotionService {
apportionDetails
.
setActivityType
(
material
.
getApportionDetails
().
get
(
0
).
getActivityType
());
apportionDetails
.
setActivityType
(
material
.
getApportionDetails
().
get
(
0
).
getActivityType
());
materialApportion
.
setDetails
(
apportionDetails
);
materialApportion
.
setDetails
(
apportionDetails
);
}
}
mApportion
.
put
(
material
.
getGoodsId
()
,
materialApportion
);
mApportion
.
put
(
pk
,
materialApportion
);
continue
;
continue
;
}
}
MaterialApportion
apportion
=
mApportion
.
get
(
material
.
getGoodsId
());
MaterialApportion
apportion
=
mApportion
.
get
(
material
.
getGoodsId
());
apportion
.
setSalePrice
(
apportion
.
getSalePrice
()
+
material
.
getNowPrice
());
apportion
.
setSalePrice
(
apportion
.
getSalePrice
()
+
material
.
getNowPrice
());
apportion
.
setAmount
(
apportion
.
getAmount
()
+
material
.
getNowPrice
()
*
material
.
getGoodsQuantity
());
apportion
.
setAmount
(
apportion
.
getAmount
()
+
material
.
getNowPrice
()
*
material
.
getGoodsQuantity
());
apportion
.
setApportionAmount
(
apportion
.
getApportionAmount
()
+
material
.
getApportionAmount
()
*
material
.
getGoodsQuantity
());
apportion
.
setApportionAmount
(
apportion
.
getApportionAmount
()
+
material
.
getApportionAmount
()
*
material
.
getGoodsQuantity
());
mApportion
.
put
(
material
.
getGoodsId
(),
apportion
);
apportion
.
setTotalDiscountAmount
(
apportion
.
getTotalDiscountAmount
()+
material
.
getApportionAmount
()*
material
.
getGoodsQuantity
()
);
mApportion
.
put
(
pk
,
apportion
);
}
}
}
}
return
mApportion
;
return
mApportion
;
...
@@ -162,12 +164,14 @@ public class MaterialPromotionService implements IPromotionService {
...
@@ -162,12 +164,14 @@ public class MaterialPromotionService implements IPromotionService {
@Data
@Data
private
class
MaterialApportion
{
private
class
MaterialApportion
{
// 累计
private
String
goodsId
;
private
String
goodsId
;
private
Long
salePrice
;
private
Long
salePrice
;
private
Long
amount
;
private
Long
amount
;
private
Integer
apportionAmount
;
private
Integer
apportionAmount
;
//优惠金额
private
Integer
totalDiscountAmount
;
private
ApportionDetails
details
;
private
ApportionDetails
details
;
private
String
pk
;
}
}
@Data
@Data
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
View file @
2383db62
This diff is collapsed.
Click to expand it.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
View file @
2383db62
...
@@ -72,7 +72,6 @@ public class CalculationServiceImpl {
...
@@ -72,7 +72,6 @@ public class CalculationServiceImpl {
@Autowired
@Autowired
private
SetMealCalculation
setMealCalculation
;
private
SetMealCalculation
setMealCalculation
;
@Autowired
@Autowired
private
ShoppingCartConvertAdapter
shoppingCartConvertAdapter
;
private
ShoppingCartConvertAdapter
shoppingCartConvertAdapter
;
...
@@ -80,9 +79,9 @@ public class CalculationServiceImpl {
...
@@ -80,9 +79,9 @@ public class CalculationServiceImpl {
* 更新购物车行优惠信息
* 更新购物车行优惠信息
*/
*/
public
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
updateShoppingCartGoodsDiscount
(
String
partnerId
,
String
storeId
,
String
userId
,
String
appId
,
Integer
orderType
,
public
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
updateShoppingCartGoodsDiscount
(
String
partnerId
,
String
storeId
,
String
userId
,
String
appId
,
Integer
orderType
,
boolean
isMember
,
String
menuType
,
String
receiveId
,
String
couponCode
,
boolean
isMember
,
String
menuType
,
String
receiveId
,
String
couponCode
,
List
<
CartGoods
>
cartGoodsList
,
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
,
List
<
CartGoods
>
cartGoodsList
,
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
,
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
)
{
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
)
{
Long
deliveryAmount
=
0L
;
Long
deliveryAmount
=
0L
;
QueryDeliverDetailResponse
response
=
calculateDeliveryAmount
(
receiveId
,
partnerId
,
storeId
,
appId
);
QueryDeliverDetailResponse
response
=
calculateDeliveryAmount
(
receiveId
,
partnerId
,
storeId
,
appId
);
...
@@ -98,7 +97,7 @@ public class CalculationServiceImpl {
...
@@ -98,7 +97,7 @@ public class CalculationServiceImpl {
ActivityQueryDto
activityQueryDto
=
fullPromotionCalculation
.
getActivityQueryDto
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
);
ActivityQueryDto
activityQueryDto
=
fullPromotionCalculation
.
getActivityQueryDto
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
);
fullPromotionCalculation
.
updateShoppingCartGoodsDiscount
(
activityQueryDto
,
calculationDiscount
,
cartGoodsList
,
shoppingCartGoodsResponseVo
);
fullPromotionCalculation
.
updateShoppingCartGoodsDiscount
(
activityQueryDto
,
calculationDiscount
,
cartGoodsList
,
shoppingCartGoodsResponseVo
);
//限时特价
//限时特价
、单品特价、超值加购
timeSaleCalculation
.
updateShoppingCartGoodsDiscount
(
calculationDiscount
,
cartGoodsList
,
shoppingCartGoodsResponseVo
);
timeSaleCalculation
.
updateShoppingCartGoodsDiscount
(
calculationDiscount
,
cartGoodsList
,
shoppingCartGoodsResponseVo
);
//优惠券
//优惠券
...
@@ -166,6 +165,13 @@ public class CalculationServiceImpl {
...
@@ -166,6 +165,13 @@ public class CalculationServiceImpl {
shoppingCartGoodsDto
.
setOriginalTotalAmount
(
shoppingCartGoodsResponseVo
.
getOriginalTotalAmount
());
shoppingCartGoodsDto
.
setOriginalTotalAmount
(
shoppingCartGoodsResponseVo
.
getOriginalTotalAmount
());
shoppingCartGoodsDto
.
setTotalAmount
(
shoppingCartGoodsResponseVo
.
getTotalAmount
());
shoppingCartGoodsDto
.
setTotalAmount
(
shoppingCartGoodsResponseVo
.
getTotalAmount
());
shoppingCartGoodsDto
.
setTotalDiscountAmount
(
shoppingCartGoodsResponseVo
.
getTotalDiscountAmount
());
shoppingCartGoodsDto
.
setTotalDiscountAmount
(
shoppingCartGoodsResponseVo
.
getTotalDiscountAmount
());
shoppingCartGoodsDto
.
setDeliveryAmount
(
shoppingCartGoodsResponseVo
.
getDeliveryAmount
());
shoppingCartGoodsDto
.
setDiscountDeliveryAmount
(
shoppingCartGoodsResponseVo
.
getDiscountDeliveryAmount
());
shoppingCartGoodsDto
.
setThresholdAmount
(
shoppingCartGoodsResponseVo
.
getThresholdAmount
());
shoppingCartGoodsDto
.
setIsDiscountDelivery
(
shoppingCartGoodsResponseVo
.
getIsDiscountDelivery
());
shoppingCartGoodsDto
.
setDiscountDeliveryActivityCode
(
shoppingCartGoodsResponseVo
.
getDiscountDeliveryActivityCode
());
// todo 包装费
// todo 包装费
shoppingCartGoodsDto
.
setPackageAmount
(
shoppingCartGoodsResponseVo
.
getNewPackAmount
());
shoppingCartGoodsDto
.
setPackageAmount
(
shoppingCartGoodsResponseVo
.
getNewPackAmount
());
List
<
CartGoods
>
cartGoodsList
=
shoppingCartGoodsResponseVo
.
getProducts
();
List
<
CartGoods
>
cartGoodsList
=
shoppingCartGoodsResponseVo
.
getProducts
();
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
View file @
2383db62
...
@@ -74,7 +74,6 @@ public class CouponDiscountCalculation {
...
@@ -74,7 +74,6 @@ public class CouponDiscountCalculation {
*/
*/
public
void
updateShoppingCartGoodsDiscount
(
CouponPromotionVO
couponPromotionVO
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
,
List
<
CartGoods
>
cartGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
)
{
public
void
updateShoppingCartGoodsDiscount
(
CouponPromotionVO
couponPromotionVO
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
,
List
<
CartGoods
>
cartGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
)
{
// 当couponCode不为空时,需计算优惠价格
// 当couponCode不为空时,需计算优惠价格
long
couponDiscount
=
0
;
long
couponDiscount
=
0
;
if
(
couponPromotionVO
!=
null
&&
StringUtils
.
isNotEmpty
(
couponPromotionVO
.
getCouponCode
())
if
(
couponPromotionVO
!=
null
&&
StringUtils
.
isNotEmpty
(
couponPromotionVO
.
getCouponCode
())
...
@@ -155,15 +154,15 @@ public class CouponDiscountCalculation {
...
@@ -155,15 +154,15 @@ public class CouponDiscountCalculation {
getMemberCouponListRequestDto
.
setPageSize
(
Integer
.
MAX_VALUE
);
getMemberCouponListRequestDto
.
setPageSize
(
Integer
.
MAX_VALUE
);
GetMemberCouponListResponseDto
.
Result
result
=
getMemberCouponList
(
getMemberCouponListRequestDto
);
GetMemberCouponListResponseDto
.
Result
result
=
getMemberCouponList
(
getMemberCouponListRequestDto
);
LogUtil
.
debug
(
"CouponServiceImpl_getMemberCouponList"
,
JSON
.
toJSONString
(
getMemberCouponListRequestDto
),
JSON
.
toJSONString
(
result
));
LogUtil
.
debug
(
"CouponServiceImpl_getMemberCouponList"
,
JSON
.
toJSONString
(
getMemberCouponListRequestDto
),
JSON
.
toJSONString
(
result
));
if
(
result
==
null
||
CollectionUtils
.
isEmpty
(
result
.
getMemberCoupons
()))
{
return
null
;
}
ActivityClassifyCouponBean
availableCouponResponseVo
=
new
ActivityClassifyCouponBean
();
ActivityClassifyCouponBean
availableCouponResponseVo
=
new
ActivityClassifyCouponBean
();
// 可用优惠券信息
// 可用优惠券信息
List
<
ActivityCouponBean
>
usableCoupons
=
Lists
.
newArrayList
();
List
<
ActivityCouponBean
>
usableCoupons
=
Lists
.
newArrayList
();
// 不可用优惠券信息
// 不可用优惠券信息
List
<
ActivityCouponBean
>
disableCoupons
=
Lists
.
newArrayList
();
List
<
ActivityCouponBean
>
disableCoupons
=
Lists
.
newArrayList
();
if
(
result
==
null
||
CollectionUtils
.
isEmpty
(
result
.
getMemberCoupons
()))
{
return
returnEmptyAvailableCoupon
(
availableCouponResponseVo
,
usableCoupons
,
disableCoupons
);
}
List
<
GetMemberCouponListResponseDto
.
Result
.
MemberCoupon
>
memberCoupons
=
result
.
getMemberCoupons
();
List
<
GetMemberCouponListResponseDto
.
Result
.
MemberCoupon
>
memberCoupons
=
result
.
getMemberCoupons
();
// 对象转map
// 对象转map
Map
<
String
,
GetMemberCouponListResponseDto
.
Result
.
MemberCoupon
>
memberCouponMap
=
memberCoupons
.
stream
().
collect
(
Map
<
String
,
GetMemberCouponListResponseDto
.
Result
.
MemberCoupon
>
memberCouponMap
=
memberCoupons
.
stream
().
collect
(
...
@@ -173,13 +172,14 @@ public class CouponDiscountCalculation {
...
@@ -173,13 +172,14 @@ public class CouponDiscountCalculation {
// 只筛选小于结束时间得券
// 只筛选小于结束时间得券
// if (Objects.equals(memberCoupon.getCouponType(), CouponTypeEnum.TYPE_1.getCode())
// if (Objects.equals(memberCoupon.getCouponType(), CouponTypeEnum.TYPE_1.getCode())
// || Objects.equals(memberCoupon.getCouponType(), CouponTypeEnum.TYPE_3.getCode())) {
// || Objects.equals(memberCoupon.getCouponType(), CouponTypeEnum.TYPE_3.getCode())) {
// 只筛选小于结束时间得券
// 只筛选小于结束时间得券
if
(
System
.
currentTimeMillis
()
<
DateUtil
.
convert2Date
(
memberCoupon
.
getEndTime
(),
DateUtil
.
FORMAT_YYYY_MM_DD_HHMMSS
).
getTime
())
{
if
(
System
.
currentTimeMillis
()
<
DateUtil
.
convert2Date
(
memberCoupon
.
getEndTime
(),
DateUtil
.
FORMAT_YYYY_MM_DD_HHMMSS
).
getTime
())
{
couponCodes
.
add
(
memberCoupon
.
getCouponCode
());
couponCodes
.
add
(
memberCoupon
.
getCouponCode
());
}
}
// }
// }
});
});
//券码可用券校验
List
<
CouponState
>
couponStateList
=
buildAvailableCoupons
(
cartGoods
,
partnerId
,
storeId
,
couponCodes
);
List
<
CouponState
>
couponStateList
=
buildAvailableCoupons
(
cartGoods
,
partnerId
,
storeId
,
couponCodes
);
if
(
CollectionUtils
.
isEmpty
(
couponStateList
))
{
if
(
CollectionUtils
.
isEmpty
(
couponStateList
))
{
return
null
;
return
null
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/TimeSaleCalculation.java
View file @
2383db62
...
@@ -41,7 +41,8 @@ public class TimeSaleCalculation {
...
@@ -41,7 +41,8 @@ public class TimeSaleCalculation {
*/
*/
public
void
updateShoppingCartGoodsDiscount
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
,
List
<
CartGoods
>
cartGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
)
{
public
void
updateShoppingCartGoodsDiscount
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
,
List
<
CartGoods
>
cartGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
)
{
if
(
calculationDiscountResult
==
null
||
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
getDiscounts
())
if
(
calculationDiscountResult
==
null
||
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
getDiscounts
())
||
!
calculationDiscountResult
.
getDiscounts
().
stream
().
anyMatch
(
discount
->
(
ActivityTypeEnum
.
TYPE_2
.
getCode
().
equals
(
discount
.
getType
())
||
(
ActivityTypeEnum
.
TYPE_21
.
getCode
().
equals
(
discount
.
getType
())))))
{
||
!
calculationDiscountResult
.
getDiscounts
().
stream
().
anyMatch
(
discount
->
(
ActivityTypeEnum
.
TYPE_2
.
getCode
().
equals
(
discount
.
getType
())
||(
ActivityTypeEnum
.
TYPE_21
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_23
.
getCode
().
equals
(
discount
.
getType
()))
)))
{
return
;
return
;
}
}
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsList
=
calculationDiscountResult
.
getGoods
();
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsList
=
calculationDiscountResult
.
getGoods
();
...
@@ -53,7 +54,7 @@ public class TimeSaleCalculation {
...
@@ -53,7 +54,7 @@ public class TimeSaleCalculation {
.
collect
(
Collectors
.
toMap
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
::
getGoodsId
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
.
collect
(
Collectors
.
toMap
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
::
getGoodsId
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
// 存储当前享受限时特价折扣的商品数量,key:goodsId; value:可享受数量
// 存储当前享受限时特价折扣的商品数量,key:goodsId; value:可享受数量
Map
<
String
,
Integer
>
numberMap
=
new
HashMap
<>();
Map
<
String
,
Integer
>
numberMap
=
new
HashMap
<>();
List
<
Integer
>
discounts
=
Arrays
.
asList
(
ActivityTypeEnum
.
TYPE_2
.
getCode
(),
ActivityTypeEnum
.
TYPE_21
.
getCode
());
List
<
Integer
>
discounts
=
Arrays
.
asList
(
ActivityTypeEnum
.
TYPE_2
.
getCode
(),
ActivityTypeEnum
.
TYPE_21
.
getCode
()
,
ActivityTypeEnum
.
TYPE_23
.
getCode
()
);
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
goods
;
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
goods
;
if
((
goods
=
goodsMap
.
get
(
cartGoods
.
getGoodsId
()))
==
null
)
{
if
((
goods
=
goodsMap
.
get
(
cartGoods
.
getGoodsId
()))
==
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