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

This commit is contained in:
nieziyan 2024-01-11 17:15:38 +08:00
commit d02bd8127d
9 changed files with 90 additions and 55 deletions

View File

@ -40,4 +40,6 @@ public interface RedisConstant {
String QIYE_EMAIL_TOKEN = "Token:QiyeEmail"; // 网易企业邮箱Token
String PREFIX_TEMPLATE = "Template:"; // 消息模板
String UNDEAL_FILE = "Undeal:";
}

View File

@ -2,6 +2,7 @@ package org.jeecg.modules;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.constant.RedisConstant;
import org.jeecg.common.properties.TaskProperties;
import org.jeecg.modules.enums.SpectrumSource;
import org.jeecg.modules.service.BlockConstant;
@ -128,9 +129,9 @@ public class UndealHandleManager{
long createMillis = currentMillis;
//判断redis是否包含文件名称 key
if (spectrumServiceQuotes.getRedisStreamUtil().hasKey(spectrumFile.getName())) {
createMillis = (long) spectrumServiceQuotes.getRedisStreamUtil().get(spectrumFile.getName());
createMillis = (long) spectrumServiceQuotes.getRedisStreamUtil().get(RedisConstant.UNDEAL_FILE + spectrumFile.getName());
} else {
spectrumServiceQuotes.getRedisStreamUtil().set(spectrumFile.getName(), currentMillis);
spectrumServiceQuotes.getRedisStreamUtil().set(RedisConstant.UNDEAL_FILE + spectrumFile.getName(), currentMillis);
}
try {
//解析文件
@ -148,7 +149,7 @@ public class UndealHandleManager{
this.taskLatch.countDown();
//满足undeal文件处理周期时长会删除源文件
if ((currentMillis - createMillis) >= taskProperties.getUndealFileTimeOut()) {
spectrumServiceQuotes.getRedisStreamUtil().del(spectrumFile.getName());
spectrumServiceQuotes.getRedisStreamUtil().del(RedisConstant.UNDEAL_FILE + spectrumFile.getName());
spectrumFile.delete();
}
}

View File

@ -21,6 +21,7 @@ import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
import org.jeecg.modules.base.enums.CalName;
import org.jeecg.modules.base.enums.CalType;
import org.jeecg.modules.base.enums.MiddleDataType;
import org.jeecg.modules.base.enums.SystemType;
import org.jeecg.modules.entity.vo.*;
import org.jeecg.modules.native_jni.AnalysisProcess;
import org.jeecg.modules.native_jni.CalValuesHandler;
@ -2670,7 +2671,11 @@ public class GammaFileUtil extends AbstractLogOrReport {
strBuffer.append(" "+middleData.analyses_type+" RADIONUCLIDE REPORT");
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(" (Noble Gas Version) ");
if (middleData.sample_Type.equals(SystemType.PARTICULATE.getType())) {
strBuffer.append(" (Particulates Version) ");
} else if (middleData.sample_Type.equals(SystemType.GAMMA.getType())) {
strBuffer.append(" (Noble Gas Version) ");
}
//换行
strBuffer.append(System.lineSeparator());
strBuffer.append(" Creation Date "+DateUtils.formatDate(new Date(), "yyyy/MM/dd-HH:mm:ss"));

View File

@ -18,10 +18,8 @@ public interface GardsNuclLibMapper extends BaseMapper<GardsNuclLib> {
List<GardsNuclLib> getNucliLib();
List<String> findNuclidesAnalysis();
List<HalfData> findNuclidesAnalysis();
List<NuclideLine> getNuclideLines(@Param("name") String name);
HalfData getOneHalf(@Param("name") String name);
List<NuclideLine> getNuclideLines();
}

View File

@ -26,27 +26,19 @@
select a.NAME, a.num_lines, a.halflife, a.halflife_err from CONFIGURATION.GARDS_NUCL_LIB a
</select>
<select id="findNuclidesAnalysis" resultType="java.lang.String">
select NAME from CONFIGURATION.GARDS_NUCL_LIB
<select id="findNuclidesAnalysis" resultType="org.jeecg.modules.entity.vo.HalfData">
select NAME as name, HALFLIFE as half from CONFIGURATION.GARDS_NUCL_LIB
</select>
<select id="getNuclideLines" resultType="org.jeecg.modules.entity.vo.NuclideLine">
SELECT FULLNAME as fullName,
SELECT NAME as name,
FULLNAME as fullName,
ENERGY as energy,
ENERGY_UNCERT as energyUncert,
YIELD as yield,
YIELD_UNCERT as yieldUncert,
KEY_FLAG as keyFlag
from CONFIGURATION.GARDS_NUCL_LINES_LIB WHERE NAME = #{name} ORDER BY ENERGY
</select>
<select id="getOneHalf" resultType="org.jeecg.modules.entity.vo.HalfData">
SELECT
NAME as name,
HALFLIFE as half
FROM
CONFIGURATION.GARDS_NUCL_LIB
WHERE NAME = #{name}
from CONFIGURATION.GARDS_NUCL_LINES_LIB ORDER BY NAME,ENERGY
</select>
</mapper>

View File

@ -60,38 +60,41 @@ public class GardsNuclLibServiceImpl extends ServiceImpl<GardsNuclLibMapper, Gar
@Override
public void getNuclideMap() {
List<String> nuclideLibs = this.baseMapper.findNuclidesAnalysis();
Map<String, NuclideLines> nuclideMap = GetNuclideLines(nuclideLibs);
Map<String, NuclideLines> nuclideMap = GetNuclideLines();
redisUtil.set("AllNuclideMap", nuclideMap);
}
public Map<String, NuclideLines> GetNuclideLines(List<String> nuclideList) {
public Map<String, NuclideLines> GetNuclideLines() {
List<HalfData> nuclideList = this.baseMapper.findNuclidesAnalysis();
Map<String, NuclideLines> mapLines = new HashMap<>();
if (nuclideList.size() < 1) {
return mapLines;
}
for (String name : nuclideList) {
NuclideLines nlines = new NuclideLines();
List<NuclideLine> nuclideLineList = this.baseMapper.getNuclideLines(name);
for (int j = 0; j < nuclideLineList.size(); j++) {
nlines.getFullNames().add(nuclideLineList.get(j).getFullName());
nlines.getVenergy().add(nuclideLineList.get(j).getEnergy());
nlines.getVuncertE().add(nuclideLineList.get(j).getEnergyUncert());
nlines.getVyield().add(nuclideLineList.get(j).getYield() / 100);
nlines.getVuncertY().add(nuclideLineList.get(j).getYieldUncert());
if (Objects.nonNull(nuclideLineList.get(j).getKeyFlag()) && nuclideLineList.get(j).getKeyFlag().intValue() > 0) {
List<NuclideLine> nuclideLineList = this.baseMapper.getNuclideLines();
for (HalfData half : nuclideList) {
String name = half.getName();
NuclideLines nlines = null;
//判断map里是否存在当前名称的核素信息
if (Objects.isNull(mapLines.get(name))) {
nlines = new NuclideLines();
nlines.setHalflife(half.getHalf() == null ? 0 : half.getHalf() * 86400);// 将天转换成秒
} else {
nlines = mapLines.get(name);
}
List<NuclideLine> filterList = nuclideLineList.stream().filter(item -> item.getName().equals(name)).collect(Collectors.toList());
for (int j = 0; j < filterList.size(); j++) {
nlines.getFullNames().add(filterList.get(j).getFullName());
nlines.getVenergy().add(filterList.get(j).getEnergy());
nlines.getVuncertE().add(filterList.get(j).getEnergyUncert());
nlines.getVyield().add(filterList.get(j).getYield() / 100);
nlines.getVuncertY().add(filterList.get(j).getYieldUncert());
if (Objects.nonNull(filterList.get(j).getKeyFlag()) && filterList.get(j).getKeyFlag().intValue() > 0) {
nlines.key_flag = j;
nlines.maxYeildIdx = j;
}
}
mapLines.put(name, nlines);
}
for (String name:nuclideList) {
HalfData half = this.baseMapper.getOneHalf(name);
NuclideLines nuclideLines = mapLines.get(half.getName());
nuclideLines.setHalflife(half.getHalf() == null ? 0 : half.getHalf() * 86400);// 将天转换成秒
mapLines.put(half.getName(), nuclideLines);
}
return mapLines;
}

View File

@ -32,8 +32,8 @@ public class SpectrumAnalysesController {
@GetMapping("getDBSearchList")
@ApiOperation(value = "查询查询条件数据接口", notes = "查询查询条件数据接口")
public Result getDBSearchList(HttpServletRequest request, boolean AllUsers) {
return spectrumAnalysisService.getDBSearchList(request, AllUsers);
public Result getDBSearchList(HttpServletRequest request, boolean AllUsers, String sampleType) {
return spectrumAnalysisService.getDBSearchList(request, AllUsers, sampleType);
}
@GetMapping("getDBSpectrumList")

View File

@ -16,7 +16,7 @@ public interface ISpectrumAnalysisService {
Result initValue(String dbName, Integer sampleId, String analyst, String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request);
Result getDBSearchList(HttpServletRequest request, boolean AllUsers);
Result getDBSearchList(HttpServletRequest request, boolean AllUsers, String sampleType);
Result getDBSpectrumList(QueryRequest queryRequest, GardsSampleDataSpectrum gardsSampleData, String dbName, String[] menuTypes, boolean AllUsers, boolean CollectStopB, boolean AcqStartB, Date startDate, Date endDate, HttpServletRequest request);

View File

@ -31,6 +31,7 @@ import org.jeecg.modules.base.abstracts.AbstractLogOrReport;
import org.jeecg.modules.base.bizVo.BetaRLR;
import org.jeecg.modules.base.dto.*;
import org.jeecg.modules.base.entity.configuration.GardsDetectors;
import org.jeecg.modules.base.entity.configuration.GardsStations;
import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.base.entity.rnman.*;
import org.jeecg.modules.base.enums.*;
@ -126,14 +127,34 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
@Override
public Result getDBSearchList(HttpServletRequest request, boolean AllUsers) {
public Result getDBSearchList(HttpServletRequest request, boolean AllUsers, String sampleType) {
Result result = new Result();
//接收返回结果
Map<String, List<String>> map = new HashMap<>();
//查询谱对应的台站类型
if (StringUtils.isBlank(sampleType)){
result.error500("谱类型不能为空");
return result;
}
List<String> menuTypes = new LinkedList<>();
if (sampleType.equalsIgnoreCase("All")) {
menuTypes.add(SystemType.BETA.getType());
menuTypes.add(SystemType.GAMMA.getType());
} else if (sampleType.equalsIgnoreCase("Beta")) {
menuTypes.add(SystemType.BETA.getType());
} else if (sampleType.equalsIgnoreCase("Gamma")) {
menuTypes.add(SystemType.GAMMA.getType());
}
List<String> stationTypes = sysDictService.findStationType(menuTypes);
if (CollectionUtils.isEmpty(stationTypes)) {
result.error500("请先补充数据字典中当前系统类型对应的台站类型信息");
return result;
}
//获取台站编码
List<String> stationCodes = new LinkedList<>();
List<String> detectorCodes = new LinkedList<>();
//根据台站id查询台站名称
Map<String, String> stationMap = (Map<String, String>)redisUtil.get("stationMap");
//查询台站信息接口
HashMap<String, Object> stationMap = (HashMap<String, Object>)redisUtil.get("stationInfoMap");
//从redis中获取探测器信息
Map<Integer, String> detectorInfoMap = (Map<Integer, String>)redisUtil.get("detectorsMap");
//获取台站信息
@ -145,24 +166,26 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
result.error500("Description Failed to obtain the current login user information");
return result;
}
//查询用户当天排班的台站信息
userStations = userTaskUtil.findUserStation(userName);
//判断当前用户在当天是否有排班任务的台站信息
if (CollectionUtils.isNotEmpty(userStations)) {
if (CollectionUtils.isNotEmpty(stationMap)){
for (Map.Entry<String, String> entry:stationMap.entrySet()) {
if (userStations.contains(entry.getKey())) {
stationCodes.add(entry.getValue());
for (Map.Entry<String, Object> entry:stationMap.entrySet()) {
GardsStations value = (GardsStations)entry.getValue();
if (userStations.contains(entry.getKey()) && StringUtils.isNotBlank(value.getType()) && stationTypes.contains(value.getType())) {
stationCodes.add(value.getStationCode());
}
}
}
if (CollectionUtils.isNotEmpty(detectorInfoMap)) {
for (Map.Entry<Integer, String> entry:detectorInfoMap.entrySet()) {
if (String.valueOf(entry.getKey()).length() <= 3) {
if (userStations.contains(String.valueOf(entry.getKey()))) {
if (String.valueOf(entry.getValue()).length() <= 5) {
if (stationCodes.contains(String.valueOf(entry.getValue()))) {
detectorCodes.add(entry.getValue());
}
} else {
if (userStations.contains(String.valueOf(entry.getKey()).substring(0, 3))) {
if (stationCodes.contains(String.valueOf(entry.getValue()).substring(0, 5))) {
detectorCodes.add(entry.getValue());
}
}
@ -171,13 +194,24 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
} else {
if (CollectionUtils.isNotEmpty(stationMap)) {
for (Map.Entry<String, String> entry: stationMap.entrySet()) {
stationCodes.add(entry.getValue());
for (Map.Entry<String, Object> entry: stationMap.entrySet()) {
GardsStations value = (GardsStations) entry.getValue();
if (StringUtils.isNotBlank(value.getType()) && stationTypes.contains(value.getType())) {
stationCodes.add(value.getStationCode());
}
}
}
if (CollectionUtils.isNotEmpty(detectorInfoMap)) {
for (Map.Entry<Integer, String> entry: detectorInfoMap.entrySet()) {
detectorCodes.add(entry.getValue());
if (String.valueOf(entry.getValue()).length() <= 5) {
if (stationCodes.contains(String.valueOf(entry.getValue()))) {
detectorCodes.add(entry.getValue());
}
} else {
if (stationCodes.contains(String.valueOf(entry.getValue()).substring(0, 5))) {
detectorCodes.add(entry.getValue());
}
}
}
}
}