wuxw7
2018-06-16 7afa32638bd4c1eec05a19a6586af3f4b1ce8ccb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package com.java110.core.context;
 
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.common.constant.ResponseConstant;
import com.java110.common.exception.InitDataFlowContextException;
import com.java110.entity.center.Business;
 
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
 
/**
 * 业务系统数据流
 * Created by wuxw on 2018/5/18.
 */
public class BusinessServiceDataFlow extends AbstractDataFlowContext {
 
 
    private String bId;
 
    private Map<String,Object> paramOut;
 
    @Override
    public Orders getOrder() {
        return this;
    }
 
 
    public BusinessServiceDataFlow(Date startDate, String code) {
        super(startDate, code);
    }
 
    public BusinessServiceDataFlow doBuilder(String reqInfo, Map<String, String> headerAll) throws InitDataFlowContextException {
        try{
            Business business = null;
            JSONObject reqInfoObj = JSONObject.parseObject(reqInfo);
            JSONObject orderObj = reqInfoObj.getJSONObject("orders");
            JSONObject businessObject = reqInfoObj.getJSONObject("business");
            this.setReqJson(reqInfoObj);
            this.setDataFlowId(orderObj.containsKey("dataFlowId")?orderObj.getString("dataFlowId"):"-1");
            this.setTransactionId(orderObj.getString("transactionId"));
            this.setOrderTypeCd(orderObj.getString("orderTypeCd"));
            this.setRequestTime(orderObj.getString("requestTime"));
            this.setBusinessType(orderObj.getString("businessType"));
            this.setbId(businessObject.getString("bId"));
            paramOut = new HashMap<String, Object>();
            this.businesses = new ArrayList<Business>();
            business = new Business().builder(businessObject);
            businesses.add(business);
            this.setCurrentBusiness(business);
            if (headerAll != null){
                this.requestCurrentHeaders.putAll(headerAll);
                this.requestHeaders.putAll(headerAll);
            }
        }catch (Exception e){
            throw new InitDataFlowContextException(ResponseConstant.RESULT_PARAM_ERROR,"初始化对象 BusinessServiceDataFlow 失败 "+reqInfo);
        }
        return this;
    }
 
    public Map<String, Object> getParamOut() {
        return paramOut;
    }
 
    public void addParamOut(String key,Object value) {
        this.paramOut.put(key,value);
    }
 
    public String getbId() {
        return bId;
    }
 
    public void setbId(String bId) {
        this.bId = bId;
    }
}