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
8fed97e7
Commit
8fed97e7
authored
Jul 21, 2022
by
周晓航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
华莱士的百事抽奖 新增订单类型校验
parent
5daae9b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
37 deletions
+51
-37
order-application-service/src/main/java/cn/freemud/service/impl/OrderAdapterServiceImpl.java
+51
-37
No files found.
order-application-service/src/main/java/cn/freemud/service/impl/OrderAdapterServiceImpl.java
View file @
8fed97e7
...
@@ -180,7 +180,7 @@ public class OrderAdapterServiceImpl {
...
@@ -180,7 +180,7 @@ public class OrderAdapterServiceImpl {
@Autowired
@Autowired
private
SvcTransactionClient
svcTransactionClient
;
private
SvcTransactionClient
svcTransactionClient
;
@Autowired
@Autowired
private
EcologyProgramApplicationClient
ecologyProgramApplicationClient
;
private
EcologyProgramApplicationClient
ecologyProgramApplicationClient
;
@Autowired
@Autowired
private
EmailAlertService
emailAlertService
;
private
EmailAlertService
emailAlertService
;
@Autowired
@Autowired
...
@@ -359,7 +359,7 @@ public class OrderAdapterServiceImpl {
...
@@ -359,7 +359,7 @@ public class OrderAdapterServiceImpl {
request
.
setReason
(
"处理订单已关闭,支付未及时回调"
);
request
.
setReason
(
"处理订单已关闭,支付未及时回调"
);
request
.
setOperator
(
"order-application-service"
);
request
.
setOperator
(
"order-application-service"
);
// 直接退款就行, 其他的资产已经被退回
// 直接退款就行, 其他的资产已经被退回
paymentHandle
.
getCommonPayRefundResponse
(
request
,
orderBean
);
paymentHandle
.
getCommonPayRefundResponse
(
request
,
orderBean
);
return
orderAdapter
.
sendPaySuccessNoticeMessage
();
return
orderAdapter
.
sendPaySuccessNoticeMessage
();
}
}
// 支付成功处理
// 支付成功处理
...
@@ -420,7 +420,7 @@ public class OrderAdapterServiceImpl {
...
@@ -420,7 +420,7 @@ public class OrderAdapterServiceImpl {
sendSvcPayInfoToSvcTransaction
(
message
.
getSvcPayItems
(),
orderBean
.
getCompanyId
(),
orderBean
.
getOid
(),
orderBean
.
getUserId
(),
orderBean
.
getShopId
());
sendSvcPayInfoToSvcTransaction
(
message
.
getSvcPayItems
(),
orderBean
.
getCompanyId
(),
orderBean
.
getOid
(),
orderBean
.
getUserId
(),
orderBean
.
getShopId
());
}
}
//爱马哥低碳活动 活动结束即可删除此代码,大概2022-09月结束
//爱马哥低碳活动 活动结束即可删除此代码,大概2022-09月结束
sendLowCarbonToWeixin
(
message
,
orderBean
);
sendLowCarbonToWeixin
(
message
,
orderBean
);
return
result
;
return
result
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
e
;
throw
e
;
...
@@ -517,11 +517,12 @@ public class OrderAdapterServiceImpl {
...
@@ -517,11 +517,12 @@ public class OrderAdapterServiceImpl {
/**
/**
* 微信低碳活动上报,活动结束即可删除
* 微信低碳活动上报,活动结束即可删除
*
* @param message
* @param message
* @param orderBean
* @param orderBean
*/
*/
private
void
sendLowCarbonToWeixin
(
PaysuccessNoticeMessage
message
,
OrderBeanV1
orderBean
)
{
private
void
sendLowCarbonToWeixin
(
PaysuccessNoticeMessage
message
,
OrderBeanV1
orderBean
)
{
ApiLog
.
printLog
(
"sendLowCarbonToWeixin"
,
message
,
orderBean
,
null
);
ApiLog
.
printLog
(
"sendLowCarbonToWeixin"
,
message
,
orderBean
,
null
);
BaseResponse
response
=
null
;
BaseResponse
response
=
null
;
try
{
try
{
// 微商城订单处理 因为没有appid
// 微商城订单处理 因为没有appid
...
@@ -551,23 +552,24 @@ public class OrderAdapterServiceImpl {
...
@@ -551,23 +552,24 @@ public class OrderAdapterServiceImpl {
request
.
setMiniAppId
(
orderBean
.
getAppId
());
request
.
setMiniAppId
(
orderBean
.
getAppId
());
response
=
ecologyProgramApplicationClient
.
reportActivityBehaviors
(
request
);
response
=
ecologyProgramApplicationClient
.
reportActivityBehaviors
(
request
);
if
(!
Objects
.
equals
(
response
.
getCode
(),
"100"
))
{
if
(!
Objects
.
equals
(
response
.
getCode
(),
"100"
))
{
if
(!
Objects
.
equals
(
response
.
getMessage
(),
"用户未参加或已退出该活动"
))
{
//用户未报名活动的过滤掉
if
(!
Objects
.
equals
(
response
.
getMessage
(),
"用户未参加或已退出该活动"
))
{
//用户未报名活动的过滤掉
emailAlertService
.
sendEmailAlert
(
"低碳活动上报失败"
,
String
.
format
(
"request:%s \r\nresponse:%s \r\norderNo:%s"
,
JSONObject
.
toJSONString
(
request
),
JSONObject
.
toJSONString
(
response
),
orderBean
.
getOid
()));
emailAlertService
.
sendEmailAlert
(
"低碳活动上报失败"
,
String
.
format
(
"request:%s \r\nresponse:%s \r\norderNo:%s"
,
JSONObject
.
toJSONString
(
request
),
JSONObject
.
toJSONString
(
response
),
orderBean
.
getOid
()));
}
}
ApiLog
.
printLog
(
"sendLowCarbonToWeixin error "
+
orderBean
.
getOid
(),
message
,
request
,
response
);
ApiLog
.
printLog
(
"sendLowCarbonToWeixin error "
+
orderBean
.
getOid
(),
message
,
request
,
response
);
}
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
emailAlertService
.
sendEmailAlert
(
"低碳活动上报异常"
,
String
.
format
(
"request:%s \r\nresponse:%s \r\norderNo:%s"
,
JSONObject
.
toJSONString
(
message
),
JSONObject
.
toJSONString
(
response
),
orderBean
.
getOid
()));
emailAlertService
.
sendEmailAlert
(
"低碳活动上报异常"
,
String
.
format
(
"request:%s \r\nresponse:%s \r\norderNo:%s"
,
JSONObject
.
toJSONString
(
message
),
JSONObject
.
toJSONString
(
response
),
orderBean
.
getOid
()));
ErrorLog
.
printErrorLog
(
"sendLowCarbonToWeixin exception"
,
"/ecology/micro-program/low-carbon-action/activities/behaviors-report"
,
orderBean
,
e
);
ErrorLog
.
printErrorLog
(
"sendLowCarbonToWeixin exception"
,
"/ecology/micro-program/low-carbon-action/activities/behaviors-report"
,
orderBean
,
e
);
}
}
}
}
private
String
getActivityId
(
String
partnerId
){
private
String
getActivityId
(
String
partnerId
)
{
String
[]
partnerArr
=
weixinPayActivity
.
split
(
","
);
String
[]
partnerArr
=
weixinPayActivity
.
split
(
","
);
if
(
partnerArr
!=
null
&&
partnerArr
.
length
>
0
)
{
if
(
partnerArr
!=
null
&&
partnerArr
.
length
>
0
)
{
for
(
String
partnerStr
:
partnerArr
)
{
for
(
String
partnerStr
:
partnerArr
)
{
String
[]
arr
=
partnerStr
.
split
(
"@"
);
String
[]
arr
=
partnerStr
.
split
(
"@"
);
if
(
Objects
.
equals
(
arr
[
0
],
partnerId
))
{
if
(
Objects
.
equals
(
arr
[
0
],
partnerId
))
{
return
arr
[
1
];
return
arr
[
1
];
}
}
}
}
...
@@ -575,23 +577,23 @@ public class OrderAdapterServiceImpl {
...
@@ -575,23 +577,23 @@ public class OrderAdapterServiceImpl {
return
null
;
return
null
;
}
}
private
boolean
isGoodInActivity
(
String
partnerId
,
List
<
ProductBeanV1
>
productList
)
{
private
boolean
isGoodInActivity
(
String
partnerId
,
List
<
ProductBeanV1
>
productList
)
{
List
<
String
>
partnerList
=
Arrays
.
asList
(
weixinPayGoods
.
split
(
","
));
List
<
String
>
partnerList
=
Arrays
.
asList
(
weixinPayGoods
.
split
(
","
));
if
(
CollectionUtils
.
isNotEmpty
(
partnerList
)
&&
CollectionUtils
.
isNotEmpty
(
productList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
partnerList
)
&&
CollectionUtils
.
isNotEmpty
(
productList
))
{
return
productList
.
stream
().
anyMatch
(
productBeanV1
->
{
return
productList
.
stream
().
anyMatch
(
productBeanV1
->
{
boolean
mainProduct
=
partnerList
.
contains
(
partnerId
+
"@"
+(
StringUtils
.
isBlank
(
productBeanV1
.
getSpecification
())?
productBeanV1
.
getProductId
():
productBeanV1
.
getSpecification
()));
boolean
mainProduct
=
partnerList
.
contains
(
partnerId
+
"@"
+
(
StringUtils
.
isBlank
(
productBeanV1
.
getSpecification
())
?
productBeanV1
.
getProductId
()
:
productBeanV1
.
getSpecification
()));
if
(
mainProduct
)
{
if
(
mainProduct
)
{
return
true
;
return
true
;
}
}
if
(
CollectionUtils
.
isNotEmpty
(
productBeanV1
.
getSendProduct
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
productBeanV1
.
getSendProduct
()))
{
boolean
sendProduct
=
productBeanV1
.
getSendProduct
().
stream
().
anyMatch
(
send
->
partnerList
.
contains
(
partnerId
+
"@"
+(
StringUtils
.
isBlank
(
send
.
getSpecification
())?
send
.
getProductId
():
send
.
getSpecification
())));
boolean
sendProduct
=
productBeanV1
.
getSendProduct
().
stream
().
anyMatch
(
send
->
partnerList
.
contains
(
partnerId
+
"@"
+
(
StringUtils
.
isBlank
(
send
.
getSpecification
())
?
send
.
getProductId
()
:
send
.
getSpecification
())));
if
(
sendProduct
)
{
if
(
sendProduct
)
{
return
true
;
return
true
;
}
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
productBeanV1
.
getComboProduct
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
productBeanV1
.
getComboProduct
()))
{
boolean
comboProduct
=
productBeanV1
.
getComboProduct
().
stream
().
anyMatch
(
combo
->
partnerList
.
contains
(
partnerId
+
"@"
+(
StringUtils
.
isBlank
(
combo
.
getSpecification
())?
combo
.
getProductId
():
combo
.
getSpecification
())));
boolean
comboProduct
=
productBeanV1
.
getComboProduct
().
stream
().
anyMatch
(
combo
->
partnerList
.
contains
(
partnerId
+
"@"
+
(
StringUtils
.
isBlank
(
combo
.
getSpecification
())
?
combo
.
getProductId
()
:
combo
.
getSpecification
())));
if
(
comboProduct
)
{
if
(
comboProduct
)
{
return
true
;
return
true
;
}
}
}
}
...
@@ -605,6 +607,7 @@ public class OrderAdapterServiceImpl {
...
@@ -605,6 +607,7 @@ public class OrderAdapterServiceImpl {
/**
/**
* 华莱士临时需求,
* 华莱士临时需求,
*
* @param request
* @param request
* @return
* @return
*/
*/
...
@@ -630,7 +633,7 @@ public class OrderAdapterServiceImpl {
...
@@ -630,7 +633,7 @@ public class OrderAdapterServiceImpl {
}
}
// step1 调用敬轩, 是否能参加活动
// step1 调用敬轩, 是否能参加活动
OrderBeanV1
orderBeanV1
=
orderCenterSdkAdapter
.
convent2NEWOrderInfo
(
orderInfoReqs
);
OrderBeanV1
orderBeanV1
=
orderCenterSdkAdapter
.
convent2NEWOrderInfo
(
orderInfoReqs
);
skip
=
this
.
canJoinActivity
(
order
InfoReqs
.
getPartnerId
(),
orderBeanV1
.
getProductList
(),
orderBeanV1
.
getSettlementAmount
().
intValue
()
);
skip
=
this
.
canJoinActivity
(
order
BeanV1
);
if
(
skip
)
{
if
(
skip
)
{
try
{
try
{
// stpe2 调用光兴, 是否成功 +1
// stpe2 调用光兴, 是否成功 +1
...
@@ -652,31 +655,42 @@ public class OrderAdapterServiceImpl {
...
@@ -652,31 +655,42 @@ public class OrderAdapterServiceImpl {
return
ResponseUtil
.
success
(
respVo
);
return
ResponseUtil
.
success
(
respVo
);
}
}
private
boolean
canJoinActivity
(
String
partnerId
,
List
<
ProductBeanV1
>
productList
,
Integer
payAmount
){
private
boolean
canJoinActivity
(
OrderBeanV1
orderBeanV1
)
{
String
partnerId
=
orderBeanV1
.
getCompanyId
();
List
<
ProductBeanV1
>
productList
=
orderBeanV1
.
getProductList
();
Integer
payAmount
=
orderBeanV1
.
getSettlementAmount
().
intValue
();
List
<
String
>
partnerList
=
Arrays
.
asList
(
baishiActivityPartner
.
split
(
","
));
List
<
String
>
partnerList
=
Arrays
.
asList
(
baishiActivityPartner
.
split
(
","
));
if
(!
partnerList
.
contains
(
partnerId
)){
// 订单类型限制
if
(
orderBeanV1
.
getBizType
().
compareTo
(
BizTypeEnum
.
ORDINARY
.
getBizType
())
!=
0
)
{
return
false
;
}
if
(
orderBeanV1
.
getMarketingType
().
compareTo
(
MarketTypeEnum
.
ORDER
.
getIndex
().
byteValue
())
!=
0
)
{
return
false
;
}
if
(!
partnerList
.
contains
(
partnerId
))
{
return
false
;
return
false
;
}
}
if
(
payAmount
>=
baishiActivityAmount
)
{
if
(
payAmount
>=
baishiActivityAmount
)
{
return
true
;
return
true
;
}
}
List
<
String
>
goodsList
=
Arrays
.
asList
(
baishiActivityGood
.
split
(
","
));
List
<
String
>
goodsList
=
Arrays
.
asList
(
baishiActivityGood
.
split
(
","
));
if
(
CollectionUtils
.
isNotEmpty
(
goodsList
)
&&
CollectionUtils
.
isNotEmpty
(
productList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
goodsList
)
&&
CollectionUtils
.
isNotEmpty
(
productList
))
{
return
productList
.
stream
().
anyMatch
(
productBeanV1
->
{
return
productList
.
stream
().
anyMatch
(
productBeanV1
->
{
boolean
mainProduct
=
goodsList
.
contains
(
StringUtils
.
isBlank
(
productBeanV1
.
getSpecification
())
?
productBeanV1
.
getProductId
():
productBeanV1
.
getSpecification
());
boolean
mainProduct
=
goodsList
.
contains
(
StringUtils
.
isBlank
(
productBeanV1
.
getSpecification
())
?
productBeanV1
.
getProductId
()
:
productBeanV1
.
getSpecification
());
if
(
mainProduct
)
{
if
(
mainProduct
)
{
return
true
;
return
true
;
}
}
if
(
CollectionUtils
.
isNotEmpty
(
productBeanV1
.
getSendProduct
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
productBeanV1
.
getSendProduct
()))
{
boolean
sendProduct
=
productBeanV1
.
getSendProduct
().
stream
().
anyMatch
(
send
->
goodsList
.
contains
(
StringUtils
.
isBlank
(
send
.
getSpecification
())?
send
.
getProductId
():
send
.
getSpecification
()));
boolean
sendProduct
=
productBeanV1
.
getSendProduct
().
stream
().
anyMatch
(
send
->
goodsList
.
contains
(
StringUtils
.
isBlank
(
send
.
getSpecification
())
?
send
.
getProductId
()
:
send
.
getSpecification
()));
if
(
sendProduct
)
{
if
(
sendProduct
)
{
return
true
;
return
true
;
}
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
productBeanV1
.
getComboProduct
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
productBeanV1
.
getComboProduct
()))
{
boolean
comboProduct
=
productBeanV1
.
getComboProduct
().
stream
().
anyMatch
(
combo
->
goodsList
.
contains
(
StringUtils
.
isBlank
(
combo
.
getSpecification
())?
combo
.
getProductId
():
combo
.
getSpecification
()));
boolean
comboProduct
=
productBeanV1
.
getComboProduct
().
stream
().
anyMatch
(
combo
->
goodsList
.
contains
(
StringUtils
.
isBlank
(
combo
.
getSpecification
())
?
combo
.
getProductId
()
:
combo
.
getSpecification
()));
if
(
comboProduct
)
{
if
(
comboProduct
)
{
return
true
;
return
true
;
}
}
}
}
...
...
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