Prechádzať zdrojové kódy

增加状态点缓存

xieshengjie 3 rokov pred
rodič
commit
446656cced
20 zmenil súbory, kde vykonal 425 pridanie a 71 odobranie
  1. 20 0
      cache/src/main/java/com/gyee/cache/controller/WindturbinestatusdiController.java
  2. 20 0
      cache/src/main/java/com/gyee/cache/controller/WindturbinetestingpointdisController.java
  3. 51 3
      cache/src/main/java/com/gyee/cache/init/CacheContext.java
  4. 16 0
      cache/src/main/java/com/gyee/cache/mapper/auto/WindturbinestatusdiMapper.java
  5. 16 0
      cache/src/main/java/com/gyee/cache/mapper/auto/WindturbinetestingpointdisMapper.java
  6. 80 0
      cache/src/main/java/com/gyee/cache/model/auto/Windturbinestatusdi.java
  7. 80 0
      cache/src/main/java/com/gyee/cache/model/auto/Windturbinetestingpointdis.java
  8. 16 0
      cache/src/main/java/com/gyee/cache/service/auto/IWindturbinestatusdiService.java
  9. 16 0
      cache/src/main/java/com/gyee/cache/service/auto/IWindturbinetestingpointdisService.java
  10. 20 0
      cache/src/main/java/com/gyee/cache/service/auto/impl/WindturbinestatusdiServiceImpl.java
  11. 20 0
      cache/src/main/java/com/gyee/cache/service/auto/impl/WindturbinetestingpointdisServiceImpl.java
  12. 1 2
      cache/src/main/resources/application-hb.yml
  13. 0 2
      cache/src/main/resources/application-hbtd.yml
  14. 1 1
      cache/src/main/resources/application.yml
  15. 6 8
      realtime/generation-service/src/main/java/com/gyee/generation/service/AverageAndGeneratingService.java
  16. 48 49
      realtime/generation-service/src/main/java/com/gyee/generation/service/GenerationService.java
  17. 1 1
      realtime/generation-service/src/main/java/com/gyee/generation/util/realtimesource/EdosUtil.java
  18. 6 3
      realtime/generation-service/src/main/resources/application-dev.yml
  19. 2 2
      realtime/generation-service/src/main/resources/application.yml
  20. 5 0
      realtime/generation-service/src/test/java/com/gyee/generation/GenerationTest.java

+ 20 - 0
cache/src/main/java/com/gyee/cache/controller/WindturbinestatusdiController.java

@@ -0,0 +1,20 @@
+package com.gyee.cache.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-03-25
+ */
+@RestController
+@RequestMapping("//windturbinestatusdi")
+public class WindturbinestatusdiController {
+
+}

+ 20 - 0
cache/src/main/java/com/gyee/cache/controller/WindturbinetestingpointdisController.java

@@ -0,0 +1,20 @@
+package com.gyee.cache.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-03-25
+ */
+@RestController
+@RequestMapping("//windturbinetestingpointdis")
+public class WindturbinetestingpointdisController {
+
+}

+ 51 - 3
cache/src/main/java/com/gyee/cache/init/CacheContext.java

@@ -9,7 +9,6 @@ import com.gyee.cache.service.auto.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.CommandLineRunner;
 import org.springframework.stereotype.Component;
 
@@ -52,8 +51,11 @@ public class CacheContext implements CommandLineRunner {
     private IWindturbinetestingpointnewService windturbinetestingpointnewService;
     @Autowired
     private IWindpowerstationpointnewService windpowerstationpointnewService;
-    @Value("${runWindpowerstation}")
-    private String runWindpowerstation;
+    @Autowired
+    private IWindturbinetestingpointdisService windturbinetestingpointdisService;
+    @Autowired
+    private IWindturbinestatusdiService windturbinestatusdiService;
+
 
     public static Map<String, Map<String, Windturbinetestingpointai>> wtpointMap = new HashMap<>();
     public static List<Windturbine> wtls = new ArrayList<>();
@@ -334,5 +336,51 @@ public class CacheContext implements CommandLineRunner {
             redisService.set(i,s);
         });
 
