wuxw7
2018-06-13 28441b3922e6188f643d145a32c55d4fa285af84
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
79
package com.java110.core.context;
 
import com.alibaba.fastjson.JSONObject;
 
import java.util.Date;
import java.util.Map;
 
/**
 * 主键生成
 * Created by wuxw on 2018/6/3.
 */
public class CodeDataFlow extends AbstractDataFlowContext {
 
    /**
     * 前缀
     */
    private String prefix;
 
    private String hostName;
 
    private String port;
 
    public String getPrefix() {
        return prefix;
    }
 
    public void setPrefix(String prefix) {
        this.prefix = prefix;
    }
 
    public String getHostName() {
        return hostName;
    }
 
    public void setHostName(String hostName) {
        this.hostName = hostName;
    }
 
    public String getPort() {
        return port;
    }
 
 
 
    public void setPort(String port) {
        this.port = port;
    }
 
    public CodeDataFlow(Date startDate, String code) {
        super(startDate, code);
    }
 
    @Override
    public CodeDataFlow doBuilder(String reqInfo, Map<String, String> headerAll) throws Exception {
        JSONObject reqInfoObj = JSONObject.parseObject(reqInfo);
        this.setReqJson(reqInfoObj);
        this.setReqData(reqInfo);
        this.setTransactionId(reqInfoObj.getString("transactionId"));
        this.setRequestTime(reqInfoObj.getString("requestTime"));
 
        if (headerAll != null && !headerAll.isEmpty()){
           this.headers.putAll(headerAll);
        }
 
        if(headerAll != null && headerAll.containsKey("hostName")) {
            this.setHostName(headerAll.get("hostName"));
        }
        if(headerAll != null && headerAll.containsKey("port")) {
            this.setPort(headerAll.get("port"));
        }
        this.setPrefix(reqInfoObj.getString("prefix"));
        return this;
    }
 
    @Override
    public Orders getOrder() {
        return this;
    }
}