This commit is contained in:
caozehui
2025-05-13 14:41:50 +08:00
parent ebb45238b0
commit ab2e5c346e
6 changed files with 41 additions and 22 deletions

View File

@@ -48,10 +48,9 @@ public interface AdHarmonicService extends IService<AdHarmonicResult> {
* 获取索引
*
* @param param
* @param isExculdePhaseAngle 是否排除电压相角、电流相角
* @return
*/
List<Integer> getIndex(StorageParam param, Boolean isExculdePhaseAngle);
List<Integer> getIndex(StorageParam param);
AdHarmonicResult getSingleResult(SingleNonHarmParam singleNonHarmParam);

View File

@@ -81,7 +81,7 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
List<DictTree> dictTreeById = dictTreeService.getDictTreeById(new ArrayList<>(adMap.keySet()));
Map<String, DictTree> dictTreeByName = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId, Function.identity()));
Map<String, List<RawDataVO>> info = new LinkedHashMap<>(3);
adMap.forEach((ad,value)->{
adMap.forEach((ad, value) -> {
if (dictTreeByName.containsKey(ad)) {
DictTree dictData = dictTreeByName.get(ad);
List<RawDataVO> rawDataVOS = new ArrayList<>();
@@ -147,7 +147,7 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
List<DictTree> dictTreeById = dictTreeService.getDictTreeById(new ArrayList<>(adMap.keySet()));
Map<String, DictTree> dictTreeByName = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId, Function.identity()));
Map<String, List<RawResultDataVO>> info = new LinkedHashMap<>(3);
adMap.forEach((ad,value)->{
adMap.forEach((ad, value) -> {
if (dictTreeByName.containsKey(ad)) {
DictTree dictData = dictTreeByName.get(ad);
List<RawResultDataVO> rawDataVOS = new ArrayList<>();
@@ -201,7 +201,7 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
}
@Override
public List<Integer> getIndex(StorageParam param, Boolean isExculdePhaseAngle) {
public List<Integer> getIndex(StorageParam param) {
String prefix = "ad_harmonic_result_";
String prefixNon = "ad_non_harmonic_result_";
DynamicTableNameHandler.setTableName(prefix + param.getCode());
@@ -211,7 +211,7 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
.ne(AdHarmonicResult::getResultFlag, 1)
.eq(AdHarmonicResult::getScriptId, param.getScriptId());
List<AdHarmonicResult> adHarmonicResultList = this.list(lambdaQueryWrapper);
List<Integer> indexes = new ArrayList<>(adHarmonicResultList.stream().map(AdHarmonicResult::getSort).collect(Collectors.toList()));
List<Integer> indexes = new ArrayList<>(adHarmonicResultList.stream().map(AdHarmonicResult::getSort).distinct().collect(Collectors.toList()));
DynamicTableNameHandler.setTableName(prefixNon + param.getCode());
LambdaQueryWrapper<AdNonHarmonicResult> resultLambdaQueryWrapper = new LambdaQueryWrapper<>();
@@ -219,13 +219,8 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
.likeRight(StrUtil.isNotBlank(param.getDevId()), AdNonHarmonicResult::getMonitorId, param.getDevId())
.ne(AdNonHarmonicResult::getResultFlag, 1)
.eq(AdNonHarmonicResult::getScriptId, param.getScriptId());
;
if (isExculdePhaseAngle) {
List<String> phaseAngleIds = dictTreeMapper.getPhaseAngleIds();
resultLambdaQueryWrapper.notIn(AdNonHarmonicResult::getAdType, phaseAngleIds);
}
List<AdNonHarmonicResult> nonHarmonicResults = adNonHarmonicMapper.selectList(resultLambdaQueryWrapper);
indexes.addAll(nonHarmonicResults.stream().map(AdNonHarmonicResult::getSort).collect(Collectors.toList()));
indexes.addAll(nonHarmonicResults.stream().map(AdNonHarmonicResult::getSort).distinct().collect(Collectors.toList()));
DynamicTableNameHandler.remove();
return indexes;
}