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
d2b79caf
Commit
d2b79caf
authored
Jun 23, 2021
by
王世昌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加挡板用于测试模拟核销券失败
parent
35a4cef3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
order-application-service/src/main/java/cn/freemud/service/coupon/impl/PlatformCouponRelationServiceImpl.java
+9
-5
No files found.
order-application-service/src/main/java/cn/freemud/service/coupon/impl/PlatformCouponRelationServiceImpl.java
View file @
d2b79caf
...
...
@@ -37,6 +37,7 @@ import com.freemud.application.sdk.api.service.EmailAlertService;
import
com.google.common.base.Throwables
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
...
...
@@ -62,6 +63,9 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
private
static
final
String
ORDER_RESOURCE_PUSH_LOG_EXCHANGE
=
"order-resource-push-log-exchange"
;
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
;
@Override
public
BaseResponse
verificationCoupon
(
List
<
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
AccountBean
>
accountList
,
QueryOrdersResponseDto
.
DataBean
.
OrderBean
orderBean
,
CouponReqType
couponReqType
)
{
for
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
AccountBean
accountBean
:
accountList
)
{
...
...
@@ -114,12 +118,12 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
CouponCodeResponseDto
couponCodeResponseDto
=
couponOfflineClient
.
verification
(
couponCodeVerificationDto
);
LogUtil
.
info
(
"核销券码返回=="
,
JSON
.
toJSONString
(
couponCodeVerificationDto
),
null
);
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
())
&&
!
Objects
.
equals
(
baffleOpen
,
true
)
)
{
LogUtil
.
info
(
"CouponReverseServiceImpl"
,
JSON
.
toJSONString
(
couponCodeVerificationDto
),
JSON
.
toJSONString
(
couponCodeResponseDto
));
break
;
}
if
(!
Objects
.
equals
(
couponCodeResponseDto
.
getStatusCode
(),
ResponseResult
.
SUCCESS
.
getCode
()))
{
sendMessage
(
orderBean
,
LogThreadLocal
.
getTrackingNo
(),
couponCodeVerificationDto
,
couponCodeResponseDto
);
if
(!
Objects
.
equals
(
couponCodeResponseDto
.
getStatusCode
(),
ResponseResult
.
SUCCESS
.
getCode
())
||
Objects
.
equals
(
baffleOpen
,
true
)
)
{
sendMessage
(
orderBean
,
LogThreadLocal
.
getTrackingNo
(),
couponCodeVerificationDto
,
Objects
.
equals
(
baffleOpen
,
true
)
?
"模拟券核销失败"
:
couponCodeResponseDto
);
emailAlertService
.
sendEmailAlert
(
"核销券码失败"
,
String
.
format
(
"request:%s \r\nresponse:%s"
,
JSONObject
.
toJSONString
(
couponCodeVerificationDto
),
JSONObject
.
toJSONString
(
couponCodeResponseDto
)));
return
ResponseUtil
.
error
(
ResponseResult
.
COUPON_VERIFICATION_FAIL
);
}
...
...
@@ -142,7 +146,7 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
*
* @param orderBean
*/
private
void
sendMessage
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
orderBean
,
String
trackingNo
,
CouponCodeVerificationDto
req
,
Object
failObject
)
{
private
void
sendMessage
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
orderBean
,
String
trackingNo
,
Object
req
,
Object
failObject
)
{
OrderResourcePushLogMsgDto
dto
=
new
OrderResourcePushLogMsgDto
();
try
{
String
failureReasons
;
...
...
@@ -170,7 +174,7 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
MQMessage
<
OrderResourcePushLogMsgDto
>
message
=
new
MQMessage
<>(
header
,
dto
);
mqService
.
convertAndSend
(
ORDER_RESOURCE_PUSH_LOG_EXCHANGE
,
ORDER_RESOURCE_PUSH_LOG_ROUTING_KEY
,
message
);
}
catch
(
Exception
e
)
{
LogUtil
.
error
(
trackingNo
,
"sendMessage error!!! routingKey = order-resource-push-log-routing-key"
,
JSONObject
.
toJSONString
(
dto
),
null
,
e
);
LogUtil
.
error
(
trackingNo
,
"sendMessage
COUPON_VERIFICATION
error!!! routingKey = order-resource-push-log-routing-key"
,
JSONObject
.
toJSONString
(
dto
),
null
,
e
);
}
}
}
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