|
|
@@ -1,6 +1,5 @@
|
|
|
package com.energy.manage.analyse.service.anomaly.impl;
|
|
|
|
|
|
-
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|
|
@@ -12,13 +11,16 @@ import com.energy.manage.analyse.domain.dto.AnomalyDTO;
|
|
|
import com.energy.manage.analyse.domain.dto.AnomalyModelDTO;
|
|
|
import com.energy.manage.analyse.domain.vo.anomaly.*;
|
|
|
import com.energy.manage.analyse.domain.vo.healthscores.HealthOverviewListVO;
|
|
|
+import com.energy.manage.analyse.domain.vo.healthscores.HealthscoresRegionVO;
|
|
|
import com.energy.manage.analyse.domain.vo.healthscores.HealthscoresWindVO;
|
|
|
import com.energy.manage.analyse.mappers.anomaly.AnomalyWindfarmMapper;
|
|
|
import com.energy.manage.analyse.mappers.windenginegroup.WindEngineGroupMapper;
|
|
|
import com.energy.manage.analyse.mappers.windfield.WindFieldMapper;
|
|
|
+import com.energy.manage.analyse.mappers.windrelation.WindRelationMapper;
|
|
|
import com.energy.manage.analyse.po.anomaly.*;
|
|
|
import com.energy.manage.analyse.po.windenginegroup.WindEngineGroupPO;
|
|
|
import com.energy.manage.analyse.po.windfield.WindFieldPO;
|
|
|
+import com.energy.manage.analyse.po.windrelation.WindRelationPO;
|
|
|
import com.energy.manage.analyse.service.anomaly.AnomalyService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@@ -47,6 +49,9 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
@Autowired
|
|
|
private WindEngineGroupMapper windEngineGroupMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private WindRelationMapper relationMapper;
|
|
|
+
|
|
|
// 通用日期格式化器(线程安全,可全局复用)
|
|
|
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
|
|
@@ -55,6 +60,101 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
// 分表前缀
|
|
|
private static final String TABLE_PREFIX = "analyse.anomaly_model_";
|
|
|
|
|
|
+ /**
|
|
|
+ * @param fids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<WindFieldPO> getWindFieldList(Set<String> fCodes) {
|
|
|
+ // 清除当前
|
|
|
+ DynamicDataSourceContextHolder.poll();
|
|
|
+ // 切换数据源
|
|
|
+ DynamicDataSourceContextHolder.push("master");
|
|
|
+ // 查询平台风机模块
|
|
|
+ Example example = new Example(WindFieldPO.class);
|
|
|
+ Example.Criteria criteria = example.createCriteria();
|
|
|
+ criteria.andIn("fieldCode", fCodes);
|
|
|
+ return windFieldMapper.selectByExample(example);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询区域异常情况信息集合
|
|
|
+ *
|
|
|
+ * @param companyCode
|
|
|
+ * @param datatime
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<AnomalyRegionVO> getAnomalyRegionList(String companyCode, String datatime) {
|
|
|
+ String beginTime = null;
|
|
|
+ String endTime = null;
|
|
|
+ if (!StringUtils.isEmpty(datatime)) {
|
|
|
+ beginTime = appendTimeToString(datatime, 00, 00, 00);
|
|
|
+ endTime = appendTimeToString(datatime, 23, 59, 59);
|
|
|
+ } else {
|
|
|
+ beginTime = getYesterdayStartStr();
|
|
|
+ endTime = getYesterdayEnd().format(DATETIME_FORMATTER);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 清除当前
|
|
|
+ DynamicDataSourceContextHolder.poll();
|
|
|
+
|
|
|
+ // 切换数据源
|
|
|
+ DynamicDataSourceContextHolder.push("master");
|
|
|
+
|
|
|
+ List<WindRelationPO> companyPos = relationMapper.selectByCodeNumber(Arrays.asList(companyCode), "company");
|
|
|
+
|
|
|
+ List<WindRelationPO> fieldPOs = null;
|
|
|
+ List<WindRelationPO> companys = null;
|
|
|
+
|
|
|
+ if (CollectionUtil.isEmpty(companyPos)) {
|
|
|
+ fieldPOs = relationMapper.selectByCodeNumber(Arrays.asList(companyCode), "field");
|
|
|
+ WindRelationPO po = new WindRelationPO();
|
|
|
+ po.setCodeNumber(companyCode);
|
|
|
+ companys = Arrays.asList(relationMapper.selectOne(po));
|
|
|
+ } else {
|
|
|
+ List<String> companyCodes = companyPos.parallelStream().map(WindRelationPO::getCodeNumber)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ fieldPOs = relationMapper.selectByCodeNumber(companyCodes, "field");
|
|
|
+ companys = companyPos;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CollectionUtil.isEmpty(fieldPOs)) {
|
|
|
+ // warn: 没有查询到对应的风场信息,可能是风场编号错误或数据库中没有该风场记录
|
|
|
+ log.warn("没有查询到对应的风场信息,可能是风场编号错误或数据库中没有该风场记录,companyCode: {}", companyCode);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ Set<String> fieldCodes = fieldPOs.parallelStream().map(WindRelationPO::getCodeNumber)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ List<WindFieldPO> fieldList = getWindFieldList(fieldCodes);
|
|
|
+
|
|
|
+ // 切换数据源
|
|
|
+ DynamicDataSourceContextHolder.push("slave");
|
|
|
+
|
|
|
+ List<AnomalyRegionVO> list = new ArrayList<>();
|
|
|
+
|
|
|
+ for (WindRelationPO company : companys) {
|
|
|
+ List<String> fieldIds = fieldList.stream()
|
|
|
+ .filter(field -> field.getCompanyCode().equals(company.getCodeNumber()))
|
|
|
+ .map(WindFieldPO::getFieldId).collect(Collectors.toList());
|
|
|
+ log.info("查询公司编号: {}, 对应的风场ID集合: {}", company.getCodeNumber(), fieldIds);
|
|
|
+ AnomalyRegionVO regionAnomalyRegionVO = anomalyWindfarmMapper.getAnomalyListByFieldIds(fieldIds, beginTime, endTime);
|
|
|
+
|
|
|
+ if (regionAnomalyRegionVO == null) {
|
|
|
+ log.warn("没有查询到对应的异常情况信息,可能是时间范围内没有数据,companyCode: {}, beginTime: {}, endTime: {}", companyCode,
|
|
|
+ beginTime, endTime);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ regionAnomalyRegionVO.setCompanyCode(company.getCodeNumber());
|
|
|
+ regionAnomalyRegionVO.setCompanyName(company.getCodeName());
|
|
|
+ list.add(regionAnomalyRegionVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ return list;
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public List<AnomalyOverviewVO> getAnomalyOverview(AnomalyDTO anomalyDTO) {
|
|
|
@@ -80,16 +180,18 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
// 切换数据源
|
|
|
DynamicDataSourceContextHolder.push("slave");
|
|
|
|
|
|
- List<AnomalyOverviewVO> anomalyOverviewVOList = anomalyWindfarmMapper.selectAnomalyWindfarmAndFieldId(fieldId, beginTime, endTime);
|
|
|
- if(CollectionUtil.isEmpty(anomalyOverviewVOList)){
|
|
|
+ List<AnomalyOverviewVO> anomalyOverviewVOList = anomalyWindfarmMapper.selectAnomalyWindfarmAndFieldId(fieldId,
|
|
|
+ beginTime, endTime);
|
|
|
+ if (CollectionUtil.isEmpty(anomalyOverviewVOList)) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- Set<String> fids = anomalyOverviewVOList.parallelStream().map(AnomalyOverviewVO::getFieldId).collect(Collectors.toSet());
|
|
|
+ Set<String> fids = anomalyOverviewVOList.parallelStream().map(AnomalyOverviewVO::getFieldId)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
List<WindFieldPO> fList = getWindFGroupList(fids);
|
|
|
- for(AnomalyOverviewVO vo : anomalyOverviewVOList){
|
|
|
- for(WindFieldPO po : fList){
|
|
|
- if(vo.getFieldId().equals(po.getFieldId())){
|
|
|
+ for (AnomalyOverviewVO vo : anomalyOverviewVOList) {
|
|
|
+ for (WindFieldPO po : fList) {
|
|
|
+ if (vo.getFieldId().equals(po.getFieldId())) {
|
|
|
vo.setFieldName(po.getFieldName());
|
|
|
vo.setFieldCode(po.getFieldCode());
|
|
|
}
|
|
|
@@ -111,7 +213,7 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
Example example = new Example(WindFieldPO.class);
|
|
|
Example.Criteria criteria = example.createCriteria();
|
|
|
criteria.andIn("fieldId", fids);
|
|
|
- return windFieldMapper.selectByExample(example);
|
|
|
+ return windFieldMapper.selectByExample(example);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -136,6 +238,7 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
|
|
|
/**
|
|
|
* 查询风机对象集合
|
|
|
+ *
|
|
|
* @param eids
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -148,19 +251,17 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
Example example = new Example(WindEngineGroupPO.class);
|
|
|
Example.Criteria criteria = example.createCriteria();
|
|
|
criteria.andIn("engineId", eids);
|
|
|
- List<WindEngineGroupPO> list = windEngineGroupMapper.selectByExample(example);
|
|
|
+ List<WindEngineGroupPO> list = windEngineGroupMapper.selectByExample(example);
|
|
|
// key为String时
|
|
|
Map<String, String> windEngineMap = list.stream()
|
|
|
.collect(Collectors.toMap(
|
|
|
WindEngineGroupPO::getEngineId,
|
|
|
WindEngineGroupPO::getEngineName,
|
|
|
- (oldValue, newValue) -> oldValue
|
|
|
- ));
|
|
|
+ (oldValue, newValue) -> oldValue));
|
|
|
|
|
|
return windEngineMap;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public BarChartVO getBarChartStats(AnomalyDTO anomalyDTO) {
|
|
|
|
|
|
@@ -193,7 +294,6 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
return anomalyWindfarmMapper.selectAnomalyModelCount(fieldId, year, beginTime, endTime);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public List<AnomalyModelVO> getAnomalyModel(AnomalyDTO anomalyDTO) {
|
|
|
|
|
|
@@ -224,7 +324,8 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
// 切换数据源
|
|
|
DynamicDataSourceContextHolder.push("slave");
|
|
|
- List<AnomalyModelPO> getAnomalyModelList = anomalyWindfarmMapper.selectAllAnomalyModel(fieldId, year, beginTime, endTime);
|
|
|
+ List<AnomalyModelPO> getAnomalyModelList = anomalyWindfarmMapper.selectAllAnomalyModel(fieldId, year, beginTime,
|
|
|
+ endTime);
|
|
|
if (CollectionUtil.isEmpty(getAnomalyModelList)) {
|
|
|
return null;
|
|
|
}
|
|
|
@@ -235,13 +336,12 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
.map(source -> BeanUtil.copyProperties(source, AnomalyModelVO.class))
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- Set<String> eids = anomalyModelVOS.parallelStream().map(AnomalyModelVO::getEngineId).collect(Collectors.toSet());
|
|
|
+ Set<String> eids = anomalyModelVOS.parallelStream().map(AnomalyModelVO::getEngineId)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
List<WindEngineGroupPO> list = getWindEngineGroupList(eids);
|
|
|
- for(AnomalyModelVO vo : anomalyModelVOS){
|
|
|
- for(WindEngineGroupPO po : list){
|
|
|
- if(vo.getEngineId().equals(po.getEngineId())){
|
|
|
+ for (AnomalyModelVO vo : anomalyModelVOS) {
|
|
|
+ for (WindEngineGroupPO po : list) {
|
|
|
+ if (vo.getEngineId().equals(po.getEngineId())) {
|
|
|
vo.setEngineName(po.getEngineName());
|
|
|
}
|
|
|
}
|
|
|
@@ -252,6 +352,7 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
|
|
|
/**
|
|
|
* 查询风机对象集合
|
|
|
+ *
|
|
|
* @param eids
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -264,11 +365,11 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
Example example = new Example(WindEngineGroupPO.class);
|
|
|
Example.Criteria criteria = example.createCriteria();
|
|
|
criteria.andIn("engineId", eids);
|
|
|
- return windEngineGroupMapper.selectByExample(example);
|
|
|
+ return windEngineGroupMapper.selectByExample(example);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AnomalyChartVO getAnomalyModelMap(AnomalyDTO anomalyDTO){
|
|
|
+ public AnomalyChartVO getAnomalyModelMap(AnomalyDTO anomalyDTO) {
|
|
|
|
|
|
AnomalyChartVO anomalyChartVO = new AnomalyChartVO();
|
|
|
String fieldId = null;
|
|
|
@@ -297,17 +398,21 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
// 切换数据源
|
|
|
DynamicDataSourceContextHolder.push("slave");
|
|
|
- List<AnomalyModelPO> getAnomalyModelList = anomalyWindfarmMapper.selectAllAnomalyModel(fieldId, year, beginTime, endTime);
|
|
|
+ List<AnomalyModelPO> getAnomalyModelList = anomalyWindfarmMapper.selectAllAnomalyModel(fieldId, year, beginTime,
|
|
|
+ endTime);
|
|
|
if (CollectionUtil.isEmpty(getAnomalyModelList)) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
// 获取风机id集合
|
|
|
- Set<String> eids = getAnomalyModelList.parallelStream().map(AnomalyModelPO::getEngineId).collect(Collectors.toSet());
|
|
|
- Map<String, String> engineMap = getWindEngineGroupMap(eids);
|
|
|
+ Set<String> eids = getAnomalyModelList.parallelStream().map(AnomalyModelPO::getEngineId)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ Map<String, String> engineMap = getWindEngineGroupMap(eids);
|
|
|
|
|
|
- Map<String, List<AnomalyThermodynamicDiagramVO>> anomalyChartMap = getAnomalyThermodynamicDiagramMap(getAnomalyModelList,engineMap);
|
|
|
- Map<String, List<AnomalyThermodynamicDiagramVO>> anomalySensorMap = getAnomalySensorMap(getAnomalyModelList,engineMap);
|
|
|
+ Map<String, List<AnomalyThermodynamicDiagramVO>> anomalyChartMap = getAnomalyThermodynamicDiagramMap(
|
|
|
+ getAnomalyModelList, engineMap);
|
|
|
+ Map<String, List<AnomalyThermodynamicDiagramVO>> anomalySensorMap = getAnomalySensorMap(getAnomalyModelList,
|
|
|
+ engineMap);
|
|
|
|
|
|
anomalyChartVO.setAnomalyChartMap(anomalyChartMap);
|
|
|
anomalyChartVO.setAnomalySensorMap(anomalySensorMap);
|
|
|
@@ -315,20 +420,21 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
return anomalyChartVO;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 整合数据检测器map
|
|
|
+ *
|
|
|
* @param getAnomalyModelList
|
|
|
* @param engineMap
|
|
|
* @return
|
|
|
*/
|
|
|
- private Map<String, List<AnomalyThermodynamicDiagramVO>> getAnomalyThermodynamicDiagramMap(List<AnomalyModelPO> getAnomalyModelList,Map<String, String> engineMap){
|
|
|
+ private Map<String, List<AnomalyThermodynamicDiagramVO>> getAnomalyThermodynamicDiagramMap(
|
|
|
+ List<AnomalyModelPO> getAnomalyModelList, Map<String, String> engineMap) {
|
|
|
|
|
|
Map<String, List<AnomalyThermodynamicDiagramVO>> map = new HashMap<>();
|
|
|
// 模块1:风速功率检测器
|
|
|
List<AnomalyThermodynamicDiagramVO> model1PowercurveList = new ArrayList<>();
|
|
|
List<AnomalyThermodynamicDiagramVO> model1ScatterList = new ArrayList<>();
|
|
|
-// List<AnomalyThermodynamicDiagramVO> model1SimulinkList = new ArrayList<>();
|
|
|
+ // List<AnomalyThermodynamicDiagramVO> model1SimulinkList = new ArrayList<>();
|
|
|
|
|
|
// 模块2:偏航检测器
|
|
|
List<AnomalyThermodynamicDiagramVO> model2StaticyawList = new ArrayList<>();
|
|
|
@@ -337,7 +443,7 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
// 模块3:变桨检测器
|
|
|
List<AnomalyThermodynamicDiagramVO> model3PitchregulationList = new ArrayList<>();
|
|
|
List<AnomalyThermodynamicDiagramVO> model3PitchcoordList = new ArrayList<>();
|
|
|
-// List<AnomalyThermodynamicDiagramVO> model3MinpitchList = new ArrayList<>();
|
|
|
+ // List<AnomalyThermodynamicDiagramVO> model3MinpitchList = new ArrayList<>();
|
|
|
|
|
|
// 模块4:运行状态检测器
|
|
|
List<AnomalyThermodynamicDiagramVO> model4PowerqualityList = new ArrayList<>();
|
|
|
@@ -349,18 +455,17 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
List<AnomalyThermodynamicDiagramVO> model5TSRList = new ArrayList<>();
|
|
|
List<AnomalyThermodynamicDiagramVO> model5CPTSRList = new ArrayList<>();
|
|
|
|
|
|
-
|
|
|
// 模块1:风速功率检测器
|
|
|
AnomalyThermodynamicDiagramVO model1Powercurve = null;
|
|
|
AnomalyThermodynamicDiagramVO model1Scatter = null;
|
|
|
-// AnomalyThermodynamicDiagramVO model1Simulink = null;
|
|
|
+ // AnomalyThermodynamicDiagramVO model1Simulink = null;
|
|
|
// 模块2:偏航检测器
|
|
|
AnomalyThermodynamicDiagramVO model2Staticyaw = null;
|
|
|
- AnomalyThermodynamicDiagramVO model2Cabletwist = null;
|
|
|
+ AnomalyThermodynamicDiagramVO model2Cabletwist = null;
|
|
|
// 模块3:变桨检测器
|
|
|
AnomalyThermodynamicDiagramVO model3Pitchregulation = null;
|
|
|
AnomalyThermodynamicDiagramVO model3Pitchcoord = null;
|
|
|
-// AnomalyThermodynamicDiagramVO model3Minpitch = null;
|
|
|
+ // AnomalyThermodynamicDiagramVO model3Minpitch = null;
|
|
|
// 模块4:运行状态检测器
|
|
|
AnomalyThermodynamicDiagramVO model4Powerquality = null;
|
|
|
AnomalyThermodynamicDiagramVO model4Operationstate = null;
|
|
|
@@ -385,10 +490,10 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
model1Scatter.setRatio(anomalyModelPO.getModel1WindpwrScatterRatio());
|
|
|
model1ScatterList.add(model1Scatter);
|
|
|
|
|
|
-// model1Simulink = new AnomalyThermodynamicDiagramVO();
|
|
|
-// model1Simulink.setEngineName(engineMap.get(anomalyModelPO.getEngineId()));
|
|
|
-// model1Simulink.setIfAbnorma(anomalyModelPO.getModel1WindpwrSimulink());
|
|
|
-// model1SimulinkList.add(model1Simulink);
|
|
|
+ // model1Simulink = new AnomalyThermodynamicDiagramVO();
|
|
|
+ // model1Simulink.setEngineName(engineMap.get(anomalyModelPO.getEngineId()));
|
|
|
+ // model1Simulink.setIfAbnorma(anomalyModelPO.getModel1WindpwrSimulink());
|
|
|
+ // model1SimulinkList.add(model1Simulink);
|
|
|
|
|
|
// 模块2:偏航检测器
|
|
|
model2Staticyaw = new AnomalyThermodynamicDiagramVO();
|
|
|
@@ -416,10 +521,10 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
model3Pitchcoord.setRatio(anomalyModelPO.getModel3PitchPitchcoordRatio());
|
|
|
model3PitchcoordList.add(model3Pitchcoord);
|
|
|
|
|
|
-// model3Minpitch = new AnomalyThermodynamicDiagramVO();
|
|
|
-// model3Minpitch.setEngineName(engineMap.get(anomalyModelPO.getEngineId()));
|
|
|
-// model3Minpitch.setIfAbnorma(anomalyModelPO.getModel3PitchMinpitch());
|
|
|
-// model3MinpitchList.add(model3Minpitch);
|
|
|
+ // model3Minpitch = new AnomalyThermodynamicDiagramVO();
|
|
|
+ // model3Minpitch.setEngineName(engineMap.get(anomalyModelPO.getEngineId()));
|
|
|
+ // model3Minpitch.setIfAbnorma(anomalyModelPO.getModel3PitchMinpitch());
|
|
|
+ // model3MinpitchList.add(model3Minpitch);
|
|
|
|
|
|
// 模块4:运行状态检测器
|
|
|
model4Powerquality = new AnomalyThermodynamicDiagramVO();
|
|
|
@@ -457,30 +562,30 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
|
|
|
}
|
|
|
// 模块1:风速功率检测器
|
|
|
- map.put(DetectorType.MODEL1_POWERCURVE.getCode(),model1PowercurveList);
|
|
|
- map.put(DetectorType.MODEL1_SCATTER.getCode(),model1ScatterList);
|
|
|
-// map.put(DetectorType.MODEL1_SIMULINK.getCode(),model1SimulinkList);
|
|
|
+ map.put(DetectorType.MODEL1_POWERCURVE.getCode(), model1PowercurveList);
|
|
|
+ map.put(DetectorType.MODEL1_SCATTER.getCode(), model1ScatterList);
|
|
|
+ // map.put(DetectorType.MODEL1_SIMULINK.getCode(),model1SimulinkList);
|
|
|
// 模块2:偏航检测器
|
|
|
- map.put(DetectorType.MODEL2_STATICYAW.getCode(),model2StaticyawList);
|
|
|
- map.put(DetectorType.MODEL2_CABLETWIST.getCode(),model2CabletwistList);
|
|
|
+ map.put(DetectorType.MODEL2_STATICYAW.getCode(), model2StaticyawList);
|
|
|
+ map.put(DetectorType.MODEL2_CABLETWIST.getCode(), model2CabletwistList);
|
|
|
// 模块3:变桨检测器
|
|
|
- map.put(DetectorType.MODEL3_PITCHREGULATION.getCode(),model3PitchregulationList);
|
|
|
- map.put(DetectorType.MODEL3_PITCHCOORD.getCode(),model3PitchcoordList);
|
|
|
-// map.put(DetectorType.MODEL3_MINPITCH.getCode(),model3MinpitchList);
|
|
|
+ map.put(DetectorType.MODEL3_PITCHREGULATION.getCode(), model3PitchregulationList);
|
|
|
+ map.put(DetectorType.MODEL3_PITCHCOORD.getCode(), model3PitchcoordList);
|
|
|
+ // map.put(DetectorType.MODEL3_MINPITCH.getCode(),model3MinpitchList);
|
|
|
// 模块4:运行状态检测器
|
|
|
- map.put(DetectorType.MODEL4_POWERQUALITY.getCode(),model4PowerqualityList);
|
|
|
- map.put(DetectorType.MODEL4_OPERATIONSTATE.getCode(),model4OperationstateList);
|
|
|
- map.put(DetectorType.MODEL4_DELOAD.getCode(),model4CtrlparamDeloadList);
|
|
|
+ map.put(DetectorType.MODEL4_POWERQUALITY.getCode(), model4PowerqualityList);
|
|
|
+ map.put(DetectorType.MODEL4_OPERATIONSTATE.getCode(), model4OperationstateList);
|
|
|
+ map.put(DetectorType.MODEL4_DELOAD.getCode(), model4CtrlparamDeloadList);
|
|
|
// 模块5:气动性能
|
|
|
- map.put(DetectorType.MODEL5_CP.getCode(),model5CPList);
|
|
|
- map.put(DetectorType.MODEL5_TSR.getCode(),model5TSRList);
|
|
|
- map.put(DetectorType.MODEL5_CP_TSR.getCode(),model5CPTSRList);
|
|
|
+ map.put(DetectorType.MODEL5_CP.getCode(), model5CPList);
|
|
|
+ map.put(DetectorType.MODEL5_TSR.getCode(), model5TSRList);
|
|
|
+ map.put(DetectorType.MODEL5_CP_TSR.getCode(), model5CPTSRList);
|
|
|
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- private Map<String, List<AnomalyThermodynamicDiagramVO>> getAnomalySensorMap(List<AnomalyModelPO> getAnomalyModelList,Map<String, String> engineMap){
|
|
|
+ private Map<String, List<AnomalyThermodynamicDiagramVO>> getAnomalySensorMap(
|
|
|
+ List<AnomalyModelPO> getAnomalyModelList, Map<String, String> engineMap) {
|
|
|
|
|
|
Map<String, List<AnomalyThermodynamicDiagramVO>> map = new HashMap<>();
|
|
|
|
|
|
@@ -497,15 +602,14 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
|
|
|
// 物理传感器异常列表
|
|
|
AnomalyThermodynamicDiagramVO powerSensorAnomaly = null;
|
|
|
- AnomalyThermodynamicDiagramVO windSpeedSensorAnomaly = null;
|
|
|
- AnomalyThermodynamicDiagramVO pitchSensorAnomaly = null;
|
|
|
+ AnomalyThermodynamicDiagramVO windSpeedSensorAnomaly = null;
|
|
|
+ AnomalyThermodynamicDiagramVO pitchSensorAnomaly = null;
|
|
|
AnomalyThermodynamicDiagramVO rotationSpeedSensorAnomaly = null;
|
|
|
- AnomalyThermodynamicDiagramVO torqueSensorAnomaly = null;
|
|
|
+ AnomalyThermodynamicDiagramVO torqueSensorAnomaly = null;
|
|
|
|
|
|
// 逻辑关联异常列表
|
|
|
- AnomalyThermodynamicDiagramVO windPowerLogicAnomaly = null;
|
|
|
- AnomalyThermodynamicDiagramVO speedTorqueLogicAnomaly = null;
|
|
|
-
|
|
|
+ AnomalyThermodynamicDiagramVO windPowerLogicAnomaly = null;
|
|
|
+ AnomalyThermodynamicDiagramVO speedTorqueLogicAnomaly = null;
|
|
|
|
|
|
for (AnomalyModelPO anomalyModelPO : getAnomalyModelList) {
|
|
|
|
|
|
@@ -553,20 +657,20 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
|
|
|
}
|
|
|
|
|
|
- map.put(AnomalySensorType.POWER_SENSOR.getFieldName(),powerSensorAnomalyList);
|
|
|
- map.put(AnomalySensorType.WIND_SENSOR.getFieldName(),windSpeedSensorAnomalyList);
|
|
|
- map.put(AnomalySensorType.PITCH_SENSOR.getFieldName(),pitchSensorAnomalyList);
|
|
|
- map.put(AnomalySensorType.SPEED_SENSOR.getFieldName(),rotationSpeedSensorAnomalyList);
|
|
|
- map.put(AnomalySensorType.TORQUE_SENSOR.getFieldName(),torqueSensorAnomalyList);
|
|
|
- map.put(AnomalySensorType.WIND_POWER_LOGIC.getFieldName(),windPowerLogicAnomalyList);
|
|
|
- map.put(AnomalySensorType.SPEED_TORQUE_LOGIC.getFieldName(),speedTorqueLogicAnomalyList);
|
|
|
+ map.put(AnomalySensorType.POWER_SENSOR.getFieldName(), powerSensorAnomalyList);
|
|
|
+ map.put(AnomalySensorType.WIND_SENSOR.getFieldName(), windSpeedSensorAnomalyList);
|
|
|
+ map.put(AnomalySensorType.PITCH_SENSOR.getFieldName(), pitchSensorAnomalyList);
|
|
|
+ map.put(AnomalySensorType.SPEED_SENSOR.getFieldName(), rotationSpeedSensorAnomalyList);
|
|
|
+ map.put(AnomalySensorType.TORQUE_SENSOR.getFieldName(), torqueSensorAnomalyList);
|
|
|
+ map.put(AnomalySensorType.WIND_POWER_LOGIC.getFieldName(), windPowerLogicAnomalyList);
|
|
|
+ map.put(AnomalySensorType.SPEED_TORQUE_LOGIC.getFieldName(), speedTorqueLogicAnomalyList);
|
|
|
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 获取变桨模块异常趋势(支持年度分表+跨年跨表)
|
|
|
+ *
|
|
|
* @param anomalyModelDTO 7/30天
|
|
|
*/
|
|
|
@Override
|
|
|
@@ -577,7 +681,7 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
LocalDate startDate = endDate.minusDays(anomalyModelDTO.getTimeRange() - 1);
|
|
|
|
|
|
// 2. 自动查询:单表 / 跨表
|
|
|
- List<AnomalyDailyVO> dbData = getUnionAnomalyData(startDate, endDate,anomalyModelDTO);
|
|
|
+ List<AnomalyDailyVO> dbData = getUnionAnomalyData(startDate, endDate, anomalyModelDTO);
|
|
|
|
|
|
// 3. 补全缺失日期(图表无断层)
|
|
|
List<AnomalyDailyVO> fullData = fillMissingDate(startDate, endDate, dbData);
|
|
|
@@ -585,7 +689,6 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
return fullData;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public AnomalySensorCountVO getAnomalySensorCount(AnomalyDTO anomalyDTO) {
|
|
|
|
|
|
@@ -615,12 +718,12 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
// 切换数据源
|
|
|
DynamicDataSourceContextHolder.push("slave");
|
|
|
- AnomalySensorCountVO anomalySensorCountVO = anomalyWindfarmMapper.selectAnomalySensorCountVO(fieldId,year,beginTime,endTime);
|
|
|
+ AnomalySensorCountVO anomalySensorCountVO = anomalyWindfarmMapper.selectAnomalySensorCountVO(fieldId, year,
|
|
|
+ beginTime, endTime);
|
|
|
|
|
|
return anomalySensorCountVO;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public AnomalyCount getAnomalyModelCount(AnomalyDTO anomalyDTO) {
|
|
|
|
|
|
@@ -650,17 +753,11 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
// 切换数据源
|
|
|
DynamicDataSourceContextHolder.push("slave");
|
|
|
- AnomalyCount anomalyCount = anomalyWindfarmMapper.selectModeCount(fieldId,year,beginTime,endTime);
|
|
|
+ AnomalyCount anomalyCount = anomalyWindfarmMapper.selectModeCount(fieldId, year, beginTime, endTime);
|
|
|
|
|
|
return anomalyCount;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 核心:自动判断 单表/跨表 查询
|
|
|
*/
|
|
|
@@ -676,7 +773,8 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
// 切换数据源
|
|
|
DynamicDataSourceContextHolder.push("slave");
|
|
|
- return anomalyWindfarmMapper.selectBySingleTable(anomalyModelDTO.getFieldId(),anomalyModelDTO.getEngineId(),
|
|
|
+ return anomalyWindfarmMapper.selectBySingleTable(anomalyModelDTO.getFieldId(),
|
|
|
+ anomalyModelDTO.getEngineId(),
|
|
|
tableName, start.toString(), end.toString());
|
|
|
}
|
|
|
// 场景2:跨年份 → 查询两张分表(UNION ALL)
|
|
|
@@ -688,12 +786,12 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
// 切换数据源
|
|
|
DynamicDataSourceContextHolder.push("slave");
|
|
|
- return anomalyWindfarmMapper.selectByUnionTables(anomalyModelDTO.getFieldId(),anomalyModelDTO.getEngineId(),
|
|
|
- table1,table2, start.toString(), end.toString());
|
|
|
+ return anomalyWindfarmMapper.selectByUnionTables(anomalyModelDTO.getFieldId(),
|
|
|
+ anomalyModelDTO.getEngineId(),
|
|
|
+ table1, table2, start.toString(), end.toString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 补全无数据日期(赋值0)
|
|
|
*/
|
|
|
@@ -702,7 +800,6 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
// 统一使用东八区,和数据库时间对齐,杜绝时区错位
|
|
|
ZoneId zoneId = ZoneId.of("Asia/Shanghai");
|
|
|
|
|
|
-
|
|
|
// Map key:VO的Date统一转东八区LocalDate
|
|
|
Map<LocalDate, AnomalyDailyVO> dataMap = data.stream()
|
|
|
.collect(Collectors.toMap(
|
|
|
@@ -710,8 +807,7 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
.toInstant()
|
|
|
.atZone(zoneId)
|
|
|
.toLocalDate(),
|
|
|
- vo -> vo
|
|
|
- ));
|
|
|
+ vo -> vo));
|
|
|
|
|
|
List<AnomalyDailyVO> result = new ArrayList<>();
|
|
|
|
|
|
@@ -730,14 +826,14 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 风速功率模块模块
|
|
|
+ *
|
|
|
* @param anomalyModelDTO
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public AnomalyWindpwrVO getAnomalyWindpwr(AnomalyModelDTO anomalyModelDTO,boolean isIntranet){
|
|
|
+ public AnomalyWindpwrVO getAnomalyWindpwr(AnomalyModelDTO anomalyModelDTO, boolean isIntranet) {
|
|
|
|
|
|
AnomalyWindpwrVO anomalyWindpwrVO = new AnomalyWindpwrVO();
|
|
|
String beginTime = null;
|
|
|
@@ -756,14 +852,14 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
// 切换数据源
|
|
|
DynamicDataSourceContextHolder.push("slave");
|
|
|
|
|
|
- BaseAnomalyDetectorPO powerPO = anomalyWindfarmMapper.selectAnomalyDetectorAll(anomalyModelDTO.getFieldId(),
|
|
|
+ BaseAnomalyDetectorPO powerPO = anomalyWindfarmMapper.selectAnomalyDetectorAll(anomalyModelDTO.getFieldId(),
|
|
|
DetectorTableEnum.POWER_CURVE.getFullTableName(year),
|
|
|
- anomalyModelDTO.getEngineId(),beginTime,endTime);
|
|
|
+ anomalyModelDTO.getEngineId(), beginTime, endTime);
|
|
|
AnomalyPowercurvePO anomalyPowercurvePO = new AnomalyPowercurvePO();
|
|
|
- BeanUtil.copyProperties(powerPO,anomalyPowercurvePO);
|
|
|
- if(powerPO != null){
|
|
|
- anomalyPowercurvePO.setFilePath(NetUtils.getFilePath(isIntranet,powerPO.getFilePath()));
|
|
|
- anomalyPowercurvePO.setGraphPath(NetUtils.getFilePath(isIntranet,powerPO.getGraphPath()));
|
|
|
+ BeanUtil.copyProperties(powerPO, anomalyPowercurvePO);
|
|
|
+ if (powerPO != null) {
|
|
|
+ anomalyPowercurvePO.setFilePath(NetUtils.getFilePath(isIntranet, powerPO.getFilePath()));
|
|
|
+ anomalyPowercurvePO.setGraphPath(NetUtils.getFilePath(isIntranet, powerPO.getGraphPath()));
|
|
|
anomalyWindpwrVO.setAnomalyPowercurvePO(anomalyPowercurvePO);
|
|
|
}
|
|
|
|
|
|
@@ -771,14 +867,14 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
// 切换数据源
|
|
|
DynamicDataSourceContextHolder.push("slave");
|
|
|
- BaseAnomalyDetectorPO scatterPO = anomalyWindfarmMapper.selectAnomalyDetectorAll(anomalyModelDTO.getFieldId(),
|
|
|
+ BaseAnomalyDetectorPO scatterPO = anomalyWindfarmMapper.selectAnomalyDetectorAll(anomalyModelDTO.getFieldId(),
|
|
|
DetectorTableEnum.SCATTER.getFullTableName(year),
|
|
|
- anomalyModelDTO.getEngineId(),beginTime,endTime);
|
|
|
+ anomalyModelDTO.getEngineId(), beginTime, endTime);
|
|
|
AnomalyScatterPO anomalyScatterPO = new AnomalyScatterPO();
|
|
|
- BeanUtil.copyProperties(scatterPO,anomalyScatterPO);
|
|
|
- if(scatterPO != null){
|
|
|
- anomalyScatterPO.setFilePath(NetUtils.getFilePath(isIntranet,scatterPO.getFilePath()));
|
|
|
- anomalyScatterPO.setGraphPath(NetUtils.getFilePath(isIntranet,scatterPO.getGraphPath()));
|
|
|
+ BeanUtil.copyProperties(scatterPO, anomalyScatterPO);
|
|
|
+ if (scatterPO != null) {
|
|
|
+ anomalyScatterPO.setFilePath(NetUtils.getFilePath(isIntranet, scatterPO.getFilePath()));
|
|
|
+ anomalyScatterPO.setGraphPath(NetUtils.getFilePath(isIntranet, scatterPO.getGraphPath()));
|
|
|
anomalyWindpwrVO.setAnomalyScatterPO(anomalyScatterPO);
|
|
|
}
|
|
|
|
|
|
@@ -786,14 +882,14 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
// 切换数据源
|
|
|
DynamicDataSourceContextHolder.push("slave");
|
|
|
- BaseAnomalyDetectorPO simulinkPO = anomalyWindfarmMapper.selectAnomalyDetectorAll(anomalyModelDTO.getFieldId(),
|
|
|
+ BaseAnomalyDetectorPO simulinkPO = anomalyWindfarmMapper.selectAnomalyDetectorAll(anomalyModelDTO.getFieldId(),
|
|
|
DetectorTableEnum.SIMULINK.getFullTableName(year),
|
|
|
- anomalyModelDTO.getEngineId(),beginTime,endTime);
|
|
|
- AnomalySimulinkPO anomalySimulinkPO = new AnomalySimulinkPO();
|
|
|
- BeanUtil.copyProperties(simulinkPO,anomalySimulinkPO);
|
|
|
- if(simulinkPO != null){
|
|
|
- anomalySimulinkPO.setFilePath(NetUtils.getFilePath(isIntranet,simulinkPO.getFilePath()));
|
|
|
- anomalySimulinkPO.setGraphPath(NetUtils.getFilePath(isIntranet,simulinkPO.getGraphPath()));
|
|
|
+ anomalyModelDTO.getEngineId(), beginTime, endTime);
|
|
|
+ AnomalySimulinkPO anomalySimulinkPO = new AnomalySimulinkPO();
|
|
|
+ BeanUtil.copyProperties(simulinkPO, anomalySimulinkPO);
|
|
|
+ if (simulinkPO != null) {
|
|
|
+ anomalySimulinkPO.setFilePath(NetUtils.getFilePath(isIntranet, simulinkPO.getFilePath()));
|
|
|
+ anomalySimulinkPO.setGraphPath(NetUtils.getFilePath(isIntranet, simulinkPO.getGraphPath()));
|
|
|
anomalyWindpwrVO.setAnomalySimulinkPO(anomalySimulinkPO);
|
|
|
}
|
|
|
return anomalyWindpwrVO;
|
|
|
@@ -801,11 +897,12 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
|
|
|
/**
|
|
|
* 偏航模块模块
|
|
|
+ *
|
|
|
* @param anomalyModelDTO
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public AnomalyYawVO geAnomalyYaw(AnomalyModelDTO anomalyModelDTO,boolean isIntranet){
|
|
|
+ public AnomalyYawVO geAnomalyYaw(AnomalyModelDTO anomalyModelDTO, boolean isIntranet) {
|
|
|
|
|
|
AnomalyYawVO anomalyYawVO = new AnomalyYawVO();
|
|
|
String beginTime = null;
|
|
|
@@ -824,44 +921,44 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
// 切换数据源
|
|
|
DynamicDataSourceContextHolder.push("slave");
|
|
|
|
|
|
- BaseAnomalyDetectorPO staticyaw= anomalyWindfarmMapper.selectAnomalyDetectorAll(anomalyModelDTO.getFieldId(),
|
|
|
+ BaseAnomalyDetectorPO staticyaw = anomalyWindfarmMapper.selectAnomalyDetectorAll(anomalyModelDTO.getFieldId(),
|
|
|
DetectorTableEnum.STATIC_YAW.getFullTableName(year),
|
|
|
- anomalyModelDTO.getEngineId(),beginTime,endTime);
|
|
|
+ anomalyModelDTO.getEngineId(), beginTime, endTime);
|
|
|
AnomalyStaticyawPO anomalyStaticyawPO = new AnomalyStaticyawPO();
|
|
|
- BeanUtil.copyProperties(staticyaw,anomalyStaticyawPO);
|
|
|
- if(staticyaw != null){
|
|
|
- anomalyStaticyawPO.setFilePath(NetUtils.getFilePath(isIntranet,staticyaw.getFilePath()));
|
|
|
- anomalyStaticyawPO.setGraphPath(NetUtils.getFilePath(isIntranet,staticyaw.getGraphPath()));
|
|
|
+ BeanUtil.copyProperties(staticyaw, anomalyStaticyawPO);
|
|
|
+ if (staticyaw != null) {
|
|
|
+ anomalyStaticyawPO.setFilePath(NetUtils.getFilePath(isIntranet, staticyaw.getFilePath()));
|
|
|
+ anomalyStaticyawPO.setGraphPath(NetUtils.getFilePath(isIntranet, staticyaw.getGraphPath()));
|
|
|
anomalyYawVO.setAnomalyStaticyawPO(anomalyStaticyawPO);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 清除当前
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
// 切换数据源
|
|
|
DynamicDataSourceContextHolder.push("slave");
|
|
|
|
|
|
- BaseAnomalyDetectorPO cabletwistPO = anomalyWindfarmMapper.selectAnomalyDetectorAll(anomalyModelDTO.getFieldId(),
|
|
|
+ BaseAnomalyDetectorPO cabletwistPO = anomalyWindfarmMapper.selectAnomalyDetectorAll(
|
|
|
+ anomalyModelDTO.getFieldId(),
|
|
|
DetectorTableEnum.CABLE_TWIST.getFullTableName(year),
|
|
|
- anomalyModelDTO.getEngineId(),beginTime,endTime);
|
|
|
+ anomalyModelDTO.getEngineId(), beginTime, endTime);
|
|
|
AnomalyCabletwistPO anomalyCabletwistPO = new AnomalyCabletwistPO();
|
|
|
- BeanUtil.copyProperties(cabletwistPO,anomalyCabletwistPO);
|
|
|
- if(cabletwistPO != null){
|
|
|
- anomalyCabletwistPO.setFilePath(NetUtils.getFilePath(isIntranet,cabletwistPO.getFilePath()));
|
|
|
- anomalyCabletwistPO.setGraphPath(NetUtils.getFilePath(isIntranet,cabletwistPO.getGraphPath()));
|
|
|
+ BeanUtil.copyProperties(cabletwistPO, anomalyCabletwistPO);
|
|
|
+ if (cabletwistPO != null) {
|
|
|
+ anomalyCabletwistPO.setFilePath(NetUtils.getFilePath(isIntranet, cabletwistPO.getFilePath()));
|
|
|
+ anomalyCabletwistPO.setGraphPath(NetUtils.getFilePath(isIntranet, cabletwistPO.getGraphPath()));
|
|
|
anomalyYawVO.setAnomalyCabletwistPO(anomalyCabletwistPO);
|
|
|
}
|
|
|
return anomalyYawVO;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 变桨模块模块
|
|
|
+ *
|
|
|
* @param anomalyModelDTO
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public AnomalyPitchVO getAnomalyPitch(AnomalyModelDTO anomalyModelDTO,boolean isIntranet){
|
|
|
+ public AnomalyPitchVO getAnomalyPitch(AnomalyModelDTO anomalyModelDTO, boolean isIntranet) {
|
|
|
|
|
|
AnomalyPitchVO anomalyPitchVO = new AnomalyPitchVO();
|
|
|
String beginTime = null;
|
|
|
@@ -880,16 +977,17 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
// 切换数据源
|
|
|
DynamicDataSourceContextHolder.push("slave");
|
|
|
|
|
|
- BaseAnomalyDetectorPO pitchregulationPO = anomalyWindfarmMapper.selectAnomalyDetectorAll(anomalyModelDTO.getFieldId(),
|
|
|
+ BaseAnomalyDetectorPO pitchregulationPO = anomalyWindfarmMapper.selectAnomalyDetectorAll(
|
|
|
+ anomalyModelDTO.getFieldId(),
|
|
|
DetectorTableEnum.PITCH_REGULATION.getFullTableName(year),
|
|
|
- anomalyModelDTO.getEngineId(),beginTime,endTime);
|
|
|
+ anomalyModelDTO.getEngineId(), beginTime, endTime);
|
|
|
AnomalyPitchregulationPO anomalyPitchregulationPO = new AnomalyPitchregulationPO();
|
|
|
|
|
|
- if(pitchregulationPO != null){
|
|
|
- BeanUtil.copyProperties(pitchregulationPO,anomalyPitchregulationPO);
|
|
|
- anomalyPitchregulationPO.setFilePath(NetUtils.getFilePath(isIntranet,pitchregulationPO.getFilePath()));
|
|
|
- anomalyPitchregulationPO.setGraphPath(NetUtils.getFilePath(isIntranet,pitchregulationPO.getGraphPath()));
|
|
|
- anomalyPitchVO.setAnomalyPitchregulationPO (anomalyPitchregulationPO);
|
|
|
+ if (pitchregulationPO != null) {
|
|
|
+ BeanUtil.copyProperties(pitchregulationPO, anomalyPitchregulationPO);
|
|
|
+ anomalyPitchregulationPO.setFilePath(NetUtils.getFilePath(isIntranet, pitchregulationPO.getFilePath()));
|
|
|
+ anomalyPitchregulationPO.setGraphPath(NetUtils.getFilePath(isIntranet, pitchregulationPO.getGraphPath()));
|
|
|
+ anomalyPitchVO.setAnomalyPitchregulationPO(anomalyPitchregulationPO);
|
|
|
}
|
|
|
|
|
|
// 清除当前
|
|
|
@@ -897,15 +995,16 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
// 切换数据源
|
|
|
DynamicDataSourceContextHolder.push("slave");
|
|
|
|
|
|
- BaseAnomalyDetectorPO pitchcoordPO = anomalyWindfarmMapper.selectAnomalyDetectorAll(anomalyModelDTO.getFieldId(),
|
|
|
+ BaseAnomalyDetectorPO pitchcoordPO = anomalyWindfarmMapper.selectAnomalyDetectorAll(
|
|
|
+ anomalyModelDTO.getFieldId(),
|
|
|
DetectorTableEnum.PITCH_COORD.getFullTableName(year),
|
|
|
- anomalyModelDTO.getEngineId(),beginTime,endTime);
|
|
|
+ anomalyModelDTO.getEngineId(), beginTime, endTime);
|
|
|
AnomalyPitchcoordPO anomalyPitchcoordPO = new AnomalyPitchcoordPO();
|
|
|
|
|
|
- if(pitchcoordPO != null){
|
|
|
- BeanUtil.copyProperties(pitchcoordPO,anomalyPitchcoordPO);
|
|
|
- anomalyPitchcoordPO.setFilePath(NetUtils.getFilePath(isIntranet,pitchcoordPO.getFilePath()));
|
|
|
- anomalyPitchcoordPO.setGraphPath(NetUtils.getFilePath(isIntranet,pitchcoordPO.getGraphPath()));
|
|
|
+ if (pitchcoordPO != null) {
|
|
|
+ BeanUtil.copyProperties(pitchcoordPO, anomalyPitchcoordPO);
|
|
|
+ anomalyPitchcoordPO.setFilePath(NetUtils.getFilePath(isIntranet, pitchcoordPO.getFilePath()));
|
|
|
+ anomalyPitchcoordPO.setGraphPath(NetUtils.getFilePath(isIntranet, pitchcoordPO.getGraphPath()));
|
|
|
anomalyPitchVO.setAnomalyPitchcoordPO(anomalyPitchcoordPO);
|
|
|
}
|
|
|
|
|
|
@@ -914,15 +1013,15 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
// 切换数据源
|
|
|
DynamicDataSourceContextHolder.push("slave");
|
|
|
|
|
|
- BaseAnomalyDetectorPO minpitchPO = anomalyWindfarmMapper.selectAnomalyDetectorAll(anomalyModelDTO.getFieldId(),
|
|
|
+ BaseAnomalyDetectorPO minpitchPO = anomalyWindfarmMapper.selectAnomalyDetectorAll(anomalyModelDTO.getFieldId(),
|
|
|
DetectorTableEnum.MIN_PITCH.getFullTableName(year),
|
|
|
- anomalyModelDTO.getEngineId(),beginTime,endTime);
|
|
|
- AnomalyMinpitchPO anomalyMinpitchPO = new AnomalyMinpitchPO();
|
|
|
+ anomalyModelDTO.getEngineId(), beginTime, endTime);
|
|
|
+ AnomalyMinpitchPO anomalyMinpitchPO = new AnomalyMinpitchPO();
|
|
|
|
|
|
- if(minpitchPO != null){
|
|
|
- BeanUtil.copyProperties(minpitchPO,anomalyMinpitchPO);
|
|
|
- anomalyMinpitchPO.setFilePath(NetUtils.getFilePath(isIntranet,minpitchPO.getFilePath()));
|
|
|
- anomalyMinpitchPO.setGraphPath(NetUtils.getFilePath(isIntranet,minpitchPO.getGraphPath()));
|
|
|
+ if (minpitchPO != null) {
|
|
|
+ BeanUtil.copyProperties(minpitchPO, anomalyMinpitchPO);
|
|
|
+ anomalyMinpitchPO.setFilePath(NetUtils.getFilePath(isIntranet, minpitchPO.getFilePath()));
|
|
|
+ anomalyMinpitchPO.setGraphPath(NetUtils.getFilePath(isIntranet, minpitchPO.getGraphPath()));
|
|
|
anomalyPitchVO.setAnomalyMinpitchPO(anomalyMinpitchPO);
|
|
|
}
|
|
|
return anomalyPitchVO;
|
|
|
@@ -930,11 +1029,12 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
|
|
|
/**
|
|
|
* 运行状态模块模块
|
|
|
+ *
|
|
|
* @param anomalyModelDTO
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public AnomalyCtrlParamVO getAnomalyCtrlParam(AnomalyModelDTO anomalyModelDTO,boolean isIntranet){
|
|
|
+ public AnomalyCtrlParamVO getAnomalyCtrlParam(AnomalyModelDTO anomalyModelDTO, boolean isIntranet) {
|
|
|
|
|
|
AnomalyCtrlParamVO anomalyCtrlParamVO = new AnomalyCtrlParamVO();
|
|
|
String beginTime = null;
|
|
|
@@ -953,59 +1053,60 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
// 切换数据源
|
|
|
DynamicDataSourceContextHolder.push("slave");
|
|
|
|
|
|
- BaseAnomalyDetectorPO powerqualityPO = anomalyWindfarmMapper.selectAnomalyDetectorAll(anomalyModelDTO.getFieldId(),
|
|
|
+ BaseAnomalyDetectorPO powerqualityPO = anomalyWindfarmMapper.selectAnomalyDetectorAll(
|
|
|
+ anomalyModelDTO.getFieldId(),
|
|
|
DetectorTableEnum.POWER_QUALITY.getFullTableName(year),
|
|
|
- anomalyModelDTO.getEngineId(),beginTime,endTime);
|
|
|
+ anomalyModelDTO.getEngineId(), beginTime, endTime);
|
|
|
AnomalyPowerqualityPO anomalyPowerqualityPO = new AnomalyPowerqualityPO();
|
|
|
- BeanUtil.copyProperties(powerqualityPO,anomalyPowerqualityPO);
|
|
|
- if(powerqualityPO != null){
|
|
|
- anomalyPowerqualityPO.setFilePath(NetUtils.getFilePath(isIntranet,powerqualityPO.getFilePath()));
|
|
|
- anomalyPowerqualityPO.setGraphPath(NetUtils.getFilePath(isIntranet,powerqualityPO.getGraphPath()));
|
|
|
- anomalyCtrlParamVO.setAnomalyPowerqualityPO (anomalyPowerqualityPO);
|
|
|
+ BeanUtil.copyProperties(powerqualityPO, anomalyPowerqualityPO);
|
|
|
+ if (powerqualityPO != null) {
|
|
|
+ anomalyPowerqualityPO.setFilePath(NetUtils.getFilePath(isIntranet, powerqualityPO.getFilePath()));
|
|
|
+ anomalyPowerqualityPO.setGraphPath(NetUtils.getFilePath(isIntranet, powerqualityPO.getGraphPath()));
|
|
|
+ anomalyCtrlParamVO.setAnomalyPowerqualityPO(anomalyPowerqualityPO);
|
|
|
}
|
|
|
|
|
|
// 清除当前
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
// 切换数据源
|
|
|
DynamicDataSourceContextHolder.push("slave");
|
|
|
- BaseAnomalyDetectorPO operationPO = anomalyWindfarmMapper.selectAnomalyDetectorAll(anomalyModelDTO.getFieldId(),
|
|
|
+ BaseAnomalyDetectorPO operationPO = anomalyWindfarmMapper.selectAnomalyDetectorAll(anomalyModelDTO.getFieldId(),
|
|
|
DetectorTableEnum.OPERATION.getFullTableName(year),
|
|
|
- anomalyModelDTO.getEngineId(),beginTime,endTime);
|
|
|
+ anomalyModelDTO.getEngineId(), beginTime, endTime);
|
|
|
AnomalyOperationPO anomalyOperationPO = new AnomalyOperationPO();
|
|
|
- BeanUtil.copyProperties(operationPO,anomalyOperationPO);
|
|
|
- if(operationPO != null){
|
|
|
- anomalyOperationPO.setFilePath(NetUtils.getFilePath(isIntranet,operationPO.getFilePath()));
|
|
|
- anomalyOperationPO.setGraphPath(NetUtils.getFilePath(isIntranet,operationPO.getGraphPath()));
|
|
|
+ BeanUtil.copyProperties(operationPO, anomalyOperationPO);
|
|
|
+ if (operationPO != null) {
|
|
|
+ anomalyOperationPO.setFilePath(NetUtils.getFilePath(isIntranet, operationPO.getFilePath()));
|
|
|
+ anomalyOperationPO.setGraphPath(NetUtils.getFilePath(isIntranet, operationPO.getGraphPath()));
|
|
|
anomalyCtrlParamVO.setAnomalyOperationPO(anomalyOperationPO);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 清除当前
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
// 切换数据源
|
|
|
DynamicDataSourceContextHolder.push("slave");
|
|
|
- BaseAnomalyDetectorPO anomalyDetectorPO = anomalyWindfarmMapper.selectAnomalyDetectorAll(anomalyModelDTO.getFieldId(),
|
|
|
+ BaseAnomalyDetectorPO anomalyDetectorPO = anomalyWindfarmMapper.selectAnomalyDetectorAll(
|
|
|
+ anomalyModelDTO.getFieldId(),
|
|
|
DetectorTableEnum.ANOMALY_DELOAD_DETECTOR.getFullTableName(year),
|
|
|
- anomalyModelDTO.getEngineId(),beginTime,endTime);
|
|
|
+ anomalyModelDTO.getEngineId(), beginTime, endTime);
|
|
|
AnomalyDeloadPO anomalyDeloadPO = new AnomalyDeloadPO();
|
|
|
- BeanUtil.copyProperties(anomalyDetectorPO,anomalyDeloadPO);
|
|
|
- if(anomalyDetectorPO != null){
|
|
|
- anomalyDeloadPO.setFilePath(NetUtils.getFilePath(isIntranet,anomalyDetectorPO.getFilePath()));
|
|
|
- anomalyDeloadPO.setGraphPath(NetUtils.getFilePath(isIntranet,anomalyDetectorPO.getGraphPath()));
|
|
|
+ BeanUtil.copyProperties(anomalyDetectorPO, anomalyDeloadPO);
|
|
|
+ if (anomalyDetectorPO != null) {
|
|
|
+ anomalyDeloadPO.setFilePath(NetUtils.getFilePath(isIntranet, anomalyDetectorPO.getFilePath()));
|
|
|
+ anomalyDeloadPO.setGraphPath(NetUtils.getFilePath(isIntranet, anomalyDetectorPO.getGraphPath()));
|
|
|
anomalyCtrlParamVO.setAnomalyDeloadPO(anomalyDeloadPO);
|
|
|
}
|
|
|
|
|
|
return anomalyCtrlParamVO;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 气动性能
|
|
|
+ *
|
|
|
* @param anomalyModelDTO
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public AnomalyAerodynamicsVO getAerodynamics(AnomalyModelDTO anomalyModelDTO,boolean isIntranet){
|
|
|
+ public AnomalyAerodynamicsVO getAerodynamics(AnomalyModelDTO anomalyModelDTO, boolean isIntranet) {
|
|
|
|
|
|
String beginTime = null;
|
|
|
String endTime = null;
|
|
|
@@ -1025,30 +1126,31 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
|
|
|
AnomalyAerodynamicsVO anomalyAerodynamicsVO = new AnomalyAerodynamicsVO();
|
|
|
|
|
|
- BaseAnomalyDetectorPO anomalyCpBasePO = anomalyWindfarmMapper.selectAnomalyDetectorAll(anomalyModelDTO.getFieldId(),
|
|
|
+ BaseAnomalyDetectorPO anomalyCpBasePO = anomalyWindfarmMapper.selectAnomalyDetectorAll(
|
|
|
+ anomalyModelDTO.getFieldId(),
|
|
|
DetectorTableEnum.CP_DETECTOR.getFullTableName(year),
|
|
|
- anomalyModelDTO.getEngineId(),beginTime,endTime);
|
|
|
+ anomalyModelDTO.getEngineId(), beginTime, endTime);
|
|
|
AnomalyCpPO anomalyCpPO = new AnomalyCpPO();
|
|
|
- BeanUtil.copyProperties(anomalyCpBasePO,anomalyCpPO);
|
|
|
- if(anomalyCpBasePO != null){
|
|
|
- anomalyCpPO.setFilePath(NetUtils.getFilePath(isIntranet,anomalyCpBasePO.getFilePath()));
|
|
|
- anomalyCpPO.setGraphPath(NetUtils.getFilePath(isIntranet,anomalyCpBasePO.getGraphPath()));
|
|
|
+ BeanUtil.copyProperties(anomalyCpBasePO, anomalyCpPO);
|
|
|
+ if (anomalyCpBasePO != null) {
|
|
|
+ anomalyCpPO.setFilePath(NetUtils.getFilePath(isIntranet, anomalyCpBasePO.getFilePath()));
|
|
|
+ anomalyCpPO.setGraphPath(NetUtils.getFilePath(isIntranet, anomalyCpBasePO.getGraphPath()));
|
|
|
anomalyAerodynamicsVO.setAnomalyCpPO(anomalyCpPO);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 清除当前
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
// 切换数据源
|
|
|
DynamicDataSourceContextHolder.push("slave");
|
|
|
- BaseAnomalyDetectorPO anomalyTsrBasePO = anomalyWindfarmMapper.selectAnomalyDetectorAll(anomalyModelDTO.getFieldId(),
|
|
|
+ BaseAnomalyDetectorPO anomalyTsrBasePO = anomalyWindfarmMapper.selectAnomalyDetectorAll(
|
|
|
+ anomalyModelDTO.getFieldId(),
|
|
|
DetectorTableEnum.TSR_DETECTOR.getFullTableName(year),
|
|
|
- anomalyModelDTO.getEngineId(),beginTime,endTime);
|
|
|
+ anomalyModelDTO.getEngineId(), beginTime, endTime);
|
|
|
AnomalyTsrPO anomalyTsrPO = new AnomalyTsrPO();
|
|
|
- BeanUtil.copyProperties(anomalyTsrBasePO,anomalyTsrPO);
|
|
|
- if(anomalyTsrBasePO != null){
|
|
|
- anomalyTsrPO.setFilePath(NetUtils.getFilePath(isIntranet,anomalyTsrBasePO.getFilePath()));
|
|
|
- anomalyTsrPO.setGraphPath(NetUtils.getFilePath(isIntranet,anomalyTsrBasePO.getGraphPath()));
|
|
|
+ BeanUtil.copyProperties(anomalyTsrBasePO, anomalyTsrPO);
|
|
|
+ if (anomalyTsrBasePO != null) {
|
|
|
+ anomalyTsrPO.setFilePath(NetUtils.getFilePath(isIntranet, anomalyTsrBasePO.getFilePath()));
|
|
|
+ anomalyTsrPO.setGraphPath(NetUtils.getFilePath(isIntranet, anomalyTsrBasePO.getGraphPath()));
|
|
|
anomalyAerodynamicsVO.setAnomalyTsrPO(anomalyTsrPO);
|
|
|
}
|
|
|
|
|
|
@@ -1056,23 +1158,21 @@ public class AnomalyServiceImpl implements AnomalyService {
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
// 切换数据源
|
|
|
DynamicDataSourceContextHolder.push("slave");
|
|
|
- BaseAnomalyDetectorPO anomalyCpTsrBasePO = anomalyWindfarmMapper.selectAnomalyDetectorAll(anomalyModelDTO.getFieldId(),
|
|
|
+ BaseAnomalyDetectorPO anomalyCpTsrBasePO = anomalyWindfarmMapper.selectAnomalyDetectorAll(
|
|
|
+ anomalyModelDTO.getFieldId(),
|
|
|
DetectorTableEnum.CP_TSR_DETECTOR.getFullTableName(year),
|
|
|
- anomalyModelDTO.getEngineId(),beginTime,endTime);
|
|
|
+ anomalyModelDTO.getEngineId(), beginTime, endTime);
|
|
|
AnomalyCpTsrPO anomalyCpTsrPO = new AnomalyCpTsrPO();
|
|
|
- BeanUtil.copyProperties(anomalyCpTsrBasePO,anomalyCpTsrPO);
|
|
|
- if(anomalyCpTsrBasePO != null){
|
|
|
- anomalyCpTsrPO.setFilePath(NetUtils.getFilePath(isIntranet,anomalyCpTsrBasePO.getFilePath()));
|
|
|
- anomalyCpTsrPO.setGraphPath(NetUtils.getFilePath(isIntranet,anomalyCpTsrBasePO.getGraphPath()));
|
|
|
+ BeanUtil.copyProperties(anomalyCpTsrBasePO, anomalyCpTsrPO);
|
|
|
+ if (anomalyCpTsrBasePO != null) {
|
|
|
+ anomalyCpTsrPO.setFilePath(NetUtils.getFilePath(isIntranet, anomalyCpTsrBasePO.getFilePath()));
|
|
|
+ anomalyCpTsrPO.setGraphPath(NetUtils.getFilePath(isIntranet, anomalyCpTsrBasePO.getGraphPath()));
|
|
|
// anomalyAerodynamicsVO.setAnomalyCpPO(anomalyCpPO);
|
|
|
anomalyAerodynamicsVO.setAnomalyCpTsrPO(anomalyCpTsrPO);
|
|
|
}
|
|
|
return anomalyAerodynamicsVO;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 分隔符
|
|
|
* ==============================================================================================================================
|