feat:自动处理分析失败谱可以加载其基础数据
This commit is contained in:
parent
86968e383b
commit
41245f0546
|
@ -29,14 +29,18 @@ public class GammaController {
|
||||||
|
|
||||||
@GetMapping("initValue")
|
@GetMapping("initValue")
|
||||||
@ApiOperation(value = "初始化gamma数据", notes = "初始化gamma数据")
|
@ApiOperation(value = "初始化gamma数据", notes = "初始化gamma数据")
|
||||||
public void initValue(Integer sampleId, String dbName, String analyst, String fileName, HttpServletRequest request) {
|
public void initValue(Integer sampleId, String dbName,
|
||||||
gammaService.initValue(sampleId, dbName, analyst, fileName, request);
|
String analyst, String fileName,
|
||||||
|
String status, HttpServletRequest request) {
|
||||||
|
gammaService.initValue(sampleId, dbName, analyst, fileName, status, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("gammaByDB")
|
@GetMapping("gammaByDB")
|
||||||
@ApiOperation(value = "gamma页面loadFromDB加载数据", notes = "gamma页面loadFromDB加载数据")
|
@ApiOperation(value = "gamma页面loadFromDB加载数据", notes = "gamma页面loadFromDB加载数据")
|
||||||
public Result gammaByDB(Integer sampleId, String dbName, String analyst, HttpServletRequest request){
|
public Result gammaByDB(Integer sampleId, String dbName,
|
||||||
return gammaService.gammaByDB(dbName, sampleId, analyst, request);
|
String analyst, String status,
|
||||||
|
HttpServletRequest request){
|
||||||
|
return gammaService.gammaByDB(dbName, sampleId, analyst, status, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("gammaByDBApp")
|
@GetMapping("gammaByDBApp")
|
||||||
|
|
|
@ -26,8 +26,12 @@ public class SpectrumAnalysesController {
|
||||||
|
|
||||||
@GetMapping("initValue")
|
@GetMapping("initValue")
|
||||||
@ApiOperation(value = "初始化数据", notes = "初始化数据")
|
@ApiOperation(value = "初始化数据", notes = "初始化数据")
|
||||||
public void initValue(String dbName, Integer sampleId, String analyst, String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request) {
|
public void initValue(String dbName, Integer sampleId,
|
||||||
spectrumAnalysisService.initValue(dbName, sampleId, analyst, sampleFileName, gasFileName, detFileName, qcFileName, request);
|
String analyst, String sampleFileName,
|
||||||
|
String gasFileName, String detFileName,
|
||||||
|
String qcFileName, String status, HttpServletRequest request) {
|
||||||
|
spectrumAnalysisService.initValue(dbName, sampleId, analyst, sampleFileName,
|
||||||
|
gasFileName, detFileName, qcFileName, status, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("getDBSearchList")
|
@GetMapping("getDBSearchList")
|
||||||
|
@ -51,8 +55,9 @@ public class SpectrumAnalysesController {
|
||||||
|
|
||||||
@GetMapping("getDBSpectrumChart")
|
@GetMapping("getDBSpectrumChart")
|
||||||
@ApiOperation(value = "查询折线图相关信息接口", notes = "查询折线图相关信息接口")
|
@ApiOperation(value = "查询折线图相关信息接口", notes = "查询折线图相关信息接口")
|
||||||
public Result getDBSpectrumChart(String dbName, Integer sampleId, String analyst, HttpServletRequest request) {
|
public Result getDBSpectrumChart(String dbName, Integer sampleId, String analyst,
|
||||||
return spectrumAnalysisService.getDBSpectrumChart(dbName, sampleId, analyst, request);
|
String status, HttpServletRequest request) {
|
||||||
|
return spectrumAnalysisService.getDBSpectrumChart(dbName, sampleId, analyst, status, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("getDBSpectrumChartApp")
|
@GetMapping("getDBSpectrumChartApp")
|
||||||
|
|
|
@ -30,6 +30,8 @@ public interface SpectrumAnalysisMapper {
|
||||||
|
|
||||||
String getQCFilePath(String siteDetCode, String collectStartStr);
|
String getQCFilePath(String siteDetCode, String collectStartStr);
|
||||||
|
|
||||||
|
String gasDetFilePath(String measurementId);
|
||||||
|
|
||||||
CommentData viewComment(@Param(value = "sampleId") Integer sampleId);
|
CommentData viewComment(@Param(value = "sampleId") Integer sampleId);
|
||||||
|
|
||||||
String getSampleFilePath(@Param(value = "sampleId") Integer sampleId);
|
String getSampleFilePath(@Param(value = "sampleId") Integer sampleId);
|
||||||
|
|
|
@ -46,16 +46,13 @@
|
||||||
d.analyst analyst,
|
d.analyst analyst,
|
||||||
c.status status,
|
c.status status,
|
||||||
c.input_file_name inputFileName
|
c.input_file_name inputFileName
|
||||||
from
|
FROM
|
||||||
CONFIGURATION.GARDS_DETECTORS a,
|
ORIGINAL.GARDS_SAMPLE_DATA c
|
||||||
CONFIGURATION.GARDS_STATIONS b,
|
LEFT JOIN ${dbName} d ON c.sample_id = d.sample_id
|
||||||
ORIGINAL.GARDS_SAMPLE_DATA c,
|
INNER JOIN CONFIGURATION.GARDS_DETECTORS a ON c.detector_id = a.detector_id
|
||||||
${dbName} d
|
INNER JOIN CONFIGURATION.GARDS_STATIONS b ON c.station_id = b.station_id
|
||||||
<where>
|
<where>
|
||||||
c.sample_id = d.sample_id
|
b.type in
|
||||||
and c.detector_id = a.detector_id
|
|
||||||
and c.station_id = b.station_id
|
|
||||||
and b.type in
|
|
||||||
<foreach collection="stationTypes" item="stationType" open="(" close=")" separator=",">
|
<foreach collection="stationTypes" item="stationType" open="(" close=")" separator=",">
|
||||||
#{stationType}
|
#{stationType}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
@ -214,6 +211,16 @@
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="gasDetFilePath" resultType="java.lang.String">
|
||||||
|
SELECT
|
||||||
|
data.INPUT_FILE_NAME
|
||||||
|
FROM
|
||||||
|
ORIGINAL.GARDS_SAMPLE_AUX aux
|
||||||
|
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA data ON aux.SAMPLE_ID = data.SAMPLE_ID
|
||||||
|
WHERE data.SPECTRAL_QUALIFIE = 'FULL'
|
||||||
|
AND aux.MEASUREMENT_ID = #{measurementId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="viewComment" resultType="org.jeecg.modules.entity.vo.CommentData">
|
<select id="viewComment" resultType="org.jeecg.modules.entity.vo.CommentData">
|
||||||
SELECT A.ANALYST, A.COMMENTS FROM RNMAN.GARDS_ANALYSES A WHERE A.SAMPLE_ID= #{sampleId}
|
SELECT A.ANALYST, A.COMMENTS FROM RNMAN.GARDS_ANALYSES A WHERE A.SAMPLE_ID= #{sampleId}
|
||||||
</select>
|
</select>
|
||||||
|
@ -1104,5 +1111,4 @@
|
||||||
<select id="findNuclidesAnalysis" resultType="java.lang.String">
|
<select id="findNuclidesAnalysis" resultType="java.lang.String">
|
||||||
select NAME from CONFIGURATION.GARDS_NUCL_LIB
|
select NAME from CONFIGURATION.GARDS_NUCL_LIB
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -15,10 +15,13 @@ import java.util.List;
|
||||||
|
|
||||||
public interface IGammaService{
|
public interface IGammaService{
|
||||||
|
|
||||||
void initValue(Integer sampleId, String dbName, String analyst, String fileName, HttpServletRequest request);
|
void initValue(Integer sampleId, String dbName, String analyst, String fileName, String status, HttpServletRequest request);
|
||||||
|
|
||||||
Result gammaByDB(String dbName, Integer sampleId, String analyst, HttpServletRequest request);
|
Result gammaByDB(String dbName, Integer sampleId, String analyst, HttpServletRequest request);
|
||||||
|
|
||||||
|
|
||||||
|
Result<?> gammaByDB(String dbName, Integer sampleId, String analyst, String status, HttpServletRequest request);
|
||||||
|
|
||||||
Result gammaByFile(String fileName, HttpServletRequest request);
|
Result gammaByFile(String fileName, HttpServletRequest request);
|
||||||
|
|
||||||
void delPHDCache(String fileName);
|
void delPHDCache(String fileName);
|
||||||
|
|
|
@ -14,7 +14,9 @@ import java.util.List;
|
||||||
|
|
||||||
public interface ISpectrumAnalysisService {
|
public interface ISpectrumAnalysisService {
|
||||||
|
|
||||||
void initValue(String dbName, Integer sampleId, String analyst, String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request);
|
void initValue(String dbName, Integer sampleId, String analyst,
|
||||||
|
String sampleFileName, String gasFileName, String detFileName,
|
||||||
|
String qcFileName, String status, HttpServletRequest request);
|
||||||
|
|
||||||
Result getDBSearchList(HttpServletRequest request, boolean AllUsers, String sampleType);
|
Result getDBSearchList(HttpServletRequest request, boolean AllUsers, String sampleType);
|
||||||
|
|
||||||
|
@ -24,6 +26,9 @@ public interface ISpectrumAnalysisService {
|
||||||
|
|
||||||
Result getDBSpectrumChart(String dbName, Integer sampleId, String analyst, HttpServletRequest request);
|
Result getDBSpectrumChart(String dbName, Integer sampleId, String analyst, HttpServletRequest request);
|
||||||
|
|
||||||
|
Result<?> getDBSpectrumChart(String dbName, Integer sampleId, String analyst,
|
||||||
|
String status, HttpServletRequest request);
|
||||||
|
|
||||||
Result getFileSpectrumChart(String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request);
|
Result getFileSpectrumChart(String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request);
|
||||||
|
|
||||||
void deleteSpectrumCacheData(String sampleFileName, HttpServletRequest request);
|
void deleteSpectrumCacheData(String sampleFileName, HttpServletRequest request);
|
||||||
|
|
|
@ -80,6 +80,7 @@ import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static org.aspectj.weaver.tools.cache.SimpleCacheFactory.path;
|
||||||
import static org.jeecg.modules.base.enums.ExportTemplate.*;
|
import static org.jeecg.modules.base.enums.ExportTemplate.*;
|
||||||
|
|
||||||
@Service(value = "gammaService")
|
@Service(value = "gammaService")
|
||||||
|
@ -156,16 +157,27 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
private IDataService dataService;
|
private IDataService dataService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initValue(Integer sampleId, String dbName, String analyst, String samfileName, HttpServletRequest request) {
|
public void initValue(Integer sampleId, String dbName,
|
||||||
|
String analyst, String samfileName,
|
||||||
|
String status, HttpServletRequest request) {
|
||||||
if (Objects.nonNull(sampleId) && StringUtils.isNotBlank(dbName)) {
|
if (Objects.nonNull(sampleId) && StringUtils.isNotBlank(dbName)) {
|
||||||
gammaByDB(dbName, sampleId, analyst, request);
|
gammaByDB(dbName, sampleId, analyst, status, request);
|
||||||
} else {
|
} else {
|
||||||
gammaByFile(samfileName, request);
|
gammaByFile(samfileName, request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result gammaByDB(String dbName, Integer sampleId, String analyst, HttpServletRequest request) {
|
public Result<?> gammaByDB(String dbName, Integer sampleId,
|
||||||
|
String analyst, String status,
|
||||||
|
HttpServletRequest request) {
|
||||||
|
if (StrUtil.equals(SampleStatus.FAIL.getValue(), status))
|
||||||
|
return this.gammaByFile(sampleId);
|
||||||
|
return this.gammaByDB(dbName, sampleId, analyst, request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<?> gammaByDB(String dbName, Integer sampleId, String analyst, HttpServletRequest request) {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
// 通过token获取用户名
|
// 通过token获取用户名
|
||||||
String userName = JwtUtil.getUserNameByToken(request);
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
|
@ -284,6 +296,89 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Result<?> gammaByFile(Integer sampleId){
|
||||||
|
Result result = new Result<>();
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
|
||||||
|
String userName = sysUser.getUsername();
|
||||||
|
String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
|
||||||
|
String rootPath = spectrumPathProperties.getRootPath();
|
||||||
|
String saveFilePath = spectrumPathProperties.getSaveFilePath();
|
||||||
|
String fullPath = rootPath + saveFilePath + StringPool.SLASH + sampleFilePath;
|
||||||
|
if (!FileUtil.exist(fullPath))
|
||||||
|
return Result.error("Sample file does not exist!");
|
||||||
|
String fileName = FileUtil.getName(fullPath);
|
||||||
|
String path = FileUtil.getParent(fullPath, 1);
|
||||||
|
// 获取当前角色的颜色配置
|
||||||
|
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||||
|
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||||
|
PHDFile phd = phdCache.getIfPresent(fileName + StringPool.DASH + userName);
|
||||||
|
if (Objects.isNull(phd)) {
|
||||||
|
phd = new PHDFile();
|
||||||
|
// 加载文件内容
|
||||||
|
boolean bRet = gammaFileUtil.loadFile(path, fileName, phd, "BetaGamma", result);
|
||||||
|
if (!bRet) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(phd) && !phd.isValid()) {
|
||||||
|
result.error500("This Spectrum is invalid! it's counts are all zero");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (!redisUtil.hasKey(userName+StringPool.DASH+phd.getHeader().getSystem_type()) || !redisUtil.hasKey(userName+StringPool.DASH+phd.getHeader().getSystem_type()+"-list")) {
|
||||||
|
//读取缓存的全部核素信息
|
||||||
|
Map<String, NuclideLines> allNuclideMap = (Map<String, NuclideLines>) redisUtil.get("AllNuclideMap");
|
||||||
|
// 查询当前用户关联的核素信息
|
||||||
|
List<String> userLib = new LinkedList<>();
|
||||||
|
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
|
||||||
|
userLib = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase());
|
||||||
|
if (CollectionUtils.isEmpty(userLib)) {
|
||||||
|
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
|
||||||
|
}
|
||||||
|
userLib = userLib.stream().sorted().collect(Collectors.toList());
|
||||||
|
Map<String, NuclideLines> nuclideMap = new HashMap<>();
|
||||||
|
for (Map.Entry<String, NuclideLines> entry:allNuclideMap.entrySet()) {
|
||||||
|
if (userLib.contains(entry.getKey())) {
|
||||||
|
nuclideMap.put(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
redisUtil.set(userName+StringPool.DASH+phd.getHeader().getSystem_type()+"-list", userLib);
|
||||||
|
redisUtil.set(userName+StringPool.DASH+phd.getHeader().getSystem_type(), nuclideMap);
|
||||||
|
}
|
||||||
|
//缓存phd谱的核素信息
|
||||||
|
Map<String, NuclideLines> phdNuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName + StringPool.DASH + phd.getHeader().getSystem_type());
|
||||||
|
phd.setPhdNuclideMap(phdNuclideMap);
|
||||||
|
//读取redis缓存的计算mdc信息
|
||||||
|
Map<String, CalMDCInfo> mdcInfoMap = (Map<String, CalMDCInfo>) redisUtil.get("mdcInfoMap-"+phd.getHeader().getSystem_type());
|
||||||
|
if (CollectionUtils.isNotEmpty(mdcInfoMap)) {
|
||||||
|
phd.setMdcInfoMap(mdcInfoMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 更新 ‘QC Flags’ 状态
|
||||||
|
List<String> qcstate = gammaFileUtil.Qcstate(phd);
|
||||||
|
map.put("QCFlag", qcstate);
|
||||||
|
// 更新 ‘Detailed Information’ 信息
|
||||||
|
List<String> detailedInfo = gammaFileUtil.DetailedInfo(phd.getId_sample(), phd);
|
||||||
|
map.put("DetailedInformation", detailedInfo);
|
||||||
|
// 更新 ACQ 模块中各时间信息
|
||||||
|
map.put("start_time", phd.getAcq().getAcquisition_start_date() + "\n" + phd.getAcq().getAcquisition_start_time());
|
||||||
|
map.put("real_time", String.format("%.2f", phd.getAcq().getAcquisition_real_time()));
|
||||||
|
map.put("live_time", String.format("%.2f", phd.getAcq().getAcquisition_live_time()));
|
||||||
|
double deadTime = (phd.getAcq().getAcquisition_real_time() - phd.getAcq().getAcquisition_live_time()) / phd.getAcq().getAcquisition_real_time();
|
||||||
|
map.put("dead_time", String.format("%.2f", deadTime * 100));
|
||||||
|
map.put("checkBox_updateCal", phd.getSetting().isBUpdateCal());
|
||||||
|
map.put("bAnalyed", phd.isBAnalyed());
|
||||||
|
map.put("peak", phd.getVPeak());
|
||||||
|
map.put("BaseCtrls", phd.getBaseCtrls());
|
||||||
|
List<SeriseData> differance = gammaFileUtil.Differance(phd, phd.getVPeak());
|
||||||
|
map.put("barChart", differance);
|
||||||
|
gammaFileUtil.UpdateChart(phd, map, colorMap);
|
||||||
|
phdCache.put(fileName + StringPool.DASH + userName, phd);
|
||||||
|
localCache.setPHDCache(phdCache);
|
||||||
|
result.setSuccess(true);
|
||||||
|
result.setResult(map);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getResultFromDB(String dbName, String userName, Integer sampleId, PHDFile phd, Result result) {
|
public boolean getResultFromDB(String dbName, String userName, Integer sampleId, PHDFile phd, Result result) {
|
||||||
// 判断连接的数据库
|
// 判断连接的数据库
|
||||||
String T_analy = "";
|
String T_analy = "";
|
||||||
|
|
|
@ -136,9 +136,11 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initValue(String dbName, Integer sampleId, String analyst, String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request) {
|
public void initValue(String dbName, Integer sampleId, String analyst,
|
||||||
|
String sampleFileName, String gasFileName, String detFileName,
|
||||||
|
String qcFileName, String status, HttpServletRequest request) {
|
||||||
if (StringUtils.isNotBlank(dbName) && Objects.nonNull(sampleId)) {
|
if (StringUtils.isNotBlank(dbName) && Objects.nonNull(sampleId)) {
|
||||||
getDBSpectrumChart(dbName, sampleId, analyst, request);
|
getDBSpectrumChart(dbName, sampleId, analyst, status, request);
|
||||||
} else {
|
} else {
|
||||||
getFileSpectrumChart(sampleFileName, gasFileName, detFileName, qcFileName, request);
|
getFileSpectrumChart(sampleFileName, gasFileName, detFileName, qcFileName, request);
|
||||||
}
|
}
|
||||||
|
@ -381,6 +383,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<?> getDBSpectrumChart(String dbName, Integer sampleId, String analyst,
|
||||||
|
String status, HttpServletRequest request) {
|
||||||
|
if (StrUtil.equals(SampleStatus.FAIL.getValue(), status))
|
||||||
|
return this.getFileSpectrumChart(sampleId);
|
||||||
|
return this.getDBSpectrumChart(dbName, sampleId, analyst, request);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result getDBSpectrumChart(String dbName, Integer sampleId, String analyst, HttpServletRequest request) {
|
public Result getDBSpectrumChart(String dbName, Integer sampleId, String analyst, HttpServletRequest request) {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
|
@ -667,6 +677,124 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Result<?> getFileSpectrumChart(Integer sampleId) {
|
||||||
|
Result result = new Result();
|
||||||
|
//获取用户名
|
||||||
|
LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
|
||||||
|
String userName = sysUser.getUsername();
|
||||||
|
String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
|
||||||
|
String rootPath = spectrumPathProperties.getRootPath();
|
||||||
|
String saveFilePath = spectrumPathProperties.getSaveFilePath();
|
||||||
|
String prefix = rootPath + saveFilePath + StringPool.SLASH;
|
||||||
|
|
||||||
|
sampleFilePath = prefix + sampleFilePath;
|
||||||
|
if (!FileUtil.exist(sampleFilePath))
|
||||||
|
return Result.error("Sample file does not exist!");
|
||||||
|
String sampleFileName = FileUtil.getName(sampleFilePath);
|
||||||
|
|
||||||
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
|
Map<String, Object> sampleMap = new HashMap<>();
|
||||||
|
Map<String, Object> gasBgMap = new HashMap<>();
|
||||||
|
Map<String, Object> detBgMap = new HashMap<>();
|
||||||
|
Map<String, Object> qcMap = new HashMap<>();
|
||||||
|
//页面展示结果数组
|
||||||
|
List<GardsXeResultsSpectrum> xeResultsSpectrumList = new LinkedList<>();
|
||||||
|
//获取本地缓存信息
|
||||||
|
Cache<String, BetaDataFile> cache = betaCache.getBetaCache();
|
||||||
|
//判断是否有公用变量的缓存
|
||||||
|
BetaDataFile betaDataFile = cache.getIfPresent(sampleFileName + "-" + userName);
|
||||||
|
//如果没有缓存过公用变量
|
||||||
|
if (Objects.isNull(betaDataFile)) {
|
||||||
|
betaDataFile = new BetaDataFile();
|
||||||
|
EnergySpectrumStruct struct = getSourceData(sampleFilePath, "sample", betaDataFile);
|
||||||
|
if (Objects.nonNull(struct)) {
|
||||||
|
betaDataFile.setSampleStruct(struct);
|
||||||
|
betaDataFile.setSampleFilePathName(sampleFilePath);
|
||||||
|
betaDataFile.setSampleFileName(sampleFileName);
|
||||||
|
sampleMap = phdFileUtil.getSourceData(struct, null, null, "sample", betaDataFile);
|
||||||
|
sampleMap.put("fileName", betaDataFile.getSampleFileName());
|
||||||
|
resultMap.put("sample", sampleMap);
|
||||||
|
}
|
||||||
|
Map<String, String> paths = this.getPaths(sampleFilePath, prefix);
|
||||||
|
String gasFilePath = paths.get("gasFilePath");
|
||||||
|
String detFilePath = paths.get("detFilePath");
|
||||||
|
String qcFilePath = paths.get("qcFilePath");
|
||||||
|
if(FileUtil.exist(gasFilePath)){
|
||||||
|
struct = getSourceData(gasFilePath, "gas", betaDataFile);
|
||||||
|
if (Objects.nonNull(struct)) {
|
||||||
|
betaDataFile.setGasStruct(struct);
|
||||||
|
betaDataFile.setGasFilePathName(gasFilePath);
|
||||||
|
betaDataFile.setGasFileName(FileUtil.getName(gasFilePath));
|
||||||
|
gasBgMap = phdFileUtil.getSourceData(struct, null, null, "gas", betaDataFile);
|
||||||
|
gasBgMap.put("fileName", betaDataFile.getGasFileName());
|
||||||
|
resultMap.put("gasBg", gasBgMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(FileUtil.exist(detFilePath)){
|
||||||
|
struct = getSourceData(detFilePath, "det", betaDataFile);
|
||||||
|
if (Objects.nonNull(struct)) {
|
||||||
|
betaDataFile.setDetStruct(struct);
|
||||||
|
betaDataFile.setDetFilePathName(detFilePath);
|
||||||
|
betaDataFile.setDetFileName(FileUtil.getName(detFilePath));
|
||||||
|
detBgMap = phdFileUtil.getSourceData(struct, null, null, "det", betaDataFile);
|
||||||
|
detBgMap.put("fileName", betaDataFile.getDetFileName());
|
||||||
|
resultMap.put("detBg", detBgMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(FileUtil.exist(qcFilePath)){
|
||||||
|
struct = getSourceData(qcFilePath, "qc", betaDataFile);
|
||||||
|
if (Objects.nonNull(struct)) {
|
||||||
|
betaDataFile.setQcStruct(struct);
|
||||||
|
betaDataFile.setQcFilePathName(qcFilePath);
|
||||||
|
betaDataFile.setQcFileName(FileUtil.getName(qcFilePath));
|
||||||
|
qcMap = phdFileUtil.getSourceData(struct, null, null, "qc", betaDataFile);
|
||||||
|
qcMap.put("fileName", betaDataFile.getQcFileName());
|
||||||
|
resultMap.put("qc", qcMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
xeResultsSpectrumList = betaDataFile.getXeResultsSpectrumList();
|
||||||
|
sampleMap = loadData("sample", betaDataFile);
|
||||||
|
sampleMap.put("fileName", betaDataFile.getSampleFileName());
|
||||||
|
resultMap.put("sample",sampleMap);
|
||||||
|
gasBgMap = loadData("gas", betaDataFile);
|
||||||
|
gasBgMap.put("fileName", betaDataFile.getGasFileName());
|
||||||
|
resultMap.put("gasBg",gasBgMap);
|
||||||
|
detBgMap = loadData("det", betaDataFile);
|
||||||
|
detBgMap.put("fileName", betaDataFile.getDetFileName());
|
||||||
|
resultMap.put("detBg",detBgMap);
|
||||||
|
qcMap = loadData("qc", betaDataFile);
|
||||||
|
qcMap.put("fileName", betaDataFile.getQcFileName());
|
||||||
|
resultMap.put("qc",qcMap);
|
||||||
|
}
|
||||||
|
phdFileUtil.getLightColor(sampleMap,gasBgMap,detBgMap,qcMap);
|
||||||
|
//Xe
|
||||||
|
if (CollectionUtils.isNotEmpty(xeResultsSpectrumList)){
|
||||||
|
for (GardsXeResultsSpectrum xeData:xeResultsSpectrumList) {
|
||||||
|
Double conc = xeData.getConc();
|
||||||
|
Double mdc = xeData.getMdc();
|
||||||
|
if (conc < 0){
|
||||||
|
xeData.setColor("red");
|
||||||
|
} else if (0<conc && conc < mdc) {
|
||||||
|
xeData.setColor("#ffcc30");
|
||||||
|
} else if (conc > mdc) {
|
||||||
|
xeData.setColor("green");
|
||||||
|
}
|
||||||
|
xeData.setMdc(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getMdc()))));
|
||||||
|
xeData.setConc(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getConc()))));
|
||||||
|
xeData.setConcErr(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getConcErr()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resultMap.put("XeData", phdFileUtil.viewXeData(xeResultsSpectrumList));
|
||||||
|
resultMap.put("bProcessed", betaDataFile.isBProcessed());
|
||||||
|
resultMap.put("savedAnalysisResult", betaDataFile.isSaveAnalysisResult());
|
||||||
|
cache.put(betaDataFile.getSampleFileName()+"-"+userName, betaDataFile);
|
||||||
|
betaCache.setBetaCache(cache);
|
||||||
|
result.setSuccess(true);
|
||||||
|
result.setResult(resultMap);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result getFileSpectrumChart(String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request) {
|
public Result getFileSpectrumChart(String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request) {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
|
@ -805,6 +933,38 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
return struct;
|
return struct;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
获取SamplePHD对应的Gas、Det、Qc PHD文件全路径
|
||||||
|
*/
|
||||||
|
private Map<String, String> getPaths(String sampleFilePath, String prefix){
|
||||||
|
Map<String, String> result = new HashMap<>();
|
||||||
|
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(sampleFilePath);
|
||||||
|
if (ObjectUtil.isNull(struct)) return result;
|
||||||
|
String detectorCode = struct.getDetector_code();
|
||||||
|
String collectionStartDate = struct.getCollection_start_date();
|
||||||
|
String collectionStartTime = struct.getCollection_start_time();
|
||||||
|
String gasBkMeasurementId = struct.getGas_bk_measurement_id();
|
||||||
|
String detectorBkMeasurementId = struct.getDetector_bk_measurement_id();
|
||||||
|
// 获取Gas和Det文件路径
|
||||||
|
String detFilePath = spectrumAnalysisMapper.gasDetFilePath(gasBkMeasurementId);
|
||||||
|
String gasFilePath = spectrumAnalysisMapper.gasDetFilePath(detectorBkMeasurementId);
|
||||||
|
detFilePath = prefix + detFilePath;
|
||||||
|
gasFilePath = prefix + gasFilePath;
|
||||||
|
result.put("detFilePath", detFilePath);
|
||||||
|
result.put("gasFilePath", gasFilePath);
|
||||||
|
// 获取Qc文件路径
|
||||||
|
if (StrUtil.isBlank(collectionStartDate) || StrUtil.isBlank(collectionStartTime))
|
||||||
|
return result;
|
||||||
|
String collectionStart = collectionStartDate + StrUtil.SPACE + collectionStartTime;
|
||||||
|
String startDateTime = LocalDateTime
|
||||||
|
.parse(collectionStart, DateTimeFormatter.ofPattern(DateConstant.DATE_BIAS_TIME_MS))
|
||||||
|
.format(DateTimeFormatter.ofPattern(DateConstant.DATE_TIME));
|
||||||
|
String qcFilePath = spectrumAnalysisMapper.getQCFilePath(detectorCode, startDateTime);
|
||||||
|
qcFilePath = prefix + qcFilePath;
|
||||||
|
result.put("qcFilePath", qcFilePath);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//加载已有数据信息
|
//加载已有数据信息
|
||||||
private Map<String, Object> loadData(String type, BetaDataFile betaDataFile) {
|
private Map<String, Object> loadData(String type, BetaDataFile betaDataFile) {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user