From 8dc6389c6d65d49bfb2569a39ffa3494b5e7ff48 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期四, 12 五月 2022 12:28:25 +0800
Subject: [PATCH] Merge branch 'master' of http://git.homecommunity.cn/supervip/MicroCommunity
---
java110-core/src/main/java/com/java110/core/context/AbstractDataFlowContext.java | 202 +++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 181 insertions(+), 21 deletions(-)
diff --git a/java110-core/src/main/java/com/java110/core/context/AbstractDataFlowContext.java b/java110-core/src/main/java/com/java110/core/context/AbstractDataFlowContext.java
old mode 100644
new mode 100755
index b826e09..8ec9b4f
--- a/java110-core/src/main/java/com/java110/core/context/AbstractDataFlowContext.java
+++ b/java110-core/src/main/java/com/java110/core/context/AbstractDataFlowContext.java
@@ -5,6 +5,7 @@
import com.java110.entity.center.Business;
import com.java110.entity.center.DataFlowLinksCost;
import com.java110.entity.center.DataFlowLog;
+import org.springframework.http.ResponseEntity;
import java.util.*;
@@ -12,7 +13,7 @@
* 鏁版嵁娴佷笂涓嬫枃
* Created by wuxw on 2018/5/18.
*/
-public abstract class AbstractDataFlowContext implements DataFlowContext,Orders{
+public abstract class AbstractDataFlowContext extends AbstractTransactionLog implements DataFlowContext, IOrders, TransactionLog {
private String dataFlowId;
@@ -30,14 +31,20 @@
private JSONArray resBusiness;
+ private JSONArray serviceBusiness;
+
private String code;
private String message;
+ private String reqData;
+
private JSONObject reqJson;
private JSONObject resJson;
+
+ private String resData;
protected List<Business> businesses;
@@ -47,7 +54,10 @@
private List<DataFlowLog> logDatas = new ArrayList<DataFlowLog>();
- protected Map<String,String> headers = new HashMap<String,String>();
+ protected Map<String, String> requestHeaders = new HashMap<String, String>();
+ protected Map<String, String> requestCurrentHeaders = new HashMap<String, String>();
+ protected Map<String, String> responseHeaders = new HashMap<String, String>();
+ protected Map<String, String> responseCurrentHeaders = new HashMap<String, String>();
//璇锋眰寮�濮嬫椂闂�
private Date startDate;
@@ -57,12 +67,46 @@
/**
* 鏋勫缓 瀵硅薄淇℃伅
+ *
* @param reqInfo
* @param headerAll
* @return
* @throws Exception
*/
- public abstract DataFlowContext builder(String reqInfo, Map<String,String> headerAll) throws Exception;
+ public <T> T builder(String reqInfo, Map<String, String> headerAll) throws Exception {
+ //棰勫鐞�
+ preBuilder(reqInfo, headerAll);
+ //璋冪敤builder
+ T dataFlowContext = (T) doBuilder(reqInfo, headerAll);
+ //鍚庡鐞�
+ afterBuilder((DataFlowContext) dataFlowContext);
+ return dataFlowContext;
+ }
+
+
+ /**
+ * 棰勫鐞�
+ *
+ * @param reqInfo
+ * @param headerAll
+ */
+ protected void preBuilder(String reqInfo, Map<String, String> headerAll) {
+ super.preBuilder(reqInfo, headerAll);
+ }
+
+ /**
+ * 鏋勫缓瀵硅薄
+ *
+ * @param reqInfo
+ * @param headerAll
+ * @return
+ * @throws Exception
+ */
+ public abstract DataFlowContext doBuilder(String reqInfo, Map<String, String> headerAll) throws Exception;
+
+ protected void afterBuilder(DataFlowContext dataFlowContext) {
+
+ }
public void setTransactionId(String transactionId) {
this.transactionId = transactionId;
@@ -148,18 +192,29 @@
this.endDate = endDate;
}
- public Map<String, String> getHeaders() {
- return headers;
+ public Map<String, String> getRequestHeaders() {
+ return requestHeaders;
}
- public JSONObject getReqJson() {
- return reqJson;
+ public Map<String, String> getResponseHeaders() {
+ return responseHeaders;
}
- public void setReqJson(JSONObject reqJson) {
- this.reqJson = reqJson;
+ public Map<String, String> getRequestCurrentHeaders() {
+ return requestHeaders;
}
+ public Map<String, String> getResponseCurrentHeaders() {
+ return responseHeaders;
+ }
+
+ public String getReqData() {
+ return reqData;
+ }
+
+ public void setReqData(String reqData) {
+ this.reqData = reqData;
+ }
public JSONObject getResJson() {
return resJson;
@@ -167,6 +222,7 @@
public void setResJson(JSONObject resJson) {
this.resJson = resJson;
+ this.setResData(resJson.toJSONString());
}
public List<DataFlowLinksCost> getLinksCostDates() {
@@ -174,7 +230,7 @@
}
- public List<DataFlowLog> getLogDatas(){
+ public List<DataFlowLog> getLogDatas() {
return logDatas;
}
@@ -196,30 +252,60 @@
/**
* 娣诲姞鍚勪釜鐜妭鐨勬棩蹇�
+ *
* @param dataFlowLog
*/
- public void addLogDatas(DataFlowLog dataFlowLog){
+ public void addLogDatas(DataFlowLog dataFlowLog) {
this.logDatas.add(dataFlowLog);
}
/**
* 娣诲姞鍚勪釜鐜妭鐨勮�楁椂
+ *
* @param dataFlowLinksCost
*/
- public void addLinksCostDates(DataFlowLinksCost dataFlowLinksCost){
+ public void addLinksCostDates(DataFlowLinksCost dataFlowLinksCost) {
this.linksCostDates.add(dataFlowLinksCost);
}
- public String getAppId(){return null;}
+ public String getAppId() {
+ return null;
+ }
- public String getUserId(){return null;};
+ public String getUserId() {
+ return null;
+ }
- public String getRemark(){return null;};
+ ;
- public String getReqSign(){return null;};
+ @Override
+ public void setAppId(String appId) {
- public JSONArray getAttrs(){return null;};
+ }
+
+ @Override
+ public void setUserId(String userId) {
+
+ }
+
+ public String getRemark() {
+ return null;
+ }
+
+ ;
+
+ public String getReqSign() {
+ return null;
+ }
+
+ ;
+
+ public JSONArray getAttrs() {
+ return null;
+ }
+
+ ;
public String getBusinessType() {
return businessType;
@@ -233,20 +319,94 @@
return null;
}
- public void addParamOut(String key,Object value) {
+ public String getResData() {
+ return resData;
+ }
+
+ public void setResData(String resData) {
+ this.resData = resData;
+ }
+
+ public JSONObject getReqJson() {
+ return reqJson;
+ }
+
+ public void setReqJson(JSONObject reqJson) {
+ this.reqJson = reqJson;
+ }
+
+ public void addParamOut(String key, Object value) {
}
- public String getbId(){
+ public void setPort(String port) {
+ this.port = port;
+ }
+
+ public String getbId() {
return null;
}
- public abstract Orders getOrder();
+ public String getLogId() {
+ return getbId();
+ }
- protected AbstractDataFlowContext(Date startDate, String code){
+
+ /**
+ * 涓氬姟缂栫爜 褰撳墠闇�瑕佸鐞嗙殑涓氬姟缂栫爜锛屽彲浠ュ啓灏嗚璇锋眰鏈嶅姟鎻愪緵鏂圭殑鏂规硶鍚�
+ * 涓昏鐢ㄤ簬 鏃ュ織绔睍绀�
+ *
+ * @return 褰撳墠鏈嶅姟缂栫爜
+ */
+ public String getServiceCode() {
+ if (this.currentBusiness != null) {
+ return currentBusiness.getServiceCode();
+ }
+ return "";
+ }
+
+ /**
+ * 涓氬姟鍚嶇О 褰撳墠闇�瑕佸鐞嗙殑涓氬姟鍚嶇О锛屽彲浠ュ綋鍓嶈皟鐢ㄧ殑涓氬姟鍚嶇О 濡� 鍟嗗搧璐拱 绛�
+ * 涓昏鐢ㄤ簬 鏃ュ織绔睍绀�
+ *
+ * @return 褰撳墠鏈嶅姟鍚嶇О
+ */
+ public String getServiceName() {
+ if (this.currentBusiness != null) {
+ return currentBusiness.getServiceName();
+ }
+ return "";
+ }
+
+
+ public abstract IOrders getOrder();
+
+ protected AbstractDataFlowContext(Date startDate, String code) {
this.setStartDate(startDate);
this.setCode(code);
}
+ public void setResponseEntity(ResponseEntity responseEntity) {
+
+ }
+
+ public ResponseEntity getResponseEntity() {
+ return null;
+ }
+
+ public JSONArray getServiceBusiness() {
+ return serviceBusiness;
+ }
+
+ public void addServiceBusiness(JSONObject serviceBusiness) {
+ if (this.serviceBusiness == null) {
+ this.serviceBusiness = new JSONArray();
+ }
+ this.serviceBusiness.add(serviceBusiness);
+ }
+
+ public void setServiceBusiness(JSONArray serviceBusinesses) {
+ this.serviceBusiness = serviceBusinesses;
+ }
}
--
Gitblit v1.8.0