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

master
chengqf 2 years ago
parent 8bef5b9c66
commit 2a4960fbbd

@ -282,8 +282,8 @@ public class IdcServiceImpl implements IdcService {
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 += " 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 += " " + 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))";
} else {
sqlWhere = "not exists (select fkId from idc_record where type='" + tnames[2] + "' and fkId=" + tnames[2] + "." + keyColumn + ")";
map.put("isEnd", "1");
@ -1023,8 +1023,9 @@ public class IdcServiceImpl implements IdcService {
.build();
try {
Response result = client.newCall(request).execute();
String msg = result!=null ? result.message().length()>200 ? result.message().substring(0,200) : result.message() : "";
int total = 0;
if (result!=null&&result.isSuccessful()&&MediaType.parse("application/force-download").equals(result.body().contentType())) {
try (InputStream inputStream = result.body().byteStream()) {
@ -1054,10 +1055,11 @@ public class IdcServiceImpl implements IdcService {
}
}
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);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@ -1230,6 +1232,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("alter table idc_file add column msg varchar(255)");
executeSql("create index i_idc_file_create_time on idc_file (createTime asc)");
} catch (Exception e) {

Loading…
Cancel
Save