wangb 6 روز پیش
والد
کامیت
abc5cb35e1

+ 11 - 0
generationXK-service/pom.xml

@@ -147,6 +147,17 @@
             <scope>test</scope>
         </dependency>
 
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+            <version>2.2.3.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>io.github.openfeign</groupId>
+            <artifactId>feign-httpclient</artifactId>
+            <version>11.9.1</version>
+        </dependency>
+
         <!--        <dependency>-->
         <!--            <groupId>com.gyee</groupId>-->
         <!--            <artifactId>data-adapter</artifactId>-->

+ 2 - 0
generationXK-service/src/main/java/com/gyee/generation/GenerationMain.java

@@ -7,6 +7,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.openfeign.EnableFeignClients;
 
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
@@ -20,6 +21,7 @@ import java.util.concurrent.TimeUnit;
  * @Description :
  */
 @SpringBootApplication
+@EnableFeignClients
 @MapperScan({"com.gyee.generation.mapper"})
 public class GenerationMain {
 

+ 71 - 0
generationXK-service/src/main/java/com/gyee/generation/feign/AdapterApi.java

@@ -0,0 +1,71 @@
+package com.gyee.generation.feign;
+
+import com.gyee.common.model.PointData;
+import com.gyee.generation.model.PointData2;
+import com.gyee.generation.util.realtimesource.timeseries.DoubleStatData;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.*;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+@FeignClient("adapter")
+public interface AdapterApi {
+    @GetMapping("/latest2")
+    List<PointData> getLatest2(URI baseUri, @RequestParam("keys") String keys);
+
+//    @GetMapping("/latest")
+//    Map<String, PointData> getLatest(URI baseUri, @RequestParam("keys") String keys);
+
+    @PostMapping("/latest")
+//    @Headers("Content-Type: application/json; charset=UTF-8")
+    Map<String, PointData> getLatest(URI baseUri, @RequestBody String keys);
+
+    @GetMapping("/history/snap")
+    List<PointData> getHistorySnap(URI baseUri, @RequestParam("tagName") String tagName,
+                                   @RequestParam("startTs") long startTs,
+                                   @RequestParam("endTs") long endTs,
+                                   @RequestParam("interval") int interval);
+
+    @GetMapping("/history/raw")
+    List<PointData> getHistoryRaw(URI baseUri, @RequestParam("tagName") String tagName,
+                                  @RequestParam("startTs") long startTs,
+                                  @RequestParam("endTs") long endTs);
+
+    @GetMapping("/history/stat2")
+    DoubleStatData getHistoryStat(URI baseUri, @RequestParam("tagName") String tagName,
+                                  @RequestParam("startTs") long startTs,
+                                  @RequestParam("endTs") long endTs);
+    //@RequestParam("interval") int interval);
+
+    @GetMapping("/history/stat")
+    List<DoubleStatData> getHistoryStat2(URI baseUri, @RequestParam("tagName") String tagName,
+                                         @RequestParam("startTs") long startTs,
+                                         @RequestParam("endTs") long endTs,
+                                         @RequestParam("interval") int interval);
+
+//    @GetMapping("/history/section")
+//    Map<String, PointData> getHistorySection(URI baseUri, @RequestParam("tagNames") String tagNames,
+//                                             @RequestParam("ts") long ts);
+
+    @PostMapping("/history/section")
+    Map<String, PointData2> getHistorySection(URI baseUri, @RequestBody String tagNames,
+                                              @RequestParam("ts") long ts);
+
+    @GetMapping("/history/section2")
+    List<PointData> getHistorySection2(URI baseUri, @RequestParam("tagName") String tagName,
+                                       @RequestParam("ts") long ts);
+
+//    @PostMapping("/latest2")
+//    Boolean writeHistory(URI baseUri, @RequestBody PointData tsData);
+//
+//    @PostMapping("/latest2/batch")
+//    Boolean writeHistoryBatch(URI baseUri, @RequestBody List<PointData> tsData);
+
+    @PostMapping("/save")
+    Boolean writeHistory(URI baseUri, @RequestBody PointData tsData);
+
+    @PostMapping("/save/batch")
+    Boolean writeHistoryBatch(URI baseUri, @RequestBody List<PointData> tsData);
+}

+ 56 - 0
generationXK-service/src/main/java/com/gyee/generation/model/PointData2.java

@@ -0,0 +1,56 @@
+package com.gyee.generation.model;
+
+
+import lombok.Data;
+
+/**
+ * @author hlf
+ * @date 2024/12/16 11:45
+ * 文件说明:
+ */
+@Data
+public class PointData2 {
+    /**
+     * 时间戳
+     */
+    private long ts;
+    private String tagName;
+    /**
+     * 数据
+     */
+    private Double doubleValue;
+    /**
+     * boolean 数据
+     */
+    private Boolean booleanValue;
+
+    private Long longValue;
+
+    public PointData2() {
+    }
+
+    public PointData2(long ts, double doubleValue) {
+        this.ts = ts;
+        this.doubleValue = doubleValue;
+    }
+
+    public double getValue() {
+        if (booleanValue != null) {
+            return booleanValue ? 1.0 : 0.0;
+        } else if (longValue != null) {
+            doubleValue = Double.valueOf(longValue);
+        }
+        return doubleValue;
+    }
+
+
+    public boolean isBooleanValue() {
+        if (booleanValue != null) {
+            return booleanValue;
+        } else {
+            return false;
+        }
+    }
+}
+
+

+ 50 - 34
generationXK-service/src/main/java/com/gyee/generation/service/ShutdownnewService.java

@@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
+import com.gyee.generation.feign.AdapterApi;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.mapper.auto.AlarmTsMapper;
+import com.gyee.generation.model.PointData2;
 import com.gyee.generation.model.auto.*;
 import com.gyee.generation.model.vo.AlarmSuperTalbeType;
 import com.gyee.generation.model.vo.AlarmVo;
@@ -17,11 +19,13 @@ import com.gyee.generation.service.auto.IProEconWindturbineStatusService;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.StringUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
+import com.gyee.generation.util.realtimesource.StringUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.net.URI;
 import java.util.*;
 import java.util.concurrent.Executor;
 import java.util.stream.Collectors;
@@ -50,16 +54,27 @@ public class ShutdownnewService {
 
     public static Logger logger = LoggerFactory.getLogger(ShutdownnewService.class);
 
-
     @Resource
     private Executor executor;
 
+    @Resource
+    private AdapterApi adapter;
+
+
+    public URI goldenUri() {
+        return URI.create("http://10.220.1.8:8011/ts");
+    }
+
+//    public URI goldenUri() {
+//        return URI.create("http://10.220.1.241:8011/ts");
+//    }
+
 
     public void execShutdown(Date recordDate) throws Exception {
 
         List<String> wtStatusIdLs = new ArrayList<>();
 
-        Map<String, PointData> wtStatusMap = new HashMap<>();
+        Map<String, PointData2> wtStatusMap = new HashMap<>();
 
 
         Map<String, ProEconWindturbineStatus> oldStatusMap = new HashMap<>();
@@ -87,15 +102,16 @@ public class ShutdownnewService {
             oldShutdownEvent2.put(wt.getId(), null);
         }
 
-        List<PointData> wtStatusLs = edosUtil.getHistMatrix(wtStatusIdLs, recordDate.getTime() / 1000);
+//        List<PointData> wtStatusLs = edosUtil.getHistMatrix(wtStatusIdLs, recordDate.getTime() / 1000);
+        String tagNameString = StringUtil.join(wtStatusIdLs, ",");
+        Map<String, PointData2> wtStatusLs = adapter.getHistorySection(goldenUri(), tagNameString, recordDate.getTime());
 
-        if (wtStatusLs.size() == wtls.size()) {
+        if (wtStatusLs.values().size() == wtls.size()) {
 
             for (int i = 0; i < wtls.size(); i++) {
 
                 ProBasicEquipment wt = wtls.get(i);
-
-                wtStatusMap.put(wt.getId(), wtStatusLs.get(i));
+                wtStatusMap.put(wt.getId(), wtStatusLs.get(wtStatusIdLs.get(i)));
 
             }
         }
@@ -185,18 +201,18 @@ public class ShutdownnewService {
                 //                {
                 //                    System.out.println("");
                 //                }
-                PointData wtPoint = wtStatusMap.get(wtId);
+                PointData2 wtPoint = wtStatusMap.get(wtId);
                 //获取当前时间
                 Date currentTime = recordDate;
                 if (StringUtils.empty(item)) {
                     item = new ProEconWindturbineStatus();
                     initalWindturbineStatus(insertProEconWindturbineStatusls, wtId, wtStatusMap, currentTime, item);
-                } else if (StringUtils.notEmp(item) && wtPoint.getPointValueInDouble() != item.getSatusCode()) {
+                } else if (StringUtils.notEmp(item) && wtPoint.getValue() != item.getSatusCode()) {
                     finishWindturbineStatus(updateProEconWindturbineStatusls, wtId, currentTime, item);
 
                 }
 
-                if (wtPoint.getPointValueInDouble() == StatusDetailValue.TXZD.getCode()) {
+                if (wtPoint.getValue() == StatusDetailValue.TXZD.getCode()) {
                     if (StringUtils.empty(interrup)) {
                         interrup = new ProEconInterruption();
                         initalInterruption(insertProEconInterruptionls, wtId, currentTime, interrup);
@@ -207,7 +223,7 @@ public class ShutdownnewService {
 
                 }
 
-                if (wtPoint.getPointValueInDouble() == StatusDetailValue.GZ.getCode()) {
+                if (wtPoint.getValue() == StatusDetailValue.GZ.getCode()) {
                     if (StringUtils.empty(shutdwonEvent)) {
                         shutdwonEvent = new ProEconShutdownEvent();
                         initalShutdownEvent(insertProEconShutdownEventls, wtId, wtStatusMap, currentTime, shutdwonEvent);
@@ -217,16 +233,16 @@ public class ShutdownnewService {
                         initalShutdownEvent2(insertProEconShutdownEvent2ls, wtId, wtStatusMap, currentTime, shutdwonEvent2);
                     }
                 } else {
-                    if (StringUtils.notEmp(shutdwonEvent) && shutdwonEvent.getStatusCode() != wtPoint.getPointValueInDouble()) {
+                    if (StringUtils.notEmp(shutdwonEvent) && shutdwonEvent.getStatusCode() != wtPoint.getValue()) {
                         finishShutdownEvent(updateProEconShutdownEventls, wtId, wtStatusMap, currentTime, shutdwonEvent);
                     }
-                    if (StringUtils.notEmp(shutdwonEvent2) && shutdwonEvent2.getStatusCode() != wtPoint.getPointValueInDouble()) {
+                    if (StringUtils.notEmp(shutdwonEvent2) && shutdwonEvent2.getStatusCode() != wtPoint.getValue()) {
                         finishShutdownEvent2(updateProEconShutdownEvent2ls, wtId, wtStatusMap, currentTime, shutdwonEvent2);
                     }
 
                 }
 
-                if (wtPoint.getPointValueInDouble() == StatusDetailValue.JX.getCode()) {
+                if (wtPoint.getValue() == StatusDetailValue.JX.getCode()) {
                     if (StringUtils.empty(shutdwonEvent)) {
                         shutdwonEvent = new ProEconShutdownEvent();
                         initalShutdownEvent(insertProEconShutdownEventls, wtId, wtStatusMap, currentTime, shutdwonEvent);
@@ -236,10 +252,10 @@ public class ShutdownnewService {
                         initalShutdownEvent2(insertProEconShutdownEvent2ls, wtId, wtStatusMap, currentTime, shutdwonEvent2);
                     }
                 } else {
-                    if (StringUtils.notEmp(shutdwonEvent) && shutdwonEvent.getStatusCode() != wtPoint.getPointValueInDouble()) {
+                    if (StringUtils.notEmp(shutdwonEvent) && shutdwonEvent.getStatusCode() != wtPoint.getValue()) {
                         finishShutdownEvent(updateProEconShutdownEventls, wtId, wtStatusMap, currentTime, shutdwonEvent);
                     }
-                    if (StringUtils.notEmp(shutdwonEvent2) && shutdwonEvent2.getStatusCode() != wtPoint.getPointValueInDouble()) {
+                    if (StringUtils.notEmp(shutdwonEvent2) && shutdwonEvent2.getStatusCode() != wtPoint.getValue()) {
                         finishShutdownEvent2(updateProEconShutdownEvent2ls, wtId, wtStatusMap, currentTime, shutdwonEvent2);
                     }
 
@@ -341,9 +357,9 @@ public class ShutdownnewService {
     }
 
     private void finishShutdownEvent(List<ProEconShutdownEvent> updateProEconShutdownEventls,
-                                     String wtId, Map<String, PointData> wtStatusMap, Date currentTime, ProEconShutdownEvent item) throws Exception {
+                                     String wtId, Map<String, PointData2> wtStatusMap, Date currentTime, ProEconShutdownEvent item) throws Exception {
 
-        if (item.getStatusCode() != wtStatusMap.get(wtId).getPointValueInDouble()) {
+        if (item.getStatusCode() != wtStatusMap.get(wtId).getValue()) {
             item.setStartTime(currentTime);
 
             double timehour = DateUtils.hoursDiff2(item.getStartTime(), item.getStopTime());
@@ -359,9 +375,9 @@ public class ShutdownnewService {
 
 
     private void finishShutdownEvent2(List<ProEconShutdownEvent2> insertProEconShutdownEvent2ls,
-                                      String wtId, Map<String, PointData> wtStatusMap, Date currentTime, ProEconShutdownEvent2 item) throws Exception {
+                                      String wtId, Map<String, PointData2> wtStatusMap, Date currentTime, ProEconShutdownEvent2 item) throws Exception {
 
-        if (item.getStatusCode() != wtStatusMap.get(wtId).getPointValueInDouble()) {
+        if (item.getStatusCode() != wtStatusMap.get(wtId).getValue()) {
             item.setStartTime(currentTime);
 
             double timehour = DateUtils.hoursDiff2(item.getStartTime(), item.getStopTime());
@@ -414,14 +430,14 @@ public class ShutdownnewService {
 
 
     private void initalShutdownEvent2(List<ProEconShutdownEvent2> insertProEconShutdownEvent2ls,
-                                      String wtId, Map<String, PointData> wtStatusMap, Date currentTime, ProEconShutdownEvent2 item) {
+                                      String wtId, Map<String, PointData2> wtStatusMap, Date currentTime, ProEconShutdownEvent2 item) {
         item.setId(StringUtils.getUUID());
         item.setProjectId(CacheContext.wtmap.get(wtId).getProjectId());
-        item.setStatusCode((int) wtStatusMap.get(wtId).getPointValueInDouble());
+        item.setStatusCode((int) wtStatusMap.get(wtId).getValue());
         item.setStopTime(currentTime);
         item.setWinpowerstationId(CacheContext.wtmap.get(wtId).getWindpowerstationId());
         item.setWindturbineId(wtId);
-        if (wtStatusMap.get(wtId).getPointValueInDouble() == StatusDetailValue.GZ.getCode()) {
+        if (wtStatusMap.get(wtId).getValue() == StatusDetailValue.GZ.getCode()) {
 
             item.setStopTypeId("gz");
 
@@ -444,7 +460,7 @@ public class ShutdownnewService {
                     item.setHandleWay(vo.getResolvent());
                 }
             }
-        } else if (wtStatusMap.get(wtId).getPointValueInDouble() == StatusDetailValue.JX.getCode()) {
+        } else if (wtStatusMap.get(wtId).getValue() == StatusDetailValue.JX.getCode()) {
             item.setStopTypeId("wh");
 
         }
@@ -452,15 +468,15 @@ public class ShutdownnewService {
         insertProEconShutdownEvent2ls.add(item);
     }
 
-    private ProEconShutdownEvent2 initalShutdownEventnew2(String wtId, Map<String, PointData> wtStatusMap, Date currentTime) {
+    private ProEconShutdownEvent2 initalShutdownEventnew2(String wtId, Map<String, PointData2> wtStatusMap, Date currentTime) {
         ProEconShutdownEvent2 item = new ProEconShutdownEvent2();
         item.setId(StringUtils.getUUID());
         item.setProjectId(CacheContext.wtmap.get(wtId).getProjectId());
-        item.setStatusCode((int) wtStatusMap.get(wtId).getPointValueInDouble());
+        item.setStatusCode((int) wtStatusMap.get(wtId).getValue());
         item.setStopTime(currentTime);
         item.setWinpowerstationId(CacheContext.wtmap.get(wtId).getWindpowerstationId());
         item.setWindturbineId(wtId);
-        if (wtStatusMap.get(wtId).getPointValueInDouble() == StatusDetailValue.GZ.getCode()) {
+        if (wtStatusMap.get(wtId).getValue() == StatusDetailValue.GZ.getCode()) {
 
             item.setStopTypeId("gz");
 
@@ -483,7 +499,7 @@ public class ShutdownnewService {
                     item.setHandleWay(vo.getResolvent());
                 }
             }
-        } else if (wtStatusMap.get(wtId).getPointValueInDouble() == StatusDetailValue.JX.getCode()) {
+        } else if (wtStatusMap.get(wtId).getValue() == StatusDetailValue.JX.getCode()) {
             item.setStopTypeId("wh");
 
         }
@@ -491,14 +507,14 @@ public class ShutdownnewService {
     }
 
     private void initalShutdownEvent(List<ProEconShutdownEvent> insertProEconShutdownEventls,
-                                     String wtId, Map<String, PointData> wtStatusMap, Date currentTime, ProEconShutdownEvent item) {
+                                     String wtId, Map<String, PointData2> wtStatusMap, Date currentTime, ProEconShutdownEvent item) {
         item.setId(StringUtils.getUUID());
         item.setProjectId(CacheContext.wtmap.get(wtId).getProjectId());
-        item.setStatusCode((int) wtStatusMap.get(wtId).getPointValueInDouble());
+        item.setStatusCode((int) wtStatusMap.get(wtId).getValue());
         item.setStopTime(currentTime);
         item.setWindpowerstationId(CacheContext.wtmap.get(wtId).getWindpowerstationId());
         item.setWindturbineId(wtId);
-        if (wtStatusMap.get(wtId).getPointValueInDouble() == StatusDetailValue.GZ.getCode()) {
+        if (wtStatusMap.get(wtId).getValue() == StatusDetailValue.GZ.getCode()) {
 
             item.setStoptypeId("gz");
 
@@ -522,7 +538,7 @@ public class ShutdownnewService {
                 }
             }
 
-        } else if (wtStatusMap.get(wtId).getPointValueInDouble() == StatusDetailValue.JX.getCode()) {
+        } else if (wtStatusMap.get(wtId).getValue() == StatusDetailValue.JX.getCode()) {
             item.setStoptypeId("wh");
 
         }
@@ -531,11 +547,11 @@ public class ShutdownnewService {
     }
 
     private void initalWindturbineStatus(List<ProEconWindturbineStatus> insertProEconWindturbineStatusls,
-                                         String wtId, Map<String, PointData> wtStatusMap, Date currentTime, ProEconWindturbineStatus item) {
+                                         String wtId, Map<String, PointData2> wtStatusMap, Date currentTime, ProEconWindturbineStatus item) {
 
         item.setProjectId(CacheContext.wtmap.get(wtId).getProjectId());
-        item.setSatusCode((int) wtStatusMap.get(wtId).getPointValueInDouble());
-        item.setStatusDesc(StatusDetailValue.getNmaeByCode(wtStatusMap.get(wtId).getPointValueInDouble()));
+        item.setSatusCode((int) wtStatusMap.get(wtId).getValue());
+        item.setStatusDesc(StatusDetailValue.getNmaeByCode(wtStatusMap.get(wtId).getValue()));
         item.setStopTime(currentTime);
         item.setWindpowerstationId(CacheContext.wtmap.get(wtId).getWindpowerstationId());
         item.setWindturbineId(wtId);

+ 6 - 0
generationXK-service/src/main/resources/application-nxf.yml

@@ -165,5 +165,11 @@ report:
 
 
 
+feign:
+  client:
+    config:
+      default:
+        connect-timeout: 15000
+        read-timeout: 7200000
 
 

+ 144 - 59
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/specific/SpecificService.java

@@ -2796,12 +2796,12 @@ public class SpecificService {
 //        }
         currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
         List<TurbineInfoDay> currentList = iTurbineInfoDayService.list(currentqw);
-        currentqw.clear();
-        currentqw.select("station_id,max(record_date) record_date,sum(gzss) gzss,sum(llfdl) llfdl");
-        currentqw.eq("station_id", CacheContext.wplsf.get(0).getId());
-        currentqw.eq("to_char(record_date,'yyyy')", year);
-        currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
-        currentList.addAll(iTurbineInfoDayService.list(currentqw));
+//        currentqw.clear();
+//        currentqw.select("station_id,max(record_date) record_date,sum(gzss) gzss,sum(llfdl) llfdl");
+//        currentqw.eq("station_id", CacheContext.wplsf.get(0).getId());
+//        currentqw.eq("to_char(record_date,'yyyy')", year);
+//        currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
+//        currentList.addAll(iTurbineInfoDayService.list(currentqw));
 
         int subYear = Integer.parseInt(year) - 1;
         QueryWrapper<TurbineInfoDay> sameperiodqw = new QueryWrapper<>();
@@ -2820,12 +2820,12 @@ public class SpecificService {
         sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear));
         sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
         List<TurbineInfoDay> sameperiodList = iTurbineInfoDayService.list(sameperiodqw);
-        sameperiodqw.clear();
-        sameperiodqw.select("station_id,max(record_date) record_date,sum(gzss) gzss,sum(llfdl) llfdl");
-        sameperiodqw.eq("station_id", CacheContext.wplsf.get(0).getId());
-        sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear));
-        sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
-        sameperiodList.addAll(iTurbineInfoDayService.list(sameperiodqw));
+//        sameperiodqw.clear();
+//        sameperiodqw.select("station_id,max(record_date) record_date,sum(gzss) gzss,sum(llfdl) llfdl");
+//        sameperiodqw.eq("station_id", CacheContext.wplsf.get(0).getId());
+//        sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear));
+//        sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
+//        sameperiodList.addAll(iTurbineInfoDayService.list(sameperiodqw));
 
         //合并当月与同期数据为返回结果
         List<SpecificTargetVo> resultList = new ArrayList<>();
@@ -2867,9 +2867,9 @@ public class SpecificService {
                 double rfdl = tqinfoday.getGzss() != null ?tqinfoday.getGzss().doubleValue() :0.0;
                 if (llfdl != 0) {
                     Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100,2);
-                    i.setCurrent(calculatedValue);
+                    i.setSameperiod(calculatedValue);
                 } else {
-                    i.setCurrent(0.0);
+                    i.setSameperiod(0.0);
                 }
                 i.setCompare(i.getCurrent().compareTo(i.getSameperiod()));
             } else {
@@ -2932,9 +2932,16 @@ public class SpecificService {
                     }
                 }
 
-
                 vo.setTargetList(tempList);
                 resultendList.add(vo);
+
+                SpecificTarget vo2 = new SpecificTarget();
+                vo2.setWpid(vo.getWpid());
+                vo2.setTargetList(vo.getTargetList());
+                vo2.setOrderNum(vo.getOrderNum()+1);
+                vo2.setWpname(CacheContext.cpmap.get(companys).getAname());
+                resultendList.add(vo2);
+
             });
         }
         SortUtils.sort(resultendList, "orderNum", SortUtils.ASC);
@@ -3386,7 +3393,7 @@ public class SpecificService {
         //获取年份所有当月的数据
         QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
         currentqw.select("station_id,max(record_date) record_date,sum(xdss) xdss,sum(llfdl) llfdl");
-        currentqw.eq("location", "wp");
+//        currentqw.eq("location", "wp");
         currentqw.eq("to_char(record_date,'yyyy')", year);
         if (type.equals("-1")) {
             currentqw.like("station_id", "_FDC_");
@@ -3400,12 +3407,12 @@ public class SpecificService {
 //        }
         currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
         List<TurbineInfoDay> currentList = iTurbineInfoDayService.list(currentqw);
-        currentqw.clear();
-        currentqw.select("station_id,max(record_date) record_date,sum(xdss) xdss,sum(llfdl) llfdl");
-//        currentqw.eq("foreign_key_id", companys + type);
-        currentqw.eq("to_char(record_date,'yyyy')", year);
-        currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
-        currentList.addAll(iTurbineInfoDayService.list(currentqw));
+//        currentqw.clear();
+//        currentqw.select("station_id,max(record_date) record_date,sum(xdss) xdss,sum(llfdl) llfdl");
+////        currentqw.eq("foreign_key_id", companys + type);
+//        currentqw.eq("to_char(record_date,'yyyy')", year);
+//        currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
+//        currentList.addAll(iTurbineInfoDayService.list(currentqw));
 
         int subYear = Integer.parseInt(year) - 1;
         QueryWrapper<TurbineInfoDay> sameperiodqw = new QueryWrapper<>();
@@ -3424,12 +3431,12 @@ public class SpecificService {
         sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear));
         sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
         List<TurbineInfoDay> sameperiodList = iTurbineInfoDayService.list(sameperiodqw);
-        sameperiodqw.clear();
-        sameperiodqw.select("station_id,max(record_date) record_date,sum(xdss) xdss,sum(llfdl) llfdl");
-//        sameperiodqw.eq("foreign_key_id", companys + type);
-        sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear));
-        sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
-        sameperiodList.addAll(iTurbineInfoDayService.list(sameperiodqw));
+//        sameperiodqw.clear();
+//        sameperiodqw.select("station_id,max(record_date) record_date,sum(xdss) xdss,sum(llfdl) llfdl");
+////        sameperiodqw.eq("foreign_key_id", companys + type);
+//        sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear));
+//        sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
+//        sameperiodList.addAll(iTurbineInfoDayService.list(sameperiodqw));
 
         //合并当月与同期数据为返回结果
         List<SpecificTargetVo> resultList = new ArrayList<>();
@@ -3449,7 +3456,15 @@ public class SpecificService {
 //            Date date = Date.from(instant);
 //            vo.setYear(DateUtils.getYear(date));
 //            vo.setMonth(DateUtils.getMonth(date));
-            vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? (i.getXdss().doubleValue()) / i.getLlfdl().doubleValue() * 100 : 0, 2));
+//            vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? (i.getXdss().doubleValue()) / i.getLlfdl().doubleValue() * 100 : 0, 2));
+            double llfdl = i.getLlfdl() != null ?i.getLlfdl().doubleValue() :0.0;
+            double rfdl = i.getXdss() != null ?i.getXdss().doubleValue() :0.0;
+            if (llfdl != 0) {
+                Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100,2);
+                vo.setCurrent(calculatedValue);
+            } else {
+                vo.setCurrent(0.0);
+            }
             resultList.add(vo);
         });
         resultList.stream().forEach(i -> {
@@ -3458,7 +3473,16 @@ public class SpecificService {
                     .findFirst();
             if (optional.isPresent()) {
                 TurbineInfoDay tqinfoday = optional.get();
-                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getLlfdl().doubleValue() != 0 ? (tqinfoday.getXdss().doubleValue() ) / tqinfoday.getLlfdl().doubleValue() * 100 : 0, 2));
+//                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getLlfdl().doubleValue() != 0 ? (tqinfoday.getXdss().doubleValue() ) / tqinfoday.getLlfdl().doubleValue() * 100 : 0, 2));
+
+                double llfdl = tqinfoday.getLlfdl() != null ?tqinfoday.getLlfdl().doubleValue() :0.0;
+                double rfdl = tqinfoday.getXdss() != null ?tqinfoday.getXdss().doubleValue() :0.0;
+                if (llfdl != 0) {
+                    Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100,2);
+                    i.setSameperiod(calculatedValue);
+                } else {
+                    i.setSameperiod(0.0);
+                }
                 i.setCompare(i.getCurrent().compareTo(i.getSameperiod()));
             } else {
                 i.setSameperiod(0.0);
@@ -3523,6 +3547,14 @@ public class SpecificService {
 
                 vo.setTargetList(tempList);
                 resultendList.add(vo);
+
+                SpecificTarget vo2 = new SpecificTarget();
+                vo2.setWpid(vo.getWpid());
+                vo2.setTargetList(vo.getTargetList());
+                vo2.setOrderNum(vo.getOrderNum()+1);
+                vo2.setWpname(CacheContext.cpmap.get(companys).getAname());
+                resultendList.add(vo2);
+
             });
         }
         SortUtils.sort(resultendList, "orderNum", SortUtils.ASC);
@@ -3694,12 +3726,12 @@ public class SpecificService {
 //        }
         currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
         List<TurbineInfoDay> currentList = iTurbineInfoDayService.list(currentqw);
-        currentqw.clear();
-        currentqw.select("station_id,max(record_date) record_date,sum(xnss) xnss,sum(llfdl) llfdl");
-//        currentqw.eq("foreign_key_id", companys + type);
-        currentqw.eq("to_char(record_date,'yyyy')", year);
-        currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
-        currentList.addAll(iTurbineInfoDayService.list(currentqw));
+//        currentqw.clear();
+//        currentqw.select("station_id,max(record_date) record_date,sum(xnss) xnss,sum(llfdl) llfdl");
+////        currentqw.eq("foreign_key_id", companys + type);
+//        currentqw.eq("to_char(record_date,'yyyy')", year);
+//        currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
+//        currentList.addAll(iTurbineInfoDayService.list(currentqw));
 
         int subYear = Integer.parseInt(year) - 1;
         QueryWrapper<TurbineInfoDay> sameperiodqw = new QueryWrapper<>();
@@ -3718,12 +3750,12 @@ public class SpecificService {
         sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear));
         sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
         List<TurbineInfoDay> sameperiodList = iTurbineInfoDayService.list(sameperiodqw);
-        sameperiodqw.clear();
-        sameperiodqw.select("station_id,max(record_date) record_date,sum(xnss) xnss,sum(llfdl) llfdl");
-//        sameperiodqw.eq("station_id", companys + type);
-        sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear));
-        sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
-        sameperiodList.addAll(iTurbineInfoDayService.list(sameperiodqw));
+//        sameperiodqw.clear();
+//        sameperiodqw.select("station_id,max(record_date) record_date,sum(xnss) xnss,sum(llfdl) llfdl");
+////        sameperiodqw.eq("station_id", companys + type);
+//        sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear));
+//        sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
+//        sameperiodList.addAll(iTurbineInfoDayService.list(sameperiodqw));
 
         //合并当月与同期数据为返回结果
         List<SpecificTargetVo> resultList = new ArrayList<>();
@@ -3743,7 +3775,16 @@ public class SpecificService {
 //            Date date = Date.from(instant);
 //            vo.setYear(DateUtils.getYear(date));
 //            vo.setMonth(DateUtils.getMonth(date));
-            vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? (i.getXnss().doubleValue()) / i.getLlfdl().doubleValue() * 100 : 0, 2));
+//            vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? (i.getXnss().doubleValue()) / i.getLlfdl().doubleValue() * 100 : 0, 2));
+            double llfdl = i.getLlfdl() != null ?i.getLlfdl().doubleValue() :0.0;
+            double rfdl = i.getXnss() != null ?i.getXnss().doubleValue() :0.0;
+            if (llfdl != 0) {
+                Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100,2);
+                vo.setCurrent(calculatedValue);
+            } else {
+                vo.setCurrent(0.0);
+            }
+
             resultList.add(vo);
         });
         resultList.stream().forEach(i -> {
@@ -3753,6 +3794,17 @@ public class SpecificService {
             if (optional.isPresent()) {
                 TurbineInfoDay tqinfoday = optional.get();
                 i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getLlfdl().doubleValue() != 0 ? (tqinfoday.getXnss().doubleValue() ) / tqinfoday.getLlfdl().doubleValue() * 100 : 0, 2));
+
+                double llfdl = tqinfoday.getLlfdl() != null ?tqinfoday.getLlfdl().doubleValue() :0.0;
+                double rfdl = tqinfoday.getXnss() != null ?tqinfoday.getXnss().doubleValue() :0.0;
+                if (llfdl != 0) {
+                    Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100,2);
+                    i.setSameperiod(calculatedValue);
+                } else {
+                    i.setSameperiod(0.0);
+                }
+
+
                 i.setCompare(i.getCurrent().compareTo(i.getSameperiod()));
             } else {
                 i.setSameperiod(0.0);
@@ -3814,9 +3866,16 @@ public class SpecificService {
                     }
                 }
 
-
                 vo.setTargetList(tempList);
                 resultendList.add(vo);
+
+                SpecificTarget vo2 = new SpecificTarget();
+                vo2.setWpid(vo.getWpid());
+                vo2.setTargetList(vo.getTargetList());
+                vo2.setOrderNum(vo.getOrderNum()+1);
+                vo2.setWpname(CacheContext.cpmap.get(companys).getAname());
+                resultendList.add(vo2);
+
             });
         }
 
@@ -3989,12 +4048,12 @@ public class SpecificService {
 //        }
         currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
         List<TurbineInfoDay> currentList = iTurbineInfoDayService.list(currentqw);
-        currentqw.clear();
-        currentqw.select("station_id,max(record_date) record_date,sum(slss) slss,sum(llfdl) llfdl");
-//        currentqw.eq("foreign_key_id", companys + type);
-        currentqw.eq("to_char(record_date,'yyyy')", year);
-        currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
-        currentList.addAll(iTurbineInfoDayService.list(currentqw));
+//        currentqw.clear();
+//        currentqw.select("station_id,max(record_date) record_date,sum(slss) slss,sum(llfdl) llfdl");
+////        currentqw.eq("foreign_key_id", companys + type);
+//        currentqw.eq("to_char(record_date,'yyyy')", year);
+//        currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
+//        currentList.addAll(iTurbineInfoDayService.list(currentqw));
 
         int subYear = Integer.parseInt(year) - 1;
         QueryWrapper<TurbineInfoDay> sameperiodqw = new QueryWrapper<>();
@@ -4013,12 +4072,12 @@ public class SpecificService {
         sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear));
         sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
         List<TurbineInfoDay> sameperiodList = iTurbineInfoDayService.list(sameperiodqw);
-        sameperiodqw.clear();
-        sameperiodqw.select("station_id,max(record_date) record_date,sum(slss) slss,sum(llfdl) llfdl");
-        sameperiodqw.eq("station_id", companys + type);
-        sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear));
-        sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
-        sameperiodList.addAll(iTurbineInfoDayService.list(sameperiodqw));
+//        sameperiodqw.clear();
+//        sameperiodqw.select("station_id,max(record_date) record_date,sum(slss) slss,sum(llfdl) llfdl");
+//        sameperiodqw.eq("station_id", companys + type);
+//        sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear));
+//        sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
+//        sameperiodList.addAll(iTurbineInfoDayService.list(sameperiodqw));
 
         //合并当月与同期数据为返回结果
         List<SpecificTargetVo> resultList = new ArrayList<>();
@@ -4038,7 +4097,16 @@ public class SpecificService {
 //            Date date = Date.from(instant);
 //            vo.setYear(DateUtils.getYear(date));
 //            vo.setMonth(DateUtils.getMonth(date));
-            vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? (i.getSlss().doubleValue()) / i.getLlfdl().doubleValue() * 100 : 0, 2));
+//            vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? (i.getSlss().doubleValue()) / i.getLlfdl().doubleValue() * 100 : 0, 2));
+            double llfdl = i.getLlfdl() != null ?i.getLlfdl().doubleValue() :0.0;
+            double rfdl = i.getSlss() != null ?i.getSlss().doubleValue() :0.0;
+            if (llfdl != 0) {
+                Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100,2);
+                vo.setCurrent(calculatedValue);
+            } else {
+                vo.setCurrent(0.0);
+            }
+
             resultList.add(vo);
         });
         resultList.stream().forEach(i -> {
@@ -4047,7 +4115,17 @@ public class SpecificService {
                     .findFirst();
             if (optional.isPresent()) {
                 TurbineInfoDay tqinfoday = optional.get();
-                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getLlfdl().doubleValue() != 0 ? (tqinfoday.getSlss().doubleValue() ) / tqinfoday.getLlfdl().doubleValue() * 100 : 0, 2));
+//                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getLlfdl().doubleValue() != 0 ? (tqinfoday.getSlss().doubleValue() ) / tqinfoday.getLlfdl().doubleValue() * 100 : 0, 2));
+
+                double llfdl = tqinfoday.getLlfdl() != null ?tqinfoday.getLlfdl().doubleValue() :0.0;
+                double rfdl = tqinfoday.getSlss() != null ?tqinfoday.getSlss().doubleValue() :0.0;
+                if (llfdl != 0) {
+                    Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100,2);
+                    i.setSameperiod(calculatedValue);
+                } else {
+                    i.setSameperiod(0.0);
+                }
+
                 i.setCompare(i.getCurrent().compareTo(i.getSameperiod()));
             } else {
                 i.setSameperiod(0.0);
@@ -4109,9 +4187,16 @@ public class SpecificService {
                     }
                 }
 
-
                 vo.setTargetList(tempList);
                 resultendList.add(vo);
+
+                SpecificTarget vo2 = new SpecificTarget();
+                vo2.setWpid(vo.getWpid());
+                vo2.setTargetList(vo.getTargetList());
+                vo2.setOrderNum(vo.getOrderNum()+1);
+                vo2.setWpname(CacheContext.cpmap.get(companys).getAname());
+                resultendList.add(vo2);
+
             });
         }
         SortUtils.sort(resultendList, "orderNum", SortUtils.ASC);