|
@@ -5,14 +5,16 @@
|
|
|
package com.tofly.xrtygis.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
-import cn.hutool.core.date.DateUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-
|
|
|
-import com.tofly.common.core.util.StringUtil;
|
|
|
-import com.tofly.common.oauth.util.SecurityUtils;
|
|
|
+import com.tofly.xrtygis.custom.entity.dto.ScadaDataDto;
|
|
|
+import com.tofly.xrtygis.custom.entity.vo.DmaSalesAmountVo;
|
|
|
+import com.tofly.xrtygis.custom.entity.vo.ScadaIndexVo;
|
|
|
+import com.tofly.xrtygis.custom.mapper.LscreenMapper;
|
|
|
+import com.tofly.xrtygis.custom.mapper.dma.CustomDmaScadaMapper;
|
|
|
import com.tofly.xrtygis.custom.util.DateTimeUtil;
|
|
|
import com.tofly.xrtygis.em.Constant;
|
|
|
+import com.tofly.xrtygis.em.IndexTypeEnum;
|
|
|
import com.tofly.xrtygis.entity.*;
|
|
|
import com.tofly.xrtygis.entity.dto.CustomizeDto;
|
|
|
import com.tofly.xrtygis.entity.vo.DmaCalculatePramVo;
|
|
@@ -23,10 +25,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.math.RoundingMode;
|
|
|
-import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.time.LocalTime;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -51,6 +50,12 @@ public class IndicatorCorrectionServiceImpl extends ServiceImpl<IndicatorCorrect
|
|
|
private TotalStatisticalService totalStatisticalService;
|
|
|
@Autowired
|
|
|
private CustomizeService customizeService;
|
|
|
+ @Autowired
|
|
|
+ private LscreenMapper lscreenMapper;
|
|
|
+ @Autowired
|
|
|
+ private CustomDmaScadaMapper customDmaScadaMapper;
|
|
|
+ @Autowired
|
|
|
+ private DmaandobserService dmaandobserService;
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -92,6 +97,8 @@ public class IndicatorCorrectionServiceImpl extends ServiceImpl<IndicatorCorrect
|
|
|
|
|
|
BigDecimal totalPlanPipeLength = baseMapper.getTotalPlanPipeLength(startDate, endDate);
|
|
|
BigDecimal planTotalDistanceLength = baseMapper.getPlanTotalDistanceLength(startDate, endDate);
|
|
|
+ List<Dmaandobser> dmaandobserList = dmaandobserService.list(new QueryWrapper<Dmaandobser>().lambda().eq(Dmaandobser::getIsout, "0"));
|
|
|
+ List<Dmaregion> dmaregionList = dmaregionService.list();
|
|
|
dmaIdList.forEach(dmaId -> {
|
|
|
DmaStatistical vo = new DmaStatistical();
|
|
|
|
|
@@ -126,10 +133,25 @@ public class IndicatorCorrectionServiceImpl extends ServiceImpl<IndicatorCorrect
|
|
|
|
|
|
BigDecimal poorProductionRate = BigDecimal.ZERO;
|
|
|
BigDecimal leakageRate = BigDecimal.ZERO;
|
|
|
+ vo.setLeakageStatus("0");
|
|
|
+ vo.setNrwStatus("0");
|
|
|
if (BigDecimal.ZERO.compareTo(gsl) != 0) {
|
|
|
leakageRate = gsl.subtract(zcysl).divide(gsl, 4, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100));
|
|
|
|
|
|
poorProductionRate = gsl.subtract(userWater).subtract(notMeasureVolume).divide(gsl, 4, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100));
|
|
|
+ Dmaregion dmaregion = dmaregionList.stream().filter(e -> e.getId().equals(dmaId)).collect(Collectors.toList()).get(0);
|
|
|
+ if (dmaregion.getLeakUp() != null
|
|
|
+ && dmaregion.getLeakDown() != null
|
|
|
+ && (dmaregion.getLeakUp().compareTo(leakageRate.floatValue()) < 0
|
|
|
+ || dmaregion.getLeakDown().compareTo(leakageRate.floatValue()) > 0)) {
|
|
|
+ vo.setLeakageStatus("1");
|
|
|
+ }
|
|
|
+ if (dmaregion.getMaxDiff() != null
|
|
|
+ && dmaregion.getMinDiff() != null
|
|
|
+ && (dmaregion.getMaxDiff().compareTo(poorProductionRate.floatValue()) < 0
|
|
|
+ || dmaregion.getMinDiff().compareTo(poorProductionRate.floatValue()) > 0)) {
|
|
|
+ vo.setNrwStatus("1");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
BigDecimal dnLengthVal = dnLengthMap.get(dmaId) == null ? BigDecimal.ZERO : dnLengthMap.get(dmaId);
|
|
@@ -167,6 +189,33 @@ public class IndicatorCorrectionServiceImpl extends ServiceImpl<IndicatorCorrect
|
|
|
vo.setLeakageVal(leakageVal);
|
|
|
vo.setDnLengthVal(dnLengthVal);
|
|
|
vo.setYearPressureVal(yearPressureVal);
|
|
|
+
|
|
|
+ List<DmaSalesAmountVo> dmaSalesAmountVoList = lscreenMapper.getDmaSalesAmountReport(dmaId, yearMonth, yearMonth);
|
|
|
+ if (CollUtil.isNotEmpty(dmaSalesAmountVoList)) {
|
|
|
+ vo.setCitizenUseVolume(dmaSalesAmountVoList.get(0).getAmountJm());
|
|
|
+ vo.setBusinessUseVolume(dmaSalesAmountVoList.get(0).getAmountFj());
|
|
|
+ vo.setSpecialUseVolume(dmaSalesAmountVoList.get(0).getAmountTs());
|
|
|
+ }
|
|
|
+
|
|
|
+ ScadaDataDto dto = new ScadaDataDto();
|
|
|
+ List<String> deviceTypeList = new ArrayList<>();
|
|
|
+ deviceTypeList.add("6");
|
|
|
+ deviceTypeList.add("7");
|
|
|
+ dto.setDeviceTypeList(deviceTypeList);
|
|
|
+ dto.setTableType(2);
|
|
|
+ dto.setTableName("STATISTICS_SCADA");
|
|
|
+ dto.setStatisticsType(1);
|
|
|
+ dto.setIndexType(IndexTypeEnum.CUM_NET_FLOW.getIndexType());
|
|
|
+ dto.setQueryMonth(yearMonth);
|
|
|
+ List<Dmaandobser> dmaandobserListFinal = dmaandobserList.stream().filter(e -> e.getDmaId().equals(dmaId)).collect(Collectors.toList());
|
|
|
+ if (CollUtil.isNotEmpty(dmaandobserListFinal)) {
|
|
|
+ dto.setDeviceIdList(dmaandobserListFinal.stream().map(Dmaandobser::getTableId).collect(Collectors.toList()));
|
|
|
+ List<ScadaIndexVo> waterFireScadaList = customDmaScadaMapper.viewScadaDataGroupTime(dto);
|
|
|
+ if (CollUtil.isNotEmpty(waterFireScadaList)) {
|
|
|
+ vo.setFreeUseVolume(BigDecimal.valueOf(waterFireScadaList.stream().mapToDouble(s -> Double.parseDouble(s.getIndexValue())).sum()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
dmaStatisticalMap.put(dmaId, vo);
|
|
|
});
|
|
|
|