From 9b5849d5058a74880a4d8b5a20b2d19f7d4f3769 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期四, 28 五月 2020 19:19:41 +0800
Subject: [PATCH] 优化代码
---
Api/src/main/java/com/java110/api/bmo/ApiBaseBMO.java | 71 +++++++++++++++++++++++++++++++++++
1 files changed, 71 insertions(+), 0 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 0ab62dd..31da303 100644
--- a/Api/src/main/java/com/java110/api/bmo/ApiBaseBMO.java
+++ b/Api/src/main/java/com/java110/api/bmo/ApiBaseBMO.java
@@ -5,9 +5,11 @@
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;
+import com.java110.utils.util.BeanConvertUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.web.client.HttpStatusCodeException;
@@ -50,6 +52,7 @@
* @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);
}
@@ -65,6 +68,7 @@
//灏� rest header 淇℃伅浼犻�掑埌涓嬪眰鏈嶅姟涓幓
HttpHeaders header = new HttpHeaders();
+
freshHttpHeader(header, context.getRequestCurrentHeaders());
ResponseEntity responseEntity = null;
@@ -195,6 +199,14 @@
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));
+ }
+
+ if(CommonConstant.O_ID.equals(key)){
+ orders.put("oId", headers.get(CommonConstant.O_ID));
+ }
}
}
@@ -222,7 +234,66 @@
if (CommonConstant.HTTP_USER_ID.equals(key)) {
httpHeaders.add("user_id", headers.get(key));
}
+
+
}
}
+
+ /**
+ * 鏂板鏁版嵁鏂规硶
+ *
+ * @param context 涓婁笅鏂囧璞�
+ * @param param po瀵硅薄
+ */
+ public void insert(DataFlowContext context, Object param, String businessType) {
+ JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+ business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, businessType);
+ business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+ JSONObject businessObj = new JSONObject();
+ businessObj = JSONObject.parseObject(JSONObject.toJSONString(BeanConvertUtil.beanCovertMap(param)));
+ JSONArray businessArr = new JSONArray();
+ businessArr.add(businessObj);
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(businessType, businessArr);
+ context.addServiceBusiness(business);
+ }
+
+ /**
+ * 鏂板鏁版嵁鏂规硶
+ *
+ * @param context 涓婁笅鏂囧璞�
+ * @param param po瀵硅薄
+ */
+ public void update(DataFlowContext context, Object param, String businessType) {
+ JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+ business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, businessType);
+ business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+ JSONObject businessObj = new JSONObject();
+ businessObj = JSONObject.parseObject(JSONObject.toJSONString(BeanConvertUtil.beanCovertMap(param)));
+ JSONArray businessArr = new JSONArray();
+ businessArr.add(businessObj);
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(businessType, businessArr);
+ context.addServiceBusiness(business);
+ }
+
+ /**
+ * 鏂板鏁版嵁鏂规硶
+ *
+ * @param context 涓婁笅鏂囧璞�
+ * @param param po瀵硅薄
+ */
+ public void delete(DataFlowContext context, Object param, String businessType) {
+ JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+ business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, businessType);
+ business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+ JSONObject businessObj = new JSONObject();
+ businessObj = JSONObject.parseObject(JSONObject.toJSONString(BeanConvertUtil.beanCovertMap(param)));
+ JSONArray businessArr = new JSONArray();
+ businessArr.add(businessObj);
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(businessType, businessArr);
+ context.addServiceBusiness(business);
+ }
}
--
Gitblit v1.8.0