feat:修改分析结果报警[核素首次发现|出现两种及以上]

This commit is contained in:
nieziyan 2024-05-11 15:39:05 +08:00
parent 95a150122c
commit 09a23b371b
22 changed files with 248 additions and 117 deletions

View File

@ -18,6 +18,9 @@ public class Info implements Serializable{
// 台站id
private String stationId;
// 探测器id
private String detectorId;
// 谱id
private String sampleId;

View File

@ -0,0 +1,11 @@
package org.jeecg.modules.base.dto;
import lombok.Data;
@Data
public class SampNucl {
private String sampleId;
private String nuclideName;
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.ConcDtoXe;
import org.jeecg.modules.base.dto.SampNucl;
import org.jeecg.modules.base.entity.rnauto.GardsNuclIded;
import java.util.List;
@ -14,4 +15,6 @@ import java.util.Set;
public interface GardsNuclIdedAutoMapper extends BaseMapper<GardsNuclIded> {
List<ConcDto> getConc(Map<String,Object> param);
List<SampNucl> sampNucl(String stationId, String detectorId, Set<String> nuclideNames);
}

View File

@ -3,6 +3,7 @@ package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.SampNucl;
import org.jeecg.modules.base.entity.rnman.GardsNuclIded;
import java.util.List;
@ -12,5 +13,7 @@ import java.util.Set;
@Mapper
public interface GardsNuclIdedManMapper extends BaseMapper<GardsNuclIded> {
List<ConcDto> getConc(Map<String,Object> param);
List<ConcDto> getConc(Map<String, Object> param);
List<SampNucl> sampNucl(String stationId, String detectorId, Set<String> nuclideNames);
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.ConcDtoXe;
import org.jeecg.modules.base.dto.SampNucl;
import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
import java.util.List;
@ -14,4 +15,6 @@ import java.util.Set;
public interface GardsXeResultsAutoMapper extends BaseMapper<GardsXeResults> {
List<ConcDtoXe> getConc(Map<String,Object> params);
List<SampNucl> sampNucl(String stationId, String detectorId, Set<String> nuclideNames);
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.ConcDtoXe;
import org.jeecg.modules.base.dto.SampNucl;
import org.jeecg.modules.base.entity.rnman.GardsXeResults;
import java.util.List;
@ -14,4 +15,6 @@ import java.util.Set;
public interface GardsXeResultsManMapper extends BaseMapper<GardsXeResults> {
List<ConcDtoXe> getConc(Map<String,Object> params);
List<SampNucl> sampNucl(String stationId, String detectorId, Set<String> nuclideNames);
}

View File

@ -23,4 +23,20 @@
</if>
</where>
</select>
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">
SELECT
n.SAMPLE_ID,
n.NUCLIDENAME AS nuclideName
FROM
ORIGINAL.GARDS_SAMPLE_DATA s
INNER JOIN RNAUTO.GARDS_NUCL_IDED n ON s.SAMPLE_ID = n.SAMPLE_ID
WHERE s.STATION_ID = #{stationId} AND s.DETECTOR_ID = #{detectorId}
<if test="nuclideNames != null and nuclideNames.size() > 0">
AND n.NUCLIDENAME IN
<foreach collection="nuclideNames" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
AND TO_NUMBER(n.CONCENTRATION) > TO_NUMBER(n.MDC)
</select>
</mapper>

View File

@ -23,4 +23,20 @@
</if>
</where>
</select>
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">
SELECT
n.SAMPLE_ID,
n.NUCLIDENAME AS nuclideName
FROM
ORIGINAL.GARDS_SAMPLE_DATA s
INNER JOIN RNAUTO.GARDS_NUCL_IDED n ON s.SAMPLE_ID = n.SAMPLE_ID
WHERE s.STATION_ID = #{stationId} AND s.DETECTOR_ID = #{detectorId}
<if test="nuclideNames != null and nuclideNames.size() > 0">
AND n.NUCLIDENAME IN
<foreach collection="nuclideNames" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
AND TO_NUMBER(n.CONCENTRATION) > TO_NUMBER(n.MDC)
</select>
</mapper>

View File

@ -23,4 +23,20 @@
</if>
</where>
</select>
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">
SELECT
n.SAMPLE_ID,
n.NUCLIDE_NAME
FROM
ORIGINAL.GARDS_SAMPLE_DATA s
INNER JOIN RNAUTO.GARDS_XE_RESULTS n ON s.SAMPLE_ID = n.SAMPLE_ID
WHERE s.STATION_ID = #{stationId} AND s.DETECTOR_ID = #{detectorId}
<if test="nuclideNames != null and nuclideNames.size() > 0">
AND n.NUCLIDE_NAME IN
<foreach collection="nuclideNames" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
AND n.NID_FLAG = 1
</select>
</mapper>

View File

@ -23,4 +23,20 @@
</if>
</where>
</select>
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">
SELECT
n.SAMPLE_ID,
n.NUCLIDE_NAME
FROM
ORIGINAL.GARDS_SAMPLE_DATA s
INNER JOIN RNMAN.GARDS_XE_RESULTS n ON s.SAMPLE_ID = n.SAMPLE_ID
WHERE s.STATION_ID = #{stationId} AND s.DETECTOR_ID = #{detectorId}
<if test="nuclideNames != null and nuclideNames.size() > 0">
AND n.NUCLIDE_NAME IN
<foreach collection="nuclideNames" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
AND n.NID_FLAG = 1
</select>
</mapper>

View File

@ -5,21 +5,18 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.text.StrBuilder;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ReUtil;
import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hwpf.sprm.SprmIterator;
import org.jeecg.common.api.dto.message.MessageDTO;
import org.jeecg.common.config.mqtoken.UserTokenContext;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.constant.enums.SampleType;
import org.jeecg.common.util.*;
import org.jeecg.common.util.dynamic.db.FreemarkerParseFactory;
import org.jeecg.modules.base.dto.NuclideInfo;
import org.jeecg.modules.base.dto.Info;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisLog;
@ -40,13 +37,10 @@ import org.springframework.stereotype.Component;
import static org.jeecg.common.constant.enums.MessageTypeEnum.*;
import static org.jeecg.common.util.TokenUtils.getTempToken;
import static org.jeecg.modules.base.enums.Template.ANALYSIS_NUCLIDE;
import static org.jeecg.modules.base.enums.Template.MONITOR_EMAIL;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@Data
@ -156,6 +150,7 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
String betaOrGamma = info.getBetaOrGamma();
String datasource = info.getDatasource();
String stationId = info.getStationId();
String detectorId = info.getDetectorId();
String sampleId = info.getSampleId();
String sampleName = info.getSampleName();
// 获取谱文件采样日期 如果为null 则默认为LocalDate.now()
@ -171,13 +166,14 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
if (ObjectUtil.isNull(condition)) continue;
switch (condition){
case FIRST_FOUND: // 首次发现该元素
firstDetected = firstDetected(betaOrGamma, datasource, nuclideNames);
firstDetected = firstDetected(betaOrGamma, datasource, stationId,
detectorId, sampleId, nuclideNames);
break;
case ABOVE_AVERAGE: // 元素浓度高于均值
moreThanAvg = moreThanAvg(datasource, stationId, collDate, nuclidesCross);
break;
case MEANWHILE: // 同时出现两种及以上核素
meanWhile = meanWhile(betaOrGamma, datasource, nuclideNames);
meanWhile = meanWhile(betaOrGamma, datasource, sampleId, nuclideNames);
if (meanWhile.size() < 2) meanWhile = ListUtil.empty();
break;
default:
@ -198,8 +194,8 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
dataTool.put("meanwhile", CollUtil.join(meanWhile, StrUtil.COMMA + StrUtil.SPACE));
// 如果报警数据为空 则不需要发送报警信息和生成报警日志
if (MapUtil.isEmpty(dataTool.get())) return;
// 台站信息和Sample信息
dataTool.put("stationId", stationId).put("sampleId", sampleId).put("sampleName", sampleName);
// 产生报警信息的Sample信息
dataTool.put("sampleId", sampleId).put("sampleName", sampleName);
// 构建预警信息实例 准备发送预警信息
MessageDTO messageDTO = TemplateUtil.parse1(ANALYSIS_NUCLIDE.getCode(), dataTool.get());
// 保存报警日志
@ -221,13 +217,14 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
/**
* 首次发现该核素
*/
private List<String> firstDetected(String betaOrGamma, String dataSourceType, Set<String> nuclideNames){
// 查询用户关注的核素是否存在 如果不存在则为首次发现该核素
// 判断核素是否存在的条件: 该核素的Conc值是否大于MDC值
List<String> existNames = analysisResultService
.nuclideNames(betaOrGamma, dataSourceType, nuclideNames);
// 两个集合元素相减则为不存在的核素 即为首次出现的核素
return CollUtil.subtractToList(nuclideNames, existNames);
private List<String> firstDetected(String betaOrGamma, String dataSourceType,
String stationId, String detectorId,
String sampleId, Set<String> nuclideNames){
/* 查询用户关注的核素是否存在 如果不存在则为首次发现该核素
判断核素是否存在的条件: 该核素的Conc值是否大于MDC值
*/
return analysisResultService.nuclideFirst(betaOrGamma, dataSourceType, stationId,
detectorId, sampleId, nuclideNames);
}
/**
@ -245,8 +242,6 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
String nuclideName = nuclide.getKey();
String concValue = nuclide.getValue();// 浓度值
String avgValue = nuclideAvgs.get(nuclideName);// 浓度均值
if (StrUtil.isBlank(concValue) || StrUtil.isBlank(avgValue))
continue;
if (!NumberUtil.isNumber(concValue) || !NumberUtil.isNumber(avgValue))
continue;
BigDecimal conc = new BigDecimal(concValue);
@ -268,10 +263,12 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
/*
* 是否同时存在两种及以上核素
* */
private List<String> meanWhile(String betaOrGamma, String dataSourceType, Set<String> nuclideNames){
// 查询用户关注的核素是否存在 如果不存在则为首次发现该核素
// 判断核素是否存在的条件: 该核素的Conc值是否大于MDC值
return analysisResultService.nuclideNames(betaOrGamma, dataSourceType, nuclideNames);
private List<String> meanWhile(String betaOrGamma, String dataSourceType,
String sampleId, Set<String> nuclideNames){
/* 查询用户关注的核素中 该谱中是否存在两种及以上核素
判断核素是否存在的条件: 该核素的Conc值是否大于MDC值
*/
return analysisResultService.nuclideExist(betaOrGamma, dataSourceType, sampleId, nuclideNames);
}
private void init() {

View File

@ -5,7 +5,10 @@ import java.util.Set;
public interface AnalysisResultService {
List<String> nuclideNames(String betaOrGamma,
String dataSourceType,
Set<String> nuclideNames);
List<String> nuclideExist(String betaOrGamma, String dataSourceType,
String sampleId, Set<String> nuclideNames);
List<String> nuclideFirst(String betaOrGamma, String dataSourceType,
String stationId, String detectorId,
String sampleId, Set<String> nuclideNames);
}

View File

@ -2,7 +2,6 @@ package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.ConcDtoXe;
import org.jeecg.modules.base.entity.rnauto.GardsNuclIded;
import java.util.List;
@ -13,5 +12,8 @@ public interface IGardsNuclIdedAutoService extends IService<GardsNuclIded> {
List<ConcDto> getConc(Map<String,Object> params);
List<String> nuclideNames(Set<String> nuclideNames);
List<String> nuclideExist(String sampleId, Set<String> nuclideNames);
List<String> nuclideFirst(String stationId, String detectorId,
String sampleId, Set<String> nuclideNames);
}

View File

@ -10,7 +10,10 @@ import java.util.Set;
public interface IGardsNuclIdedManService extends IService<GardsNuclIded> {
List<ConcDto> getConc(Map<String,Object> params);
List<ConcDto> getConc(Map<String, Object> params);
List<String> nuclideNames(Set<String> nuclideNames);
List<String> nuclideExist(String sampleId, Set<String> nuclideNames);
List<String> nuclideFirst(String stationId, String detectorId,
String sampleId, Set<String> nuclideNames);
}

View File

@ -1,7 +1,6 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.ConcDtoXe;
import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
@ -13,5 +12,8 @@ public interface IGardsXeResultsAutoService extends IService<GardsXeResults> {
List<ConcDtoXe> getConc(Map<String,Object> params, Set<String> nuclides);
List<String> nuclideNames(Set<String> nuclideNames);
List<String> nuclideExist(String sampleId, Set<String> nuclideNames);
List<String> nuclideFirst(String stationId, String detectorId,
String sampleId, Set<String> nuclideNames);
}

View File

@ -1,7 +1,6 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.ConcDtoXe;
import org.jeecg.modules.base.entity.rnman.GardsXeResults;
@ -13,5 +12,8 @@ public interface IGardsXeResultsManService extends IService<GardsXeResults> {
List<ConcDtoXe> getConc(Map<String,Object> params, Set<String> nuclides);
List<String> nuclideNames(Set<String> nuclideNames);
List<String> nuclideExist(String sampleId, Set<String> nuclideNames);
List<String> nuclideFirst(String stationId, String detectorId,
String sampleId, Set<String> nuclideNames);
}

View File

@ -26,20 +26,46 @@ public class AnalysisResultServiceImpl implements AnalysisResultService {
@Override
public List<String> nuclideNames(String betaOrGamma, String dataSourceType, Set<String> nuclideNames) {
public List<String> nuclideExist(String betaOrGamma, String dataSourceType,
String sampleId, Set<String> nuclideNames) {
if (CommonConstant.ARMDARR.equals(dataSourceType)){
if (CommonConstant.BETA.equals(betaOrGamma)){
return xeResultsAutoService.nuclideNames(nuclideNames);
return xeResultsAutoService.nuclideExist(sampleId, nuclideNames);
}else if (CommonConstant.GAMMA.equals(betaOrGamma)){
return nuclIdedAutoService.nuclideNames(nuclideNames);
return nuclIdedAutoService.nuclideExist(sampleId, nuclideNames);
}else {
return ListUtil.empty();
}
} else if (CommonConstant.ARMDRRR.equals(dataSourceType)) {
if (CommonConstant.BETA.equals(betaOrGamma)){
return xeResultsManService.nuclideNames(nuclideNames);
return xeResultsManService.nuclideExist(sampleId, nuclideNames);
}else if (CommonConstant.GAMMA.equals(betaOrGamma)){
return nuclIdedManService.nuclideNames(nuclideNames);
return nuclIdedManService.nuclideExist(sampleId, nuclideNames);
}else {
return ListUtil.empty();
}
}else {
return ListUtil.empty();
}
}
@Override
public List<String> nuclideFirst(String betaOrGamma, String dataSourceType,
String stationId, String detectorId,
String sampleId, Set<String> nuclideNames) {
if (CommonConstant.ARMDARR.equals(dataSourceType)){
if (CommonConstant.BETA.equals(betaOrGamma)){
return xeResultsAutoService.nuclideFirst(stationId, detectorId, sampleId, nuclideNames);
}else if (CommonConstant.GAMMA.equals(betaOrGamma)){
return nuclIdedAutoService.nuclideFirst(stationId, detectorId, sampleId, nuclideNames);
}else {
return ListUtil.empty();
}
} else if (CommonConstant.ARMDRRR.equals(dataSourceType)) {
if (CommonConstant.BETA.equals(betaOrGamma)){
return xeResultsManService.nuclideFirst(stationId, detectorId, sampleId, nuclideNames);
}else if (CommonConstant.GAMMA.equals(betaOrGamma)){
return nuclIdedManService.nuclideFirst(stationId, detectorId, sampleId, nuclideNames);
}else {
return ListUtil.empty();
}

View File

@ -1,12 +1,15 @@
package org.jeecg.modules.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.common.constant.DateConstant;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.ConcDtoXe;
import org.jeecg.modules.base.dto.SampNucl;
import org.jeecg.modules.base.entity.rnauto.GardsNuclIded;
import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
import org.jeecg.modules.mapper.GardsNuclIdedAutoMapper;
@ -33,17 +36,34 @@ public class GardsNuclIdedAutoServiceImpl extends ServiceImpl<GardsNuclIdedAutoM
}
@Override
public List<String> nuclideNames(Set<String> nuclideNames) {
public List<String> nuclideExist(String sampleId, Set<String> nuclideNames) {
LambdaQueryWrapper<GardsNuclIded> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GardsNuclIded::getSampleId, sampleId);
wrapper.in(GardsNuclIded::getNuclideName, nuclideNames);
List<GardsNuclIded> nuclIdeds = this.list(wrapper);
// 判断核素是否存在的条件: 该核素Conc值是否大于MDC值
Set<String> existNuclides = nuclIdeds.stream()
.filter(item -> NumberUtil.isNumber(item.getConcentration()))
.filter(item -> NumberUtil.isNumber(item.getMdc()))
.filter(item ->NumberUtil.isGreater(new BigDecimal(item.getConcentration()), new BigDecimal(item.getMdc())))
.filter(item -> NumberUtil.isGreater(new BigDecimal(item.getConcentration()), new BigDecimal(item.getMdc())))
.map(GardsNuclIded::getNuclideName)
.collect(Collectors.toSet());
return ListUtil.toList(existNuclides);
}
@Override
public List<String> nuclideFirst(String stationId, String detectorId,
String sampleId, Set<String> nuclideNames) {
List<SampNucl> sampNucls = this.baseMapper.sampNucl(stationId, detectorId, nuclideNames);
// 获取除了当前谱的所有存在的核素
Set<String> notCurrent = sampNucls.stream()
.filter(item -> !StrUtil.equals(item.getSampleId(), sampleId))
.map(SampNucl::getNuclideName).collect(Collectors.toSet());
// 获取当前谱的所有存在的核素
Set<String> current = sampNucls.stream()
.filter(item -> StrUtil.equals(item.getSampleId(), sampleId))
.map(SampNucl::getNuclideName).collect(Collectors.toSet());
// 两集合相减即为当前谱中的首次在当前台站当前探测器中出现的核素
return CollUtil.subtractToList(current, notCurrent);
}
}

View File

@ -1,12 +1,15 @@
package org.jeecg.modules.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.constant.DateConstant;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.SampNucl;
import org.jeecg.modules.base.entity.rnman.GardsNuclIded;
import org.jeecg.modules.mapper.GardsNuclIdedManMapper;
import org.jeecg.modules.service.IGardsNuclIdedManService;
@ -30,17 +33,34 @@ public class GardsNuclIdedManServiceImpl extends ServiceImpl<GardsNuclIdedManMap
}
@Override
public List<String> nuclideNames(Set<String> nuclideNames) {
public List<String> nuclideExist(String sampleId, Set<String> nuclideNames) {
LambdaQueryWrapper<GardsNuclIded> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GardsNuclIded::getSampleId, sampleId);
wrapper.in(GardsNuclIded::getNuclideName, nuclideNames);
List<GardsNuclIded> nuclIdeds = this.list(wrapper);
// 判断核素是否存在的条件: 该核素Conc值是否大于MDC值
Set<String> existNuclides = nuclIdeds.stream()
.filter(item -> NumberUtil.isNumber(item.getConcentration()))
.filter(item -> NumberUtil.isNumber(item.getMdc()))
.filter(item ->NumberUtil.isGreater(new BigDecimal(item.getConcentration()), new BigDecimal(item.getMdc())))
.filter(item -> NumberUtil.isGreater(new BigDecimal(item.getConcentration()), new BigDecimal(item.getMdc())))
.map(GardsNuclIded::getNuclideName)
.collect(Collectors.toSet());
return ListUtil.toList(existNuclides);
}
@Override
public List<String> nuclideFirst(String stationId, String detectorId,
String sampleId, Set<String> nuclideNames) {
List<SampNucl> sampNucls = this.baseMapper.sampNucl(stationId, detectorId, nuclideNames);
// 获取除了当前谱的所有存在的核素
Set<String> notCurrent = sampNucls.stream()
.filter(item -> !StrUtil.equals(item.getSampleId(), sampleId))
.map(SampNucl::getNuclideName).collect(Collectors.toSet());
// 获取当前谱的所有存在的核素
Set<String> current = sampNucls.stream()
.filter(item -> StrUtil.equals(item.getSampleId(), sampleId))
.map(SampNucl::getNuclideName).collect(Collectors.toSet());
// 两集合相减即为当前谱中的首次在当前台站当前探测器中出现的核素
return CollUtil.subtractToList(current, notCurrent);
}
}

View File

@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.common.constant.DateConstant;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.ConcDtoXe;
import org.jeecg.modules.base.dto.SampNucl;
import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
import org.jeecg.modules.mapper.GardsXeResultsAutoMapper;
import org.jeecg.modules.service.IGardsXeResultsAutoService;
@ -52,8 +53,9 @@ public class GardsXeResultsAutoServiceImpl extends ServiceImpl<GardsXeResultsAut
}
@Override
public List<String> nuclideNames(Set<String> nuclideNames) {
public List<String> nuclideExist(String sampleId, Set<String> nuclideNames) {
LambdaQueryWrapper<GardsXeResults> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GardsXeResults::getSampleId, sampleId);
wrapper.in(GardsXeResults::getNuclideName, nuclideNames);
List<GardsXeResults> xeResults = this.list(wrapper);
// 判断核素是否存在的条件: 该核素NidFlag值是否为1
@ -64,4 +66,20 @@ public class GardsXeResultsAutoServiceImpl extends ServiceImpl<GardsXeResultsAut
.collect(Collectors.toSet());
return ListUtil.toList(existNuclides);
}
@Override
public List<String> nuclideFirst(String stationId, String detectorId,
String sampleId, Set<String> nuclideNames) {
List<SampNucl> sampNucls = this.baseMapper.sampNucl(stationId, detectorId, nuclideNames);
// 获取除了当前谱的所有存在的核素
Set<String> notCurrent = sampNucls.stream()
.filter(item -> !StrUtil.equals(item.getSampleId(), sampleId))
.map(SampNucl::getNuclideName).collect(Collectors.toSet());
// 获取当前谱的所有存在的核素
Set<String> current = sampNucls.stream()
.filter(item -> StrUtil.equals(item.getSampleId(), sampleId))
.map(SampNucl::getNuclideName).collect(Collectors.toSet());
// 两集合相减即为当前谱中的首次在当前台站当前探测器中出现的核素
return CollUtil.subtractToList(current, notCurrent);
}
}

View File

@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.constant.DateConstant;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.dto.ConcDtoXe;
import org.jeecg.modules.base.dto.SampNucl;
import org.jeecg.modules.base.entity.rnman.GardsXeResults;
import org.jeecg.modules.mapper.GardsXeResultsManMapper;
import org.jeecg.modules.service.IGardsXeResultsManService;
@ -52,8 +53,9 @@ public class GardsXeResultsManServiceImpl extends ServiceImpl<GardsXeResultsManM
}
@Override
public List<String> nuclideNames(Set<String> nuclideNames) {
public List<String> nuclideExist(String sampleId, Set<String> nuclideNames) {
LambdaQueryWrapper<GardsXeResults> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GardsXeResults::getSampleId, sampleId);
wrapper.in(GardsXeResults::getNuclideName, nuclideNames);
List<GardsXeResults> xeResults = this.list(wrapper);
// 判断核素是否存在的条件: 该核素NidFlag值是否为1
@ -64,4 +66,20 @@ public class GardsXeResultsManServiceImpl extends ServiceImpl<GardsXeResultsManM
.collect(Collectors.toSet());
return ListUtil.toList(existNuclides);
}
@Override
public List<String> nuclideFirst(String stationId, String detectorId,
String sampleId, Set<String> nuclideNames) {
List<SampNucl> sampNucls = this.baseMapper.sampNucl(stationId, detectorId, nuclideNames);
// 获取除了当前谱的所有存在的核素
Set<String> notCurrent = sampNucls.stream()
.filter(item -> !StrUtil.equals(item.getSampleId(), sampleId))
.map(SampNucl::getNuclideName).collect(Collectors.toSet());
// 获取当前谱的所有存在的核素
Set<String> current = sampNucls.stream()
.filter(item -> StrUtil.equals(item.getSampleId(), sampleId))
.map(SampNucl::getNuclideName).collect(Collectors.toSet());
// 两集合相减即为当前谱中的首次在当前台站当前探测器中出现的核素
return CollUtil.subtractToList(current, notCurrent);
}
}

View File

@ -1,70 +0,0 @@
package org.jeecg.modules.quartz.controller;
import cn.hutool.core.map.MapUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.Prompt;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.ImportExcelUtil;
import org.jeecg.common.util.RedisStreamUtil;
import org.jeecg.modules.base.dto.Info;
import org.jeecg.modules.quartz.entity.QuartzJob;
import org.jeecg.modules.quartz.service.IQuartzJobService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("sys/testana")
@Slf4j
@Api(tags = "定时任务接口")
public class TestController {
@Autowired
private RedisStreamUtil redisStreamUtil;
@GetMapping("test")
public void test(){
Info info = new Info();
info.setStationId("205");
info.setSampleId("425496");
info.setBetaOrGamma("Gamma");
info.setFullOrPrel("FULL");
info.setDatasource("1");
info.setSampleName("CAX05_001-20230624_0220_Q_FULL_299.3.PHD");
info.setCollectionDate(LocalDateTime.now());
Map<String, String> nuclides = MapUtil.newHashMap();
nuclides.put("Be7","1000000");
nuclides.put("sss","1000000");
nuclides.put("Tl208","10");
info.setNuclides(nuclides);
redisStreamUtil.pushAnalysis(info);
}
}