解决暂态测试项,icd分项和不分项功能优化
This commit is contained in:
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -23,7 +24,6 @@ import com.njcn.gather.storage.service.AdHarmonicService;
|
||||
import com.njcn.gather.system.dictionary.mapper.DictTreeMapper;
|
||||
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -43,7 +43,6 @@ import java.util.stream.Collectors;
|
||||
public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarmonicResult> implements AdHarmonicService {
|
||||
|
||||
private final AdNonHarmonicMapper adNonHarmonicMapper;
|
||||
private final IDictDataService dictDataService;
|
||||
private final DictTreeMapper dictTreeMapper;
|
||||
|
||||
@Override
|
||||
@@ -101,15 +100,15 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
|
||||
|
||||
Field fieldA = harmonicResult.getClass().getDeclaredField("aValue" + isHarmOrInHarm(i).intValue());
|
||||
fieldA.setAccessible(true);
|
||||
dataVO.setDataA(ObjectUtil.isNotNull(fieldA.get(harmonicResult)) ? new BigDecimal(fieldA.get(harmonicResult) + "").toPlainString() : null);
|
||||
dataVO.setDataA(StrUtil.isNotBlank(fieldA.get(harmonicResult) + "") ? new BigDecimal(fieldA.get(harmonicResult) + "").toPlainString() : null);
|
||||
|
||||
Field fieldB = harmonicResult.getClass().getDeclaredField("bValue" + isHarmOrInHarm(i).intValue());
|
||||
fieldB.setAccessible(true);
|
||||
dataVO.setDataB(ObjectUtil.isNotNull(fieldB.get(harmonicResult)) ? new BigDecimal(fieldB.get(harmonicResult) + "").toPlainString() : null);
|
||||
dataVO.setDataB(StrUtil.isNotBlank(fieldB.get(harmonicResult) + "") ? new BigDecimal(fieldB.get(harmonicResult) + "").toPlainString() : null);
|
||||
|
||||
Field fieldC = harmonicResult.getClass().getDeclaredField("cValue" + isHarmOrInHarm(i).intValue());
|
||||
fieldC.setAccessible(true);
|
||||
dataVO.setDataC(ObjectUtil.isNotNull(fieldC.get(harmonicResult)) ? new BigDecimal(fieldC.get(harmonicResult) + "").toPlainString() : null);
|
||||
dataVO.setDataC(StrUtil.isNotBlank(fieldC.get(harmonicResult) + "") ? new BigDecimal(fieldC.get(harmonicResult) + "").toPlainString() : null);
|
||||
} catch (NoSuchFieldException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
@@ -251,10 +250,10 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
|
||||
|
||||
private Integer setResultFlag(List<RawResultDataVO.DetectionData> numbers) {
|
||||
List<Integer> isData = numbers.stream().filter(Objects::nonNull)
|
||||
.filter(x -> ObjectUtil.isNotNull(x.getData()))
|
||||
.map(RawResultDataVO.DetectionData::getIsData)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
.filter(x -> ObjectUtil.isNotNull(x.getData()))
|
||||
.map(RawResultDataVO.DetectionData::getIsData)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
return getInteger(isData);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
@@ -24,10 +25,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -77,12 +75,12 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
|
||||
List<RawDataVO> rawDataVOS = new ArrayList<>();
|
||||
for (AdNonHarmonicResult result : value) {
|
||||
RawDataVO dataVO = new RawDataVO();
|
||||
dataVO.setUnit(unit(dictTree.getCode()));
|
||||
dataVO.setUnit(dictTree.getCode().equals("MAG")?"%":unit(dictTree.getCode()));
|
||||
dataVO.setTime(result.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
|
||||
dataVO.setDataA(ObjectUtil.isNotNull(result.getAValue()) ? new BigDecimal(result.getAValue()).toPlainString() : null);
|
||||
dataVO.setDataB(ObjectUtil.isNotNull(result.getBValue()) ? new BigDecimal(result.getBValue()).toPlainString() : null);
|
||||
dataVO.setDataC(ObjectUtil.isNotNull(result.getCValue()) ? new BigDecimal(result.getCValue()).toPlainString() : null);
|
||||
dataVO.setDataT(ObjectUtil.isNotNull(result.getTValue()) ? new BigDecimal(result.getTValue()).toPlainString() : null);
|
||||
dataVO.setDataA(StrUtil.isNotBlank(result.getAValue()) ? new BigDecimal(result.getAValue()).toPlainString() : null);
|
||||
dataVO.setDataB(StrUtil.isNotBlank(result.getBValue()) ? new BigDecimal(result.getBValue()).toPlainString() : null);
|
||||
dataVO.setDataC(StrUtil.isNotBlank(result.getCValue()) ? new BigDecimal(result.getCValue()).toPlainString() : null);
|
||||
dataVO.setDataT(StrUtil.isNotBlank(result.getTValue()) ? new BigDecimal(result.getTValue()).toPlainString() : null);
|
||||
rawDataVOS.add(dataVO);
|
||||
}
|
||||
info.put(dictTree.getName(), rawDataVOS);
|
||||
@@ -104,11 +102,11 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
|
||||
List<AdNonHarmonicResult> adHarmonicResults = this.getBaseMapper().selectJoinList(AdNonHarmonicResult.class, wrapper);
|
||||
|
||||
Map<String, RawResultDataVO> info = new LinkedHashMap<>(2);
|
||||
Map<String, AdNonHarmonicResult> adTypeMap = adHarmonicResults.stream().collect(Collectors.toMap(AdNonHarmonicResult::getAdType, Function.identity()));
|
||||
Map<String, AdNonHarmonicResult> adTypeMap = adHarmonicResults.stream()
|
||||
.sorted(Comparator.comparing(AdNonHarmonicResult::getResultFlag))
|
||||
.collect(Collectors.toMap(AdNonHarmonicResult::getAdType, Function.identity(), (a, b) -> a, LinkedHashMap::new));
|
||||
List<DictTree> dictTreeById = dictTreeService.getDictTreeById(new ArrayList<>(adTypeMap.keySet()));
|
||||
|
||||
Map<String, DictTree> dictTreeByName = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId, Function.identity()));
|
||||
|
||||
adTypeMap.forEach((key, result) -> {
|
||||
if (dictTreeByName.containsKey(key)) {
|
||||
DictTree treeName = dictTreeByName.get(key);
|
||||
@@ -234,7 +232,7 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
|
||||
* 暂态-电压幅值
|
||||
*/
|
||||
case "MAG":
|
||||
unit = "%";
|
||||
unit = "V";
|
||||
break;
|
||||
/**
|
||||
* 暂态-持续时间
|
||||
|
||||
Reference in New Issue
Block a user