|
@@ -4,22 +4,34 @@ import com.energy.manage.common.enums.TypeRelationEnum;
|
|
|
import com.energy.manage.common.po.analysis.AnalysisResultPo;
|
|
|
import com.energy.manage.common.po.windrelation.WindRelationPO;
|
|
|
import com.energy.manage.service.constant.analysis.AnalysisStatusConstants;
|
|
|
+import com.energy.manage.service.domain.vo.analysis.AnalysisDiagramRelationVo;
|
|
|
+import com.energy.manage.service.domain.vo.analysis.AnalysisGeneralFileVo;
|
|
|
import com.energy.manage.service.domain.vo.analysis.AnalysisOptionRecordsVo;
|
|
|
import com.energy.manage.service.domain.vo.analysis.AnalysisResultVo;
|
|
|
+import com.energy.manage.service.domain.vo.homepage.FloatingWindowInfoVo;
|
|
|
import com.energy.manage.service.domain.vo.homepage.HomePageVo;
|
|
|
import com.energy.manage.service.domain.vo.homepage.WaitTaskVo;
|
|
|
import com.energy.manage.service.domain.vo.system.SysOrganizationAuthVo;
|
|
|
+import com.energy.manage.service.domain.vo.windenginegroup.WindEngineGroupPageVo;
|
|
|
import com.energy.manage.service.domain.vo.windexceptioncount.WindExceptionCountVo;
|
|
|
+import com.energy.manage.service.domain.vo.windfield.WindFieldVo;
|
|
|
+import com.energy.manage.service.mappers.analysis.AnalysisDiagramRelationMapper;
|
|
|
+import com.energy.manage.service.mappers.analysis.AnalysisGeneralFileMapper;
|
|
|
import com.energy.manage.service.mappers.analysis.AnalysisOptionRecordsMapper;
|
|
|
import com.energy.manage.service.mappers.analysis.AnalysisResultMapper;
|
|
|
import com.energy.manage.service.mappers.system.SysOrganizationAuthMapper;
|
|
|
+import com.energy.manage.service.mappers.windenginegroup.WindEngineGroupMapper;
|
|
|
import com.energy.manage.service.mappers.windexceptioncount.WindExceptionCountMapper;
|
|
|
+import com.energy.manage.service.mappers.windfield.WindFieldMapper;
|
|
|
import com.energy.manage.service.mappers.windrelation.WindRelationMapper;
|
|
|
import com.energy.manage.service.service.homepage.HomePageService;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
@@ -51,6 +63,18 @@ public class HomePageServiceImpl implements HomePageService {
|
|
|
@Autowired
|
|
|
private SysOrganizationAuthMapper authMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private AnalysisGeneralFileMapper generalFileMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AnalysisDiagramRelationMapper diagramRelationMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private WindFieldMapper windFieldMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private WindEngineGroupMapper windEngineGroupMapper;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 驾驶舱首页查询
|
|
@@ -91,7 +115,11 @@ public class HomePageServiceImpl implements HomePageService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<AnalysisOptionRecordsVo> queryOptionRecords(Integer roleId, String codeNumber, String codeType){
|
|
|
+ public List<AnalysisOptionRecordsVo> queryOptionRecords(Integer roleId,
|
|
|
+ String codeNumber,
|
|
|
+ String codeType,
|
|
|
+ String startTime,
|
|
|
+ String endTime){
|
|
|
List<AnalysisOptionRecordsVo> voList = new ArrayList<>();
|
|
|
//风场
|
|
|
List<String> fieldCodes = new ArrayList<>();
|
|
@@ -105,7 +133,52 @@ public class HomePageServiceImpl implements HomePageService {
|
|
|
if(CollectionUtils.isEmpty(fieldCodes)){
|
|
|
return voList;
|
|
|
}
|
|
|
- return analysisOptionRecordsMapper.selectAllByTimeDesc(fieldCodes);
|
|
|
+ return analysisOptionRecordsMapper.selectAllByTimeDesc(fieldCodes,startTime,endTime);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取悬浮窗信息
|
|
|
+ * @param batchCode
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public FloatingWindowInfoVo queryFloatingWindowInfo(String batchCode, String fieldCode){
|
|
|
+ FloatingWindowInfoVo floatingWindowInfoVo = new FloatingWindowInfoVo();
|
|
|
+ //设置装机容量
|
|
|
+ WindFieldVo windFieldVo = windFieldMapper.selectByCodeNumber(fieldCode);
|
|
|
+ floatingWindowInfoVo.setRatedCapacityNumber(windFieldVo == null ? "0" : doubleDivide(windFieldVo.getRatedCapacityNumber(),1000D));
|
|
|
+ //设置风机数量
|
|
|
+ List<WindEngineGroupPageVo> windEngineGroupPageVos = windEngineGroupMapper.selectWindEngineGroupListByFieldCode(fieldCode);
|
|
|
+ floatingWindowInfoVo.setEngineTotalCount(windEngineGroupPageVos.size());
|
|
|
+ //设置分析信息
|
|
|
+ if(StringUtils.isNotBlank(batchCode)){
|
|
|
+ //设置分析时间 数据时间范围
|
|
|
+ AnalysisResultPo analysisResultPo = analysisResultMapper.selectByBatchCode(batchCode);
|
|
|
+ BeanUtils.copyProperties(analysisResultPo,floatingWindowInfoVo);
|
|
|
+ //设置分析类型数目
|
|
|
+ Set<String> analysisGeneralTypes = generalFileMapper.selectByBatchCode(batchCode).stream()
|
|
|
+ .map(AnalysisGeneralFileVo::getAnalysisTypeCode)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ Set<String> analysisDeliayTypes = diagramRelationMapper.selectByBatchCode(batchCode).stream()
|
|
|
+ .map(AnalysisDiagramRelationVo :: getAnalysisTypeCode)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ analysisGeneralTypes.addAll(analysisDeliayTypes);
|
|
|
+ floatingWindowInfoVo.setAnalysisTypeCount(analysisGeneralTypes.size());
|
|
|
+ }
|
|
|
+ return floatingWindowInfoVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * double计算(四舍五入)
|
|
|
+ * @param dividend
|
|
|
+ * @param divisor
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String doubleDivide(Double dividend, Double divisor){
|
|
|
+ BigDecimal dividendBigDecimal = new BigDecimal(dividend);
|
|
|
+ BigDecimal divisorBigDecimal = new BigDecimal(divisor);
|
|
|
+ return dividendBigDecimal.divide(divisorBigDecimal,BigDecimal.ROUND_HALF_UP).toString();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -121,7 +194,7 @@ public class HomePageServiceImpl implements HomePageService {
|
|
|
|
|
|
@Override
|
|
|
public List<AnalysisResultPo> getAnalysisResultErrStateList(Integer roleId) {
|
|
|
- List<AnalysisResultPo> list =authMapper.selectWindRelationByErrState(roleId);
|
|
|
+ List<AnalysisResultPo> list = authMapper.selectWindRelationByErrState(roleId);
|
|
|
return list;
|
|
|
}
|
|
|
|