许鹏程
2023-06-30 3bbfaa3d7d416afbd154576453c8ee9e7e2f8899
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
package com.product.data.center.entity;
 
import com.product.core.entity.DataTableEntity;
import com.product.data.center.utils.CallBackReturnValue;
import com.product.datasource.entity.DataBaseEntity;
import com.product.util.CallBack;
 
/**
 * 批处理配置
 */
public class BatchConfigEntity {
 
    /**
     * 来源数据库连接信息
     */
    private DataBaseEntity sourceDbe;
 
    /**
     * 目标数据库连接信息
     */
    private DataBaseEntity targetDbe;
    /**
     * 查询数据
     */
    private QueryDataConfigEntity queryEntity;
 
    /**
     * 数据查询后处理回调接口
     */
    private CallBackReturnValue<DataTableEntity, DataTableEntity> dataDispose;
    /**
     * 每批次处理插入的数量
     */
    private int batchDisposeSize = 2000;
    /**
     * 批次插入错误处理回调
     */
    private CallBack<BatchExecuteEntity> batchError;
 
    /**
     * 错误后继续
     */
    private boolean errorContinue = true;
 
 
    /**
     * @param sourceDbe     来源数据库连接信息
     * @param targetDbe     目标数据库连接信息
     * @param queryEntity   查询数据sql
     * @param dataDispose   数据查询后处理回调接口
     * @param batchError    批次插入错误处理回调
     * @param errorContinue 错误后继续
     */
    public BatchConfigEntity(DataBaseEntity sourceDbe,
                             DataBaseEntity targetDbe,
                             QueryDataConfigEntity queryEntity,
                             CallBackReturnValue<DataTableEntity, DataTableEntity> dataDispose,
                             CallBack<BatchExecuteEntity> batchError,
                             boolean errorContinue) {
        this.sourceDbe = sourceDbe;
        this.targetDbe = targetDbe;
        this.queryEntity = queryEntity;
        queryEntity.setDbt(sourceDbe.getDataBaseType());
        this.dataDispose = dataDispose;
        this.batchError = batchError;
        this.errorContinue = errorContinue;
    }
 
    /**
     * @param sourceDbe        来源数据库连接信息
     * @param targetDbe        目标数据库连接信息
     * @param queryEntity      查询数据sql
     * @param dataDispose      数据查询后处理回调接口
     * @param batchDisposeSize 每批次处理插入的数量
     * @param batchError       批次插入错误处理回调
     * @param errorContinue    错误后继续
     */
    public BatchConfigEntity(DataBaseEntity sourceDbe,
                             DataBaseEntity targetDbe,
                             QueryDataConfigEntity queryEntity,
                             CallBackReturnValue<DataTableEntity, DataTableEntity> dataDispose,
                             int batchDisposeSize,
                             CallBack<BatchExecuteEntity> batchError,
                             boolean errorContinue) {
        this.sourceDbe = sourceDbe;
        this.targetDbe = targetDbe;
        this.queryEntity = queryEntity;
        queryEntity.setDbt(sourceDbe.getDataBaseType());
        this.dataDispose = dataDispose;
        this.batchDisposeSize = batchDisposeSize;
        this.batchError = batchError;
        this.errorContinue = errorContinue;
    }
 
    public DataBaseEntity getSourceDbe() {
        return sourceDbe;
    }
 
    public void setSourceDbe(DataBaseEntity sourceDbe) {
        this.sourceDbe = sourceDbe;
    }
 
    public QueryDataConfigEntity getQueryEntity() {
        return queryEntity;
    }
 
    public DataBaseEntity getTargetDbe() {
        return targetDbe;
    }
 
    public void setTargetDbe(DataBaseEntity targetDbe) {
        this.targetDbe = targetDbe;
    }
 
    public void setQueryEntity(QueryDataConfigEntity queryEntity) {
        this.queryEntity = queryEntity;
    }
 
    public CallBackReturnValue<DataTableEntity, DataTableEntity> getDataDispose() {
        return dataDispose;
    }
 
    public void setDataDispose(CallBackReturnValue<DataTableEntity, DataTableEntity> dataDispose) {
        this.dataDispose = dataDispose;
    }
 
    public int getBatchDisposeSize() {
        return batchDisposeSize;
    }
 
    public void setBatchDisposeSize(int batchDisposeSize) {
        this.batchDisposeSize = batchDisposeSize;
    }
 
    public CallBack<BatchExecuteEntity> getBatchError() {
        return batchError;
    }
 
    public void setBatchError(CallBack<BatchExecuteEntity> batchError) {
        this.batchError = batchError;
    }
 
    public boolean isErrorContinue() {
        return errorContinue;
    }
 
    public void setErrorContinue(boolean errorContinue) {
        this.errorContinue = errorContinue;
    }
 
}