| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | * Created by wuxw on 2018/4/13. |
| | | */ |
| | | public class DataFlow { |
| | | |
| | | |
| | | private String dataFlowId; |
| | | |
| | | private String oId; |
| | | |
| | |
| | | //请求完成时间 |
| | | private Date endDate; |
| | | |
| | | private String reqJson; |
| | | private JSONObject reqJson; |
| | | |
| | | private String resJson; |
| | | private JSONObject resJson; |
| | | |
| | | private List<Business> businesses; |
| | | |
| | | private String requestURL; |
| | | |
| | | private List<DataFlowLinksCost> linksCostDatas = new ArrayList<DataFlowLinksCost>(); |
| | | private List<DataFlowLinksCost> linksCostDates = new ArrayList<DataFlowLinksCost>(); |
| | | |
| | | private Map<String,String> headers = new HashMap<String,String>(); |
| | | |
| | | private AppRoute appRoute; |
| | | /*private AppRoute appRoute;*/ |
| | | |
| | | private List<AppRoute> appRoutes = new ArrayList<AppRoute>(); |
| | | //请求业务系统报文 |
| | | private JSONObject requestBusinessJson; |
| | | |
| | |
| | | return businesses; |
| | | } |
| | | |
| | | public String getDataFlowId() { |
| | | return dataFlowId; |
| | | } |
| | | |
| | | public void setDataFlowId(String dataFlowId) { |
| | | this.dataFlowId = dataFlowId; |
| | | } |
| | | |
| | | public void setBusinesses(List<Business> businesses) { |
| | | this.businesses = businesses; |
| | |
| | | this.endDate = endDate; |
| | | } |
| | | |
| | | public String getReqJson() { |
| | | return reqJson; |
| | | } |
| | | |
| | | public void setReqJson(String reqJson) { |
| | | this.reqJson = reqJson; |
| | | } |
| | | |
| | | public String getResJson() { |
| | | return resJson; |
| | | } |
| | | |
| | | public void setResJson(String resJson) { |
| | | this.resJson = resJson; |
| | | } |
| | | |
| | | public String getRequestURL() { |
| | | return requestURL; |
| | |
| | | return headers; |
| | | } |
| | | |
| | | public AppRoute getAppRoute() { |
| | | /*public AppRoute getAppRoute() { |
| | | return appRoute; |
| | | } |
| | | |
| | | public void setAppRoute(AppRoute appRoute) { |
| | | this.appRoute = appRoute; |
| | | }*/ |
| | | |
| | | public List<AppRoute> getAppRoutes() { |
| | | return appRoutes; |
| | | } |
| | | |
| | | public void addAppRoutes(AppRoute appRoute) { |
| | | this.appRoutes.add(appRoute); |
| | | } |
| | | |
| | | public String getIp() { |
| | |
| | | this.responseBusinessJson = responseBusinessJson; |
| | | } |
| | | |
| | | public JSONObject getReqJson() { |
| | | return reqJson; |
| | | } |
| | | |
| | | public void setReqJson(JSONObject reqJson) { |
| | | this.reqJson = reqJson; |
| | | } |
| | | |
| | | public JSONObject getResJson() { |
| | | return resJson; |
| | | } |
| | | |
| | | public void setResJson(JSONObject resJson) { |
| | | this.resJson = resJson; |
| | | } |
| | | |
| | | public List<DataFlowLinksCost> getLinksCostDates() { |
| | | return linksCostDates; |
| | | } |
| | | |
| | | /** |
| | | * 添加各个环节的耗时 |
| | | * @param dataFlowLinksCost |
| | | */ |
| | | public void addLinksCostDatas(DataFlowLinksCost dataFlowLinksCost){ |
| | | this.linksCostDatas.add(dataFlowLinksCost); |
| | | public void addLinksCostDates(DataFlowLinksCost dataFlowLinksCost){ |
| | | this.linksCostDates.add(dataFlowLinksCost); |
| | | } |
| | | |
| | | public DataFlow builder(String reqInfo, Map<String,String> headerAll) throws Exception{ |
| | |
| | | JSONObject reqInfoObj = JSONObject.parseObject(reqInfo); |
| | | JSONObject orderObj = reqInfoObj.getJSONObject("orders"); |
| | | JSONArray businessArray = reqInfoObj.getJSONArray("business"); |
| | | this.setReqJson(reqInfoObj); |
| | | this.setDataFlowId(orderObj.containsKey("dataFlowId")?orderObj.getString("dataFlowId"):"-1"); |
| | | this.setAppId(orderObj.getString("appId")); |
| | | this.setAppId(orderObj.getString("transactionId")); |
| | | this.setTransactionId(orderObj.getString("transactionId")); |
| | | this.setUserId(orderObj.getString("userId")); |
| | | this.setOrderTypeCd(orderObj.getString("orderTypeCd")); |
| | | this.setRemark(orderObj.getString("remark")); |
| | |
| | | |
| | | |
| | | }catch (Exception e){ |
| | | |
| | | throw e; |
| | | } |
| | | return this; |