|
|
|
@ -197,9 +197,20 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//拉取失败文件
|
|
|
|
|
fetchFailFile(host);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void fetchFailFile(String host) {
|
|
|
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
|
|
|
map.put("sql", "select * from idc_file where createTime<date_sub(now(),interval 30 minute) order by createTime");
|
|
|
|
|
List<Map<String,Object>> list = dbDao.list(map);
|
|
|
|
|
for(int i=0;i<list.size();i++) {
|
|
|
|
|
signleDownloadFile(host,list.get(i).get("filePath").toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void asyncDataTask(boolean isUpload) {
|
|
|
|
|
initTable();
|
|
|
|
@ -1013,8 +1024,8 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
try {
|
|
|
|
|
Response result = client.newCall(request).execute();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (MediaType.parse("application/force-download").equals(result.body().contentType())) {
|
|
|
|
|
int total = 0;
|
|
|
|
|
if (result!=null&&result.isSuccessful()&&MediaType.parse("application/force-download").equals(result.body().contentType())) {
|
|
|
|
|
try (InputStream inputStream = result.body().byteStream()) {
|
|
|
|
|
|
|
|
|
|
String filePathSlash = filePath.substring(filePath.length() - 1).equals("/") ? "" : "/";
|
|
|
|
@ -1024,21 +1035,28 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
byte b[] = new byte[1024];
|
|
|
|
|
|
|
|
|
|
int len = 0;
|
|
|
|
|
|
|
|
|
|
while ((len = inputStream.read(b)) != -1) {
|
|
|
|
|
|
|
|
|
|
total += len;
|
|
|
|
|
outputStream.write(b, 0, len);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
outputStream.flush();
|
|
|
|
|
outputStream.close();
|
|
|
|
|
if(!(total>0)) {
|
|
|
|
|
new File(filePath + filePathSlash + fileName).delete();
|
|
|
|
|
executeSql("delete from idc_file where filePath='"+fileName+"'");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!(total>0)) {
|
|
|
|
|
String sql = "replace idc_file (filePath,createTime) values ('"+fileName+"',now())";
|
|
|
|
|
executeSql(sql);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
@ -1202,6 +1220,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
alterTable("idc_status", "create table idc_status (id varchar(100),statusTime datetime,PRIMARY KEY (id))");
|
|
|
|
|
alterTable("idc_record", "create table idc_record (id varchar(36),type varchar(60),fkId varchar(36),isEnd char(1),createTime datetime,primary key (id),INDEX i_idc_record_fk_id (fkId),INDEX i_idc_record_create_time (createTime))");
|
|
|
|
|
alterTable("idc_log", "create table idc_log (id varchar(36),orderNum int,taskId varchar(60),type varchar(60),content varchar(2000),offset int,total int,createTime datetime,PRIMARY KEY (id))");
|
|
|
|
|
alterTable("idc_file", "create table idc_file (filePath varchar(255),createTime datetime,PRIMARY KEY (filePath))");
|
|
|
|
|
dbDao.delete("delete from idc_record where createTime<date_sub(now(),interval 2 day) and isEnd='0'");
|
|
|
|
|
try {
|
|
|
|
|
executeSql("alter table basic_export_status add column cacheFilePath varchar(255)");
|
|
|
|
@ -1211,6 +1230,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
executeSql("alter table basic_export_status add column msg varchar(255)");
|
|
|
|
|
executeSql("alter table basic_upload_status add column msg varchar(255)");
|
|
|
|
|
executeSql("alter table basic_download_status add column msg varchar(255)");
|
|
|
|
|
executeSql("create index i_idc_file_create_time on idc_file (createTime asc)");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|