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; }