修改同步数据时间条件到当前时间

master
chengqf 2 years ago
parent 8f148f2cc0
commit b028c2ec6c

@ -282,8 +282,8 @@ public class IdcServiceImpl implements IdcService {
if (!StringUtils.isEmpty(updateTimeColumn)) { if (!StringUtils.isEmpty(updateTimeColumn)) {
sqlWhere += " " + updateTimeColumn + ">= cast('" + lastUpdateTime + "' as datetime)";// and date_add(cast('"+DateUtil.formatDate(nowUpdateTime, "yyyy-MM-dd HH:mm:ss")+"' as datetime),INTERVAL 1 day)"; sqlWhere += " " + updateTimeColumn + " between cast('" + lastUpdateTime + "' as datetime) and cast('"+DateUtil.formatDate(nowUpdateTime, "yyyy-MM-dd HH:mm:ss")+"' as datetime)";
sqlWhere += " and not exists (select fkId from idc_record where type='" + tnames[2] + "' and fkId=" + tnames[2] + "." + keyColumn + " and createTime>date_sub(now(),interval 15 MINUTE))"; //sqlWhere += " and not exists (select fkId from idc_record where type='" + tnames[2] + "' and fkId=" + tnames[2] + "." + keyColumn + " and createTime>date_sub(now(),interval 15 MINUTE))";
} else { } else {
sqlWhere = "not exists (select fkId from idc_record where type='" + tnames[2] + "' and fkId=" + tnames[2] + "." + keyColumn + ")"; sqlWhere = "not exists (select fkId from idc_record where type='" + tnames[2] + "' and fkId=" + tnames[2] + "." + keyColumn + ")";
map.put("isEnd", "1"); map.put("isEnd", "1");
@ -1023,7 +1023,7 @@ public class IdcServiceImpl implements IdcService {
.build(); .build();
try { try {
Response result = client.newCall(request).execute(); Response result = client.newCall(request).execute();
String msg = result!=null ? result.message().length()>200 ? result.message().substring(0,200) : result.message() : "";
int total = 0; int total = 0;
if (result!=null&&result.isSuccessful()&&MediaType.parse("application/force-download").equals(result.body().contentType())) { if (result!=null&&result.isSuccessful()&&MediaType.parse("application/force-download").equals(result.body().contentType())) {
try (InputStream inputStream = result.body().byteStream()) { try (InputStream inputStream = result.body().byteStream()) {
@ -1054,10 +1054,11 @@ public class IdcServiceImpl implements IdcService {
} }
} }
if(!(total>0)) { if(!(total>0)) {
String sql = "replace idc_file (filePath,createTime) values ('"+fileName+"',now())"; String sql = "replace idc_file (filePath,createTime,msg) values ('"+fileName+"',now(),'"+msg+"')";
executeSql(sql); executeSql(sql);
} }
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
@ -1230,6 +1231,7 @@ public class IdcServiceImpl implements IdcService {
executeSql("alter table basic_export_status add column msg varchar(255)"); 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_upload_status add column msg varchar(255)");
executeSql("alter table basic_download_status add column msg varchar(255)"); executeSql("alter table basic_download_status add column msg varchar(255)");
executeSql("alter table idc_file add column msg varchar(255)");
executeSql("create index i_idc_file_create_time on idc_file (createTime asc)"); executeSql("create index i_idc_file_create_time on idc_file (createTime asc)");
} catch (Exception e) { } catch (Exception e) {

Loading…
Cancel
Save