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
078d2d28
Commit
078d2d28
authored
Jul 05, 2021
by
王世昌
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bugfix-小料三方商品id修复-wsc' into qa
parents
3496e5a8
a69ed155
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
16 deletions
+59
-16
order-application-service/src/main/java/cn/freemud/enums/OrderAccountType.java
+15
-0
order-application-service/src/main/java/cn/freemud/enums/ResponseResult.java
+1
-0
order-application-service/src/main/java/cn/freemud/service/coupon/impl/PlatformCouponRelationServiceImpl.java
+30
-9
order-application-service/src/main/java/cn/freemud/service/impl/CheckOrder.java
+4
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationCommonService.java
+7
-6
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/promotion/CouponSharingService.java
+2
-1
No files found.
order-application-service/src/main/java/cn/freemud/enums/OrderAccountType.java
View file @
078d2d28
...
...
@@ -13,6 +13,9 @@
package
cn
.
freemud
.
enums
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* 应该是下面这个type对应
* @see com.freemud.sdk.api.assortment.order.enums.OldOrderAccountType
...
...
@@ -39,6 +42,18 @@ public enum OrderAccountType {
private
String
desc
;
/**
* 需要 核销的 券 归类
* 代金券
* 商品券
* 运费全
* 折扣券
*/
public
static
List
<
Integer
>
verificationCoupon
=
Arrays
.
asList
(
OrderAccountType
.
COUPON
.
getCode
(),
OrderAccountType
.
PRODUCT_COUPON
.
getCode
(),
OrderAccountType
.
FREIGHT_COUPON
.
getCode
(),
OrderAccountType
.
DISCOUNT_COUPON
.
getCode
());
OrderAccountType
(
Integer
code
,
String
desc
)
{
this
.
code
=
code
;
this
.
desc
=
desc
;
...
...
order-application-service/src/main/java/cn/freemud/enums/ResponseResult.java
View file @
078d2d28
...
...
@@ -70,6 +70,7 @@ public enum ResponseResult {
STORE_WILL_COLSE
(
"43020"
,
"门店即将打烊,不能下单"
,
""
),
STORE_DDELIVERY_METHOD
(
"43021"
,
"获取门店外卖配送方式异常"
,
""
),
STORE_QUERYEXPECTARRIVETIME
(
"43022"
,
"获取门店计算预计送达时间失败"
,
""
),
STORE_DATE_ERROR
(
"43023"
,
"门店数据错误"
,
""
),
/**
* 购物车状态码
...
...
order-application-service/src/main/java/cn/freemud/service/coupon/impl/PlatformCouponRelationServiceImpl.java
View file @
078d2d28
...
...
@@ -40,10 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Service
(
"platformCouponRelationService"
)
...
...
@@ -64,7 +61,7 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
private
static
final
String
ORDER_RESOURCE_PUSH_LOG_ROUTING_KEY
=
"order-resource-push-log-routing-key"
;
@Value
(
"${baffleOpen.verification.coupon:false}"
)
private
Boolean
baffleOpen
=
false
;
private
Boolean
baffleOpen
=
false
;
@Override
public
BaseResponse
verificationCoupon
(
List
<
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
AccountBean
>
accountList
,
QueryOrdersResponseDto
.
DataBean
.
OrderBean
orderBean
,
CouponReqType
couponReqType
)
{
...
...
@@ -72,7 +69,9 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
if
(
CollectionUtils
.
isEmpty
(
accountList
))
{
return
ResponseUtil
.
success
();
}
if
(
accountList
.
size
()
>
1
)
{
// 需要判断 accountList 里面 是都 同时包含 配送券+ other券
boolean
isDoubleCoupon
=
checkAccountList
(
accountList
);
if
(
isDoubleCoupon
)
{
Integer
code
=
OrderAccountType
.
FREIGHT_COUPON
.
getCode
();
// 运费券 塞进 核销接口里面, 这里真的是贼恶心 逻辑不敢动
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
AccountBean
freightCouponAccountBean
=
accountList
.
stream
().
filter
(
accountBean
->
code
.
equals
(
accountBean
.
getType
())).
findFirst
().
orElse
(
null
);
...
...
@@ -91,6 +90,28 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
}
/**
* 要校验一遍是否 使用了 需要核销的券 代金券 商品券 运费全 折扣券 需要核销
*
* @param accountList 这里会传递 多张券 和其他的计算 类型
* @return
*/
private
boolean
checkAccountList
(
List
<
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
AccountBean
>
accountList
)
{
// 里面只有一个值 直接使用老逻辑 不管是 什么券
if
(
accountList
.
size
()
==
1
)
{
return
false
;
}
// 拿出 所有的使用券信息 代金券 商品券 运费全 折扣券 需要核销
int
count
=
0
;
for
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
AccountBean
accountBean
:
accountList
)
{
if
(
OrderAccountType
.
verificationCoupon
.
contains
(
accountBean
.
getType
())){
count
++;
}
}
// 说明使用了 2张以上的优惠券 需要核销
return
count
>
1
;
}
/**
* 原有逻辑没变动的基础上 加上 配送券信息对象
*
* @param couponCodeVerificationTransDto 配送券信息对象 如果为null 就是原来的逻辑
...
...
@@ -180,12 +201,12 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
lastException
=
ex
;
ErrorLog
.
printErrorLog
(
"verification_error"
,
"/api"
,
couponCodeVerificationDto
,
ex
);
}
if
(
lastException
!=
null
){
if
(
lastException
!=
null
)
{
sendMessage
(
orderBean
,
LogThreadLocal
.
getTrackingNo
(),
couponCodeVerificationDto
,
lastException
);
}
else
if
(!
ok
||
Objects
.
equals
(
baffleOpen
,
true
))
{
}
else
if
(!
ok
||
Objects
.
equals
(
baffleOpen
,
true
))
{
sendMessage
(
orderBean
,
LogThreadLocal
.
getTrackingNo
(),
couponCodeVerificationDto
,
ok
?
"模拟券核销失败"
:
couponCodeResponseDto
);
}
if
(!
ok
){
if
(!
ok
)
{
emailAlertService
.
sendEmailAlert
(
"核销券码失败"
,
String
.
format
(
"request:%s \r\nresponse:%s"
,
JSONObject
.
toJSONString
(
couponCodeVerificationDto
),
JSONObject
.
toJSONString
(
lastException
==
null
?
couponCodeResponseDto
:
lastException
)));
return
ResponseUtil
.
error
(
ResponseResult
.
COUPON_VERIFICATION_FAIL
);
}
...
...
order-application-service/src/main/java/cn/freemud/service/impl/CheckOrder.java
View file @
078d2d28
...
...
@@ -205,6 +205,10 @@ public class CheckOrder {
if
(
storeResponseDto
.
getActiveFlag
()
==
null
||
storeResponseDto
.
getActiveFlag
()
!=
1
)
{
throw
new
ServiceException
(
ResponseResult
.
STORE_ITEM_STOP_BUSINESS
);
}
//特殊情况
if
(
""
.
equals
(
storeResponseDto
.
getBusinessType
()))
{
throw
new
ServiceException
(
ResponseResult
.
STORE_DATE_ERROR
);
}
createOrderVo
.
setStoreName
(
storeResponseDto
.
getStoreName
());
createOrderVo
.
setStoreAddress
(
storeResponseDto
.
getAddress
());
createOrderVo
.
setThirdShopId
(
storeResponseDto
.
getThirdPartCode
());
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationCommonService.java
View file @
078d2d28
...
...
@@ -109,11 +109,12 @@ public class CalculationCommonService {
// 需要算上配送券的优惠金额
Integer
discountAmount
=
0
;
if
(
CollectionUtils
.
isNotEmpty
(
discountResult
.
getDiscounts
()))
{
// 过滤出配送券金额
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Discount
discount
=
discountResult
.
getDiscounts
().
stream
().
filter
(
c
->
c
.
getType
()
!=
null
&&
c
.
getType
().
compareTo
(
ActivityTypeEnum
.
TYPE_34
.
getCode
())
==
0
).
findFirst
().
orElse
(
null
);
if
(
discount
!=
null
)
{
discountAmount
=
discount
.
getDiscount
();
}
// 过滤出配送券金额 和 满减配送费活动金额
double
sum
=
discountResult
.
getDiscounts
().
stream
()
.
filter
(
c
->
c
.
getType
()
!=
null
&&
(
c
.
getType
().
compareTo
(
ActivityTypeEnum
.
TYPE_34
.
getCode
())
==
0
||
c
.
getType
().
compareTo
(
ActivityTypeEnum
.
TYPE_14
.
getCode
())
==
0
))
.
mapToDouble
(
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Discount
::
getDiscount
)
.
sum
();
discountAmount
=
Double
.
valueOf
(
sum
).
intValue
();
}
shoppingCartGoodsResponseVo
.
setTotalDiscountAmount
(
discountResult
.
getTotalDiscountAmount
()
+
discountAmount
);
}
...
...
@@ -466,7 +467,7 @@ public class CalculationCommonService {
goods
.
setSpuForeignName
(
mg
.
getSpuForeignName
());
goods
.
setSalePrice
(
mg
.
getFinalPrice
());
goods
.
setQty
(
mg
.
getQty
());
goods
.
setCustomerCode
(
cartGoods
.
getCustomerCode
());
goods
.
setCustomerCode
(
mg
.
getCustomerCode
());
goods
.
setOriginalPrice
(
mg
.
getOriginalPrice
());
//提前当前行促销
BlockRow
blockRow
=
smallRow
.
get
(
goods
.
getSpuId
());
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/promotion/CouponSharingService.java
View file @
078d2d28
...
...
@@ -85,7 +85,8 @@ public class CouponSharingService {
// 当couponCode不为空时,需计算优惠价格 3代金 31折扣 32商品 33换购券
long
couponDiscount
=
0
;
if
(
couponPromotionVO
!=
null
&&
StringUtils
.
isNotEmpty
(
couponPromotionVO
.
getCouponCode
())
if
(
couponPromotionVO
!=
null
&&
(
StringUtils
.
isNotEmpty
(
couponPromotionVO
.
getCouponCode
())
||
CollectionUtils
.
isNotEmpty
(
couponPromotionVO
.
getCouponCodes
()))
&&
calculationDiscountResult
!=
null
&&
CollectionUtils
.
isNotEmpty
(
calculationDiscountResult
.
getDiscounts
()))
{
//List<CalculationSharingDiscountResponseDto.CalculationDiscountResult.CouponResults> couponResultsList = calculationDiscountResult.getCouponDiscounts();
// 需要加上 配送券的 配送券 type = 34
...
...
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