上传文件重命名内容修改

This commit is contained in:
qiaoqinzheng 2024-01-29 13:41:28 +08:00
parent dac0736e72
commit 6a65d9cdd6

View File

@ -63,8 +63,7 @@ public class SpectrumFileServiceImpl implements ISpectrumFileService {
ZipInputStream zipInputStream = null; ZipInputStream zipInputStream = null;
String slash = SymbolConstant.SINGLE_SLASH; String slash = SymbolConstant.SINGLE_SLASH;
String filePath = slash + spectrumPathProperties.getUploadPath() String filePath = spectrumPathProperties.getUploadPath() + slash + username;
+ slash + username;
String tempFilePath = System.getProperty("java.io.tmpdir") + username + slash; String tempFilePath = System.getProperty("java.io.tmpdir") + username + slash;
List<String> fileNames = new ArrayList<>(); List<String> fileNames = new ArrayList<>();
List<File> fileList = new ArrayList<>(); List<File> fileList = new ArrayList<>();
@ -106,9 +105,7 @@ public class SpectrumFileServiceImpl implements ISpectrumFileService {
if (!regexPattern.matcher(fileName).find() && !regexPattern1.matcher(fileName).find()) { if (!regexPattern.matcher(fileName).find() && !regexPattern1.matcher(fileName).find()) {
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(oneFile); EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(oneFile);
String suffix = nameStandUtil.GetSuffix(struct.data_type, struct.spectrum_quantity, String.valueOf(struct.acquisition_live_time)); String suffix = nameStandUtil.GetSuffix(struct.data_type, struct.spectrum_quantity, String.valueOf(struct.acquisition_live_time));
String filePreffix = struct.detector_code + StringPool.DASH + struct.acquisition_start_date.replace(StringPool.SLASH, StringPool.EMPTY)+StringPool.UNDERSCORE fileName = nameStandUtil.GetFileNameFromDateTime(struct.measurement_id, suffix);
+ struct.acquisition_start_time.substring(0, 5).replace(StringPool.COLON, StringPool.EMPTY);
fileName = filePreffix+suffix;
} }
String fullFilePath = rootPath + filePath + slash + fileName; String fullFilePath = rootPath + filePath + slash + fileName;
FileInputStream local = new FileInputStream(oneFile); FileInputStream local = new FileInputStream(oneFile);