+        logger.info("--------------------------redis五种状态");
+        Map<String,Map<String,List<Windturbinetestingpointdis>>> wzztMap = new HashMap<>();
+        List<Windturbinetestingpointdis> windturbinetestingpointdis = windturbinetestingpointdisService.list();
+        windturbinetestingpointdis.stream().forEach(w->{
+            if (wzztMap.containsKey(w.getWindturbineid())){
+                Map<String, List<Windturbinetestingpointdis>> stringListMap = wzztMap.get(w.getWindturbineid());
+                if (stringListMap.containsKey(w.getUniformcode())){
+                    stringListMap.get(w.getUniformcode()).add(w);
+                }else {
+                    List<Windturbinetestingpointdis> wdisList = new ArrayList<>();
+                    wdisList.add(w);
+                    stringListMap.put(w.getUniformcode(),wdisList);
+                }
+            }else {
+                Map<String,List<Windturbinetestingpointdis>> map = new HashMap<>();
+                List<Windturbinetestingpointdis> wdisList = new ArrayList<>();
+                wdisList.add(w);
+                map.put(w.getUniformcode(),wdisList);
+                wzztMap.put(w.getWindturbineid(),map);
+            }
+        });
+        redisService.set("WZZT",JSONObject.toJSONString(wzztMap));
+
+        logger.info("--------------------------redis十三种状态");
+        Map<String,Map<String,List<Windturbinestatusdi>>> sszztMap = new HashMap<>();
+        List<Windturbinestatusdi> windturbinestatusdis = windturbinestatusdiService.list();
+        windturbinestatusdis.stream().forEach(w->{
+            if (sszztMap.containsKey(w.getWindturbineid())){
+                Map<String, List<Windturbinestatusdi>> stringListMap = sszztMap.get(w.getWindturbineid());
+                if (stringListMap.containsKey(w.getUniformcode())){
+                    stringListMap.get(w.getUniformcode()).add(w);
+                }else {
+                    List<Windturbinestatusdi> wdisList = new ArrayList<>();
+                    wdisList.add(w);
+                    stringListMap.put(w.getUniformcode(),wdisList);
+                }
+            }else {
+                Map<String,List<Windturbinestatusdi>> map = new HashMap<>();
+                List<Windturbinestatusdi> wdisList = new ArrayList<>();
+                wdisList.add(w);
+                map.put(w.getUniformcode(),wdisList);
+                sszztMap.put(w.getWindturbineid(),map);
+            }
+        });
+        redisService.set("SSZZT",JSONObject.toJSONString(wzztMap));
+
     }
 }

+ 16 - 0
cache/src/main/java/com/gyee/cache/mapper/auto/WindturbinestatusdiMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.cache.mapper.auto;
+
+import com.gyee.cache.model.auto.Windturbinestatusdi;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-03-25
+ */
+public interface WindturbinestatusdiMapper extends BaseMapper<Windturbinestatusdi> {
+
+}

+ 16 - 0
cache/src/main/java/com/gyee/cache/mapper/auto/WindturbinetestingpointdisMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.cache.mapper.auto;
+
+import com.gyee.cache.model.auto.Windturbinetestingpointdis;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-03-25
+ */
+public interface WindturbinetestingpointdisMapper extends BaseMapper<Windturbinetestingpointdis> {
+
+}

+ 80 - 0
cache/src/main/java/com/gyee/cache/model/auto/Windturbinestatusdi.java

@@ -0,0 +1,80 @@
+package com.gyee.cache.model.auto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-03-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("WINDTURBINESTATUSDI")
+public class Windturbinestatusdi extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId("ID")
+    private String id;
+
+    @TableField("CODE")
+    private String code;
+
+    @TableField("NAME")
+    private String name;
+
+    @TableField("MODEL")
+    private String model;
+
+    @TableField("VALUEUNIT")
+    private String valueunit;
+
+    @TableField("ENGLISHNAME")
+    private String englishname;
+
+    @TableField("TYPEID")
+    private String typeid;
+
+    @TableField("MODELID")
+    private String modelid;
+
+    @TableField("MAXVAL")
+    private Double maxval;
+
+    @TableField("MINVAL")
+    private Double minval;
+
+    @TableField("REASONABLEMAXVAL")
+    private Double reasonablemaxval;
+
+    @TableField("REASONABLEMINVAL")
+    private Double reasonableminval;
+
+    @TableField("WINDTURBINEID")
+    private String windturbineid;
+
+    @TableField("UNIFORMCODE")
+    private String uniformcode;
+
+    @TableField("SHORTID")
+    private String shortid;
+
+    @TableField("LONGID")
+    private String longid;
+
+    @TableField("WINDPOWERSTATIONID")
+    private String windpowerstationid;
+
+    @TableField("REALTIMEID")
+    private String realtimeid;
+
+
+}

