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
38aafa19
Commit
38aafa19
authored
Jul 01, 2022
by
查志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单推送开放平台增加黑名单配置
parent
7d3d3d7a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
1 deletions
+80
-1
call-back-service/src/main/java/cn/freemud/amp/service/OrderCallBackMQService.java
+6
-1
call-back-service/src/main/java/cn/freemud/config/PushOrderConfig.java
+74
-0
No files found.
call-back-service/src/main/java/cn/freemud/amp/service/OrderCallBackMQService.java
View file @
38aafa19
...
@@ -17,6 +17,7 @@ import cn.freemud.amqp.Header;
...
@@ -17,6 +17,7 @@ import cn.freemud.amqp.Header;
import
cn.freemud.amqp.MQAction
;
import
cn.freemud.amqp.MQAction
;
import
cn.freemud.amqp.MQMessage
;
import
cn.freemud.amqp.MQMessage
;
import
cn.freemud.amqp.MQService
;
import
cn.freemud.amqp.MQService
;
import
cn.freemud.config.PushOrderConfig
;
import
cn.freemud.constant.RedisKeyConstant
;
import
cn.freemud.constant.RedisKeyConstant
;
import
cn.freemud.entities.dto.OrderExtInfoDto
;
import
cn.freemud.entities.dto.OrderExtInfoDto
;
import
cn.freemud.entities.dto.OrderStatusChangeRequestDto
;
import
cn.freemud.entities.dto.OrderStatusChangeRequestDto
;
...
@@ -66,6 +67,9 @@ public class OrderCallBackMQService {
...
@@ -66,6 +67,9 @@ public class OrderCallBackMQService {
private
static
final
String
backOrdersNotifyActivityExchange
=
"program.backorders_notify_activity_exchange"
;
private
static
final
String
backOrdersNotifyActivityExchange
=
"program.backorders_notify_activity_exchange"
;
@Autowired
@Autowired
private
LogUtil
logUtil
;
private
LogUtil
logUtil
;
@Autowired
private
PushOrderConfig
pushOrderConfig
;
public
void
sendOrderMQ
(
OrderCallBackRequestVo
body
)
{
public
void
sendOrderMQ
(
OrderCallBackRequestVo
body
)
{
OrderInfoReqs
orderInfoReqs
=
getOrderInfoReqs
(
body
);
OrderInfoReqs
orderInfoReqs
=
getOrderInfoReqs
(
body
);
if
(
orderInfoReqs
==
null
)
{
if
(
orderInfoReqs
==
null
)
{
...
@@ -190,7 +194,8 @@ public class OrderCallBackMQService {
...
@@ -190,7 +194,8 @@ public class OrderCallBackMQService {
if
(
checkParkingOrders
(
orderInfoReqs
))
{
if
(
checkParkingOrders
(
orderInfoReqs
))
{
return
false
;
return
false
;
}
}
return
true
;
//订单推送改造, 过渡期部分聚合层推送, 部分不推送,由基础服务推送
return
pushOrderConfig
.
needPushOrder
(
orderInfoReqs
.
getPartnerId
(),
orderInfoReqs
.
getStoreId
());
}
}
private
OrderInfoReqs
getWechatReportOrderInfoReqs
(
OrderCallBackRequestVo
body
)
{
private
OrderInfoReqs
getWechatReportOrderInfoReqs
(
OrderCallBackRequestVo
body
)
{
...
...
call-back-service/src/main/java/cn/freemud/config/PushOrderConfig.java
0 → 100644
View file @
38aafa19
package
cn
.
freemud
.
config
;
import
lombok.Data
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.Configuration
;
import
java.util.*
;
/**
* @author Clover.z
* @version 1.0.0
* @since 1.0.0
*/
@Data
@Configuration
@ConfigurationProperties
(
prefix
=
"push-order"
)
public
class
PushOrderConfig
{
/**
* 不推送开放平台的商户和门店配置
* 格式: 商户号:门店号,门店号,...;商户号:门店号,门店号,...;...
* 如果只配置了商户号, 则表示全门店都不推送
*/
private
String
config
;
/**
* 不推送开放平台的商户门店信息
* key:商户号
*/
private
Map
<
String
,
List
<
String
>>
notPushMap
;
public
synchronized
void
initMap
()
{
if
(
null
==
notPushMap
)
{
notPushMap
=
new
HashMap
<>();
if
(
StringUtils
.
isBlank
(
config
))
return
;
String
[]
cfgList
=
config
.
split
(
";"
);
for
(
String
cfg
:
cfgList
)
{
//格式必须是 商户号:门店号
String
[]
s
=
cfg
.
split
(
":"
);
if
(
s
.
length
==
1
)
{
//全商户
notPushMap
.
put
(
s
[
0
],
new
ArrayList
<>());
}
else
{
// 不满足格式直接忽略
if
(
s
.
length
!=
2
)
continue
;
notPushMap
.
put
(
s
[
0
],
Arrays
.
asList
(
s
[
1
].
split
(
","
)));
}
}
}
}
/**
* 判断门店的订单 是否需要推送三方
* @param partnerId 商户号
* @param storeCode 门店号
* @return 是否需要推送
*/
public
boolean
needPushOrder
(
String
partnerId
,
String
storeCode
)
{
// 未配置, 聚合层全部不推送,由基础服务统一推送开放平台
if
(
StringUtils
.
isBlank
(
config
))
return
false
;
if
(
null
==
notPushMap
)
initMap
();
// 商户号是否在推送黑名单配置中
List
<
String
>
storeList
=
notPushMap
.
get
(
partnerId
);
// 配置了商户,没有配置门店, 表示所有门店都不推送
if
(
CollectionUtils
.
isEmpty
(
storeList
))
return
false
;
return
!
storeList
.
contains
(
storeCode
);
}
}
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