瀏覽代碼

文件导出相关

wangchangsheng 3 年之前
父節點
當前提交
059c88561b

+ 19 - 0
pom.xml

@@ -366,6 +366,25 @@
 			<version>8.18.0</version>
 		</dependency>
 		<!--http请求-->
+
+		<dependency>
+			<groupId>org.apache.poi</groupId>
+			<artifactId>poi</artifactId>
+			<version>5.0.0</version>
+		</dependency>
+
+		<dependency>
+			<groupId>net.sourceforge.jexcelapi</groupId>
+			<artifactId>jxl</artifactId>
+			<version>2.6.12</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.commons</groupId>
+			<artifactId>commons-collections4</artifactId>
+			<version>4.4</version>
+		</dependency>
+
 	</dependencies>
 
 

+ 2 - 0
src/main/java/com/gyee/SpringbootStart.java

@@ -5,6 +5,7 @@ import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.scheduling.annotation.EnableScheduling;
 
 
 /**
@@ -12,6 +13,7 @@ import org.springframework.cache.annotation.EnableCaching;
  * @author gyee
  *
  */
+@EnableScheduling
 @EnableCaching
 @SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
 public class SpringbootStart {

+ 15 - 0
src/main/java/com/gyee/frame/common/conf/ExportConfig.java

@@ -22,4 +22,19 @@ public class ExportConfig {
     private Map<String, String> template2swgl;
 
     private Map<String, String> template2cft;
+
+    //导出数据模板标题
+    private List<String> template1title;
+
+    private List<String> template2swdltitle;
+
+    private List<String> template2swgltitle;
+
+    private List<String> template2cfttitle;
+
+    //文件导出地址
+    private String exportpath;
+
+    //数据导出间隔
+    private List<Integer> exportval;
 }

+ 30 - 0
src/main/java/com/gyee/frame/controller/comm/FullPushMsgController.java

@@ -0,0 +1,30 @@
+package com.gyee.frame.controller.comm;
+
+
+import com.gyee.frame.common.domain.AjaxResult;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+@RestController
+@RequestMapping("/fullpushmessage")
+public class FullPushMsgController {
+
+
+    public AjaxResult pushmsg () {
+
+
+        return null;
+    }
+
+
+
+
+
+
+
+
+
+
+
+}

+ 10 - 0
src/main/java/com/gyee/frame/controller/curve/PowerCurveController.java

@@ -0,0 +1,10 @@
+package com.gyee.frame.controller.curve;
+
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@Controller
+@RequestMapping("/contrast")
+public class PowerCurveController {
+}

+ 80 - 9
src/main/java/com/gyee/frame/controller/export/GoldenController.java

@@ -5,25 +5,30 @@ import com.gyee.frame.common.conf.AjaxStatus;
 import com.gyee.frame.common.domain.AjaxResult;
 import com.gyee.frame.service.WindpowerstationService;
 import com.gyee.frame.service.export.GoldenService;
+import com.gyee.frame.util.excel.FileUtils;
+import com.gyee.frame.util.excel.ZipUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import javax.annotation.Resource;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
+import javax.servlet.http.HttpServletRequest;
+import java.util.*;
 
 @RestController
 @RequestMapping("/export")
-@Api(value = "golden数据导出功能",tags =  "golden数据导出功能")
+@Api(value = "golden数据导出功能", tags = "golden数据导出功能")
 public class GoldenController {
 
-    @Resource
+    @Autowired
     private GoldenService goldenService;
-    @Resource
+    @Autowired
     private WindpowerstationService stationService;
 
+
+    @Autowired
+    FileUtils fileUtils;
+
     /**
      * 查询所有的场站
      *
@@ -37,7 +42,6 @@ public class GoldenController {
     }
 
 
-
     /**
      * 通过模板导出单个风机数据
      *
@@ -82,8 +86,75 @@ public class GoldenController {
             @RequestParam(value = "interval", required = false) Optional<Integer> interval) {
 
         int val = interval.isPresent() ? interval.get() : 1800;
-
         Map<String, List<Object>> map = goldenService.getHistoryDataAll(station, id, startTs, endTs, val);
         return AjaxResult.successData(AjaxStatus.success.code, map);
     }
+
+//    /**
+//     * @param request
+//     * @return
+//     */
+//    @GetMapping("/downloadFile")
+//    public ResponseEntity<Resource> downloadFile(HttpServletRequest request,
+//                                                 @RequestParam(value = "station") String station,
+//                                                 @RequestParam(value = "templateId") String templateId,
+//                                                 @RequestParam(value = "month") String month,
+//                                                 @RequestParam(value = "interval") int interval) throws Exception {
+//
+//        String path = fileUtils.getFilePath(station, templateId, month, interval);
+//        if ("1".equals(templateId)){
+//            ZipUtils.toZip(fileUtils.getFilePathNoEx(path), path, true);
+//        }
+//        // Load file as Resource
+//        Resource resource = fileUtils.loadFileAsResource(path);
+//
+//        // Try to determine file's content type
+//        String contentType = null;
+//        try {
+//            contentType = request.getServletContext().getMimeType(resource.getFile().getAbsolutePath());
+//        } catch (IOException ex) {
+//
+//        }
+//
+//        // Fallback to the default content type if type could not be determined
+//        if (contentType == null) {
+//            contentType = "application/octet-stream";
+//        }
+//
+//        return ResponseEntity.ok()
+//                .contentType(MediaType.parseMediaType(contentType))
+//                .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + resource.getFilename() + "\"")
+//                .body(resource);
+//    }
+
+
+
+    /**
+     * @param request
+     * @return
+     */
+    @GetMapping("/downloadFile")
+    public AjaxResult downloadFile(HttpServletRequest request,
+                                                 @RequestParam(value = "station") String station,
+                                                 @RequestParam(value = "templateId") String templateId,
+                                                 @RequestParam(value = "month") String month,
+                                                 @RequestParam(value = "interval") int interval) throws Exception {
+        String path = fileUtils.getFilePath(station, templateId, month, interval);
+        if ("1".equals(templateId)){
+            ZipUtils.toZip(fileUtils.getFilePathNoEx(path), path, true);
+        }
+        Map map = new HashMap();
+        map.put("path",fileUtils.getFilePath2(station, templateId, month, interval));
+
+        if ("1".equals(templateId)) {
+            map.put("name",station+".zip");
+        } else if ("2".equals(templateId)) {
+            map.put("name",station+".xls");
+        }
+
+        AjaxResult result =  AjaxResult.successData(200,map);
+        return result;
+    }
+
+
 }

+ 69 - 0
src/main/java/com/gyee/frame/model/excel/ExcelVo.java

@@ -0,0 +1,69 @@
+package com.gyee.frame.model.excel;
+
+/**
+ * excel vo
+ */
+public class ExcelVo {
+
+
+    private String F1;
+
+    private double F2;
+
+    private double F3;
+
+    private double F4;
+
+    private double F5;
+
+    private double F6;
+
+
+    public String getF1() {
+        return F1;
+    }
+
+    public void setF1(String f1) {
+        F1 = f1;
+    }
+
+    public double getF2() {
+        return F2;
+    }
+
+    public void setF2(double f2) {
+        F2 = f2;
+    }
+
+    public double getF3() {
+        return F3;
+    }
+
+    public void setF3(double f3) {
+        F3 = f3;
+    }
+
+    public double getF4() {
+        return F4;
+    }
+
+    public void setF4(double f4) {
+        F4 = f4;
+    }
+
+    public double getF5() {
+        return F5;
+    }
+
+    public void setF5(double f5) {
+        F5 = f5;
+    }
+
+    public double getF6() {
+        return F6;
+    }
+
+    public void setF6(double f6) {
+        F6 = f6;
+    }
+}

+ 98 - 42
src/main/java/com/gyee/frame/service/export/GoldenService.java

@@ -5,16 +5,22 @@ import com.gyee.frame.common.conf.ThreadPoolTaskConfig;
 import com.gyee.frame.common.exception.QiNiuException;
 import com.gyee.frame.common.exception.enums.QiNiuErrorEnum;
 import com.gyee.frame.common.feign.RemoteServiceBuilder;
+import com.gyee.frame.model.auto.Windpowerstation;
+import com.gyee.frame.model.auto.WindpowerstationExample;
 import com.gyee.frame.model.custom.export.TsPointData;
 import com.gyee.frame.service.AnalysissubtablebottomService;
 import com.gyee.frame.service.WindTurbineTestingPointAiService;
+import com.gyee.frame.service.WindpowerstationService;
 import com.gyee.frame.service.WindturbineService;
 import com.gyee.frame.util.DateUtils;
+import com.gyee.frame.util.excel.ExcelExportUtils;
+import com.gyee.frame.util.excel.FileUtils;
 import com.gyee.frame.util.task.TaskTemplateCallable;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 
-import javax.annotation.Resource;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -27,25 +33,32 @@ import java.util.stream.Collectors;
 public class GoldenService {
 
 
-    @Resource
+    @Autowired
     private ExportConfig exportConfig;
-    @Resource
+    @Autowired
     private ThreadPoolTaskConfig taskConfig;
-    @Resource
+    @Autowired
     private RemoteServiceBuilder remoteService;
-    @Resource
+    @Autowired
     private WindturbineService windturbineService;
-    @Resource
+    @Autowired
     private WindTurbineTestingPointAiService windService;
+    @Autowired
+    private WindpowerstationService windpowerstationService;
 
-    @Resource
+    @Autowired
     private AnalysissubtablebottomService analysissubtablebottomService;
 
+    @Autowired
+    private FileUtils fileService;
+
+
     /**
      * 一天的时间戳
      */
     public static final Integer TIMES_TAMP_DAY = 86400;
 
+
     /**
      * 根据场站和风机ID查询
      *
@@ -80,15 +93,45 @@ public class GoldenService {
     public Map<String, List<Object>> getHistoryDataAll(String station, int templateId, long startTs, long endTs, int interval) {
         switch (templateId) {
             case 1:
-                return getTemplateHistory1(station, startTs, endTs, interval);
+                getTemplateHistory1(station, null,startTs, endTs, interval);
+                return null;
             case 2:
-                return getTemplateHistory2(station, startTs, endTs, interval);
+                return getTemplateHistory2(station,null, startTs, endTs, interval);
             default:
                 throw new QiNiuException(QiNiuErrorEnum.TEMPLATE_NO_SUPPORT);
         }
     }
 
 
+
+    @Scheduled(cron = "0 0 1 * * ?")
+//    @Scheduled(cron = "0/5 * * * * *")
+    public void getHistoryData() {
+
+        Calendar c = Calendar.getInstance();
+        c.set(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH)-1,0, 0, 0);
+        long beginOfDate = c.getTime().getTime();
+        c = Calendar.getInstance();
+        c.set(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH),0, 0, 0);
+        long endOfDate = c.getTime().getTime();
+
+        List<Integer>  val  =  exportConfig.getExportval();
+        WindpowerstationExample example = new WindpowerstationExample();
+        example.createCriteria().andIdLike("%_FDC%");
+        List<Windpowerstation> lists = windpowerstationService.selectByExample(example);
+        beginOfDate = 1633017600000L;
+        endOfDate = 1635696000000L;
+        for(int i :val){
+            for (Windpowerstation station: lists) {
+                getTemplateHistory1(station.getCode(),station.getAddress(),beginOfDate,endOfDate,i*60);
+                getTemplateHistory2(station.getCode(),station.getAddress(),beginOfDate,endOfDate,i*60);
+            }
+        }
+    }
+
+
+
+
     /**
      * 模板1  场站所有风机数据
      *
@@ -98,37 +141,38 @@ public class GoldenService {
      * @param interval
      * @return
      */
-    private Map<String, List<Object>> getTemplateHistory1(String station, long startTs, long endTs, int interval) {
-        // 风机ID、数据
-        Map<String, List<Object>> map = new LinkedHashMap<>();
+    private Map<String, Map<String, List<Object>>> getTemplateHistory1(String station, String address,long startTs, long endTs, int interval) {
 
+        String val = Integer.valueOf(interval / 60) + "";
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        String startTss = dateFormat.format(startTs);
+        // 风机ID、数据
+        Map<String, Map<String, List<Object>>> map = new LinkedHashMap<>();
         try {
             List<String> winds = windturbineService.findWindTurbineAll(station);
             if (winds == null)
-                return map;
-
+                return null;
             // 异步返回结果
-            List<Future<Map<String, List<Object>>>> list = new LinkedList<>();
+            List<Future<Map<String, Map<String, List<Object>>>>> list = new LinkedList<>();
             for (String wind : winds) {
                 TaskTemplateCallable task = new TaskTemplateCallable(windService, remoteService.ShardingService(),
                         exportConfig.getTemplate1(), station, wind, startTs, endTs, interval);
                 Future submit = taskConfig.getExecutor().submit(task);
                 list.add(submit);
             }
-
             // 返回结果处理
-            for (Future<Map<String, List<Object>>> future : list) {
-                Map<String, List<Object>> wtMap = future.get();
-                for (Map.Entry<String, List<Object>> entry : wtMap.entrySet()) {
+            for (Future<Map<String, Map<String, List<Object>>>> future : list) {
+                Map<String, Map<String, List<Object>>> wtMap = future.get();
+                for (Map.Entry<String, Map<String, List<Object>>> entry : wtMap.entrySet()) {
                     map.put(entry.getKey(), entry.getValue());
+                    List<String> title = exportConfig.getTemplate1title();
+                    ExcelExportUtils.exelcExportTem(entry.getValue(), entry.getKey(), title, exportConfig.getExportpath() + "\\excel\\" + startTss.substring(0, 7) + "\\" + val + "\\" + address + "单机\\", entry.getKey());
                 }
             }
-
         } catch (Exception e) {
-            log.error(e.getMessage());
+            log.error("error", e);
             throw new QiNiuException(QiNiuErrorEnum.ERROR_DATA);
         }
-
         return map;
     }
 
@@ -197,27 +241,28 @@ public class GoldenService {
      * @param endTs
      * @return
      */
-    private Map<String, List<Object>> getTemplateHistory2(String station, long startTs, long endTs, int interval) {
+    private Map<String, List<Object>> getTemplateHistory2(String station,String address, long startTs, long endTs, int interval) {
+
+        String val = Integer.valueOf(interval / 60) + "";
         // 风机ID、数据
         Map<String, List<Object>> map = new LinkedHashMap<>();
-
         try {
+
             // 上网电量
             String point = exportConfig.getTemplate2swdl().get(station);
             String[] points = point.split(",");
             DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
             String startTss = dateFormat.format(startTs);
             String endTss = dateFormat.format(endTs);
-            List<Map> data = analysissubtablebottomService.selectByRecorddateGrop(startTss,endTss,station,points);
-
-
-            //List<TsPointData> data = remoteService.ShardingService().getHistorySnap(point, startTs, endTs, TIMES_TAMP_DAY);
+            List<Map> data = analysissubtablebottomService.selectByRecorddateGrop(startTss, endTss, station, points);
             List<Object> list = new ArrayList<>();
-            //list.add(data.stream().map(p -> DateUtils.format(p.getTs(), DateUtils.DATE_PATTERN)).collect(Collectors.toList()));
-            //list.add(data.stream().map(TsPointData::getDoubleValue).collect(Collectors.toList()));
-
             list.add(data.stream().map(p -> dateFormat.format(p.get("RECORDDATE"))).collect(Collectors.toList()));
             list.add(data.stream().map(p -> Double.valueOf(p.get("SWDL").toString())).collect(Collectors.toList()));
+            List<String> swdltitle = exportConfig.getTemplate2swdltitle();
+            Map<String, List<Object>> swdlVos = new HashMap<>();
+            swdlVos.put("F1", data.stream().map(p -> dateFormat.format(p.get("RECORDDATE"))).collect(Collectors.toList()));
+            swdlVos.put("F2", data.stream().map(p -> Double.valueOf(p.get("SWDL").toString())).collect(Collectors.toList()));
+            ExcelExportUtils.exelcExportTem(swdlVos, "日上网电量", swdltitle, exportConfig.getExportpath() + "\\excel\\" + startTss.substring(0, 7) + "//" + val + "//", address+"测风塔");
             map.put("swdl", list);
 
             // 上网功率
@@ -226,18 +271,22 @@ public class GoldenService {
             List<Object> list2 = new ArrayList<>();
             list2.add(data2.stream().map(p -> DateUtils.format(p.getTs(), DateUtils.DATE_TIME_PATTERN)).collect(Collectors.toList()));
             list2.add(data2.stream().map(TsPointData::getDoubleValue).collect(Collectors.toList()));
+            Map<String, List<Object>> swglVos = new HashMap<>();
+            swglVos.put("F1", data2.stream().map(p -> DateUtils.format(p.getTs(), DateUtils.DATE_TIME_PATTERN)).collect(Collectors.toList()));
+            swglVos.put("F2", data2.stream().map(TsPointData::getDoubleValue).collect(Collectors.toList()));
+            List<String> swgltitle = exportConfig.getTemplate2swgltitle();
+            ExcelExportUtils.exelcExportTem(swglVos, "上网功率", swgltitle, exportConfig.getExportpath() + "\\excel\\" + startTss.substring(0, 7) + "//" + val + "//", address+"测风塔");
             map.put("swgl", list2);
 
             // 测风塔数据
             String point3 = exportConfig.getTemplate2cft().get(station);
-            List<Object> maps = getTemplateHistory2(startTs, endTs, interval, point3);
-            map.put("cft", maps);
-
-        } catch (QiNiuException e) {
-            log.error(e.getMessage());
+            Map<String, List<Object>> cftlVos = getTemplateHistory2(startTs, endTs, interval, point3);
+            List<String> cftltitle = exportConfig.getTemplate2cfttitle();
+            ExcelExportUtils.exelcExportTem(cftlVos, "测风塔数据", cftltitle, exportConfig.getExportpath() + "\\excel\\" + startTss.substring(0, 7) + "//" + val + "//", address+"测风塔");
+        } catch (Exception e) {
+            log.error("error", e);
             throw new QiNiuException(QiNiuErrorEnum.ERROR_DATA);
         }
-
         return map;
     }
 
@@ -251,15 +300,20 @@ public class GoldenService {
      * @param points
      * @return
      */
-    private List<Object> getTemplateHistory2(long startTs, long endTs, int interval, String points) {
+    private Map<String, List<Object>> getTemplateHistory2(long startTs, long endTs, int interval, String points) {
         List<Object> list = new ArrayList<>();
 
+        Map<String, List<Object>> map = new HashMap<>();
+
+
         // 第一列添加时间
-        List<String> intervals = dateInterval(startTs, endTs, interval);
+        List<Object> intervals = dateInterval(startTs, endTs, interval);
         list.add(intervals);
+        map.put("F1", intervals);
 
         try {
             String[] splits = points.split(",");
+            int num = 2;
             for (String point : splits) {
                 List<TsPointData> data = remoteService.ShardingService().getHistorySnap(point, startTs, endTs, interval);
 
@@ -271,6 +325,8 @@ public class GoldenService {
                     collect = data.stream().map(TsPointData::getDoubleValue).collect(Collectors.toList());
                 }
                 list.add(collect);
+                map.put("F" + num, collect);
+                num++;
             }
 
         } catch (QiNiuException e) {
@@ -278,7 +334,7 @@ public class GoldenService {
             throw new QiNiuException(QiNiuErrorEnum.ERROR_DATA);
         }
 
-        return list;
+        return map;
     }
 
 
@@ -290,8 +346,8 @@ public class GoldenService {
      * @param interval
      * @return
      */
-    private List<String> dateInterval(long st, long et, int interval) {
-        List<String> list = new ArrayList<>();
+    private List<Object> dateInterval(long st, long et, int interval) {
+        List<Object> list = new ArrayList<>();
         int val = interval * 1000;
         while (st < et) {
             list.add(DateUtils.format(st, DateUtils.DATE_TIME_PATTERN));

+ 131 - 4
src/main/java/com/gyee/frame/service/websocket/GenreSetPushService.java

@@ -468,10 +468,11 @@ public class GenreSetPushService {
                 }
             }
 
-            if(rycfdl==0.0)
-            {
-                rycfdl = rfdl * YCFDLXS;
-            }
+//            if(rycfdl==0.0)
+//            {
+//                rycfdl = rfdl * YCFDLXS;
+//            }
+            rycfdl = StringUtils.round(rfdl * YCFDLXS, 2);
             //预测电量临时算法=(月发电量+日预测发电量*(日历天数-当前日数))*预测发电量系数
             c = Calendar.getInstance();
             double yycfdl = (yfdl + rycfdl*(daynum-c.get(Calendar.DAY_OF_MONTH)))*YCFDLXS;
@@ -859,6 +860,132 @@ public class GenreSetPushService {
                     mxztmap.put("hjslts", 0.0);
 
                     mxztmap.put("jrts", djnum + sdtjnum + zcfdnum + qxjclnum + xdjclnum + xdtjnum + gztjnum + cnsltjnum + jxtjnum + cnsljxnum + dwslnum + hjslnum + lxnum);
+                }else if (id.endsWith("_GC")){
+                    List<String> gfzbls = new ArrayList<>();
+
+                    List<Windturbine> wtls = InitialRunner.pj_wtmap.get(id);
+                    for(Windturbine wt:wtls) {
+                        //状态
+                        gfzbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wt.getId(), Constant.FJZT).getId());
+                    }
+                    List<PointData> gfzblist = realApiUtil.getRealData(gfzbls);
+                    if (!gfzblist.isEmpty() && gfzblist.size() == gfzblist.size()) {
+                        for (int i = 0; i < wtls.size(); i++) {
+                            double gfzt = MathUtil.twoBit(MathUtil.twoBit(gfzblist.get(i).getPointValueInDouble()));
+                            switch (Double.valueOf(gfzt).intValue()) {
+                                case 0:
+                                    djnum++;
+                                    break;
+                                case 1:
+                                    zcfdnum++;
+                                    break;
+                                case 2:
+                                    gztjnum++;
+                                    break;
+                                case 3:
+                                    lxnum++;
+                                    break;
+                                case 4:
+                                    jxtjnum++;
+                                    break;
+                                case 5:
+                                    xdjclnum++;
+                                    break;
+                                case 6:
+                                    xdjclnum++;
+                                    break;
+                                default:
+                                    break;
+                            }
+
+                        }
+                    }
+
+                    //待机台数
+                    mxztmap.put("djts", djnum);
+                    //正常发电台数
+                    mxztmap.put("yxts", zcfdnum);
+                    // 限电降出力台数
+                    mxztmap.put("xdjclts", xdjclnum);
+                    // 故障停机台数
+                    mxztmap.put("gzts", gztjnum);
+                    // 检修停机台数
+                    mxztmap.put("jxts", jxtjnum);
+                    // 电网受累台数
+                    mxztmap.put("dwslts", dwslnum);
+                    // 风机离线台数
+                    mxztmap.put("lxts", lxnum);
+                    mxztmap.put("sdtjts", 0.0);
+                    mxztmap.put("fdjclts", 0.0);
+                    mxztmap.put("xdtjts", 0.0);
+                    mxztmap.put("cnslgzts", 0.0);
+                    mxztmap.put("cnsljxts", 0.0);
+                    mxztmap.put("hjslts", 0.0);
+
+                    mxztmap.put("jrts", djnum + sdtjnum + zcfdnum + qxjclnum + xdjclnum + xdtjnum + gztjnum + cnsltjnum + jxtjnum + cnsljxnum + dwslnum + hjslnum + lxnum);
+                }else if (id.endsWith("_XL")){
+                    List<String> gfzbls = new ArrayList<>();
+
+                    List<Windturbine> wtls = InitialRunner.ln_wtmap.get(id);
+                    for(Windturbine wt:wtls) {
+                        //状态
+                        gfzbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wt.getId(), Constant.FJZT).getId());
+                    }
+                    List<PointData> gfzblist = realApiUtil.getRealData(gfzbls);
+                    if (!gfzblist.isEmpty() && gfzblist.size() == gfzblist.size()) {
+                        for (int i = 0; i < wtls.size(); i++) {
+                            double gfzt = MathUtil.twoBit(MathUtil.twoBit(gfzblist.get(i).getPointValueInDouble()));
+                            switch (Double.valueOf(gfzt).intValue()) {
+                                case 0:
+                                    djnum++;
+                                    break;
+                                case 1:
+                                    zcfdnum++;
+                                    break;
+                                case 2:
+                                    gztjnum++;
+                                    break;
+                                case 3:
+                                    lxnum++;
+                                    break;
+                                case 4:
+                                    jxtjnum++;
+                                    break;
+                                case 5:
+                                    xdjclnum++;
+                                    break;
+                                case 6:
+                                    xdjclnum++;
+                                    break;
+                                default:
+                                    break;
+                            }
+
+                        }
+                    }
+
+                    //待机台数
+                    mxztmap.put("djts", djnum);
+                    //正常发电台数
+                    mxztmap.put("yxts", zcfdnum);
+                    // 限电降出力台数
+                    mxztmap.put("xdjclts", xdjclnum);
+                    // 故障停机台数
+                    mxztmap.put("gzts", gztjnum);
+                    // 检修停机台数
+                    mxztmap.put("jxts", jxtjnum);
+                    // 电网受累台数
+                    mxztmap.put("dwslts", dwslnum);
+                    // 风机离线台数
+                    mxztmap.put("lxts", lxnum);
+                    mxztmap.put("sdtjts", 0.0);
+                    mxztmap.put("fdjclts", 0.0);
+                    mxztmap.put("xdtjts", 0.0);
+                    mxztmap.put("cnslgzts", 0.0);
+                    mxztmap.put("cnsljxts", 0.0);
+                    mxztmap.put("hjslts", 0.0);
+
+                    mxztmap.put("jrts", djnum + sdtjnum + zcfdnum + qxjclnum + xdjclnum + xdtjnum + gztjnum + cnsltjnum + jxtjnum + cnsljxnum + dwslnum + hjslnum + lxnum);
                 }else {
                     mxztmap.put("djts", 0.0);
                     mxztmap.put("sdtjts", 0.0);

+ 195 - 0
src/main/java/com/gyee/frame/util/excel/ExcelExportUtils.java

@@ -0,0 +1,195 @@
+package com.gyee.frame.util.excel;
+
+import org.apache.poi.hssf.usermodel.HSSFCell;
+import org.apache.poi.hssf.usermodel.HSSFRow;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * EXCEL导出工具
+ */
+public class ExcelExportUtils {
+
+    private static Logger logger = LoggerFactory.getLogger(ExcelExportUtils.class);
+
+    /**
+     *
+     * @param voList 数据
+     * @param sheetName sheet名称
+     * @param titles 单元格表头
+     * @param path 导出路径
+     * @param fileName 导出文件名
+     * @return
+     * @throws Exception
+     */
+    public static boolean exelcExportTem(Map<String, List<Object>> voList, String sheetName, List<String> titles, String path, String fileName) throws Exception {
+
+        boolean check = checkExist(path, fileName + ".xls");
+        if (check) {
+            //获取d://test.xls,建立数据的输入通道
+            FileInputStream in = new FileInputStream(path + fileName + ".xls");
+            //使用POI提供的方法得到excel的信息
+            POIFSFileSystem poifsFileSystem = new POIFSFileSystem(in);
+            //得到文档对象
+            HSSFWorkbook workbook = new HSSFWorkbook(poifsFileSystem);
+            //根据name获取sheet表
+            HSSFSheet sheet = workbook.getSheet(sheetName);
+            if (null == sheet) {
+                sheet = workbook.createSheet(sheetName);
+                HSSFRow row = sheet.createRow(0);
+                //创建单元格,设置表头
+                HSSFCell cell = row.createCell(0);
+                for (int i = 1; i <= titles.size(); i++) {
+                    cell.setCellValue(titles.get(i - 1));
+                    cell = row.createCell(i);
+                }
+            }
+            FileOutputStream out = new FileOutputStream(path + fileName + ".xls");  //向d://test.xls中写数据
+            for (int i = 0; i < voList.get("F1").size(); i++) {
+                HSSFRow row = sheet.createRow((short) (sheet.getLastRowNum() + 1)); //对总行数减4,就是倒数行数加数据
+                //创建单元格设值
+                switch (titles.size()) {
+                    case 2:
+                        row.createCell(0).setCellValue(voList.get("F1").get(i).toString());
+                        row.createCell(1).setCellValue(Double.valueOf(voList.get("F2").get(i).toString()));
+                        break;
+                    case 5:
+                        row.createCell(0).setCellValue(voList.get("F1").get(i).toString());
+                        row.createCell(1).setCellValue(Double.valueOf(voList.get("F2").get(i).toString()));
+                        row.createCell(2).setCellValue(Double.valueOf(voList.get("F3").get(i).toString()));
+                        row.createCell(3).setCellValue(Double.valueOf(voList.get("F4").get(i).toString()));
+                        row.createCell(4).setCellValue(Double.valueOf(voList.get("F5").get(i).toString()));
+                        break;
+                    case 6:
+                        row.createCell(0).setCellValue(voList.get("F1").get(i).toString());
+                        row.createCell(1).setCellValue(Double.valueOf(voList.get("F2").get(i).toString()));
+                        row.createCell(2).setCellValue(Double.valueOf(voList.get("F3").get(i).toString()));
+                        row.createCell(3).setCellValue(Double.valueOf(voList.get("F4").get(i).toString()));
+                        row.createCell(4).setCellValue(Double.valueOf(voList.get("F5").get(i).toString()));
+                        row.createCell(5).setCellValue(Double.valueOf(voList.get("F6").get(i).toString()));
+                        break;
+                    default:
+                        break;
+                }
+            }
+
+            try {
+                workbook.write(out);
+                out.flush();
+                logger.info(fileName + "-文件写入成功");
+                return true;
+            } catch (Exception e) {
+                logger.error("文件写入失败", e);
+                return false;
+            } finally {
+                if (null != out) {
+                    out.close();
+                }
+                if (null != workbook) {
+                    workbook.close();
+                }
+            }
+
+        } else {
+
+            //创建一个workbook对应一个excel文件
+            HSSFWorkbook workbook = new HSSFWorkbook();
+            //在workbook中创建一个sheet对应excel中的sheet
+            HSSFSheet sheet = workbook.createSheet(sheetName);
+            //在sheet表中添加表头第0行,老版本的poi对sheet的行列有限制
+            HSSFRow row0 = sheet.createRow(0);
+            //创建单元格,设置表头
+            HSSFCell cell = row0.createCell(0);
+            for (int i = 1; i <= titles.size(); i++) {
+                cell.setCellValue(titles.get(i - 1));
+                cell = row0.createCell(i);
+            }
+            //写入数据
+            for (int i = 0; i < voList.get("F1").size(); i++) {
+                HSSFRow row1 = sheet.createRow(i + 1);
+                //创建单元格设值
+                switch (titles.size()) {
+                    case 2:
+                        row1.createCell(0).setCellValue(voList.get("F1").get(i).toString());
+                        row1.createCell(1).setCellValue(Double.valueOf(voList.get("F2").get(i).toString()));
+                        break;
+                    case 5:
+                        row1.createCell(0).setCellValue(voList.get("F1").get(i).toString());
+                        row1.createCell(1).setCellValue(Double.valueOf(voList.get("F2").get(i).toString()));
+                        row1.createCell(2).setCellValue(Double.valueOf(voList.get("F3").get(i).toString()));
+                        row1.createCell(3).setCellValue(Double.valueOf(voList.get("F4").get(i).toString()));
+                        row1.createCell(4).setCellValue(Double.valueOf(voList.get("F5").get(i).toString()));
+                        break;
+                    case 6:
+                        row1.createCell(0).setCellValue(voList.get("F1").get(i).toString());
+                        row1.createCell(1).setCellValue(Double.valueOf(voList.get("F2").get(i).toString()));
+                        row1.createCell(2).setCellValue(Double.valueOf(voList.get("F3").get(i).toString()));
+                        row1.createCell(3).setCellValue(Double.valueOf(voList.get("F4").get(i).toString()));
+                        row1.createCell(4).setCellValue(Double.valueOf(voList.get("F5").get(i).toString()));
+                        row1.createCell(5).setCellValue(Double.valueOf(voList.get("F6").get(i).toString()));
+                        break;
+                    default:
+                        break;
+                }
+            }
+            //将文件保存到指定的位置
+
+            FileOutputStream out = null;
+            try {
+                out = new FileOutputStream(path + fileName + ".xls");
+                workbook.write(out);
+                out.flush();
+                logger.info(fileName + "-文件写入成功");
+                return true;
+            } catch (Exception e) {
+                logger.error("文件写入失败", e);
+                return false;
+            } finally {
+                if (null != out) {
+                    out.close();
+                }
+            }
+        }
+
+    }
+
+
+    /**
+     * 判断文件及目录是否存在,若目录不存在则创建目录,文件不存 在返回false
+     *
+     * @param filepath
+     * @param fileName
+     * @return tag
+     * @throws Exception
+     */
+    public static boolean checkExist(String filepath, String fileName) throws Exception {
+
+        boolean tag = false;
+        File path = new File(filepath);
+        File name = new File(filepath + fileName);
+        //判断目录是否存在
+        if (path.exists()) {
+            //判断文件是否存在
+            if (name.exists()) {
+                tag = true;
+            }
+        } else {
+            //创建目录
+            path.mkdirs();
+            //检查目录是否存在
+            if (name.exists()) {
+                tag = true;
+            }
+        }
+        return tag;
+    }
+
+}

+ 108 - 0
src/main/java/com/gyee/frame/util/excel/FileUtils.java

@@ -0,0 +1,108 @@
+package com.gyee.frame.util.excel;
+
+import com.gyee.frame.common.exception.QiNiuException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.UrlResource;
+import org.springframework.stereotype.Service;
+
+import java.net.MalformedURLException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+@Service
+public class FileUtils {
+
+
+    private final Path fileStorageLocation; // 文件在本地存储的地址
+
+
+    @Autowired
+    public FileUtils() {
+        this.fileStorageLocation = Paths.get(System.getProperty("user.dir")).toAbsolutePath().normalize();
+    }
+
+
+    /**
+     * 加载文件
+     * @param fileName 文件名
+     * @return 文件
+     */
+    public Resource loadFileAsResource(String fileName) {
+        try {
+            Path filePath = this.fileStorageLocation.resolve(fileName).normalize();
+            Resource resource = new UrlResource(filePath.toUri());
+            if(resource.exists()) {
+                return resource;
+            } else {
+                throw new QiNiuException("File not found " + fileName);
+            }
+        } catch (MalformedURLException ex) {
+            throw new QiNiuException("File not found " + fileName);
+        }
+    }
+
+
+    /**
+     * 获取文件路径
+     * @param station
+     * @param templateId
+     * @param month
+     * @param interval
+     * @return
+     */
+    public String getFilePath(String station,String templateId,String month,int interval) {
+
+        StringBuilder sb = new StringBuilder();
+        try {
+            String val = Integer.valueOf(interval / 60) + "";
+//            String uploadDir = System.getProperty("user.dir");// ResourceUtils.getURL("classpath:").getPath()+"static\\excel";
+            String uploadDir = "D:\\java\\apache-tomcat-9.0.50\\webapps\\excel";
+            sb.append(uploadDir).append("\\");
+            sb.append(month).append("\\");
+            sb.append(val).append("\\");
+            if ("1".equals(templateId)){
+                sb.append(station).append(".zip");
+            }else if ("2".equals(templateId)){
+                sb.append(station).append(".xls");
+            } else {
+                throw new QiNiuException("请求错误");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return sb.toString();
+    }
+
+
+    /**
+     * 获取文件路径
+     * @param station
+     * @param templateId
+     * @param month
+     * @param interval
+     * @return
+     */
+    public String getFilePath2(String station,String templateId,String month,int interval) {
+        String val = Integer.valueOf(interval / 60) + "";
+        StringBuilder sb = new StringBuilder("http:\\192.168.10.15:8080").append("\\");
+        sb.append("excel").append("\\");
+        sb.append(month).append("\\");
+        sb.append(val);
+        return sb.toString();
+    }
+
+
+    public  String getFilePathNoEx(String filePath) {
+        if ((filePath != null) && (filePath.length() > 0)) {
+            int dot = filePath.lastIndexOf('.');
+            if ((dot >-1) && (dot < (filePath.length()))) {
+                return filePath.substring(0, dot);
+            }
+        }
+        return filePath;
+    }
+
+
+
+}

+ 157 - 0
src/main/java/com/gyee/frame/util/excel/ZipUtils.java

@@ -0,0 +1,157 @@
+package com.gyee.frame.util.excel;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.*;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+/**
+ * 文件压缩工具类
+ */
+public class ZipUtils {
+
+
+    private static Logger logger = LoggerFactory.getLogger(ZipUtils.class);
+    private static final int BUFFER_SIZE = 2 * 1024;
+
+
+    /**
+     * 压缩成ZIP 方法1
+     *
+     * @param srcDir           压缩文件夹路径
+     * @param path             压缩文件输出流
+     * @param KeepDirStructure 是否保留原来的目录结构,true:保留目录结构;false:所有文件跑到压缩包根目录下(注意:不保留目录结构可能会出现同名文件,会压缩失败)
+     * @throws RuntimeException 压缩失败会抛出运行时异常
+     */
+    public static void toZip(String srcDir, String path, boolean KeepDirStructure) {
+        long start = System.currentTimeMillis();
+        ZipOutputStream zos = null;
+        OutputStream fos = null;
+        try {
+            File file = new File(path);
+            if (file.exists()) {
+                file.delete();
+            }
+            fos = new FileOutputStream(file);
+            zos = new ZipOutputStream(fos);
+            File sourceFile = new File(srcDir);
+            compress(sourceFile, zos, sourceFile.getName(), KeepDirStructure);
+            long end = System.currentTimeMillis();
+            logger.info("压缩完成,耗时:" + (end - start) + " ms");
+        } catch (Exception e) {
+            logger.error("zip error from ZipUtils", e);
+        } finally {
+            if (zos != null) {
+                try {
+                    zos.close();
+                } catch (Exception e) {
+                    logger.error("zos 流关闭异常", e);
+                }
+            }
+            if (fos != null) {
+                try {
+                    fos.close();
+                } catch (Exception e) {
+                    logger.error("fos 流关闭异常", e);
+                }
+            }
+        }
+    }
+
+
+    /**
+     * 压缩成ZIP 方法2
+     *
+     * @param srcFiles 需要压缩的文件列表
+     * @param out      压缩文件输出流
+     * @throws RuntimeException 压缩失败会抛出运行时异常
+     */
+    public static void toZip(List<File> srcFiles, OutputStream out) throws RuntimeException {
+        long start = System.currentTimeMillis();
+        ZipOutputStream zos = null;
+        try {
+            zos = new ZipOutputStream(out);
+            for (File srcFile : srcFiles) {
+                byte[] buf = new byte[BUFFER_SIZE];
+                zos.putNextEntry(new ZipEntry(srcFile.getName()));
+                int len;
+                FileInputStream in = new FileInputStream(srcFile);
+                while ((len = in.read(buf)) != -1) {
+                    zos.write(buf, 0, len);
+                }
+                zos.closeEntry();
+                in.close();
+            }
+            long end = System.currentTimeMillis();
+            logger.info("压缩完成,耗时:" + (end - start) + " ms");
+        } catch (Exception e) {
+            logger.error("zip error from ZipUtils", e);
+            throw new RuntimeException("zip error from ZipUtils", e);
+        } finally {
+            if (zos != null) {
+                try {
+                    zos.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
+
+    /**
+     * 递归压缩方法
+     *
+     * @param sourceFile       源文件
+     * @param zos              zip输出流
+     * @param name             压缩后的名称
+     * @param KeepDirStructure 是否保留原来的目录结构,true:保留目录结构;false:所有文件跑到压缩包根目录下(注意:不保留目录结构可能会出现同名文件,会压缩失败)
+     * @throws Exception
+     */
+    private static void compress(File sourceFile, ZipOutputStream zos, String name,
+                                 boolean KeepDirStructure) throws Exception {
+        byte[] buf = new byte[BUFFER_SIZE];
+        if (sourceFile.isFile()) {
+            // 向zip输出流中添加一个zip实体,构造器中name为zip实体的文件的名字
+            zos.putNextEntry(new ZipEntry(name));
+            // copy文件到zip输出流中
+            int len;
+            FileInputStream in = new FileInputStream(sourceFile);
+            while ((len = in.read(buf)) != -1) {
+                zos.write(buf, 0, len);
+            }
+            // Complete the entry
+            zos.closeEntry();
+            in.close();
+        } else {
+            File[] listFiles = sourceFile.listFiles();
+            if (listFiles == null || listFiles.length == 0) {
+                // 需要保留原来的文件结构时,需要对空文件夹进行处理
+                if (KeepDirStructure) {
+                    // 空文件夹的处理
+                    zos.putNextEntry(new ZipEntry(name + "/"));
+                    // 没有文件,不需要文件的copy
+
+                    zos.closeEntry();
+                }
+            } else {
+                for (File file : listFiles) {
+                    // 判断是否需要保留原来的文件结构
+                    if (KeepDirStructure) {
+                        // 注意:file.getName()前面需要带上父文件夹的名字加一斜杠,
+                        // 不然最后压缩包中就不能保留原来的文件结构,即:所有文件都跑到压缩包根目录下了
+                        compress(file, zos, name + "/" + file.getName(), KeepDirStructure);
+                    } else {
+                        compress(file, zos, file.getName(), KeepDirStructure);
+                    }
+                }
+            }
+        }
+
+    }
+
+
+}

+ 15 - 9
src/main/java/com/gyee/frame/util/task/TaskTemplateCallable.java

@@ -41,16 +41,19 @@ public class TaskTemplateCallable implements Callable {
 
 
     @Override
-    public Map<String, List<Object>> call()  {
+    public Map<String, Map<String, List<Object>>> call()  {
 
-        Map<String, List<Object>> map = new HashMap<>();
-        List<Object> list = new ArrayList<>();
+        Map<String, Map<String, List<Object>>> map = new HashMap<>();
+//        List<Object> list = new ArrayList<>();
+        Map<String, List<Object>> list = new HashMap<>();
 
         // 第一列添加时间
-        List<String> intervals = dateInterval(startTs, endTs, interval);
-        list.add(intervals);
+        List<Object> intervals = dateInterval(startTs, endTs, interval);
+        //list.add(intervals);
+        list.put("F1",intervals);
 
         try {
+            int num = 2;
             for (String code : this.codes) {
                 List<WindTurbineTestingPointAi2> windPoints = this.windService.findPointsByUniformCodeAndStation(station, wtId, code);
                 if (windPoints == null || windPoints.size() == 0)
@@ -68,7 +71,8 @@ public class TaskTemplateCallable implements Callable {
                     } else {
                         collect = data.stream().map(point -> (int) point.getDoubleValue()).collect(Collectors.toList());
                     }
-                    list.add(collect);
+                    //list.add(collect);
+                    list.put("F"+num,collect);
                 } else {
                     if (data.size() == 0) {
                         for (int i = 0; i < intervals.size(); i++)
@@ -76,8 +80,10 @@ public class TaskTemplateCallable implements Callable {
                     } else {
                         collect = data.stream().map(TsPointData::getDoubleValue).collect(Collectors.toList());
                     }
-                    list.add(collect);
+                    //list.add(collect);
+                    list.put("F"+num,collect);
                 }
+                num++;
             }
 
             map.put(this.wtId, list);
@@ -99,8 +105,8 @@ public class TaskTemplateCallable implements Callable {
      * @param interval
      * @return
      */
-    private List<String> dateInterval(long st, long et, int interval) {
-        List<String> list = new ArrayList<>();
+    private List<Object> dateInterval(long st, long et, int interval) {
+        List<Object> list = new ArrayList<>();
         int val = interval * 1000;
         while (st < et) {
             list.add(DateUtils.format(st, DateUtils.DATE_TIME_PATTERN));

+ 9 - 0
src/main/java/com/gyee/frame/websocket/MyConstant.java

@@ -0,0 +1,9 @@
+package com.gyee.frame.websocket;
+
+/**
+ * @descrition:websocket常量
+ * @author:wang
+ * @date:2021-11-10
+ */
+public class MyConstant {
+}

+ 52 - 0
src/main/java/com/gyee/frame/websocket/WebsocketConfig.java

@@ -0,0 +1,52 @@
+package com.gyee.frame.websocket;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.messaging.simp.config.MessageBrokerRegistry;
+import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
+import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
+import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
+
+
+/**
+ * @descrition:websocket配置类
+ * @autho:wang
+ * @date:2021-11-10
+ */
+@Configuration
+@EnableWebSocketMessageBroker
+public class WebsocketConfig  implements WebSocketMessageBrokerConfigurer {
+
+    /**
+     * 注册stomp端点,主要是起到连接作用
+     *
+     * @param stompEndpointRegistry
+     */
+    @Override
+    public void registerStompEndpoints(StompEndpointRegistry stompEndpointRegistry) {
+        stompEndpointRegistry
+                .addEndpoint("/sis_service")  //端点名称
+                //.setHandshakeHandler() 握手处理,主要是连接的时候认证获取其他数据验证等
+                //.addInterceptors() 拦截处理,和http拦截类似
+                .setAllowedOrigins("*");//跨域
+        // .withSockJS(); //使用sockJS1
+
+    }
+
+    /**
+     * 注册相关服务
+     *
+     * @param registry
+     */
+    @Override
+    public void configureMessageBroker(MessageBrokerRegistry registry) {
+
+        //topic用来广播
+        registry.enableSimpleBroker("/topic", "/queue");
+        //客户端名称前缀
+        registry.setApplicationDestinationPrefixes("/app");
+        //用户名称前
+        registry.setUserDestinationPrefix("/user");
+    }
+
+
+}

+ 37 - 0
src/main/java/com/gyee/frame/websocket/WebsocketController.java

@@ -0,0 +1,37 @@
+package com.gyee.frame.websocket;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.messaging.MessageHeaders;
+import org.springframework.messaging.simp.SimpMessagingTemplate;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+
+/**
+ * @descrition:
+ * @author:wang
+ * @date:2021-11-10
+ */
+@RestController
+public class WebsocketController {
+
+    @Autowired
+    private SimpMessagingTemplate messagingTemplate;
+
+
+    /**
+     * @param distination    订阅地址
+     * @param messageBody    发送内容
+     * @param messageHeaders 头信息,自定义的头信息即可,无需添加id,ts
+     * @return
+     * @author wang
+     * @date 2021-11-10
+     * @description: 向订阅地址发送消息(不区分用户), 可增加head头信息
+     */
+    public void sendToAll(String distination, Object messageBody, Map<String, Object> messageHeaders) {
+        MessageHeaders xMessageHeaders = new MessageHeaders(messageHeaders);
+        messagingTemplate.convertAndSend(distination, messageBody, xMessageHeaders);
+    }
+}

+ 35 - 0
src/main/java/com/gyee/frame/websocket/WebsocketHeartbeat.java

@@ -0,0 +1,35 @@
+package com.gyee.frame.websocket;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @descrition:心跳
+ * @autho:wang
+ * @date:2021-11-10
+ */
+@Component
+public class WebsocketHeartbeat {
+
+
+    @Autowired
+    private WebsocketController websocketController;
+    private Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    /**
+     * 按一定频率执行的定时任务
+     */
+    @Scheduled(fixedRate = 50000)
+    public void scheduled1() {
+        Map<String, Object> header = new HashMap<>();
+        header.put("data-type", "heartbeat");
+        websocketController.sendToAll("/topic/heartbeat-data", System.currentTimeMillis(), header);
+    }
+
+}

+ 7 - 0
src/main/resources/application.yml

@@ -173,6 +173,7 @@ zmconfig:
 #golden数据导出模板测点
 exportcode:
   template1: AI022,AI130,GZZT,XDZT
+  template1title: 数据时间, scada风速(m/s), scada功率(kW), 是否故障(故障=1,不故障=0), 是否限电(限电=1,不限电=0)
   #日上网电量
 #  template2swdl:
 #    MHS_FDC: MHSFCJSFW.NX_GD_MHSF_XX_XX_XXX_XXX_CI0136
@@ -187,6 +188,7 @@ exportcode:
     QS_FDC: QSDJL.NX_GD_QSF_DD_P1_L1_001_ZXYG001, SLDJL.NX_GD_QSF_DD_P1_L1_001_ZXYG001
     SBQ_FDC: SBQDJL.NX_GD_SBQF_DD_P1_L1_001_ZXYG009, SBQDJL.NX_GD_SBQF_DD_P1_L1_001_ZXYG061, SBQDJL.NX_GD_SBQF_DD_P1_L1_001_ZXYG109
     XS_FDC: XSDJL.NX_GD_XSF_DD_P1_L1_001_ZXYG017
+  template2swdltitle: 数据时间(格式:2021/10/1), 日报上网电量(mWh)
   #上网功率
   template2swgl:
     MHS_FDC: MHSFCJSFW.NX_GD_MHSF_XX_XX_XXX_XXX_CI0135
@@ -194,6 +196,7 @@ exportcode:
     QS_FDC: QSFCJSFW.NX_GD_QSF_XX_XX_XXX_XXX_CI0135
     SBQ_FDC: SBQFCJSFW.NX_GD_SBQF_XX_XX_XXX_XXX_CI0135
     XS_FDC: XSFCJSFW.NX_GD_XSF_XX_XX_XXX_XXX_CI0135
+  template2swgltitle: 数据时间(格式:2019-05-01 13:10:00), 上网功率(kW)
   #测风塔数据
   template2cft:
     MHS_FDC: MHSFGL.NX_GD_MHSF_YC_P1_L1_001_FGLS30,MHSFGL.NX_GD_MHSF_YC_P1_L1_001_FGLD70,MHSFGL.NX_GD_MHSF_YC_P1_L1_001_FGLTEM,MHSFGL.NX_GD_MHSF_YC_P1_L1_001_FGLPRE,MHSFGL.NX_GD_MHSF_YC_P1_L1_001_FGLHUM
@@ -201,3 +204,7 @@ exportcode:
     QS_FDC: QSFGL.NX_GD_QSF_YC_P1_L1_001_CFT003,QSFGL.NX_GD_QSF_YC_P1_L1_001_CFT018,QSFGL.NX_GD_QSF_YC_P1_L1_001_CFT019,QSFGL.NX_GD_QSF_YC_P1_L1_001_CFT020,QSFGL.NX_GD_QSF_YC_P1_L1_001_CFT021
     SBQ_FDC: SBQFCJSFW.NX_GD_SBQF_XX_XX_XXX_XXX_CI0106,SBQFGL.NX_GD_SBQF_YC_P1_L1_001_FGLD70,SBQFGL.NX_GD_SBQF_YC_P1_L1_001_FGLTEM,SBQFGL.NX_GD_SBQF_YC_P1_L1_001_FGLPRE,SBQFGL.NX_GD_SBQF_YC_P1_L1_001_FGLHUM
     XS_FDC: XSFGL.NX_GD_XSF_YC_P1_L1_001_FGLS30,XSFGL.NX_GD_XSF_YC_P1_L1_001_FGLD70,XSFGL.NX_GD_XSF_YC_P1_L1_001_FGLTEM,XSFGL.NX_GD_XSF_YC_P1_L1_001_FGLPRE,XSFGL.NX_GD_XSF_YC_P1_L1_001_FGLHUM
+  template2cfttitle: 数据时间(格式:2019-05-01 13:10:00), 轮毂高度平均风速(m/s), 轮毂高度平均风向(°), 温度(℃), 压强(hPa), 湿度(%)
+  exportpath: D:\java\apache-tomcat-9.0.50\webapps #D:\\gis\apache-tomcat-8.0.36\\webapps\\zhfx
+  exportval: 5, 10, 15
+

+ 1 - 1
src/main/resources/mybatis/auto/AnalysissubtablebottomMapper.xml

@@ -360,7 +360,7 @@
         <where>
             AND wpid = #{wpid}
             AND RECORDDATE >= to_date(#{startTs}, 'yyyy-mm-dd')
-            AND RECORDDATE  &lt;=  to_date(#{endTs}, 'yyyy-mm-dd')
+            AND RECORDDATE  &lt;  to_date(#{endTs}, 'yyyy-mm-dd')
             AND meterid in
             <foreach collection="point" item="item" index="index" open= "(" separator="," close=")">
                 #{item}

src/main/resources/ehcache/ehcache-shiro.xml → src/main/resources/static/ehcache/ehcache-shiro.xml