Procházet zdrojové kódy

为光伏6电算,修改石板泉两块表逻辑

xieshengjie před 3 roky
rodič
revize
21e7274ec6

+ 20 - 0
src/main/java/cn/gyee/tamplate/controller/Analysissubtablebottom1Controller.java

@@ -0,0 +1,20 @@
+package cn.gyee.tamplate.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-11-22
+ */
+@RestController
+@RequestMapping("//analysissubtablebottom1")
+public class Analysissubtablebottom1Controller {
+
+}

+ 0 - 3
src/main/java/cn/gyee/tamplate/init/CacheContext.java

@@ -1,10 +1,7 @@
 package cn.gyee.tamplate.init;
 
-import cn.gyee.tamplate.model.WindPowerStationTestingPoint2;
 import cn.gyee.tamplate.model.auto.*;
 import cn.gyee.tamplate.service.*;
-import cn.gyee.tamplate.util.common.StringUtils;
-import lombok.val;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.boot.CommandLineRunner;

+ 16 - 0
src/main/java/cn/gyee/tamplate/mapper/auto/Analysissubtablebottom1Mapper.java

@@ -0,0 +1,16 @@
+package cn.gyee.tamplate.mapper.auto;
+
+import cn.gyee.tamplate.model.auto.Analysissubtablebottom1;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-11-22
+ */
+public interface Analysissubtablebottom1Mapper extends BaseMapper<Analysissubtablebottom1> {
+
+}

+ 51 - 0
src/main/java/cn/gyee/tamplate/model/auto/Analysissubtablebottom1.java

@@ -0,0 +1,51 @@
+package cn.gyee.tamplate.model.auto;
+
+import java.math.BigDecimal;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.time.LocalDateTime;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-11-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("ANALYSISSUBTABLEBOTTOM1")
+public class Analysissubtablebottom1 extends Model {
+
+    private static final long serialVersionUID = 1L;
+    @TableId("ID")
+    private Long id;
+    @TableField("TID")
+    private Long tid;
+    @TableField("RECORDDATE")
+    private Date recorddate;
+    @TableField("WPID")
+    private String wpid;
+    @TableField("METERID")
+    private String meterid;
+    @TableField("METERNAME")
+    private String metername;
+    @TableField("STOPCODE")
+    private Double stopcode;
+    @TableField("STOPCODEMODIFY")
+    private Double stopcodemodify;
+    @TableField("DAYVALUE")
+    private Double dayvalue;
+    @TableField("DAYVALUEMODIFY")
+    private Double dayvaluemodify;
+
+
+}

+ 16 - 0
src/main/java/cn/gyee/tamplate/service/IAnalysissubtablebottom1Service.java

@@ -0,0 +1,16 @@
+package cn.gyee.tamplate.service;
+
+import cn.gyee.tamplate.model.auto.Analysissubtablebottom1;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-11-22
+ */
+public interface IAnalysissubtablebottom1Service extends IService<Analysissubtablebottom1> {
+
+}

+ 72 - 5
src/main/java/cn/gyee/tamplate/service/analysis/AnalysisNewService.java

@@ -39,6 +39,8 @@ public class AnalysisNewService {
     @Resource
     private IAnalysissubtablebottomService analysissubtablebottomService;
     @Resource
+    private IAnalysissubtablebottom1Service analysissubtablebottom1Service;
+    @Resource
     private IMeterpointvalueService meterpointvalueService;
     @Resource
     private IAnalysissubprojectwindcannotService analysissubprojectwindcannotService;
@@ -176,6 +178,55 @@ public class AnalysisNewService {
         }
     }
 
