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
jenkins
order-group
Commits
14d629d7
Commit
14d629d7
authored
Feb 06, 2020
by
shuhu.hou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支付成功移除卡包
parent
4b62383d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
40 deletions
+52
-40
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
+1
-1
order-application-service/pom.xml
+5
-0
order-application-service/src/main/java/cn/freemud/enums/ResponseResult.java
+1
-0
order-application-service/src/main/java/cn/freemud/service/CouponActivityService.java
+7
-11
order-application-service/src/main/java/cn/freemud/service/impl/CouponActivityServiceImpl.java
+36
-23
order-application-service/src/main/java/cn/freemud/service/impl/OrderServiceImpl.java
+2
-5
No files found.
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
View file @
14d629d7
...
@@ -2064,7 +2064,7 @@ public class OrderSdkAdapter {
...
@@ -2064,7 +2064,7 @@ public class OrderSdkAdapter {
CouponRequest
couponCodeVerificationDto
=
new
CouponRequest
();
CouponRequest
couponCodeVerificationDto
=
new
CouponRequest
();
couponCodeVerificationDto
.
setVer
(
Integer
.
valueOf
(
Version
.
VERSION_1
));
couponCodeVerificationDto
.
setVer
(
Integer
.
valueOf
(
Version
.
VERSION_1
));
couponCodeVerificationDto
.
setReqtype
(
71
);
couponCodeVerificationDto
.
setReqtype
(
71
);
couponCodeVerificationDto
.
setPartnerId
(
Integer
.
getInteger
(
orderBean
.
getCompanyId
()));
couponCodeVerificationDto
.
setPartnerId
(
Integer
.
parseInt
(
orderBean
.
getCompanyId
()));
couponCodeVerificationDto
.
setChannel
(
activityChannelEnum
.
getCode
());
couponCodeVerificationDto
.
setChannel
(
activityChannelEnum
.
getCode
());
couponCodeVerificationDto
.
setStation_id
(
"-1"
);
couponCodeVerificationDto
.
setStation_id
(
"-1"
);
couponCodeVerificationDto
.
setOperator_id
(
"-1"
);
couponCodeVerificationDto
.
setOperator_id
(
"-1"
);
...
...
order-application-service/pom.xml
View file @
14d629d7
...
@@ -331,6 +331,11 @@
...
@@ -331,6 +331,11 @@
<groupId>
org.apache.skywalking
</groupId>
<groupId>
org.apache.skywalking
</groupId>
<artifactId>
apm-toolkit-logback-1.x
</artifactId>
<artifactId>
apm-toolkit-logback-1.x
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
com.freemud.sdk.api.assortment
</groupId>
<artifactId>
assortment-ordercenter-sdk
</artifactId>
<version>
2.0.3.RELEASE
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
order-application-service/src/main/java/cn/freemud/enums/ResponseResult.java
View file @
14d629d7
...
@@ -150,6 +150,7 @@ public enum ResponseResult {
...
@@ -150,6 +150,7 @@ public enum ResponseResult {
COUPON_SHOP_NOTSUPPORT
(
"46010"
,
"优惠券在当前门店不可用"
),
COUPON_SHOP_NOTSUPPORT
(
"46010"
,
"优惠券在当前门店不可用"
),
COUPON_ORDER_WAY_ERROR
(
"46011"
,
"您选择得优惠券不适用该点餐方式"
),
COUPON_ORDER_WAY_ERROR
(
"46011"
,
"您选择得优惠券不适用该点餐方式"
),
COUPON_VERIFICATION_FAIL
(
"46012"
,
"优惠券核销失败"
),
COUPON_VERIFICATION_FAIL
(
"46012"
,
"优惠券核销失败"
),
COUPON_CALLBACK_FAIL
(
"46013"
,
"优惠券移除卡包失败"
),
/**
/**
* 加价购商品
* 加价购商品
*/
*/
...
...
order-application-service/src/main/java/cn/freemud/service/CouponActivityService.java
View file @
14d629d7
...
@@ -11,20 +11,16 @@ import java.util.List;
...
@@ -11,20 +11,16 @@ import java.util.List;
public
interface
CouponActivityService
{
public
interface
CouponActivityService
{
/**
/**
* 优惠券核销
* 核销优惠券
* @param couponCode 券码
* @param orderBean
* @param oid 订单ID
* @param partnerId 商户ID
* @param storeId 门店ID
* @param userId 用户ID
* @return
*/
*/
BaseResponse
verificationCoupon
(
ActivityChannelEnum
activityChannelEnum
,
String
couponCode
,
String
oid
,
String
partnerId
,
BaseResponse
verificationCoupon
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
orderBean
);
String
storeId
,
String
userId
,
List
<
CouponCodeVerificationProductDto
>
products
,
Integer
discountPrice
);
/**
/**
*
核销优惠券
*
移除卡包
* @param orderBean
* @param orderBean
* @return
*/
*/
BaseResponse
verificationCoupon
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
orderBean
)
;
BaseResponse
callbackNotify
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
orderBean
)
;
}
}
order-application-service/src/main/java/cn/freemud/service/impl/CouponActivityServiceImpl.java
View file @
14d629d7
...
@@ -15,10 +15,14 @@ import cn.freemud.utils.PropertyConvertUtil;
...
@@ -15,10 +15,14 @@ import cn.freemud.utils.PropertyConvertUtil;
import
cn.freemud.utils.ResponseUtil
;
import
cn.freemud.utils.ResponseUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.freemud.application.sdk.api.couponcenter.offline.service.OfflineCouponSdkService
;
import
com.freemud.application.sdk.api.log.ApiLog
;
import
com.freemud.application.sdk.api.log.ApiLog
;
import
com.freemud.application.sdk.api.log.ErrorLog
;
import
com.freemud.application.sdk.api.log.ErrorLog
;
import
com.freemud.application.sdk.api.log.ThirdPartyLog
;
import
com.freemud.application.sdk.api.log.ThirdPartyLog
;
import
com.freemud.application.sdk.api.service.EmailAlertService
;
import
com.freemud.application.sdk.api.service.EmailAlertService
;
import
com.freemud.sdk.api.assortment.order.enums.OldOrderAccountType
;
import
com.freemud.sdk.api.assortment.order.enums.QueryOrderAccountType
;
import
com.freemud.sdk.api.assortment.order.request.order.CreateOrderAccountRequest
;
import
com.google.common.base.Throwables
;
import
com.google.common.base.Throwables
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
...
@@ -42,28 +46,8 @@ public class CouponActivityServiceImpl implements CouponActivityService {
...
@@ -42,28 +46,8 @@ public class CouponActivityServiceImpl implements CouponActivityService {
private
CouponOfflineClient
couponOfflineClient
;
private
CouponOfflineClient
couponOfflineClient
;
@Autowired
@Autowired
private
EmailAlertService
emailAlertService
;
private
EmailAlertService
emailAlertService
;
private
static
Gson
gson
=
new
Gson
();
@Autowired
private
OfflineCouponSdkService
offlineCouponSdkService
;
@Override
public
BaseResponse
verificationCoupon
(
ActivityChannelEnum
activityChannelEnum
,
String
couponCode
,
String
oid
,
String
partnerId
,
String
storeId
,
String
userId
,
List
<
CouponCodeVerificationProductDto
>
products
,
Integer
discountPrice
)
{
if
(
StringUtils
.
isNotBlank
(
couponCode
))
{
CouponCodeVerificationDto
couponCodeVerificationDto
=
couponAdapter
.
convert2CouponCodeVerificationDto
(
activityChannelEnum
,
couponCode
,
oid
,
partnerId
,
storeId
,
userId
,
products
,
discountPrice
);
try
{
//3.券核销
CouponCodeResponseDto
couponCodeResponseDto
=
couponOfflineClient
.
verification
(
couponCodeVerificationDto
);
LogUtil
.
info
(
"coupond_verification_info"
,
gson
.
toJson
(
couponCodeVerificationDto
),
gson
.
toJson
(
couponCodeResponseDto
));
if
(!
Objects
.
equals
(
couponCodeResponseDto
.
getStatusCode
(),
ResponseResult
.
SUCCESS
.
getCode
()))
{
LogUtil
.
info
(
"coupond_verification_error"
,
gson
.
toJson
(
couponCodeVerificationDto
),
gson
.
toJson
(
couponCodeResponseDto
));
return
ResponseUtil
.
error
(
ResponseResult
.
COUPON_VERIFICATION_FAIL
);
}
}
catch
(
Exception
e
)
{
LogUtil
.
error
(
"verification_error"
,
gson
.
toJson
(
couponCodeVerificationDto
),
""
,
e
);
return
ResponseUtil
.
error
(
ResponseResult
.
COUPON_VERIFICATION_FAIL
);
}
}
return
ResponseUtil
.
success
();
}
/**
/**
...
@@ -112,7 +96,7 @@ public class CouponActivityServiceImpl implements CouponActivityService {
...
@@ -112,7 +96,7 @@ public class CouponActivityServiceImpl implements CouponActivityService {
||
OrderAccountType
.
DISCOUNT_COUPON
.
getCode
().
equals
(
accountBean
.
getType
()))
{
||
OrderAccountType
.
DISCOUNT_COUPON
.
getCode
().
equals
(
accountBean
.
getType
()))
{
CouponCodeVerificationDto
couponCodeVerificationDto
=
couponAdapter
.
convert2CouponCodeVerificationDto
(
activityChannelEnum
,
accountBean
.
getAccountId
(),
orderBean
.
getOid
(),
orderBean
.
getCompanyId
(),
orderBean
.
getShopId
(),
orderBean
.
getUserId
(),
products
,
accountBean
.
getPrice
().
intValue
());
CouponCodeVerificationDto
couponCodeVerificationDto
=
couponAdapter
.
convert2CouponCodeVerificationDto
(
activityChannelEnum
,
accountBean
.
getAccountId
(),
orderBean
.
getOid
(),
orderBean
.
getCompanyId
(),
orderBean
.
getShopId
(),
orderBean
.
getUserId
(),
products
,
accountBean
.
getPrice
().
intValue
());
try
{
try
{
//
3
.券核销
//
71
.券核销
CouponCodeResponseDto
couponCodeResponseDto
=
couponOfflineClient
.
verification
(
couponCodeVerificationDto
);
CouponCodeResponseDto
couponCodeResponseDto
=
couponOfflineClient
.
verification
(
couponCodeVerificationDto
);
ThirdPartyLog
.
infoConvertJson
(
System
.
currentTimeMillis
(),
System
.
currentTimeMillis
(),
"/api"
,
couponCodeVerificationDto
,
couponCodeResponseDto
);
ThirdPartyLog
.
infoConvertJson
(
System
.
currentTimeMillis
(),
System
.
currentTimeMillis
(),
"/api"
,
couponCodeVerificationDto
,
couponCodeResponseDto
);
if
(!
Objects
.
equals
(
couponCodeResponseDto
.
getStatusCode
(),
ResponseResult
.
SUCCESS
.
getCode
()))
{
if
(!
Objects
.
equals
(
couponCodeResponseDto
.
getStatusCode
(),
ResponseResult
.
SUCCESS
.
getCode
()))
{
...
@@ -128,4 +112,33 @@ public class CouponActivityServiceImpl implements CouponActivityService {
...
@@ -128,4 +112,33 @@ public class CouponActivityServiceImpl implements CouponActivityService {
}
}
return
ResponseUtil
.
success
();
return
ResponseUtil
.
success
();
}
}
@Override
public
BaseResponse
callbackNotify
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
orderBean
)
{
if
(
CollectionUtils
.
isEmpty
(
orderBean
.
getAccountList
()))
{
return
ResponseUtil
.
success
();
}
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
AccountBean
accountBean
=
orderBean
.
getAccountList
().
stream
().
filter
(
account
->
account
.
getType
().
equals
(
OldOrderAccountType
.
COUPON
.
getCode
())
||
account
.
getType
().
equals
(
OldOrderAccountType
.
PRODUCT_COUPON
.
getCode
())
||
account
.
getType
().
equals
(
OldOrderAccountType
.
DISCOUNT_COUPON
.
getCode
())).
findFirst
().
orElse
(
null
);
if
(
accountBean
==
null
)
{
return
ResponseUtil
.
success
();
}
String
orderCode
=
orderBean
.
getOid
();
String
partnerId
=
orderBean
.
getCompanyId
();
String
couponCode
=
accountBean
.
getAccountId
();
try
{
//移除卡包失败,邮件报警
com
.
freemud
.
application
.
sdk
.
api
.
base
.
BaseResponse
baseResponse
=
offlineCouponSdkService
.
callbackNotify
(
couponCode
,
orderCode
,
partnerId
);
if
(!
Objects
.
equals
(
baseResponse
.
getStatusCode
(),
ResponseResult
.
SUCCESS
.
getCode
()))
{
emailAlertService
.
sendEmailAlert
(
"券码移除卡包失败"
,
String
.
format
(
"request:%s \r\nresponse:%s"
,
"券码号:"
+
couponCode
+
"订单号:"
+
orderCode
,
JSONObject
.
toJSONString
(
baseResponse
)));
return
ResponseUtil
.
error
(
ResponseResult
.
COUPON_CALLBACK_FAIL
);
}
return
ResponseUtil
.
success
();
}
catch
(
Exception
ex
)
{
emailAlertService
.
sendEmailAlert
(
"券码移除卡包异常"
,
String
.
format
(
"request:%s \r\nexception:%s"
,
"券码号:"
+
couponCode
+
"订单号:"
+
orderCode
,
Throwables
.
getStackTraceAsString
(
ex
)));
ErrorLog
.
printErrorLog
(
"verification_error"
,
"/callbackNotify"
,
orderCode
,
ex
);
return
ResponseUtil
.
error
(
ResponseResult
.
COUPON_CALLBACK_FAIL
);
}
}
}
}
order-application-service/src/main/java/cn/freemud/service/impl/OrderServiceImpl.java
View file @
14d629d7
...
@@ -372,11 +372,8 @@ public class OrderServiceImpl implements Orderservice {
...
@@ -372,11 +372,8 @@ public class OrderServiceImpl implements Orderservice {
if
(!
PayStatus
.
NOT_PAY
.
getCode
().
equals
(
orderBean
.
getPayStatus
())
||
!
OrderStatus
.
WAIT_PAY
.
getCode
().
equals
(
orderBean
.
getStatus
()))
{
if
(!
PayStatus
.
NOT_PAY
.
getCode
().
equals
(
orderBean
.
getPayStatus
())
||
!
OrderStatus
.
WAIT_PAY
.
getCode
().
equals
(
orderBean
.
getStatus
()))
{
return
sendPaySuccessNoticeMessage
();
return
sendPaySuccessNoticeMessage
();
}
}
//核销优惠券,若核销失败直接退款
//若该订单使用了优惠券,则移除卡包,移除失败也不退款
// if (!ResponseResult.SUCCESS.getCode().equals(couponActivityService.verificationCoupon(orderBean).getCode())){
couponActivityService
.
callbackNotify
(
orderBean
);
// orderRefund(orderBean, "核销券异常退款", openid, oid);
// return newSendPayFaileMessage();
// }
// 订单失败后 发消息重试 待实现
// 订单失败后 发消息重试 待实现
String
takeCode
;
String
takeCode
;
String
daySeq
;
String
daySeq
;
...
...
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