From 8ddb4e5684d0270e206fff6e063552abec835d59 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期二, 19 五月 2020 17:25:20 +0800
Subject: [PATCH] 优化心跳线程
---
Api/src/main/java/com/java110/api/bmo/ApiBaseBMO.java | 33 +++++++++++++++++++++++++++------
1 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/Api/src/main/java/com/java110/api/bmo/ApiBaseBMO.java b/Api/src/main/java/com/java110/api/bmo/ApiBaseBMO.java
index 439bdad..1434bdc 100644
--- a/Api/src/main/java/com/java110/api/bmo/ApiBaseBMO.java
+++ b/Api/src/main/java/com/java110/api/bmo/ApiBaseBMO.java
@@ -5,6 +5,7 @@
import com.java110.core.context.DataFlowContext;
import com.java110.core.factory.DataFlowFactory;
import com.java110.entity.center.AppService;
+import com.java110.entity.order.Orders;
import com.java110.event.service.api.ServiceDataFlowEvent;
import com.java110.utils.constant.CommonConstant;
import com.java110.utils.constant.ServiceCodeConstant;
@@ -34,7 +35,7 @@
* @param event
* @return
*/
- protected ResponseEntity<String> callService(ServiceDataFlowEvent event) {
+ public ResponseEntity<String> callService(ServiceDataFlowEvent event) {
DataFlowContext dataFlowContext = event.getDataFlowContext();
AppService service = event.getAppService();
@@ -50,9 +51,23 @@
* @return
*/
public ResponseEntity<String> callService(DataFlowContext context, String serviceCode,JSONArray businesses) {
+ context.getRequestCurrentHeaders().put(CommonConstant.HTTP_ORDER_TYPE_CD, "D");
JSONObject paramInObj = restToCenterProtocol(businesses, context.getRequestCurrentHeaders());
+ return callService(context,serviceCode,paramInObj);
+ }
+
+ /**
+ * 璋冪敤涓嬫父鏈嶅姟
+ *
+ * @param context
+ * @param serviceCode 涓嬫父鏈嶅姟
+ * @return
+ */
+ public ResponseEntity<String> callService(DataFlowContext context, String serviceCode,JSONObject paramInObj) {
+
//灏� rest header 淇℃伅浼犻�掑埌涓嬪眰鏈嶅姟涓幓
HttpHeaders header = new HttpHeaders();
+
freshHttpHeader(header, context.getRequestCurrentHeaders());
ResponseEntity responseEntity = null;
@@ -72,7 +87,7 @@
* @param appService 涓嬫父鏈嶅姟
* @return
*/
- protected ResponseEntity<String> callService(DataFlowContext context, AppService appService, Map paramIn) {
+ public ResponseEntity<String> callService(DataFlowContext context, AppService appService, Map paramIn) {
context.getRequestCurrentHeaders().put(CommonConstant.HTTP_ORDER_TYPE_CD, "D");
@@ -130,7 +145,7 @@
* @param headers 璁㈠崟澶翠俊鎭�
* @return
*/
- protected JSONObject restToCenterProtocol(JSONArray businesses, Map<String, String> headers) {
+ public JSONObject restToCenterProtocol(JSONArray businesses, Map<String, String> headers) {
JSONObject centerProtocol = JSONObject.parseObject("{\"orders\":{},\"business\":[]}");
freshOrderProtocol(centerProtocol.getJSONObject("orders"), headers);
@@ -145,7 +160,7 @@
* @param business
* @return
*/
- protected JSONObject restToCenterProtocol(JSONObject business, Map<String, String> headers) {
+ public JSONObject restToCenterProtocol(JSONObject business, Map<String, String> headers) {
JSONObject centerProtocol = JSONObject.parseObject("{\"orders\":{},\"business\":[]}");
freshOrderProtocol(centerProtocol.getJSONObject("orders"), headers);
@@ -161,7 +176,7 @@
* @param orders 璁㈠崟淇℃伅
* @param headers 澶撮儴淇℃伅
*/
- protected void freshOrderProtocol(JSONObject orders, Map<String, String> headers) {
+ public void freshOrderProtocol(JSONObject orders, Map<String, String> headers) {
for (String key : headers.keySet()) {
if (CommonConstant.HTTP_APP_ID.equals(key)) {
@@ -183,6 +198,10 @@
if (CommonConstant.HTTP_USER_ID.equals(key)) {
orders.put("userId", headers.get(key));
}
+
+ if(CommonConstant.ORDER_PROCESS.equals(key)){
+ orders.put("orderProcess", headers.get(CommonConstant.ORDER_PROCESS));
+ }
}
}
@@ -193,7 +212,7 @@
* @param httpHeaders http 澶翠俊鎭�
* @param headers 澶撮儴淇℃伅
*/
- protected void freshHttpHeader(HttpHeaders httpHeaders, Map<String, String> headers) {
+ public void freshHttpHeader(HttpHeaders httpHeaders, Map<String, String> headers) {
for (String key : headers.keySet()) {
if (CommonConstant.HTTP_APP_ID.equals(key)) {
@@ -210,6 +229,8 @@
if (CommonConstant.HTTP_USER_ID.equals(key)) {
httpHeaders.add("user_id", headers.get(key));
}
+
+
}
}
--
Gitblit v1.8.0