//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 wpls = CacheContext.wpls; // Map> wppromap = CacheContext.wppromap; // Map> prolinemap = CacheContext.prolinemap; // List meterpoints = CacheContext.meterpoints; // Map> wppointmap = CacheContext.wppointmap; // Date samedayZero = DateUtils.getSamedayZero(); // Date monthFirstZero = DateUtils.getMonthFirstZero(); // Date yearFirstZero = DateUtils.getYearFirstZero(); // Date currentDate = DateUtils.getCurrentDate(); // wpls.stream().forEach(wp->{ // AtomicReference fcrfdl = new AtomicReference<>((double) 0); // AtomicReference fcyfdl = new AtomicReference<>((double) 0); // AtomicReference fcnfdl = new AtomicReference<>((double) 0); // wppromap.get(wp.getId()).stream().forEach(project -> { // AtomicReference qcrfdl = new AtomicReference<>(0.0); // AtomicReference qcyfdl = new AtomicReference<>(0.0); // AtomicReference qcnfdl = new AtomicReference<>(0.0); // prolinemap.get(project.getId()).stream().forEach(line -> { // Optional 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 dayFirst = edosUtil.getHistoryDatasSnap(pointid, samedayZero.getTime() / 1000, samedayZero.getTime() / 1000, 1l, null).stream().findFirst(); // if (dayFirst.isPresent()){ // sameday = dayFirst.get().getPointValueInDouble(); // } // Optional monthFirst = edosUtil.getHistoryDatasSnap(pointid, monthFirstZero.getTime() / 1000, monthFirstZero.getTime() / 1000, 1l, null).stream().findFirst(); // if (monthFirst.isPresent()){ // month = monthFirst.get().getPointValueInDouble(); // } // Optional 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(); // }); // } //}