wuxw
2019-02-07 c5aac73ec29f74904b544a722037b39bbb85ab3e
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
package com.java110.core.context;
 
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.*;
 
/**
 * 数据流上下文
 * Created by wuxw on 2018/5/18.
 */
public abstract class AbstractOrderDataFlowContext extends AbstractDataFlowContextPlus implements IOrderDataFlowContext{
 
    protected AbstractOrderDataFlowContext(Date startDate, String code){}
 
    /**
     * 构建 对象信息
     * @param reqInfo
     * @param headerAll
     * @return
     * @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((IOrderDataFlowContext) dataFlowContext);
        return dataFlowContext;
    }
 
 
    /**
     * 预处理
     * @param reqInfo
     * @param headerAll
     */
    protected void preBuilder(String reqInfo, Map<String,String> headerAll) {
 
    }
 
    /**
     * 构建对象
     * @param reqInfo
     * @param headerAll
     * @return
     * @throws Exception
     */
    public abstract IOrderDataFlowContext doBuilder(String reqInfo, Map<String,String> headerAll) throws Exception;
 
    protected void afterBuilder(IOrderDataFlowContext dataFlowContext){
 
    }
 
}