123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- //package com.gyee.generation.service;
- //
- //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.util.realtimesource.EdosUtil;
- //import com.gyee.generation.util.realtimesource.IEdosUtil;
- //import org.springframework.stereotype.Service;
- //
- //import java.util.*;
- //import java.util.concurrent.atomic.AtomicReference;
- //
- ///**
- // * @ClassName : GenerationService
- // * @Author : xieshengjie
- // * @Date: 2022/2/28 15:23
- // * @Description :
- // */
- //@Service
- //public class GenerationService {
- //
- // private IEdosUtil edosUtil = new EdosUtil();
- //
- // public void saveGenerationDatas(){
- // List<Windpowerstation> wpls = CacheContext.wpls;
- // Map<String, List<Project>> wppromap = CacheContext.wppromap;
- // Map<String, List<Line>> prolinemap = CacheContext.prolinemap;
- // List<Meterpoint> meterpoints = CacheContext.meterpoints;
- // Map<String, Map<String, Windpowerstationpointnew>> wppointmap = CacheContext.wppointmap;
- // Date samedayZero = DateUtils.getSamedayZero();
- // Date monthFirstZero = DateUtils.getMonthFirstZero();
- // Date yearFirstZero = DateUtils.getYearFirstZero();
- // Date currentDate = DateUtils.getCurrentDate();
- // wpls.stream().forEach(wp->{
- // AtomicReference<Double> fcrfdl = new AtomicReference<>((double) 0);
- // AtomicReference<Double> fcyfdl = new AtomicReference<>((double) 0);
- // AtomicReference<Double> fcnfdl = new AtomicReference<>((double) 0);
- // wppromap.get(wp.getId()).stream().forEach(project -> {
- // AtomicReference<Double> qcrfdl = new AtomicReference<>(0.0);
- // AtomicReference<Double> qcyfdl = new AtomicReference<>(0.0);
- // AtomicReference<Double> qcnfdl = new AtomicReference<>(0.0);
- // prolinemap.get(project.getId()).stream().forEach(line -> {
- // Optional<Meterpoint> optionalMeterpoint = meterpoints.stream().filter(me -> me.getUniformcode().equals("ZXYG") && me.getMetertype().equals("进线") && me.getMetersort().equals("主")).findFirst();
- // if (optionalMeterpoint.isPresent()){
- // String pointid = optionalMeterpoint.get().getId();
- // Double real = 0.0;
- // Double sameday = 0.0;
- // Double month = 0.0;
- // Double year = 0.0;
- // try {
- // real = edosUtil.getRealData(pointid).getPointValueInDouble();
- // Optional<PointData> dayFirst = edosUtil.getHistoryDatasSnap(pointid, samedayZero.getTime() / 1000, samedayZero.getTime() / 1000, 1l, null).stream().findFirst();
- // if (dayFirst.isPresent()){
- // sameday = dayFirst.get().getPointValueInDouble();
- // }
- // Optional<PointData> monthFirst = edosUtil.getHistoryDatasSnap(pointid, monthFirstZero.getTime() / 1000, monthFirstZero.getTime() / 1000, 1l, null).stream().findFirst();
- // if (monthFirst.isPresent()){
- // month = monthFirst.get().getPointValueInDouble();
- // }
- // Optional<PointData> yearFirst = edosUtil.getHistoryDatasSnap(pointid, yearFirstZero.getTime() / 1000, yearFirstZero.getTime() / 1000, 1l, null).stream().findFirst();
- // if (yearFirst.isPresent()){
- // year = yearFirst.get().getPointValueInDouble();
- // }
- // Double magnification = optionalMeterpoint.get().getMagnification();
- // double xlrfdl = (real - sameday) * magnification;
- // qcrfdl.updateAndGet(v -> new Double((double) (v + xlrfdl)));
- // PointData r = new PointData();
- // r.setPointTime(currentDate.getTime());
- // r.setPointValue(String.valueOf(xlrfdl));
- // r.setPointValueInDouble(xlrfdl);
- // r.setEdnaId();
- // r.setPointName();
- //
- // double xlyfdl = (real - month) * magnification;
- // qcyfdl.updateAndGet(v -> new Double((double) (v + xlyfdl)));
- // PointData y = new PointData();
- // y.setPointTime(currentDate.getTime());
- // y.setPointValue(String.valueOf(xlyfdl));
- // y.setPointValueInDouble(xlyfdl);
- // y.setEdnaId();
- // y.setPointName();
- //
- // double xlnfdl = (real - year) * magnification;
- // qcnfdl.updateAndGet(v -> new Double((double) (v + xlnfdl)));
- // PointData n = new PointData();
- // n.setPointTime(currentDate.getTime());
- // n.setPointValue(String.valueOf(xlnfdl));
- // n.setPointValueInDouble(xlnfdl);
- // n.setEdnaId();
- // n.setPointName();
- // } catch (Exception e) {
- // e.printStackTrace();
- // }
- // }
- // });
- // fcrfdl.updateAndGet(v -> new Double((double) (v + qcrfdl.get())));
- // PointData r = new PointData();
- // r.setPointTime(currentDate.getTime());
- // r.setPointValue(String.valueOf(qcrfdl.get()));
- // r.setPointValueInDouble(qcrfdl.get());
- // r.setEdnaId();
- // r.setPointName();
- //
- // fcyfdl.updateAndGet(v -> new Double((double) (v + qcyfdl.get())));
- // PointData y = new PointData();
- // y.setPointTime(currentDate.getTime());
- // y.setPointValue(String.valueOf(qcyfdl.get()));
- // y.setPointValueInDouble(qcyfdl.get());
- // y.setEdnaId();
- // y.setPointName();
- //
- // fcnfdl.updateAndGet(v -> new Double((double) (v + qcnfdl.get())));
- // PointData n = new PointData();
- // n.setPointTime(currentDate.getTime());
- // n.setPointValue(String.valueOf(qcnfdl.get()));
- // n.setPointValueInDouble(qcnfdl.get());
- // n.setEdnaId();
- // n.setPointName();
- // });
- // PointData r = new PointData();
- // r.setPointTime(currentDate.getTime());
- // r.setPointValue(String.valueOf(fcrfdl.get()));
- // r.setPointValueInDouble(fcrfdl.get());
- // r.setEdnaId();
- // r.setPointName();
- //
- // PointData y = new PointData();
- // y.setPointTime(currentDate.getTime());
- // y.setPointValue(String.valueOf(fcyfdl.get()));
- // y.setPointValueInDouble(fcyfdl.get());
- // y.setEdnaId();
- // y.setPointName();
- //
- // PointData n = new PointData();
- // n.setPointTime(currentDate.getTime());
- // n.setPointValue(String.valueOf(fcnfdl.get()));
- // n.setPointValueInDouble(fcnfdl.get());
- // n.setEdnaId();
- // n.setPointName();
- // });
- // }
- //}
|