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
a94253f0
Commit
a94253f0
authored
Jul 21, 2022
by
周晓航
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'KA-华莱士抽奖跳转百世新增接口' into qa
parents
4e27db46
8fed97e7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
36 deletions
+50
-36
order-application-service/src/main/java/cn/freemud/service/impl/OrderAdapterServiceImpl.java
+50
-36
No files found.
order-application-service/src/main/java/cn/freemud/service/impl/OrderAdapterServiceImpl.java
View file @
a94253f0
...
...
@@ -359,7 +359,7 @@ public class OrderAdapterServiceImpl {
request
.
setReason
(
"处理订单已关闭,支付未及时回调"
);
request
.
setOperator
(
"order-application-service"
);
// 直接退款就行, 其他的资产已经被退回
paymentHandle
.
getCommonPayRefundResponse
(
request
,
orderBean
);
paymentHandle
.
getCommonPayRefundResponse
(
request
,
orderBean
);
return
orderAdapter
.
sendPaySuccessNoticeMessage
();
}
// 支付成功处理
...
...
@@ -420,7 +420,7 @@ public class OrderAdapterServiceImpl {
sendSvcPayInfoToSvcTransaction
(
message
.
getSvcPayItems
(),
orderBean
.
getCompanyId
(),
orderBean
.
getOid
(),
orderBean
.
getUserId
(),
orderBean
.
getShopId
());
}
//爱马哥低碳活动 活动结束即可删除此代码,大概2022-09月结束
sendLowCarbonToWeixin
(
message
,
orderBean
);
sendLowCarbonToWeixin
(
message
,
orderBean
);
return
result
;
}
catch
(
Exception
e
)
{
throw
e
;
...
...
@@ -518,11 +518,12 @@ public class OrderAdapterServiceImpl {
/**
* 微信低碳活动上报,活动结束即可删除
*
* @param message
* @param orderBean
*/
private
void
sendLowCarbonToWeixin
(
PaysuccessNoticeMessage
message
,
OrderBeanV1
orderBean
)
{
ApiLog
.
printLog
(
"sendLowCarbonToWeixin"
,
message
,
orderBean
,
null
);
private
void
sendLowCarbonToWeixin
(
PaysuccessNoticeMessage
message
,
OrderBeanV1
orderBean
)
{
ApiLog
.
printLog
(
"sendLowCarbonToWeixin"
,
message
,
orderBean
,
null
);
BaseResponse
response
=
null
;
try
{
// 微商城订单处理 因为没有appid
...
...
@@ -552,23 +553,24 @@ public class OrderAdapterServiceImpl {
request
.
setMiniAppId
(
orderBean
.
getAppId
());
response
=
ecologyProgramApplicationClient
.
reportActivityBehaviors
(
request
);
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
()));
}
ApiLog
.
printLog
(
"sendLowCarbonToWeixin error "
+
orderBean
.
getOid
(),
message
,
request
,
response
);
ApiLog
.
printLog
(
"sendLowCarbonToWeixin error "
+
orderBean
.
getOid
(),
message
,
request
,
response
);
}
}
}
catch
(
Exception
e
)
{
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
);
}
catch
(
Exception
e
)
{
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
);
}
}
private
String
getActivityId
(
String
partnerId
){
private
String
getActivityId
(
String
partnerId
)
{
String
[]
partnerArr
=
weixinPayActivity
.
split
(
","
);
if
(
partnerArr
!=
null
&&
partnerArr
.
length
>
0
)
{
for
(
String
partnerStr
:
partnerArr
)
{
if
(
partnerArr
!=
null
&&
partnerArr
.
length
>
0
)
{
for
(
String
partnerStr
:
partnerArr
)
{
String
[]
arr
=
partnerStr
.
split
(
"@"
);
if
(
Objects
.
equals
(
arr
[
0
],
partnerId
))
{
if
(
Objects
.
equals
(
arr
[
0
],
partnerId
))
{
return
arr
[
1
];
}
}
...
...
@@ -576,23 +578,23 @@ public class OrderAdapterServiceImpl {
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
(
","
));
if
(
CollectionUtils
.
isNotEmpty
(
partnerList
)
&&
CollectionUtils
.
isNotEmpty
(
productList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
partnerList
)
&&
CollectionUtils
.
isNotEmpty
(
productList
))
{
return
productList
.
stream
().
anyMatch
(
productBeanV1
->
{
boolean
mainProduct
=
partnerList
.
contains
(
partnerId
+
"@"
+(
StringUtils
.
isBlank
(
productBeanV1
.
getSpecification
())?
productBeanV1
.
getProductId
():
productBeanV1
.
getSpecification
()));
if
(
mainProduct
)
{
boolean
mainProduct
=
partnerList
.
contains
(
partnerId
+
"@"
+
(
StringUtils
.
isBlank
(
productBeanV1
.
getSpecification
())
?
productBeanV1
.
getProductId
()
:
productBeanV1
.
getSpecification
()));
if
(
mainProduct
)
{
return
true
;
}
if
(
CollectionUtils
.
isNotEmpty
(
productBeanV1
.
getSendProduct
()))
{
boolean
sendProduct
=
productBeanV1
.
getSendProduct
().
stream
().
anyMatch
(
send
->
partnerList
.
contains
(
partnerId
+
"@"
+(
StringUtils
.
isBlank
(
send
.
getSpecification
())?
send
.
getProductId
():
send
.
getSpecification
())));
if
(
sendProduct
)
{
if
(
CollectionUtils
.
isNotEmpty
(
productBeanV1
.
getSendProduct
()))
{
boolean
sendProduct
=
productBeanV1
.
getSendProduct
().
stream
().
anyMatch
(
send
->
partnerList
.
contains
(
partnerId
+
"@"
+
(
StringUtils
.
isBlank
(
send
.
getSpecification
())
?
send
.
getProductId
()
:
send
.
getSpecification
())));
if
(
sendProduct
)
{
return
true
;
}
}
if
(
CollectionUtils
.
isNotEmpty
(
productBeanV1
.
getComboProduct
()))
{
boolean
comboProduct
=
productBeanV1
.
getComboProduct
().
stream
().
anyMatch
(
combo
->
partnerList
.
contains
(
partnerId
+
"@"
+(
StringUtils
.
isBlank
(
combo
.
getSpecification
())?
combo
.
getProductId
():
combo
.
getSpecification
())));
if
(
comboProduct
)
{
if
(
CollectionUtils
.
isNotEmpty
(
productBeanV1
.
getComboProduct
()))
{
boolean
comboProduct
=
productBeanV1
.
getComboProduct
().
stream
().
anyMatch
(
combo
->
partnerList
.
contains
(
partnerId
+
"@"
+
(
StringUtils
.
isBlank
(
combo
.
getSpecification
())
?
combo
.
getProductId
()
:
combo
.
getSpecification
())));
if
(
comboProduct
)
{
return
true
;
}
}
...
...
@@ -606,6 +608,7 @@ public class OrderAdapterServiceImpl {
/**
* 华莱士临时需求,
*
* @param request
* @return
*/
...
...
@@ -631,7 +634,7 @@ public class OrderAdapterServiceImpl {
}
// step1 调用敬轩, 是否能参加活动
OrderBeanV1
orderBeanV1
=
orderCenterSdkAdapter
.
convent2NEWOrderInfo
(
orderInfoReqs
);
skip
=
this
.
canJoinActivity
(
order
InfoReqs
.
getPartnerId
(),
orderBeanV1
.
getProductList
(),
orderBeanV1
.
getSettlementAmount
().
intValue
()
);
skip
=
this
.
canJoinActivity
(
order
BeanV1
);
if
(
skip
)
{
try
{
// stpe2 调用光兴, 是否成功 +1
...
...
@@ -653,31 +656,42 @@ public class OrderAdapterServiceImpl {
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
(
","
));
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
;
}
if
(
payAmount
>=
baishiActivityAmount
)
{
if
(
payAmount
>=
baishiActivityAmount
)
{
return
true
;
}
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
->
{
boolean
mainProduct
=
goodsList
.
contains
(
StringUtils
.
isBlank
(
productBeanV1
.
getSpecification
())
?
productBeanV1
.
getProductId
():
productBeanV1
.
getSpecification
());
if
(
mainProduct
)
{
boolean
mainProduct
=
goodsList
.
contains
(
StringUtils
.
isBlank
(
productBeanV1
.
getSpecification
())
?
productBeanV1
.
getProductId
()
:
productBeanV1
.
getSpecification
());
if
(
mainProduct
)
{
return
true
;
}
if
(
CollectionUtils
.
isNotEmpty
(
productBeanV1
.
getSendProduct
()))
{
boolean
sendProduct
=
productBeanV1
.
getSendProduct
().
stream
().
anyMatch
(
send
->
goodsList
.
contains
(
StringUtils
.
isBlank
(
send
.
getSpecification
())?
send
.
getProductId
():
send
.
getSpecification
()));
if
(
sendProduct
)
{
if
(
CollectionUtils
.
isNotEmpty
(
productBeanV1
.
getSendProduct
()))
{
boolean
sendProduct
=
productBeanV1
.
getSendProduct
().
stream
().
anyMatch
(
send
->
goodsList
.
contains
(
StringUtils
.
isBlank
(
send
.
getSpecification
())
?
send
.
getProductId
()
:
send
.
getSpecification
()));
if
(
sendProduct
)
{
return
true
;
}
}
if
(
CollectionUtils
.
isNotEmpty
(
productBeanV1
.
getComboProduct
()))
{
boolean
comboProduct
=
productBeanV1
.
getComboProduct
().
stream
().
anyMatch
(
combo
->
goodsList
.
contains
(
StringUtils
.
isBlank
(
combo
.
getSpecification
())?
combo
.
getProductId
():
combo
.
getSpecification
()));
if
(
comboProduct
)
{
if
(
CollectionUtils
.
isNotEmpty
(
productBeanV1
.
getComboProduct
()))
{
boolean
comboProduct
=
productBeanV1
.
getComboProduct
().
stream
().
anyMatch
(
combo
->
goodsList
.
contains
(
StringUtils
.
isBlank
(
combo
.
getSpecification
())
?
combo
.
getProductId
()
:
combo
.
getSpecification
()));
if
(
comboProduct
)
{
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