修改样品统计分析模块返回数据排序
This commit is contained in:
parent
b2a591e366
commit
45922fe814
|
|
@ -220,13 +220,28 @@ public class SampleStatAnalysisService extends ServiceImpl<GardsSampleStatAnalys
|
|||
Map<String, List<NuclideActConcIntvl>> groupedByNuclideName = nuclideActConcIntvlList.stream()
|
||||
.filter(p -> p.getNuclideName() != null)
|
||||
.collect(Collectors.groupingBy(NuclideActConcIntvl::getNuclideName));
|
||||
|
||||
Map<String, List<NuclideActConcIntvl>> sortedByCount = groupedByNuclideName.entrySet().stream()
|
||||
.sorted(Map.Entry.<String, List<NuclideActConcIntvl>>comparingByValue(
|
||||
Comparator.comparingInt(List::size)
|
||||
).reversed()) // .reversed() 表示从多到少
|
||||
.collect(Collectors.toMap(
|
||||
Map.Entry::getKey,
|
||||
Map.Entry::getValue,
|
||||
(e1, e2) -> e1,
|
||||
LinkedHashMap::new // 使用 LinkedHashMap
|
||||
));
|
||||
|
||||
|
||||
|
||||
//查询级别 getSample
|
||||
List<String> nuclideNames = new ArrayList<>(groupedByNuclideName.keySet());
|
||||
if (CollectionUtils.isNotEmpty(nuclideNames)) {
|
||||
//通过台站ID、核素名称查找阈值
|
||||
thresholdResultHisDataList = this.baseMapper.selectByStationAndNuclides(schemaName, Integer.valueOf(stationCode), nuclideNames, startTime, endTime);
|
||||
}
|
||||
resultMap.put("nuclideActConcIntvlList", groupedByNuclideName);
|
||||
// resultMap.put("nuclideActConcIntvlList", groupedByNuclideName);
|
||||
resultMap.put("nuclideActConcIntvlList", sortedByCount);
|
||||
resultMap.put("sampleLevelDataList", sampleLevelDataList);
|
||||
resultMap.put("thresholdResultHisDataList", thresholdResultHisDataList);
|
||||
result.setSuccess(true);
|
||||
|
|
@ -239,6 +254,7 @@ public class SampleStatAnalysisService extends ServiceImpl<GardsSampleStatAnalys
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取指定时间范围内的样品等级
|
||||
*
|
||||
|
|
@ -567,7 +583,11 @@ public class SampleStatAnalysisService extends ServiceImpl<GardsSampleStatAnalys
|
|||
.collect(Collectors.groupingBy(NuclideActConcIntvl::getStationCode));
|
||||
|
||||
int colorIndex = 0;
|
||||
//TODO
|
||||
Random rand = new Random();
|
||||
|
||||
double min = 100.0;
|
||||
double max = 2000.0;
|
||||
|
||||
for (Map.Entry<String, List<NuclideActConcIntvl>> entry : groupByStation.entrySet()) {
|
||||
String displayCode = entry.getKey();
|
||||
|
|
@ -606,6 +626,8 @@ public class SampleStatAnalysisService extends ServiceImpl<GardsSampleStatAnalys
|
|||
// 检测值 + 误差条
|
||||
Double conc = r.getConc();
|
||||
Double err = r.getConcErr();
|
||||
//TODO
|
||||
//Double err =Math.round(min + (max - min) * rand.nextDouble() * 1000000.0) / 1000000.0;
|
||||
if (conc != null && err != null) {
|
||||
double low = Math.max(conc - err, 0.01);
|
||||
double high = conc + err;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user