Merge remote-tracking branch 'origin/station' into station

This commit is contained in:
nieziyan 2023-12-12 19:31:45 +08:00
commit f5f55479a3
11 changed files with 241 additions and 58 deletions

View File

@ -17,6 +17,7 @@ import org.springframework.stereotype.Component;
import java.io.*; import java.io.*;
import java.math.BigInteger; import java.math.BigInteger;
import java.time.DateTimeException;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime; import java.time.LocalTime;
@ -963,8 +964,17 @@ public class FileFtransitUtil {
int cal_s = (int) CalS; int cal_s = (int) CalS;
int cal_ms = (int) ((CalS - cal_s) * 10); int cal_ms = (int) ((CalS - cal_s) * 10);
String calibra_time = LocalDateTime.of(CalY, CalM, CalD, CalH, CalMin, cal_s, cal_ms) String calibra_time = "";
.format(DateTimeFormatter.ofPattern(DateConstant.DATE_BIAS_TIME_MS)); try {
LocalDateTime dateTime = LocalDateTime.of(CalY, CalM, CalD, CalH, CalMin, cal_s, cal_ms);
calibra_time = dateTime.format(DateTimeFormatter.ofPattern(DateConstant.DATE_BIAS_TIME_MS));
} catch (DateTimeException e) {
calibra_time = "";
}
// if (CalY > 0 && CalM > 0 && CalD >= 0 && CalH >= 0 && CalMin >= 0 && cal_s >= 0 && cal_ms >= 0) {
// calibra_time = LocalDateTime.of(CalY, CalM, CalD, CalH, CalMin, cal_s, cal_ms)
// .format(DateTimeFormatter.ofPattern(DateConstant.DATE_BIAS_TIME_MS));
// }
datas.setCalibra_time(calibra_time); datas.setCalibra_time(calibra_time);
// g_Energy g_Resolution // g_Energy g_Resolution
@ -1631,7 +1641,7 @@ public class FileFtransitUtil {
default: temp+="Jan"; break; default: temp+="Jan"; break;
} }
temp+=String.format("-%s", str.substring(2, 4)); // DD-MMM-YY temp+=String.format("-%s", str.substring(2, 4)); // DD-MMM-YY
if(str.substring(0, 2) == "20") { // DD-MMM-YY* if(str.substring(0, 2).equalsIgnoreCase("20")) { // DD-MMM-YY*
temp+="1"; temp+="1";
} else { } else {
temp+="0"; temp+="0";
@ -1639,6 +1649,7 @@ public class FileFtransitUtil {
} else { } else {
temp = StringPool.DASH; temp = StringPool.DASH;
temp+="Jan"; temp+="Jan";
temp+= StringPool.DASH;
temp+="0"; temp+="0";
} }
return temp; return temp;

View File

@ -12,4 +12,6 @@ public interface GardsNuclLibMapper extends BaseMapper<GardsNuclLib> {
List<GardsNuclLibDto> halfLife(List<String> nuclideNames); List<GardsNuclLibDto> halfLife(List<String> nuclideNames);
List<String> allName(); List<String> allName();
List<GardsNuclLib> getNucliLib();
} }

View File

@ -17,7 +17,13 @@
</if> </if>
</where> </where>
</select> </select>
<select id="allName" resultType="java.lang.String"> <select id="allName" resultType="java.lang.String">
SELECT NAME FROM CONFIGURATION.GARDS_NUCL_LIB SELECT NAME FROM CONFIGURATION.GARDS_NUCL_LIB
</select> </select>
<select id="getNucliLib" resultType="org.jeecg.modules.base.entity.configuration.GardsNuclLib">
select a.NAME, a.num_lines, a.halflife, a.halflife_err from CONFIGURATION.GARDS_NUCL_LIB a
</select>
</mapper> </mapper>

View File

@ -11,4 +11,6 @@ public interface IGardsNuclLibService extends IService<GardsNuclLib> {
Map<String,Double> halfLife(List<String> nuclideNames); Map<String,Double> halfLife(List<String> nuclideNames);
List<String> allName(); List<String> allName();
void getNucliLib();
} }

View File

