Browse Source

光伏表写数据

xujuanning 5 months ago
parent
commit
0a2e7217c2

+ 53 - 0
generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo1Service.java

@@ -1,20 +1,26 @@
 package com.gyee.generation.service;//package com.gyee.generation.service;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.common.model.PointData;
 import com.gyee.common.model.StringUtils;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
 import com.gyee.generation.model.vo.CompanyType;
 import com.gyee.generation.model.vo.Location;
 import com.gyee.generation.model.vo.WpType;
+import com.gyee.generation.service.auto.IProEconAnalysisSubtableBottomService;
 import com.gyee.generation.service.auto.IProEconEquipmentInfoDay1Service;
 import com.gyee.generation.service.auto.IProEconPowerstationInfoDay1Service;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
 import com.gyee.generation.util.statisticcs.Initial;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -31,6 +37,14 @@ public class WindPowerInfo1Service {
     @Resource
     private IProEconEquipmentInfoDay1Service proEconEquipmentInfoDay1Service;
 
+    @Value("${ndgfzb.gf}")
+    private String gf;
+
+    @Resource
+    private IProEconAnalysisSubtableBottomService iProEconAnalysisSubtableBottomService;
+
+
+
     /**
      * 计算区域日信息
      */
@@ -1239,6 +1253,45 @@ public class WindPowerInfo1Service {
     }
 
 
+    public void writegf(Date date) throws Exception {
+        LocalDate localDate = LocalDateTime.now().toLocalDate();
+        String[] split = gf.split(",");
+        List<PointData> realData = edosUtil.getRealData(split);
+        QueryWrapper<ProEconAnalysisSubtableBottom> qw = new QueryWrapper<>();
+        qw.lambda().eq(ProEconAnalysisSubtableBottom::getRecordDate, localDate);
+        List<ProEconAnalysisSubtableBottom> sel = iProEconAnalysisSubtableBottomService.sel(qw);
+        List<ProEconAnalysisSubtableBottom> ls = new ArrayList<>();
+        if (null == sel || sel.isEmpty()) {
+            for (PointData real : realData) {
+                ProEconAnalysisSubtableBottom pb = new ProEconAnalysisSubtableBottom();
+                date = new Date(real.getPointTime());
+                pb.setRecordDate(date);
+                String[] split1 = real.getPointName().split("\\.");
+                if ("曙光储能电站".equals(split1[2]) || "宁东33光伏场站".equals(split1[2])) {
+                    pb.setWpid("GJNY_NXGS_SGB_GDC_STA");
+                }else if("霞光储能电站".equals(split1[2]) || "宁东32光伏场站".equals(split1[2])){
+                    pb.setWpid("GJNY_NXGS_XGB_GDC_STA");
+                }else {
+                    pb.setWpid("GJNY_NXGS_QZB_GDC_STA");
+                }
+                pb.setMeterId(real.getPointName());
+                pb.setMeterName(real.getPointName());
+                pb.setStopCode(real.getPointValueInDouble());
+                ls.add(pb);
+            }
+        }else {
+            for (PointData real : realData) {
+                for (ProEconAnalysisSubtableBottom s : sel) {
+                    ProEconAnalysisSubtableBottom pb = new ProEconAnalysisSubtableBottom();
+                    if (real.getPointName().equals(s.getMeterId())) {
+                        pb.setStopCode(real.getPointValueInDouble());
+                    }
+                    ls.add(pb);
+                }
+            }
+        }
+        boolean b = iProEconAnalysisSubtableBottomService.batchAdd(ls);
+    }
 }
 
 

+ 4 - 0
generationXK-service/src/main/java/com/gyee/generation/service/auto/IProEconAnalysisSubtableBottomService.java

@@ -1,5 +1,6 @@
 package com.gyee.generation.service.auto;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.gyee.generation.model.auto.ProEconAnalysisSubtableBottom;
 
@@ -15,4 +16,7 @@ import java.util.List;
  */
 public interface IProEconAnalysisSubtableBottomService extends IService<ProEconAnalysisSubtableBottom> {
     boolean batchAdd(List<ProEconAnalysisSubtableBottom> proEconStationPowers);
+
+    List<ProEconAnalysisSubtableBottom> sel(QueryWrapper<ProEconAnalysisSubtableBottom> queryWrapper);
+
 }

+ 7 - 0
generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/ProEconAnalysisSubtableBottomServiceImpl.java

@@ -41,4 +41,11 @@ public class ProEconAnalysisSubtableBottomServiceImpl extends ServiceImpl<ProEco
 
         return true;
     }
+
+
+    @Override
+    public List<ProEconAnalysisSubtableBottom> sel(QueryWrapper<ProEconAnalysisSubtableBottom> queryWrapper) {
+        return baseMapper.selectList(queryWrapper);
+    }
+
 }

+ 18 - 0
generationXK-service/src/main/java/com/gyee/generation/task/SaticSchedulePgTask.java

@@ -4,6 +4,7 @@ package com.gyee.generation.task;
 import com.gyee.common.util.DateUtils;
 import com.gyee.generation.service.*;
 import com.gyee.generation.service.StationPower.StationPowerService;
+import com.gyee.generation.service.auto.IProEconAnalysisSubtableBottomService;
 import com.gyee.generation.util.SpringUtils;
 import com.gyee.generation.util.math.AvailablePowerAccuracyCalculator;
 import com.gyee.generation.util.math.PowerPredictionErrorCalculator;
@@ -104,6 +105,10 @@ public class SaticSchedulePgTask {
     @Resource
     private WindPowerInfo5UpdateService windPowerInfo5UpdateService;
 
+    @Resource
+    private IProEconAnalysisSubtableBottomService iProEconAnalysisSubtableBottomService;
+
+
     @XxlJob("windPowerInfo5Update")
     public void windPowerInfo5Update() {
 
@@ -740,6 +745,19 @@ public class SaticSchedulePgTask {
 
     }
 
+
+    /**
+     * 光伏数据写入
+     */
+    @XxlJob("ndgfzb")
+    public void ndgfzb() throws Exception {
+
+        Date date = new Date();
+        windPowerInfo1Service.writegf(date);
+
+    }
+
+
     /**
      * 场站2表
      * 15分钟只执行一次

File diff suppressed because it is too large
+ 5 - 0
generationXK-service/src/main/resources/application-nxf.yml