瀏覽代碼

Merge branch 'master' of http://124.70.43.205:3000/wangb/runeconomy-nx

hlf 3 月之前
父節點
當前提交
69e9b813a3

+ 4 - 2
data-adapter/src/main/java/com/gyee/dataadapter/controller/AdapterController.java

@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.util.*;
+import java.util.stream.Collectors;
 
 @RestController
 @RequestMapping("/ts")
@@ -91,8 +92,9 @@ public class AdapterController {
     }
 
     @PostMapping("/save/batch")
-    public boolean writeLatestBatch(@RequestBody List<PointData> PointDataList) {
-        return tsDataService.writeLatest(PointDataList);
+    public boolean writeLatestBatch(@RequestBody List<PointData> pointDataList) {
+        pointDataList = pointDataList.stream().filter(pd -> !"INITIAL".equals(pd.getTagName())).collect(Collectors.toList());
+        return tsDataService.writeLatest(pointDataList);
     }
 
     @PostMapping("/save")

+ 3 - 2
data-adapter/src/main/java/com/gyee/dataadapter/service/TsDataService.java

@@ -132,12 +132,13 @@ public class TsDataService {
                 Collectors.groupingBy(tn -> tn.startsWith("NX_FGS_")));
         Map<String, PointData> result = new HashMap<>();
         try {
+            Map<String, PointData> latest = historyDao.getHistorySection(time, nxFgs.get(true));
+            result.putAll(latest);
+            if (nxFgs.get(false) == null) return result;
             for (String tagName : nxFgs.get(false)) {
                 List<PointData> pdsMap = adapterService.getPointData(time, time, 1, null, tagName);
                 result.put(tagName, pdsMap.get(0));
             }
-            Map<String, PointData> latest = historyDao.getHistorySection(time, nxFgs.get(true));
-            result.putAll(latest);
             return result;
         } catch (Exception e) {
             log.error(e.getMessage());

+ 30 - 9
generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo1Service.java

@@ -15,17 +15,26 @@ 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.boot.ApplicationArguments;
+import org.springframework.boot.ApplicationRunner;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
+import java.time.Instant;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.time.ZoneId;
 import java.util.*;
 import java.util.stream.Collectors;
 
 @Service
 public class WindPowerInfo1Service {
+//    @Override
+//    public void run(ApplicationArguments args) throws Exception {
+//        Date date = new Date();
+//        writegf(date);
+//    }
 
     //    private static final Logger logger = LoggerFactory.getLogger(WindPowerInfo1Service.class);
     @Resource
@@ -44,7 +53,6 @@ public class WindPowerInfo1Service {
     private IProEconAnalysisSubtableBottomService iProEconAnalysisSubtableBottomService;
 
 
-
     /**
      * 计算区域日信息
      */
@@ -1256,42 +1264,55 @@ public class WindPowerInfo1Service {
     public void writegf(Date date) throws Exception {
         LocalDate localDate = LocalDateTime.now().toLocalDate();
         String[] split = gf.split(",");
-        List<PointData> realData = edosUtil.getRealData(Arrays.asList(split));
+        List<String> str = new ArrayList<>(Arrays.asList(split));
+        List<PointData> realData = edosUtil.getRealData(str);
         QueryWrapper<ProEconAnalysisSubtableBottom> qw = new QueryWrapper<>();
         qw.lambda().eq(ProEconAnalysisSubtableBottom::getRecordDate, localDate);
         List<ProEconAnalysisSubtableBottom> sel = iProEconAnalysisSubtableBottomService.sel(qw);
-        List<ProEconAnalysisSubtableBottom> ls = new ArrayList<>();
+        List<ProEconAnalysisSubtableBottom> ls = null;
         if (null == sel || sel.isEmpty()) {
+            ls = new ArrayList<>();
             for (PointData real : realData) {
                 ProEconAnalysisSubtableBottom pb = new ProEconAnalysisSubtableBottom();
-                date = new Date(real.getPointTime());
-                pb.setRecordDate(date);
+                pb.setRecordDate(new Date(real.getPointTime()));
                 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])){
+                } else if ("霞光储能电站".equals(split1[2]) || "宁东32光伏场站".equals(split1[2])) {
                     pb.setWpid("GJNY_NXGS_XGB_GDC_STA");
+                } else if ("电度表".equals(split1[3]) ) {
+                    pb.setWpid("NX_FGS_HA_FDC_STA");
                 }else {
                     pb.setWpid("GJNY_NXGS_QZB_GDC_STA");
                 }
                 pb.setMeterId(real.getPointName());
                 pb.setMeterName(real.getPointName());
                 pb.setStopCode(real.getPointValueInDouble());
+                pb.setStopCodeModify(real.getPointValueInDouble());
                 ls.add(pb);
             }
-        }else {
+        } else {
+            ls = new ArrayList<>();
             for (PointData real : realData) {
                 for (ProEconAnalysisSubtableBottom s : sel) {
-                    ProEconAnalysisSubtableBottom pb = new ProEconAnalysisSubtableBottom();
                     if (real.getPointName().equals(s.getMeterId())) {
+                        ProEconAnalysisSubtableBottom pb = new ProEconAnalysisSubtableBottom();
+                        pb.setId(s.getId());
                         pb.setStopCode(real.getPointValueInDouble());
+                        pb.setStopCodeModify(real.getPointValueInDouble());
+                        pb.setRecordDate(new Date(real.getPointTime()));
+                        pb.setMeterName(real.getPointName());
+                        pb.setMeterId(real.getPointName());
+                        ls.add(pb);
                     }
-                    ls.add(pb);
                 }
             }
         }
         boolean b = iProEconAnalysisSubtableBottomService.batchAdd(ls);
+
     }
+
+
 }
 
 

+ 2 - 1
generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/ProEconAnalysisSubtableBottomServiceImpl.java

@@ -25,7 +25,8 @@ public class ProEconAnalysisSubtableBottomServiceImpl extends ServiceImpl<ProEco
             proEconStationPowers.stream().forEach(i -> {
                 QueryWrapper<ProEconAnalysisSubtableBottom> qw = new QueryWrapper<>();
                 qw.lambda().eq(ProEconAnalysisSubtableBottom::getRecordDate, i.getRecordDate());
-                qw.lambda().eq(ProEconAnalysisSubtableBottom::getMeterId, i.getMeterId());
+//                qw.lambda().eq(ProEconAnalysisSubtableBottom::getMeterId, i.getMeterId());
+                qw.lambda().eq(ProEconAnalysisSubtableBottom::getId, i.getId());
                 long count = baseMapper.selectCount(qw);
                 if (count > 0) {
                     baseMapper.update(i, qw);

+ 3 - 2
generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/StatusService.java

@@ -1244,7 +1244,8 @@ public class StatusService {
             resultList.add(txzdPoint);
 
         });
-        edosUtil.sendMultiPoint(resultList);
+        List<PointData> resultLists = resultList.stream().filter(res -> !"INITIAL".equals(res.getEdnaId()) && !res.getEdnaId().contains("区域集控")).collect(Collectors.toList());
+        edosUtil.sendMultiPoint(resultLists);
     }
 
     private double getMxzt(double zjzt, Map<String, ProEconEquipmentmodel> modelMap, Map<String, Map<Integer, Integer>> aistateMap,
@@ -1771,7 +1772,7 @@ public class StatusService {
             //            end=new Date();
             //            System.out.println("执行用时"+ DateUtils.secondsDiff(begin,end) +"秒");
             //            System.out.println("场站状态判定调度程序执行结束!。。。。。。");
-            //            System.out.println("完成!。。。。。。");
+                        System.out.println("完成!。。。。。。");
         }
     }
 

+ 10 - 7
generationXK-service/src/main/java/com/gyee/generation/util/realtimesource/EdosUtil.java

@@ -757,6 +757,7 @@ public class EdosUtil implements IEdosUtil {
                     // 根据key获得value, value也可以是JSONObject,JSONArray,使用对应的参数接收即可
                     JSONObject jsonData = jsonObject.getJSONObject(key);
                     Long ts = jsonData.getLong("ts");
+                    pointData.setPointTime(ts);
                     String pointValue = null;
                     if (jsonData.containsKey("doubleValue")) {
                         pointValue = jsonData.getString("doubleValue");
@@ -1236,11 +1237,13 @@ public class EdosUtil implements IEdosUtil {
     private JSONObject convertPointData(PointData pd) {
         JSONObject jo = new JSONObject();
         jo.put("tagName", pd.getEdnaId());
-        JSONObject joo = new JSONObject();
-        joo.put("ts", pd.getPointTime());
-        joo.put("status", 0);
-        joo.put("doubleValue", pd.getPointValueInDouble());
-        jo.put("tsData", joo);
+        jo.put("ts", pd.getPointTime());
+        jo.put("doubleValue", pd.getPointValueInDouble());
+//        JSONObject joo = new JSONObject();
+//        joo.put("ts", pd.getPointTime());
+//        joo.put("status", 0);
+//        joo.put("doubleValue", pd.getPointValueInDouble());
+//        jo.put("tsData", joo);
         return jo;
     }
 
@@ -1305,12 +1308,12 @@ public class EdosUtil implements IEdosUtil {
     @Override
     public void sendMultiPoint(List<PointData> pointls) throws Exception {
 
-        String url = baseURL + "/latest/batch";
+        String url = baseURL + "/save/batch";
 
         if (!pointls.isEmpty()) {
 
             if (pointls.get(0).getEdnaId().startsWith("GF-")) {
-                url = baseURL2 + "/latest/batch";
+                url = baseURL2 + "/save/batch";
             }
 
             List<JSONObject> writeList = new ArrayList<>();

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