feat:获取探测器Id

This commit is contained in:
nieziyan 2024-05-13 16:25:44 +08:00
parent c5ffa77954
commit 4bb2518d36
7 changed files with 27 additions and 12 deletions

View File

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

View File

@ -43,5 +43,7 @@ public interface SystemClient {
@PostMapping("/sys/appMessage/pushMessageToSingle")
void pushMessageToSingle(@RequestBody MessageDTO messageDTO, @RequestParam String groupId);
/* GardsSampleDataController下相关接口 */
@GetMapping("/gardsSampleData/getDetectorId")
String getDetectorId(@RequestParam String sampleId);
}

View File

@ -150,7 +150,6 @@ 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()
@ -166,8 +165,7 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
if (ObjectUtil.isNull(condition)) continue;
switch (condition){
case FIRST_FOUND: // 首次发现该元素
firstDetected = firstDetected(betaOrGamma, datasource, stationId,
detectorId, sampleId, nuclideNames);
firstDetected = firstDetected(betaOrGamma, datasource, stationId, sampleId, nuclideNames);
break;
case ABOVE_AVERAGE: // 元素浓度高于均值
moreThanAvg = moreThanAvg(datasource, stationId, collDate, nuclidesCross);
@ -218,11 +216,11 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
* 首次发现该核素
*/
private List<String> firstDetected(String betaOrGamma, String dataSourceType,
String stationId, String detectorId,
String sampleId, Set<String> nuclideNames){
String stationId, String sampleId, Set<String> nuclideNames){
/* 查询用户关注的核素是否存在 如果不存在则为首次发现该核素
判断核素是否存在的条件: 该核素的Conc值是否大于MDC值
*/
String detectorId = systemClient.getDetectorId(sampleId);
return analysisResultService.nuclideFirst(betaOrGamma, dataSourceType, stationId,
detectorId, sampleId, nuclideNames);
}

View File

@ -2,6 +2,7 @@ package org.jeecg.modules.service.impl;
import cn.hutool.core.collection.ListUtil;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.modules.feignclient.SystemClient;
import org.jeecg.modules.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

View File

@ -19,7 +19,7 @@ import java.util.Map;
public class GardsSampleDataController {
@Autowired
private IGardsSampleDataService gardsSampleDataService;
private IGardsSampleDataService sampleDataService;
@Autowired
private RedisUtil redisUtil;
@ -28,7 +28,7 @@ public class GardsSampleDataController {
public Result<IPage<GardsSampleDataSystem>> findPage(QueryRequest queryRequest,
GardsSampleDataSystem gardsSampleData,
boolean collectStopCheck, boolean acqDotStartCheck){
return gardsSampleDataService.findPage(queryRequest, gardsSampleData, collectStopCheck, acqDotStartCheck);
return sampleDataService.findPage(queryRequest, gardsSampleData, collectStopCheck, acqDotStartCheck);
}
@GetMapping("findStations")
@ -49,7 +49,11 @@ public class GardsSampleDataController {
@ApiOperation(value = "删除DATA_BASE数据", notes = "删除DATA_BASE数据")
public Result<?> deleteById(@RequestParam Integer sampleId, boolean sampleData,
boolean rnAuto, boolean rnMan){
return gardsSampleDataService.deleteById(sampleId, sampleData, rnAuto, rnMan);
return sampleDataService.deleteById(sampleId, sampleData, rnAuto, rnMan);
}
@GetMapping("getDetectorId")
public String getDetectorId(@RequestParam String sampleId){
return sampleDataService.getDetectorId(sampleId);
}
}

View File

@ -31,4 +31,6 @@ public interface IGardsSampleDataService extends IService<GardsSampleDataSystem>
GardsSampleDataSystem getOne(Integer sampleId);
void delTables(List<String> tableNames, Integer sampleId);
String getDetectorId(String sampleId);
}

View File

@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.toolkit.SqlRunner;
@ -22,6 +23,7 @@ import org.jeecg.common.util.FTPUtil;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.base.dto.AnalysesDto;
import org.jeecg.modules.base.dto.OwnerDto;
import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.base.entity.rnauto.GardsAnalyses;
import org.jeecg.modules.system.entity.GardsSampleDataSystem;
import org.jeecg.modules.system.mapper.GardsSampleDataMapper;
@ -203,6 +205,15 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
}
}
@Override
public String getDetectorId(String sampleId) {
LambdaQueryWrapper<GardsSampleDataSystem> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GardsSampleDataSystem::getSampleId, sampleId);
Integer detectorId = Optional.of(this.getOne(wrapper, false))
.orElse(new GardsSampleDataSystem()).getDetectorId();
return ObjectUtil.isNull(detectorId) ? null : detectorId.toString();
}
private String samplePath(String savePath, Integer sampleId){
GardsSampleDataSystem sampleData = getOne(sampleId);
String inputFileName = sampleData.getInputFileName();