没用插件,分页之类的,就直接用代码实现。。。
private int uploadDataType_1() throws SQLException{
//获取数据
ResultSet resultSet = DBConnection.executeQuery(
"SELECT * from TB_StoreHouse WHERE provice_id ='430000'"
);
//数据集结构
ResultSetMetaData reMetaData = resultSet.getMetaData();
System.out.println("数据集的结构---"+reMetaData);
//数据集的列数
int columnCount = reMetaData.getColumnCount();
System.out.println("数据集的列数---"+columnCount);
JSONArray array = new JSONArray();
int responseCode=0;
/*
* int a 分批上传 本批次数据的位数
*
* int b 为总共上传几批次
*/
int a = 0;
int b =0;
boolean result=true;
while ( result= resultSet.next()) {
//转json
JSONObject jsonObject = new JSONObject();
if (++a<200) {
for (int i = 1; i <= columnCount; i++) {
String columnLabel = reMetaData.getColumnLabel(i);
String value = resultSet.getString(columnLabel);
jsonObject.put(columnLabel, value);
}
array.add(jsonObject);
}else {
for (int i = 1; i <= columnCount; i++) {
String columnLabel = reMetaData.getColumnLabel(i);
String value = resultSet.getString(columnLabel);
jsonObject.put(columnLabel, value);
}
array.add(jsonObject);
//调用ws
GrainServiceImplService rs = new GrainServiceImplService();
GrainService re = rs.getGrainServiceImplPort();
responseCode =re.test(null, "1", 1, "3", "4");
System.out.println("上传第"+ ++b +"批数据,上传累计条数:"+b*200+"条");
a=0;
array= new JSONArray();
System.out.println("执行结果为 " + responseCode);
}
}
if (result) {
}else {
//调用ws
GrainServiceImplService rs = new GrainServiceImplService();
GrainService re = rs.getGrainServiceImplPort();
responseCode= re.test(null, "1", 1, "3", "4");
int c=a+(b*200);
System.out.println("本批次数据不满20条,共"+ c +"条");
System.out.println("整表数据传输完成");
System.out.println("执行结果为" + responseCode);
}
return responseCode;
}