完善监测点结果、设备结果
This commit is contained in:
@@ -2,9 +2,7 @@ package com.njcn.gather.storage.service;
|
||||
|
||||
import com.njcn.db.mybatisplus.service.IReplenishMybatisService;
|
||||
import com.njcn.gather.storage.pojo.po.BaseResult;
|
||||
import com.njcn.gather.storage.pojo.po.ContrastNonHarmonicResult;
|
||||
import com.njcn.gather.storage.pojo.po.SimAndDigHarmonicResult;
|
||||
import com.njcn.gather.storage.pojo.po.SimAndDigNonHarmonicResult;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -12,14 +10,13 @@ import java.util.Map;
|
||||
public interface DetectionDataDealService extends IReplenishMybatisService<SimAndDigHarmonicResult> {
|
||||
|
||||
|
||||
Boolean acceptNonHarmonic(List<? extends BaseResult> nonHarmonicResultList, String code);
|
||||
|
||||
Boolean acceptNonHarmonic(List<? extends BaseResult> nonHarmonicResultList,String code);
|
||||
|
||||
Boolean acceptHarmonic(List<? extends BaseResult> harmonicResultList,String code);
|
||||
Boolean acceptHarmonic(List<? extends BaseResult> harmonicResultList, String code);
|
||||
|
||||
Boolean acceptNonHarmonicResult(List<? extends BaseResult> nonHarmonicResultList, String code);
|
||||
|
||||
Boolean acceptHarmonicResult(List<? extends BaseResult> SimAndDigHarmonicResultList,String code);
|
||||
Boolean acceptHarmonicResult(List<? extends BaseResult> SimAndDigHarmonicResultList, String code);
|
||||
|
||||
/**
|
||||
* 根据终端id查询终端所有监测项目是否合格
|
||||
@@ -30,5 +27,18 @@ public interface DetectionDataDealService extends IReplenishMybatisService<SimAn
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
Map<String,Integer> devResult(boolean isContrast,List<String> ids,List<String> adType,String code);
|
||||
Map<String, Integer> devResult(boolean isContrast, List<String> ids, List<String> adType, String code);
|
||||
|
||||
/**
|
||||
* 获取检测点的检测结果
|
||||
*
|
||||
* @param monitorId
|
||||
* @param adTypes
|
||||
* @param dataSource
|
||||
* @param num
|
||||
* @param waveNum
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
Integer getMonitorResult(String monitorId, List<String> adTypes, String dataSource, Integer num, Integer waveNum, String code);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.gather.storage.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler;
|
||||
import com.njcn.db.mybatisplus.service.impl.ReplenishMybatisServiceImpl;
|
||||
@@ -206,19 +207,50 @@ public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl<Detect
|
||||
Map<String, List<Integer>> harmMap = harm.stream().collect(Collectors.groupingBy(x -> x.getDevMonitorId().split("_")[0],
|
||||
Collectors.mapping(BaseResult::getResultFlag, Collectors.toList())));
|
||||
for (String id : ids) {
|
||||
String s = id.split("_")[0];
|
||||
List<Integer> resultFlags = new ArrayList<>();
|
||||
if (noHarmMap.containsKey(id)) {
|
||||
resultFlags.addAll(noHarmMap.get(id));
|
||||
if (noHarmMap.containsKey(s)) {
|
||||
resultFlags.addAll(noHarmMap.get(s));
|
||||
}
|
||||
if (harmMap.containsKey(id)) {
|
||||
resultFlags.addAll(harmMap.get(id));
|
||||
if (harmMap.containsKey(s)) {
|
||||
resultFlags.addAll(harmMap.get(s));
|
||||
}
|
||||
map.put(id, isResultFlag(resultFlags));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
private static Integer isResultFlag(List<Integer> resultFlags) {
|
||||
@Override
|
||||
public Integer getMonitorResult(String monitorId, List<String> adTypes, String dataSource, Integer num, Integer waveNum, String code) {
|
||||
DynamicTableNameHandler.setTableName("ad_non_harmonic_result_" + code);
|
||||
LambdaQueryWrapper<ContrastNonHarmonicResult> wrapper1 = new LambdaQueryWrapper<ContrastNonHarmonicResult>()
|
||||
.like(ContrastNonHarmonicResult::getDevMonitorId, monitorId)
|
||||
.in(CollUtil.isNotEmpty(adTypes), ContrastNonHarmonicResult::getAdType, adTypes)
|
||||
.eq(ContrastNonHarmonicResult::getDataType, dataSource)
|
||||
.eq(ContrastNonHarmonicResult::getNum, num)
|
||||
.eq(ObjectUtil.isNotEmpty(waveNum), ContrastNonHarmonicResult::getWaveNum, waveNum);
|
||||
|
||||
List<ContrastNonHarmonicResult> nonHarmonicResultList = contrastNonHarmonicService.list(wrapper1);
|
||||
DynamicTableNameHandler.remove();
|
||||
|
||||
DynamicTableNameHandler.setTableName("ad_harmonic_result_" + code);
|
||||
LambdaQueryWrapper<ContrastHarmonicResult> wrapper2 = new LambdaQueryWrapper<ContrastHarmonicResult>()
|
||||
.like(ContrastHarmonicResult::getDevMonitorId, monitorId)
|
||||
.in(CollUtil.isNotEmpty(adTypes), ContrastHarmonicResult::getAdType, adTypes)
|
||||
.eq(ContrastHarmonicResult::getDataType, dataSource)
|
||||
.eq(ContrastHarmonicResult::getNum, num)
|
||||
.eq(ObjectUtil.isNotEmpty(waveNum), ContrastHarmonicResult::getWaveNum, waveNum);
|
||||
|
||||
List<ContrastHarmonicResult> harmonicResultList = contrastHarmonicService.list(wrapper2);
|
||||
DynamicTableNameHandler.remove();
|
||||
|
||||
List<Integer> resultFlagList = nonHarmonicResultList.stream().map(ContrastNonHarmonicResult::getResultFlag).collect(Collectors.toList());
|
||||
resultFlagList.addAll(harmonicResultList.stream().map(ContrastHarmonicResult::getResultFlag).collect(Collectors.toList()));
|
||||
|
||||
return isResultFlag(resultFlagList);
|
||||
}
|
||||
|
||||
public static Integer isResultFlag(List<Integer> resultFlags) {
|
||||
// 检测结果(0:不符合 1:符合 2:/[未检测无结果])
|
||||
//脚本结果是 1.符合 2.不符合 4.未检测无结果 5.不参与误差比较
|
||||
resultFlags = resultFlags.stream().filter(x -> 4 != x && 5 != x).distinct().collect(Collectors.toList());
|
||||
|
||||
Reference in New Issue
Block a user