Browse Source

修改健康报告问题

xieshengjie 2 năm trước cách đây
mục cha
commit
b26b52be52

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

@@ -75,111 +75,111 @@ public class CacheContext implements CommandLineRunner {
 
         logger.info("----------------------数据中心点开始");
         //缓存golden 所有点
-//        List<Datacenter> datacenterList = datacenterService.list();
-//
-//        datacenterList.stream().forEach(i->{
-//            if (!redisService.hasKey(i.getTableid())){
-//                QueryWrapper<Datacenterpoint> queryWrapper = new QueryWrapper<>();
-//                queryWrapper.eq("tid",i.getTableid());
-//                List<Datacenterpoint> realtimedataList = datacenterpointService.list(queryWrapper);
-//                String s = null;
-//                try {
-//                    s = JSONUtil.objectToJson(realtimedataList);
-//                } catch (IOException e) {
-//                    e.printStackTrace();
-//                }
-//                redisService.set(i.getTableid(),s);
-//            }
-//        });
-//        logger.info("----------------------数据中心点结束");
-//        logger.info("----------------------设备点开始");
-//        //缓存设备点
-//        if (!redisService.hasKey("WT")){
-//            Map<String,Map<String,Windturbinetestingpointai2>> wtaimap = new HashMap<>();
-//            List<Windturbine> windturbineList = windturbineService.list();
-//            windturbineList.stream().forEach(i->{
-//                Map<String,Windturbinetestingpointai2> codeaimap = new HashMap<>();
-//                QueryWrapper<Windturbinetestingpointai2> qw = new QueryWrapper<>();
-//                qw.eq("windturbineid",i.getId());
-//                List<Windturbinetestingpointai2> windturbinetestingpointai2List = windturbinetestingpointai2Service.list(qw);
-//                windturbinetestingpointai2List.stream().forEach(x->{
-//                    codeaimap.put(x.getUniformcode(),x);
-//                });
-//                wtaimap.put(i.getId(),codeaimap);
-//            });
-//            String s = JSONObject.toJSONString(wtaimap);
-//            redisService.set("WT",s);
-//        };
-//        logger.info("----------------------设备点结束");
-//        logger.info("----------------------线路点开始");
-//        //缓存线路点
-//        if (!redisService.hasKey("LN")){
-//            Map<String,Map<String, Windpowerstationtestingpoint2>> lnaimap = new HashMap<>();
-//            List<Line> lineList = lineService.list();
-//            lineList.stream().forEach(i->{
-//                Map<String,Windpowerstationtestingpoint2> codeaimap = new HashMap<>();
-//                QueryWrapper<Windpowerstationtestingpoint2> qw = new QueryWrapper<>();
-//                qw.eq("windpowerstationid",i.getId());
-//                List<Windpowerstationtestingpoint2> windpowerstationtestingpoint2List = windpowerstationtestingpoint2Service.list(qw);
-//                windpowerstationtestingpoint2List.stream().forEach(x->{
-//                    codeaimap.put(x.getUniformcode(),x);
-//                });
-//                lnaimap.put(i.getId(),codeaimap);
-//            });
-//            String s = JSONObject.toJSONString(lnaimap);
-//            redisService.set("LN",s);
-//        };
-//        logger.info("----------------------线路点结束");
-//        logger.info("----------------------工程点开始");
-//        //缓存工程点
-//        if (!redisService.hasKey("PJ")){
-//            Map<String,Map<String, Windpowerstationtestingpoint2>> pjaimap = new HashMap<>();
-//            List<Project> projectList = projectService.list();
-//            projectList.stream().forEach(i->{
-//                Map<String,Windpowerstationtestingpoint2> codeaimap = new HashMap<>();
-//                QueryWrapper<Windpowerstationtestingpoint2> qw = new QueryWrapper<>();
-//                qw.eq("windpowerstationid",i.getId());
-//                List<Windpowerstationtestingpoint2> windpowerstationtestingpoint2List = windpowerstationtestingpoint2Service.list(qw);
-//                windpowerstationtestingpoint2List.stream().forEach(x->{
-//                    codeaimap.put(x.getUniformcode(),x);
-//                });
-//                pjaimap.put(i.getId(),codeaimap);
-//            });
-//            String s = JSONObject.toJSONString(pjaimap);
-//            redisService.set("PJ",s);
-//        };
-//        logger.info("----------------------工程点结束");
-//        logger.info("----------------------场站点开始");
-//        //缓存场站点
-//        if (!redisService.hasKey("WP")){
-//            Map<String,Map<String, Windpowerstationtestingpoint2>> wpaimap = new HashMap<>();
-//            List<Windpowerstation> wpList = windpowerstationService.list();
-//            List<String> wpids = wpList.stream().map(i -> i.getId()).collect(Collectors.toList());
-//            wpids.add("0");
-//            wpids.add("-1");
-//            wpids.add("-2");
-//            wpids.stream().forEach(i->{
-//                Map<String,Windpowerstationtestingpoint2> codeaimap = new HashMap<>();
-//                QueryWrapper<Windpowerstationtestingpoint2> qw = new QueryWrapper<>();
-//                qw.eq("windpowerstationid",i);
-//                List<Windpowerstationtestingpoint2> windpowerstationtestingpoint2List = windpowerstationtestingpoint2Service.list(qw);
-//                windpowerstationtestingpoint2List.stream().forEach(x->{
-//                    codeaimap.put(x.getUniformcode(),x);
-//                });
-//                wpaimap.put(i,codeaimap);
-//            });
-//            String s = JSONObject.toJSONString(wpaimap);
-//
-//            redisService.set("WP",s);
-//        };
-//        logger.info("----------------------场站点结束");
-//        logger.info("----------------------MODELPOWERRD表开始");
-//        if (!redisService.hasKey("MPRD")){
-//            List<Modelpowerrd> mordlist = modelpowerrdService.list();
-//            String s = JSONObject.toJSONString(mordlist);
-//            redisService.set("MPRD",s);
-//        }
-//        logger.info("----------------------MODELPOWERRD表结束");
+        List<Datacenter> datacenterList = datacenterService.list();
+
+        datacenterList.stream().forEach(i->{
+            if (!redisService.hasKey(i.getTableid())){
+                QueryWrapper<Datacenterpoint> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("tid",i.getTableid());
+                List<Datacenterpoint> realtimedataList = datacenterpointService.list(queryWrapper);
+                String s = null;
+                try {
+                    s = JSONUtil.objectToJson(realtimedataList);
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+                redisService.set(i.getTableid(),s);
+            }
+        });
+        logger.info("----------------------数据中心点结束");
+        logger.info("----------------------设备点开始");
+        //缓存设备点
+        if (!redisService.hasKey("WT")){
+            Map<String,Map<String,Windturbinetestingpointai2>> wtaimap = new HashMap<>();
+            List<Windturbine> windturbineList = windturbineService.list();
+            windturbineList.stream().forEach(i->{
+                Map<String,Windturbinetestingpointai2> codeaimap = new HashMap<>();
+                QueryWrapper<Windturbinetestingpointai2> qw = new QueryWrapper<>();
+                qw.eq("windturbineid",i.getId());
+                List<Windturbinetestingpointai2> windturbinetestingpointai2List = windturbinetestingpointai2Service.list(qw);
+                windturbinetestingpointai2List.stream().forEach(x->{
+                    codeaimap.put(x.getUniformcode(),x);
+                });
+                wtaimap.put(i.getId(),codeaimap);
+            });
+            String s = JSONObject.toJSONString(wtaimap);
+            redisService.set("WT",s);
+        };
+        logger.info("----------------------设备点结束");
+        logger.info("----------------------线路点开始");
+        //缓存线路点
+        if (!redisService.hasKey("LN")){
+            Map<String,Map<String, Windpowerstationtestingpoint2>> lnaimap = new HashMap<>();
+            List<Line> lineList = lineService.list();
+            lineList.stream().forEach(i->{
+                Map<String,Windpowerstationtestingpoint2> codeaimap = new HashMap<>();
+                QueryWrapper<Windpowerstationtestingpoint2> qw = new QueryWrapper<>();
+                qw.eq("windpowerstationid",i.getId());
+                List<Windpowerstationtestingpoint2> windpowerstationtestingpoint2List = windpowerstationtestingpoint2Service.list(qw);
+                windpowerstationtestingpoint2List.stream().forEach(x->{
+                    codeaimap.put(x.getUniformcode(),x);
+                });
+                lnaimap.put(i.getId(),codeaimap);
+            });
+            String s = JSONObject.toJSONString(lnaimap);
+            redisService.set("LN",s);
+        };
+        logger.info("----------------------线路点结束");
+        logger.info("----------------------工程点开始");
+        //缓存工程点
+        if (!redisService.hasKey("PJ")){
+            Map<String,Map<String, Windpowerstationtestingpoint2>> pjaimap = new HashMap<>();
+            List<Project> projectList = projectService.list();
+            projectList.stream().forEach(i->{
+                Map<String,Windpowerstationtestingpoint2> codeaimap = new HashMap<>();
+                QueryWrapper<Windpowerstationtestingpoint2> qw = new QueryWrapper<>();
+                qw.eq("windpowerstationid",i.getId());
+                List<Windpowerstationtestingpoint2> windpowerstationtestingpoint2List = windpowerstationtestingpoint2Service.list(qw);
+                windpowerstationtestingpoint2List.stream().forEach(x->{
+                    codeaimap.put(x.getUniformcode(),x);
+                });
+                pjaimap.put(i.getId(),codeaimap);
+            });
+            String s = JSONObject.toJSONString(pjaimap);
+            redisService.set("PJ",s);
+        };
+        logger.info("----------------------工程点结束");
+        logger.info("----------------------场站点开始");
+        //缓存场站点
+        if (!redisService.hasKey("WP")){
+            Map<String,Map<String, Windpowerstationtestingpoint2>> wpaimap = new HashMap<>();
+            List<Windpowerstation> wpList = windpowerstationService.list();
+            List<String> wpids = wpList.stream().map(i -> i.getId()).collect(Collectors.toList());
+            wpids.add("0");
+            wpids.add("-1");
+            wpids.add("-2");
+            wpids.stream().forEach(i->{
+                Map<String,Windpowerstationtestingpoint2> codeaimap = new HashMap<>();
+                QueryWrapper<Windpowerstationtestingpoint2> qw = new QueryWrapper<>();
+                qw.eq("windpowerstationid",i);
+                List<Windpowerstationtestingpoint2> windpowerstationtestingpoint2List = windpowerstationtestingpoint2Service.list(qw);
+                windpowerstationtestingpoint2List.stream().forEach(x->{
+                    codeaimap.put(x.getUniformcode(),x);
+                });
+                wpaimap.put(i,codeaimap);
+            });
+            String s = JSONObject.toJSONString(wpaimap);
+
+            redisService.set("WP",s);
+        };
+        logger.info("----------------------场站点结束");
+        logger.info("----------------------MODELPOWERRD表开始");
+        if (!redisService.hasKey("MPRD")){
+            List<Modelpowerrd> mordlist = modelpowerrdService.list();
+            String s = JSONObject.toJSONString(mordlist);
+            redisService.set("MPRD",s);
+        }
+        logger.info("----------------------MODELPOWERRD表结束");
 
 
     }

+ 1 - 1
datacenter/src/main/java/com/gyee/datacenter/init/CacheContext.java

@@ -31,7 +31,7 @@ import java.util.Map;
 @Component
 public class CacheContext implements CommandLineRunner {
 
-    private static final Logger log = LoggerFactory.getLogger(ParameterComparisonService.class);
+    private static final Logger log = LoggerFactory.getLogger(CacheContext.class);
     @Autowired
     private RedisService redisService;
     @Autowired

+ 1 - 0
datacenter/src/main/java/com/gyee/datacenter/util/PageDTO.java

@@ -13,6 +13,7 @@ import lombok.Data;
 public class PageDTO {
     /**
      * 每页显示的条数
+     *
      */
     private int limit = 100;
 

+ 5 - 7
gradeevaluation/src/main/java/com/gyee/gradeevaluation/init/CacheContext.java

@@ -104,13 +104,11 @@ public class CacheContext implements CommandLineRunner {
         });
         lineList = lineService.list();
 
-
-
-//        healthReportService.saveHealthReport("2021-09-07","2021-09-07","MHS_FDC");
-//        healthReportService.saveHealthReport("2021-09-07","2021-09-07","NSS_FDC");
-//        healthReportService.saveHealthReport("2021-09-07","2021-09-07","QS_FDC");
-//        healthReportService.saveHealthReport("2021-09-07","2021-09-07","SBQ_FDC");
-//        healthReportService.saveHealthReport("2021-09-07","2021-09-07","XS_FDC");
+//        healthReportService.saveHealthReport("2022-06-24","2022-06-24","MHS_FDC");
+//        healthReportService.saveHealthReport("2022-06-24","2022-06-24","NSS_FDC");
+//        healthReportService.saveHealthReport("2022-06-24","2022-06-24","QS_FDC");
+//        healthReportService.saveHealthReport("2022-06-24","2022-06-24","SBQ_FDC");
+//        healthReportService.saveHealthReport("2022-06-24","2022-06-24","XS_FDC");
         log.info("-------------------------------缓存结束--------------------------------------");
     }
 }