feat:database details

This commit is contained in:
nieziyan 2023-10-30 11:15:55 +08:00
parent f9d780379f
commit 3c7280d516
5 changed files with 30 additions and 1 deletions

View File

@ -18,4 +18,10 @@ public interface SysServerMapper extends BaseMapper<SysServer> {
List<SourceDto> pageAll(String itemName);
List<AlarmInfo> alarmInfo(String sourceId);
List<String> dbNamesPG();
List<String> dbNamesMY();
List<String> dbNamesOR();
}

View File

@ -72,4 +72,14 @@
WHERE r.source_id = #{sourceId}
ORDER BY l.alarm_start_date DESC
</select>
<select id="dbNamesPG" resultType="java.lang.String">
SELECT datname FROM pg_database WHERE datistemplate = false;
</select>
<select id="dbNamesMY" resultType="java.lang.String">
SHOW DATABASES;
</select>
<select id="dbNamesOR" resultType="java.lang.String">
SELECT username FROM all_users;
</select>
</mapper>

View File

@ -33,4 +33,6 @@ public interface ISysServerService extends IService<SysServer> {
Result<?> details_BasicInfo(String hostId);
Result<?> details_AlarmInfo(String sourceId, Integer pageNo, Integer pageSize);
List<String> dbNames();
}

View File

@ -304,4 +304,10 @@ public class SysServerServiceImpl extends ServiceImpl<SysServerMapper, SysServer
page.setRecords(records);
return Result.OK(page);
}
@Override
public List<String> dbNames() {
return null;
}
}

View File

@ -62,7 +62,9 @@ public class SpectrumFileServiceImpl implements ISpectrumFileService {
FileOutputStream fos = null;
ZipInputStream zipInputStream = null;
String slash = SymbolConstant.SINGLE_SLASH;
String filePath = slash + spectrumPathProperties.getUploadPath() + slash + username;
String filePath = slash + spectrumPathProperties.getUploadPath()
+ slash + username;
String tempFilePath = System.getProperty("java.io.tmpdir") + username + slash;
List<String> fileNames = new ArrayList<>();
List<File> fileList = new ArrayList<>();
@ -96,14 +98,17 @@ public class SpectrumFileServiceImpl implements ISpectrumFileService {
boolean created = FTPUtil.createDirs(ftpClient, filePath);
if (!created) return Result.error(Prompt.DIR_CREATE_FAIL + filePath);
// 上传所有文件
System.out.println("filelist>>>>"+fileList.size());
for (File oneFile : fileList) {
String fileName = oneFile.getName();
// 判断能谱文件名称是否符合规则不符合则进行重命名
if (!regexPattern.matcher(fileName).find() && !regexPattern1.matcher(fileName).find()) {
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(oneFile);
String suffix = nameStandUtil.GetSuffix(struct.data_type, struct.spectrum_quantity, String.valueOf(struct.acquisition_live_time));
fileName = oneFile.getName().substring(0, 23)+suffix;
}
String fullFilePath = filePath + slash + fileName;
System.out.println("fullFilePath>>>>"+fullFilePath);
FileInputStream local = new FileInputStream(oneFile);
ftpClient.storeFile(fullFilePath, local);
}