feat:自建台站loadFromDB
This commit is contained in:
parent
40e94299a7
commit
b48cf5a991
|
@ -0,0 +1,12 @@
|
|||
package org.jeecg.modules.base.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RoiDto {
|
||||
|
||||
private Integer roiNum;
|
||||
|
||||
private String phdPath;
|
||||
|
||||
}
|
|
@ -47,7 +47,7 @@ public interface AnalysisManService {
|
|||
|
||||
void saveQcCheckROI(Integer sampleId, Map<String, QcCheckItem> qcItems, Integer idAnalysis);
|
||||
|
||||
void saveMDCROI(Integer sampleId, Map<String, CalMDCInfo> mdcInfoMap, Integer idAnalysis);
|
||||
void saveMDCROI(Integer sampleId, List<Map<String, CalMDCInfo>> mdcInfoMaps, Integer idAnalysis);
|
||||
|
||||
void saveAnalySettingROI(Integer sampleId, Integer idAnalysis, List<PHDFile> phdFiles);
|
||||
}
|
||||
|
|
|
@ -489,10 +489,12 @@ public class AnalysisManServiceImpl implements AnalysisManService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void saveMDCROI(Integer sampleId, Map<String, CalMDCInfo> mdcInfoMap, Integer idAnalysis){
|
||||
public void saveMDCROI(Integer sampleId, List<Map<String, CalMDCInfo>> mdcInfoMaps, Integer idAnalysis){
|
||||
List<GardsMDCRoi> mdcRois = new ArrayList<>();
|
||||
Set<Integer> roiIds = this.middleDataMap.keySet();
|
||||
for (Integer roiId : roiIds) {
|
||||
List<Integer> roiIds = ListUtil.toList(this.middleDataMap.keySet());
|
||||
for (int i = 0; i < roiIds.size(); i++) {
|
||||
Integer roiId = roiIds.get(i);
|
||||
Map<String, CalMDCInfo> mdcInfoMap = mdcInfoMaps.get(i);
|
||||
mdcRois.addAll(saveMDCROI(sampleId, idAnalysis, roiId, mdcInfoMap));
|
||||
}
|
||||
mdcRoiManService.saveBatch(mdcRois);
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.base.dto.RoiDto;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsDetectors;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
||||
|
@ -86,6 +87,8 @@ public interface SpectrumAnalysisMapper {
|
|||
|
||||
Integer getAnalysisID(@Param(value = "dbName") String dbName, @Param(value = "sampleId") Integer sampleId, @Param(value = "userName") String userName);
|
||||
|
||||
List<RoiDto> roiPaths(@Param("dbName") String dbName, @Param("analysisId") Integer analysisId);
|
||||
|
||||
List<GardsCalibrationPairsSpectrum> ReadGammaFitChannelEnergy(@Param(value = "idAnalysis") Integer idAnalysis);
|
||||
|
||||
List<GardsCalibrationSpectrum> ReadGammaCalibrationParam(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
|
||||
|
|
|
@ -1104,5 +1104,8 @@
|
|||
<select id="findNuclidesAnalysis" resultType="java.lang.String">
|
||||
select NAME from CONFIGURATION.GARDS_NUCL_LIB
|
||||
</select>
|
||||
<select id="roiPaths" resultType="org.jeecg.modules.base.dto.RoiDto">
|
||||
SELECT ROI_NUM, PHD_PATH FROM ${dbName}.GARDS_ANALYSIS_ROI WHERE IDANALYSIS = #{analysisId} ORDER BY ROI_NUM ASC
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -27,6 +27,7 @@ import org.jeecg.common.properties.ParameterProperties;
|
|||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
import org.jeecg.common.util.*;
|
||||
import org.jeecg.modules.base.dto.RoiDto;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
||||
import org.jeecg.modules.base.entity.original.GardsSampleData;
|
||||
|
@ -65,6 +66,8 @@ import java.time.format.DateTimeFormatter;
|
|||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.aspectj.weaver.tools.cache.SimpleCacheFactory.path;
|
||||
|
||||
@Service
|
||||
public class SelfStationServiceImpl implements ISelfStationService {
|
||||
|
||||
|
@ -131,6 +134,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@DS("ora")
|
||||
public Result loadFromDB(String dbName, Integer sampleId, String analyst, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
Map<String, Map<String, Object>> resultMap = new HashMap<>();
|
||||
|
@ -143,14 +147,18 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
result.error500("Please select a piece of data");
|
||||
return result;
|
||||
}
|
||||
String prefix = spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH;
|
||||
//查询分析id,相关的分析结果
|
||||
Integer analysisID = null;
|
||||
List<RoiDto> roiPaths = new ArrayList<>();
|
||||
if (dbName.equalsIgnoreCase("auto")){
|
||||
dbName = "RNAUTO";
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, "RNAUTO");
|
||||
roiPaths = spectrumAnalysisMapper.roiPaths(dbName, analysisID);
|
||||
} else if (dbName.equalsIgnoreCase("man")){
|
||||
dbName = "RNMAN";
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, analyst);
|
||||
roiPaths = spectrumAnalysisMapper.roiPaths(dbName, analysisID);
|
||||
}
|
||||
try {
|
||||
if (Objects.nonNull(analysisID)) {
|
||||
|
@ -173,14 +181,14 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
detFileName = dbSpectrumFilePath.getDetBgFilePath().substring(dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH)+1);
|
||||
}
|
||||
//从缓存中获取公用变量的数据
|
||||
SelfStationData selfStationData = selfCache.getIfPresent(sampleFileName + "-" + userName);
|
||||
SelfStationData selfStationData = selfCache.getIfPresent(sampleFileName + StringPool.DASH + userName);
|
||||
if (Objects.isNull(selfStationData)) {
|
||||
//初始化自建台站数据对象
|
||||
selfStationData = new SelfStationData();
|
||||
//判断sample文件名是否为空
|
||||
if (Objects.nonNull(sample)) {
|
||||
//拼接sample文件路径
|
||||
String sampleFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath();
|
||||
String sampleFilePath = prefix + dbSpectrumFilePath.getSampleFilePath();
|
||||
//返回结果map
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
//获取sample分析后的对象
|
||||
|
@ -190,12 +198,15 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
selfStationData.setSampleTmpPath(sampleFilePath);
|
||||
selfStationUtil.loadFile(selfStationData, sample.getSampleId(), sample.getStatus(), "sample", map);
|
||||
resultMap.put("sample", map);
|
||||
|
||||
// 返回Beta和Gamma的数据
|
||||
bGSpectrum(struct, map);
|
||||
}
|
||||
}
|
||||
//判断det文件名是否为空
|
||||
if (Objects.nonNull(detBg)) {
|
||||
//拼接det文件路径
|
||||
String detFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath();
|
||||
String detFilePath = prefix + dbSpectrumFilePath.getDetBgFilePath();
|
||||
//返回结果map
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
//获取sample分析后的对象
|
||||
|
@ -233,13 +244,45 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
redisUtil.set(userName+StringPool.DASH+systemType+"-list-self", userLib);
|
||||
redisUtil.set(userName+StringPool.DASH+systemType+"-self", nuclideMap);
|
||||
}
|
||||
// 将四个Gamma ROI文件对象放到缓存中
|
||||
SelfStationVueData sampleVueData = selfStationData.getSampleVueData();
|
||||
|
||||
Map<Integer, String> roiPathMap = roiPaths.stream()
|
||||
.collect(Collectors.toMap(RoiDto::getRoiNum, RoiDto::getPhdPath));
|
||||
|
||||
String fullPath1 = prefix + roiPathMap.get(1);
|
||||
String fullPath2 = prefix + roiPathMap.get(2);
|
||||
String fullPath3 = prefix + roiPathMap.get(3);
|
||||
String fullPath4 = prefix + roiPathMap.get(4);
|
||||
|
||||
String name1 = FileUtil.getName(fullPath1);
|
||||
String name2 = FileUtil.getName(fullPath2);
|
||||
String name3 = FileUtil.getName(fullPath3);
|
||||
String name4 = FileUtil.getName(fullPath4);
|
||||
|
||||
String path = fullPath1.substring(0, fullPath1.lastIndexOf(StrUtil.SLASH));
|
||||
|
||||
sampleVueData.setROIOneFileName(name1);
|
||||
sampleVueData.setROIOnePHDFile(selfStationUtil.getGammaPHD(name1, path));
|
||||
sampleVueData.setROITwoFileName(name2);
|
||||
sampleVueData.setROITwoPHDFile(selfStationUtil.getGammaPHD(name2, path));
|
||||
sampleVueData.setROIThreeFileName(name3);
|
||||
sampleVueData.setROIThreePHDFile(selfStationUtil.getGammaPHD(name3, path));
|
||||
sampleVueData.setROIFourFileName(name4);
|
||||
sampleVueData.setROIFourPHDFile(selfStationUtil.getGammaPHD(name4, path));
|
||||
}
|
||||
//将自建台站的数据封装到缓存对象中
|
||||
selfCache.put(sampleFileName + StringPool.DASH + userName, selfStationData);
|
||||
//将缓存对象存入到缓存中
|
||||
selfStationCache.setSelfCache(selfCache);
|
||||
} else {
|
||||
if (Objects.nonNull(sample)) {
|
||||
//返回结果map
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
selfStationUtil.loadFile(selfStationData, sample.getSampleId(), sample.getStatus(), "sample", map);
|
||||
resultMap.put("sample", map);
|
||||
// 返回Beta和Gamma的数据
|
||||
bGSpectrum(selfStationData.getSampleStruct(), map);
|
||||
}
|
||||
if (Objects.nonNull(detBg)) {
|
||||
//返回结果map
|
||||
|
@ -251,9 +294,10 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
result.setSuccess(true);
|
||||
result.setResult(resultMap);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -513,7 +557,6 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
seriseData.setY(gCounts.get(i));
|
||||
seriseDataG.add(seriseData);
|
||||
}
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
map.put("bSpectrum", seriseDataB);
|
||||
map.put("gSpectrum", seriseDataG);
|
||||
}
|
||||
|
@ -4087,7 +4130,12 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
String path4 = savePathName + StrUtil.SLASH + phdFile4.getFilename();
|
||||
List<String> phdFilePaths = ListUtil.toList(path1, path2, path3, path4);
|
||||
//读取参数内容
|
||||
Map<String, CalMDCInfo> mdcInfoMap = phdFile1.getMdcInfoMap();
|
||||
Map<String, CalMDCInfo> mdcInfoMap1 = phdFile1.getMdcInfoMap();
|
||||
Map<String, CalMDCInfo> mdcInfoMap2 = phdFile1.getMdcInfoMap();
|
||||
Map<String, CalMDCInfo> mdcInfoMap3 = phdFile1.getMdcInfoMap();
|
||||
Map<String, CalMDCInfo> mdcInfoMap4 = phdFile1.getMdcInfoMap();
|
||||
List<Map<String, CalMDCInfo>> mdcInfoMaps = ListUtil.toList(mdcInfoMap1, mdcInfoMap2,
|
||||
mdcInfoMap3, mdcInfoMap4);
|
||||
|
||||
bRet = gammaFileUtil.GetInterMiddlData(phdFiles, userName, middleDatas, "save");
|
||||
if (!bRet) {
|
||||
|
@ -4161,7 +4209,7 @@ public class SelfStationServiceImpl implements ISelfStationService {
|
|||
// 向 RNMAN.GARDS_ANALY_SETTING 表写入 SpecSetup 分析参数设置
|
||||
analysisManService.saveAnalySettingROI(sampleId, idAnalysis, phdFiles);
|
||||
// 向 RNMAN.GARDS_MDC 表写入 MDC计算结果
|
||||
analysisManService.saveMDCROI(sampleId, mdcInfoMap, idAnalysis);
|
||||
analysisManService.saveMDCROI(sampleId, mdcInfoMaps, idAnalysis);
|
||||
if (bRet) {
|
||||
phd.setStatus("R");
|
||||
//分析成功后存储日志文件和报告文件
|
||||
|
|
Loading…
Reference in New Issue
Block a user