Compare commits
3 Commits
86968e383b
...
939ffb1f6c
Author | SHA1 | Date | |
---|---|---|---|
![]() |
939ffb1f6c | ||
![]() |
6b16aa6a40 | ||
![]() |
41245f0546 |
|
@ -29,14 +29,18 @@ public class GammaController {
|
|||
|
||||
@GetMapping("initValue")
|
||||
@ApiOperation(value = "初始化gamma数据", notes = "初始化gamma数据")
|
||||
public void initValue(Integer sampleId, String dbName, String analyst, String fileName, HttpServletRequest request) {
|
||||
gammaService.initValue(sampleId, dbName, analyst, fileName, request);
|
||||
public void initValue(Integer sampleId, String dbName,
|
||||
String analyst, String fileName,
|
||||
String status, HttpServletRequest request) {
|
||||
gammaService.initValue(sampleId, dbName, analyst, fileName, status, request);
|
||||
}
|
||||
|
||||
@GetMapping("gammaByDB")
|
||||
@ApiOperation(value = "gamma页面loadFromDB加载数据", notes = "gamma页面loadFromDB加载数据")
|
||||
public Result gammaByDB(Integer sampleId, String dbName, String analyst, HttpServletRequest request){
|
||||
return gammaService.gammaByDB(dbName, sampleId, analyst, request);
|
||||
public Result gammaByDB(Integer sampleId, String dbName,
|
||||
String analyst, String status,
|
||||
HttpServletRequest request){
|
||||
return gammaService.gammaByDB(dbName, sampleId, analyst, status, request);
|
||||
}
|
||||
|
||||
@GetMapping("gammaByDBApp")
|
||||
|
|
|
@ -26,8 +26,12 @@ public class SpectrumAnalysesController {
|
|||
|
||||
@GetMapping("initValue")
|
||||
@ApiOperation(value = "初始化数据", notes = "初始化数据")
|
||||
public void initValue(String dbName, Integer sampleId, String analyst, String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request) {
|
||||
spectrumAnalysisService.initValue(dbName, sampleId, analyst, sampleFileName, gasFileName, detFileName, qcFileName, request);
|
||||
public void initValue(String dbName, Integer sampleId,
|
||||
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")
|
||||
|
@ -51,8 +55,9 @@ public class SpectrumAnalysesController {
|
|||
|
||||
@GetMapping("getDBSpectrumChart")
|
||||
@ApiOperation(value = "查询折线图相关信息接口", notes = "查询折线图相关信息接口")
|
||||
public Result getDBSpectrumChart(String dbName, Integer sampleId, String analyst, HttpServletRequest request) {
|
||||
return spectrumAnalysisService.getDBSpectrumChart(dbName, sampleId, analyst, request);
|
||||
public Result getDBSpectrumChart(String dbName, Integer sampleId, String analyst,
|
||||
String status, HttpServletRequest request) {
|
||||
return spectrumAnalysisService.getDBSpectrumChart(dbName, sampleId, analyst, status, request);
|
||||
}
|
||||
|
||||
@GetMapping("getDBSpectrumChartApp")
|
||||
|
|
|
@ -22,6 +22,8 @@ public interface SpectrumAnalysisMapper {
|
|||
|
||||
Page<GardsSampleDataSpectrum> getDBSpectrumList(IPage<GardsSampleDataSpectrum> page, GardsSampleDataSpectrum gardsSampleData, String dbName, List<String> stationTypes, boolean CollectStopB, boolean AcqStartB, String startTime, String endTime, List<String> userStations, boolean AllUsers, String orderField, String orderType);
|
||||
|
||||
Page<GardsSampleDataSpectrum> getDBSpectrumListInner(IPage<GardsSampleDataSpectrum> page, GardsSampleDataSpectrum gardsSampleData, String dbName, List<String> stationTypes, boolean CollectStopB, boolean AcqStartB, String startTime, String endTime, List<String> userStations, boolean AllUsers, String orderField, String orderType);
|
||||
|
||||
Page<GardsSampleDataSpectrum> loadSampleData(IPage<GardsSampleDataSpectrum> page, GardsSampleDataSpectrum gardsSampleData, List<String> stationTypes, boolean CollectStopB, boolean AcqStartB, String startTime, String endTime, List<String> userStations, boolean AllUsers, String orderField, String orderType);
|
||||
|
||||
SpectrumFileRecord getDBSpectrumFilePath(String dbName, Integer sampleId, Integer analysisID);
|
||||
|
@ -30,6 +32,8 @@ public interface SpectrumAnalysisMapper {
|
|||
|
||||
String getQCFilePath(String siteDetCode, String collectStartStr);
|
||||
|
||||
String gasDetFilePath(String measurementId);
|
||||
|
||||
CommentData viewComment(@Param(value = "sampleId") Integer sampleId);
|
||||
|
||||
String getSampleFilePath(@Param(value = "sampleId") Integer sampleId);
|
||||
|
|
|
@ -46,16 +46,85 @@
|
|||
d.analyst analyst,
|
||||
c.status status,
|
||||
c.input_file_name inputFileName
|
||||
from
|
||||
CONFIGURATION.GARDS_DETECTORS a,
|
||||
CONFIGURATION.GARDS_STATIONS b,
|
||||
ORIGINAL.GARDS_SAMPLE_DATA c,
|
||||
${dbName} d
|
||||
FROM
|
||||
ORIGINAL.GARDS_SAMPLE_DATA c
|
||||
LEFT JOIN ${dbName} d ON c.sample_id = d.sample_id
|
||||
INNER JOIN CONFIGURATION.GARDS_DETECTORS a ON c.detector_id = a.detector_id
|
||||
INNER JOIN CONFIGURATION.GARDS_STATIONS b ON c.station_id = b.station_id
|
||||
<where>
|
||||
c.sample_id = d.sample_id
|
||||
and c.detector_id = a.detector_id
|
||||
and c.station_id = b.station_id
|
||||
and b.type in
|
||||
b.type in
|
||||
<foreach collection="stationTypes" item="stationType" open="(" close=")" separator=",">
|
||||
#{stationType}
|
||||
</foreach>
|
||||
<if test=" gardsSampleData.sampleId != null ">
|
||||
and c.sample_id = #{gardsSampleData.sampleId}
|
||||
</if>
|
||||
<if test=" gardsSampleData.stationName != null and gardsSampleData.stationName != '' ">
|
||||
and b.station_code = #{gardsSampleData.stationName}
|
||||
</if>
|
||||
<if test=" gardsSampleData.detectorsName != null and gardsSampleData.detectorsName != '' ">
|
||||
and a.detector_code = #{gardsSampleData.detectorsName}
|
||||
</if>
|
||||
<if test=" gardsSampleData.sampleType != null and gardsSampleData.sampleType != '' ">
|
||||
and c.sample_type = #{gardsSampleData.sampleType}
|
||||
</if>
|
||||
<if test=" gardsSampleData.dataType != null and gardsSampleData.dataType != '' ">
|
||||
and c.data_type = #{gardsSampleData.dataType}
|
||||
</if>
|
||||
<if test=" gardsSampleData.spectralQualifie != null and gardsSampleData.spectralQualifie != '' ">
|
||||
and c.spectral_qualifie = #{gardsSampleData.spectralQualifie}
|
||||
</if>
|
||||
<if test=" gardsSampleData.status != null and gardsSampleData.status != '' ">
|
||||
and c.status = #{gardsSampleData.status}
|
||||
</if>
|
||||
<if test=" CollectStopB == true ">
|
||||
and c.collect_stop between TO_DATE(#{startTime}, 'yyyy-mm-dd hh24:mi:ss') and TO_DATE(#{endTime}, 'yyyy-mm-dd hh24:mi:ss')
|
||||
</if>
|
||||
<if test=" AcqStartB == true ">
|
||||
and c.acquisition_start between TO_DATE(#{startTime}, 'yyyy-mm-dd hh24:mi:ss') and TO_DATE(#{endTime}, 'yyyy-mm-dd hh24:mi:ss')
|
||||
</if>
|
||||
<if test="AllUsers == false">
|
||||
<if test=" userStations.size == 0 and userStations != null ">
|
||||
and c.station_id in ('')
|
||||
</if>
|
||||
<if test=" userStations.size > 0 and userStations != null ">
|
||||
and c.station_id in
|
||||
<foreach collection="userStations" item="userStation" open="(" close=")" separator=",">
|
||||
#{userStation}
|
||||
</foreach>
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
<if test=" orderField != 'createTime' and orderField != '' and orderField != null and orderType != '' and orderType != null ">
|
||||
ORDER BY ${orderField} ${orderType}
|
||||
</if>
|
||||
<if test=" orderField == 'createTime' or orderField == '' or orderField == null or orderType == '' or orderType == null ">
|
||||
ORDER BY collectStop DESC
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getDBSpectrumListInner" resultType="org.jeecg.modules.entity.GardsSampleDataSpectrum">
|
||||
select c.sample_id sampleId,
|
||||
b.station_code stationName,
|
||||
a.detector_code detectorsName,
|
||||
c.sample_type sampleType,
|
||||
c.data_type dataType,
|
||||
c.spectral_qualifie spectralQualifie,
|
||||
c.collect_stop collectStop,
|
||||
c.acquisition_start acquisitionStart,
|
||||
c.acquisition_real_sec acquisitionRealSec,
|
||||
c.acquisition_live_sec acquisitionLiveSec,
|
||||
d.IDANALYSIS analysitId,
|
||||
d.analyst analyst,
|
||||
c.status status,
|
||||
c.input_file_name inputFileName
|
||||
FROM
|
||||
ORIGINAL.GARDS_SAMPLE_DATA c
|
||||
INNER JOIN ${dbName} d ON c.sample_id = d.sample_id
|
||||
INNER JOIN CONFIGURATION.GARDS_DETECTORS a ON c.detector_id = a.detector_id
|
||||
INNER JOIN CONFIGURATION.GARDS_STATIONS b ON c.station_id = b.station_id
|
||||
<where>
|
||||
b.type in
|
||||
<foreach collection="stationTypes" item="stationType" open="(" close=")" separator=",">
|
||||
#{stationType}
|
||||
</foreach>
|
||||
|
@ -214,6 +283,16 @@
|
|||
</where>
|
||||
</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 A.ANALYST, A.COMMENTS FROM RNMAN.GARDS_ANALYSES A WHERE A.SAMPLE_ID= #{sampleId}
|
||||
</select>
|
||||
|
@ -1104,5 +1183,4 @@
|
|||
<select id="findNuclidesAnalysis" resultType="java.lang.String">
|
||||
select NAME from CONFIGURATION.GARDS_NUCL_LIB
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -15,10 +15,13 @@ import java.util.List;
|
|||
|
||||
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, String status, HttpServletRequest request);
|
||||
|
||||
Result gammaByFile(String fileName, HttpServletRequest request);
|
||||
|
||||
void delPHDCache(String fileName);
|
||||
|
|
|
@ -14,7 +14,9 @@ import java.util.List;
|
|||
|
||||
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);
|
||||
|
||||
|
@ -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,
|
||||
String status, HttpServletRequest request);
|
||||
|
||||
Result getFileSpectrumChart(String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request);
|
||||
|
||||
void deleteSpectrumCacheData(String sampleFileName, HttpServletRequest request);
|
||||
|
|
|
@ -80,6 +80,7 @@ import java.util.*;
|
|||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.aspectj.weaver.tools.cache.SimpleCacheFactory.path;
|
||||
import static org.jeecg.modules.base.enums.ExportTemplate.*;
|
||||
|
||||
@Service(value = "gammaService")
|
||||
|
@ -156,16 +157,27 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
private IDataService dataService;
|
||||
|
||||
@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)) {
|
||||
gammaByDB(dbName, sampleId, analyst, request);
|
||||
gammaByDB(dbName, sampleId, analyst, status, request);
|
||||
} else {
|
||||
gammaByFile(samfileName, request);
|
||||
}
|
||||
}
|
||||
|
||||
@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();
|
||||
// 通过token获取用户名
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
|
@ -284,6 +296,89 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
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) {
|
||||
// 判断连接的数据库
|
||||
String T_analy = "";
|
||||
|
@ -4747,10 +4842,13 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
idAnalysis = spectrumAnalysisMapper.getIdAnalysisByIdAnalyst(phd.getId_sample(), userName);
|
||||
// 写入 RNMAN数据库
|
||||
// 获取phd文件中的totalcmt信息 存入数据库
|
||||
String comments = phd.getTotalCmt().trim();
|
||||
// 如果comment的数据长度大于1024 则截取前1024部分
|
||||
if (comments.length() > 1024) {
|
||||
comments = comments.substring(0, 1024);
|
||||
String comments = null;
|
||||
if (StrUtil.isNotBlank(phd.getTotalCmt())){
|
||||
comments = phd.getTotalCmt().trim();
|
||||
// 如果comment的数据长度大于1024 则截取前1024部分
|
||||
if (comments.length() > 1024) {
|
||||
comments = comments.substring(0, 1024);
|
||||
}
|
||||
}
|
||||
// 判断idAnalysis是否为空
|
||||
if (StringUtils.isBlank(idAnalysis)) {
|
||||
|
|
|
@ -136,9 +136,11 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
|
||||
|
||||
@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)) {
|
||||
getDBSpectrumChart(dbName, sampleId, analyst, request);
|
||||
getDBSpectrumChart(dbName, sampleId, analyst, status, request);
|
||||
} else {
|
||||
getFileSpectrumChart(sampleFileName, gasFileName, detFileName, qcFileName, request);
|
||||
}
|
||||
|
@ -289,7 +291,12 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
}
|
||||
//声明分页page
|
||||
Page<GardsSampleDataSpectrum> page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
|
||||
Page<GardsSampleDataSpectrum> sampleDataPage = spectrumAnalysisMapper.getDBSpectrumList(page, gardsSampleData, dbName, stationTypes, CollectStopB, AcqStartB, startTime, endTime, userStations, AllUsers, queryRequest.getField(), queryRequest.getOrder());
|
||||
String status = gardsSampleData.getStatus();
|
||||
Page<GardsSampleDataSpectrum> sampleDataPage;
|
||||
if (StrUtil.equals(SampleStatus.FAIL.getValue(), status))
|
||||
sampleDataPage = spectrumAnalysisMapper.getDBSpectrumList(page, gardsSampleData, dbName, stationTypes, CollectStopB, AcqStartB, startTime, endTime, userStations, AllUsers, queryRequest.getField(), queryRequest.getOrder());
|
||||
else
|
||||
sampleDataPage = spectrumAnalysisMapper.getDBSpectrumListInner(page, gardsSampleData, dbName, stationTypes, CollectStopB, AcqStartB, startTime, endTime, userStations, AllUsers, queryRequest.getField(), queryRequest.getOrder());
|
||||
sampleDataPage.getRecords().stream().forEach(item->{item.setDbName(tempDBName);});
|
||||
result.setSuccess(true);
|
||||
result.setResult(sampleDataPage);
|
||||
|
@ -381,6 +388,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
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
|
||||
public Result getDBSpectrumChart(String dbName, Integer sampleId, String analyst, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
|
@ -667,6 +682,124 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
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
|
||||
public Result getFileSpectrumChart(String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
|
@ -805,6 +938,38 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
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(detectorBkMeasurementId);
|
||||
String gasFilePath = spectrumAnalysisMapper.gasDetFilePath(gasBkMeasurementId);
|
||||
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) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
|
Loading…
Reference in New Issue
Block a user