|
@@ -6,13 +6,13 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.energy.manage.common.base.Page;
|
|
import com.energy.manage.common.base.Page;
|
|
|
import com.energy.manage.common.constant.redis.ManagerRedisKeyConstant;
|
|
import com.energy.manage.common.constant.redis.ManagerRedisKeyConstant;
|
|
|
import com.energy.manage.common.enums.IdPrefixEnum;
|
|
import com.energy.manage.common.enums.IdPrefixEnum;
|
|
|
|
|
+import com.energy.manage.common.po.analysis.AnalysisGeneralFilePo;
|
|
|
import com.energy.manage.common.po.analysis.AnalysisOptionRecordsPo;
|
|
import com.energy.manage.common.po.analysis.AnalysisOptionRecordsPo;
|
|
|
import com.energy.manage.common.po.analysis.AnalysisResultPo;
|
|
import com.energy.manage.common.po.analysis.AnalysisResultPo;
|
|
|
import com.energy.manage.common.po.analysis.AnalysisTypePo;
|
|
import com.energy.manage.common.po.analysis.AnalysisTypePo;
|
|
|
import com.energy.manage.common.po.analysisdatarelationrecords.AnalysisDataRelationRecordsPo;
|
|
import com.energy.manage.common.po.analysisdatarelationrecords.AnalysisDataRelationRecordsPo;
|
|
|
import com.energy.manage.common.po.analysispriorityrecords.AnalysisPriorityRecordsPo;
|
|
import com.energy.manage.common.po.analysispriorityrecords.AnalysisPriorityRecordsPo;
|
|
|
import com.energy.manage.common.po.windfield.WindFieldPO;
|
|
import com.energy.manage.common.po.windfield.WindFieldPO;
|
|
|
-import com.energy.manage.common.reponse.ConstVar;
|
|
|
|
|
import com.energy.manage.common.reponse.ResultResp;
|
|
import com.energy.manage.common.reponse.ResultResp;
|
|
|
import com.energy.manage.common.util.HttpUtils;
|
|
import com.energy.manage.common.util.HttpUtils;
|
|
|
import com.energy.manage.common.util.IdGeneratorUtil;
|
|
import com.energy.manage.common.util.IdGeneratorUtil;
|
|
@@ -294,16 +294,10 @@ public class AnalysisServiceImpl implements AnalysisService {
|
|
|
@Override
|
|
@Override
|
|
|
public ResultResp analysis(AnalysisDto analysisDto) {
|
|
public ResultResp analysis(AnalysisDto analysisDto) {
|
|
|
try {
|
|
try {
|
|
|
- if(checkAnalysising()){
|
|
|
|
|
- return ResultResp.FAIL(ConstVar.ANALYSISING);
|
|
|
|
|
- }
|
|
|
|
|
- //手动分析要进行分析类型code转换为flag(便于json分析类型赋值)
|
|
|
|
|
- // (是因为算法分析类型code与平台分析类型code没有做统一,开发之后才做统一,所以需要转换)
|
|
|
|
|
- if(analysisDto.getAutoOrManual().equalsIgnoreCase(AnalysisConstants.MANUAL_ANALYSIS)){
|
|
|
|
|
- transferAnalysisFlagByCode(analysisDto);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //(是因为算法分析类型code与平台分析类型code没有做统一,开发之后才做统一,所以需要转换)
|
|
|
|
|
+ transferAnalysisFlagByCode(analysisDto);
|
|
|
//当有功功率没有设置的话 设置默认值 整个风场最大额定功率*1.2 (图像设计移动到前端了,废弃)
|
|
//当有功功率没有设置的话 设置默认值 整个风场最大额定功率*1.2 (图像设计移动到前端了,废弃)
|
|
|
-// setActivePower(analysisDto);
|
|
|
|
|
|
|
+ //setActivePower(analysisDto);
|
|
|
//查询分析中或者排队中的数量
|
|
//查询分析中或者排队中的数量
|
|
|
int analysingCount = analysisResultMapper.selectAnalysisingCount();
|
|
int analysingCount = analysisResultMapper.selectAnalysisingCount();
|
|
|
if(analysingCount > 0){
|
|
if(analysingCount > 0){
|
|
@@ -315,7 +309,7 @@ public class AnalysisServiceImpl implements AnalysisService {
|
|
|
//更新任务状态为排队中(只更新分析完成与未分析状态)
|
|
//更新任务状态为排队中(只更新分析完成与未分析状态)
|
|
|
analysisResultMapper.updateAnalysisState(analysisDto.getDataBatchNum());
|
|
analysisResultMapper.updateAnalysisState(analysisDto.getDataBatchNum());
|
|
|
}else{
|
|
}else{
|
|
|
- //调用算法逻辑(排队逻辑)
|
|
|
|
|
|
|
+ //调用算法逻辑
|
|
|
callAnalysis(analysisDto);
|
|
callAnalysis(analysisDto);
|
|
|
}
|
|
}
|
|
|
return ResultResp.SUCCESS();
|
|
return ResultResp.SUCCESS();
|
|
@@ -446,27 +440,29 @@ public class AnalysisServiceImpl implements AnalysisService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 查询所有的分析类型
|
|
|
|
|
- */
|
|
|
|
|
- @Override
|
|
|
|
|
- public List<Map<String, Object>> queryAllAnalysisType() {
|
|
|
|
|
- return getAnalysisType(null);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
*过滤分析类型并生成树形结构
|
|
*过滤分析类型并生成树形结构
|
|
|
* @param analysisCodes
|
|
* @param analysisCodes
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
private List<Map<String, Object>> getAnalysisType(Set<String> analysisCodes){
|
|
private List<Map<String, Object>> getAnalysisType(Set<String> analysisCodes){
|
|
|
- List<AnalysisTypePo> analysisTypePos = analysisTypeMapper.selectAll();
|
|
|
|
|
- if(CollectionUtils.isNotEmpty(analysisCodes)){
|
|
|
|
|
- analysisTypePos = analysisTypePos.stream().filter(item -> analysisCodes.contains(item.getTypeCode())).collect(Collectors.toList());
|
|
|
|
|
|
|
+ if(CollectionUtils.isEmpty(analysisCodes)){
|
|
|
|
|
+ return new ArrayList<>();
|
|
|
}
|
|
}
|
|
|
|
|
+ List<AnalysisTypePo> analysisTypePos = analysisTypeMapper.selectAllByOrderNum();
|
|
|
|
|
+ analysisTypePos = analysisTypePos.stream().filter(item -> analysisCodes.contains(item.getTypeCode()) || item.getParentId().equals(ZREO_STR)).collect(Collectors.toList());
|
|
|
return TreeUtil.getJava8ResultTree(BeanMapUtils.listBeanToListMap(analysisTypePos), "parentId", "id");
|
|
return TreeUtil.getJava8ResultTree(BeanMapUtils.listBeanToListMap(analysisTypePos), "parentId", "id");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * 查询所有的分析类型
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<Map<String, Object>> queryAllAnalysisType() {
|
|
|
|
|
+ List<AnalysisTypePo> analysisTypeList = analysisTypeMapper.selectAllByOrderNum();
|
|
|
|
|
+ return TreeUtil.getJava8ResultTree(BeanMapUtils.listBeanToListMap(analysisTypeList), "parentId", "id");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* 查询已经分析的风机信息
|
|
* 查询已经分析的风机信息
|
|
|
* @param batchCode
|
|
* @param batchCode
|
|
|
* @param analysisTypeCode
|
|
* @param analysisTypeCode
|
|
@@ -475,6 +471,16 @@ public class AnalysisServiceImpl implements AnalysisService {
|
|
|
@Override
|
|
@Override
|
|
|
public Set<WindEngineGroupShortVo> queryAnalysisedEngine(String batchCode, String analysisTypeCode){
|
|
public Set<WindEngineGroupShortVo> queryAnalysisedEngine(String batchCode, String analysisTypeCode){
|
|
|
Set<WindEngineGroupShortVo> set = diagramRelationMapper.selectByBatchCodeAndAnalysisTypeCode(batchCode,analysisTypeCode);
|
|
Set<WindEngineGroupShortVo> set = diagramRelationMapper.selectByBatchCodeAndAnalysisTypeCode(batchCode,analysisTypeCode);
|
|
|
|
|
+ if(CollectionUtils.isEmpty(set)){
|
|
|
|
|
+ int count = generalFileMapper.selectCount(new AnalysisGeneralFilePo().setBatchCode(batchCode));
|
|
|
|
|
+ if(count > 0){
|
|
|
|
|
+ AnalysisResultPo analysisResultPo = analysisResultMapper.selectByBatchCode(batchCode);
|
|
|
|
|
+ set = engineGroupMapper.selectWindEngineGroupShortList(analysisResultPo.getFieldCode())
|
|
|
|
|
+ .stream().collect(Collectors.toSet());
|
|
|
|
|
+ }else{
|
|
|
|
|
+ return new HashSet<>();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
//排序
|
|
//排序
|
|
|
return set.stream()
|
|
return set.stream()
|
|
|
.sorted(Comparator.comparing(WindEngineGroupShortVo::getEngineName))
|
|
.sorted(Comparator.comparing(WindEngineGroupShortVo::getEngineName))
|
|
@@ -496,8 +502,9 @@ public class AnalysisServiceImpl implements AnalysisService {
|
|
|
if(CollectionUtils.isEmpty(analysisTypeVos)){
|
|
if(CollectionUtils.isEmpty(analysisTypeVos)){
|
|
|
return analysisDetailVos;
|
|
return analysisDetailVos;
|
|
|
}
|
|
}
|
|
|
|
|
+ Set<String> analysisTypeCodes = analysisTypeVos.stream().map(item -> item.getTypeCode()).collect(Collectors.toSet());
|
|
|
//最新总文件
|
|
//最新总文件
|
|
|
- List<AnalysisGeneralFileVo> newGeneralFileVos = getNewGeneralFiles(batchCode,analysisTypeCode,isIntranet);
|
|
|
|
|
|
|
+ List<AnalysisGeneralFileVo> newGeneralFileVos = getAllGeneralFiles(batchCode,analysisTypeCodes,isIntranet);
|
|
|
//获取最新分文件
|
|
//获取最新分文件
|
|
|
List<AnalysisDiagramRelationVo> newDiagramRelationVos = getNewDiagramRelations(batchCode, analysisTypeCode, fieldEngineCodes,isIntranet);
|
|
List<AnalysisDiagramRelationVo> newDiagramRelationVos = getNewDiagramRelations(batchCode, analysisTypeCode, fieldEngineCodes,isIntranet);
|
|
|
//查询评论
|
|
//查询评论
|
|
@@ -854,6 +861,18 @@ public class AnalysisServiceImpl implements AnalysisService {
|
|
|
// return engineGroupVos.parallelStream().collect(Collectors.toMap(WindEngineGroupVo::getEngineCode,WindEngineGroupVo::getEngineName, (k1, k2) -> k1, LinkedHashMap::new));
|
|
// return engineGroupVos.parallelStream().collect(Collectors.toMap(WindEngineGroupVo::getEngineCode,WindEngineGroupVo::getEngineName, (k1, k2) -> k1, LinkedHashMap::new));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取所有分析类型总文件
|
|
|
|
|
+ * @param batchCode
|
|
|
|
|
+ * @param typeCodes
|
|
|
|
|
+ * @param isIntranet
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ private List<AnalysisGeneralFileVo> getAllGeneralFiles(String batchCode,Set<String> typeCodes, boolean isIntranet){
|
|
|
|
|
+ List<AnalysisGeneralFileVo> resultList = new ArrayList<>();
|
|
|
|
|
+ typeCodes.stream().forEach(typeCode -> resultList.addAll(getNewGeneralFiles(batchCode,typeCode,isIntranet)));
|
|
|
|
|
+ return resultList;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取总文件
|
|
* 获取总文件
|
|
@@ -997,7 +1016,13 @@ public class AnalysisServiceImpl implements AnalysisService {
|
|
|
configAnalysisCodes.stream().forEach(item -> {
|
|
configAnalysisCodes.stream().forEach(item -> {
|
|
|
String[] typeStrs = item.split("\\|");
|
|
String[] typeStrs = item.split("\\|");
|
|
|
String flag = analysisTypeMapper.selecFlagByCode(typeStrs[0]);
|
|
String flag = analysisTypeMapper.selecFlagByCode(typeStrs[0]);
|
|
|
- flag = flag.substring(0,flag.lastIndexOf("|") + 1) + typeStrs[1];
|
|
|
|
|
|
|
+ String dataSource;
|
|
|
|
|
+ if(StringUtils.isNotBlank(analysisDto.getScada())){
|
|
|
|
|
+ dataSource = analysisDto.getScada();
|
|
|
|
|
+ }else{
|
|
|
|
|
+ dataSource = typeStrs[1];
|
|
|
|
|
+ }
|
|
|
|
|
+ flag = flag.substring(0,flag.lastIndexOf("|") + 1) + dataSource;
|
|
|
flags.add(flag);
|
|
flags.add(flag);
|
|
|
});
|
|
});
|
|
|
analysisDto.setConfigAnalysis(flags.stream().collect(Collectors.toList()));
|
|
analysisDto.setConfigAnalysis(flags.stream().collect(Collectors.toList()));
|
|
@@ -1225,6 +1250,7 @@ public class AnalysisServiceImpl implements AnalysisService {
|
|
|
* @param fieldCode
|
|
* @param fieldCode
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
|
|
+ @Override
|
|
|
public String createWindFieldBatchCode(String fieldCode){
|
|
public String createWindFieldBatchCode(String fieldCode){
|
|
|
String sequece = IdPrefixEnum.WIND_ENGINE_BATCH_NUMBER.getCode().concat(IdGeneratorUtil.zeroFillUtil(cacheService.incr(ManagerRedisKeyConstant.build(ManagerRedisKeyConstant.IDGENERATOR_CONSTANTS_KEY, fieldCode,IdPrefixEnum.WIND_ENGINE_BATCH_NUMBER.getCode())),6));
|
|
String sequece = IdPrefixEnum.WIND_ENGINE_BATCH_NUMBER.getCode().concat(IdGeneratorUtil.zeroFillUtil(cacheService.incr(ManagerRedisKeyConstant.build(ManagerRedisKeyConstant.IDGENERATOR_CONSTANTS_KEY, fieldCode,IdPrefixEnum.WIND_ENGINE_BATCH_NUMBER.getCode())),6));
|
|
|
return fieldCode + SEPARATOR + sequece;
|
|
return fieldCode + SEPARATOR + sequece;
|