|
@@ -6,11 +6,443 @@ package com.gyee.generation.service.realtimelibrary;
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
+import com.gyee.common.contant.ContantXk;
|
|
|
|
+import com.gyee.common.model.PointData;
|
|
|
|
+import com.gyee.common.util.DateUtils;
|
|
|
|
+import com.gyee.generation.init.CacheContext;
|
|
|
|
+import com.gyee.generation.model.auto.*;
|
|
|
|
+import com.gyee.generation.service.auto.IProBasicMeterPointService;
|
|
|
|
+import com.gyee.generation.util.PointUtil;
|
|
|
|
+import com.gyee.generation.util.StringUtils;
|
|
|
|
+import com.gyee.generation.util.realtimesource.IEdosUtil;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
+
|
|
@Service
|
|
@Service
|
|
|
|
+@Slf4j
|
|
public class ElectricityMeteringService {
|
|
public class ElectricityMeteringService {
|
|
|
|
|
|
-// public void cal
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private IProBasicMeterPointService meterPointService;
|
|
|
|
+ @Resource
|
|
|
|
+ private IEdosUtil edosUtil;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public void saveGenerationDatas() throws Exception {
|
|
|
|
+
|
|
|
|
+ List<ProBasicLine> lnls = CacheContext.lnls;
|
|
|
|
+ List<ProBasicMeterPoint> meterpoints = CacheContext.meterpoints;
|
|
|
|
+ List<ProBasicProject> projects = CacheContext.pjls;
|
|
|
|
+ List<ProBasicWindpowerstation> wpls = CacheContext.wpls;
|
|
|
|
+ Map<String, Map<String, ProBasicWppoint>> linepointmap = CacheContext.linepointmap;
|
|
|
|
+ Map<String, Map<String, ProBasicWppoint>> propointmap = CacheContext.propointmap;
|
|
|
|
+ Map<String, Map<String, ProBasicWppoint>> wppointmap = CacheContext.wppointmap;
|
|
|
|
+ Map<String, List<ProBasicLine>> prolinemap = CacheContext.prolinemap;
|
|
|
|
+ Map<String, List<ProBasicProject>> wppromap = CacheContext.wppromap;
|
|
|
|
+ Date samedayZero = DateUtils.getSamedayZero();
|
|
|
|
+ Date monthFirstZero = DateUtils.getMonthFirstZero();
|
|
|
|
+ Date yearFirstZero = DateUtils.getYearFirstZero();
|
|
|
|
+ Date currentDate = DateUtils.getCurrentDate();
|
|
|
|
+ Date tomorrow = DateUtils.addDays(samedayZero,1);
|
|
|
|
+
|
|
|
|
+ List<PointData> lineResultList = new ArrayList<>();
|
|
|
|
+ lnls.stream().forEach(line->{
|
|
|
|
+ Map<String, ProBasicWppoint> proBasicWppointMap = linepointmap.get(line.getId());
|
|
|
|
+ //线路发电量
|
|
|
|
+ log.info(line.getName()+"电计量电量计算开始!");
|
|
|
|
+ Optional<ProBasicMeterPoint> fdlOptional = meterpoints.stream().filter(me -> me.getLineId().equals(line.getId()) && me.getUniformCode().equals("ZXYG") && me.getMeterType().equals("进线") && me.getMeterSort().equals("主")).findFirst();
|
|
|
|
+ getLineFdl(samedayZero, monthFirstZero, yearFirstZero, currentDate, lineResultList, proBasicWppointMap, fdlOptional);
|
|
|
|
+ log.info(line.getName()+"电计量电量计算完毕!");
|
|
|
|
+
|
|
|
|
+ //线路上网电量
|
|
|
|
+ log.info(line.getName()+"电计量上网电量计算开始!");
|
|
|
|
+ List<PointData> fdlList = new ArrayList<>();
|
|
|
|
+ Optional<ProBasicMeterPoint> swdlOptional = meterpoints.stream().filter(me -> me.getUniformCode().equals("ZXYG") && me.getMeterType().equals("出线") && me.getMeterSort().equals("主") && me.getLineId().contains(line.getId())).findFirst();
|
|
|
|
+ getLineOtherFdl(linepointmap, samedayZero, monthFirstZero, yearFirstZero, currentDate, lineResultList, line, proBasicWppointMap, fdlOptional, fdlList, swdlOptional);
|
|
|
|
+ log.info(line.getName()+"电计量上网电量计算完毕!");
|
|
|
|
+ //线路购网电量
|
|
|
|
+ log.info(line.getName()+"电计量购网电量计算开始!");
|
|
|
|
+ Optional<ProBasicMeterPoint> gwdlOptional = meterpoints.stream().filter(me -> me.getUniformCode().equals("FXYG") && me.getMeterType().equals("出线") && me.getMeterSort().equals("主") && me.getLineId().contains(line.getId())).findFirst();
|
|
|
|
+ getLineOtherFdl(linepointmap, samedayZero, monthFirstZero, yearFirstZero, currentDate, lineResultList, line, proBasicWppointMap, fdlOptional, fdlList, gwdlOptional);
|
|
|
|
+ log.info(line.getName()+"电计量购网电量计算完毕!");
|
|
|
|
+
|
|
|
|
+ //线路厂用电量
|
|
|
|
+ log.info(line.getName()+"电计量厂用电量计算开始!");
|
|
|
|
+ Optional<ProBasicMeterPoint> zybOptional = meterpoints.stream().filter(me-> me.getUniformCode().equals("ZXYG") && me.getMeterType().equals("站用变") && me.getMeterSort().equals("主") && me.getLineId().contains(line.getId())).findFirst();
|
|
|
|
+ getLineOtherFdl(linepointmap, samedayZero, monthFirstZero, yearFirstZero, currentDate, lineResultList, line, proBasicWppointMap, fdlOptional, fdlList, zybOptional);
|
|
|
|
+ log.info(line.getName()+"电计量厂用电量计算完毕!");
|
|
|
|
+
|
|
|
|
+ //农网购网电量
|
|
|
|
+ log.info(line.getName()+"农网购网电量计算开始!");
|
|
|
|
+ setZero(lineResultList,currentDate,proBasicWppointMap,ContantXk.RNWGWDL,ContantXk.YNWGWDL,ContantXk.NNWGWDL);
|
|
|
|
+ log.info(line.getName()+"农网购网电量计算完毕!");
|
|
|
|
+ });
|
|
|
|
+ //线路存储
|
|
|
|
+ edosUtil.sendMultiPoint(lineResultList);
|
|
|
|
+
|
|
|
|
+ List<PointData> proResultList = new ArrayList<>();
|
|
|
|
+ projects.stream().forEach(pro->{
|
|
|
|
+ Map<String, ProBasicWppoint> proBasicWppointMap = propointmap.get(pro.getId());
|
|
|
|
+ List<ProBasicLine> proBasicLines = prolinemap.get(pro.getId());
|
|
|
|
+ AtomicReference<Double> rfdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> yfdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> nfdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> rswdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> yswdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> nswdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> rgwgwdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> ygwgwdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> ngwgwdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> rnwgwdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> ynwgwdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> nnwgwdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> rcydl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> ycydl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> ncydl = new AtomicReference<>((double) 0);
|
|
|
|
+ proBasicLines.stream().forEach(line->{
|
|
|
|
+ try {
|
|
|
|
+ double linerfdl = getLineValue(line.getId(), ContantXk.RFDLSYZ, currentDate, linepointmap);
|
|
|
|
+ rfdl.updateAndGet(v -> new Double((double) (v + linerfdl)));
|
|
|
|
+ double lineyfdl = getLineValue(line.getId(), ContantXk.YFDLSYZ, currentDate, linepointmap);
|
|
|
|
+ yfdl.updateAndGet(v -> new Double((double) (v + lineyfdl)));
|
|
|
|
+ double linenfdl = getLineValue(line.getId(), ContantXk.NFDLSYZ, currentDate, linepointmap);
|
|
|
|
+ nfdl.updateAndGet(v -> new Double((double) (v + linenfdl)));
|
|
|
|
+ double linerswdl = getLineValue(line.getId(), ContantXk.RSWDL, currentDate, linepointmap);
|
|
|
|
+ rswdl.updateAndGet(v -> new Double((double) (v + linerswdl)));
|
|
|
|
+ double lineyswdl = getLineValue(line.getId(), ContantXk.YSWDL, currentDate, linepointmap);
|
|
|
|
+ yswdl.updateAndGet(v -> new Double((double) (v + lineyswdl)));
|
|
|
|
+ double linenswdl = getLineValue(line.getId(), ContantXk.NSWDL, currentDate, linepointmap);
|
|
|
|
+ nswdl.updateAndGet(v -> new Double((double) (v + linenswdl)));
|
|
|
|
+ double linergwgwdl = getLineValue(line.getId(), ContantXk.RGWGWDL, currentDate, linepointmap);
|
|
|
|
+ rgwgwdl.updateAndGet(v -> new Double((double) (v + linergwgwdl)));
|
|
|
|
+ double lineygwgwdl = getLineValue(line.getId(), ContantXk.YGWGWDL, currentDate, linepointmap);
|
|
|
|
+ ygwgwdl.updateAndGet(v -> new Double((double) (v + lineygwgwdl)));
|
|
|
|
+ double linengwgwdl = getLineValue(line.getId(), ContantXk.NGWGWDL, currentDate, linepointmap);
|
|
|
|
+ ngwgwdl.updateAndGet(v -> new Double((double) (v + linengwgwdl)));
|
|
|
|
+ double linernwgwdl = getLineValue(line.getId(), ContantXk.RNWGWDL, currentDate, linepointmap);
|
|
|
|
+ rnwgwdl.updateAndGet(v -> new Double((double) (v + linernwgwdl)));
|
|
|
|
+ double lineynwgwdl = getLineValue(line.getId(), ContantXk.YNWGWDL, currentDate, linepointmap);
|
|
|
|
+ ynwgwdl.updateAndGet(v -> new Double((double) (v + lineynwgwdl)));
|
|
|
|
+ double linennwgwdl = getLineValue(line.getId(), ContantXk.NNWGWDL, currentDate, linepointmap);
|
|
|
|
+ nnwgwdl.updateAndGet(v -> new Double((double) (v + linennwgwdl)));
|
|
|
|
+ double linercydl = getLineValue(line.getId(), ContantXk.RCYDL, currentDate, linepointmap);
|
|
|
|
+ rcydl.updateAndGet(v -> new Double((double) (v + linercydl)));
|
|
|
|
+ double lineycydl = getLineValue(line.getId(), ContantXk.YCYDL, currentDate, linepointmap);
|
|
|
|
+ ycydl.updateAndGet(v -> new Double((double) (v + lineycydl)));
|
|
|
|
+ double linencydl = getLineValue(line.getId(), ContantXk.NCYDL, currentDate, linepointmap);
|
|
|
|
+ ncydl.updateAndGet(v -> new Double((double) (v + linencydl)));
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ ProBasicWppoint rfdlpoint = proBasicWppointMap.get(ContantXk.RFDLSYZ);
|
|
|
|
+ proResultList.add(PointUtil.createPointData(currentDate,rfdl.get(),rfdlpoint.getNemCode(),rfdlpoint.getName()));
|
|
|
|
+ ProBasicWppoint yfdlpoint = proBasicWppointMap.get(ContantXk.YFDLSYZ);
|
|
|
|
+ proResultList.add(PointUtil.createPointData(currentDate,yfdl.get(),yfdlpoint.getNemCode(),yfdlpoint.getName()));
|
|
|
|
+ ProBasicWppoint nfdlpoint = proBasicWppointMap.get(ContantXk.YFDLSYZ);
|
|
|
|
+ proResultList.add(PointUtil.createPointData(currentDate,nfdl.get(),yfdlpoint.getNemCode(),nfdlpoint.getName()));
|
|
|
|
+
|
|
|
|
+ ProBasicWppoint rswdlpoint = proBasicWppointMap.get(ContantXk.RSWDL);
|
|
|
|
+ proResultList.add(PointUtil.createPointData(currentDate,rswdl.get(),rswdlpoint.getNemCode(),rswdlpoint.getName()));
|
|
|
|
+ ProBasicWppoint yswdlpoint = proBasicWppointMap.get(ContantXk.YSWDL);
|
|
|
|
+ proResultList.add(PointUtil.createPointData(currentDate,yswdl.get(),yswdlpoint.getNemCode(),yswdlpoint.getName()));
|
|
|
|
+ ProBasicWppoint nswdlpoint = proBasicWppointMap.get(ContantXk.NSWDL);
|
|
|
|
+ proResultList.add(PointUtil.createPointData(currentDate,nswdl.get(),nswdlpoint.getNemCode(),nswdlpoint.getName()));
|
|
|
|
+
|
|
|
|
+ ProBasicWppoint rgwgwdlpoint = proBasicWppointMap.get(ContantXk.RGWGWDL);
|
|
|
|
+ proResultList.add(PointUtil.createPointData(currentDate,rgwgwdl.get(),rgwgwdlpoint.getNemCode(),rgwgwdlpoint.getName()));
|
|
|
|
+ ProBasicWppoint ygwgwdlpoint = proBasicWppointMap.get(ContantXk.YGWGWDL);
|
|
|
|
+ proResultList.add(PointUtil.createPointData(currentDate,ygwgwdl.get(),ygwgwdlpoint.getNemCode(),ygwgwdlpoint.getName()));
|
|
|
|
+ ProBasicWppoint ngwgwdlpoint = proBasicWppointMap.get(ContantXk.NGWGWDL);
|
|
|
|
+ proResultList.add(PointUtil.createPointData(currentDate,ngwgwdl.get(),ngwgwdlpoint.getNemCode(),ngwgwdlpoint.getName()));
|
|
|
|
+
|
|
|
|
+ ProBasicWppoint rnwgwdlpoint = proBasicWppointMap.get(ContantXk.RNWGWDL);
|
|
|
|
+ proResultList.add(PointUtil.createPointData(currentDate,rnwgwdl.get(),rnwgwdlpoint.getNemCode(),rnwgwdlpoint.getName()));
|
|
|
|
+ ProBasicWppoint ynwgwdlpoint = proBasicWppointMap.get(ContantXk.YNWGWDL);
|
|
|
|
+ proResultList.add(PointUtil.createPointData(currentDate,ynwgwdl.get(),ynwgwdlpoint.getNemCode(),ynwgwdlpoint.getName()));
|
|
|
|
+ ProBasicWppoint nnwgwdlpoint = proBasicWppointMap.get(ContantXk.NNWGWDL);
|
|
|
|
+ proResultList.add(PointUtil.createPointData(currentDate,nnwgwdl.get(),nnwgwdlpoint.getNemCode(),nnwgwdlpoint.getName()));
|
|
|
|
+
|
|
|
|
+ ProBasicWppoint rcydlpoint = proBasicWppointMap.get(ContantXk.RCYDL);
|
|
|
|
+ proResultList.add(PointUtil.createPointData(currentDate,rcydl.get(),rcydlpoint.getNemCode(),rcydlpoint.getName()));
|
|
|
|
+ ProBasicWppoint ycydlpoint = proBasicWppointMap.get(ContantXk.YCYDL);
|
|
|
|
+ proResultList.add(PointUtil.createPointData(currentDate,ycydl.get(),ycydlpoint.getNemCode(),ycydlpoint.getName()));
|
|
|
|
+ ProBasicWppoint ncydlpoint = proBasicWppointMap.get(ContantXk.NCYDL);
|
|
|
|
+ proResultList.add(PointUtil.createPointData(currentDate,ncydl.get(),ncydlpoint.getNemCode(),ncydlpoint.getName()));
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ //期次存储
|
|
|
|
+ edosUtil.sendMultiPoint(proResultList);
|
|
|
|
+
|
|
|
|
+ List<PointData> wpResultList = new ArrayList<>();
|
|
|
|
+ wpls.stream().forEach(wp->{
|
|
|
|
+ Map<String, ProBasicWppoint> wpBasicWppointMap = wppointmap.get(wp.getId());
|
|
|
|
+ List<ProBasicProject> proBasicPros = wppromap.get(wp.getId());
|
|
|
|
+ AtomicReference<Double> rfdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> yfdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> nfdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> rswdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> yswdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> nswdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> rgwgwdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> ygwgwdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> ngwgwdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> rnwgwdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> ynwgwdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> nnwgwdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> rcydl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> ycydl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> ncydl = new AtomicReference<>((double) 0);
|
|
|
|
+ proBasicPros.stream().forEach(line->{ //期次
|
|
|
|
+ try {
|
|
|
|
+ double linerfdl = getLineValue(line.getId(), ContantXk.RFDLSYZ, currentDate, linepointmap);
|
|
|
|
+ rfdl.updateAndGet(v -> new Double((double) (v + linerfdl)));
|
|
|
|
+ double lineyfdl = getLineValue(line.getId(), ContantXk.YFDLSYZ, currentDate, linepointmap);
|
|
|
|
+ yfdl.updateAndGet(v -> new Double((double) (v + lineyfdl)));
|
|
|
|
+ double linenfdl = getLineValue(line.getId(), ContantXk.NFDLSYZ, currentDate, linepointmap);
|
|
|
|
+ nfdl.updateAndGet(v -> new Double((double) (v + linenfdl)));
|
|
|
|
+ double linerswdl = getLineValue(line.getId(), ContantXk.RSWDL, currentDate, linepointmap);
|
|
|
|
+ rswdl.updateAndGet(v -> new Double((double) (v + linerswdl)));
|
|
|
|
+ double lineyswdl = getLineValue(line.getId(), ContantXk.YSWDL, currentDate, linepointmap);
|
|
|
|
+ yswdl.updateAndGet(v -> new Double((double) (v + lineyswdl)));
|
|
|
|
+ double linenswdl = getLineValue(line.getId(), ContantXk.NSWDL, currentDate, linepointmap);
|
|
|
|
+ nswdl.updateAndGet(v -> new Double((double) (v + linenswdl)));
|
|
|
|
+ double linergwgwdl = getLineValue(line.getId(), ContantXk.RGWGWDL, currentDate, linepointmap);
|
|
|
|
+ rgwgwdl.updateAndGet(v -> new Double((double) (v + linergwgwdl)));
|
|
|
|
+ double lineygwgwdl = getLineValue(line.getId(), ContantXk.YGWGWDL, currentDate, linepointmap);
|
|
|
|
+ ygwgwdl.updateAndGet(v -> new Double((double) (v + lineygwgwdl)));
|
|
|
|
+ double linengwgwdl = getLineValue(line.getId(), ContantXk.NGWGWDL, currentDate, linepointmap);
|
|
|
|
+ ngwgwdl.updateAndGet(v -> new Double((double) (v + linengwgwdl)));
|
|
|
|
+ double linernwgwdl = getLineValue(line.getId(), ContantXk.RNWGWDL, currentDate, linepointmap);
|
|
|
|
+ rnwgwdl.updateAndGet(v -> new Double((double) (v + linernwgwdl)));
|
|
|
|
+ double lineynwgwdl = getLineValue(line.getId(), ContantXk.YNWGWDL, currentDate, linepointmap);
|
|
|
|
+ ynwgwdl.updateAndGet(v -> new Double((double) (v + lineynwgwdl)));
|
|
|
|
+ double linennwgwdl = getLineValue(line.getId(), ContantXk.NNWGWDL, currentDate, linepointmap);
|
|
|
|
+ nnwgwdl.updateAndGet(v -> new Double((double) (v + linennwgwdl)));
|
|
|
|
+ double linercydl = getLineValue(line.getId(), ContantXk.RCYDL, currentDate, linepointmap);
|
|
|
|
+ rcydl.updateAndGet(v -> new Double((double) (v + linercydl)));
|
|
|
|
+ double lineycydl = getLineValue(line.getId(), ContantXk.YCYDL, currentDate, linepointmap);
|
|
|
|
+ ycydl.updateAndGet(v -> new Double((double) (v + lineycydl)));
|
|
|
|
+ double linencydl = getLineValue(line.getId(), ContantXk.NCYDL, currentDate, linepointmap);
|
|
|
|
+ ncydl.updateAndGet(v -> new Double((double) (v + linencydl)));
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ ProBasicWppoint rfdlpoint = wpBasicWppointMap.get(ContantXk.RFDLSYZ);
|
|
|
|
+ wpResultList.add(PointUtil.createPointData(currentDate,rfdl.get(),rfdlpoint.getNemCode(),rfdlpoint.getName()));
|
|
|
|
+ ProBasicWppoint yfdlpoint = wpBasicWppointMap.get(ContantXk.YFDLSYZ);
|
|
|
|
+ wpResultList.add(PointUtil.createPointData(currentDate,yfdl.get(),yfdlpoint.getNemCode(),yfdlpoint.getName()));
|
|
|
|
+ ProBasicWppoint nfdlpoint = wpBasicWppointMap.get(ContantXk.YFDLSYZ);
|
|
|
|
+ wpResultList.add(PointUtil.createPointData(currentDate,nfdl.get(),yfdlpoint.getNemCode(),nfdlpoint.getName()));
|
|
|
|
+
|
|
|
|
+ ProBasicWppoint rswdlpoint = wpBasicWppointMap.get(ContantXk.RSWDL);
|
|
|
|
+ wpResultList.add(PointUtil.createPointData(currentDate,rswdl.get(),rswdlpoint.getNemCode(),rswdlpoint.getName()));
|
|
|
|
+ ProBasicWppoint yswdlpoint = wpBasicWppointMap.get(ContantXk.YSWDL);
|
|
|
|
+ wpResultList.add(PointUtil.createPointData(currentDate,yswdl.get(),yswdlpoint.getNemCode(),yswdlpoint.getName()));
|
|
|
|
+ ProBasicWppoint nswdlpoint = wpBasicWppointMap.get(ContantXk.NSWDL);
|
|
|
|
+ wpResultList.add(PointUtil.createPointData(currentDate,nswdl.get(),nswdlpoint.getNemCode(),nswdlpoint.getName()));
|
|
|
|
+
|
|
|
|
+ ProBasicWppoint rgwgwdlpoint = wpBasicWppointMap.get(ContantXk.RGWGWDL);
|
|
|
|
+ wpResultList.add(PointUtil.createPointData(currentDate,rgwgwdl.get(),rgwgwdlpoint.getNemCode(),rgwgwdlpoint.getName()));
|
|
|
|
+ ProBasicWppoint ygwgwdlpoint = wpBasicWppointMap.get(ContantXk.YGWGWDL);
|
|
|
|
+ wpResultList.add(PointUtil.createPointData(currentDate,ygwgwdl.get(),ygwgwdlpoint.getNemCode(),ygwgwdlpoint.getName()));
|
|
|
|
+ ProBasicWppoint ngwgwdlpoint = wpBasicWppointMap.get(ContantXk.NGWGWDL);
|
|
|
|
+ wpResultList.add(PointUtil.createPointData(currentDate,ngwgwdl.get(),ngwgwdlpoint.getNemCode(),ngwgwdlpoint.getName()));
|
|
|
|
+
|
|
|
|
+ ProBasicWppoint rnwgwdlpoint = wpBasicWppointMap.get(ContantXk.RNWGWDL);
|
|
|
|
+ wpResultList.add(PointUtil.createPointData(currentDate,rnwgwdl.get(),rnwgwdlpoint.getNemCode(),rnwgwdlpoint.getName()));
|
|
|
|
+ ProBasicWppoint ynwgwdlpoint = wpBasicWppointMap.get(ContantXk.YNWGWDL);
|
|
|
|
+ wpResultList.add(PointUtil.createPointData(currentDate,ynwgwdl.get(),ynwgwdlpoint.getNemCode(),ynwgwdlpoint.getName()));
|
|
|
|
+ ProBasicWppoint nnwgwdlpoint = wpBasicWppointMap.get(ContantXk.NNWGWDL);
|
|
|
|
+ wpResultList.add(PointUtil.createPointData(currentDate,nnwgwdl.get(),nnwgwdlpoint.getNemCode(),nnwgwdlpoint.getName()));
|
|
|
|
+
|
|
|
|
+ ProBasicWppoint rcydlpoint = wpBasicWppointMap.get(ContantXk.RCYDL);
|
|
|
|
+ wpResultList.add(PointUtil.createPointData(currentDate,rcydl.get(),rcydlpoint.getNemCode(),rcydlpoint.getName()));
|
|
|
|
+ ProBasicWppoint ycydlpoint = wpBasicWppointMap.get(ContantXk.YCYDL);
|
|
|
|
+ wpResultList.add(PointUtil.createPointData(currentDate,ycydl.get(),ycydlpoint.getNemCode(),ycydlpoint.getName()));
|
|
|
|
+ ProBasicWppoint ncydlpoint = wpBasicWppointMap.get(ContantXk.NCYDL);
|
|
|
|
+ wpResultList.add(PointUtil.createPointData(currentDate,ncydl.get(),ncydlpoint.getNemCode(),ncydlpoint.getName()));
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ //场站存储
|
|
|
|
+ edosUtil.sendMultiPoint(wpResultList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private double getLineValue(String lineid, String uniformcode, Date currentDate, Map<String, Map<String, ProBasicWppoint>> linepointmap) throws Exception {
|
|
|
|
+ ProBasicWppoint proBasicWppoint = linepointmap.get(lineid).get(uniformcode);
|
|
|
|
+ return edosUtil.getSectionData(proBasicWppoint,currentDate.getTime()).getPointValueInDouble();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ private void setZero(List<PointData> resultList,Date currentDate,Map<String, ProBasicWppoint> linemap,String rcode,String ycode,String ncode) {
|
|
|
|
+ //线路日发电量
|
|
|
|
+ PointData r = new PointData();
|
|
|
|
+ r.setPointTime(currentDate.getTime());
|
|
|
|
+ r.setPointValue("0");
|
|
|
|
+ r.setPointValueInDouble(0);
|
|
|
|
+ r.setEdnaId(linemap.get(rcode).getNemCode());
|
|
|
|
+ r.setPointName(linemap.get(rcode).getName());
|
|
|
|
+ resultList.add(r);
|
|
|
|
+ //线路月发电量
|
|
|
|
+ PointData y = new PointData();
|
|
|
|
+ y.setPointTime(currentDate.getTime());
|
|
|
|
+ y.setPointValue("0");
|
|
|
|
+ y.setPointValueInDouble(0);
|
|
|
|
+ y.setEdnaId(linemap.get(ycode).getNemCode());
|
|
|
|
+ y.setPointName(linemap.get(ycode).getName());
|
|
|
|
+ resultList.add(y);
|
|
|
|
+ //线路年发电量
|
|
|
|
+ PointData n = new PointData();
|
|
|
|
+ n.setPointTime(currentDate.getTime());
|
|
|
|
+ n.setPointValue("0");
|
|
|
|
+ n.setPointValueInDouble(0);
|
|
|
|
+ n.setEdnaId(linemap.get(ncode).getNemCode());
|
|
|
|
+ n.setPointName(linemap.get(ncode).getName());
|
|
|
|
+ resultList.add(n);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void getLineOtherFdl(Map<String, Map<String, ProBasicWppoint>> linepointmap, Date samedayZero, Date monthFirstZero, Date yearFirstZero, Date currentDate, List<PointData> lineResultList, ProBasicLine line, Map<String, ProBasicWppoint> proBasicWppointMap, Optional<ProBasicMeterPoint> fdlOptional, List<PointData> fdlList, Optional<ProBasicMeterPoint> swdlOptional) {
|
|
|
|
+ if (swdlOptional.isPresent()){
|
|
|
|
+ ProBasicMeterPoint swdlMeterpoint = swdlOptional.get();
|
|
|
|
+ if (StringUtils.isEmpty(fdlList)){
|
|
|
|
+ String[] lines = swdlMeterpoint.getLineId().split("\\|");
|
|
|
|
+ Arrays.stream(lines).forEach(l->{
|
|
|
|
+ getLineFdl(samedayZero, monthFirstZero, yearFirstZero, currentDate, fdlList, proBasicWppointMap, fdlOptional);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ //获取电量百分比,算其他电量
|
|
|
|
+ Map<String, Double> percentageMap = getPercentage(fdlList,swdlMeterpoint,linepointmap, line);
|
|
|
|
+
|
|
|
|
+ String pointid = swdlMeterpoint.getId();
|
|
|
|
+ Double real = 0.0;
|
|
|
|
+ Double sameday = 0.0;
|
|
|
|
+ Double month = 0.0;
|
|
|
|
+ Double year = 0.0;
|
|
|
|
+ try {
|
|
|
|
+ real = edosUtil.getSectionData(pointid,currentDate.getTime()).getPointValueInDouble();
|
|
|
|
+ sameday = edosUtil.getSectionData(pointid,samedayZero.getTime()).getPointValueInDouble();
|
|
|
|
+ month = edosUtil.getSectionData(pointid,monthFirstZero.getTime()).getPointValueInDouble();
|
|
|
|
+ year = edosUtil.getSectionData(pointid,yearFirstZero.getTime()).getPointValueInDouble();
|
|
|
|
+
|
|
|
|
+ Double magnification = swdlMeterpoint.getMagnification();
|
|
|
|
+ Double xs = swdlMeterpoint.getXs();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //线路上网电量
|
|
|
|
+ double xlswdl = (real - sameday) * magnification / xs * percentageMap.get("percentage");
|
|
|
|
+ ProBasicWppoint rpoint = proBasicWppointMap.get(ContantXk.RSWDL);
|
|
|
|
+ PointData rpointData = PointUtil.createPointData(currentDate, xlswdl, rpoint.getNemCode(), rpoint.getName());
|
|
|
|
+ lineResultList.add(rpointData);
|
|
|
|
+ //线路月上网发电量
|
|
|
|
+ double xlyswdl = (real - month) * magnification / xs * percentageMap.get("ypercentage");
|
|
|
|
+ ProBasicWppoint ypoint = proBasicWppointMap.get(ContantXk.YSWDL);
|
|
|
|
+ PointData ypointData = PointUtil.createPointData(currentDate, xlyswdl, ypoint.getNemCode(), ypoint.getName());
|
|
|
|
+ lineResultList.add(ypointData);
|
|
|
|
+ //线路年上网发电量
|
|
|
|
+ double xlnswfdl = (real - year) * magnification / xs * percentageMap.get("npercentage");
|
|
|
|
+ ProBasicWppoint npoint = proBasicWppointMap.get(ContantXk.NSWDL);
|
|
|
|
+ PointData npointData = PointUtil.createPointData(currentDate, xlnswfdl, npoint.getNemCode(), npoint.getName());
|
|
|
|
+ lineResultList.add(npointData);
|
|
|
|
+
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void getLineFdl(Date samedayZero, Date monthFirstZero, Date yearFirstZero, Date currentDate, List<PointData> lineResultList, Map<String, ProBasicWppoint> proBasicWppointMap, Optional<ProBasicMeterPoint> fdlOptional) {
|
|
|
|
+ if (fdlOptional.isPresent()){
|
|
|
|
+ ProBasicMeterPoint proBasicMeterPoint = fdlOptional.get();
|
|
|
|
+ String pointid = proBasicMeterPoint.getId();
|
|
|
|
+ Double real = 0.0;
|
|
|
|
+ Double sameday = 0.0;
|
|
|
|
+ Double month = 0.0;
|
|
|
|
+ Double year = 0.0;
|
|
|
|
+ try {
|
|
|
|
+ real = edosUtil.getSectionData(pointid,currentDate.getTime()).getPointValueInDouble();
|
|
|
|
+ sameday = edosUtil.getSectionData(pointid,samedayZero.getTime()).getPointValueInDouble();
|
|
|
|
+ month = edosUtil.getSectionData(pointid,monthFirstZero.getTime()).getPointValueInDouble();
|
|
|
|
+ year = edosUtil.getSectionData(pointid,yearFirstZero.getTime()).getPointValueInDouble();
|
|
|
|
+
|
|
|
|
+ Double magnification = fdlOptional.get().getMagnification();
|
|
|
|
+ Double xs = proBasicMeterPoint.getXs();
|
|
|
|
+ //线路日发电量
|
|
|
|
+ double xlrfdl = (real - sameday) * magnification / xs;
|
|
|
|
+ ProBasicWppoint rpoint = proBasicWppointMap.get(ContantXk.RFDLSYZ);
|
|
|
|
+ PointData r = PointUtil.createPointData(currentDate, xlrfdl, rpoint.getNemCode(),rpoint.getName());
|
|
|
|
+ lineResultList.add(r);
|
|
|
|
+ //线路月发电量
|
|
|
|
+ double xlyfdl = (real - month) * magnification / xs;
|
|
|
|
+ ProBasicWppoint ypoint = proBasicWppointMap.get(ContantXk.YFDLSYZ);
|
|
|
|
+ PointData y = PointUtil.createPointData(currentDate, xlyfdl,ypoint.getNemCode(),ypoint.getName());
|
|
|
|
+ lineResultList.add(y);
|
|
|
|
+ //线路年发电量
|
|
|
|
+ double xlnfdl = (real - year) * magnification / xs;
|
|
|
|
+ ProBasicWppoint npoint = proBasicWppointMap.get(ContantXk.NFDLSYZ);
|
|
|
|
+ PointData n = PointUtil.createPointData(currentDate, xlnfdl,npoint.getNemCode(),npoint.getName());
|
|
|
|
+ lineResultList.add(n);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private Map<String,Double> getPercentage(List<PointData> fdlList,ProBasicMeterPoint swdlMeterpoint,Map<String, Map<String, ProBasicWppoint>> linepointmap,ProBasicLine line){
|
|
|
|
+
|
|
|
|
+ Map<String,Double> percentageMap = new HashMap<>();
|
|
|
|
+ String[] swdlLines = swdlMeterpoint.getLineId().split("\\|");
|
|
|
|
+ AtomicReference<Double> xldl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> xlzdl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> xlydl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> xlzydl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> xlndl = new AtomicReference<>((double) 0);
|
|
|
|
+ AtomicReference<Double> xlzndl = new AtomicReference<>((double) 0);
|
|
|
|
+ Arrays.stream(swdlLines).forEach(l->{
|
|
|
|
+ Optional<PointData> xldlfirst = fdlList.stream().filter(res -> res.getEdnaId().equals(linepointmap.get(l).get(ContantXk.RFDLSYZ).getNemCode())).findFirst();
|
|
|
|
+ if (xldlfirst.isPresent()){
|
|
|
|
+ if (l.equals(line.getId())){
|
|
|
|
+ xldl.set(xldlfirst.get().getPointValueInDouble());
|
|
|
|
+ xlzdl.updateAndGet(v -> new Double((double) (v + xldlfirst.get().getPointValueInDouble())));
|
|
|
|
+ }else{
|
|
|
|
+ xlzdl.updateAndGet(v -> new Double((double) (v + xldlfirst.get().getPointValueInDouble())));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Optional<PointData> xlydlfirst = fdlList.stream().filter(res -> res.getEdnaId().equals(linepointmap.get(l).get(ContantXk.YFDLSYZ).getNemCode())).findFirst();
|
|
|
|
+ if (xlydlfirst.isPresent()){
|
|
|
|
+ if (l.equals(line.getId())){
|
|
|
|
+ xlydl.set(xlydlfirst.get().getPointValueInDouble());
|
|
|
|
+ xlzydl.updateAndGet(v -> new Double((double) (v + xlydlfirst.get().getPointValueInDouble())));
|
|
|
|
+ }else{
|
|
|
|
+ xlzydl.updateAndGet(v -> new Double((double) (v + xlydlfirst.get().getPointValueInDouble())));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Optional<PointData> xlndlfirst = fdlList.stream().filter(res -> res.getEdnaId().equals(linepointmap.get(l).get(ContantXk.NFDLSYZ).getNemCode())).findFirst();
|
|
|
|
+ if (xlndlfirst.isPresent()){
|
|
|
|
+ if (l.equals(line.getId())){
|
|
|
|
+ xlndl.set(xlndlfirst.get().getPointValueInDouble());
|
|
|
|
+ xlzndl.updateAndGet(v -> new Double((double) (v + xlndlfirst.get().getPointValueInDouble())));
|
|
|
|
+ }else{
|
|
|
|
+ xlzndl.updateAndGet(v -> new Double((double) (v + xlndlfirst.get().getPointValueInDouble())));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ //电量百分比
|
|
|
|
+ double percentage = xlzdl.get() != 0 ? xldl.get() / xlzdl.get() * 100 : 0;
|
|
|
|
+ percentageMap.put("percentage",percentage);
|
|
|
|
+ double ypercentage = xlzydl.get() != 0 ? xlydl.get() / xlzydl.get() * 100 : 0;
|
|
|
|
+ percentageMap.put("ypercentage",ypercentage);
|
|
|
|
+ double npercentage = xlzndl.get() != 0 ? xlndl.get() / xlzndl.get() * 100 : 0;
|
|
|
|
+ percentageMap.put("npercentage",npercentage);
|
|
|
|
+ return percentageMap;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|