+ 80 - 0
cache/src/main/java/com/gyee/cache/model/auto/Windturbinetestingpointdis.java

@@ -0,0 +1,80 @@
+package com.gyee.cache.model.auto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-03-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("WINDTURBINETESTINGPOINTDIS")
+public class Windturbinetestingpointdis extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId("ID")
+    private String id;
+
+    @TableField("CODE")
+    private String code;
+
+    @TableField("NAME")
+    private String name;
+
+    @TableField("MODEL")
+    private String model;
+
+    @TableField("VALUEUNIT")
+    private String valueunit;
+
+    @TableField("ENGLISHNAME")
+    private String englishname;
+
+    @TableField("TYPEID")
+    private String typeid;
+
+    @TableField("MODELID")
+    private String modelid;
+
+    @TableField("MAXVAL")
+    private Double maxval;
+
+    @TableField("MINVAL")
+    private Double minval;
+
+    @TableField("REASONABLEMAXVAL")
+    private Double reasonablemaxval;
+
+    @TableField("REASONABLEMINVAL")
+    private Double reasonableminval;
+
+    @TableField("WINDTURBINEID")
+    private String windturbineid;
+
+    @TableField("UNIFORMCODE")
+    private String uniformcode;
+
+    @TableField("SHORTID")
+    private String shortid;
+
+    @TableField("LONGID")
+    private String longid;
+
+    @TableField("WINDPOWERSTATIONID")
+    private String windpowerstationid;
+
+    @TableField("REALTIMEID")
+    private String realtimeid;
+
+
+}

+ 16 - 0
cache/src/main/java/com/gyee/cache/service/auto/IWindturbinestatusdiService.java

@@ -0,0 +1,16 @@
+package com.gyee.cache.service.auto;
+
+import com.gyee.cache.model.auto.Windturbinestatusdi;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-03-25
+ */
+public interface IWindturbinestatusdiService extends IService<Windturbinestatusdi> {
+
+}

+ 16 - 0
cache/src/main/java/com/gyee/cache/service/auto/IWindturbinetestingpointdisService.java

@@ -0,0 +1,16 @@
+package com.gyee.cache.service.auto;
+
+import com.gyee.cache.model.auto.Windturbinetestingpointdis;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-03-25
+ */
+public interface IWindturbinetestingpointdisService extends IService<Windturbinetestingpointdis> {
+
+}

+ 20 - 0
cache/src/main/java/com/gyee/cache/service/auto/impl/WindturbinestatusdiServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.cache.service.auto.impl;
+
+import com.gyee.cache.model.auto.Windturbinestatusdi;
+import com.gyee.cache.mapper.auto.WindturbinestatusdiMapper;
+import com.gyee.cache.service.auto.IWindturbinestatusdiService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-03-25
+ */
+@Service
+public class WindturbinestatusdiServiceImpl extends ServiceImpl<WindturbinestatusdiMapper, Windturbinestatusdi> implements IWindturbinestatusdiService {
+
+}

+ 20 - 0
cache/src/main/java/com/gyee/cache/service/auto/impl/WindturbinetestingpointdisServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.cache.service.auto.impl;
+
+import com.gyee.cache.model.auto.Windturbinetestingpointdis;
+import com.gyee.cache.mapper.auto.WindturbinetestingpointdisMapper;
+import com.gyee.cache.service.auto.IWindturbinetestingpointdisService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-03-25
+ */
+@Service
+public class WindturbinetestingpointdisServiceImpl extends ServiceImpl<WindturbinetestingpointdisMapper, Windturbinetestingpointdis> implements IWindturbinetestingpointdisService {
+
+}

+ 1 - 2
cache/src/main/resources/application-hb.yml

@@ -87,6 +87,5 @@ logging:
     com.example: debug
 
 
-golden:
-  baseURL: http://10.155.32.4:8011/ts
+
 

+ 0 - 2
cache/src/main/resources/application-hbtd.yml

@@ -89,8 +89,6 @@ logging:
     com.example: debug
 
 
-golden:
-  baseURL: http://10.83.68.159:8011/ts
 
 
 

