From bec2a892a1839ca8dbd194d01bb49f050d720c31 Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Wed, 20 Sep 2023 17:13:23 +0800 Subject: [PATCH] =?UTF-8?q?GammaFileUtil=E4=BF=AE=E6=94=B9=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=86=85=E5=AE=B9=E8=8E=B7=E5=8F=96=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20NameStandUtil=E4=BF=AE=E6=94=B9=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=B7=AF=E5=BE=84=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9Gamma=E6=A8=A1=E5=9D=97saveToDB=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/common/util/GammaFileUtil.java | 4 +-- .../org/jeecg/common/util/NameStandUtil.java | 27 +++++++++---------- .../service/impl/GammaServiceImpl.java | 11 +++++--- .../GardsSampleDataSpectrumServiceImpl.java | 2 +- ...sSampleDescriptionSpectrumServiceImpl.java | 22 +++++++-------- 5 files changed, 34 insertions(+), 32 deletions(-) diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/GammaFileUtil.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/GammaFileUtil.java index 8bfcbb30..7c735c30 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/GammaFileUtil.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/GammaFileUtil.java @@ -56,7 +56,7 @@ public class GammaFileUtil { @Autowired private NameStandUtil nameStandUtil; - public boolean loadFile(String pathName, String fileName, PHDFile phd, Result result){ + public boolean loadFile(String pathName, String fileName, PHDFile phd, Result result) { phd.setFilepath(pathName); phd.setFilename(fileName); //连接ftp @@ -2804,7 +2804,7 @@ public class GammaFileUtil { String subDirSavePath = ""; subDirSavePath+=nameStandUtil.GetSysTemSubdir(fileAnlyse.getHeader().getSystem_type()); subDirSavePath+=nameStandUtil.GetDateTypeSubdir(dataType); - Map fileNames = nameStandUtil.NameStandard(subDirSavePath, fileAnlyse); + Map fileNames = nameStandUtil.NameStandard(fileAnlyse); String lcName = fileNames.get("lc"); String scacName = fileNames.get("scac"); String baselineName = fileNames.get("baseline"); diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/NameStandUtil.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/NameStandUtil.java index 711c2320..12d7c03a 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/NameStandUtil.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/NameStandUtil.java @@ -20,15 +20,15 @@ public class NameStandUtil { public String GetSysTemSubdir(String systemType) { StringBuffer path = new StringBuffer(); if(systemType.contains(SystemType.BETA.getType())) { - path.append(StringPool.SLASH+"Spectrum"); + path.append("Spectrum"); path.append(StringPool.SLASH+"Xenon"); path.append(StringPool.SLASH+"Sauna"); } else if(systemType.contains(SystemType.GAMMA.getType())) { - path.append(StringPool.SLASH+"Spectrum"); + path.append("Spectrum"); path.append(StringPool.SLASH+"Xenon"); path.append(StringPool.SLASH+"Spalax"); } else if(systemType.contains(SystemType.PARTICULATE.getType())) { - path.append(StringPool.SLASH+"Spectrum"); + path.append("Spectrum"); path.append(StringPool.SLASH+"Particulates"); } return path.toString(); @@ -78,9 +78,9 @@ public class NameStandUtil { return path.toString(); } - public Map NameStandard(String path, PHDFile fileAnlyse) { + public Map NameStandard(PHDFile fileAnlyse) { String suffix = GetSuffix(fileAnlyse.getMsgInfo().getData_type(),fileAnlyse.getHeader().getSystem_type(),fileAnlyse.getHeader().getSpectrum_quantity(),String.valueOf(fileAnlyse.getAcq().getAcquisition_live_time())); - Map fileNames = NameStandardByName(path, fileAnlyse.getFilename(), fileAnlyse.getHeader().getMeasurement_id(),suffix); + Map fileNames = NameStandardByName(fileAnlyse.getFilename(), fileAnlyse.getHeader().getMeasurement_id(),suffix); return fileNames; } @@ -117,13 +117,12 @@ public class NameStandUtil { return rData; } - public Map NameStandardByName(String path, String fileName, String dateTimeFormat, String suffix) { + public Map NameStandardByName(String fileName, String dateTimeFormat, String suffix) { Map map = new HashMap<>(); String StandardFileName=""; String measurementName = GetFileNameFromDateTime(dateTimeFormat, suffix); - String fileDir = path + StringPool.SLASH; if(measurementName != fileName) { - StandardFileName = fileDir+measurementName; + StandardFileName = measurementName; } String fileSuffix = "PHD"; @@ -133,11 +132,11 @@ public class NameStandUtil { String m_logfileName = StandardFileName; String m_reportFileName = StandardFileName; - m_lcFileName.replace(fileSuffix,"lc"); - m_baseLineFileName.replace(fileSuffix,"baseline"); - m_scacFileName.replace(fileSuffix,"scac"); - m_logfileName.replace(fileSuffix,"log"); - m_reportFileName.replace("."+fileSuffix,"_rpt"); + m_lcFileName = m_lcFileName.replace(fileSuffix,"lc"); + m_baseLineFileName = m_baseLineFileName.replace(fileSuffix,"baseline"); + m_scacFileName = m_scacFileName.replace(fileSuffix,"scac"); + m_logfileName = m_logfileName.replace(fileSuffix,"log"); + m_reportFileName = m_reportFileName.replace("."+fileSuffix,"_rpt"); String m_saveFileName = StandardFileName; @@ -189,7 +188,7 @@ public class NameStandUtil { //添加文件名日期 List dateSub = GetSubDirByFileName(saveFileName); for(int pos=0;pos phdCache = localCache.getPHDCache(); PHDFile phd = phdCache.getIfPresent(fileName); + if (Objects.isNull(phd)) { + result.error500("请先解析文件!"); + return result; + } //查看分析员是否有权限操作当前台站信息 //判断当前分析员是否有过排班任务 Integer stationId = spectrumAnalysisMapper.getStationId(phd.getHeader().getSite_code()); @@ -2837,8 +2842,7 @@ public class GammaServiceImpl implements IGammaService { phd.setStatus(sampleData.getStatus()); } else { //如果sampleData为空 存储数据 - needUploadSpec = SaveSampleToDB(phd, middleData.analyses_save_filePath); - bRet = needUploadSpec; + bRet = SaveSampleToDB(phd, middleData.analyses_save_filePath); } if(!bRet) { result.error500("The Database hasn't this Spectrum("+phd.getFilename()+") and Insert it to Database failed."); @@ -2931,6 +2935,7 @@ public class GammaServiceImpl implements IGammaService { return result; } + @Transactional public boolean SaveSampleToDB(PHDFile phd, String input_file_name) { boolean bRet = true; String sit_det_code = phd.getHeader().getSite_code(); diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataSpectrumServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataSpectrumServiceImpl.java index ed27c1d7..b1303bb6 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataSpectrumServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataSpectrumServiceImpl.java @@ -113,7 +113,7 @@ public class GardsSampleDataSpectrumServiceImpl extends ServiceImpl 1024){ - t_cmt = t_cmt.substring(0, 1024); - } - GardsSampleDescription sampleDescription = new GardsSampleDescription(); - sampleDescription.setSampleId(sampleId); - sampleDescription.setDescription(t_cmt); - int insert = this.baseMapper.insert(sampleDescription); - if (insert>0) { - bRet = true; - } + String t_cmt = StringUtils.isNotBlank(phd.getOriTotalCmt())?phd.getOriTotalCmt():""; + if(t_cmt.length() > 1024){ + t_cmt = t_cmt.substring(0, 1024); + } + GardsSampleDescription sampleDescription = new GardsSampleDescription(); + sampleDescription.setSampleId(sampleId); + sampleDescription.setDescription(t_cmt); + int insert = this.baseMapper.insert(sampleDescription); + if (insert>0) { + bRet = true; } return bRet; }