feat:文件上传失败列表

This commit is contained in:
nieziyan 2023-11-02 14:37:30 +08:00
parent 96df7732d0
commit 970446059b
3 changed files with 35 additions and 11 deletions

View File

@ -63,9 +63,9 @@
SELECT SELECT
a.table_name AS tableName, a.table_name AS tableName,
a.num_rows AS numRow, a.num_rows AS numRow,
ROUND((d.bytes / (1024 * 1024)), 2) AS dataSize, COALESCE(ROUND((d.bytes / (1024 * 1024)), 2), 0) AS dataSize,
ROUND((d.bytes / (1024 * 1024)), 2) AS indexSize, COALESCE(ROUND((d.bytes / (1024 * 1024)), 2), 0) AS indexSize,
ROUND((d.bytes / d.max_size) * 100, 3) AS used COALESCE(ROUND((d.bytes / d.max_size) * 100, 3), 0) AS used
FROM FROM
all_tables a all_tables a
LEFT JOIN dba_segments d ON a.owner = d.owner AND a.table_name = d.segment_name AND d.segment_type = 'TABLE' LEFT JOIN dba_segments d ON a.owner = d.owner AND a.table_name = d.segment_name AND d.segment_type = 'TABLE'
@ -76,7 +76,7 @@
<select id="dbIndexOR" resultType="org.jeecg.modules.base.dto.DBInfo"> <select id="dbIndexOR" resultType="org.jeecg.modules.base.dto.DBInfo">
SELECT SELECT
a.table_name AS tableName, a.table_name AS tableName,
ROUND((d.bytes / (1024 * 1024)), 2) AS indexSize COALESCE(ROUND((d.bytes / (1024 * 1024)), 2), 0) AS indexSize
FROM FROM
all_tables a all_tables a
LEFT JOIN dba_segments d ON a.owner = d.owner AND a.table_name = d.segment_name AND d.segment_type = 'INDEX' LEFT JOIN dba_segments d ON a.owner = d.owner AND a.table_name = d.segment_name AND d.segment_type = 'INDEX'

View File

@ -186,12 +186,10 @@ public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDa
List<String> dbNames = new ArrayList<>(); List<String> dbNames = new ArrayList<>();
switch (dbType){ switch (dbType){
case DataBaseConstant.DB_TYPE_ORACLE: case DataBaseConstant.DB_TYPE_ORACLE:
DSSwitcher.switchToOracle(); dbNames = dbNamesOR();
dbNames = baseMapper.dbNamesOR();
DSSwitcher.clear();
break; break;
case DataBaseConstant.DB_TYPE_POSTGRESQL: case DataBaseConstant.DB_TYPE_POSTGRESQL:
dbNames = baseMapper.dbNamesPG(); dbNames = dbNamesPG();
break; break;
case DataBaseConstant.DB_TYPE_MYSQL: case DataBaseConstant.DB_TYPE_MYSQL:
// ... // ...
@ -221,6 +219,25 @@ public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDa
return dbInfos; return dbInfos;
} }
private List<String> dbNamesOR(){
DSSwitcher.switchToOracle();
List<String> dbNames = baseMapper.dbNamesOR();
DSSwitcher.clear();
return dbNames;
}
private List<String> dbNamesPG(){
return baseMapper.dbNamesPG();
}
private List<String> dbNamesMY(){
// 切换数据源
return baseMapper.dbNamesMY();
// 清除数据源
}
private List<DBInfo> dbInfoOR(String dataBase){ private List<DBInfo> dbInfoOR(String dataBase){
DSSwitcher.switchToOracle(); DSSwitcher.switchToOracle();
List<DBInfo> dbInfos = baseMapper.dbInfoOR(dataBase); List<DBInfo> dbInfos = baseMapper.dbInfoOR(dataBase);
@ -233,4 +250,9 @@ public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDa
DSSwitcher.clear(); DSSwitcher.clear();
return dbInfos; return dbInfos;
} }
private List<DBInfo> dbInfoPG(String dataBase){
return null;
}
} }

View File

@ -98,7 +98,7 @@ public class SpectrumFileServiceImpl implements ISpectrumFileService {
boolean created = FTPUtil.createDirs(ftpClient, filePath); boolean created = FTPUtil.createDirs(ftpClient, filePath);
if (!created) return Result.error(Prompt.DIR_CREATE_FAIL + filePath); if (!created) return Result.error(Prompt.DIR_CREATE_FAIL + filePath);
// 上传所有文件 // 上传所有文件
System.out.println("filelist>>>>"+fileList.size()); List<String> failList = new ArrayList<>();
String rootPath = spectrumPathProperties.getRootPath(); String rootPath = spectrumPathProperties.getRootPath();
for (File oneFile : fileList) { for (File oneFile : fileList) {
String fileName = oneFile.getName(); String fileName = oneFile.getName();
@ -109,10 +109,12 @@ public class SpectrumFileServiceImpl implements ISpectrumFileService {
fileName = oneFile.getName().substring(0, 23)+suffix; fileName = oneFile.getName().substring(0, 23)+suffix;
} }
String fullFilePath = rootPath + filePath + slash + fileName; String fullFilePath = rootPath + filePath + slash + fileName;
System.out.println("fullFilePath>>>>"+fullFilePath);
FileInputStream local = new FileInputStream(oneFile); FileInputStream local = new FileInputStream(oneFile);
ftpClient.storeFile(fullFilePath, local); boolean success = ftpClient.storeFile(fullFilePath, local);
if (!success) failList.add(fullFilePath);
} }
if (CollUtil.isNotEmpty(failList))
return Result.error(Prompt.UPLOAD_ERR, failList);
return Result.OK(Prompt.UPLOAD_SUCC); return Result.OK(Prompt.UPLOAD_SUCC);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();