From edc7c3f722c5c69c4461a6ac0184b52f501d9d48 Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 26 Mar 2023 18:04:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E4=B8=BB=E9=94=AE=EF=BC=8Cno?= =?UTF-8?q?t=20exists=E6=9D=A1=E4=BB=B6=E5=A2=9E=E5=8A=A0type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/glxp/sale/admin/idc/dao/DbDao.java | 2 +- .../admin/idc/service/impl/IdcServiceImpl.java | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/api-admin/src/main/java/com/glxp/sale/admin/idc/dao/DbDao.java b/api-admin/src/main/java/com/glxp/sale/admin/idc/dao/DbDao.java index fec44dd..95e50e8 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/idc/dao/DbDao.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/idc/dao/DbDao.java @@ -60,7 +60,7 @@ public interface DbDao { @Select("select column_name columnName, data_type dataType, column_comment columnComment, column_key columnKey, extra as extra,table_name tableName, " + "concat('(',if(NUMERIC_PRECISION>0,CONVERT(NUMERIC_PRECISION,CHAR),''),if(NUMERIC_SCALE>0,concat(',',CONVERT(NUMERIC_SCALE,CHAR)),''),if(CHARACTER_MAXIMUM_LENGTH>0,CONVERT(CHARACTER_MAXIMUM_LENGTH,CHAR),''),')') as width " + " from information_schema.columns\r\n" - + " where lower(table_name) = lower(#{tableName}) column_key='PRI' and table_schema = (select database()) order by ordinal_position") + + " where lower(table_name) = lower(#{tableName}) and column_key='PRI' and table_schema = (select database()) order by ordinal_position") List> listKeyMysql(String tableName); @Select("select cname as \"columnName\",coltype as \"dataType\",cname \"columnComment\",'' as \"columnKey\",'' as \"extra\",tname \"tableName\", " +" '('||decode(sign(PRECISION),1,to_char(PRECISION),'')||decode(sign(SCALE),1,','||to_char(SCALE),'')||decode(sign(PRECISION),1,'',decode(sign(SCALE),1,'',to_char(width)))||')' as width " diff --git a/api-admin/src/main/java/com/glxp/sale/admin/idc/service/impl/IdcServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/idc/service/impl/IdcServiceImpl.java index f28c853..c7a69ea 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/idc/service/impl/IdcServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/idc/service/impl/IdcServiceImpl.java @@ -178,13 +178,17 @@ public class IdcServiceImpl implements IdcService { String[] tn = t.split("/"); String lastUpdateTime = getUpdateTime(tn[0]); Date nowUpdateTime = new Date(); + List> keyList = dbDao.listKeyMysql(tn[0]); + String keyColumn = keyList!=null&&keyList.size()>0 ? keyList.get(0).get("columnName").toString() : "id"; Map map = new HashMap(); - String sqlWhere = "not exists (select fkId from idc_record where fkId="+tn[0]+".id)"; + String sqlWhere = "not exists (select fkId from idc_record where type='"+tn[0]+"' and fkId="+tn[0]+"."+keyColumn+")"; if(!StringUtils.isEmpty(tn[1])) { sqlWhere+=" and "+tn[1]+">=cast('"+lastUpdateTime+"' as datetime)"; } else { map.put("isEnd", "1"); } + if(tn[0].equals("thr_order")) + logger.info("-------------------"+sqlWhere); map.put("sqlWhere", sqlWhere); map.put("tableName", tn[0]); map.put("filePathColumn", tn[2]); @@ -394,10 +398,14 @@ public class IdcServiceImpl implements IdcService { String filePathColumn = params.get("filePathColumn")!=null ? params.get("filePathColumn").toString() : ""; orderNum++; saveIdcLog(messageType,"",tableName +">"+where,0,total); + if(tableName.equals("thr_order")) + logger.info("tableName-->"+tableName+"-->row-->"+total+"-->sqlWhere-->"+where); if(total>0) { success = true; params.put("page", 0); params.put("limit", limit); + List> keyList = dbDao.listKeyMysql(tableName); + String keyColumn = keyList!=null&&keyList.size()>0 ? keyList.get(0).get("columnName").toString() : "id"; for(int i=0;i map = dbDao.get("select * from idc_status where id='"+id+"'"); if(map!=null&&map.get("id")!=null) { - updateTime = DateUtil.formatDate(IDCUtils.parseDate(map.get("statusTime").toString())); + updateTime = DateUtil.formatDate(IDCUtils.parseDate(map.get("statusTime").toString()),"yyyy-MM-dd HH:mm:ss"); } else { updateTime = "2000-01-01 00:00:00"; String sql = "insert into idc_status (id,statusTime) values ('"+id+"',cast('"+updateTime+"' as datetime))";