소스 검색

1.添加风速,风向,温湿度气压三种数据曲线对比
2.优化文件解析步骤

wangt 1 년 전
부모
커밋
a852c13785

+ 17 - 14
neim-biz/src/main/java/com/jiayue/biz/service/impl/AnalysisDataImpl.java

@@ -1025,20 +1025,23 @@ public class AnalysisDataImpl {
                     List<File> fileNameList = Arrays.asList(files1).stream().filter(f -> !f.isDirectory() && f.getName().substring(f.getName().lastIndexOf(".")).contains(".log")).collect(Collectors.toList());
                     //循环文件名
                     for (File fileNameForELog : fileNameList) {
-                        String fileName = fileNameForELog.getName().substring(0, fileNameForELog.getName().indexOf(".log"));
-                        //找出wnd文件
-                        List<File> wndFile = Arrays.stream(files1).filter(f -> f.getName().contains(".wnd") && f.getName().contains(fileName)).collect(Collectors.toList());
-
-                        if (wndFile.size() > 0) {
-                            HashMap<String, String> stringStringHashMap = this.parseWnd(wndFile.get(0));
-                            String eqNo = stringStringHashMap.get("SiteNumber");
-                            //找出csv文件
-                            List<File> csvFile = Arrays.stream(files1).filter(f -> f.getName().contains(".csv") && f.getName().contains(fileName)).collect(Collectors.toList());
-
-                            if (csvFile.size() > 0 && wndFile.size() > 0) {
-                                parseEol(csvFile.get(0), stringStringHashMap, eqNo, fileNameForELog);
-
+                        try {
+                            String fileName = fileNameForELog.getName().substring(0, fileNameForELog.getName().indexOf(".log"));
+                            //找出wnd文件
+                            List<File> wndFile = Arrays.stream(files1).filter(f -> f.getName().contains(".wnd") && f.getName().contains(fileName)).collect(Collectors.toList());
+
+                            if (wndFile.size() > 0) {
+                                HashMap<String, String> stringStringHashMap = this.parseWnd(wndFile.get(0));
+                                String eqNo = stringStringHashMap.get("SiteNumber");
+                                //找出csv文件
+                                List<File> csvFile = Arrays.stream(files1).filter(f -> f.getName().contains(".csv") && f.getName().contains(fileName)).collect(Collectors.toList());
+
+                                if (csvFile.size() > 0 && wndFile.size() > 0) {
+                                    parseEol(csvFile.get(0), stringStringHashMap, eqNo, fileNameForELog);
+                                }
                             }
+                        } catch (Exception e) {
+                            log.error("解析eol文件:{} 异常:{}", fileNameForELog, e);
                         }
                     }
 
@@ -1115,7 +1118,7 @@ public class AnalysisDataImpl {
                     //移动原始文件
                     com.jiayue.biz.util.FileUtil.move(fileNameForELog.getPath(), eolFilePath + File.separator + eqNo);
                 } catch (Exception e) {
-                    e.printStackTrace();
+                    log.error("备份EOL原始文件错误:{}", e);
                 }
 
                 windTowerDataParentTableService.packageData(dataList, eqNo, "", "eol", "", windTowerInfos.get(0));

+ 101 - 106
neim-biz/src/main/java/com/jiayue/biz/service/impl/EmailImpl.java

@@ -103,7 +103,8 @@ public class EmailImpl extends ServiceImpl<EmailMapper, Email> implements EmailS
                 store.connect(host, user, password);
                 store.id(IAM);
                 IMAPFolder folder = (IMAPFolder) store.getFolder("INBOX"); // 收件箱
-                /* Folder.READ_ONLY:只读权限
+                /*
+                 * Folder.READ_ONLY:只读权限
                  * Folder.READ_WRITE:可读可写(可以修改邮件的状态)
                  */
                 folder.open(Folder.READ_WRITE); //打开收件箱
@@ -122,21 +123,18 @@ public class EmailImpl extends ServiceImpl<EmailMapper, Email> implements EmailS
                     messages1 = folder.search(ft);
                 }
 
-
                 for (Message message : messages1) {
                     //存在附件返回true 不存在返回false
-                    Flags flags = message.getFlags();
-                    if (flags.contains(Flags.Flag.SEEN)) {
-                    } else {
-                        //未读
-                        Multipart m = (Multipart) message.getContent();
-                        for (int s = 0; s < m.getCount(); s++) {
-                            BodyPart mimeMultipart = m.getBodyPart(s);
-                            log.info(mimeMultipart.getFileName());
-                        }
-                        //解析邮件
-                        parseMessage(message);
+
+                    //未读
+                    Multipart m = (Multipart) message.getContent();
+                    for (int s = 0; s < m.getCount(); s++) {
+                        BodyPart mimeMultipart = m.getBodyPart(s);
+                        log.info(mimeMultipart.getFileName());
                     }
+                    //解析邮件
+                    parseMessage(message);
+
                 }
 
                 //释放资源
@@ -467,32 +465,47 @@ public class EmailImpl extends ServiceImpl<EmailMapper, Email> implements EmailS
             File file = new File("D:\\in\\");
             //遍历所有文件
             File[] files = file.listFiles();
+            if (null == files || files.length == 0) {
+                log.warn("路径:{} 下为空,没有要解析的文件");
+                return;
+            }
+            Map<String, WindTowerInfo> windTowerInfoMap = windTowerInfoService.list().stream().collect(Collectors.toMap(x -> x.getEquipmentNo() + "", x -> x, (x1, x2) -> x1));
+            Map<String, EmailWindTowerInfo> emailWindTowerInfoMap = emailWindTowerInfoService.list().stream().collect(Collectors.toMap(x -> x.getEquipmentNo() + "", x -> x, (x1, x2) -> x1));
             for (File f : files) {
-                String[] fileType = f.getName().split("\\.");
-                if (fileType[1].equals("RWD")) {
-                    //RWD文件类型
-                    String id = f.getName().substring(0, 4);
-                    //根据编号过滤
-                    List<WindTowerInfo> windTowerInfoList = windTowerInfoService.list().stream().filter(wind -> wind.getEquipmentNo().equals(id)).collect(Collectors.toList());
+                try {
+                    //文件类型,做解析区分使用
+                    String fileTypeStr = "";
+
+                    String fileEquipmentNo = "";
+                    String fileType = f.getName().split("\\.")[1];
+                    if (fileType.equals("RWD")) {
+                        //RWD文件类型
+                        fileEquipmentNo = f.getName().substring(0, 4);
+                    } else {
+                        //rld文件类型
+                        fileEquipmentNo = f.getName().split("_")[0];
+                    }
+                    WindTowerInfo windTowerInfo = windTowerInfoMap.get(fileEquipmentNo);
                     //没有这个编号的塔
-                    if (windTowerInfoList.size() == 0) {
-                        List<EmailWindTowerInfo> emailWindTowerInfos = emailWindTowerInfoService.list().stream().filter(wind -> wind.getEquipmentNo().equals(id)).collect(Collectors.toList());
-                        if (emailWindTowerInfos.size() == 0) {
+                    if (null == windTowerInfo) {
+                        EmailWindTowerInfo emailWindTowerInfo = emailWindTowerInfoMap.get(fileEquipmentNo);
+                        if (null == emailWindTowerInfo) {
                             //如果测风塔里面没有这个塔并且邮件测风塔里也没有这个塔 则添加到邮箱读取的测风塔表中
-                            EmailWindTowerInfo emailWindTowerInfo = new EmailWindTowerInfo();
-                            emailWindTowerInfo.setEquipmentNo(id);
-                            emailWindTowerInfoService.save(emailWindTowerInfo);
-                            log.info(id + " 测风塔信息里没有这个的塔 并且邮件测风塔里也没有这个塔");
+                            EmailWindTowerInfo emailWindTowerInfoNew = new EmailWindTowerInfo();
+                            emailWindTowerInfoNew.setEquipmentNo(fileEquipmentNo);
+                            emailWindTowerInfoService.save(emailWindTowerInfoNew);
+                            log.info(fileEquipmentNo + " 测风塔信息里没有这个的塔 并且邮件测风塔里也没有这个塔");
                         } else {
-                            log.info(id + " 测风塔信息里没有这个的塔 邮件测风塔里已存在这个塔");
+                            log.info(fileEquipmentNo + " 测风塔信息里没有这个的塔 邮件测风塔里已存在这个塔");
                         }
-                    }
-                    for (WindTowerInfo w : windTowerInfoList) {
-                        if (id.equals(w.getEquipmentNo())) {
-                            if (w.getPassword().equals("")) {
+                    } else {
+                        if (fileType.equals("RWD")) {
+                            //RWD文件类型
+                            if (windTowerInfo.getPassword().equals("")) {
                                 log.error("该测风塔没有配置密码");
+                                return;
                             } else {
-                                String password = w.getPassword();
+                                String password = windTowerInfo.getPassword();
                                 String cmd = "\"D:\\NRG\\SymDR\\SDR.exe\"" + " /z " + password + " " + f.getPath();
                                 Process ipconfig = runtime.exec(cmd);
                                 ipconfig.waitFor();
@@ -500,67 +513,46 @@ public class EmailImpl extends ServiceImpl<EmailMapper, Email> implements EmailS
                                 byte[] bytes = new byte[1024];
                                 int len = 0;
                                 while ((len = inputStream.read(bytes)) != -1) {
-                                    log.info(new String(bytes, 0, len, "GBK"));
+                                    log.info("解析RWD文件完成:{}", new String(bytes, 0, len, "GBK"));
+                                }
+
+                                //转换成txt的文件在D:\NRG\ScaledData\目录下 移动到 D:\out\下   转换文件后会有两个文件一个txt  一个log  删除log 移动txt
+                                File file1 = new File("D:\\NRG\\ScaledData\\");
+                                File[] files1 = file1.listFiles();
+                                for (File e : files1) {
+                                    String[] name = e.getName().split("\\.");
+                                    if (name[1].equals("txt")) {
+                                        FileUtil.move(e.getPath(), outPutDir);
+                                    } else {
+                                        e.delete();
+                                    }
                                 }
+                                //转成txt后把文件移动到系统文件备份目录下
+                                File file2 = new File("D:\\in\\");
+                                File[] files2 = file2.listFiles();
+                                //xls移动系统文件目录下
+                                for (File e : files2) {
+                                    String[] str = e.getName().split("\\.");
+                                    if (str[1].equals("RWD")) {
+                                        FileUtil.move(e.getPath(), FileUtil.getSystemFilePath() + File.separator + str[0].substring(0, 4));
+                                    } else {
+                                        String[] strs = str[0].split("_");
+                                        FileUtil.move(e.getPath(), FileUtil.getSystemFilePath() + File.separator + strs[0]);
+                                    }
+                                }
+                                //把txt文件转成excel文件并解析
+                                fileTypeStr = "RWD";
                             }
-                        }
-                    }
-                    //转换成txt的文件在D:\NRG\ScaledData\目录下 移动到 D:\out\下   转换文件后会有两个文件一个txt  一个log  删除log 移动txt
-                    File file1 = new File("D:\\NRG\\ScaledData\\");
-                    File[] files1 = file1.listFiles();
-                    for (File e : files1) {
-                        String[] name = e.getName().split("\\.");
-                        if (name[1].equals("txt")) {
-                            FileUtil.move(e.getPath(), "D:\\out\\new\\");
                         } else {
-                            e.delete();
-                        }
-                    }
-                    //转成txt后把文件移动到系统文件备份目录下
-                    File file2 = new File("D:\\in\\");
-                    File[] files2 = file2.listFiles();
-                    //xls移动系统文件目录下
-                    for (File e : files2) {
-                        String[] str = e.getName().split("\\.");
-                        if (str[1].equals("RWD")) {
-                            FileUtil.move(e.getPath(), FileUtil.getSystemFilePath() + File.separator + str[0].substring(0, 4));
-                        } else {
-                            String[] strs = str[0].split("_");
-                            FileUtil.move(e.getPath(), FileUtil.getSystemFilePath() + File.separator + strs[0]);
-                        }
-                    }
-                    //把txt文件转成excel文件并解析
-                    String type = "RWD";
-                    analysisDataService.analysisData(type);
-                } else {
-                    //rld文件类型
-                    String[] id = f.getName().split("_");
-                    //根据编号过滤
-                    List<WindTowerInfo> windTowerInfoList = windTowerInfoService.list().stream().filter(wind -> wind.getEquipmentNo().equals(id[0])).collect(Collectors.toList());
-                    //没有这个编号的塔
-                    if (windTowerInfoList.size() == 0) {
-                        List<EmailWindTowerInfo> emailWindTowerInfos = emailWindTowerInfoService.list().stream().filter(wind -> wind.getEquipmentNo().equals(id[0])).collect(Collectors.toList());
-                        if (emailWindTowerInfos.size() == 0) {
-                            //如果测风塔里面没有这个塔并且邮件测风塔里也没有这个塔 则添加到邮箱读取的测风塔表中
-                            EmailWindTowerInfo emailWindTowerInfo = new EmailWindTowerInfo();
-                            emailWindTowerInfo.setEquipmentNo(id[0]);
-                            emailWindTowerInfoService.save(emailWindTowerInfo);
-                            log.info(id[0] + " 测风塔信息里没有这个的塔 并且邮件测风塔里也没有这个塔");
-                        } else {
-                            log.info(id[0] + " 测风塔信息里没有这个的塔 邮件测风塔里已存在这个塔");
-                        }
-                    }
-                    //如果有   有可能会有编号相同 但是记录仪编号不同的情况 不解析看不到记录仪编号 所以只能用相同编号的测风塔密码解析
-                    //如果是从邮件里读到的塔新增的话是没有数据密码的 所以需要人为的手动配置密码
-                    for (WindTowerInfo w : windTowerInfoList) {
-                        if (id[0].equals(w.getEquipmentNo())) {
-                            if ("".equals(w.getPassword())) {
-                                log.error(w.getEquipmentNo() + "测风塔没有配置数据密码");
+                            //rld文件类型
+                            if ("".equals(windTowerInfo.getPassword())) {
+                                log.error(windTowerInfo.getEquipmentNo() + "测风塔没有配置数据密码");
+                                return;
                             } else {
                                 String[] s = new String[]{
-                                        "\"D:\\Program Files (x86)\\Renewable NRG Systems\\SymPRO Desktop\\SymPRODesktop.exe\"",
+                                        "\"D:\\soft\\SymphoniePRO\\SymPRODesktop.exe\"",
                                         "/cmd", "convert", "/file", f.getPath(),
-                                        "/pass", w.getPassword(), "/type", "\"meas\"", "/outputdir", "\"D:\\out\\new\""
+                                        "/pass", windTowerInfo.getPassword(), "/type", "\"meas\"", "/outputdir", "\"D:\\out\\new\""
                                 };
                                 Process ipconfig = runtime.exec(s);
                                 ipconfig.waitFor();
@@ -568,34 +560,37 @@ public class EmailImpl extends ServiceImpl<EmailMapper, Email> implements EmailS
                                 byte[] bytes = new byte[1024];
                                 int len = 0;
                                 while ((len = inputStream.read(bytes)) != -1) {
-                                    log.info(new String(bytes, 0, len, "GBK"));
+                                    log.info("解析RLD文件完成:{}", new String(bytes, 0, len, "GBK"));
+                                }
+                            }
+                            //转成txt后把文件移动到系统文件备份目录下
+                            File file1 = new File("D:\\in\\");
+                            File[] files1 = file1.listFiles();
+                            //xls移动系统文件目录下
+                            for (File e : files1) {
+                                String[] str = e.getName().split("\\.");
+                                if (str[1].equals("RWD")) {
+                                    FileUtil.move(e.getPath(), FileUtil.getSystemFilePath() + File.separator + str[0].substring(0, 4));
+                                } else {
+                                    String[] strs = str[0].split("_");
+                                    FileUtil.move(e.getPath(), FileUtil.getSystemFilePath() + File.separator + strs[0]);
                                 }
                             }
+                            //把txt文件转成excel文件并解析
+                            fileTypeStr = "rld";
                         }
-                    }
 
-                }
-                //转成txt后把文件移动到系统文件备份目录下
-                File file1 = new File("D:\\in\\");
-                File[] files1 = file1.listFiles();
-                //xls移动系统文件目录下
-                for (File e : files1) {
-                    String[] str = e.getName().split("\\.");
-                    if (str[1].equals("RWD")) {
-                        FileUtil.move(e.getPath(), FileUtil.getSystemFilePath() + File.separator + str[0].substring(0, 4));
-                    } else {
-                        String[] strs = str[0].split("_");
-                        FileUtil.move(e.getPath(), FileUtil.getSystemFilePath() + File.separator + strs[0]);
                     }
+                    analysisDataService.analysisData(fileTypeStr);
+                } catch (Exception e) {
+                    log.error("处理文件:{} 异常:{}", file.getAbsolutePath(), e);
                 }
-                //把txt文件转成excel文件并解析
-                String type = "rld";
-                analysisDataService.analysisData(type);
             }
 
 
-        } catch (Exception e) {
-            log.error("执行系统命令失败:" + e);
+        } catch (
+                Exception e) {
+            log.error("执行系统命令失败:{}", e);
         }
     }
 }

+ 1 - 17
neim-biz/src/main/java/com/jiayue/biz/util/FileUtil.java

@@ -45,7 +45,7 @@ public class FileUtil {
                     throw new RuntimeException(destDir + " 目录创建失败");
             }
             File file = new File(remoteAbsoluteFile + File.separator + srcFile.getName());
-            if(file.exists()){
+            if (file.exists()) {
                 file.delete();
             }
             FileUtils.moveFile(srcFile, new File(remoteAbsoluteFile + File.separator + srcFile.getName()));
@@ -273,22 +273,6 @@ public class FileUtil {
 
     private static String createUploadAllDir(String dir) {
         String path = "";
-        /*if (System.getProperties().getProperty("file.separator").equals("\\")) {
-            path = new File(getResourceBasePath()).getParentFile().getParentFile().getParentFile().getAbsolutePath() + File.separator + dir;
-            try {
-                path = URLDecoder.decode(path, "UTF-8");
-            } catch (UnsupportedEncodingException e) {
-                e.printStackTrace();
-            }
-            File file = new File(path);
-            if (!file.exists()) {
-                boolean b = file.mkdirs();
-                if (!b)
-                    log.error("目录创建失败" + path);
-            }
-        } else {
-            path = "D:\\program\\" + dir;
-        }*/
         path = "D:\\program\\" + dir;
         return path;
     }

+ 7 - 28
neim-ui/src/views/dataQuery/windTowerStatusData/index.vue

@@ -15,14 +15,6 @@
       </div>
       <div class="conOne">
         <span>测风塔:</span>
-        <!--        <el-select v-model="eqId" placeholder="请选择" @change="changeEquipment">
-                  <el-option
-                    v-for="item in equipmentAllInfo"
-                    :key="item.equipmentNo"
-                    :label="item.name"
-                    :value="item.equipmentNo">
-                  </el-option>
-                </el-select>-->
         <el-select v-model="eqId" filterable placeholder="请选择" @change="changeEquipment">
           <el-option
             v-for="item in startDateAndEndDate"
@@ -104,24 +96,17 @@
 
 <script>
 import {
-  listWindTowerStatusData,
-  getWindTowerStatusData,
-  delWindTowerStatusData,
   addWindTowerStatusData,
-  updateWindTowerStatusData,
+  delWindTowerStatusData,
+  getWindTowerStatusData,
+  listWindTowerStatusData,
   timeWindTowerStatusData,
-  exportData,
-  exportAllData
+  updateWindTowerStatusData
 } from "@/api/biz/dataQuery/RealTimeDisplay";
 import {listAllInfo, listEquipmentIdAndDataTime} from "@/api/biz/dataQuery/windTowerStatusInfo";
 import defaultOption from "@/api/biz/dataQuery/defaultOption";
 import download from '@/plugins/download'
-import {
-  shuttleWindTowerStatusData,
-  showWindTowerStatusData,
-  updateDisplay,
-  findByDisplaySign,
-} from "@/api/biz/dataQuery/config";
+import {findByDisplaySign, shuttleWindTowerStatusData, updateDisplay,} from "@/api/biz/dataQuery/config";
 
 export default {
   name: "WindTowerStatusData",
@@ -658,7 +643,7 @@ export default {
       download.windTowerStatus("/dataQuery/RealTimeDisplay/export", new Date(this.dataTime[0]).getTime(), new Date(this.dataTime[1]).getTime(), this.eqId);
       // this.downPdfTimer = setInterval(() => {
       //   if (Cookies.get('exportDataLoading')) {
-          this.exportDataLoading = false
+      this.exportDataLoading = false
       //     clearInterval(this.downPdfTimer)
       //     Cookies.remove("exportDataLoading");
       //   }
@@ -666,14 +651,8 @@ export default {
     },
     handleAllExport() {
       this.exportLoading = true
-      download.exportAllData("/dataQuery/RealTimeDisplay/exportAll",this.eqId+"&startTime="+new Date(this.dataTime[0]).getTime()+"&endTime="+new Date(this.dataTime[1]).getTime());
-      // this.downPdfTimer = setInterval(() => {
-      //   if (Cookies.get('exportLoading')) {
+      download.exportAllData("/dataQuery/RealTimeDisplay/exportAll", this.eqId + "&startTime=" + new Date(this.dataTime[0]).getTime() + "&endTime=" + new Date(this.dataTime[1]).getTime());
       this.exportLoading = false
-      //     clearInterval(this.downPdfTimer)
-      //     Cookies.remove("exportLoading");
-      //   }
-      // }, 500)
     },
     formatEquimentId(row) {
       let filter = this.equipmentAllInfo.find(w => w.equipmentNo == row.equipmentId);

+ 584 - 0
neim-ui/src/views/windResources/comprehensiveQuery/index.vue

@@ -0,0 +1,584 @@
+<template>
+  <div>
+    <el-card class="box-card">
+      <div class="seachBox">
+        <div class="conditionOne">
+          <span>测风塔:</span>
+          <el-select v-model="cftId" filterable placeholder="请选择" @change="changeCft">
+            <el-option
+              v-for="item in startDateAndEndDate"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value">
+              <span style="float: left;">{{ item.label }}</span>
+              <span style="float: right; color: #8492a6; font-size: 13px">{{ item.date }}</span>
+            </el-option>
+          </el-select>
+          <!--            :picker-options="pickerOptions"-->
+        </div>
+        <div class="conditionTwo">
+          <span>时间:</span>
+          <el-date-picker
+            v-model="dataTime"
+            type="daterange"
+            range-separator="至"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+          >
+          </el-date-picker>
+        </div>
+        <div class="conditionTwo">
+          <span>层高:</span>
+          <el-select v-model="height" placeholder="请选择" clearable multiple>
+            <el-option
+              v-for="item in options"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value">
+            </el-option>
+          </el-select>
+        </div>
+        <el-button class="seachBtu" type="primary" plain icon="el-icon-search" size="small" :loading="btuLoading"
+                   @click="getCharts">搜索
+        </el-button>
+      </div>
+      <div>
+        <div id="wsChart"/>
+      </div>
+      <div>
+        <div id="wdChart"/>
+      </div>
+      <div>
+        <div id="TPChart"/>
+      </div>
+    </el-card>
+  </div>
+</template>
+
+<script>
+import {listEquipmentIdAndDataTime} from "@/api/biz/dataQuery/windTowerStatusInfo";
+import {listAllWs, listTPAndAirDensity, startTimeAndEndTime} from "@/api/biz/dataQuery/RealTimeDisplay";
+import defaultOption from "@/api/biz/dataQuery/defaultOption";
+
+export default {
+  name: "index",
+  data() {
+    return {
+      btuLoading: true,
+      dataTime: [new Date(new Date().toLocaleDateString()).getTime() - 2 * 24 * 60 * 60 * 60 * 1000, new Date(new Date().toLocaleDateString()).getTime()],
+      height: null,
+      options: [],
+      allOptions: [],
+      cftId: '',
+      startDateAndEndDate: [],
+      defaultTimeData: [],//默认时间范围集合
+      timeData: [], //时间集合
+      wsData: [],//风速集合
+      wdData: [],//风向集合
+      avgWsText: '',//风速平均值
+      avgWdText: '',//风向平均值
+      wsChart: null,
+      wdChart: null,
+      TPChart: null,
+      activeName: 'first',
+      page: {
+        total: 0, // 总页数
+        currentPage: 1, // 当前页数
+        pageSize: 10 // 每页显示多少条
+      },
+      pickerMinDate: '', //获取开始选择时间
+      pickerMaxDate: '', //获取结束选择时间
+      pickerOptions: {
+        //时间范围选择控制
+        onPick: ({maxDate, minDate}) => {
+          if (minDate) {
+            this.pickerMinDate = minDate.getTime()
+          }
+          if (maxDate) {
+            this.pickerMinDate = ''
+            this.pickerMaxDate = maxDate.getTime()
+          }
+        },
+        disabledDate: time => {
+          const day30 = 30 * 24 * 3600 * 1000
+          if (this.pickerMinDate !== '') {
+            let maxTime = this.pickerMinDate + day30
+            if (maxTime >= new Date()) {
+              maxTime = new Date()
+            }
+            return time.getTime() > maxTime
+          }
+          if (this.pickerMaxDate !== '' && !this.pickerMinDate) {
+            let minTime = this.pickerMaxDate - day30
+            return time.getTime() < minTime
+          }
+          return time.getTime() > Date.now()
+        },
+      }
+    }
+  },
+  mounted() {
+    this.allOptions = defaultOption.allHeightOptions
+    this.getTimeFrame()
+  },
+  destroyed() {
+    if (!this.wsChart) {
+      return
+    }
+    if (!this.wdChart) {
+      return
+    }
+    if (!this.TPChart) {
+      return
+    }
+    this.wsChart.dispose()
+    this.wsChart = null
+    this.wdChart.dispose()
+    this.wdChart = null
+    this.TPChart.dispose()
+    this.TPChart = null
+  },
+  methods: {
+    /*获取所有的测风塔*/
+    getlistEquipmentIdAndDataTime() {
+      listEquipmentIdAndDataTime().then(res => {
+        this.startDateAndEndDate = res.data
+        this.cftId = res.data[0].value
+
+        this.changeHeight(res.data[0])
+        this.getCharts()
+      })
+    },
+    /*搜索,默认搜索风速的曲线图*/
+    async getCharts() {
+      this.btuLoading = true
+      const param =
+        {
+          startTime: new Date(this.dataTime[0]).getTime(),
+          endTime: new Date(this.dataTime[1]).getTime() - 1,
+          equipmentId: this.cftId,
+          height: this.height == null ? this.height : this.height.toString()
+        }
+      if (!this.wsChart) {
+        this.wsChart = this.$echarts.init(document.getElementById('wsChart'))
+      }
+      // 调用showLoading方法
+      this.wsChart.showLoading({
+        text: 'loading',
+        color: '#c23531',
+        textColor: '#000',
+        maskColor: 'rgba(255, 255, 255, 0.2)',
+        zlevel: 0,
+      });
+      if (!this.wdChart) {
+        this.wdChart = this.$echarts.init(document.getElementById('wdChart'))
+      }
+      // 调用showLoading方法
+      this.wdChart.showLoading({
+        text: 'loading',
+        color: '#c23531',
+        textColor: '#000',
+        maskColor: 'rgba(255, 255, 255, 0.2)',
+        zlevel: 0,
+      });
+      if (!this.TPChart) {
+        this.TPChart = this.$echarts.init(document.getElementById('TPChart'))
+      }
+      // 调用showLoading方法
+      this.TPChart.showLoading({
+        text: 'loading',
+        color: '#c23531',
+        textColor: '#000',
+        maskColor: 'rgba(255, 255, 255, 0.2)',
+        zlevel: 0,
+      });
+      await listAllWs(param).then(async res => {
+        // 时间
+        this.timeData = res.data.time
+        //曲线图
+        this.wsData = res.data.ws[0]
+        this.drawWsChart(this.wsData, this.timeData)
+
+        //曲线图
+        this.wdData = res.data.wd[0]
+        this.drawWdChart(this.wdData, this.timeData)
+        this.btuLoading = false
+      }).catch(err => {
+        this.btuLoading = false
+        this.wsChart.hideLoading();
+        this.wdChart.hideLoading();
+        this.$message.error('获取风速数据异常')
+        console.log('获取风速数据异常:' + err)
+      })
+
+      listTPAndAirDensity(param).then(res => {
+        if (Object.keys(res.data).length > 0) {
+          this.tableData = res.data.data
+          this.avgAirDensity = res.data.avgAirDensity
+          this.avgPa = res.data.avgPa
+          this.avgT = res.data.avgT
+          this.page.total = this.tableData.length
+          this.page.currentPage = 1
+          this.page.pageSize = 10
+          this.timeArr = []
+          this.paArr = []
+          this.tArr = []
+          this.timeArr = res.data.time
+          let paArr = res.data.pa
+          let tArr = res.data.t
+          for (let j = 0; j < paArr.length; j++) {
+            this.paArr.push([paArr[j].time, paArr[j].pa])
+          }
+          for (let j = 0; j < tArr.length; j++) {
+            this.tArr.push([tArr[j].time, tArr[j].t])
+          }
+          this.$nextTick(function () {
+            this.drawTPCharts(this.timeArr, this.paArr, this.tArr)
+          })
+          this.tableLoading = false
+        } else {
+          this.$message.warning('此时间段测风塔没有数据')
+          this.TPChart.hideLoading();
+          this.tableLoading = false
+        }
+        this.btuLoading = false
+      }).catch(err => {
+        this.btuLoading = false
+        this.TPChart.hideLoading();
+        this.$message.error('查询失败')
+        console.log('获取风况数据异常:' + err)
+      })
+    },
+    /*获取默认的时间段*/
+    getTimeFrame() {
+      startTimeAndEndTime().then(res => {
+        this.defaultTimeData = res.data
+        this.getlistEquipmentIdAndDataTime()
+      }).catch(err => {
+        this.getlistEquipmentIdAndDataTime()
+        this.$message.error('获取时间范围异常')
+        console.log('获取时间范围异常:' + err)
+      })
+    },
+    /*切换测风塔找到它对应的层高*/
+    changeCft() {
+      let data = this.startDateAndEndDate.find(w => w.value == this.cftId)
+      this.changeHeight(data)
+    },
+    /*切换测风塔时改变层高option*/
+    changeHeight(data) {
+      if (data.heights != null) {
+        var option = []
+        let str = data.heights.split(',')
+        this.height = null
+        for (let i = 0; i < str.length; i++) {
+          let filter = this.allOptions.find(w => w.value == str[i])
+          option.push(filter)
+        }
+        this.options = option
+      } else {
+        this.height = null
+        this.options = this.allOptions
+      }
+    },
+    /*风速曲线图*/
+    drawWsChart(data, time) {
+      this.wsChart = this.$echarts.init(document.getElementById('wsChart'))
+      /*拼接曲线图的serise*/
+      let serise = []
+      let legend = []
+      for (let i = 0; i < data.length; i++) {
+        let seriseData = []
+        legend.push(data[i].height + 'm')
+        /*拼接serise Data*/
+        for (let j = 0; j < data[i].arr.length; j++) {
+          seriseData.push([data[i].arr[j].time, data[i].arr[j].ws])
+        }
+
+        serise.push({
+          name: data[i].height + 'm',
+          type: 'line',
+          smooth: false,
+          symbol: 'none', // 这句就是去掉点的
+          data: seriseData
+        })
+      }
+      var option = {
+        title: {
+          text: '风速曲线图',
+        },
+        legend: {
+          data: legend
+        },
+        grid: {
+          left: '2%',
+          right: '3%',
+          containLabel: true
+        },
+        tooltip: {
+          trigger: 'axis',
+        },
+        // color: ['#1a9f00', '#2f4554', '#61a0a8','#d48265'],
+        xAxis: {
+          name: '时间',
+          type: 'category',
+          axisLine: {
+            lineStyle: {
+              color: '#666b8f',
+              width: 4// 这里是为了突出显示加上的
+            }
+          },
+          data: time
+        },
+        yAxis: {
+          type: 'value',
+          name: '风速(m/s)',
+          min: 0,
+          // interval: 5,
+          axisLabel: {
+            formatter: '{value}'
+          },
+          axisLine: {
+            show: true,
+            lineStyle: {
+              color: '#666b8f',
+              width: 4// 这里是为了突出显示加上的
+            }
+          },
+          splitLine: {
+            show: true,
+            lineStyle: {
+              color: ['#315070'],
+              width: 2,
+              type: 'dotted'
+            }
+          }
+        },
+        series: serise
+      }
+      this.wsChart.setOption(option, true)
+      this.wsChart.hideLoading();
+      window.addEventListener('resize', () => {
+        if (this.wsChart) {
+          this.wsChart.resize()
+        }
+      })
+    },
+    /*风向曲线图*/
+    drawWdChart(data, time) {
+      this.wdChart = this.$echarts.init(document.getElementById('wdChart'))
+      /*拼接曲线图的serise*/
+      let serise = []
+      let legend = []
+      for (let i = 0; i < data.length; i++) {
+        var seriseData = []
+        legend.push(data[i].height + 'm')
+        /*拼接serise Data*/
+        for (let j = 0; j < data[i].arr.length; j++) {
+          var arr = data[i].arr
+          seriseData.push([arr[j].time, arr[j].wd])
+        }
+        serise.push({
+          name: data[i].height + 'm',
+          type: 'line',
+          smooth: false,
+          symbol: 'none', // 这句就是去掉点的
+          data: seriseData
+        })
+      }
+      var option = {
+        title: {
+          text: '风向曲线图',
+        },
+        legend: {
+          // data: ['风向']
+          data: legend
+        },
+        grid: {
+          // top: '17%',
+          left: '2%',
+          right: '3%',
+          // bottom: '8%',
+          containLabel: true
+        },
+        tooltip: {
+          trigger: 'axis',
+        },
+        xAxis: {
+          name: '时间',
+          type: 'category',
+          nameGap: 25,
+          axisLine: {
+            lineStyle: {
+              color: '#666b8f',
+              width: 4// 这里是为了突出显示加上的
+            }
+          },
+          data: time
+        },
+        yAxis: {
+          type: 'value',
+          name: '风向(°)',
+          min: 0,
+          axisLabel: {
+            formatter: '{value}'
+          },
+          axisLine: {
+            show: true,
+            lineStyle: {
+              color: '#666b8f',
+              width: 4// 这里是为了突出显示加上的
+            }
+          },
+          splitLine: {
+            show: true,
+            lineStyle: {
+              color: ['#315070'],
+              width: 2,
+              type: 'dotted'
+            }
+          }
+        },
+        series: serise
+      }
+      this.wdChart.setOption(option, true)
+      this.wdChart.hideLoading();
+      window.addEventListener('resize', () => {
+        if (this.wdChart) {
+          this.wdChart.resize()
+        }
+      })
+    },
+    /*风向曲线图*/
+    drawTPCharts(time, pa, t) {
+      if (!this.TPChart) {
+        this.TPChart = this.$echarts.init(document.getElementById('TPChart'))
+      }
+      var option = {
+        title: {
+          text: '温度和气压时间折线图',
+        },
+        legend: [{
+          top: "0%",
+          left: "45%",
+          data: [{name: "温度"}]
+        }, {
+          top: "0%",
+          left: "50%",
+          data: [{name: "压强"}]
+        }],
+        grid: {
+          // top: '17%',
+          left: '3%',
+          right: '2%',
+          // bottom: '8%',
+          containLabel: true
+        },
+        tooltip: {
+          trigger: 'axis'
+        },
+        xAxis: {
+          name: '时间',
+          type: 'category',
+          axisTick: {alignWithLabel: true},
+          nameLocation: 'center',
+          nameGap: 25,
+          data: time
+        },
+        yAxis: [{
+          type: 'value',
+          name: '温度(°C)',
+          alignTicks: true,
+          axisLine: {
+            show: true
+          }
+        }, {
+          type: 'value',
+          alignTicks: true,
+          name: '压强(hpa)',
+          axisLine: {
+            show: true
+          },
+
+          axisLine: {
+            show: true,
+            lineStyle: {
+              color: '#666b8f',
+              width: 4// 这里是为了突出显示加上的
+            }
+          },
+          splitLine: {
+            show: true,
+            lineStyle: {
+              type: 'dotted'
+            }
+          },
+          // max: value => (value.max * 1.001).toFixed(0),
+          // min: value => (value.min * 0.998).toFixed(0),
+        }],
+        series: [{
+          name: "温度",
+          type: "line",
+          color: ["#eb9f0d"],
+          symbol: "none",
+          smooth: true,
+          data: t
+        },
+          {
+            name: "压强",
+            type: "line",
+            color: ["#969ac7"],
+            symbol: "none",
+            smooth: true,
+            yAxisIndex: 1, //在单个图表实例中存在多个y轴的时候有用
+            data: pa
+          }
+        ]
+      }
+      this.TPChart.setOption(option, true)
+      this.TPChart.hideLoading();
+      window.addEventListener('resize', () => {
+        if (this.TPChart) {
+          this.TPChart.resize()
+        }
+      })
+    },
+    handleClick() {
+      if (this.activeName == 'first') {
+        this.wsChart = null
+        this.$nextTick(() => {
+          this.drawWsChart(this.wsData, this.timeData)
+          this.wsChart.resize()
+        })
+      } else {
+        this.wdChart = null
+        this.$nextTick(() => {
+          this.drawWdChart(this.wdData, this.timeData)
+          this.wdChart.resize()
+        })
+      }
+    },
+  }
+}
+</script>
+
+<style scoped>
+.seachBox {
+  display: flex;
+  margin: .5%;
+}
+
+.conditionOne, .conditionTwo, .seachBtu {
+  display: inline-block;
+}
+
+.conditionTwo, .seachBtu {
+  margin-left: .5%;
+}
+
+#wsChart, #wdChart, #TPChart {
+  width: 100%;
+  height: calc(25vh - 5px);
+}
+
+</style>

+ 7 - 6
neim-ui/src/views/windResources/windSpeedCurve/index.vue

@@ -38,7 +38,8 @@
             </el-option>
           </el-select>
         </div>
-        <el-button class="seachBtu" type="primary" plain icon="el-icon-search" size="small" :loading="btuLoading" @click="getCharts">搜索
+        <el-button class="seachBtu" type="primary" plain icon="el-icon-search" size="small" :loading="btuLoading"
+                   @click="getCharts">搜索
         </el-button>
       </div>
       <div class="mainBox">
@@ -62,9 +63,8 @@
 </template>
 
 <script>
-import {listAllInfo, listEquipmentIdAndDataTime} from "@/api/biz/dataQuery/windTowerStatusInfo";
-import {listAllWs} from "@/api/biz/dataQuery/RealTimeDisplay";
-import {startTimeAndEndTime} from "@/api/biz/dataQuery/RealTimeDisplay";
+import {listEquipmentIdAndDataTime} from "@/api/biz/dataQuery/windTowerStatusInfo";
+import {listAllWs, startTimeAndEndTime} from "@/api/biz/dataQuery/RealTimeDisplay";
 import defaultOption from "@/api/biz/dataQuery/defaultOption";
 
 export default {
@@ -336,7 +336,7 @@ export default {
             formatter: '{value}'
           },
           axisLine: {
-            show:true,
+            show: true,
             lineStyle: {
               color: '#666b8f',
               width: 4// 这里是为了突出显示加上的
@@ -429,7 +429,7 @@ export default {
             formatter: '{value}'
           },
           axisLine: {
-            show:true,
+            show: true,
             lineStyle: {
               color: '#666b8f',
               width: 4// 这里是为了突出显示加上的
@@ -497,6 +497,7 @@ export default {
   height: calc(75vh - 5px);
 }
 
+
 .block {
   float: right;
 }