+ 1 - 1
cache/src/main/resources/application.yml

@@ -1,4 +1,4 @@
 spring:
   profiles:
 #    active: jn
-    active: hbtd
+    active: hb

+ 6 - 8
realtime/generation-service/src/main/java/com/gyee/generation/service/AverageAndGeneratingService.java

@@ -82,7 +82,7 @@ public class AverageAndGeneratingService {
             List<PointData> projectyfdlList = new ArrayList<>();
             List<PointData> projectnfdlList = new ArrayList<>();
             projects.stream().forEach(project -> {
-                List<Line> lines = prolinemap.get(project);
+                List<Line> lines = prolinemap.get(project.getId());
                 Map<String, Windpowerstationpointnew> projectpointnewmap = propointmap.get(project.getId());
                 Windpowerstationpointnew projectpointnew = projectpointnewmap.get(Contant.RPJFS);
                 Windpowerstationpointnew yprojectpointnew = projectpointnewmap.get(Contant.YPJFS);
@@ -144,19 +144,17 @@ public class AverageAndGeneratingService {
                             Double samedayValue = 0.0;
                             Double monthFirstValue = 0.0;
                             Double yearFirstValue = 0.0;
-                            Optional<PointData> currentfirst = edosUtil.getHistoryDatasSnap(ai064, currentDate.getTime() / 1000, currentDate.getTime() / 1000, 1l, null).stream().findFirst();
-                            if (currentfirst.isPresent()){
-                                currentValue = currentfirst.get().getPointValueInDouble();
-                            }
-                            Optional<PointData> samedayfirst = edosUtil.getHistoryDatasSnap(ai064, samedayZero.getTime() / 1000, samedayZero.getTime() / 1000, 1l, null).stream().findFirst();
+                            PointData realData = edosUtil.getRealData(ai064);
+                            currentValue = realData.getPointValueInDouble();
+                            Optional<PointData> samedayfirst = edosUtil.getHistoryDatasSnap(ai064, samedayZero.getTime() / 1000, samedayZero.getTime() / 1000, 1l, 0l).stream().findFirst();
                             if (samedayfirst.isPresent()){
                                 samedayValue = samedayfirst.get().getPointValueInDouble();
                             }
-                            Optional<PointData> monthfirst = edosUtil.getHistoryDatasSnap(ai064, monthFirstZero.getTime() / 1000, monthFirstZero.getTime() / 1000, 1l, null).stream().findFirst();
+                            Optional<PointData> monthfirst = edosUtil.getHistoryDatasSnap(ai064, monthFirstZero.getTime() / 1000, monthFirstZero.getTime() / 1000, 1l, 0l).stream().findFirst();
                             if (monthfirst.isPresent()){
                                 monthFirstValue = monthfirst.get().getPointValueInDouble();
                             }
-                            Optional<PointData> yearfirst = edosUtil.getHistoryDatasSnap(ai064, yearFirstZero.getTime() / 1000, yearFirstZero.getTime() / 1000, 1l, null).stream().findFirst();
+                            Optional<PointData> yearfirst = edosUtil.getHistoryDatasSnap(ai064, yearFirstZero.getTime() / 1000, yearFirstZero.getTime() / 1000, 1l, 0l).stream().findFirst();
                             if (yearfirst.isPresent()){
                                 yearFirstValue = yearfirst.get().getPointValueInDouble();
                             }

+ 48 - 49
realtime/generation-service/src/main/java/com/gyee/generation/service/GenerationService.java

@@ -165,56 +165,55 @@ public class GenerationService {
             Date date = DateUtils.parseDate(day);
             QueryWrapper<Meterpointvalue> qw = new QueryWrapper();
             qw.eq("recorddate",date);
-            List<Meterpointvalue> meterpointvalues = meterpointvalueService.list(qw);
-            if (StringUtils.isEmpty(meterpointvalues)){
-                meterpoints.stream().forEach(meterpoint -> {
-                    String meterid = meterpoint.getId();
-                    Double magnification = meterpoint.getMagnification();
-                    Double xs = meterpoint.getXs();
-                    Meterpointvalue meterpointvalue = new Meterpointvalue();
-                    Date date1 = DateUtils.addDays(date, 1);
-                    meterpointvalue.setRecorddate(date1);
-                    Double real = 0.0;
-                    Double sameday = 0.0;
-                    Double month = 0.0;
-                    Double year = 0.0;
-                    try {
-                        Optional<PointData> first = edosUtil.getHistoryDatasSnap(meterid, date1.getTime() / 1000, date1.getTime() / 1000, 1l, null).stream().findFirst();
-                        if (first.isPresent()){
-                            real = first.get().getPointValueInDouble();
-                        }
-                        Optional<PointData> dayFirst = edosUtil.getHistoryDatasSnap(meterid, samedayZero.getTime() / 1000, samedayZero.getTime() / 1000, 1l, null).stream().findFirst();
-                        if (dayFirst.isPresent()){
-                            sameday = dayFirst.get().getPointValueInDouble();
-                        }
-                        Optional<PointData> monthFirst = edosUtil.getHistoryDatasSnap(meterid, monthFirstZero.getTime() / 1000, monthFirstZero.getTime() / 1000, 1l, null).stream().findFirst();
-                        if (monthFirst.isPresent()){
-                            month = monthFirst.get().getPointValueInDouble();
-                        }
-                        Optional<PointData> yearFirst = edosUtil.getHistoryDatasSnap(meterid, yearFirstZero.getTime() / 1000, yearFirstZero.getTime() / 1000, 1l, null).stream().findFirst();
-                        if (yearFirst.isPresent()){
-                            year = yearFirst.get().getPointValueInDouble();
-                        }
-                    } catch (Exception e) {
-                        e.printStackTrace();
+//            meterpointvalueService.remove(qw);
+            meterpoints.stream().forEach(meterpoint -> {
+                String meterid = meterpoint.getId();
+                Double magnification = meterpoint.getMagnification();
+                Double xs = meterpoint.getXs();
+                Meterpointvalue meterpointvalue = new Meterpointvalue();
+                Date date1 = DateUtils.addDays(date, 1);
+                meterpointvalue.setRecorddate(date1);
+                meterpointvalue.setMeterid(meterpoint.getId());
+                Double real = 0.0;
+                Double sameday = 0.0;
+                Double month = 0.0;
+                Double year = 0.0;
+                try {
+                    Optional<PointData> first = edosUtil.getHistoryDatasSnap(meterid, date1.getTime() / 1000, date1.getTime() / 1000, 1l, null).stream().findFirst();
+                    if (first.isPresent()){
+                        real = first.get().getPointValueInDouble();
                     }
-                    meterpointvalue.setYear(DoubleUtils.keepPrecision(year/xs,2));
-                    meterpointvalue.setYear4(DoubleUtils.keepPrecision(year/xs,4));
-                    meterpointvalue.setMonth(DoubleUtils.keepPrecision(month/xs,2));
-                    meterpointvalue.setMonth4(DoubleUtils.keepPrecision(month/xs,4));
-                    meterpointvalue.setDay(DoubleUtils.keepPrecision(sameday/xs,2));
-                    meterpointvalue.setDay4(DoubleUtils.keepPrecision(sameday/xs,4));
-                    meterpointvalue.setNow(DoubleUtils.keepPrecision(real/xs,2));
-                    meterpointvalue.setNow4(DoubleUtils.keepPrecision(real/xs,4));
-                    Double yearvalue = (real - year) * magnification;
-                    Double monthvalue = (real - month) * magnification;
-                    Double dayvalue = (real - sameday) * magnification;
-                    meterpointvalue.setYearvalue(yearvalue);
-                    meterpointvalue.setMonthvalue(monthvalue);
-                    meterpointvalue.setDayvalue(dayvalue);
-                    resultList.add(meterpointvalue);
-                });
-            }
+                    Optional<PointData> dayFirst = edosUtil.getHistoryDatasSnap(meterid, samedayZero.getTime() / 1000, samedayZero.getTime() / 1000, 1l, null).stream().findFirst();
+                    if (dayFirst.isPresent()){
+                        sameday = dayFirst.get().getPointValueInDouble();
+                    }
+                    Optional<PointData> monthFirst = edosUtil.getHistoryDatasSnap(meterid, monthFirstZero.getTime() / 1000, monthFirstZero.getTime() / 1000, 1l, null).stream().findFirst();
+                    if (monthFirst.isPresent()){
+                        month = monthFirst.get().getPointValueInDouble();
+                    }
+                    Optional<PointData> yearFirst = edosUtil.getHistoryDatasSnap(meterid, yearFirstZero.getTime() / 1000, yearFirstZero.getTime() / 1000, 1l, null).stream().findFirst();
+                    if (yearFirst.isPresent()){
+                        year = yearFirst.get().getPointValueInDouble();
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+                meterpointvalue.setYear(DoubleUtils.keepPrecision(year/xs,2));
+                meterpointvalue.setYear4(DoubleUtils.keepPrecision(year/xs,4));
+                meterpointvalue.setMonth(DoubleUtils.keepPrecision(month/xs,2));
+                meterpointvalue.setMonth4(DoubleUtils.keepPrecision(month/xs,4));
+                meterpointvalue.setDay(DoubleUtils.keepPrecision(sameday/xs,2));
+                meterpointvalue.setDay4(DoubleUtils.keepPrecision(sameday/xs,4));
+                meterpointvalue.setNow(DoubleUtils.keepPrecision(real/xs,2));
+                meterpointvalue.setNow4(DoubleUtils.keepPrecision(real/xs,4));
+                Double yearvalue = (real - year) * magnification;
+                Double monthvalue = (real - month) * magnification;
+                Double dayvalue = (real - sameday) * magnification;
+                meterpointvalue.setYearvalue(yearvalue);
+                meterpointvalue.setMonthvalue(monthvalue);
+                meterpointvalue.setDayvalue(dayvalue);
+                resultList.add(meterpointvalue);
+            });
             meterpointvalueService.saveBatch(resultList);
         });
     }

+ 1 - 1
realtime/generation-service/src/main/java/com/gyee/generation/util/realtimesource/EdosUtil.java

@@ -380,7 +380,7 @@ public class EdosUtil implements IEdosUtil {
                         //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
                         // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
                         // 则代表该时间节点快照有效,否则为0
-                        String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getId() + "&ts=" + snapItem.getPointTime() + "000";
+                        String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getCode() + "&ts=" + snapItem.getPointTime() + "000";
                         ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
                         JSONObject jsonObjectSection = sectionResp.getBody();
 

+ 6 - 3
realtime/generation-service/src/main/resources/application-dev.yml

@@ -18,7 +18,7 @@ spring:
     #      nodes: xxx.xxx.xxx.xxx:xxxx,xxx.xxx.xxx.xxx:xxxx,xxx.xxx.xxx.xxx:xxxx
     #      #默认值是5 一般当此值设置过大时,容易报:Too many Cluster redirections
     #      maxRedirects: 3
-    password: gdnxfd123
+    password:
     application:
       name: test
     jedis:
@@ -27,14 +27,14 @@ spring:
         min-idle: 0
         max-idle: 8
         max-wait: -1
-    database: 0
+    database: 19
   autoconfigure:
     exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
   datasource:
     type: com.alibaba.druid.pool.DruidDataSource
     driver-class-name: oracle.jdbc.OracleDriver
     #外网
-    url: jdbc:oracle:thin:@192.168.2.215:1521:gdsj
+    url: jdbc:oracle:thin:@10.83.68.165:1521:gdsj
     username: gdprod
     password: gd123
     oracle-schema=:
@@ -84,7 +84,10 @@ logging:
     com.example: debug
 
 
+db:
+  url: http://10.83.68.205:8011/ts
 
+runWindpowerstation: CL_FDC,KB_FDC,DX_FDC,SY_FDC
 
 
 

+ 2 - 2
realtime/generation-service/src/main/resources/application.yml

@@ -1,5 +1,5 @@
 # 场站,期次,线路电计量信息
 spring:
   profiles:
-#    active: td
-    active: test
+    active: td
+#    active: dev

+ 5 - 0
realtime/generation-service/src/test/java/com/gyee/generation/GenerationTest.java

@@ -1,5 +1,6 @@
 package com.gyee.generation;
 
+import com.gyee.generation.service.AverageAndGeneratingService;
 import com.gyee.generation.service.GenerationService;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -23,7 +24,11 @@ import javax.annotation.Resource;
 public class GenerationTest {
     @Resource
     private GenerationService generationService;
+    @Resource
+    private AverageAndGeneratingService averageAndGeneratingService;
     @Test
     public void test1() throws Exception {
+//        generationService.saveMeterpointValue("2022-03-25","2022-03-25");
+        averageAndGeneratingService.saveAvespeedAndAvepowerAndScada();
     }
 }