新增查询台站信息,探测器信息接口

This commit is contained in:
qiaoqinzheng 2023-07-06 14:40:40 +08:00
parent 87c470fa8f
commit 478ee60133
6 changed files with 187 additions and 8 deletions

View File

@ -22,6 +22,12 @@ public class SpectrumAnalysesController {
@Autowired
private ISpectrumAnalysisService spectrumAnalysisService;
@GetMapping("getDBSearchList")
@ApiOperation(value = "查询台站,探测器数据接口", notes = "查询台站,探测器数据接口")
public Result getDBSearchList(String menuType){
return spectrumAnalysisService.getDBSearchList(menuType);
}
@GetMapping("getDBSpectrumList")
@ApiOperation(value = "获取数据库中交互分析基础数据", notes = "获取数据库中交互分析基础数据")
public Result getDBSpectrumList(QueryRequest queryRequest, GardsSampleData gardsSampleData, String dbName, String menuType,boolean CollectStop, boolean AcqStart,

View File

@ -0,0 +1,7 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.system.entity.GardsDetectors;
public interface GardsDetectorsMapper extends BaseMapper<GardsDetectors> {
}

View File

@ -8,6 +8,8 @@ import java.util.Date;
public interface ISpectrumAnalysisService {
Result getDBSearchList(String menuType);
Result getDBSpectrumList(QueryRequest queryRequest, GardsSampleData gardsSampleData, String dbName, String menuType, boolean CollectStop, boolean AcqStart, Date startDate, Date endDate);
}

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.service.impl;
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.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -9,16 +10,17 @@ import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.base.entity.GardsSampleData;
import org.jeecg.modules.mapper.GardsDetectorsMapper;
import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
import org.jeecg.modules.service.ISpectrumAnalysisService;
import org.jeecg.modules.service.ISysDictService;
import org.jeecg.modules.system.entity.GardsDetectors;
import org.jeecg.modules.system.entity.GardsStations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
@Service("spectrumAnalysisService")
@DS("auo")
@ -30,6 +32,45 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
private RedisUtil redisUtil;
@Autowired
private ISysDictService sysDictService;
@Autowired
private GardsDetectorsMapper gardsDetectorsMapper;
@Override
public Result getDBSearchList(String menuType) {
Result result = new Result();
Map<String, List<String>> map = new HashMap<>();
//查询谱对应的台站类型
if (StringUtils.isBlank(menuType)){
result.error500("谱类型不能为空");
return result;
}
List<String> stationTypes = sysDictService.findStationType(menuType);
if (CollectionUtils.isEmpty(stationTypes)) {
result.error500("请先补充数据字典中当前系统类型对应的台站类型信息");
return result;
}
//查询全部台站信息
HashMap<String, GardsStations> stationInfoMap = (HashMap<String, GardsStations>) redisUtil.get("stationInfoMap");
//根据台站类型获取台站信息
List<GardsStations> gardsStations = stationInfoMap.values().stream().filter(item -> stationTypes.contains(item.getType())).sorted(Comparator.comparing(GardsStations::getStationId)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(gardsStations)){
//获取台站编码
List<String> stationCodes = gardsStations.stream().map(GardsStations::getStationCode).collect(Collectors.toList());
//获取台站id
List<Integer> stationIds = gardsStations.stream().map(GardsStations::getStationId).collect(Collectors.toList());
//根据台站id查询对应的探测器
LambdaQueryWrapper<GardsDetectors> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(GardsDetectors::getStationId, stationIds);
queryWrapper.orderByAsc(GardsDetectors::getDetectorId);
List<GardsDetectors> gardsDetectors = gardsDetectorsMapper.selectList(queryWrapper);
List<String> detectorCodes = gardsDetectors.stream().map(GardsDetectors::getDetectorCode).collect(Collectors.toList());
map.put("stationCode", stationCodes);
map.put("detectorCode", detectorCodes);
result.setSuccess(true);
result.setResult(map);
}
return result;
}
@Override
public Result getDBSpectrumList(QueryRequest queryRequest, GardsSampleData gardsSampleData, String dbName, String menuType, boolean CollectStop, boolean AcqStart, Date startDate, Date endDate) {
@ -65,10 +106,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
result.error500("数据库类型不存在");
return result;
}
//从redis中获取台站信息
Map<Integer, String> stationMap = (Map<Integer, String>)redisUtil.get("stationMap");
//从redis中获取探测器信息
Map<Integer, String> detectorsMap = (Map<Integer, String>)redisUtil.get("detectorsMap");
//声明分页page
Page<GardsSampleData> page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
Page<GardsSampleData> sampleDataPage = spectrumAnalysisMapper.getDBSpectrumList(page, gardsSampleData, dbName, stationTypes, CollectStop, AcqStart, startTime, endTime);

View File

@ -0,0 +1,69 @@
package org.jeecg.modules.system.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName(value = "CONFIGURATION.GARDS_DETECTORS")
public class GardsDetectors implements Serializable {
@TableField(value = "DETECTOR_ID")
private Integer detectorId;
@TableField(value = "DETECTOR_CODE")
private String detectorCode;
@TableField(value = "LON")
private Double lon;
@TableField(value = "LAT")
private Double lat;
@TableField(value = "TYPE")
private String type;
@TableField(value = "CHANNELS")
private Double channels;
@TableField(value = "RATED_EFFICIENCY")
private Double ratedEfficiency;
@TableField(value = "RATED_RESOLUTION")
private Double ratedResolution;
@TableField(value = "ECAL_RANGE_MAX")
private Double ecalRangeMax;
@TableField(value = "DATE_BEGIN")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date dateBegin;
@TableField(value = "DATE_END")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date dateEnd;
@TableField(value = "STATUS")
private String status;
@TableField(value = "DESCRIPTION")
private String description;
@TableField(value = "MODDATE")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date moddate;
@TableField(value = "STATION_ID")
private Integer stationId;
@TableField(exist = false)
private String stationName;
}

View File

@ -0,0 +1,58 @@
package org.jeecg.modules.system.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName(value = "CONFIGURATION.GARDS_STATIONS")
public class GardsStations implements Serializable {
@TableField(value = "STATION_ID")
private Integer stationId;
@TableField(value = "STATION_CODE")
private String stationCode;
@TableField(value = "COUNTRY_CODE")
private String countryCode;
@TableField(value = "TYPE")
private String type;
@TableField(value = "LON")
private Double lon;
@TableField(value = "LAT")
private Double lat;
@TableField(value = "ELEVATION")
private Double elevation;
@TableField(value = "DESCRIPTION")
private String description;
@TableField(value = "DATE_BEGIN")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date dateBegin;
@TableField(value = "DATE_END")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date dateEnd;
@TableField(value = "STATUS")
private String status;
@TableField(value = "MODDATE")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date moddate;
}