tClass) {
38 | return excel(new XSSFWorkbook(), tClass);
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/com/github/liuhuagui/gridexcel/util/Assert.java:
--------------------------------------------------------------------------------
1 | package com.github.liuhuagui.gridexcel.util;
2 |
3 | import org.apache.commons.collections4.CollectionUtils;
4 |
5 | import java.util.Collection;
6 |
7 | /**
8 | * Assertion utility class that assists in validating arguments.
9 | * @author KaiKang
10 | */
11 | public class Assert {
12 |
13 | /**
14 | * Assert that a collection contains elements; that is, it must not be
15 | * {@code null} and must contain at least one element.
16 | * Assert.notEmpty(collection, "Collection must contain elements");
17 | * @param collection the collection to check
18 | * @param message the exception message to use if the assertion fails
19 | * @throws IllegalArgumentException if the collection is {@code null} or
20 | * contains no elements
21 | */
22 | public static void notEmpty(Collection> collection, String message) {
23 | if (CollectionUtils.isEmpty(collection)) {
24 | throw new IllegalArgumentException(message);
25 | }
26 | }
27 |
28 | /**
29 | * Assert that an object is not {@code null}.
30 | * Assert.notNull(clazz, "The class must not be null");
31 | * @param object the object to check
32 | * @param message the exception message to use if the assertion fails
33 | * @throws IllegalArgumentException if the object is {@code null}
34 | */
35 | public static void notNull(Object object, String message) {
36 | if (object == null) {
37 | throw new IllegalArgumentException(message);
38 | }
39 | }
40 |
41 | /**
42 | * Assert that an object is {@code null}.
43 | * Assert.isNull(value, "The value must be null");
44 | * @param object the object to check
45 | * @param message the exception message to use if the assertion fails
46 | * @throws IllegalArgumentException if the object is not {@code null}
47 | */
48 | public static void isNull(Object object, String message) {
49 | if (object != null) {
50 | throw new IllegalArgumentException(message);
51 | }
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/github/liuhuagui/gridexcel/util/ExcelType.java:
--------------------------------------------------------------------------------
1 | package com.github.liuhuagui.gridexcel.util;
2 |
3 |
4 | /**
5 | * Enumeration used to determine whether xls or xlsx should be processed.
6 | * @author KaiKang
7 | */
8 | public enum ExcelType {
9 | XLS,XLSX;
10 | }
11 |
--------------------------------------------------------------------------------
/src/test/java/ReadTest.java:
--------------------------------------------------------------------------------
1 | import bean.Consultant;
2 | import bean.Payment;
3 | import bean.TradeOrder;
4 | import com.alibaba.fastjson.JSON;
5 | import com.github.liuhuagui.gridexcel.GridExcel;
6 | import com.github.liuhuagui.gridexcel.eventmodel.XLSEventModel;
7 | import com.github.liuhuagui.gridexcel.eventmodel.XLSXEventModel;
8 | import com.github.liuhuagui.gridexcel.util.ExcelType;
9 | import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
10 | import org.junit.Test;
11 | import org.xml.sax.SAXException;
12 |
13 | import javax.xml.parsers.ParserConfigurationException;
14 | import java.io.IOException;
15 | import java.io.InputStream;
16 | import java.util.ArrayList;
17 | import java.util.HashMap;
18 | import java.util.Map;
19 |
20 | /**
21 | * 部分测试样例。
22 | * 其中{@link TradeOrder}、{@link Consultant}、{@link bean.Provider}、{@link bean.Service}、{@link bean.Customer}、{@link Payment}
23 | * 是用来测试的业务对象,目的是展现出GridExcel对关联对象较好的支持能力。使用时可以参照以下样例。
24 | *
25 | * @autor SunKaiKang
26 | * @date 2019/7/26 0026 13:10
27 | */
28 | public class ReadTest {
29 | /**
30 | * 测试{@link XLSEventModel}。
31 | * 业务逻辑处理方式二选一:
32 | * 1.放在readConsumer函数中。
33 | * 2.使用final or effective final的局部变量存放这写数据,做后续处理。
34 | */
35 | @Test
36 | public void xlsEventModelTest() throws IOException {
37 | InputStream resourceAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("2003.xls");
38 | ArrayList arrayList = new ArrayList();
39 | XLSEventModel xls = new XLSEventModel(resourceAsStream, 1, cs -> {
40 | TradeOrder tradeOrder = new TradeOrder();
41 | tradeOrder.setTradeOrderId(Long.valueOf(cs.get(0)));
42 | Consultant consultant = new Consultant();
43 | consultant.setConsultantName(cs.get(3));
44 | tradeOrder.setConsultant(consultant);
45 | tradeOrder.setPaymentRatio(cs.get(16));
46 | arrayList.add(tradeOrder);
47 | });
48 | xls.process();
49 | System.out.println(JSON.toJSONString(arrayList));
50 | }
51 |
52 | /**
53 | * 测试{@link XLSXEventModel}。
54 | * 业务逻辑处理方式二选一:
55 | * 1.放在readConsumer函数中。
56 | * 2.使用final or effective final的局部变量存放这写数据,做后续处理。
57 | */
58 | @Test
59 | public void xlsxEventModelTest() throws IOException, OpenXML4JException, ParserConfigurationException, SAXException {
60 | InputStream resourceAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("2007.xlsx");
61 | ArrayList arrayList = new ArrayList();
62 | XLSXEventModel xlsx = new XLSXEventModel(resourceAsStream, 1, cs -> {
63 | TradeOrder tradeOrder = new TradeOrder();
64 | tradeOrder.setTradeOrderId(Long.valueOf(cs.get(0)));
65 | Consultant consultant = new Consultant();
66 | consultant.setConsultantName(cs.get(3));
67 | tradeOrder.setConsultant(consultant);
68 | tradeOrder.setPaymentRatio(cs.get(16));
69 | arrayList.add(tradeOrder);
70 | });
71 | xlsx.process();
72 | System.out.println(JSON.toJSONString(arrayList));
73 | }
74 |
75 | /**
76 | * 业务逻辑处理方式三选一:
77 | * 1.启用windowListener,并将业务逻辑放在该函数中。
78 | * 2.不启用windowListener,使用get()方法取回全部数据集合,做后续处理。
79 | * 3.readFunction函数,直接放在函数中处理 或 使用final or effective final的局部变量存放这写数据,做后续处理。
80 | * 注意:使用EventModel时readFunction函数的输入为每行的cell值集合List。
81 | *
82 | * @throws Exception
83 | */
84 | @Test
85 | public void readXlsByEventModel() throws Exception {
86 | InputStream resourceAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("2003.xls");
87 | GridExcel.readByEventModel(resourceAsStream, TradeOrder.class, ExcelType.XLS)
88 | .window(2, ts -> System.out.println(JSON.toJSONString(ts)))//推荐在这里执行自己的业务逻辑
89 | .process(cs -> {
90 | TradeOrder tradeOrder = new TradeOrder();
91 | tradeOrder.setTradeOrderId(Long.valueOf(cs.get(0)));
92 | Consultant consultant = new Consultant();
93 | consultant.setConsultantName(cs.get(3));
94 | tradeOrder.setConsultant(consultant);
95 | tradeOrder.setPaymentRatio(cs.get(16));
96 | return tradeOrder;
97 | }, 1);
98 | }
99 |
100 | /**
101 | * 业务逻辑处理方式三选一:
102 | * 1.启用windowListener,并将业务逻辑放在该函数中。
103 | * 2.不启用windowListener,使用get()方法取回全部数据集合,做后续处理。
104 | * 3.readFunction函数,直接放在函数中处理 或 使用final or effective final的局部变量存放这写数据,做后续处理。
105 | * 注意:使用EventModel时readFunction函数的输入为每行的cell值集合List。
106 | *
107 | * @throws Exception
108 | */
109 | @Test
110 | public void readXlsxByEventModel() throws Exception {
111 | InputStream resourceAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("2007.xlsx");
112 | GridExcel.readByEventModel(resourceAsStream, TradeOrder.class, ExcelType.XLSX)
113 | .window(2, ts -> System.out.println(JSON.toJSONString(ts)))//推荐在这里执行自己的业务逻辑
114 | .process(cs -> {
115 | TradeOrder tradeOrder = new TradeOrder();
116 | tradeOrder.setTradeOrderId(Long.valueOf(cs.get(0)));
117 | Consultant consultant = new Consultant();
118 | consultant.setConsultantName(cs.get(3));
119 | tradeOrder.setConsultant(consultant);
120 | tradeOrder.setPaymentRatio(cs.get(16));
121 | return tradeOrder;
122 | }, 1);
123 | }
124 |
125 | /**
126 | * 业务逻辑处理方式三选一:
127 | * 1.启用windowListener,并将业务逻辑放在该函数中。
128 | * 2.不启用windowListener,使用get()方法取回全部数据集合,做后续处理。
129 | * 3.readFunction函数,直接放在函数中处理 或 使用final or effective final的局部变量存放这写数据,做后续处理。
130 | * 注意:使用UserModel时readFunction函数的输入为为Row对象。
131 | *
132 | * @throws Exception
133 | */
134 | @Test
135 | public void readXlsByUserModel() throws Exception {
136 | InputStream resourceAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("2003.xls");
137 | GridExcel.readByUserModel(resourceAsStream, TradeOrder.class, ExcelType.XLS)
138 | .window(2, ts -> System.out.println(JSON.toJSONString(ts)))//推荐在这里执行自己的业务逻辑
139 | .process(row -> {
140 | TradeOrder tradeOrder = new TradeOrder();
141 | tradeOrder.setTradeOrderId(Long.valueOf(row.getCell(0).getStringCellValue()));
142 | Consultant consultant = new Consultant();
143 | consultant.setConsultantName(row.getCell(3).getStringCellValue());
144 | tradeOrder.setConsultant(consultant);
145 | tradeOrder.setPaymentRatio(row.getCell(16).getStringCellValue());
146 | return tradeOrder;
147 | }, 1);
148 | }
149 |
150 | /**
151 | * 业务逻辑处理方式三选一:
152 | * 1.启用windowListener,并将业务逻辑放在该函数中。
153 | * 2.不启用windowListener,使用get()方法取回全部数据集合,做后续处理。
154 | * 3.readFunction函数,直接放在函数中处理 或 使用final or effective final的局部变量存放这写数据,做后续处理。
155 | * 注意:使用UserModel时readFunction函数的输入为为Row对象。
156 | *
157 | * @throws Exception
158 | */
159 | @Test
160 | public void readXlsxByUserModel() throws Exception {
161 | InputStream resourceAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("2007.xlsx");
162 | GridExcel.readByUserModel(resourceAsStream, TradeOrder.class, ExcelType.XLSX)
163 | .window(2, ts -> System.out.println(JSON.toJSONString(ts)))//推荐在这里执行自己的业务逻辑
164 | .process(row -> {
165 | TradeOrder tradeOrder = new TradeOrder();
166 | tradeOrder.setTradeOrderId(Long.valueOf(row.getCell(0).getStringCellValue()));
167 | Consultant consultant = new Consultant();
168 | consultant.setConsultantName(row.getCell(3).getStringCellValue());
169 | tradeOrder.setConsultant(consultant);
170 | tradeOrder.setPaymentRatio(row.getCell(16).getStringCellValue());
171 | return tradeOrder;
172 | }, 1);
173 | }
174 |
175 | /**
176 | * No Entity无实体类读Excel文件
177 | * 业务逻辑处理方式三选一:
178 | * 1.启用windowListener,并将业务逻辑放在该函数中。
179 | * 2.不启用windowListener,使用get()方法取回全部数据集合,做后续处理。
180 | * 3.readFunction函数,直接放在函数中处理 或 使用final or effective final的局部变量存放这写数据,做后续处理。
181 | * 注意:使用EventModel时readFunction函数的输入为每行的cell值集合List。
182 | *
183 | * @throws Exception
184 | */
185 | @Test
186 | public void readXlsxByEventModelWithoutEntity() throws Exception {
187 | InputStream resourceAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("2007.xlsx");
188 | GridExcel.readByEventModel(resourceAsStream, Map.class, ExcelType.XLSX)
189 | .window(2, ts -> System.out.println(JSON.toJSONString(ts)))//推荐在这里执行自己的业务逻辑
190 | .process(cs -> {
191 | Map map = new HashMap();
192 | map.put("tradeOrderId", cs.get(0));
193 | map.put("consultantName", cs.get(3));
194 | map.put("paymentRatio", cs.get(16));
195 | return map;
196 | }, 1);
197 | }
198 |
199 | /**
200 | * 由于空cell造成监听函数——readFunction出现"数组越界"或"索引乱序"问题。
201 | * Issue #3
Issue #4
203 | * Issue #5
204 | * 测试XlsxByEventModel
205 | *
206 | * @throws Exception
207 | */
208 | @Test
209 | public void readMissingCellXlsxByEventModel() throws Exception {
210 | InputStream resourceAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("test.xlsx");
211 | GridExcel.readByEventModel(resourceAsStream, Map.class, ExcelType.XLSX)
212 | .window(2, ts -> System.out.println(ts.size()))//推荐在这里执行自己的业务逻辑
213 | .process(cs -> {
214 | System.out.println(cs.get(11));
215 | return null;
216 | }, 1);
217 | }
218 |
219 | /**
220 | * 由于空cell造成监听函数——readFunction出现"数组越界"或"索引乱序"问题。
221 | * Issue #3
Issue #4
223 | * Issue #5
224 | * 测试XlsByEventModel
225 | *
226 | * @throws Exception
227 | */
228 | @Test
229 | public void readMissingCellXlsByEventModel() throws Exception {
230 | InputStream resourceAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("test.xls");
231 | GridExcel.readByEventModel(resourceAsStream, Map.class, ExcelType.XLS)
232 | .window(2, ts -> System.out.println(ts.size()))//推荐在这里执行自己的业务逻辑
233 | .process(cs -> {
234 | // System.out.println(cs.size());
235 | return null;
236 | }, 1);
237 | }
238 |
239 |
240 | /**
241 | * 由于空cell造成监听函数——readFunction出现"数组越界"或"索引乱序"问题。
242 | * Issue #3
Issue #4
244 | * Issue #5
245 | * 测试XlsxByUserModel
246 | *
247 | * @throws Exception
248 | */
249 | @Test
250 | public void readMissingCellXlsxByUserModel() throws Exception {
251 | InputStream resourceAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("test.xlsx");
252 | GridExcel.readByUserModel(resourceAsStream, Map.class, ExcelType.XLSX)
253 | .window(2, ts -> System.out.println(ts.size()))//推荐在这里执行自己的业务逻辑
254 | .process(row -> {
255 | // System.out.println(row.getLastCellNum());
256 | return null;
257 | }, 1);
258 | }
259 |
260 | /**
261 | * 由于空cell造成监听函数——readFunction出现"数组越界"或"索引乱序"问题。
262 | * Issue #3
Issue #4
264 | * Issue #5
265 | * 测试XlsByUserModel
266 | *
267 | * @throws Exception
268 | */
269 | @Test
270 | public void readMissingCellXlsByUserModel() throws Exception {
271 | InputStream resourceAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("test.xls");
272 | GridExcel.readByUserModel(resourceAsStream, Map.class, ExcelType.XLS)
273 | .window(2, ts -> System.out.println(ts.size()))//推荐在这里执行自己的业务逻辑
274 | .process(row -> {
275 | // System.out.println(row.getLastCellNum());
276 | return null;
277 | }, 1);
278 | }
279 |
280 | }
281 |
--------------------------------------------------------------------------------
/src/test/java/WriteTest.java:
--------------------------------------------------------------------------------
1 | import bean.Payment;
2 | import bean.TradeOrder;
3 | import com.github.liuhuagui.gridexcel.GridExcel;
4 | import org.apache.commons.io.FileUtils;
5 | import org.junit.Test;
6 | import util.MockData;
7 | import util.PaymentWays;
8 |
9 | import java.io.File;
10 | import java.util.LinkedHashMap;
11 | import java.util.function.Function;
12 |
13 | /**
14 | * 使用MockData从类路径下的序列化对象文件获取模拟数据List
15 | * @author KaiKang
16 | */
17 | public class WriteTest {
18 |
19 | private void putPaymentsFunction(LinkedHashMap> writeFunctionMap, final int index) {
20 | writeFunctionMap.put("第" + (1 + index) + "次支付订单号", to -> {
21 | Payment payment = to.getPayments().get(index);
22 | return payment.getPaymentId();
23 | });
24 | writeFunctionMap.put("第" + (1 + index) + "次支付金额", to -> {
25 | Payment payment = to.getPayments().get(index);
26 | return payment.getPaymentAmount();
27 | });
28 | writeFunctionMap.put("第" + (1 + index) + "次支付方式", to -> {
29 | Payment payment = to.getPayments().get(index);
30 | return PaymentWays.bankInstName(payment.getPaymentWay());
31 | });
32 | writeFunctionMap.put("第" + (1 + index) + "次支付状态", to -> {
33 | Payment payment = to.getPayments().get(index);
34 | return payment.getPaymentStatus() == 1 ? "支付完成" : "支付中";
35 | });
36 |
37 | }
38 |
39 | public LinkedHashMap> writeFunctionMap(){
40 | LinkedHashMap> writeFunctionMap = new LinkedHashMap<>();
41 | writeFunctionMap.put("订单号", to -> to.getTradeOrderId());
42 | writeFunctionMap.put("顾问编号", to -> to.getConsultantId());
43 | writeFunctionMap.put("顾问姓名", to -> to.getConsultant().getConsultantName());
44 | writeFunctionMap.put("顾问手机号", to -> to.getConsultant().getConsultantPhone());
45 | writeFunctionMap.put("客户编号", to -> to.getCustomerId());
46 | writeFunctionMap.put("客户名称", to -> to.getCustomer().getCustomerName());
47 | writeFunctionMap.put("客户手机号", to -> to.getCustomer().getCustomerPhone());
48 | writeFunctionMap.put("服务商编号", to -> to.getProviderId());
49 | writeFunctionMap.put("服务商名称", to -> to.getProvider().getProviderName());
50 | writeFunctionMap.put("服务商注册手机号", to -> to.getProvider().getLegalPersonPhone());
51 | writeFunctionMap.put("服务编号", to -> to.getServiceId());
52 | writeFunctionMap.put("服务名称", to -> to.getService().getServiceName());
53 | writeFunctionMap.put("单价", to -> to.getActualUnitPrice());
54 | writeFunctionMap.put("数量", to -> to.getServiceCount());
55 | writeFunctionMap.put("总额", to -> to.getActualSumPrice());
56 | writeFunctionMap.put("支付比例", to -> to.getPaymentRatio());
57 | writeFunctionMap.put("支付次数", to -> to.getPaymentTimes());
58 | writeFunctionMap.put("支付状态", to -> {
59 | Byte status = to.getPaymentStatus();
60 | return status == null ? "未支付" : ("第" + Math.abs(status) + "次支付" + (status > 0 ? "完成" : "中"));
61 | });
62 | // 为支付订单添加处理函数
63 | putPaymentsFunction(writeFunctionMap, 0);
64 | putPaymentsFunction(writeFunctionMap, 1);
65 | putPaymentsFunction(writeFunctionMap, 2);
66 |
67 | return writeFunctionMap;
68 | }
69 |
70 |
71 | /**
72 | * 使用UserModel写出数据到Excel
73 | * @throws Exception
74 | */
75 | @Test
76 | public void writeExcelByUserModel() throws Exception {
77 | GridExcel.writeByUserModel(TradeOrder.class)
78 | .head(writeFunctionMap())//对象字段到Excel列的映射
79 | .createSheet()
80 | .process(MockData.data())//模拟数据。在这里设置业务数据集合。
81 | .write(FileUtils.openOutputStream(new File("/excel/test.xlsx")));
82 | }
83 |
84 | /**
85 | * 使用Streaming UserModel写出数据到Excel
86 | * @throws Exception
87 | */
88 | @Test
89 | public void writeExcelByStreaming() throws Exception {
90 | GridExcel.writeByStreaming(TradeOrder.class)
91 | .head(writeFunctionMap())//对象字段到Excel列的映射
92 | .createSheet()
93 | .process(MockData.data())//模拟数据。在这里设置业务数据集合。
94 | .write(FileUtils.openOutputStream(new File("/excel/test.xlsx")));
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/src/test/java/bean/Consultant.java:
--------------------------------------------------------------------------------
1 | package bean;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | *
7 | * databaseTable:consultant
8 | */
9 | public class Consultant implements Serializable{
10 |
11 | /**
12 | * 顾问ID
13 | */
14 | private String consultantId;
15 |
16 | /**
17 | * 服务商ID
18 | */
19 | private String providerId;
20 |
21 | /**
22 | * 顾问姓名
23 | */
24 | private String consultantName;
25 |
26 | /**
27 | * 顾问性别
28 | */
29 | private String consultantGender;
30 |
31 | /**
32 | * 头像路径
33 | */
34 | private String consultantImage;
35 |
36 | /**
37 | * 身份证号
38 | */
39 | private String consultantIdentity;
40 |
41 | /**
42 | * 入职日期
43 | */
44 | private String joinedDate;
45 |
46 | /**
47 | * 综合描述
48 | */
49 | private String consultantDescribe;
50 |
51 | /**
52 | * 手机号
53 | */
54 | private String consultantPhone;
55 |
56 |
57 | /**
58 | * 联系方式
59 | */
60 | private String contactPhone;
61 |
62 | /**
63 | * 主管名称
64 | */
65 | private String masterName;
66 |
67 | /**
68 | * 主管手机号
69 | */
70 | private String masterPhone;
71 |
72 | /**
73 | * 验证码
74 | */
75 | private String validateNum;
76 |
77 | /**
78 | * 验证码过期时间
79 | */
80 | private String validateTime;
81 |
82 | /**
83 | * 顾问类型
84 | */
85 | private String consultantType;
86 |
87 | /**
88 | * 顾问密码
89 | */
90 | private String passWord;
91 |
92 | /**
93 | * 服务区域
94 | */
95 | private String serviceArea;
96 |
97 | /**
98 | * 服务范围,西文“,"分离
99 | */
100 | private String serviceContent;
101 |
102 | /**
103 | * 服务数量
104 | */
105 | private Integer serviceCount;
106 |
107 | /**
108 | * 好评率
109 | */
110 | private String favorableRate;
111 |
112 | /**
113 | * 关注顾问的客户总数
114 | */
115 | private Integer byCustomerCount;
116 |
117 | public String findKey(){
118 | return consultantId;
119 | }
120 |
121 | public String getMasterName() {
122 | return masterName;
123 | }
124 |
125 |
126 | public void setMasterName(String masterName) {
127 | this.masterName = masterName;
128 | }
129 |
130 | public String getMasterPhone() {
131 | return masterPhone;
132 | }
133 |
134 | public void setMasterPhone(String masterPhone) {
135 | this.masterPhone = masterPhone;
136 | }
137 |
138 | public Integer getByCustomerCount() {
139 | return byCustomerCount;
140 | }
141 |
142 |
143 | public void setByCustomerCount(Integer byCustomerCount) {
144 | this.byCustomerCount = byCustomerCount;
145 | }
146 |
147 |
148 | public String getContactPhone() {
149 | return contactPhone;
150 | }
151 |
152 | public void setContactPhone(String contactPhone) {
153 | this.contactPhone = contactPhone;
154 | }
155 |
156 |
157 | public String getValidateNum() {
158 | return validateNum;
159 | }
160 |
161 | public void setValidateNum(String validateNum) {
162 | this.validateNum = validateNum;
163 | }
164 |
165 | public String getValidateTime() {
166 | return validateTime;
167 | }
168 |
169 |
170 | public void setValidateTime(String validateTime) {
171 | this.validateTime = validateTime;
172 | }
173 |
174 |
175 |
176 | public String getServiceContent() {
177 | return serviceContent;
178 | }
179 |
180 |
181 | public void setServiceContent(String serviceContent) {
182 | this.serviceContent = serviceContent;
183 | }
184 |
185 |
186 | public String getConsultantId() {
187 | return consultantId;
188 | }
189 |
190 | public void setConsultantId(String consultantId) {
191 | this.consultantId = consultantId;
192 | }
193 |
194 | public String getProviderId() {
195 | return providerId;
196 | }
197 |
198 | public void setProviderId(String providerId) {
199 | this.providerId = providerId;
200 | }
201 |
202 | public String getConsultantName() {
203 | return consultantName;
204 | }
205 |
206 | public void setConsultantName(String consultantName) {
207 | this.consultantName = consultantName;
208 | }
209 |
210 | public String getConsultantGender() {
211 | return consultantGender;
212 | }
213 |
214 | public void setConsultantGender(String consultantGender) {
215 | this.consultantGender = consultantGender;
216 | }
217 |
218 | public String getConsultantImage() {
219 | return consultantImage;
220 | }
221 |
222 | public void setConsultantImage(String consultantImage) {
223 | this.consultantImage = consultantImage;
224 | }
225 |
226 | public String getConsultantIdentity() {
227 | return consultantIdentity;
228 | }
229 |
230 | public void setConsultantIdentity(String consultantIdentity) {
231 | this.consultantIdentity = consultantIdentity;
232 | }
233 |
234 | public String getJoinedDate() {
235 | return joinedDate;
236 | }
237 |
238 | public void setJoinedDate(String joinedDate) {
239 | this.joinedDate = joinedDate;
240 | }
241 |
242 | public String getConsultantDescribe() {
243 | return consultantDescribe;
244 | }
245 |
246 | public void setConsultantDescribe(String consultantDescribe) {
247 | this.consultantDescribe = consultantDescribe;
248 | }
249 |
250 | public String getConsultantPhone() {
251 | return consultantPhone;
252 | }
253 |
254 | public void setConsultantPhone(String consultantPhone) {
255 | this.consultantPhone = consultantPhone;
256 | }
257 |
258 | public String getConsultantType() {
259 | return consultantType;
260 | }
261 |
262 | public void setConsultantType(String consultantType) {
263 | this.consultantType = consultantType;
264 | }
265 |
266 | public String getPassWord() {
267 | return passWord;
268 | }
269 |
270 | public void setPassWord(String passWord) {
271 | this.passWord = passWord;
272 | }
273 |
274 | public String getServiceArea() {
275 | return serviceArea;
276 | }
277 |
278 | public void setServiceArea(String serviceArea) {
279 | this.serviceArea = serviceArea;
280 | }
281 |
282 | public Integer getServiceCount() {
283 | return serviceCount;
284 | }
285 |
286 | public void setServiceCount(Integer serviceCount) {
287 | this.serviceCount = serviceCount;
288 | }
289 |
290 | public String getFavorableRate() {
291 | return favorableRate;
292 | }
293 |
294 | public void setFavorableRate(String favorableRate) {
295 | this.favorableRate = favorableRate;
296 | }
297 | }
--------------------------------------------------------------------------------
/src/test/java/bean/Customer.java:
--------------------------------------------------------------------------------
1 | package bean;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | *
7 | * databaseTable:customer
8 | */
9 | public class Customer implements Serializable {
10 | /**
11 | * 客户ID
12 | */
13 | private String customerId;
14 |
15 | /**
16 | * 客户联系方式
17 | */
18 | private String customerPhone;
19 |
20 | /**
21 | * 密码
22 | */
23 | private String passWord;
24 |
25 | /**
26 | * 新密码
27 | */
28 | private String newPassWord;
29 |
30 | /**
31 | * 验证码
32 | */
33 | private String validateNum;
34 |
35 | /**
36 | * 失效时间
37 | */
38 | private String validateTime;
39 |
40 | /**
41 | * 冻结时间
42 | */
43 | private String frozenTime;
44 |
45 | /**
46 | * 解冻时间
47 | */
48 | private String thawingTime;
49 |
50 | /**
51 | * 昵称
52 | */
53 | private String customerName;
54 |
55 | /**
56 | * 头像路径
57 | */
58 | private String customerImage;
59 |
60 | /**
61 | * 客户类型
62 | */
63 | private String customerType;
64 |
65 | /**
66 | * 邮箱
67 | */
68 | private String customerEmail;
69 |
70 | /**
71 | * 职业
72 | */
73 | private String customerProfession;
74 |
75 | /**
76 | * 城市
77 | */
78 | private String customerCity;
79 |
80 | /**
81 | * 了解渠道
82 | */
83 | private String knowWay;
84 |
85 | /**
86 | * 未读通知数
87 | */
88 | private Integer unreadNotificationCount;
89 |
90 | /**
91 | * 已读通知数
92 | */
93 | private Integer readNotificationCount;
94 |
95 | /**
96 | * 关注的顾问总数
97 | */
98 | private Integer toConsultantCount;
99 |
100 | public String findKey() {
101 | return customerId;
102 | }
103 |
104 | public Integer getToConsultantCount() {
105 | return toConsultantCount;
106 | }
107 |
108 | public void setToConsultantCount(Integer toConsultantCount) {
109 | this.toConsultantCount = toConsultantCount;
110 | }
111 |
112 | public Integer getUnreadNotificationCount() {
113 | return unreadNotificationCount;
114 | }
115 |
116 | public void setUnreadNotificationCount(Integer unreadNotificationCount) {
117 | this.unreadNotificationCount = unreadNotificationCount;
118 | }
119 |
120 | public Integer getReadNotificationCount() {
121 | return readNotificationCount;
122 | }
123 |
124 | public void setReadNotificationCount(Integer readNotificationCount) {
125 | this.readNotificationCount = readNotificationCount;
126 | }
127 |
128 | public String getFrozenTime() {
129 | return frozenTime;
130 | }
131 |
132 | public void setFrozenTime(String frozenTime) {
133 | this.frozenTime = frozenTime;
134 | }
135 |
136 | public String getThawingTime() {
137 | return thawingTime;
138 | }
139 |
140 | public void setThawingTime(String thawingTime) {
141 | this.thawingTime = thawingTime;
142 | }
143 |
144 | public String getCustomerId() {
145 | return customerId;
146 | }
147 |
148 | public void setCustomerId(String customerId) {
149 | this.customerId = customerId == null ? null : (customerId.trim().length()==0?null:customerId);
150 | }
151 |
152 | public String getNewPassWord() {
153 | return newPassWord;
154 | }
155 |
156 | public void setNewPassWord(String newPassWord) {
157 | this.newPassWord = newPassWord;
158 | }
159 |
160 | public String getCustomerPhone() {
161 | return customerPhone;
162 | }
163 |
164 | public void setCustomerPhone(String customerPhone) {
165 | this.customerPhone = customerPhone == null ? null : (customerPhone.trim().length()==0?null:customerPhone);
166 | }
167 |
168 | public String getPassWord() {
169 | return passWord;
170 | }
171 |
172 | public void setPassWord(String passWord) {
173 | this.passWord = passWord == null ? null : (passWord.trim().length()==0?null:passWord);
174 | }
175 |
176 | public String getValidateNum() {
177 | return validateNum;
178 | }
179 |
180 | public void setValidateNum(String validateNum) {
181 | this.validateNum = validateNum == null ? null : (validateNum.trim().length()==0?null:validateNum);
182 | }
183 |
184 | public String getValidateTime() {
185 | return validateTime;
186 | }
187 |
188 | public void setValidateTime(String validateTime) {
189 | this.validateTime = validateTime == null ? null : (validateTime.trim().length()==0?null:validateTime);
190 | }
191 |
192 | public String getCustomerName() {
193 | return customerName;
194 | }
195 |
196 | public void setCustomerName(String customerName) {
197 | this.customerName = customerName == null ? null : (customerName.trim().length()==0?null:customerName);
198 | }
199 |
200 | public String getCustomerImage() {
201 | return customerImage;
202 | }
203 |
204 | public void setCustomerImage(String customerImage) {
205 | this.customerImage = customerImage == null ? null : (customerImage.trim().length()==0?null:customerImage);
206 | }
207 |
208 | public String getCustomerType() {
209 | return customerType;
210 | }
211 |
212 | public void setCustomerType(String customerType) {
213 | this.customerType = customerType == null ? null : (customerType.trim().length()==0?null:customerType);
214 | }
215 |
216 | public String getCustomerEmail() {
217 | return customerEmail;
218 | }
219 |
220 | public void setCustomerEmail(String customerEmail) {
221 | this.customerEmail = customerEmail == null ? null : (customerEmail.trim().length()==0?null:customerEmail);
222 | }
223 |
224 | public String getCustomerProfession() {
225 | return customerProfession;
226 | }
227 |
228 | public void setCustomerProfession(String customerProfession) {
229 | this.customerProfession = customerProfession == null ? null : (customerProfession.trim().length()==0?null:customerProfession);
230 | }
231 |
232 | public String getCustomerCity() {
233 | return customerCity;
234 | }
235 |
236 | public void setCustomerCity(String customerCity) {
237 | this.customerCity = customerCity == null ? null : (customerCity.trim().length()==0?null:customerCity);
238 | }
239 |
240 | public String getKnowWay() {
241 | return knowWay;
242 | }
243 |
244 | public void setKnowWay(String knowWay) {
245 | this.knowWay = knowWay == null ? null : (knowWay.trim().length()==0?null:knowWay);
246 | }
247 | }
--------------------------------------------------------------------------------
/src/test/java/bean/Payment.java:
--------------------------------------------------------------------------------
1 | package bean;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | *
7 | * databaseTable:payment
8 | */
9 | public class Payment implements Serializable{
10 | /**
11 | * 支付id
12 | */
13 | private Long paymentId;
14 |
15 | /**
16 | * 交易订单号
17 | */
18 | private Long tradeOrderId;
19 |
20 | /**
21 | * 支付阶段
22 | */
23 | private Byte paymentPhase;
24 |
25 | /**
26 | * 支付权重,<100
27 | */
28 | private Byte paymentWeight;
29 |
30 | /**
31 | * 支付金额
32 | */
33 | private Double paymentAmount;
34 |
35 | /**
36 | * 支付方式,0微信,1支付宝,其他——银联
37 | */
38 | private String paymentWay;
39 |
40 | /**
41 | * 支付状态, 0未支付 1支付成功
42 | */
43 | private Byte paymentStatus;
44 |
45 | public Payment() {
46 | }
47 |
48 | public Payment(Long tradeOrderId) {
49 | super();
50 | this.tradeOrderId = tradeOrderId;
51 | }
52 |
53 | public Long getPaymentId() {
54 | return paymentId;
55 | }
56 |
57 | public void setPaymentId(Long paymentId) {
58 | this.paymentId = paymentId;
59 | }
60 |
61 | public Long getTradeOrderId() {
62 | return tradeOrderId;
63 | }
64 |
65 | public void setTradeOrderId(Long tradeOrderId) {
66 | this.tradeOrderId = tradeOrderId;
67 | }
68 |
69 | public Byte getPaymentPhase() {
70 | return paymentPhase;
71 | }
72 |
73 | public void setPaymentPhase(Byte paymentPhase) {
74 | this.paymentPhase = paymentPhase;
75 | }
76 |
77 | public Byte getPaymentWeight() {
78 | return paymentWeight;
79 | }
80 |
81 | public void setPaymentWeight(Byte paymentWeight) {
82 | this.paymentWeight = paymentWeight;
83 | }
84 |
85 | public Double getPaymentAmount() {
86 | return paymentAmount;
87 | }
88 |
89 | public void setPaymentAmount(Double paymentAmount) {
90 | this.paymentAmount = paymentAmount;
91 | }
92 |
93 | public String getPaymentWay() {
94 | return paymentWay;
95 | }
96 |
97 | public void setPaymentWay(String paymentWay) {
98 | this.paymentWay = paymentWay;
99 | }
100 |
101 | public Byte getPaymentStatus() {
102 | return paymentStatus;
103 | }
104 |
105 | public void setPaymentStatus(Byte paymentStatus) {
106 | this.paymentStatus = paymentStatus;
107 | }
108 | }
--------------------------------------------------------------------------------
/src/test/java/bean/Provider.java:
--------------------------------------------------------------------------------
1 | package bean;
2 |
3 | import java.io.Serializable;
4 | import java.util.List;
5 |
6 |
7 |
8 | /**
9 | *
10 | * databaseTable:provider
11 | */
12 | public class Provider implements Serializable {
13 | /**
14 | * 服务商ID
15 | */
16 | private String providerId;
17 |
18 | /**
19 | * 服务商名称
20 | */
21 | private String providerName;
22 |
23 | /**
24 | * 服务商性质
25 | */
26 | private String providerCharacter;
27 |
28 | /**
29 | * 头像路径
30 | */
31 | private String providerImage;
32 |
33 | /**
34 | * 描述
35 | */
36 | private String providerDescribe;
37 |
38 | /**
39 | * 企业地址
40 | */
41 | private String providerAddress;
42 |
43 | /**
44 | * 企业邮箱
45 | */
46 | private String providerEmail;
47 |
48 | /**
49 | * 法人姓名
50 | */
51 | private String legalPersonName;
52 |
53 | /**
54 | * 法人性别
55 | */
56 | private String legalPersonGender;
57 |
58 | /**
59 | * 法人身份证号
60 | */
61 | private String legalPersonIdentityNum;
62 |
63 | /**
64 | * 身份证正面照路径
65 | */
66 | private String legalPersonIdentityFore;
67 |
68 | /**
69 | * 身份证背面照路径
70 | */
71 | private String legalPersonIdentityBack;
72 |
73 | /**
74 | * 法人手机号
75 | */
76 | private String legalPersonPhone;
77 |
78 | /**
79 | * 密码
80 | */
81 | private String passWord;
82 |
83 | /**
84 | * 新密码
85 | */
86 | private String newPassWord;
87 |
88 | /**
89 | * 验证码
90 | */
91 | private String validateNum;
92 |
93 | /**
94 | * 过期时间
95 | */
96 | private String validateTime;
97 |
98 | /**
99 | * 冻结时间
100 | */
101 | private String frozenTime;
102 |
103 | /**
104 | * 解冻时间
105 | */
106 | private String thawingTime;
107 |
108 | /**
109 | * 经营许可证编号
110 | */
111 | private String businessLicenceNum;
112 |
113 | /**
114 | * 经营许可证路径
115 | */
116 | private String businessLicenceUrl;
117 |
118 | /**
119 | * 服务商下顾问的初始密码
120 | */
121 | private String defaultPassWord;
122 |
123 | /**
124 | * 服务商状态
125 | */
126 | private String providerType;
127 |
128 | /**
129 | * 未读通知数
130 | */
131 | private Integer unreadNotificationCount;
132 |
133 | /**
134 | * 已读通知数
135 | */
136 | private Integer readNotificationCount;
137 |
138 | /**
139 | * 订单总数
140 | */
141 | private Integer orderQuantity;
142 |
143 | /**
144 | * 待结算订单总数
145 | */
146 | private Integer pendingSettlementQuantity;
147 |
148 | /**
149 | * 服务上下顾问总数
150 | */
151 | private Integer consultantQuantity;
152 |
153 | /**
154 | * 服务项目总数
155 | */
156 | private Integer serviceQuantity;
157 |
158 |
159 | public Integer getUnreadNotificationCount() {
160 | return unreadNotificationCount;
161 | }
162 |
163 | public void setUnreadNotificationCount(Integer unreadNotificationCount) {
164 | this.unreadNotificationCount = unreadNotificationCount;
165 | }
166 |
167 | public Integer getReadNotificationCount() {
168 | return readNotificationCount;
169 | }
170 |
171 | public void setReadNotificationCount(Integer readNotificationCount) {
172 | this.readNotificationCount = readNotificationCount;
173 | }
174 |
175 | public Integer getOrderQuantity() {
176 | return orderQuantity;
177 | }
178 |
179 | public void setOrderQuantity(Integer orderQuantity) {
180 | this.orderQuantity = orderQuantity;
181 | }
182 |
183 | public Integer getPendingSettlementQuantity() {
184 | return pendingSettlementQuantity;
185 | }
186 |
187 | public void setPendingSettlementQuantity(Integer pendingSettlementQuantity) {
188 | this.pendingSettlementQuantity = pendingSettlementQuantity;
189 | }
190 |
191 | public Integer getConsultantQuantity() {
192 | return consultantQuantity;
193 | }
194 |
195 | public void setConsultantQuantity(Integer consultantQuantity) {
196 | this.consultantQuantity = consultantQuantity;
197 | }
198 |
199 | public Integer getServiceQuantity() {
200 | return serviceQuantity;
201 | }
202 |
203 | public void setServiceQuantity(Integer serviceQuantity) {
204 | this.serviceQuantity = serviceQuantity;
205 | }
206 |
207 | public String getProviderCharacter() {
208 | return providerCharacter;
209 | }
210 |
211 | public void setProviderCharacter(String providerCharacter) {
212 | this.providerCharacter = providerCharacter;
213 | }
214 |
215 | public String getFrozenTime() {
216 | return frozenTime;
217 | }
218 |
219 | public void setFrozenTime(String frozenTime) {
220 | this.frozenTime = frozenTime;
221 | }
222 |
223 | public String getThawingTime() {
224 | return thawingTime;
225 | }
226 |
227 |
228 | public void setThawingTime(String thawingTime) {
229 | this.thawingTime = thawingTime;
230 | }
231 |
232 |
233 | public String getProviderId() {
234 | return providerId;
235 | }
236 |
237 | public void setProviderId(String providerId) {
238 | this.providerId = providerId == null ? null : (providerId.trim().length()==0?null:providerId);
239 | }
240 |
241 | public String getNewPassWord() {
242 | return newPassWord;
243 | }
244 |
245 | public void setNewPassWord(String newPassWord) {
246 | this.newPassWord = newPassWord;
247 | }
248 |
249 | public String getProviderType() {
250 | return providerType;
251 | }
252 |
253 | public void setProviderType(String providerType) {
254 | this.providerType = providerType;
255 | }
256 |
257 | public String getDefaultPassWord() {
258 | return defaultPassWord;
259 | }
260 |
261 | public void setDefaultPassWord(String defaultPassWord) {
262 | this.defaultPassWord = defaultPassWord;
263 | }
264 |
265 | public String getProviderName() {
266 | return providerName;
267 | }
268 |
269 | public void setProviderName(String providerName) {
270 | this.providerName = providerName == null ? null : (providerName.trim().length()==0?null:providerName);
271 | }
272 |
273 | public String getProviderImage() {
274 | return providerImage;
275 | }
276 |
277 | public void setProviderImage(String providerImage) {
278 | this.providerImage = providerImage == null ? null : (providerImage.trim().length()==0?null:providerImage);
279 | }
280 |
281 | public String getProviderDescribe() {
282 | return providerDescribe;
283 | }
284 |
285 | public void setProviderDescribe(String providerDescribe) {
286 | this.providerDescribe = providerDescribe == null ? null : (providerDescribe.trim().length()==0?null:providerDescribe);
287 | }
288 |
289 | public String getProviderAddress() {
290 | return providerAddress;
291 | }
292 |
293 | public void setProviderAddress(String providerAddress) {
294 | this.providerAddress = providerAddress == null ? null : (providerAddress.trim().length()==0?null:providerAddress);
295 | }
296 |
297 | public String getProviderEmail() {
298 | return providerEmail;
299 | }
300 |
301 | public void setProviderEmail(String providerEmail) {
302 | this.providerEmail = providerEmail == null ? null : (providerEmail.trim().length()==0?null:providerEmail);
303 | }
304 |
305 | public String getLegalPersonName() {
306 | return legalPersonName;
307 | }
308 |
309 | public void setLegalPersonName(String legalPersonName) {
310 | this.legalPersonName = legalPersonName == null ? null : (legalPersonName.trim().length()==0?null:legalPersonName);
311 | }
312 |
313 | public String getLegalPersonGender() {
314 | return legalPersonGender;
315 | }
316 |
317 | public void setLegalPersonGender(String legalPersonGender) {
318 | this.legalPersonGender = legalPersonGender == null ? null : (legalPersonGender.trim().length()==0?null:legalPersonGender);
319 | }
320 |
321 | public String getLegalPersonIdentityNum() {
322 | return legalPersonIdentityNum;
323 | }
324 |
325 | public void setLegalPersonIdentityNum(String legalPersonIdentityNum) {
326 | this.legalPersonIdentityNum = legalPersonIdentityNum == null ? null : (legalPersonIdentityNum.trim().length()==0?null:legalPersonIdentityNum);
327 | }
328 |
329 | public String getLegalPersonIdentityFore() {
330 | return legalPersonIdentityFore;
331 | }
332 |
333 | public void setLegalPersonIdentityFore(String legalPersonIdentityFore) {
334 | this.legalPersonIdentityFore = legalPersonIdentityFore == null ? null : (legalPersonIdentityFore.trim().length()==0?null:legalPersonIdentityFore);
335 | }
336 |
337 | public String getLegalPersonIdentityBack() {
338 | return legalPersonIdentityBack;
339 | }
340 |
341 | public void setLegalPersonIdentityBack(String legalPersonIdentityBack) {
342 | this.legalPersonIdentityBack = legalPersonIdentityBack == null ? null : (legalPersonIdentityBack.trim().length()==0?null:legalPersonIdentityBack);
343 | }
344 |
345 | public String getLegalPersonPhone() {
346 | return legalPersonPhone;
347 | }
348 |
349 | public void setLegalPersonPhone(String legalPersonPhone) {
350 | this.legalPersonPhone = legalPersonPhone == null ? null : (legalPersonPhone.trim().length()==0?null:legalPersonPhone);
351 | }
352 |
353 | public String getPassWord() {
354 | return passWord;
355 | }
356 |
357 | public void setPassWord(String passWord) {
358 | this.passWord = passWord == null ? null : (passWord.trim().length()==0?null:passWord);
359 | }
360 |
361 | public String getValidateNum() {
362 | return validateNum;
363 | }
364 |
365 | public void setValidateNum(String validateNum) {
366 | this.validateNum = validateNum == null ? null : (validateNum.trim().length()==0?null:validateNum);
367 | }
368 |
369 | public String getValidateTime() {
370 | return validateTime;
371 | }
372 |
373 | public void setValidateTime(String validateTime) {
374 | this.validateTime = validateTime == null ? null : (validateTime.trim().length()==0?null:validateTime);
375 | }
376 |
377 | public String getBusinessLicenceNum() {
378 | return businessLicenceNum;
379 | }
380 |
381 | public void setBusinessLicenceNum(String businessLicenceNum) {
382 | this.businessLicenceNum = businessLicenceNum == null ? null : (businessLicenceNum.trim().length()==0?null:businessLicenceNum);
383 | }
384 |
385 | public String getBusinessLicenceUrl() {
386 | return businessLicenceUrl;
387 | }
388 |
389 | public void setBusinessLicenceUrl(String businessLicenceUrl) {
390 | this.businessLicenceUrl = businessLicenceUrl == null ? null : (businessLicenceUrl.trim().length()==0?null:businessLicenceUrl);
391 | }
392 | }
--------------------------------------------------------------------------------
/src/test/java/bean/Service.java:
--------------------------------------------------------------------------------
1 | package bean;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | *
7 | * databaseTable:service
8 | */
9 | public class Service implements Serializable{
10 |
11 | /**
12 | * 服务ID
13 | */
14 | private String serviceId;
15 |
16 | /**
17 | * 服务名称
18 | */
19 | private String serviceName;
20 |
21 | /**
22 | * 服务图片路径
23 | */
24 | private String serviceImage;
25 |
26 | /**
27 | * 二级服务ID
28 | */
29 | private String secondServiceId;
30 |
31 | /**
32 | * 服务描述
33 | */
34 | private String serviceDescribe;
35 |
36 | /**
37 | * 单位价格
38 | */
39 | private String unitPrice;
40 |
41 | public String getServiceId() {
42 | return serviceId;
43 | }
44 |
45 | public void setServiceId(String serviceId) {
46 | this.serviceId = serviceId == null ? null : (serviceId.trim().length()==0?null:serviceId);
47 | }
48 |
49 | public String getServiceName() {
50 | return serviceName;
51 | }
52 |
53 | public void setServiceName(String serviceName) {
54 | this.serviceName = serviceName == null ? null : (serviceName.trim().length()==0?null:serviceName);
55 | }
56 |
57 | public String getServiceImage() {
58 | return serviceImage;
59 | }
60 |
61 | public void setServiceImage(String serviceImage) {
62 | this.serviceImage = serviceImage == null ? null : (serviceImage.trim().length()==0?null:serviceImage);
63 | }
64 |
65 | public String getSecondServiceId() {
66 | return secondServiceId;
67 | }
68 |
69 | public void setSecondServiceId(String secondServiceId) {
70 | this.secondServiceId = secondServiceId;
71 | }
72 |
73 | public String getServiceDescribe() {
74 | return serviceDescribe;
75 | }
76 |
77 | public void setServiceDescribe(String serviceDescribe) {
78 | this.serviceDescribe = serviceDescribe == null ? null : (serviceDescribe.trim().length()==0?null:serviceDescribe);
79 | }
80 |
81 | public String getUnitPrice() {
82 | return unitPrice;
83 | }
84 |
85 | public void setUnitPrice(String unitPrice) {
86 | this.unitPrice = unitPrice;
87 | }
88 |
89 |
90 | }
--------------------------------------------------------------------------------
/src/test/java/bean/TradeOrder.java:
--------------------------------------------------------------------------------
1 | package bean;
2 |
3 | import java.io.Serializable;
4 | import java.util.List;
5 |
6 | /**
7 | *
8 | * databaseTable:trade_order
9 | */
10 | public class TradeOrder implements Serializable{
11 |
12 | /**
13 | * 交易订单号
14 | */
15 | private Long tradeOrderId;
16 |
17 | /**
18 | * 交易类型
19 | */
20 | private Byte tradeType;
21 |
22 | /**
23 | * 支付比例
24 | */
25 | private String paymentRatio;
26 |
27 | /**
28 | * 支付次数
29 | */
30 | private Byte paymentTimes;
31 |
32 | /**
33 | * 服务ID
34 | */
35 | private Long serviceId;
36 |
37 | /**
38 | * 服务商Id
39 | */
40 | private String providerId;
41 |
42 | /**
43 | * 客户ID
44 | */
45 | private String customerId;
46 |
47 | /**
48 | * 顾问ID
49 | */
50 | private String consultantId;
51 |
52 | /**
53 | * 标准单位价格
54 | */
55 | private Double standardUnitPrice;
56 |
57 | /**
58 | * 实际单位价格
59 | */
60 | private Double actualUnitPrice;
61 |
62 | /**
63 | * 服务数量
64 | */
65 | private Integer serviceCount;
66 |
67 | /**
68 | * 标准总价
69 | */
70 | private Double standardSumPrice;
71 |
72 | /**
73 | * 实际总价
74 | */
75 | private Double actualSumPrice;
76 |
77 | /**
78 | * 提前提醒时间
79 | */
80 | private String advancedRemindTime;
81 |
82 | /**
83 | * 强制更新流程时间
84 | */
85 | private String mandatoryUpdateTime;
86 |
87 | /**
88 | * 当前流程序号
89 | */
90 | private Integer currentProcessNum;
91 |
92 |
93 | /**
94 | * 交易地址
95 | */
96 | private String tradeAddress;
97 |
98 | /**
99 | * n(|n|∈N+) 第|n|次支付,<0支付中,>0支付完成
100 | */
101 | private Byte paymentStatus;
102 | /**
103 | * 关联集合的属性
104 | */
105 | private List payments;
106 |
107 | private Customer customer;
108 |
109 | private Provider provider;
110 |
111 | private Consultant consultant;
112 |
113 | private Service service;
114 |
115 | public Byte getPaymentStatus() {
116 | return paymentStatus;
117 | }
118 |
119 | public void setPaymentStatus(Byte paymentStatus) {
120 | this.paymentStatus = paymentStatus;
121 | }
122 |
123 | public Service getService() {
124 | return service;
125 | }
126 |
127 | public void setService(Service service) {
128 | this.service = service;
129 | }
130 |
131 | public Customer getCustomer() {
132 | return customer;
133 | }
134 |
135 | public void setCustomer(Customer customer) {
136 | this.customer = customer;
137 | }
138 |
139 | public Provider getProvider() {
140 | return provider;
141 | }
142 |
143 | public void setProvider(Provider provider) {
144 | this.provider = provider;
145 | }
146 |
147 | public Consultant getConsultant() {
148 | return consultant;
149 | }
150 |
151 | public void setConsultant(Consultant consultant) {
152 | this.consultant = consultant;
153 | }
154 |
155 | public Long getTradeOrderId() {
156 | return tradeOrderId;
157 | }
158 |
159 | public void setTradeOrderId(Long tradeOrderId) {
160 | this.tradeOrderId = tradeOrderId;
161 | }
162 |
163 | public Byte getTradeType() {
164 | return tradeType;
165 | }
166 |
167 | public void setTradeType(Byte tradeType) {
168 | this.tradeType = tradeType;
169 | }
170 |
171 | public String getPaymentRatio() {
172 | return paymentRatio;
173 | }
174 |
175 | public void setPaymentRatio(String paymentRatio) {
176 | this.paymentRatio = paymentRatio;
177 | }
178 |
179 | public Byte getPaymentTimes() {
180 | return paymentTimes;
181 | }
182 |
183 | public void setPaymentTimes(Byte paymentTimes) {
184 | this.paymentTimes = paymentTimes;
185 | }
186 |
187 | public Long getServiceId() {
188 | return serviceId;
189 | }
190 |
191 | public void setServiceId(Long serviceId) {
192 | this.serviceId = serviceId;
193 | }
194 |
195 | public String getProviderId() {
196 | return providerId;
197 | }
198 |
199 | public void setProviderId(String providerId) {
200 | this.providerId = providerId;
201 | }
202 |
203 | public String getCustomerId() {
204 | return customerId;
205 | }
206 |
207 | public void setCustomerId(String customerId) {
208 | this.customerId = customerId;
209 | }
210 |
211 | public String getConsultantId() {
212 | return consultantId;
213 | }
214 |
215 | public void setConsultantId(String consultantId) {
216 | this.consultantId = consultantId;
217 | }
218 |
219 | public Double getStandardUnitPrice() {
220 | return standardUnitPrice;
221 | }
222 |
223 | public void setStandardUnitPrice(Double standardUnitPrice) {
224 | this.standardUnitPrice = standardUnitPrice;
225 | }
226 |
227 | public Double getActualUnitPrice() {
228 | return actualUnitPrice;
229 | }
230 |
231 | public void setActualUnitPrice(Double actualUnitPrice) {
232 | this.actualUnitPrice = actualUnitPrice;
233 | }
234 |
235 | public Integer getServiceCount() {
236 | return serviceCount;
237 | }
238 |
239 | public void setServiceCount(Integer serviceCount) {
240 | this.serviceCount = serviceCount;
241 | }
242 |
243 | public Double getStandardSumPrice() {
244 | return standardSumPrice;
245 | }
246 |
247 | public void setStandardSumPrice(Double standardSumPrice) {
248 | this.standardSumPrice = standardSumPrice;
249 | }
250 |
251 | public Double getActualSumPrice() {
252 | return actualSumPrice;
253 | }
254 |
255 | public void setActualSumPrice(Double actualSumPrice) {
256 | this.actualSumPrice = actualSumPrice;
257 | }
258 |
259 | public String getAdvancedRemindTime() {
260 | return advancedRemindTime;
261 | }
262 |
263 | public void setAdvancedRemindTime(String advancedRemindTime) {
264 | this.advancedRemindTime = advancedRemindTime;
265 | }
266 |
267 | public String getMandatoryUpdateTime() {
268 | return mandatoryUpdateTime;
269 | }
270 |
271 | public void setMandatoryUpdateTime(String mandatoryUpdateTime) {
272 | this.mandatoryUpdateTime = mandatoryUpdateTime;
273 | }
274 |
275 | public Integer getCurrentProcessNum() {
276 | return currentProcessNum;
277 | }
278 |
279 | public void setCurrentProcessNum(Integer currentProcessNum) {
280 | this.currentProcessNum = currentProcessNum;
281 | }
282 |
283 | public List getPayments() {
284 | return payments;
285 | }
286 |
287 | public void setPayments(List payments) {
288 | this.payments = payments;
289 | }
290 | }
--------------------------------------------------------------------------------
/src/test/java/util/MockData.java:
--------------------------------------------------------------------------------
1 | package util;
2 |
3 | import bean.*;
4 | import org.apache.commons.io.FileUtils;
5 |
6 | import java.io.*;
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | /**
11 | * 生成模拟数据
12 | * @author KaiKang
13 | */
14 | public class MockData {
15 | /**
16 | * 生成模拟数据
17 | * @throws IOException
18 | * @throws ClassNotFoundException
19 | */
20 | public static void init() throws IOException, ClassNotFoundException {
21 | TradeOrder tradeOrder = new TradeOrder();
22 | tradeOrder.setTradeOrderId(1l);
23 | tradeOrder.setCustomerId("2123122");
24 | tradeOrder.setConsultantId("1222");
25 | tradeOrder.setServiceId(11l);
26 | tradeOrder.setProviderId("233");
27 | tradeOrder.setActualUnitPrice(2312.0);
28 | tradeOrder.setServiceCount(2);
29 | tradeOrder.setActualSumPrice(4624.0);
30 | tradeOrder.setPaymentRatio("1:3:4");
31 | tradeOrder.setPaymentTimes((byte) 2);
32 | tradeOrder.setPaymentStatus((byte) -2);
33 |
34 | Customer customer = new Customer();
35 | customer.setCustomerId("2123122");
36 | customer.setCustomerName("测试客户");
37 | customer.setCustomerPhone("2312331231");
38 | tradeOrder.setCustomer(customer);
39 |
40 | Consultant consultant = new Consultant();
41 | consultant.setConsultantId("1222");
42 | consultant.setConsultantPhone("23131221132");
43 | consultant.setConsultantName("KaiKang");
44 | tradeOrder.setConsultant(consultant);
45 |
46 | Provider provider = new Provider();
47 | provider.setProviderId("233");
48 | provider.setProviderName("测试服务商");
49 | provider.setLegalPersonPhone("2131332123");
50 | tradeOrder.setProvider(provider);
51 |
52 | Service service = new Service();
53 | service.setServiceName("测试服务");
54 | tradeOrder.setService(service);
55 |
56 | ArrayList payments = new ArrayList<>();
57 | Payment e = new Payment();
58 | e.setPaymentWay("1");
59 | e.setPaymentId(1111l);
60 | e.setPaymentAmount(12.0);
61 | e.setPaymentStatus((byte) 1);
62 | payments.add(e);
63 | Payment e1 = new Payment();
64 | e1.setPaymentWay("0");
65 | e1.setPaymentId(1111l);
66 | e1.setPaymentAmount(12.0);
67 | e1.setPaymentStatus((byte) 0);
68 | payments.add(e1);
69 | tradeOrder.setPayments(payments);
70 |
71 | List tradeOrders = new ArrayList<>();
72 | for(int i=0 ;i<200;i++){
73 | tradeOrders.add(tradeOrder);
74 | }
75 | System.out.println(tradeOrders.size());
76 |
77 | File file = new File("/excel/datasource.obj");
78 | FileOutputStream fileOutputStream = FileUtils.openOutputStream(file);
79 | ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
80 | objectOutputStream.writeObject(tradeOrders);
81 | objectOutputStream.flush();
82 | }
83 |
84 | /**
85 | * 从类路径中获取模拟数据
86 | * @return
87 | * @throws IOException
88 | * @throws ClassNotFoundException
89 | */
90 | public static List data() throws IOException, ClassNotFoundException {
91 | InputStream resourceAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("datasource.obj");
92 | ObjectInputStream objectInputStream = new ObjectInputStream(resourceAsStream);
93 | return (List) objectInputStream.readObject();
94 | }
95 |
96 | }
97 |
--------------------------------------------------------------------------------
/src/test/java/util/PaymentWays.java:
--------------------------------------------------------------------------------
1 | package util;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | /**
7 | * 支付方式Hash存储
8 | * @author KaiKang
9 | */
10 | public class PaymentWays {
11 | /**
12 | * key,机构号
13 | * value,机构名称
14 | */
15 | private static final Map paymentWaysMap;
16 | static {
17 | paymentWaysMap = new HashMap();
18 | paymentWaysMap.put("0", "微信");
19 | paymentWaysMap.put("1", "支付宝");
20 | paymentWaysMap.put("700000000000003", "中国工商银行");
21 | paymentWaysMap.put("700000000000002", "中国农业银行");
22 | paymentWaysMap.put("700000000000001", "中国银行");
23 | paymentWaysMap.put("700000000000004", "中国建设银行");
24 | paymentWaysMap.put("700000000000006", "中国交通银行");
25 | paymentWaysMap.put("700000000000011", "中国邮政储蓄银行");
26 | paymentWaysMap.put("700000000000010", "招商银行");
27 | paymentWaysMap.put("700000000000013", "中信银行");
28 | paymentWaysMap.put("700000000000015", "华夏银行");
29 | paymentWaysMap.put("700000000000008", "中国民生银行");
30 | paymentWaysMap.put("700000000000009", "兴业银行");
31 | paymentWaysMap.put("700000000000014", "平安银行");
32 | paymentWaysMap.put("700000000000005", "中国光大银行");
33 | paymentWaysMap.put("700000000000012", "广发银行");
34 | paymentWaysMap.put("700000000000007", "浦发银行");
35 | paymentWaysMap.put("700000000000022", "青岛银行");
36 | paymentWaysMap.put("700000000000019", "深圳发展银行");
37 | paymentWaysMap.put("700000000000044", "徽商银行");
38 | paymentWaysMap.put("700000000000020", "东亚银行");
39 | }
40 |
41 | /**
42 | * 通过机构号,查询机构名称
43 | * @param bankInstNo 机构号
44 | * @return
45 | */
46 | public static String bankInstName(String bankInstNo) {
47 | String bankInstName = paymentWaysMap.get(bankInstNo);
48 | return bankInstName == null?"银联支付":bankInstName;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/test/resources/2003.xls:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liuhuagui/gridexcel/8ea1be715ecd2b92524f2b76a1e9ba27f702c5a0/src/test/resources/2003.xls
--------------------------------------------------------------------------------
/src/test/resources/2007.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liuhuagui/gridexcel/8ea1be715ecd2b92524f2b76a1e9ba27f702c5a0/src/test/resources/2007.xlsx
--------------------------------------------------------------------------------
/src/test/resources/datasource.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liuhuagui/gridexcel/8ea1be715ecd2b92524f2b76a1e9ba27f702c5a0/src/test/resources/datasource.obj
--------------------------------------------------------------------------------
/src/test/resources/test.xls:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liuhuagui/gridexcel/8ea1be715ecd2b92524f2b76a1e9ba27f702c5a0/src/test/resources/test.xls
--------------------------------------------------------------------------------
/src/test/resources/test.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liuhuagui/gridexcel/8ea1be715ecd2b92524f2b76a1e9ba27f702c5a0/src/test/resources/test.xlsx
--------------------------------------------------------------------------------