Bladeren bron

增加redis存储格式说明

xusl 3 jaren geleden
bovenliggende
commit
690b0dacf5

+ 101 - 90
ipfcst-console/README.md

@@ -1,91 +1,102 @@
-# vue-admin-template
+Redis存储说明:
+============================================
+**实际功率**
+
+存储格式->【power-场站编号-设备编号,属性map】
+属性map:
+stationCode 场站编号
+time 时间
+realValue 实际功率
+ableValue 可用功率
+theoryValue 理论功率
+referencePowerBySample 样板机参照功率
+referencePowerByMeasuring 测风/光法参照功率
+ablePowerBySample 样板机法可用功率
+ablePowerByMeasuring 测风/光法可用功率
+openCapacity 开机容量
+abnormalOfSample 样板机法的异常值
+abnormalOfMeasuring 测风光法的异常值
+
+----------------------------------------------------------------------------
+
+**气象站**
+
+存储格式->【qxz-场站编号-设备编号,属性map】
+属性map:
+stationCode 场站编号
+equipmentNo 设备编号
+time 时间
+globalR 总辐射
+directR 直接辐射
+diffuseR 散射辐射
+airT 环境温度
+p 气压
+rh 湿度
+cellT 电池板温度
+ws 风速
+wd 风向
+
+----------------------------------------------------------------------------
+
+**测风塔**
+
+存储格式->【cft-场站编号-设备编号,属性map】
+属性map:
+stationCode 场站编号
+equipmentNo 设备编号
+time 时间
+tInst 温度瞬时值
+rhInst 湿度瞬时值
+paInst 气压瞬时值
+wsInst10 10米风速瞬时值
+wdInst10 10米风向瞬时值
+wsInst30 30米风速瞬时值
+wdInst30 30米风向瞬时值
+wsInst50 50米风速瞬时值
+wdInst50 50米风向瞬时值
+wsInst70 70米风速瞬时值
+wdInst70 70米风向瞬时值
+wsInstHubHeight 轮毂高度风速瞬时值
+wdInstHubHeight 轮毂高度风向瞬时值
+
+----------------------------------------------------------------------------
+
+**风机**
+
+存储格式->【fj-场站编号-设备编号,属性map】
+属性map:
+stationCode 场站编号
+equipmentNo 设备编号
+time 时间
+status 状态
+activePower 有功
+reactivePower 无功
+powerFactor 功率因数
+voltage 电压
+electricalCurrent 电流
+dayElectricQuantity 当日发电量
+windWheelRatedSpeed 转速
+ws 风速
+wd 风向
+t 温度
+pitchAngle 桨距角
+cumulativeGeneratedEnergy 累积发电量
+
+----------------------------------------------------------------------------
+
+**逆变器**
+
+存储格式->【nbq-场站编号-设备编号,属性map】
+属性map:
+stationCode 场站编号
+equipmentNo 设备编号
+time 时间
+status 状态
+activePower 有功
+reactivePower 无功
+powerFactor 功率因数
+voltage 电压
+electricalCurrent 电流
+dayElectricQuantity 当日发电量
+cumulativeGeneratedEnergy 累积发电量
 
