@ -40,7 +40,6 @@ import com.glxp.api.entity.system.SystemParamConfigEntity;
import com.glxp.api.idc.service.IdcService ;
import com.glxp.api.idc.utils.DBAUtils ;
import com.glxp.api.idc.utils.IDCUtils ;
import com.glxp.api.idc.utils.TableUtils ;
import com.glxp.api.req.system.ScheduledRequest ;
import com.glxp.api.service.system.SystemParamConfigService ;
import com.glxp.api.util.CustomUtil ;
@ -203,7 +202,7 @@ public class IdcServiceImpl implements IdcService {
}
}
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" ) ;
@ -225,7 +224,7 @@ public class IdcServiceImpl implements IdcService {
/*未发送重新发送*/
asyncFailTask ( map . get ( "syncIp" ) . toString ( ) ) ;
}
String [ ] syncTables = TableUtils . syncTables ( ) ;
for ( int i = 0 ; i < syncTables . length ; i + + ) {
String [ ] tnames = syncTables [ i ] . split ( "/" ) ;
@ -241,10 +240,10 @@ public class IdcServiceImpl implements IdcService {
}
}
/*上传失败重新上传*/
private void asyncFailTask ( String host ) {
try
try
{
String filePathSlash = filePath . substring ( filePath . length ( ) - 1 ) . equals ( "/" ) ? "" : "/" ;
String sql = "select * from basic_export_status where status='1' and receiveStatus='0' where updateTime<date_sub(now(),interval 6 minute) order by updateTime" ;
@ -302,10 +301,10 @@ public class IdcServiceImpl implements IdcService {
}
}
} catch ( Exception ex ) {
}
}
/*数据删除同步*/
private void asyncDelete ( String tname , boolean isUpload , String syncIp ) {
String [ ] tnames = tname . split ( "/" ) ;
@ -354,7 +353,7 @@ public class IdcServiceImpl implements IdcService {
try {
result = relay ( "" , JSON . toJSONString ( msg ) , null , syncIp ) ;
} catch ( Exception ex ) {
}
if ( IDCUtils . isJson ( result ) ) {
JSONObject json = JSON . parseObject ( result ) ;
@ -362,14 +361,14 @@ public class IdcServiceImpl implements IdcService {
saveIdcLog ( tnames [ 9 ] , "" , tnames [ 2 ] + ">success(delete)" , i * limit , total ) ;
} else {
success = false ;
saveIdcLog ( tnames [ 9 ] , "" , tnames [ 2 ] + ">" + result , i * limit , total ) ;
}
} else {
success = false ;
saveIdcLog ( tnames [ 9 ] , "" , syncIp + ":" + tnames [ 2 ] + ">fail:上传地址未连通" , i * limit , total ) ;
}
} else {
saveIdcLog ( tnames [ 9 ] , "" , tnames [ 2 ] + ">success(delete)" , i * limit , total ) ;
}
@ -716,7 +715,7 @@ public class IdcServiceImpl implements IdcService {
Map < String , Object > whereParams = new HashMap < String , Object > ( ) ;
whereParams . put ( "sqlWhere" , params . get ( "sqlWhere" ) ) ;
String dataWhere = params . get ( "dataWhere" ) ! = null ? params . get ( "dataWhere" ) . toString ( ) : "" ;
Map < String , Object > map = new HashMap < String , Object > ( ) ;
String where = DBAUtils . convertWhere ( column , whereParams , dataWhere ) ;
@ -951,7 +950,7 @@ public class IdcServiceImpl implements IdcService {
private boolean analyToDB ( String host , String tableName , String uniqueColumn , String
filePathColumn , List < Map < String , Object > > list , boolean isUpload ) {
String tName = DBAUtils . tableRealName ( tableName ) ;
String sql = "replace " + tName + "(" ;
String del = "delete from " + tName + " where " ;
@ -1184,27 +1183,27 @@ public class IdcServiceImpl implements IdcService {
int total = 0 ;
if ( result ! = null & & result . isSuccessful ( ) & & MediaType . parse ( "application/force-download" ) . equals ( result . body ( ) . contentType ( ) ) ) {
try ( InputStream inputStream = result . body ( ) . byteStream ( ) ) {
FileOutputStream outputStream = new FileOutputStream ( filePath + filePathSlash + imagePath + fileName ) ;
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 + imagePath + fileName ) . delete ( ) ;
executeSql ( "delete from idc_file where filePath='" + fileName + "'" ) ;
}
} catch ( Exception e ) {
@ -1403,7 +1402,7 @@ public class IdcServiceImpl implements IdcService {
}
private void executeSql ( String sql ) {
try {
jdbcTemplate . execute ( sql ) ;
@ -1414,4 +1413,4 @@ public class IdcServiceImpl implements IdcService {
}
}
}