@ -5,22 +5,29 @@ import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.base.dto.GardsNuclLibDto; import org.jeecg.modules.base.dto.GardsNuclLibDto;
import org.jeecg.modules.base.entity.configuration.GardsNuclLib; import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
import org.jeecg.modules.mapper.GardsNuclLibMapper; import org.jeecg.modules.mapper.GardsNuclLibMapper;
import org.jeecg.modules.service.IGardsNuclLibService; import org.jeecg.modules.service.IGardsNuclLibService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
@DS("ora") @DS("ora")
public class GardsNuclLibServiceImpl extends ServiceImpl<GardsNuclLibMapper, GardsNuclLib> implements IGardsNuclLibService { public class GardsNuclLibServiceImpl extends ServiceImpl<GardsNuclLibMapper, GardsNuclLib> implements IGardsNuclLibService {
@Autowired
private RedisUtil redisUtil;
@Override @Override
public Map<String, Double> halfLife(List<String> nuclideNames) { public Map<String, Double> halfLife(List<String> nuclideNames) {
Map<String, Double> halfLife = MapUtil.newHashMap(); Map<String, Double> halfLife = MapUtil.newHashMap();
@ -38,4 +45,11 @@ public class GardsNuclLibServiceImpl extends ServiceImpl<GardsNuclLibMapper, Gar
return baseMapper.allName().stream().filter(StrUtil::isNotBlank) return baseMapper.allName().stream().filter(StrUtil::isNotBlank)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@Override
public void getNucliLib() {
List<GardsNuclLib> gardsNuclLibs = this.baseMapper.getNucliLib();
Map<String, GardsNuclLib> nuclLibMap = gardsNuclLibs.stream().collect(Collectors.toMap(GardsNuclLib::getName, Function.identity()));
redisUtil.set("nuclLibs", nuclLibMap);
}
} }

View File

@ -2,18 +2,22 @@ package org.jeecg.modules.controller;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.base.bizVo.GammaRLR; import org.jeecg.modules.base.bizVo.GammaRLR;
import org.jeecg.modules.entity.GardsSampleDataSpectrum;
import org.jeecg.modules.entity.vo.*; import org.jeecg.modules.entity.vo.*;
import org.jeecg.modules.feignclient.SystemClient; import org.jeecg.modules.feignclient.SystemClient;
import org.jeecg.modules.service.IGammaService; import org.jeecg.modules.service.IGammaService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List; import java.util.List;
@RestController @RestController
@ -53,6 +57,12 @@ public class GammaController {
gammaService.delPHDCache(fileName); gammaService.delPHDCache(fileName);
} }
@GetMapping("loadSampleData")
public Result loadSampleData(QueryRequest queryRequest, GardsSampleDataSpectrum gardsSampleData, String[] menuTypes, boolean AllUsers, boolean CollectStopB, boolean AcqStartB,
@DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate, @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate, HttpServletRequest request) {
return gammaService.loadSampleData(queryRequest, gardsSampleData, menuTypes, AllUsers, CollectStopB, AcqStartB, startDate, endDate, request);
}
@GetMapping("CompareDB") @GetMapping("CompareDB")
public Result CompareDB(String fileName, Integer sampleId, HttpServletRequest request) { public Result CompareDB(String fileName, Integer sampleId, HttpServletRequest request) {
return gammaService.CompareDB(fileName, sampleId, request); return gammaService.CompareDB(fileName, sampleId, request);

View File

@ -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> 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> 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); SpectrumFileRecord getDBSpectrumFilePath(String dbName, Integer sampleId, Integer analysisID);
List<GardsXeResultsSpectrum> getXeDataList(Integer sampleId); List<GardsXeResultsSpectrum> getXeDataList(Integer sampleId);

View File

@ -106,6 +106,78 @@
</if> </if>
</select> </select>
<select id="loadSampleData" 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,
c.status status,
c.input_file_name inputFileName
from
CONFIGURATION.GARDS_DETECTORS a,
CONFIGURATION.GARDS_STATIONS b,
ORIGINAL.GARDS_SAMPLE_DATA c
<where>
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=",">
#{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="getXeDataList" resultType="org.jeecg.modules.entity.GardsXeResultsSpectrum"> <select id="getXeDataList" resultType="org.jeecg.modules.entity.GardsXeResultsSpectrum">
SELECT SAMPLE_ID,NUCLIDE_NAME,CONC,CONC_ERR,MDC,LC FROM RNAUTO.GARDS_XE_RESULTS where SAMPLE_ID = #{sampleId} SELECT SAMPLE_ID,NUCLIDE_NAME,CONC,CONC_ERR,MDC,LC FROM RNAUTO.GARDS_XE_RESULTS where SAMPLE_ID = #{sampleId}
</select> </select>

View File

@ -1,13 +1,16 @@
package org.jeecg.modules.service; package org.jeecg.modules.service;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.base.bizVo.GammaRLR; import org.jeecg.modules.base.bizVo.GammaRLR;
import org.jeecg.modules.entity.GardsSampleDataSpectrum;
import org.jeecg.modules.entity.vo.*; import org.jeecg.modules.entity.vo.*;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List; import java.util.List;
public interface IGammaService{ public interface IGammaService{
@ -22,6 +25,8 @@ public interface IGammaService{
void delPHDCache(String fileName); void delPHDCache(String fileName);
Result loadSampleData(QueryRequest queryRequest, GardsSampleDataSpectrum gardsSampleData, String[] menuTypes, boolean AllUsers, boolean CollectStopB, boolean AcqStartB, Date startDate, Date endDate, HttpServletRequest request);
Result CompareDB(String fileName, Integer sampleId, HttpServletRequest request); Result CompareDB(String fileName, Integer sampleId, HttpServletRequest request);
Result Compare(String fileName, String compareFileName, HttpServletRequest request); Result Compare(String fileName, String compareFileName, HttpServletRequest request);

View File

@ -10,8 +10,10 @@ import cn.hutool.core.util.ReUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
@ -21,6 +23,7 @@ import org.apache.commons.lang3.StringUtils;
import com.google.common.cache.Cache; import com.google.common.cache.Cache;
import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPClient;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.cache.LocalCache; import org.jeecg.common.cache.LocalCache;
import org.jeecg.common.constant.DateConstant; import org.jeecg.common.constant.DateConstant;
@ -142,6 +145,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
private IGardsAnalySettingSpectrumService analySettingSpectrumService; private IGardsAnalySettingSpectrumService analySettingSpectrumService;
@Autowired @Autowired
private RedisStreamUtil redisStreamUtil; private RedisStreamUtil redisStreamUtil;
@Autowired
private ISysDictSpectrumService sysDictService;
@Override @Override
public Result initValue(Integer sampleId, String dbName, String analyst, String samfileName, HttpServletRequest request) { public Result initValue(Integer sampleId, String dbName, String analyst, String samfileName, HttpServletRequest request) {
@ -899,6 +904,46 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
localCache.deletePHDCache(key); localCache.deletePHDCache(key);
} }
@Override
public Result loadSampleData(QueryRequest queryRequest, GardsSampleDataSpectrum gardsSampleData, String[] menuTypes, boolean AllUsers, boolean CollectStopB, boolean AcqStartB, Date startDate, Date endDate, HttpServletRequest request) {
Result result = new Result();
if (Objects.isNull(startDate)){
result.error500("The start time cannot be empty");
return result;
}
String startTime = DateUtils.formatDate(startDate, "yyyy-MM-dd") + " 00:00:00";
if (Objects.isNull(endDate)) {
result.error500("The end time cannot be empty");
return result;
}
String endTime = DateUtils.formatDate(endDate, "yyyy-MM-dd") + " 23:59:59";
List<String> menuTypeList = Arrays.asList(menuTypes);
if (CollectionUtils.isEmpty(menuTypeList)){
result.error500("The spectrum type cannot be empty");
return result;
}
List<String> stationTypes = sysDictService.findStationType(menuTypeList);
if (CollectionUtils.isEmpty(stationTypes)) {
result.error500("Please add the station type corresponding to the current system type in the data dictionary");
return result;
}
List<String> userStations = new LinkedList<>();
if (Objects.nonNull(AllUsers) && !AllUsers){
String userName = JwtUtil.getUserNameByToken(request);
if (StringUtils.isBlank(userName)){
result.error500("Description Failed to obtain the current login user information");
return result;
}
userStations = userTaskUtil.findUserStation(userName);
}
//声明分页page
Page<GardsSampleDataSpectrum> page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
Page<GardsSampleDataSpectrum> sampleDataPage = spectrumAnalysisMapper.loadSampleData(page, gardsSampleData, stationTypes, CollectStopB, AcqStartB, startTime, endTime, userStations, AllUsers, queryRequest.getField(), queryRequest.getOrder());
result.setSuccess(true);
result.setResult(sampleDataPage);
return result;
}
@Override @Override
public Result CompareDB(String fileName, Integer sampleId, HttpServletRequest request) { public Result CompareDB(String fileName, Integer sampleId, HttpServletRequest request) {
Result result = new Result(); Result result = new Result();
@ -932,6 +977,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
result.setResult(chartDataList); result.setResult(chartDataList);
} }
compareFile.delete(); compareFile.delete();
} else {
result.error500("比较文件不存在!");
return result;
} }
return result; return result;
} }
@ -1017,6 +1065,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
result.setResult(stripMap); result.setResult(stripMap);
} }
stripFile.delete(); stripFile.delete();
} else {
result.error500("比较文件不存在!");
return result;
} }
return result; return result;
} }
@ -2060,7 +2111,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (CollectionUtils.isNotEmpty(nuclideList)) { if (CollectionUtils.isNotEmpty(nuclideList)) {
map.put("list", nuclideList); map.put("list", nuclideList);
String name = nuclideList.get(0); String name = nuclideList.get(0);
InitTable(name, map, phd, colorMap); InitTable(name, map, phd, colorMap, nuclideMap);
} else { } else {
map.put("list", nuclideList); map.put("list", nuclideList);
map.put("chart", new LinkedList<>()); map.put("chart", new LinkedList<>());
@ -2085,43 +2136,43 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
// return nuclideList; // return nuclideList;
// } // }
public void InitTable(String name, Map<String, Object> map, PHDFile phd, Map<String, String> colorMap) { public void InitTable(String name, Map<String, Object> map, PHDFile phd, Map<String, String> colorMap, Map<String, NuclideLines> nuclideMap) {
InitNuclideInfo(name, map); InitNuclideInfo(name, map);
long span = phd.getSpec().getG_energy_span(); long span = phd.getSpec().getG_energy_span();
List<GardsNuclLinesLib> nuclideTableList = spectrumAnalysisMapper.getNuclideTable(name, span);
//判断缓存的核素信息是否为空
if (CollectionUtils.isNotEmpty(nuclideMap)) {
//获取当前核素名称的核素集合
NuclideLines lines = nuclideMap.get(name);
List<GardsNuclLinesLib> nuclideTableList = new LinkedList<>();//spectrumAnalysisMapper.getNuclideTable(name, span);
for (int i=0; i<lines.fullNames.size(); i++) {
Double energy = lines.venergy.get(i);
if (Objects.nonNull(energy)) {
if (lines.venergy.get(i) >= 30 && lines.venergy.get(i) <= span) {
GardsNuclLinesLib nuclLinesLib = new GardsNuclLinesLib();
nuclLinesLib.setFullName(lines.fullNames.get(i));
nuclLinesLib.setEnergy(Double.valueOf(String.format("%.3f", lines.venergy.get(i))));
nuclLinesLib.setEnergyUncert(Objects.nonNull(lines.vuncertE.get(i))?Double.valueOf(String.format("%.3f", lines.vuncertE.get(i))):0.0);
nuclLinesLib.setYield(Objects.nonNull(lines.vyield.get(i))?Double.valueOf(String.format("%.3f", lines.vyield.get(i)*100)):0.0);
nuclLinesLib.setYieldUncert(Objects.nonNull(lines.vuncertY.get(i))?Double.valueOf(String.format("%.3f", lines.vuncertY.get(i))):0.0);
nuclideTableList.add(nuclLinesLib);
}
}
}
if (CollectionUtils.isNotEmpty(nuclideTableList)) { if (CollectionUtils.isNotEmpty(nuclideTableList)) {
nuclideTableList.stream().forEach(item-> { nuclideTableList = nuclideTableList.stream().sorted(Comparator.comparing(GardsNuclLinesLib::getYield)).collect(Collectors.toList());
if (Objects.nonNull(item.getEnergy())) {
item.setEnergy(Double.valueOf(String.format("%.3f", item.getEnergy())));
} else {
item.setEnergy(Double.valueOf(String.format("%.3f", 0.0)));
}
if (Objects.nonNull(item.getEnergyUncert())) {
item.setEnergyUncert(Double.valueOf(String.format("%.3f", item.getEnergyUncert())));
} else {
item.setEnergyUncert(Double.valueOf(String.format("%.3f", 0.0)));
}
if (Objects.nonNull(item.getYield())) {
item.setYield(Double.valueOf(String.format("%.3f", item.getYield())));
} else {
item.setYield(Double.valueOf(String.format("%.3f", 0.0)));
}
if (Objects.nonNull(item.getYieldUncert())) {
item.setYieldUncert(Double.valueOf(String.format("%.3f", item.getYieldUncert())));
} else {
item.setYieldUncert(Double.valueOf(String.format("%.3f", 0.0)));
}
});
nuclideTableList.stream().max(Comparator.comparing(GardsNuclLinesLib::getYield)).get().setKeyFlag(1); nuclideTableList.stream().max(Comparator.comparing(GardsNuclLinesLib::getYield)).get().setKeyFlag(1);
map.put("table", nuclideTableList); map.put("table", nuclideTableList);
gammaFileUtil.InitChart(nuclideTableList, phd, map, colorMap); gammaFileUtil.InitChart(nuclideTableList, phd, map, colorMap);
} }
} }
}
public void InitNuclideInfo(String name, Map<String, Object> map) { public void InitNuclideInfo(String name, Map<String, Object> map) {
map.put("name", name); map.put("name", name);
Map<String, GardsNuclLib> nuclLibs = (Map<String, GardsNuclLib>) redisUtil.get("nuclLibs");
GardsNuclLib nuclideInfo = spectrumAnalysisMapper.getNuclideInfo(name); if (CollectionUtils.isNotEmpty(nuclLibs)) {
GardsNuclLib nuclideInfo = nuclLibs.get(name);
if (Objects.nonNull(nuclideInfo)) { if (Objects.nonNull(nuclideInfo)) {
map.put("lines", nuclideInfo.getNumLines()); map.put("lines", nuclideInfo.getNumLines());
if (Objects.isNull(nuclideInfo.getHalflife())) { if (Objects.isNull(nuclideInfo.getHalflife())) {
@ -2149,6 +2200,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
} }
} }
} }
}
@Override @Override
public Result changeNuclide(Integer sampleId, String fileName, String nuclideName, HttpServletRequest request) { public Result changeNuclide(Integer sampleId, String fileName, String nuclideName, HttpServletRequest request) {
@ -2162,7 +2214,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
return result; return result;
} }
Map<String, String> colorMap = sysUserColorService.initColor(userName); Map<String, String> colorMap = sysUserColorService.initColor(userName);
InitTable(nuclideName, map, phd, colorMap); //获取缓存的核素信息
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());
InitTable(nuclideName, map, phd, colorMap, nuclideMap);
result.setSuccess(true); result.setSuccess(true);
result.setResult(map); result.setResult(map);
return result; return result;
@ -2210,7 +2264,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (CollectionUtils.isNotEmpty(nuclideList)) { if (CollectionUtils.isNotEmpty(nuclideList)) {
map.put("list", nuclideList); map.put("list", nuclideList);
String name = nuclideList.get(0); String name = nuclideList.get(0);
InitTable(name, map, phd, colorMap); InitTable(name, map, phd, colorMap, nuclideMap);
} else { } else {
map.put("list", nuclideList); map.put("list", nuclideList);
map.put("chart", new LinkedList<>()); map.put("chart", new LinkedList<>());

View File

@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.base.BaseMap; import org.jeecg.common.base.BaseMap;
import org.jeecg.common.constant.GlobalConstants; import org.jeecg.common.constant.GlobalConstants;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.service.IGardsNuclLibService;
import org.jeecg.modules.system.service.IGardsDetectorsService; import org.jeecg.modules.system.service.IGardsDetectorsService;
import org.jeecg.modules.system.service.IGardsNuclearfacilityService; import org.jeecg.modules.system.service.IGardsNuclearfacilityService;
import org.jeecg.modules.system.service.IGardsStationsService; import org.jeecg.modules.system.service.IGardsStationsService;
@ -42,6 +43,8 @@ public class JeecgSystemCloudApplication extends SpringBootServletInitializer im
private IGardsDetectorsService gardsDetectorsService; private IGardsDetectorsService gardsDetectorsService;
@Autowired @Autowired
private IGardsNuclearfacilityService gardsNuclearfacilityService; private IGardsNuclearfacilityService gardsNuclearfacilityService;
@Autowired
private IGardsNuclLibService gardsNuclLibService;
@Override @Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
@ -81,5 +84,7 @@ public class JeecgSystemCloudApplication extends SpringBootServletInitializer im
gardsDetectorsService.findDetectors(); gardsDetectorsService.findDetectors();
//触发缓存一下核设施信息 //触发缓存一下核设施信息
gardsNuclearfacilityService.findNuclearFacility(); gardsNuclearfacilityService.findNuclearFacility();
//触发缓存一下核素信息
gardsNuclLibService.getNucliLib();
} }
} }