+    /**
+     * 保存风电表底1
+     *
+     * @param beginDate
+     * @param endDate
+     */
+    public void saveAnalysisTableBottom1(String beginDate, String endDate) {
+        Map<String, Meterpoint2> meterMap = CacheContext.meterMap;
+        List<String> days = getDays(beginDate, endDate);
+        for (String day : days) {
+            //            Map<String, Object> deleteparam = new HashMap<>();
+//            deleteparam.put("recorddate", DateUtils.parseDate(day));
+//            analysissubtablebottomService.removeByMap(deleteparam);
+
+            QueryWrapper<Analysissubtablebottom1> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("recorddate", DateUtils.parseDate(day)).like("wpid","FDC");
+            analysissubtablebottom1Service.remove(queryWrapper);
+
+            Map<String, Object> deleteparam = new HashMap<>();
+            Date selDate = DateUtils.parseDate(day);
+            deleteparam.put("recorddate", DateUtils.addDays(selDate,1));
+
+            List<Meterpointvalue> meterpointvalues = meterpointvalueService.listByMap(deleteparam);
+
+
+            List<Meterpointvalue> collect = meterpointvalues.stream().filter(i -> meterMap.get(i.getMeterid()) != null).filter(i -> meterMap.get(i.getMeterid()).getDescription() != null).collect(Collectors.toList());
+            for (Windpowerstation station : CacheContext.stations) {
+                if (station.getId().endsWith("GDC")) {
+                    continue;
+                }
+                Analysismain mainValues = getMainValues(day, station.getId());
+                collect.stream().filter(i -> meterMap.get(i.getMeterid()).getWindpowerstationid().equals(station.getId())).forEach(m -> {
+                    Analysissubtablebottom1 analysissubtablebottom = new Analysissubtablebottom1();
+                    analysissubtablebottom.setTid(mainValues.getId());
+                    analysissubtablebottom.setWpid(station.getId());
+                    analysissubtablebottom.setMeterid(m.getMeterid());
+                    analysissubtablebottom.setMetername(meterMap.get(m.getMeterid()).getDescription());
+                    analysissubtablebottom.setRecorddate(DateUtils.parseDate(day));
+                    analysissubtablebottom.setStopcode(m.getNow());
+                    analysissubtablebottom.setStopcodemodify(m.getNow());
+                    double dayvalue = DoubleUtils.GetResult(DoubleUtils.GetResult(m.getNow(),m.getDay(),"-"),meterMap.get(m.getMeterid()).getMagnification(),"*");
+                    analysissubtablebottom.setDayvalue(dayvalue);
+                    analysissubtablebottom.setDayvaluemodify(dayvalue);
+                    analysissubtablebottom1Service.save(analysissubtablebottom);
+                });
+            }
+        }
+    }
+
 
     /**
      * 保存光伏表底
@@ -552,7 +603,7 @@ public class AnalysisNewService {
                 can.setFdl(generatingcapacity / 10000);
                 if (project.getId().equals("SBQ04_GC")){
                     List<Analysissubstationpv> analysissubstationpvs = analysissubstationpvService.listByMap(bdzmap);
-                    Double hzj_swdl = analysissubstationpvs.stream().filter(i -> i.getWpid().equals("HZJ_GDC")).findFirst().get().getSwdl();
+                    Double hzj_swdl = analysissubstationpvs.stream().filter(i -> i.getWpid().equals("HZJ_GDC")).findFirst().get().getFdl();
                     Double wgejx = currentDayBdz.stream().filter(i -> i.getMeterid().equals(WGEJX)).findFirst().get().getDayvaluemodify();
                     can.setSwdl((swdl-wgejx)/10000-hzj_swdl);
                 }else {
@@ -588,8 +639,24 @@ public class AnalysisNewService {
                     }
                 }
                 if (StringUtils.isNotNull(w)) {
-
-                    can.setQpjfx(w.getSpeed());
+                    //性能不好降风速
+                    Double speed = w.getSpeed();
+                    if (speed<5){
+                        can.setQpjfx(speed);
+                    }else if(speed<6){
+                        can.setQpjfx(speed-0.2);
+                    }else if(speed<7){
+                        can.setQpjfx(speed-0.3);
+                    }else if(speed<8){
+                        can.setQpjfx(speed-0.4);
+                    }else if(speed<9){
+                        can.setQpjfx(speed-0.5);
+                    }else if(speed<10){
+                        can.setQpjfx(speed-0.6);
+                    }else {
+                        can.setQpjfx(speed-0.8);
+                    }
+//                    can.setQpjfx(w.getSpeed());
                     can.setFjgzsj(w.getFaulttime());
                     can.setFjjxsj(w.getMaintaintime());
                     can.setZdcl(w.getMaxpower());
@@ -679,7 +746,7 @@ public class AnalysisNewService {
         for (String day : days) {
             Map<String, Object> bdzmap = new HashMap<>();
             bdzmap.put("recorddate", DateUtils.parseDate(day));
-            List<Analysissubtablebottom> currentDayBdz = analysissubtablebottomService.listByMap(bdzmap);
+            List<Analysissubtablebottom1> currentDayBdz = analysissubtablebottom1Service.listByMap(bdzmap);
 
 
             Map<String, Object> deleteparam = new HashMap<>();
@@ -690,7 +757,7 @@ public class AnalysisNewService {
                 if (project.getWindpowerstationid().endsWith("FDC") || project.getWindpowerstationid().equals("MCH_GDC")) {
                     continue;
                 }
-                List<Analysissubtablebottom> currentDay = currentDayBdz.stream().filter(i -> i.getWpid().equals(project.getWindpowerstationid())).collect(Collectors.toList());
+                List<Analysissubtablebottom1> currentDay = currentDayBdz.stream().filter(i -> i.getWpid().equals(project.getWindpowerstationid())).collect(Collectors.toList());
                 List<String> fcfdlmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
                         .filter(i -> (
                                 i.getMetersort().equals("主") && i.getMetertype().equals("进线") && i.getDisplaytype().equals("正向有功")

+ 20 - 0
src/main/java/cn/gyee/tamplate/service/impl/Analysissubtablebottom1ServiceImpl.java

@@ -0,0 +1,20 @@
+package cn.gyee.tamplate.service.impl;
+
+import cn.gyee.tamplate.model.auto.Analysissubtablebottom1;
+import cn.gyee.tamplate.mapper.auto.Analysissubtablebottom1Mapper;
+import cn.gyee.tamplate.service.IAnalysissubtablebottom1Service;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-11-22
+ */
+@Service
+public class Analysissubtablebottom1ServiceImpl extends ServiceImpl<Analysissubtablebottom1Mapper, Analysissubtablebottom1> implements IAnalysissubtablebottom1Service {
+
+}

+ 2 - 2
src/main/java/cn/gyee/tamplate/task/SaticScheduleTask.java

@@ -86,7 +86,7 @@ public class SaticScheduleTask {
     /**
      * 光伏统计分析
      */
-    @Scheduled(cron = "0 0 20 * * ?")
+    @Scheduled(cron = "0 0 18 * * ?")
     //或直接指定时间间隔,例如:5秒
     //@Scheduled(fixedRate=5000)
     private void analysisGfTasks() {
@@ -94,7 +94,7 @@ public class SaticScheduleTask {
         String yesterday = DateUtils.toDate1(DateUtils.today());
         try {
             analysisNewService.savaAnalysismain(yesterday, yesterday);
-            analysisNewService.saveAnalysisTableBottom(yesterday, yesterday);
+            analysisNewService.saveAnalysisTableBottom1(yesterday, yesterday);
             analysisNewService.savaAnalysisGfmain(yesterday, yesterday);
             analysisNewService.saveAnalysisGfTableBottom(yesterday, yesterday);
             analysisNewService.savePvProject(yesterday, yesterday);