-English | [简体中文](./README-zh.md)
-
-> A minimal vue admin template with Element UI & axios & iconfont & permission control & lint
-
-**Live demo:** http://panjiachen.github.io/vue-admin-template
-
-
-**The current version is `v4.0+` build on `vue-cli`. If you want to use the old version , you can switch branch to [tag/3.11.0](https://github.com/PanJiaChen/vue-admin-template/tree/tag/3.11.0), it does not rely on `vue-cli`**
-
-## Build Setup
-
-
-```bash
-# clone the project
-git clone https://github.com/PanJiaChen/vue-admin-template.git
-
-# enter the project directory
-cd vue-admin-template
-
-# install dependency
-npm install
-
-# develop
-npm run dev
-```
-
-This will automatically open http://localhost:9528
-
-## Build
-
-```bash
-# build for test environment
-npm run build:stage
-
-# build for production environment
-npm run build:prod
-```
-
-## Advanced
-
-```bash
-# preview the release environment effect
-npm run preview
-
-# preview the release environment effect + static resource analysis
-npm run preview -- --report
-
-# code format check
-npm run lint
-
-# code format check and auto fix
-npm run lint -- --fix
-```
-
-Refer to [Documentation](https://panjiachen.github.io/vue-element-admin-site/guide/essentials/deploy.html) for more information
-
-## Demo
-
-![demo](https://github.com/PanJiaChen/PanJiaChen.github.io/blob/master/images/demo.gif)
-
-## Extra
-
-If you want router permission && generate menu by user roles , you can use this branch [permission-control](https://github.com/PanJiaChen/vue-admin-template/tree/permission-control)
-
-For `typescript` version, you can use [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) (Credits: [@Armour](https://github.com/Armour))
-
-## Related Project
-
-- [vue-element-admin](https://github.com/PanJiaChen/vue-element-admin)
-
-- [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin)
-
-- [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template)
-
-- [awesome-project](https://github.com/PanJiaChen/vue-element-admin/issues/2312)
-
-## Browsers support
-
-Modern browsers and Internet Explorer 10+.
-
-| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari |
-| --------- | --------- | --------- | --------- |
-| IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions
-
-## License
-
-[MIT](https://github.com/PanJiaChen/vue-admin-template/blob/master/LICENSE) license.
-
-Copyright (c) 2017-present PanJiaChen

+ 24 - 0
ipfcst-console/src/test/java/com/jiayue/ipfcst/fileupload/service/E63UploadFileServiceTest.java

@@ -1,9 +1,12 @@
 package com.jiayue.ipfcst.fileupload.service;
 
+import com.alibaba.fastjson.JSON;
 import com.jiayue.ipfcst.BaseTest;
 import com.jiayue.ipfcst.common.core.exception.BusinessException;
 import com.jiayue.ipfcst.common.data.entity.ElectricField;
+import com.jiayue.ipfcst.common.data.entity.WeatherStationStatusData;
 import com.jiayue.ipfcst.console.service.ElectricFieldService;
+import com.jiayue.ipfcst.console.util.RedisUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -11,7 +14,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import javax.xml.ws.Action;
 
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import static org.junit.jupiter.api.Assertions.*;
 
@@ -27,9 +32,28 @@ public class E63UploadFileServiceTest extends BaseTest {
   E63UploadFileService e63UploadFileService;
   @Autowired
   ElectricFieldService electricFieldService;
+  @Autowired
+  private RedisUtils redisUtils;
 
   @Test
   public void testCreateFile() throws Exception{
       e63UploadFileService.generateQxzOrCftFile(new Date());
   }
+
+  @Test
+  public void testRedis() throws Exception{
+    Map<String,String> map = new HashMap<>();
+    map.put("globalR","534.89");
+    map.put("DirectR","472.52");
+    map.put("DiffuseR","62.37");
+
+    redisUtils.hmset("qxz-J00026-qazwsxedc",map);
+    System.out.println("===========================================================");
+    Map<String,String> getMap = redisUtils.hgetall("qxz-J00026-qazwsxedc");
+    getMap.keySet().forEach(key -> System.out.println("map.get(" + key + ") = " + map.get(key)));
+
+    WeatherStationStatusData weatherStationStatusData = JSON.parseObject(JSON.toJSONString(getMap), WeatherStationStatusData.class);
+    System.out.println(weatherStationStatusData);
+    Thread.sleep(5000000L);
+  }
 }

+ 83 - 0
ipfcst-console/src/test/java/com/jiayue/ipfcst/fileupload/service/TestFtpClient.java

@@ -0,0 +1,83 @@
+package com.jiayue.ipfcst.fileupload.service;
+
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.io.IoUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.ftp.Ftp;
+import cn.hutool.extra.ftp.FtpConfig;
+import cn.hutool.extra.ftp.FtpMode;
+import com.jiayue.ipfcst.common.data.entity.UploadFileLog;
+import com.jiayue.ipfcst.common.data.entity.UploadURL;
+import com.jiayue.ipfcst.fileupload.util.FileConstant;
+
+import java.io.*;
+import java.nio.charset.Charset;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * TODO
+ *
+ * @author xsl
+ * @version 3.0
+ */
+public class TestFtpClient {
+  public static void main(String[] args) {
+    Ftp ftp = null;
+    InputStreamReader isr = null;
+    InputStream uploadFileIs = null;
+    try {
+      // 主动模式
+//      FtpMode mode = FtpMode.Active;
+      // 被动模式
+      FtpMode mode = FtpMode.Passive;
+      FtpConfig ftpConfig = new FtpConfig();
+      ftpConfig.setHost("192.168.9.103");
+      ftpConfig.setPort(21);
+      ftpConfig.setPassword("qhftp");
+      ftpConfig.setUser("qhftp");
+      ftpConfig.setCharset(Charset.forName("UTF-8"));
+      ftpConfig.setConnectionTimeout(5 * 1000L);
+      ftp = new Ftp(ftpConfig, mode);
+      System.out.println("ftp客户端连接成功");
+      isr = new InputStreamReader(new FileInputStream("d:\\test\\CHQMHG_20210908_1405_QXZ.PVD"), "UTF-8");
+      StringBuffer sb = new StringBuffer("");
+      int len1 = 0;
+      while ((len1 = isr.read()) != -1) {
+        sb.append((char) len1);
+      }
+      isr.close();
+      String str = sb.toString();
+      uploadFileIs = new ByteArrayInputStream(str.getBytes("UTF-8"));
+      String uploadFileName = new String(new File("d:\\test\\CHQMHG_20210908_1405_QXZ.PVD").getName().getBytes("UTF-8"), "UTF-8");
+      boolean isSuccess = ftp.upload("/J00026/QXZ", uploadFileName, uploadFileIs);
+      if (isSuccess) {
+        System.out.println("上传成功");
+      } else {
+        System.out.println("上传失败");
+      }
+    } catch (Exception e) {
+      e.printStackTrace();
+    } finally {
+      if (isr != null) {
+        try {
+          isr.close();
+        } catch (IOException e) {
+          e.printStackTrace();
+        }
+      }
+      if (uploadFileIs != null) {
+        try {
+          uploadFileIs.close();
+        } catch (IOException e) {
+          e.printStackTrace();
+        }
+      }
+      if (ftp != null) {
+        IoUtil.close(ftp);
+      }
+    }
+  }
+}