Compare commits

..

3 Commits

  1. 99
      README.md
  2. 8
      ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
  3. 22
      ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java
  4. 2
      ruoyi-admin/src/main/resources/application-druid.yml
  5. 11
      ruoyi-admin/src/main/resources/application.yml
  6. 43
      ruoyi-api/src/main/java/com/ruoyi/api/app/AlarmDataApiController.java
  7. 41
      ruoyi-api/src/main/java/com/ruoyi/api/app/AlarmJobController.java
  8. 25
      ruoyi-api/src/main/java/com/ruoyi/api/app/DapingController.java
  9. 39
      ruoyi-api/src/main/java/com/ruoyi/api/app/RegularTimeController.java
  10. 2
      ruoyi-api/src/main/java/com/ruoyi/api/app/StationDataApiController.java
  11. 19
      ruoyi-api/src/main/java/com/ruoyi/api/app/TestApiController.java
  12. 2
      ruoyi-api/src/main/java/com/ruoyi/api/app/WaterDataApiController.java
  13. 7
      ruoyi-api/src/main/java/com/ruoyi/api/controller/AbstractApiController.java
  14. 66
      ruoyi-api/src/main/java/com/ruoyi/api/domain/RegularTime.java
  15. 40
      ruoyi-api/src/main/java/com/ruoyi/api/domain/XsAlarmEntity.java
  16. 36
      ruoyi-api/src/main/java/com/ruoyi/api/domain/XsAlarmListEntity.java
  17. 34
      ruoyi-api/src/main/java/com/ruoyi/api/domain/XsAlarmUserEntity.java
  18. 26
      ruoyi-api/src/main/java/com/ruoyi/api/mapper/DapingMapper.java
  19. 17
      ruoyi-api/src/main/java/com/ruoyi/api/mapper/RegularTimeMapper.java
  20. 13
      ruoyi-api/src/main/java/com/ruoyi/api/mapper/XsAlarmListMapper.java
  21. 13
      ruoyi-api/src/main/java/com/ruoyi/api/mapper/XsAlarmMapper.java
  22. 13
      ruoyi-api/src/main/java/com/ruoyi/api/mapper/XsAlarmUserMapper.java
  23. 16
      ruoyi-api/src/main/java/com/ruoyi/api/params/AlarmDataParams.java
  24. 17
      ruoyi-api/src/main/java/com/ruoyi/api/params/AlarmJobDataParams.java
  25. 21
      ruoyi-api/src/main/java/com/ruoyi/api/params/AlarmJobParams.java
  26. 13
      ruoyi-api/src/main/java/com/ruoyi/api/params/AlarmJobSendUserParams.java
  27. 31
      ruoyi-api/src/main/java/com/ruoyi/api/service/AlarmDataApiService.java
  28. 65
      ruoyi-api/src/main/java/com/ruoyi/api/service/AlarmJobService.java
  29. 14
      ruoyi-api/src/main/java/com/ruoyi/api/service/DapingService.java
  30. 22
      ruoyi-api/src/main/java/com/ruoyi/api/service/IRegularTimeService.java
  31. 5
      ruoyi-api/src/main/java/com/ruoyi/api/service/StationDataApiService.java
  32. 6
      ruoyi-api/src/main/java/com/ruoyi/api/service/WaterDataApiService.java
  33. 12
      ruoyi-api/src/main/java/com/ruoyi/api/service/XsAlarmListService.java
  34. 12
      ruoyi-api/src/main/java/com/ruoyi/api/service/XsAlarmService.java
  35. 12
      ruoyi-api/src/main/java/com/ruoyi/api/service/XsAlarmUserService.java
  36. 114
      ruoyi-api/src/main/java/com/ruoyi/api/service/impl/DapingServiceImpl.java
  37. 34
      ruoyi-api/src/main/java/com/ruoyi/api/service/impl/RegularTimeServiceImpl.java
  38. 13
      ruoyi-api/src/main/java/com/ruoyi/api/service/impl/XsAlarmListServiceImpl.java
  39. 13
      ruoyi-api/src/main/java/com/ruoyi/api/service/impl/XsAlarmServiceImpl.java
  40. 13
      ruoyi-api/src/main/java/com/ruoyi/api/service/impl/XsAlarmUserServiceImpl.java
  41. 127
      ruoyi-api/src/main/java/com/ruoyi/api/util/Digests.java
  42. 500
      ruoyi-api/src/main/java/com/ruoyi/api/util/HttpRequestUtils.java
  43. 53
      ruoyi-api/src/main/java/com/ruoyi/api/util/RegularTimeUtil.java
  44. 79
      ruoyi-api/src/main/resources/mapper/api/DapingMapper.xml
  45. 297
      ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/ApiController.java
  46. 105
      ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/CameraBrandController.java
  47. 407
      ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/CameraController.java
  48. 38
      ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/CameraNetFtpController.java
  49. 25
      ruoyi-code/src/main/java/com/ruoyi/code/camera/domain/Camera.java
  50. 39
      ruoyi-code/src/main/java/com/ruoyi/code/camera/domain/CameraBrand.java
  51. 15
      ruoyi-code/src/main/java/com/ruoyi/code/camera/domain/CameraParams.java
  52. 18
      ruoyi-code/src/main/java/com/ruoyi/code/camera/mapper/CameraBrandMapper.java
  53. 122
      ruoyi-code/src/main/java/com/ruoyi/code/camera/scheduled/RegisterServer.java
  54. 36
      ruoyi-code/src/main/java/com/ruoyi/code/camera/scheduled/RtspScreenshotTask.java
  55. 21
      ruoyi-code/src/main/java/com/ruoyi/code/camera/service/ICameraBrandService.java
  56. 6
      ruoyi-code/src/main/java/com/ruoyi/code/camera/service/ICameraService.java
  57. 33
      ruoyi-code/src/main/java/com/ruoyi/code/camera/service/impl/CameraBrandServiceImpl.java
  58. 60
      ruoyi-code/src/main/java/com/ruoyi/code/camera/service/impl/CameraServiceImpl.java
  59. 3
      ruoyi-code/src/main/java/com/ruoyi/code/camera/service/impl/WaterPhotoInfoServiceImpl.java
  60. 113
      ruoyi-code/src/main/java/com/ruoyi/code/rtudata/controller/RtuDataController.java
  61. 54
      ruoyi-code/src/main/java/com/ruoyi/code/rtudata/domain/RtuData.java
  62. 28
      ruoyi-code/src/main/java/com/ruoyi/code/rtudata/mapper/RtuDataMapper.java
  63. 25
      ruoyi-code/src/main/java/com/ruoyi/code/rtudata/service/IRtuDataService.java
  64. 95
      ruoyi-code/src/main/java/com/ruoyi/code/rtudata/service/impl/RtuDataServiceImpl.java
  65. 37
      ruoyi-code/src/main/java/com/ruoyi/code/sctaationinfo/controller/ScStationInfoController.java
  66. 3
      ruoyi-code/src/main/java/com/ruoyi/code/sctaationinfo/service/IScStationInfoService.java
  67. 21
      ruoyi-code/src/main/java/com/ruoyi/code/sctaationinfo/service/impl/ScStationInfoServiceImpl.java
  68. 5
      ruoyi-code/src/main/java/com/ruoyi/code/scwaterdata/domain/ScWaterData.java
  69. 98
      ruoyi-code/src/main/java/com/ruoyi/code/warning/controller/WaAlarmController.java
  70. 96
      ruoyi-code/src/main/java/com/ruoyi/code/warning/controller/WaEmployeeController.java
  71. 96
      ruoyi-code/src/main/java/com/ruoyi/code/warning/controller/WaMessageController.java
  72. 106
      ruoyi-code/src/main/java/com/ruoyi/code/warning/controller/WaThresholdController.java
  73. 49
      ruoyi-code/src/main/java/com/ruoyi/code/warning/domain/WaAlarm.java
  74. 36
      ruoyi-code/src/main/java/com/ruoyi/code/warning/domain/WaEmpMsg.java
  75. 39
      ruoyi-code/src/main/java/com/ruoyi/code/warning/domain/WaEmployee.java
  76. 50
      ruoyi-code/src/main/java/com/ruoyi/code/warning/domain/WaMessage.java
  77. 40
      ruoyi-code/src/main/java/com/ruoyi/code/warning/domain/WaThreshold.java
  78. 22
      ruoyi-code/src/main/java/com/ruoyi/code/warning/mapper/WaAlarmMapper.java
  79. 23
      ruoyi-code/src/main/java/com/ruoyi/code/warning/mapper/WaEmpMsgMapper.java
  80. 18
      ruoyi-code/src/main/java/com/ruoyi/code/warning/mapper/WaEmployeeMapper.java
  81. 17
      ruoyi-code/src/main/java/com/ruoyi/code/warning/mapper/WaMessageMapper.java
  82. 18
      ruoyi-code/src/main/java/com/ruoyi/code/warning/mapper/WaThresholdMapper.java
  83. 24
      ruoyi-code/src/main/java/com/ruoyi/code/warning/service/IWaAlarmService.java
  84. 21
      ruoyi-code/src/main/java/com/ruoyi/code/warning/service/IWaEmpMsgService.java
  85. 24
      ruoyi-code/src/main/java/com/ruoyi/code/warning/service/IWaEmployeeService.java
  86. 35
      ruoyi-code/src/main/java/com/ruoyi/code/warning/service/IWaMessageService.java
  87. 22
      ruoyi-code/src/main/java/com/ruoyi/code/warning/service/IWaThresholdService.java
  88. 44
      ruoyi-code/src/main/java/com/ruoyi/code/warning/service/impl/WaAlarmServiceImpl.java
  89. 33
      ruoyi-code/src/main/java/com/ruoyi/code/warning/service/impl/WaEmpMsgServiceImpl.java
  90. 59
      ruoyi-code/src/main/java/com/ruoyi/code/warning/service/impl/WaEmployeeServiceImpl.java
  91. 90
      ruoyi-code/src/main/java/com/ruoyi/code/warning/service/impl/WaMessageServiceImpl.java
  92. 36
      ruoyi-code/src/main/java/com/ruoyi/code/warning/service/impl/WaThresholdServiceImpl.java
  93. 79
      ruoyi-code/src/main/java/utils/Base64Utils.java
  94. 12
      ruoyi-code/src/main/java/utils/CameraUtil.java
  95. 21
      ruoyi-code/src/main/java/utils/RegisterUtil.java
  96. 301
      ruoyi-code/src/main/java/utils/RtspConvert.java
  97. 295
      ruoyi-code/src/main/java/utils/run_device_cfg.java
  98. 10
      ruoyi-code/src/main/resources/mapper/camera/CameraMapper.xml
  99. 6
      ruoyi-code/src/main/resources/mapper/camera/WaterPhotoInfoMapper.xml
  100. 27
      ruoyi-code/src/main/resources/mapper/rtudata/RtuDataMapper.xml
  101. Some files were not shown because too many files have changed in this diff Show More

99
README.md

@ -1,97 +1,2 @@ @@ -1,97 +1,2 @@
<p align="center">
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-d3d0a9303e11d522a06cd263f3079027715.png">
</p>
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v3.8.2</h1>
<h4 align="center">基于SpringBoot+Vue前后端分离的Java快速开发框架</h4>
<p align="center">
<a href="https://gitee.com/y_project/RuoYi-Vue/stargazers"><img src="https://gitee.com/y_project/RuoYi-Vue/badge/star.svg?theme=dark"></a>
<a href="https://gitee.com/y_project/RuoYi-Vue"><img src="https://img.shields.io/badge/RuoYi-v3.8.2-brightgreen.svg"></a>
<a href="https://gitee.com/y_project/RuoYi-Vue/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
</p>
## 平台简介
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
* 前端采用Vue、Element UI。
* 后端采用Spring Boot、Spring Security、Redis & Jwt。
* 权限认证使用Jwt,支持多终端认证系统。
* 支持加载动态权限菜单,多方式轻松权限控制。
* 高效率开发,使用代码生成器可以一键生成前后端代码。
* 提供了技术栈([Vue3](https://v3.cn.vuejs.org) [Element Plus](https://element-plus.org/zh-CN) [Vite](https://cn.vitejs.dev))版本[RuoYi-Vue3](https://github.com/yangzongzhuan/RuoYi-Vue3),保持同步更新。
* 提供了单应用版本[RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast),Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。
* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
* 特别鸣谢:[element](https://github.com/ElemeFE/element),[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin),[eladmin-web](https://github.com/elunez/eladmin-web)。
* 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)&nbsp;&nbsp;
* 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)&nbsp;&nbsp;
## 内置功能
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
3. 岗位管理:配置系统用户所属担任职务。
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
7. 参数管理:对系统动态配置常用参数。
8. 通知公告:系统通知公告信息发布维护。
9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
10. 登录日志:系统登录日志记录查询包含登录异常。
11. 在线用户:当前系统中活跃用户状态监控。
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
13. 代码生成:前后端代码的生成(java、html、xml、sql)支持CRUD下载 。
14. 系统接口:根据业务代码自动生成相关的api接口文档。
15. 服务监控:监视当前系统CPU、内存、磁盘、堆栈等相关信息。
16. 缓存监控:对系统的缓存信息查询,命令统计等。
17. 在线构建器:拖动表单元素生成相应的HTML代码。
18. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。
## 在线体验
- admin/admin123
- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。
演示地址:http://vue.ruoyi.vip
文档地址:http://doc.ruoyi.vip
## 演示图
<table>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/cd1f90be5f2684f4560c9519c0f2a232ee8.jpg"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/1cbcf0e6f257c7d3a063c0e3f2ff989e4b3.jpg"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-8074972883b5ba0622e13246738ebba237a.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-9f88719cdfca9af2e58b352a20e23d43b12.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-39bf2584ec3a529b0d5a3b70d15c9b37646.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-936ec82d1f4872e1bc980927654b6007307.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-b2d62ceb95d2dd9b3fbe157bb70d26001e9.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-d67451d308b7a79ad6819723396f7c3d77a.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/5e8c387724954459291aafd5eb52b456f53.jpg"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/644e78da53c2e92a95dfda4f76e6d117c4b.jpg"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-8370a0d02977eebf6dbf854c8450293c937.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-49003ed83f60f633e7153609a53a2b644f7.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-d4fe726319ece268d4746602c39cffc0621.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-c195234bbcd30be6927f037a6755e6ab69c.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/b6115bc8c31de52951982e509930b20684a.jpg"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-5e4daac0bb59612c5038448acbcef235e3a.png"/></td>
</tr>
</table>
## 若依前后端分离交流群
QQ群: [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/已满-104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](https://img.shields.io/badge/已满-186866453-blue.svg)](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [![加入QQ群](https://img.shields.io/badge/已满-201396349-blue.svg)](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [![加入QQ群](https://img.shields.io/badge/已满-101456076-blue.svg)](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [![加入QQ群](https://img.shields.io/badge/已满-101539465-blue.svg)](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) [![加入QQ群](https://img.shields.io/badge/已满-264312783-blue.svg)](https://jq.qq.com/?_wv=1027&k=EI9an8lJ) [![加入QQ群](https://img.shields.io/badge/167385320-blue.svg)](https://jq.qq.com/?_wv=1027&k=SWCtLnMz) 点击按钮入群。
程序运行需要将本地jar包安装到maven仓库
mvn install:install-file -Dfile=lib/jna.jar -DgroupId=com.sun -DartifactId=jna -Dversion=1.0 -Dpackaging=jar

8
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java

@ -17,10 +17,10 @@ public class RuoYiApplication @@ -17,10 +17,10 @@ public class RuoYiApplication
{
public static void main(String[] args)
{
// System.setProperty("spring.devtools.restart.enabled", "false");
// SpringApplication.run(RuoYiApplication.class, args);
SpringApplicationBuilder builder = new SpringApplicationBuilder(RuoYiApplication.class);
builder.headless(false).run(args);
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args);
// SpringApplicationBuilder builder = new SpringApplicationBuilder(RuoYiApplication.class);
// builder.headless(false).run(args);
System.out.println("(♥◠‿◠)ノ゙ 启动成功 ლ(´ڡ`ლ)゙ ");
}

22
ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java

@ -1,23 +1,27 @@ @@ -1,23 +1,27 @@
package com.ruoyi.web.core.config;
import com.ruoyi.common.config.RuoYiConfig;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.ruoyi.common.config.RuoYiConfig;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.*;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiKey;
import springfox.documentation.service.AuthorizationScope;
import springfox.documentation.service.Contact;
import springfox.documentation.service.SecurityReference;
import springfox.documentation.service.SecurityScheme;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;
import java.util.ArrayList;
import java.util.List;
/**
* Swagger2的接口配置
*
@ -109,9 +113,9 @@ public class SwaggerConfig @@ -109,9 +113,9 @@ public class SwaggerConfig
// 用ApiInfoBuilder进行定制
return new ApiInfoBuilder()
// 设置标题
.title("标题:华双视频水位数据接收平台_接口文档")
.title("标题:若依管理系统_接口文档")
// 描述
.description("描述:XXX,XXX模块...")
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
// 作者信息
.contact(new Contact(ruoyiConfig.getName(), null, null))
// 版本

2
ruoyi-admin/src/main/resources/application-druid.yml

@ -6,7 +6,7 @@ spring: @@ -6,7 +6,7 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://192.168.16.219:3306/znsc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://121.40.203.197:3306/znsc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true&allowPublicKeyRetrieval=true
username: znsc
password: znSC_1q2w#E$R
# 从库数据源

11
ruoyi-admin/src/main/resources/application.yml

@ -129,9 +129,12 @@ xss: @@ -129,9 +129,12 @@ xss:
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
#服务器ip
#camera:
# register:
# ip: 192.168.1.11
## ip: 172.17.0.2
# port: 8020
# username: admin
# password: admin123
localip: 172.16.46.58
#公网ip,用于判断视频播放
serverip: 121.40.203.197
#接入方式 0-主动注册 1-网络
accessmode: 0

43
ruoyi-api/src/main/java/com/ruoyi/api/app/AlarmDataApiController.java

@ -1,43 +0,0 @@ @@ -1,43 +0,0 @@
package com.ruoyi.api.app;
import com.ruoyi.api.controller.AbstractApiController;
import com.ruoyi.api.params.AlarmDataParams;
import com.ruoyi.api.params.WaterDataParams;
import com.ruoyi.api.service.AlarmDataApiService;
import com.ruoyi.api.service.WaterDataApiService;
import com.ruoyi.code.warning.service.IWaAlarmService;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.validator.ValidatorUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* 系统对外接口-检测信息
*/
@RestController
@RequestMapping("/api")
@Slf4j
public class AlarmDataApiController extends AbstractApiController {
@Resource
private AlarmDataApiService alarmDataApiService;
/**
* 预警数据查询
*
* @param params
* @return
*/
@PostMapping("v1/alarm_data/query")
public R query(@RequestBody AlarmDataParams params) {
log.info("[预警数据查询接口查询参数为{}]", params);
ValidatorUtils.validateV2(params);
return alarmDataApiService.query(params);
}
}

41
ruoyi-api/src/main/java/com/ruoyi/api/app/AlarmJobController.java

@ -1,41 +0,0 @@ @@ -1,41 +0,0 @@
package com.ruoyi.api.app;
import com.ruoyi.api.controller.AbstractApiController;
import com.ruoyi.api.params.AlarmJobParams;
import com.ruoyi.api.service.AlarmJobService;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.validator.ValidatorUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* 系统对外接口-检测信息
*/
@RestController
@RequestMapping("/job")
@Slf4j
public class AlarmJobController extends AbstractApiController {
@Resource
private AlarmJobService alarmJobService;
/**
* 报警数据接收
*
* @param params
* @return
*/
@PostMapping("v1/alarm/add")
public R query(@RequestBody AlarmJobParams params) {
log.info("[报警数据接收接口数据为:{}]", params);
ValidatorUtils.validateV2(params);
return alarmJobService.add(params);
}
}

25
ruoyi-api/src/main/java/com/ruoyi/api/app/DapingController.java

@ -6,17 +6,15 @@ import com.ruoyi.common.core.page.R; @@ -6,17 +6,15 @@ import com.ruoyi.common.core.page.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* 大屏的接口
*/
@RestController
@RequestMapping("/api/daping")
@RequestMapping("/daping")
@Slf4j
public class DapingController {
@ -24,28 +22,23 @@ public class DapingController { @@ -24,28 +22,23 @@ public class DapingController {
private DapingService dapingService;
@RequestMapping("/station/info")
public R getStationInfo(@RequestParam Map<String,Object> params){
return dapingService.getStationInfo(params);
public List<WaterPhotoInfo> getStationInfo(){
return dapingService.getStationInfo();
}
@RequestMapping("/station/waterLevel")
public R getStationWaterLevel(@RequestParam Map<String,Object> params){
return dapingService.getStationWaterLevel(params);
public List<WaterPhotoInfo> getStationWaterLevel(){
return dapingService.getStationWaterLevel();
}
@RequestMapping("/station/waterLevelTrend")
public R getWaterLevelTrend(String ids){
return dapingService.getWaterLevelTrend(ids);
public R getWaterLevelTrend(){
return dapingService.getWaterLevelTrend();
}
@RequestMapping("/station/status")
public R getStationByStatus(@RequestParam Map<String,Object> params){
return dapingService.getStationByStatus(params);
}
@RequestMapping("/station/count")
public R getCount(@RequestParam Map<String,Object> params){
return dapingService.getCount(params);
public R getStationByStatus(){
return dapingService.getStationByStatus();
}
}

39
ruoyi-api/src/main/java/com/ruoyi/api/app/RegularTimeController.java

@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
package com.ruoyi.api.app;
import com.ruoyi.api.domain.RegularTime;
import com.ruoyi.api.service.IRegularTimeService;
import com.ruoyi.api.util.RegularTimeUtil;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* 定时报Controller
*
* @author ruoyi
* @date 2022-09-23
*/
@RestController
@RequestMapping("/api/regular/time")
public class RegularTimeController extends BaseController
{
@Resource
private IRegularTimeService regularTimeService;
/**
* 新增
*/
@RequestMapping("/add")
public R add(String asciiCode){
if (StringUtils.isEmpty(asciiCode)){
return R.error("asciiCode不能为空!");
}
RegularTime regularTime = RegularTimeUtil.hourlyReportASCII(asciiCode);
regularTimeService.save(regularTime);
return R.ok();
}
}

2
ruoyi-api/src/main/java/com/ruoyi/api/app/StationDataApiController.java

@ -32,7 +32,7 @@ public class StationDataApiController extends AbstractApiController { @@ -32,7 +32,7 @@ public class StationDataApiController extends AbstractApiController {
public R query(@RequestBody StationDataParams params) {
log.info("[测站数据查询接口查询参数为{}]", params);
ValidatorUtils.validateV2(params);
return stationDataApiService.query(params);
return stationDataApiService.query(params,getMarketAuthDto());
}
}

19
ruoyi-api/src/main/java/com/ruoyi/api/app/TestApiController.java

@ -5,7 +5,6 @@ import lombok.extern.slf4j.Slf4j; @@ -5,7 +5,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import utils.RtspConvert;
@RestController
@ -17,22 +16,4 @@ public class TestApiController { @@ -17,22 +16,4 @@ public class TestApiController {
return R.ok();
}
@RequestMapping("/openPullM3u8")
public R openPullM3u8(){
RtspConvert convert = new RtspConvert();
String ip = "192.168.1.40";
String userName = "admin";
String pwd = "admin123";
String m3u8 = convert.rtsp2Hls(ip, userName, pwd);
System.out.println("***********************************" + m3u8);
return R.ok();
}
@RequestMapping("/closePullM3u8")
public R closePullM3u8(){
RtspConvert convert = new RtspConvert();
convert.closeAllProcess();
return R.ok();
}
}

2
ruoyi-api/src/main/java/com/ruoyi/api/app/WaterDataApiController.java

@ -34,7 +34,7 @@ public class WaterDataApiController extends AbstractApiController { @@ -34,7 +34,7 @@ public class WaterDataApiController extends AbstractApiController {
public R query(@RequestBody WaterDataParams params) {
log.info("[水位数据查询接口查询参数为{}]", params);
ValidatorUtils.validateV2(params);
return waterDataApiService.query(params);
return waterDataApiService.query(params,getMarketAuthDto());
}
}

7
ruoyi-api/src/main/java/com/ruoyi/api/controller/AbstractApiController.java

@ -33,12 +33,11 @@ public abstract class AbstractApiController { @@ -33,12 +33,11 @@ public abstract class AbstractApiController {
ValidatorUtils.validateV2(signParams);
YhAppInfoEntity appInfo = commonService.checkDigest(signParams);
HttpServletUtil.setAppInfo(appInfo);
//验证接口权限
commonService.authPermission(appInfo);
}
// protected MarketAuthDto getMarketAuthDto() {
// return commonService.getMarketAuthDto(HttpServletUtil.getAppInfo());
// }
protected MarketAuthDto getMarketAuthDto() {
return commonService.getMarketAuthDto(HttpServletUtil.getAppInfo());
}
}

66
ruoyi-api/src/main/java/com/ruoyi/api/domain/RegularTime.java

@ -1,66 +0,0 @@ @@ -1,66 +0,0 @@
package com.ruoyi.api.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* 定时报对象 regular_time
*
* @author ruoyi
* @date 2022-09-23
*/
@Data
@TableName("regular_time")
public class RegularTime implements Serializable
{
private static final long serialVersionUID = 1L;
/** id */
@TableId(type = IdType.INPUT)
private Long id;
/** 中心站地址 */
private String centralStationAddr;
/** 遥测站地址 */
private String stationAddr;
/** 密码 */
private String password;
/** 功能码 */
private String code;
/** 报文上下行标识和长度 */
private String msgIdAndLength;
/** 流水号 */
private String serialNum;
/** 发报时间 */
private String dispatchTime;
/** 遥测站分类码 */
private String stationTypeCode;
/** 观测时间 */
private String observationTime;
/** 瞬时水位 */
private String waterLevel;
/** 电压 */
private String voltage;
/** 温度 */
private String temperature;
/** 校验 */
private String checkCode;
}

40
ruoyi-api/src/main/java/com/ruoyi/api/domain/XsAlarmEntity.java

@ -1,40 +0,0 @@ @@ -1,40 +0,0 @@
package com.ruoyi.api.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 对外接口表
*
*/
@Data
@TableName("xs_alarm")
public class XsAlarmEntity implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
private Long id;
private String name;
private String level;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date alarmTime;
private String longitudeAndLatitude;
private String description;
private Long mainId;
}

36
ruoyi-api/src/main/java/com/ruoyi/api/domain/XsAlarmListEntity.java

@ -1,36 +0,0 @@ @@ -1,36 +0,0 @@
package com.ruoyi.api.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 对外接口表
*
*/
@Data
@TableName("xs_alarm_list")
public class XsAlarmListEntity implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
private Long id;
private String sendTitle;
private String sendPhone;
private String sendContent;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date sendEffectiveTime;
}

34
ruoyi-api/src/main/java/com/ruoyi/api/domain/XsAlarmUserEntity.java

@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
package com.ruoyi.api.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 对外接口表
*
*/
@Data
@TableName("xs_alarm_user")
public class XsAlarmUserEntity implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
private Long id;
private String name;
private String sex;
private String phone;
private Long mainId;
}

26
ruoyi-api/src/main/java/com/ruoyi/api/mapper/DapingMapper.java

@ -17,13 +17,13 @@ public interface DapingMapper extends BaseMapper<WaterPhotoInfo> { @@ -17,13 +17,13 @@ public interface DapingMapper extends BaseMapper<WaterPhotoInfo> {
* 大屏查询查询站点信息
* @return
*/
List<WaterPhotoInfo> selectStationInfo(@Param("params") Map<String,Object> params);
List<WaterPhotoInfo> selectStationInfo();
/**
* 实时水位
* @return
*/
List<WaterPhotoInfo> selectWaterLevel(@Param("params") Map<String,Object> params);
List<WaterPhotoInfo> selectWaterLevel();
/**
* 水位趋势
@ -35,33 +35,17 @@ public interface DapingMapper extends BaseMapper<WaterPhotoInfo> { @@ -35,33 +35,17 @@ public interface DapingMapper extends BaseMapper<WaterPhotoInfo> {
* 查询id
* @return
*/
List<Map<String,Object>> selectStationInfoId(@Param("ids") String ids);
List<Integer> selectStationInfoId();
/**
* 在线
* @return
*/
Map<String,Object> selectStationByOnlineStatus(@Param("params") Map<String,Object> params);
Map<String,Object> selectStationByOnlineStatus();
/**
* 不在线
* @return
*/
Map<String,Object> selectStationByOfflineStatus(@Param("params") Map<String,Object> params);
/**
* 查询所有的区域
* @return
*/
List<Map<String,Object>> selectAllAlea();
/**
* 查询某个区域的所有在线或者离线的设备数量
* 1 在线
* 0 离线
* @param status
* @param aleaId
* @return
*/
Integer selectZXAndLXCount(@Param("params") Map<String,Object> params);
Map<String,Object> selectStationByOfflineStatus();
}

17
ruoyi-api/src/main/java/com/ruoyi/api/mapper/RegularTimeMapper.java

@ -1,17 +0,0 @@ @@ -1,17 +0,0 @@
package com.ruoyi.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import com.ruoyi.api.domain.RegularTime;
/**
* Mapper接口
*
* @author ruoyi
* @date 2022-09-23
*/
@Mapper
public interface RegularTimeMapper extends BaseMapper<RegularTime>
{
}

13
ruoyi-api/src/main/java/com/ruoyi/api/mapper/XsAlarmListMapper.java

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
package com.ruoyi.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.api.domain.XsAlarmListEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 对外接口表
*
*/
@Mapper
public interface XsAlarmListMapper extends BaseMapper<XsAlarmListEntity> {
}

13
ruoyi-api/src/main/java/com/ruoyi/api/mapper/XsAlarmMapper.java

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
package com.ruoyi.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.api.domain.XsAlarmEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 对外接口表
*
*/
@Mapper
public interface XsAlarmMapper extends BaseMapper<XsAlarmEntity> {
}

13
ruoyi-api/src/main/java/com/ruoyi/api/mapper/XsAlarmUserMapper.java

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
package com.ruoyi.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.api.domain.XsAlarmUserEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 对外接口表
*
*/
@Mapper
public interface XsAlarmUserMapper extends BaseMapper<XsAlarmUserEntity> {
}

16
ruoyi-api/src/main/java/com/ruoyi/api/params/AlarmDataParams.java

@ -1,16 +0,0 @@ @@ -1,16 +0,0 @@
package com.ruoyi.api.params;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@Data
public class AlarmDataParams {
private Long stnmId;
private String startTime;
private String endTime;
}

17
ruoyi-api/src/main/java/com/ruoyi/api/params/AlarmJobDataParams.java

@ -1,17 +0,0 @@ @@ -1,17 +0,0 @@
package com.ruoyi.api.params;
import lombok.Data;
@Data
public class AlarmJobDataParams {
private String name;
private String level;
private String alarmTime;
private String longitudeAndLatitude;
private String description;
}

21
ruoyi-api/src/main/java/com/ruoyi/api/params/AlarmJobParams.java

@ -1,21 +0,0 @@ @@ -1,21 +0,0 @@
package com.ruoyi.api.params;
import lombok.Data;
import java.util.List;
@Data
public class AlarmJobParams {
private String sendTitle;
private String sendPhone;
private String sendContent;
private String sendEffectiveTime;
private AlarmJobDataParams data;
private List<AlarmJobSendUserParams> sendUser;
}

13
ruoyi-api/src/main/java/com/ruoyi/api/params/AlarmJobSendUserParams.java

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
package com.ruoyi.api.params;
import lombok.Data;
@Data
public class AlarmJobSendUserParams {
private String name;
private String sex;
private String phone;
}

31
ruoyi-api/src/main/java/com/ruoyi/api/service/AlarmDataApiService.java

@ -1,31 +0,0 @@ @@ -1,31 +0,0 @@
package com.ruoyi.api.service;
import com.ruoyi.api.params.AlarmDataParams;
import com.ruoyi.api.params.WaterDataParams;
import com.ruoyi.code.warning.domain.WaAlarm;
import com.ruoyi.code.warning.service.IWaAlarmService;
import com.ruoyi.common.core.page.R;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class AlarmDataApiService {
@Resource
private IWaAlarmService waAlarmService;
public R query(AlarmDataParams params) {
Map<String,Object> map = new HashMap<>();
map.put("stnmId",params.getStnmId());
map.put("startTime",params.getStartTime());
map.put("endTime",params.getEndTime());
List<WaAlarm> list = waAlarmService.queryAlarm(map);
return R.ok().put("data", list);
}
}

65
ruoyi-api/src/main/java/com/ruoyi/api/service/AlarmJobService.java

@ -1,65 +0,0 @@ @@ -1,65 +0,0 @@
package com.ruoyi.api.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.api.domain.XsAlarmEntity;
import com.ruoyi.api.domain.XsAlarmListEntity;
import com.ruoyi.api.domain.XsAlarmUserEntity;
import com.ruoyi.api.params.AlarmJobDataParams;
import com.ruoyi.api.params.AlarmJobParams;
import com.ruoyi.api.params.AlarmJobSendUserParams;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Service
public class AlarmJobService {
@Resource
private XsAlarmListService xsAlarmListService;
@Resource
private XsAlarmUserService xsAlarmUserService;
@Resource
private XsAlarmService xsAlarmService;
public R add(AlarmJobParams params) {
XsAlarmListEntity list = new XsAlarmListEntity();
list.setSendTitle(params.getSendTitle());
list.setSendContent(params.getSendContent());
list.setSendEffectiveTime(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, params.getSendEffectiveTime()));
xsAlarmListService.save(list);
List<AlarmJobSendUserParams> sendUser = params.getSendUser();
if(!sendUser.isEmpty()){
XsAlarmUserEntity user;
List<XsAlarmUserEntity> userList = new ArrayList<>();
for (AlarmJobSendUserParams u : sendUser) {
user = new XsAlarmUserEntity();
user.setMainId(list.getId());
user.setName(u.getName());
user.setPhone(u.getPhone());
user.setSex(u.getSex());
userList.add(user);
}
xsAlarmUserService.saveBatch(userList);
}
AlarmJobDataParams data = params.getData();
XsAlarmEntity alarm = new XsAlarmEntity();
if(data != null){
alarm.setMainId(list.getId());
alarm.setName(data.getName());
alarm.setAlarmTime(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, data.getAlarmTime()));
alarm.setDescription(data.getDescription());
alarm.setLongitudeAndLatitude(data.getLongitudeAndLatitude());
alarm.setLevel(data.getLevel());
xsAlarmService.save(alarm);
}
return R.ok();
}
}

14
ruoyi-api/src/main/java/com/ruoyi/api/service/DapingService.java

@ -5,34 +5,28 @@ import com.ruoyi.code.camera.domain.WaterPhotoInfo; @@ -5,34 +5,28 @@ import com.ruoyi.code.camera.domain.WaterPhotoInfo;
import com.ruoyi.common.core.page.R;
import java.util.List;
import java.util.Map;
public interface DapingService extends IService<WaterPhotoInfo> {
/**
* 大屏查询查询站点信息
* @return
*/
R getStationInfo(Map<String,Object> params);
List<WaterPhotoInfo> getStationInfo();
/**
* 实时水位
* @return
*/
R getStationWaterLevel(Map<String,Object> params);
List<WaterPhotoInfo> getStationWaterLevel();
/**
* 水位趋势
* @return
*/
R getWaterLevelTrend(String ids);
R getWaterLevelTrend();
/**
* 查询状态
* @return
*/
R getStationByStatus(Map<String,Object> params);
/**
* 水位计分布
*/
R getCount(Map<String,Object> params);
R getStationByStatus();
}

22
ruoyi-api/src/main/java/com/ruoyi/api/service/IRegularTimeService.java

@ -1,22 +0,0 @@ @@ -1,22 +0,0 @@
package com.ruoyi.api.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.api.domain.RegularTime;
import com.ruoyi.common.core.page.R;
import java.util.Map;
/**
* Service接口
*
* @author ruoyi
* @date 2022-09-23
*/
public interface IRegularTimeService extends IService<RegularTime>
{
/**
* 查询
*/
R queryPage(Map<String, Object> params);
}

5
ruoyi-api/src/main/java/com/ruoyi/api/service/StationDataApiService.java

@ -21,14 +21,13 @@ public class StationDataApiService { @@ -21,14 +21,13 @@ public class StationDataApiService {
@Resource
private IScStationInfoService scStationInfoService;
// public R query(StationDataParams params, MarketAuthDto marketAuthDto) {
public R query(StationDataParams params) {
public R query(StationDataParams params, MarketAuthDto marketAuthDto) {
Long id = params.getId();
String stnm = params.getStnm();
List<ScStationInfo> list = scStationInfoService.list(
new QueryWrapper<ScStationInfo>()
// .in("id", marketAuthDto.getQueryList())
.in("id", marketAuthDto.getQueryList())
.eq(id != null, "id", id)
.like(StringUtils.isNotBlank(stnm),"stnm", stnm)
);

6
ruoyi-api/src/main/java/com/ruoyi/api/service/WaterDataApiService.java

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
package com.ruoyi.api.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.api.dto.MarketAuthDto;
import com.ruoyi.api.dto.StationData;
import com.ruoyi.api.params.StationDataParams;
import com.ruoyi.api.params.WaterDataParams;
@ -26,14 +27,15 @@ public class WaterDataApiService { @@ -26,14 +27,15 @@ public class WaterDataApiService {
@Resource
private IScWaterDataService scWaterDataService;
public R query(WaterDataParams params) {
public R query(WaterDataParams params, MarketAuthDto marketAuthDto) {
Long stnmId = params.getStnmId();
String startTime = params.getStartTime();
String endTime = params.getEndTime();
List<ScWaterData> list = scWaterDataService.list(
new QueryWrapper<ScWaterData>()
.eq(stnmId != null,"stnm_id", stnmId)
.in("stnm_id", marketAuthDto.getQueryList())
.eq("stnm_id", stnmId)
.between("tm",startTime,endTime)
);

12
ruoyi-api/src/main/java/com/ruoyi/api/service/XsAlarmListService.java

@ -1,12 +0,0 @@ @@ -1,12 +0,0 @@
package com.ruoyi.api.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.api.domain.XsAlarmListEntity;
/**
* 对外接口表
*
*/
public interface XsAlarmListService extends IService<XsAlarmListEntity> {
}

12
ruoyi-api/src/main/java/com/ruoyi/api/service/XsAlarmService.java

@ -1,12 +0,0 @@ @@ -1,12 +0,0 @@
package com.ruoyi.api.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.api.domain.XsAlarmEntity;
/**
* 对外接口表
*
*/
public interface XsAlarmService extends IService<XsAlarmEntity> {
}

12
ruoyi-api/src/main/java/com/ruoyi/api/service/XsAlarmUserService.java

@ -1,12 +0,0 @@ @@ -1,12 +0,0 @@
package com.ruoyi.api.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.api.domain.XsAlarmUserEntity;
/**
* 对外接口表
*
*/
public interface XsAlarmUserService extends IService<XsAlarmUserEntity> {
}

114
ruoyi-api/src/main/java/com/ruoyi/api/service/impl/DapingServiceImpl.java

@ -4,16 +4,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -4,16 +4,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.api.mapper.DapingMapper;
import com.ruoyi.api.service.DapingService;
import com.ruoyi.code.camera.domain.WaterPhotoInfo;
import com.ruoyi.common.annotation.DeptDataScope;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.*;
@Service
public class DapingServiceImpl extends ServiceImpl<DapingMapper, WaterPhotoInfo> implements DapingService{
@ -22,18 +16,8 @@ public class DapingServiceImpl extends ServiceImpl<DapingMapper, WaterPhotoInfo> @@ -22,18 +16,8 @@ public class DapingServiceImpl extends ServiceImpl<DapingMapper, WaterPhotoInfo>
* @return
*/
@Override
@DeptDataScope(deptAlias="s")
public R getStationInfo(Map<String,Object> params) {
List<WaterPhotoInfo> list = baseMapper.selectStationInfo(params).stream().filter(waterPhotoInfo -> {
String imgName = waterPhotoInfo.getImgName();
if(StringUtils.isNotBlank(imgName)) {
String img = imgName.replace("\\", "/");
waterPhotoInfo.setImgName(img);
}
return true;
}).collect(Collectors.toList());
return R.ok().put("data",list);
public List<WaterPhotoInfo> getStationInfo() {
return baseMapper.selectStationInfo();
}
/**
@ -41,97 +25,47 @@ public class DapingServiceImpl extends ServiceImpl<DapingMapper, WaterPhotoInfo> @@ -41,97 +25,47 @@ public class DapingServiceImpl extends ServiceImpl<DapingMapper, WaterPhotoInfo>
* @return
*/
@Override
@DeptDataScope(deptAlias="s")
public R getStationWaterLevel(Map<String,Object> params) {
List<WaterPhotoInfo> list = baseMapper.selectWaterLevel(params);
return R.ok().put("data",list);
public List<WaterPhotoInfo> getStationWaterLevel() {
return baseMapper.selectWaterLevel();
}
/**
* 水位趋势
* @return
*/
@Override
public R getWaterLevelTrend(String ids) {
public R getWaterLevelTrend() {
Map<String, Object> map = new HashMap<>();
Map<String, Object> valMap;
Map<String, Object> valMap = new HashMap<>();
List<String> valueList;
List<String> tmList = new ArrayList<>();
List<String> stnmList = new ArrayList<>();
List<Map<String, Object>> valuesList = new ArrayList<>();
List<Map<String,Object>> stList = baseMapper.selectStationInfoId(ids);
for (Map<String,Object> m : stList) {
List<WaterPhotoInfo> waterPhotoInfos = baseMapper.selectWaterLevelTrend(Integer.parseInt(m.get("id").toString()));
if (waterPhotoInfos.size()==0){
break;
}
Set<String> tmList = new HashSet<>();
Set<String> stnmList = new HashSet<>();
List<Integer> idList = baseMapper.selectStationInfoId();
for (Integer id : idList) {
List<WaterPhotoInfo> waterPhotoInfos = baseMapper.selectWaterLevelTrend(id);
valueList = new ArrayList<>();
valMap = new HashMap<>();
for (int i = 0; i < waterPhotoInfos.size(); i++) {
if(waterPhotoInfos.get(i).getId() != null){
valueList.add(waterPhotoInfos.get(i).getValue());
}else{
if(i > 0){
valueList.add(valueList.get(i-1));
}else{
valueList.add(waterPhotoInfos.get(i).getValue());
}
}
if(!tmList.contains(waterPhotoInfos.get(i).getTm())){
tmList.add(waterPhotoInfos.get(i).getTm());
}
String stnm = "";
for (WaterPhotoInfo waterPhotoInfo : waterPhotoInfos) {
valueList.add(waterPhotoInfo.getValue());
stnmList.add(waterPhotoInfo.getStnm());
stnm = waterPhotoInfo.getStnm();
tmList.add(waterPhotoInfo.getTm());
}
stnmList.add(m.get("stnm").toString());
valMap.put("stnm",m.get("stnm").toString());
valMap.put("value",valueList);
valuesList.add(valMap);
valMap.put(stnm,valueList);
}
map.put("values",valuesList);
map.put("values",valMap);
map.put("tms",tmList);
map.put("stnms",stnmList);
return R.ok().put("data",map);
return R.ok().put("map",map);
}
@Override
@DeptDataScope(deptAlias="s")
public R getStationByStatus(Map<String,Object> params) {
Map<String, Object> map1 = baseMapper.selectStationByOnlineStatus(params);
Map<String, Object> map2 = baseMapper.selectStationByOfflineStatus(params);
public R getStationByStatus() {
Map<String, Object> map1 = baseMapper.selectStationByOnlineStatus();
Map<String, Object> map2 = baseMapper.selectStationByOfflineStatus();
List<Map<String, Object>> resultList = new ArrayList<>();
resultList.add(map1);
resultList.add(map2);
return R.ok().put("data",resultList);
}
@Override
@DeptDataScope(deptAlias="s")
public R getCount(Map<String,Object> params) {
List<Map<String, Object>> map = baseMapper.selectAllAlea();
Map<String, Object> result = new HashMap<>();
// 区域名称
List<String> stnms = new ArrayList<>();
// 各个区域在线的设备
List<Integer> zx = new ArrayList<>();
// 各个区域离线的设备
List<Integer> lx = new ArrayList<>();
for (Map<String, Object> m : map) {
Integer aleaId = (Integer)m.get("alea_id");
// 查询各个区域在线的设备
params.put("aleaId",aleaId);
params.put("status",1);
Integer zxCount = baseMapper.selectZXAndLXCount(params);
// 查询各个区域离线的设备
params.put("status",0);
Integer lxCount = baseMapper.selectZXAndLXCount(params);
zx.add(zxCount);
lx.add(lxCount);
stnms.add((String) m.get("alea_name"));
}
result.put("stnms",stnms);
result.put("zx",zx);
result.put("lx",lx);
return R.ok().put("data",result);
}
}

34
ruoyi-api/src/main/java/com/ruoyi/api/service/impl/RegularTimeServiceImpl.java

@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
package com.ruoyi.api.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.api.domain.RegularTime;
import com.ruoyi.api.mapper.RegularTimeMapper;
import com.ruoyi.api.service.IRegularTimeService;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.Query;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* Service业务层处理
*
* @author ruoyi
* @date 2022-09-23
*/
@Service("regularTimeService")
public class RegularTimeServiceImpl extends ServiceImpl<RegularTimeMapper, RegularTime> implements IRegularTimeService
{
@Override
public R queryPage(Map<String, Object> params) {
IPage<RegularTime> page = this.page(
new Query<RegularTime>().getPage(params),
new QueryWrapper<RegularTime>()
);
return R.ok().put("count", page.getTotal()).put("data", page.getRecords());
}
}

13
ruoyi-api/src/main/java/com/ruoyi/api/service/impl/XsAlarmListServiceImpl.java

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
package com.ruoyi.api.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.api.domain.XsAlarmListEntity;
import com.ruoyi.api.mapper.XsAlarmListMapper;
import com.ruoyi.api.service.XsAlarmListService;
import org.springframework.stereotype.Service;
@Service("xsAlarmListService")
public class XsAlarmListServiceImpl extends ServiceImpl<XsAlarmListMapper, XsAlarmListEntity> implements XsAlarmListService {
}

13
ruoyi-api/src/main/java/com/ruoyi/api/service/impl/XsAlarmServiceImpl.java

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
package com.ruoyi.api.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.api.domain.XsAlarmEntity;
import com.ruoyi.api.mapper.XsAlarmMapper;
import com.ruoyi.api.service.XsAlarmService;
import org.springframework.stereotype.Service;
@Service("xsAlarmService")
public class XsAlarmServiceImpl extends ServiceImpl<XsAlarmMapper, XsAlarmEntity> implements XsAlarmService {
}

13
ruoyi-api/src/main/java/com/ruoyi/api/service/impl/XsAlarmUserServiceImpl.java

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
package com.ruoyi.api.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.api.domain.XsAlarmUserEntity;
import com.ruoyi.api.mapper.XsAlarmUserMapper;
import com.ruoyi.api.service.XsAlarmUserService;
import org.springframework.stereotype.Service;
@Service("xsAlarmUserService")
public class XsAlarmUserServiceImpl extends ServiceImpl<XsAlarmUserMapper, XsAlarmUserEntity> implements XsAlarmUserService {
}

127
ruoyi-api/src/main/java/com/ruoyi/api/util/Digests.java

@ -1,127 +0,0 @@ @@ -1,127 +0,0 @@
package com.ruoyi.api.util;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.lang3.Validate;
import java.security.GeneralSecurityException;
import java.security.MessageDigest;
import java.security.SecureRandom;
import java.util.Random;
/**
* @author wcy
* @date 2021/8/13 下午3:03
*/
public class Digests {
private static SecureRandom random = new SecureRandom();
/**
* 加密遵循RFC2671规范 将相关参数加密生成一个MD5字符串,并返回
*/
public static String http_da_calc_HA1(String username, String realm, String password,
String nonce, String nc, String cnonce, String qop,
String method, String uri, String algorithm) {
String HA1, HA2;
if ("MD5-sess".equals(algorithm)) {
HA1 = HA1_MD5_sess(username, realm, password, nonce, cnonce);
} else {
HA1 = HA1_MD5(username, realm, password);
}
byte[] md5Byte = md5(HA1.getBytes());
HA1 = new String(Hex.encodeHex(md5Byte));
md5Byte = md5(HA2(method, uri).getBytes());
HA2 = new String(Hex.encodeHex(md5Byte));
String original = HA1 + ":" + (nonce + ":" + nc + ":" + cnonce + ":" + qop) + ":" + HA2;
md5Byte = md5(original.getBytes());
return new String(Hex.encodeHex(md5Byte));
}
/**
* algorithm值为MD5时规则
*/
private static String HA1_MD5(String username, String realm, String password) {
return username + ":" + realm + ":" + password;
}
/**
* algorithm值为MD5-sess时规则
*/
private static String HA1_MD5_sess(String username, String realm, String password, String nonce, String cnonce) {
// MD5(username:realm:password):nonce:cnonce
String s = HA1_MD5(username, realm, password);
byte[] md5Byte = md5(s.getBytes());
String smd5 = new String(Hex.encodeHex(md5Byte));
return smd5 + ":" + nonce + ":" + cnonce;
}
private static String HA2(String method, String uri) {
return method + ":" + uri;
}
/**
* 对输入字符串进行md5散列.
*/
public static byte[] md5(byte[] input) {
return digest(input, "MD5", null, 1);
}
/**
* 对字符串进行散列, 支持md5与sha1算法.
*/
private static byte[] digest(byte[] input, String algorithm, byte[] salt, int iterations) {
try {
MessageDigest digest = MessageDigest.getInstance(algorithm);
if (salt != null) {
digest.update(salt);
}
byte[] result = digest.digest(input);
for (int i = 1; i < iterations; i++) {
digest.reset();
result = digest.digest(result);
}
return result;
} catch (GeneralSecurityException e) {
throw new RuntimeException(e);
}
}
/**
* 随机生成numBytes长度数组
* @param numBytes
* @return
*/
public static byte[] generateSalt(int numBytes) {
Validate.isTrue(numBytes > 0, "numBytes argument must be a positive integer (1 or larger)", (long)numBytes);
byte[] bytes = new byte[numBytes];
random.nextBytes(bytes);
return bytes;
}
@Deprecated
public static String generateSalt2(int length) {
String val = "";
Random random = new Random();
//参数length,表示生成几位随机数
for(int i = 0; i < length; i++) {
String charOrNum = random.nextInt(2) % 2 == 0 ? "char" : "num";
//输出字母还是数字
if( "char".equalsIgnoreCase(charOrNum) ) {
//输出是大写字母还是小写字母
int temp = random.nextInt(2)%2 == 0 ? 65 : 97;
val += (char)(random.nextInt(26) + temp);
} else if( "num".equalsIgnoreCase(charOrNum) ) {
val += String.valueOf(random.nextInt(10));
}
}
return val.toLowerCase();
}
}

500
ruoyi-api/src/main/java/com/ruoyi/api/util/HttpRequestUtils.java

@ -1,500 +0,0 @@ @@ -1,500 +0,0 @@
package com.ruoyi.api.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.*;
/**
* @author wcy
* @date 2021/8/13 下午3:04
*/
public class HttpRequestUtils {
private static final Logger logger = LoggerFactory.getLogger(HttpRequestUtils.class);
public static void main(String[] args) {
// String json = HttpRequestUtils.sendPost("http://112.13.167.212:10000/uas/v1/api/dev/list",
// "", "nb012105", "Fhsw123456", "{}", "json");
String devListUrl = "http://112.13.167.212:10000/uas/v1/api/dev/list";
String mediaLiveUrl = "http://112.13.167.212:10000/mss/v1/api/media/live";
String jsonRtsp = HttpRequestUtils.sendPost(mediaLiveUrl,
"", "nb012105", "Fhsw123456", "{\n" +
" \"cameraId\": \"33021322031505040301000000581502\",\n" +
" \"streamType\": 1,\n" +
" \"urlType\": 1,\n" +
" \"agentType\": 1\n" +
"}", "json");
// String json = HttpRequestUtils.sendPost("http://112.13.167.212:10000/uas/v1/api/ptz/control",
//// String json = HttpRequestUtils.sendPost("http://112.13.167.212:10000/dcs/v1/api/preset/get",
// "", "nb012105", "Fhsw123456", "{\n" +
//// " \"cameraId\": \"33021323010505040301020001151452\"" +
// " \"cameraId\": \"33021323010505040301020001151452\",\n" +
// " \"opCode\": \"PTZ_PREFAB_BIT_RUN\",\n" +
// " \"param1\": 1,\n" +
// " \"param2\": 10\n" +
// "}", "json");
System.out.println(jsonRtsp);
JSONObject object = JSON.parseObject(jsonRtsp);
System.out.println(object.getString("url"));
System.out.println("ws://localhost:8866/live?url="+object.getString("url"));
System.out.println("let rtspUrl =\""+object.getString("url")+"\";");
}
static int nc = 0; //调用次数
private static final String GET = "GET";
private static final String POST = "POST";
private static final String PUT = "PUT";
private static final String DELETE = "DELETE";
/**
* 向指定URL发送DELETE方法的请求
* @param url 发送请求的URL
* @param param 请求参数请求参数应该是 name1=value1&name2=value2 的形式
* @param username 验证所需的用户名
* @param password 验证所需的密码
* @param json 请求json字符串
* @param type 返回xml和json格式数据默认xml传入json返回json数据
* @return URL 所代表远程资源的响应结果
*/
public static String sendDelete(String url, String param, String username, String password, String json, String type) {
StringBuilder result = new StringBuilder();
BufferedReader in = null;
try {
String wwwAuth = sendGet(url, param); //发起一次授权请求
if (wwwAuth.startsWith("WWW-Authenticate:")) {
wwwAuth = wwwAuth.replaceFirst("WWW-Authenticate:", "");
} else {
return wwwAuth;
}
nc ++;
String urlNameString = url + (StringUtils.isNotEmpty(param) ? "?" + param : "");
URL realUrl = new URL(urlNameString);
// 打开和URL之间的连接
HttpURLConnection connection = (HttpURLConnection)realUrl.openConnection();
// 设置是否向connection输出,因为这个是post请求,参数要放在
// http正文内,因此需要设为true
connection.setDoOutput(true);
// Read from the connection. Defaultis true.
connection.setDoInput(true);
// 默认是 GET方式
connection.setRequestMethod(DELETE);
// 设置通用的请求属性
setRequestProperty(connection, wwwAuth, realUrl, username, password, DELETE, type);
if (!StringUtils.isEmpty(json)) {
byte[] writebytes =json.getBytes();
connection.setRequestProperty("Content-Length",String.valueOf(writebytes.length));
OutputStream outwritestream = connection.getOutputStream();
outwritestream.write(json.getBytes());
outwritestream.flush();
outwritestream.close();
}
if (connection.getResponseCode() == 200) {
in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
result.append(line);
}
} else {
String errResult = formatResultInfo(connection, type);
logger.info(errResult);
return errResult;
}
nc = 0;
} catch (Exception e) {
nc = 0;
throw new RuntimeException(e);
} finally {
try {
if (in != null) in.close();
} catch (Exception e2) {
e2.printStackTrace();
}
}
return result.toString();
}
/**
* 向指定URL发送PUT方法的请求
* @param url 发送请求的URL
* @param param 请求参数请求参数应该是 name1=value1&name2=value2 的形式
* @param username 验证所需的用户名
* @param password 验证所需的密码
* @param json 请求json字符串
* @param type 返回xml和json格式数据默认xml传入json返回json数据
* @return URL 所代表远程资源的响应结果
*/
public static String sendPUT(String url, String param, String username, String password, String json, String type) {
StringBuilder result = new StringBuilder();
BufferedReader in = null;
try {
String wwwAuth = sendGet(url, param); //发起一次授权请求
if (wwwAuth.startsWith("WWW-Authenticate:")) {
wwwAuth = wwwAuth.replaceFirst("WWW-Authenticate:", "");
} else {
return wwwAuth;
}
nc ++;
String urlNameString = url + (StringUtils.isNotEmpty(param) ? "?" + param : "");
URL realUrl = new URL(urlNameString);
// 打开和URL之间的连接
HttpURLConnection connection = (HttpURLConnection)realUrl.openConnection();
// 设置是否向connection输出,因为这个是post请求,参数要放在
// http正文内,因此需要设为true
connection.setDoOutput(true);
// Read from the connection. Defaultis true.
connection.setDoInput(true);
// 默认是 GET方式
connection.setRequestMethod(PUT);
// Post 请求不能使用缓存
connection.setUseCaches(false);
// 设置通用的请求属性
setRequestProperty(connection, wwwAuth,realUrl, username, password, PUT, type);
if (!StringUtils.isEmpty(json)) {
byte[] writebytes =json.getBytes();
connection.setRequestProperty("Content-Length",String.valueOf(writebytes.length));
OutputStream outwritestream = connection.getOutputStream();
outwritestream.write(json.getBytes());
outwritestream.flush();
outwritestream.close();
}
if (connection.getResponseCode() == 200) {
in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
result.append(line);
}
} else {
String errResult = formatResultInfo(connection, type);
logger.info(errResult);
return errResult;
}
nc = 0;
} catch (Exception e) {
nc = 0;
throw new RuntimeException(e);
} finally {
try {
if (in != null) in.close();
} catch (Exception e2) {
e2.printStackTrace();
}
}
return result.toString();
}
/**
* 向指定URL发送POST方法的请求
* @param url 发送请求的URL
* @param param 请求参数请求参数应该是 name1=value1&name2=value2 的形式
* @param username 验证所需的用户名
* @param password 验证所需的密码
* @param json 请求json字符串
* @param type 返回xml和json格式数据默认xml传入json返回json数据
* @return URL 所代表远程资源的响应结果
*/
public static String sendPost(String url, String param, String username, String password, String json, String type) {
StringBuilder result = new StringBuilder();
BufferedReader in = null;
try {
String wwwAuth = sendGet(url, param); //发起一次授权请求
if (wwwAuth.startsWith("WWW-Authenticate:")) {
wwwAuth = wwwAuth.replaceFirst("WWW-Authenticate:", "");
} else {
return wwwAuth;
}
nc ++;
String urlNameString = url + (StringUtils.isNotEmpty(param) ? "?" + param : "");
URL realUrl = new URL(urlNameString);
// 打开和URL之间的连接
HttpURLConnection connection = (HttpURLConnection)realUrl.openConnection();
// 设置是否向connection输出,因为这个是post请求,参数要放在
// http正文内,因此需要设为true
connection.setDoOutput(true);
// Read from the connection. Defaultis true.
connection.setDoInput(true);
// 默认是 GET方式
connection.setRequestMethod(POST);
// Post 请求不能使用缓存
connection.setUseCaches(false);
// 设置通用的请求属性
setRequestProperty(connection, wwwAuth,realUrl, username, password, POST, type);
if (!StringUtils.isEmpty(json)) {
byte[] writebytes =json.getBytes();
connection.setRequestProperty("Content-Length",String.valueOf(writebytes.length));
OutputStream outwritestream = connection.getOutputStream();
outwritestream.write(json.getBytes());
outwritestream.flush();
outwritestream.close();
}
if (connection.getResponseCode() == 200 || connection.getResponseCode() == 201) {
in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
result.append(line);
}
} else {
String errResult = formatResultInfo(connection, type);
logger.info(errResult);
return errResult;
}
nc = 0;
} catch (Exception e) {
nc = 0;
throw new RuntimeException(e);
} finally {
try {
if (in != null) in.close();
} catch (Exception e2) {
e2.printStackTrace();
}
}
return result.toString();
}
/**
* 向指定URL发送GET方法的请求
* @param url 发送请求的URL
* @param param 请求参数请求参数应该是 name1=value1&name2=value2 的形式
* @param username 验证所需的用户名
* @param password 验证所需的密码
* @param type 返回xml和json格式数据默认xml传入json返回json数据
* @return URL 所代表远程资源的响应结果
*/
public static String sendGet(String url, String param, String username, String password, String type) {
StringBuilder result = new StringBuilder();
BufferedReader in = null;
try {
String wwwAuth = sendGet(url, param); //发起一次授权请求
if (wwwAuth.startsWith("WWW-Authenticate:")) {
wwwAuth = wwwAuth.replaceFirst("WWW-Authenticate:", "");
} else {
return wwwAuth;
}
nc ++;
String urlNameString = url + (StringUtils.isNotEmpty(param) ? "?" + param : "");
URL realUrl = new URL(urlNameString);
// 打开和URL之间的连接
HttpURLConnection connection = (HttpURLConnection)realUrl.openConnection();
// 设置通用的请求属性
setRequestProperty(connection, wwwAuth,realUrl, username, password, GET, type);
// 建立实际的连接
// connection.connect();
in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
result.append(line);
}
nc = 0;
} catch (Exception e) {
nc = 0;
throw new RuntimeException(e);
} finally {
try {
if (in != null) in.close();
} catch (Exception e2) {
e2.printStackTrace();
}
}
return result.toString();
}
/**
* 生成授权信息
* @param authorization 上一次调用返回401的WWW-Authenticate数据
* @param username 用户名
* @param password 密码
* @return 授权后的数据, 应放在http头的Authorization里
* @throws IOException 异常
*/
private static String getAuthorization(String authorization, String uri, String username, String password, String method) throws IOException {
uri = StringUtils.isEmpty(uri) ? "/" : uri;
// String temp = authorization.replaceFirst("Digest", "").trim();
String temp = authorization.replaceFirst("Digest", "").trim().replace("MD5","\"MD5\"");
// String json = "{\"" + temp.replaceAll("=", "\":").replaceAll(",", ",\"") + "}";
String json = withdrawJson(authorization);
// String json = "{ \"realm\": \"Wowza\", \" domain\": \"/\", \" nonce\": \"MTU1NzgxMTU1NzQ4MDo2NzI3MWYxZTZkYjBiMjQ2ZGRjYTQ3ZjNiOTM2YjJjZA==\", \" algorithm\": \"MD5\", \" qop\": \"auth\" }";
JSONObject jsonObject = JSON.parseObject(json);
String cnonce = Digests.generateSalt2(8);
String ncstr = ("00000000" + nc).substring(Integer.toString(nc).length()); //认证的次数,第一次是1,第二次是2...
// String algorithm = jsonObject.getString("algorithm");
String algorithm = jsonObject.getString("algorithm");
String qop = jsonObject.getString("qop");
String nonce = jsonObject.getString("nonce");
String realm = jsonObject.getString("realm");
String response = Digests.http_da_calc_HA1(username, realm, password,
nonce, ncstr, cnonce, qop,
method, uri, algorithm);
//组成响应authorization
authorization = "Digest username=\"" + username + "\"," + temp;
authorization += ",uri=\"" + uri
+ "\",nc=\"" + ncstr
+ "\",cnonce=\"" + cnonce
+ "\",response=\"" + response+"\"";
return authorization;
}
/**
* 将返回的Authrization信息转成json
* @param authorization authorization info
* @return 返回authrization json格式数据 String json = "{ \"realm\": \"Wowza\", \" domain\": \"/\", \" nonce\": \"MTU1NzgxMTU1NzQ4MDo2NzI3MWYxZTZkYjBiMjQ2ZGRjYTQ3ZjNiOTM2YjJjZA==\", \" algorithm\": \"MD5\", \" qop\": \"auth\" }";
*/
private static String withdrawJson(String authorization) {
String temp = authorization.replaceFirst("Digest", "").trim().replaceAll("\"","");
// String noncetemp = temp.substring(temp.indexOf("nonce="), temp.indexOf("uri="));
// String json = "{\"" + temp.replaceAll("=", "\":").replaceAll(",", ",\"") + "}";
String[] split = temp.split(",");
Map<String, String> map = new HashMap<>();
Arrays.asList(split).forEach(c -> {
String c1 = c.replaceFirst("=",":");
String[] split1 = c1.split(":");
map.put(split1[0].trim(), split1[1].trim());
});
return JSONObject.toJSONString(map);
}
/**
* 向指定URL发送GET方法的请求
* @param url 发送请求的URL
* @param param 请求参数请求参数应该是 name1=value1&name2=value2 的形式
* @return URL 所代表远程资源的响应结果
*/
public static String sendGet(String url, String param) {
StringBuilder result = new StringBuilder();
BufferedReader in = null;
try {
String urlNameString = url + (StringUtils.isNotEmpty(param) ? "?" + param : "");
URL realUrl = new URL(urlNameString);
// 打开和URL之间的连接
URLConnection connection = realUrl.openConnection();
// 设置通用的请求属性
connection.setRequestProperty("accept", "*/*");
connection.setRequestProperty("connection", "Keep-Alive");
connection.setRequestProperty("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
connection.connect();
//返回401时需再次用用户名和密码请求
//此情况返回服务器的 WWW-Authenticate 信息
if (((HttpURLConnection) connection).getResponseCode() == 401) {
Map<String, List<String>> map = connection.getHeaderFields();
return "WWW-Authenticate:" + map.get("WWW-Authenticate").get(0);
}
in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
result.append(line);
}
} catch (Exception e) {
throw new RuntimeException("get请求发送失败",e);
}
// 使用finally块来关闭输入流
finally {
try {
if (in != null) in.close();
} catch (Exception e2) {
e2.printStackTrace();
}
}
return result.toString();
}
/**
* HTTP set request property
*
* @param connection HttpConnection
* @param wwwAuth 授权auth
* @param realUrl 实际url
* @param username 验证所需的用户名
* @param password 验证所需的密码
* @param method 请求方式
* @param type 返回xml和json格式数据默认xml传入json返回json数据
*/
private static void setRequestProperty(HttpURLConnection connection, String wwwAuth, URL realUrl, String username, String password, String method, String type)
throws IOException {
if (type != null && type.equals("json")) {
// 返回json
connection.setRequestProperty("accept", "application/json;charset=UTF-8");
connection.setRequestProperty("Content-Type","application/json;charset=UTF-8");
connection.setRequestProperty("connection", "Keep-Alive");
connection.setRequestProperty("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
} else {
// 返回xml
if (!method.equals(GET)) {
connection.setRequestProperty("Content-Type","application/json;charset=UTF-8");
}
connection.setRequestProperty("accept", "*/*");
connection.setRequestProperty("connection", "Keep-Alive");
// connection.setRequestProperty("Cache-Control", "no-cache");
connection.setRequestProperty("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
}
//授权信息
String authentication = getAuthorization(wwwAuth, realUrl.getPath(), username, password, method);
connection.setRequestProperty("Authorization", authentication);
}
/**
* 格式化请求返回信息支持json和xml格式
* @param connection HttpConnection
* @param type 指定返回数据格式jsonxml默认xml
* @return 返回数据
*/
private static String formatResultInfo(HttpURLConnection connection, String type) throws IOException {
String result = "";
if (type != null && type.equals("json")) {
result = String.format("{\"errCode\":%s, \"message\":%s}",connection.getResponseCode(),connection.getResponseMessage());
} else {
result = String.format(" <?xml version=\"1.0\" encoding=\"UTF-8\" ?> "
+ " <wmsResponse>"
+ " <errCode>%d</errCode>"
+ " <message>%s</message>"
+ " </wmsResponse>",connection.getResponseCode(),connection.getResponseMessage());
}
return result;
}
}

53
ruoyi-api/src/main/java/com/ruoyi/api/util/RegularTimeUtil.java

@ -1,53 +0,0 @@ @@ -1,53 +0,0 @@
package com.ruoyi.api.util;
import com.ruoyi.api.domain.RegularTime;
public class RegularTimeUtil {
// 每天整点报 整点 ASCII
public static RegularTime hourlyReportASCII(String asciiCode) {
RegularTime regularTime = new RegularTime();
String[] strArr = asciiCode.split(" ");
String s1 = strArr[0];
// 中心站地址
String centralStationAddr = s1.substring(0, 2);
regularTime.setCentralStationAddr(centralStationAddr);
// 遥测站地址
String stationAddr = s1.substring(2, 12);
regularTime.setStationAddr(stationAddr);
// 密码
String password = s1.substring(12, 16);
regularTime.setPassword(password);
//功能码
String code = s1.substring(16, 18);
regularTime.setCode(code);
//报文上下行标识和长度 报文标识和长度
String msgIDAndLength = s1.substring(18, 22);
regularTime.setMsgIdAndLength(msgIDAndLength);
// 流水号
String serialNum = s1.substring(22, 26);
regularTime.setSerialNum(serialNum);
// 发报时间
String dispatchTime = s1.substring(26, 38);
regularTime.setDispatchTime(dispatchTime);
// 遥测站分类码
String stationTypeCode = strArr[2];
regularTime.setStationTypeCode(stationTypeCode);
// 观测时间
String observationTime = strArr[4];
regularTime.setObservationTime(observationTime);
// 瞬时水位
String waterLevel = strArr[6];
regularTime.setWaterLevel(waterLevel);
// 电压
String voltage = strArr[8];
regularTime.setVoltage(voltage);
// 温度
String temperature = strArr[10];
regularTime.setTemperature(temperature);
// 校验
String checkCode = strArr[11];
regularTime.setCheckCode(checkCode);
return regularTime;
}
}

79
ruoyi-api/src/main/resources/mapper/api/DapingMapper.xml

@ -9,45 +9,24 @@ @@ -9,45 +9,24 @@
longitude,
latitude,
s.id,
c.tm as start_time,
create_time,
c.value,
c.img_name,
s.camera_sn
c.img_name
FROM
sc_station_info s
inner join sc_water_current_data c on c.stnm_id = s.id
where s.del_flag='0'
${params.dataScope}
left join sc_water_current_data c on c.stnm_id = s.id
</select>
<select id="selectWaterLevel" resultType="com.ruoyi.code.camera.domain.WaterPhotoInfo">
SELECT
s.id,
s.stnm,
s.camera_sn,
w.tm,
w.value
FROM
sc_station_info s
LEFT JOIN sc_water_current_data w ON w.stnm_id = s.id
where s.del_flag='0'
${params.dataScope}
</select>
<select id="selectWaterLevelTrend" resultType="com.ruoyi.code.camera.domain.WaterPhotoInfo">
select tms.tm,d.id, d.stnm, ifnull(d.value,0) value
from (
select date_format( DATE_SUB( NOW(), INTERVAL 11 HOUR ) , '%Y-%m-%d %H:00:00') tm union all
select date_format( DATE_SUB( NOW(), INTERVAL 10 HOUR ) , '%Y-%m-%d %H:00:00') tm union all
select date_format( DATE_SUB( NOW(), INTERVAL 9 HOUR ) , '%Y-%m-%d %H:00:00') tm union all
select date_format( DATE_SUB( NOW(), INTERVAL 8 HOUR ) , '%Y-%m-%d %H:00:00') tm union all
select date_format( DATE_SUB( NOW(), INTERVAL 7 HOUR ) , '%Y-%m-%d %H:00:00') tm union all
select date_format( DATE_SUB( NOW(), INTERVAL 6 HOUR ) , '%Y-%m-%d %H:00:00') tm union all
select date_format( DATE_SUB( NOW(), INTERVAL 5 HOUR ) , '%Y-%m-%d %H:00:00') tm union all
select date_format( DATE_SUB( NOW(), INTERVAL 4 HOUR ) , '%Y-%m-%d %H:00:00') tm union all
select date_format( DATE_SUB( NOW(), INTERVAL 3 HOUR ) , '%Y-%m-%d %H:00:00') tm union all
select date_format( DATE_SUB( NOW(), INTERVAL 2 HOUR ) , '%Y-%m-%d %H:00:00') tm union all
select date_format( DATE_SUB( NOW(), INTERVAL 1 HOUR ) , '%Y-%m-%d %H:00:00') tm
) tms
left join (
SELECT
s.id,
s.stnm,
@ -56,54 +35,20 @@ @@ -56,54 +35,20 @@
FROM
sc_station_info s
LEFT JOIN sc_water_data w ON w.stnm_id = s.id
WHERE s.del_flag='0' and
WHERE
tm BETWEEN DATE_SUB( NOW(), INTERVAL 12 HOUR )
AND DATE_SUB( NOW(), INTERVAL 1 HOUR )
AND RIGHT ( tm, 5 )= '00:00' and s.id= #{id}
) d on tms.tm = d.tm
ORDER BY tms.tm
AND now()
AND RIGHT ( tm, 5 )= '00:00' and s.id=#{id}
ORDER BY
tm
</select>
<select id="selectStationInfoId" resultType="java.util.Map">
select id,stnm from sc_station_info
<where>
del_flag='0'
<if test="ids != null and ids != ''">
and id in (${ids})
</if>
</where>
<if test="ids == null or ids == ''">
limit 5
</if>
<select id="selectStationInfoId" resultType="java.lang.Integer">
select id from sc_station_info
</select>
<select id="selectStationByOnlineStatus" resultType="java.util.Map">
select count(1) as value , '在线' as name from camera a
left join sc_station_info s on a.devsn = s.camera_sn
where a.status = '1' and a.first_time is not null and a.del_flag='0'
${params.dataScope}
select count(1) as value , '在线' as name from camera where status = '1';
</select>
<select id="selectStationByOfflineStatus" resultType="java.util.Map">
select count(1) as value , '不在线' as name from camera a
left join sc_station_info s on a.devsn = s.camera_sn
where a.status = '0' and a.first_time is not null and a.del_flag='0'
${params.dataScope}
</select>
<select id="selectAllAlea" resultType="java.util.Map">
select * from sc_station_alea
</select>
<select id="selectZXAndLXCount" resultType="java.lang.Integer">
SELECT
count( 1 )
FROM
camera a
left join sc_station_info s on a.devsn = s.camera_sn
WHERE
a.status = #{params.status} and a.del_flag='0'
AND a.devsn IN (
SELECT camera_sn FROM sc_station_info WHERE del_flag = '0' AND alea_id = #{params.aleaId}
${params.dataScope}
)
select count(1) as value , '不在线' as name from camera where status = '2';
</select>
</mapper>

297
ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/ApiController.java

@ -1,33 +1,26 @@ @@ -1,33 +1,26 @@
package com.ruoyi.code.camera.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.code.camera.domain.Camera;
import com.ruoyi.code.camera.domain.CameraNetFtp;
import com.ruoyi.code.camera.domain.LogInfo;
import com.ruoyi.code.camera.service.ICameraNetFtpService;
import com.ruoyi.code.camera.service.ICameraService;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.sun.jna.NativeLong;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import sdk.java.lib.netmanager.NetEnums;
import sdk.java.lib.netmanager.NetStructs;
import utils.Base64Utils;
import utils.CameraUtil;
import utils.run_device_cfg;
import utils.run_device_log_search;
import utils.RegisterUtil;
import javax.annotation.Resource;
import java.io.File;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 摄像机Controller
@ -39,12 +32,8 @@ import java.util.*; @@ -39,12 +32,8 @@ import java.util.*;
@RequestMapping("/api")
public class ApiController extends BaseController
{
@Value("${localip}")
private String localIp;
@Resource
private ICameraService cameraService;
@Resource
private ICameraNetFtpService cameraNetFtpService;
@RequestMapping("/camera/heart")
public R heart(@RequestParam Map<String, Object> params){
@ -59,270 +48,4 @@ public class ApiController extends BaseController @@ -59,270 +48,4 @@ public class ApiController extends BaseController
return R.ok();
}
@RequestMapping("/devHeart")
public R devHeart(String devNo){
System.out.println(devNo+"发送心跳");
return R.ok();
}
/**
* 重启注册服务
*/
@RequestMapping("register")
public R register(){
return cameraService.register(localIp);
}
/**
* 清空所有摄像机状态
*/
@RequestMapping("outLine")
public R outLine(){
return cameraService.outLine(localIp);
}
/**
* 重启摄像机
*/
@RequestMapping("reboot/{id}")
public R reboot(@PathVariable("id") Long id){
Camera c = cameraService.getById(id);
return cameraService.rebootByLoginId(c);
}
/**
* 刷新4G信号强度
*/
@RequestMapping("/refreshRssi/{id}")
public R refreshRssiLevel(@PathVariable("id") Long id){
Camera c = cameraService.getById(id);
if(c.getStatus() == 0 || StringUtils.isBlank(c.getLoginId())){
return R.error("设备未在线");
}
int level = CameraUtil.get4gRssiLevel(new NativeLong(Long.parseLong(c.getLoginId())));
c.setRssiLevel(level);
cameraService.updateById(c);
return R.ok();
}
/**
* 查询摄像头重启数据
*/
@RequestMapping("/getautocfg/{id}")
public R getAutoCfg(@PathVariable("id") Long id){
int nCommand = NetEnums.EM_DEVICE_CFG_TYPE.DEVICE_CFG_AUTO_MAINTAIN;
Camera camera = cameraService.getById(id);
run_device_cfg cfg = new run_device_cfg();
// Object data = JSON.toJSON(cfg.getAutoCfg(new NativeLong(Long.parseLong(camera.getLoginId())),nCommand)).toString();
NetStructs.STU_CFG_AUTO_MAINTAIN cc = cfg.getAutoCfg(new NativeLong(Long.parseLong(camera.getLoginId())),nCommand);
Map<String,Object> data = new HashMap<>();
data.put("bEnable",cc.bEnable);
data.put("uWeekDay",cc.uWeekDay);
data.put("uHour",cc.uHour);
return R.ok().put("data", data);
}
/**
* 设置摄像头重启
*/
@RequestMapping("/setautocfg")
public R setAutoCfg(@RequestBody Map<String, Object> params){
int id = (Integer) params.get("id");
Camera camera = cameraService.getById(id);
run_device_cfg cfg = new run_device_cfg();
return cfg.setAutoFtpCfg(new NativeLong(Long.parseLong(camera.getLoginId())),
Integer.parseInt(params.get("bEnable").toString()),
Integer.parseInt(params.get("uHour").toString()),
Integer.parseInt(params.get("uWeekDay").toString()));
}
/**
* 获取日志
*/
@RequestMapping("/getloginfo")
public R getloginfo(@RequestParam Map<String, Object> params){
String id = (String) params.get("id");
String startTime = (String) params.get("startTime");
String endTime = (String) params.get("endTime");
Camera camera = cameraService.getById(id);
run_device_log_search logSearch = new run_device_log_search();
List<LogInfo> data = logSearch.logInfoSearchByTime(new NativeLong(Long.parseLong(camera.getLoginId())), startTime, endTime);
return R.ok().put("data",data);
}
/**
* 获取补光灯配置
*/
@RequestMapping("/getLigntCfg/{id}")
public R getLigntCfg(@PathVariable("id") Long id){
Camera camera = cameraService.getById(id);
run_device_cfg cfg = new run_device_cfg();
NativeLong loginID = new NativeLong(Long.parseLong(camera.getLoginId()));
Map<String,Object> map = cfg.getLigntCfg(loginID);
return R.ok().put("data",map);
}
/**
* 修改补光灯配置
*/
@RequestMapping("/setLightCfg")
public R setLightCfg(@RequestBody Map<String,Object> params){
Integer id = (Integer) params.get("id");
Integer emMode = Integer.parseInt((String) params.get("emMode"));
Integer nPreValue = (Integer) params.get("nPreValue");
Integer nBrightness = (Integer) params.get("nBrightness");
String startTime1 = (String) params.get("startTime1");
String startTime2 = (String) params.get("startTime2");
String endTime1 = (String) params.get("endTime1");
String endTime2 = (String) params.get("endTime2");
Camera camera = cameraService.getById(id);
run_device_cfg cfg = new run_device_cfg();
NativeLong nativeID = new NativeLong(Long.parseLong(camera.getLoginId()));
boolean flag = cfg.setLightCfg(nativeID, emMode, nPreValue, nBrightness, startTime1, endTime1, startTime2, endTime2);
if (flag){
return R.ok();
}
return R.error();
}
/**
* 校准时间
*/
@RequestMapping("/setNowTime/{id}")
public R setNowTime(@PathVariable("id")Long id){
Camera camera = cameraService.getById(id);
CameraUtil.setNowTime(new NativeLong(Long.parseLong(camera.getLoginId())));
return R.ok();
}
@RequestMapping("/getNetCfg")
public R getNetCfg(Long cameraId){
Camera camera = cameraService.getById(cameraId);
if(camera.getStatus() == 0){
return R.error("设备未在线");
}
CameraNetFtp cfg = cameraNetFtpService.getNetCfg(camera);
return R.ok().put("data",cfg);
}
@RequestMapping("/editNetCfg")
public R editNetCfg(@RequestBody CameraNetFtp cameraNetFtp){
Camera camera = cameraService.getOne(new QueryWrapper<Camera>().eq("devsn",cameraNetFtp.getDevsn()).eq("status","1"));
if(camera == null){
return R.error("设备未在线");
}
cameraNetFtp.setLoginId(camera.getLoginId());
return cameraNetFtpService.editNetCfg(cameraNetFtp);
}
@RequestMapping("/pullRtspPhoto")
public R pullRtspPhoto(){
cameraService.pullRtspPhoto();
return R.ok();
}
private final SimpleDateFormat sdf_pic = new SimpleDateFormat("yyyyMMddHHmmss");
private final SimpleDateFormat sdf_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private final SimpleDateFormat sdf_date = new SimpleDateFormat("yyyy-MM-dd");
@RequestMapping("/getPicJson")
public R getPicJson(@RequestParam Map<String, Object> params) throws Exception {
System.out.println("===================================");
// System.out.println(JSON.toJSONString(params));
if(params.containsKey("json")){
String serialNo = (String) params.get("SerialNo");
String json = (String) params.get("json");
String picture = (String) params.get("picture");
System.out.println("图片进来了");
System.out.println("serialNo="+serialNo);
JSONObject object = JSON.parseObject(json);
String timestamp_str = object.getJSONArray("Events").getJSONObject(0).getString("Timestamp");
long times = Long.parseLong(timestamp_str);
Date date = new Date(times * 1000);
String pic_date = sdf_date.format(date);
//图片名称 2022_10_13_13_15_00_序列号.jpg
String pic_name = getPicName(date)+"_"+serialNo+".jpg";
//保存路径
// String path = RuoYiConfig.getProfile() + File.separator+"upload"+File.separator+"myftp"+File.separator+ serialNo + File.separator + pic_date + File.separator;
String path = RuoYiConfig.getProfile() + File.separator+"upload"+File.separator+"myftp"+File.separator+ "img" + File.separator + serialNo + File.separator;
File file = new File(path);
//判断是否需要创建文件夹
if (!file.exists()) {
file.mkdirs();
}
boolean r = Base64Utils.GenerateImage(picture,path+pic_name);
System.out.println("图片保存结果为"+r);
}
return R.ok();
}
public String getPicName(Date date) throws ParseException {
List<String> arr = Arrays.asList("4","9");
String datetime_str = sdf_time.format(date);
String newDatetimeStr = datetime_str.substring(0,16)+":00";
Date newDate = DateUtils.parseDate(newDatetimeStr,"yyyy-MM-dd HH:mm:ss");
//m 分的末位
String m = newDatetimeStr.substring(15,16);
if(arr.contains(m)){
return sdf_pic.format(DateUtils.addMinutes(newDate,1));
}
return sdf_pic.format(newDate);
}
@RequestMapping("/addHttpCfg")
public R addHttpCfg(Long id){
Camera camera = cameraService.getById(id);
run_device_cfg cfg = new run_device_cfg();
NativeLong loginID = new NativeLong(Long.parseLong(camera.getLoginId()));
cfg.addHttpCfg(loginID,"121.40.203.197");
return R.ok();
}
@RequestMapping("/getHttpCfg")
public R getHttpCfg(Long id){
Camera camera = cameraService.getById(id);
run_device_cfg cfg = new run_device_cfg();
NativeLong loginID = new NativeLong(Long.parseLong(camera.getLoginId()));
cfg.getHttpCfg(loginID);
return R.ok();
}
@RequestMapping("/setHttpReverseRegister")
public R setHttpReverseRegister(Long id){
Camera camera = cameraService.getById(id);
run_device_cfg cfg = new run_device_cfg();
NativeLong loginID = new NativeLong(Long.parseLong(camera.getLoginId()));
cfg.initHttpReverseRegister(loginID);
return R.ok();
}
@RequestMapping("/getHttpReverseRegister")
public R getHttpReverseRegister(Long id){
Camera camera = cameraService.getById(id);
run_device_cfg cfg = new run_device_cfg();
NativeLong loginID = new NativeLong(Long.parseLong(camera.getLoginId()));
Map<String, Object> map = cfg.getHttpReverseRegister(loginID);
return R.ok().put("data",map);
}
@RequestMapping("/clearHttpReverseRegister")
public R clearHttpReverseRegister(Long id){
Camera camera = cameraService.getById(id);
run_device_cfg cfg = new run_device_cfg();
NativeLong loginID = new NativeLong(Long.parseLong(camera.getLoginId()));
Map<String, Object> map = cfg.clearHttpReverseRegister(loginID);
return R.ok().put("data",map);
}
}

105
ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/CameraBrandController.java

@ -1,105 +0,0 @@ @@ -1,105 +0,0 @@
package com.ruoyi.code.camera.controller;
import com.ruoyi.code.camera.domain.CameraBrand;
import com.ruoyi.code.camera.service.ICameraBrandService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* brandController
*
* @author ruoyi
* @date 2022-09-26
*/
@RestController
@RequestMapping("/web/brand")
public class CameraBrandController extends BaseController
{
@Resource
private ICameraBrandService cameraBrandService;
/**
* 查询列表
*/
@PreAuthorize("@ss.hasPermi('web:brand:list')")
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
return cameraBrandService.queryPage(params);
}
/**
* 查询列表 不带分页
*/
@RequestMapping("/brands")
public R listBrand(){
return R.ok().put("data",cameraBrandService.list());
}
/**
* 获取详细信息
*/
@RequestMapping("/info/{id}")
@PreAuthorize("@ss.hasPermi('web:brand:query')")
public R info(@PathVariable("id") Long id){
CameraBrand cameraBrand = cameraBrandService.getById(id);
return R.ok().put("data", cameraBrand);
}
/**
* 导出列表
*/
@PreAuthorize("@ss.hasPermi('web:brand:export')")
@Log(title = "列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CameraBrand cameraBrand)
{
List<CameraBrand> list = cameraBrandService.list();
ExcelUtil<CameraBrand> util = new ExcelUtil<CameraBrand>(CameraBrand.class);
util.exportExcel(response, list, "列表数据");
}
/**
* 新增
*/
@RequestMapping("/add")
@Log(title = "CameraBrand", businessType = BusinessType.INSERT)
@PreAuthorize("@ss.hasPermi('web:brand:add')")
public R add(@RequestBody CameraBrand cameraBrand){
cameraBrandService.save(cameraBrand);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/edit")
@PreAuthorize("@ss.hasPermi('web:brand:edit')")
@Log(title = "CameraBrand", businessType = BusinessType.UPDATE)
public R edit(@RequestBody CameraBrand cameraBrand){
cameraBrandService.updateById(cameraBrand);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete/{ids}")
@PreAuthorize("@ss.hasPermi('web:brand:remove')")
@Log(title = "CameraBrand", businessType = BusinessType.DELETE)
public R delete(@PathVariable Long[] ids){
cameraBrandService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}

407
ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/CameraController.java

@ -1,12 +1,8 @@ @@ -1,12 +1,8 @@
package com.ruoyi.code.camera.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.code.camera.domain.Camera;
import com.ruoyi.code.camera.domain.CameraParams;
import com.ruoyi.code.camera.domain.LogInfo;
import com.ruoyi.code.camera.service.ICameraService;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.R;
@ -20,7 +16,10 @@ import org.springframework.security.access.prepost.PreAuthorize; @@ -20,7 +16,10 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import sdk.java.lib.netmanager.NetEnums;
import sdk.java.lib.netmanager.NetStructs;
import utils.*;
import utils.CameraUtil;
import utils.RegisterUtil;
import utils.run_device_cfg;
import utils.run_device_log_search;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@ -45,9 +44,6 @@ public class CameraController extends BaseController @@ -45,9 +44,6 @@ public class CameraController extends BaseController
@Value("${serverip}")
private String serverIp;
@Value("${localip}")
private String localIp;
/**
* 查询列表
*/
@ -110,244 +106,165 @@ public class CameraController extends BaseController @@ -110,244 +106,165 @@ public class CameraController extends BaseController
@PreAuthorize("@ss.hasPermi('web:camera:remove')")
@Log(title = "Camera", businessType = BusinessType.DELETE)
public R delete(@PathVariable Long[] ids){
List<Camera> list = cameraService.list(new QueryWrapper<Camera>().in("id",Arrays.asList(ids)));
list.forEach(d ->d.setDelFlag("1"));
cameraService.updateBatchById(list);
cameraService.removeByIds(Arrays.asList(ids));
return R.ok();
}
@RequestMapping("register")
public R register(){
return cameraService.register(localIp);
}
@RequestMapping("outLine")
public R outLine(){
return cameraService.outLine(localIp);
}
@RequestMapping("reboot/{id}")
public R reboot(@PathVariable("id") Long id){
Camera c = cameraService.getById(id);
return cameraService.rebootByLoginId(c);
}
@RequestMapping("showVideo/{id}")
public R showVideo(HttpServletRequest request,@PathVariable("id") Long id){
//解析ip地址,非服务器ip禁止打开视频
String ip = IPUtils.getIpAddr(request);
List<String> ipArr = Arrays.asList(serverIp,"127.0.0.1");
System.out.println("show video ip : " + ip);
if(ipArr.contains(ip)) {
Camera c = cameraService.getById(id);
System.out.println("show loginID:" + c.getLoginId());
RegisterUtil window = new RegisterUtil(localIp);
window.m_frame.setVisible(true);
window.showVideo(new NativeLong(Long.parseLong(c.getLoginId())));
return R.ok();
}
return R.error("请在服务器上查看视频");
}
/**
* 查询摄像头未绑定站点的
*/
@RequestMapping("/cameraNoList")
public R getCameraList(){
return R.ok().put("data",cameraService.getCameraList());
}
/**
* 根据站点表的id查询摄像头信息
*/
@RequestMapping("/cameraBySid/{sid}")
public R getCameraBySid(@PathVariable("sid") Long sid) {
return R.ok().put("data",cameraService.getCameraBySid(sid));
}
/**
* 刷新4G信号强度
*/
@RequestMapping("/refreshRssi/{id}")
public R refreshRssiLevel(@PathVariable("id") Long id){
Camera c = cameraService.getById(id);
if(c.getStatus() == 0 || StringUtils.isBlank(c.getLoginId())){
return R.error("设备未在线");
}
int level = CameraUtil.get4gRssiLevel(new NativeLong(Long.parseLong(c.getLoginId())));
c.setRssiLevel(level);
cameraService.updateById(c);
return R.ok();
}
/**
* 查询摄像头重启数据
*/
@RequestMapping("/getautocfg/{id}")
public R getAutoCfg(@PathVariable("id") Long id){
int nCommand = NetEnums.EM_DEVICE_CFG_TYPE.DEVICE_CFG_AUTO_MAINTAIN;
Camera camera = cameraService.getById(id);
run_device_cfg cfg = new run_device_cfg();
// Object data = JSON.toJSON(cfg.getAutoCfg(new NativeLong(Long.parseLong(camera.getLoginId())),nCommand)).toString();
NetStructs.STU_CFG_AUTO_MAINTAIN cc = cfg.getAutoCfg(new NativeLong(Long.parseLong(camera.getLoginId())),nCommand);
Map<String,Object> data = new HashMap<>();
data.put("bEnable",cc.bEnable);
data.put("uWeekDay",cc.uWeekDay);
data.put("uHour",cc.uHour);
return R.ok().put("data", data);
}
/**
* 设置摄像头重启
*/
@RequestMapping("/setautocfg")
public R setAutoCfg(@RequestBody Map<String, Object> params){
int id = (Integer) params.get("id");
Camera camera = cameraService.getById(id);
run_device_cfg cfg = new run_device_cfg();
return cfg.setAutoFtpCfg(new NativeLong(Long.parseLong(camera.getLoginId())),
Integer.parseInt(params.get("bEnable").toString()),
Integer.parseInt(params.get("uHour").toString()),
Integer.parseInt(params.get("uWeekDay").toString()));
}
/**
* 获取日志
*/
@RequestMapping("/getloginfo")
public R getloginfo(@RequestParam Map<String, Object> params){
String id = (String) params.get("id");
String startTime = (String) params.get("startTime");
String endTime = (String) params.get("endTime");
Camera camera = cameraService.getById(id);
run_device_log_search logSearch = new run_device_log_search();
List<LogInfo> data = logSearch.logInfoSearchByTime(new NativeLong(Long.parseLong(camera.getLoginId())), startTime, endTime);
return R.ok().put("data",data);
}
@RequestMapping("/getLigntCfg/{id}")
public R getLigntCfg(@PathVariable("id") Long id){
Camera camera = cameraService.getById(id);
run_device_cfg cfg = new run_device_cfg();
NativeLong loginID = new NativeLong(Long.parseLong(camera.getLoginId()));
Map<String,Object> map = cfg.getLigntCfg(loginID);
return R.ok().put("data",map);
}
@RequestMapping("/setLightCfg")
public R setLightCfg(@RequestBody Map<String,Object> params){
Integer id = (Integer) params.get("id");
Integer emMode = Integer.parseInt((String) params.get("emMode"));
Integer nPreValue = (Integer) params.get("nPreValue");
Integer nBrightness = (Integer) params.get("nBrightness");
String startTime1 = (String) params.get("startTime1");
String startTime2 = (String) params.get("startTime2");
String endTime1 = (String) params.get("endTime1");
String endTime2 = (String) params.get("endTime2");
Camera camera = cameraService.getById(id);
run_device_cfg cfg = new run_device_cfg();
NativeLong nativeID = new NativeLong(Long.parseLong(camera.getLoginId()));
boolean flag = cfg.setLightCfg(nativeID, emMode, nPreValue, nBrightness, startTime1, endTime1, startTime2, endTime2);
if (flag){
return R.ok();
}
return R.error();
}
@RequestMapping("/setNowTime/{id}")
public R setNowTime(@PathVariable("id")Long id){
Camera camera = cameraService.getById(id);
CameraUtil.setNowTime(new NativeLong(Long.parseLong(camera.getLoginId())));
return R.ok();
}
@RequestMapping("/retartPullM3u8")
public R retartPullM3u8(){
List<Camera> list = cameraService.list(new QueryWrapper<Camera>().eq("access_type","1").eq("status","1"));
if(list.isEmpty()){
return R.error("设备未在线");
}
RtspConvert convert = new RtspConvert();
convert.closeAllProcess();
for (Camera camera : list) {
try {
String m3u8 = convert.rtsp2Hls(camera.getIp(), camera.getUsername(), camera.getPassword());
System.out.println(camera.getIp() +" m3u8 = " + m3u8);
Thread.sleep(2000);
} catch (Exception e) {
logger.error(camera.getIp() + "拉流失败");
logger.error(e.getMessage());
}
}
return R.ok();
}
@RequestMapping("/getHttpReverseRegister/{id}")
public R getHttpReverseRegister(@PathVariable("id") Long id){
Camera camera = cameraService.getById(id);
run_device_cfg cfg = new run_device_cfg();
NativeLong loginID = new NativeLong(Long.parseLong(camera.getLoginId()));
Map<String,Object> map = cfg.getHttpReverseRegister(loginID);
return R.ok().put("data",map);
}
@RequestMapping("/setHttpReverseRegister")
public R setHttpReverseRegister(@RequestBody Map<String,Object> params){
Integer id = (Integer) params.get("id");
int bEnable = Integer.parseInt((String) params.get("bEnable"));
String heartUrl = (String) params.get("heartUrl");
String pushPicUrl = (String) params.get("pushPicUrl");
int heartbeatInterval = (Integer) params.get("heartbeatInterval");
Camera camera = cameraService.getById(id);
run_device_cfg cfg = new run_device_cfg();
NativeLong nativeID = new NativeLong(Long.parseLong(camera.getLoginId()));
return cfg.setHttpReverseRegister(nativeID, bEnable, heartUrl, pushPicUrl, heartbeatInterval);
}
@RequestMapping("/setConfig")
public R setConfig(@RequestBody Map<String,Object> params){
Integer id = (Integer) params.get("id");
String lStart = (String)params.get("lstart");
String cLen = (String)params.get("clen");
String tLen = (String)params.get("tlen");
String cP = (String)params.get("cp");
Map<String,Object> map = new HashMap<>();
if(StringUtils.isNotBlank(lStart)){
map.put("l_start",Double.valueOf(lStart));
}
if(StringUtils.isNotBlank(cLen)){
map.put("c_len",Double.valueOf(cLen));
}
if(StringUtils.isNotBlank(tLen)){
map.put("t_len",Double.valueOf(tLen));
}
if(StringUtils.isNotBlank(cP)){
map.put("c_p",Double.valueOf(cP));
}
String paramsStr = JSON.toJSONString(map);
Camera camera = cameraService.getById(id);
if(paramsStr.length() > 5){
camera.setParams(paramsStr);
}else{
camera.setParams(null);
}
cameraService.updateById(camera);
return R.ok();
}
//
// @RequestMapping("register")
// public R register(){
// return cameraService.register();
// }
//
//
// @RequestMapping("outLine")
// public R outLine(){
// return cameraService.outLine();
// }
//
// @RequestMapping("reboot/{id}")
// public R reboot(@PathVariable("id") Long id){
// Camera c = cameraService.getById(id);
// return cameraService.rebootByLoginId(c);
// }
//
//
// @RequestMapping("showVideo/{id}")
// public R showVideo(HttpServletRequest request,@PathVariable("id") Long id){
// //解析ip地址,非服务器ip禁止打开视频
// String ip = IPUtils.getIpAddr(request);
// List<String> ipArr = Arrays.asList(serverIp,"127.0.0.1");
// System.out.println("show video ip : " + ip);
// if(ipArr.contains(ip)) {
// Camera c = cameraService.getById(id);
// System.out.println("show loginID:" + c.getLoginId());
// RegisterUtil window = new RegisterUtil();
// window.m_frame.setVisible(true);
// window.showVideo(new NativeLong(Long.parseLong(c.getLoginId())));
// return R.ok();
// }
// return R.error("请在服务器上查看视频");
// }
//
// /**
// * 查询摄像头未绑定站点的
// */
// @RequestMapping("/cameraNoList")
// public R getCameraList(){
// return R.ok().put("data",cameraService.getCameraList());
// }
//
// /**
// * 根据站点表的id查询摄像头信息
// */
// @RequestMapping("/cameraBySid/{sid}")
// public R getCameraBySid(@PathVariable("sid") Long sid) {
// return R.ok().put("data",cameraService.getCameraBySid(sid));
// }
//
// /**
// * 刷新4G信号强度
// */
// @RequestMapping("/refreshRssi/{id}")
// public R refreshRssiLevel(@PathVariable("id") Long id){
// Camera c = cameraService.getById(id);
// if(c.getStatus() == 0 || StringUtils.isBlank(c.getLoginId())){
// return R.error("设备未在线");
// }
// int level = CameraUtil.get4gRssiLevel(new NativeLong(Long.parseLong(c.getLoginId())));
// c.setRssiLevel(level);
// cameraService.updateById(c);
// return R.ok();
// }
// /**
// * 查询摄像头重启数据
// */
// @RequestMapping("/getautocfg/{id}")
// public R getAutoCfg(@PathVariable("id") Long id){
//
// int nCommand = NetEnums.EM_DEVICE_CFG_TYPE.DEVICE_CFG_AUTO_MAINTAIN;
// Camera camera = cameraService.getById(id);
//
// run_device_cfg cfg = new run_device_cfg();
//// Object data = JSON.toJSON(cfg.getAutoCfg(new NativeLong(Long.parseLong(camera.getLoginId())),nCommand)).toString();
// NetStructs.STU_CFG_AUTO_MAINTAIN cc = cfg.getAutoCfg(new NativeLong(Long.parseLong(camera.getLoginId())),nCommand);
// Map<String,Object> data = new HashMap<>();
// data.put("bEnable",cc.bEnable);
// data.put("uWeekDay",cc.uWeekDay);
// data.put("uHour",cc.uHour);
// return R.ok().put("data", data);
// }
// /**
// * 设置摄像头重启
// */
// @RequestMapping("/setautocfg")
// public R setAutoCfg(@RequestBody Map<String, Object> params){
// int id = (Integer) params.get("id");
// Camera camera = cameraService.getById(id);
//
// run_device_cfg cfg = new run_device_cfg();
// return cfg.setAutoFtpCfg(new NativeLong(Long.parseLong(camera.getLoginId())),
// Integer.parseInt(params.get("bEnable").toString()),
// Integer.parseInt(params.get("uHour").toString()),
// Integer.parseInt(params.get("uWeekDay").toString()));
//
//
// }
// /**
// * 获取日志
// */
// @RequestMapping("/getloginfo")
// public R getloginfo(@RequestParam Map<String, Object> params){
//
// String id = (String) params.get("id");
// String startTime = (String) params.get("startTime");
// String endTime = (String) params.get("endTime");
//
// Camera camera = cameraService.getById(id);
//
// run_device_log_search logSearch = new run_device_log_search();
//
// List<LogInfo> data = logSearch.logInfoSearchByTime(new NativeLong(Long.parseLong(camera.getLoginId())), startTime, endTime);
//
// return R.ok().put("data",data);
//
// }
//
// @RequestMapping("/getLigntCfg/{id}")
// public R getLigntCfg(@PathVariable("id") Long id){
// Camera camera = cameraService.getById(id);
// run_device_cfg cfg = new run_device_cfg();
// NativeLong loginID = new NativeLong(Long.parseLong(camera.getLoginId()));
// Map<String,Object> map = cfg.getLigntCfg(loginID);
// return R.ok().put("data",map);
// }
//
// @RequestMapping("/setLightCfg")
// public R setLightCfg(@RequestBody Map<String,Object> params){
// Integer id = (Integer) params.get("id");
// Integer emMode = Integer.parseInt((String) params.get("emMode"));
// Integer nPreValue = (Integer) params.get("nPreValue");
// Integer nBrightness = (Integer) params.get("nBrightness");
// String startTime1 = (String) params.get("startTime1");
// String startTime2 = (String) params.get("startTime2");
// String endTime1 = (String) params.get("endTime1");
// String endTime2 = (String) params.get("endTime2");
//
// Camera camera = cameraService.getById(id);
// run_device_cfg cfg = new run_device_cfg();
// NativeLong nativeID = new NativeLong(Long.parseLong(camera.getLoginId()));
//
// boolean flag = cfg.setLightCfg(nativeID, emMode, nPreValue, nBrightness, startTime1, endTime1, startTime2, endTime2);
// if (flag){
// return R.ok();
// }
// return R.error();
// }
//
// @RequestMapping("/setNowTime/{id}")
// public R setNowTime(@PathVariable("id")Long id){
// Camera camera = cameraService.getById(id);
// CameraUtil.setNowTime(new NativeLong(Long.parseLong(camera.getLoginId())));
// return R.ok();
// }
}

38
ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/CameraNetFtpController.java

@ -51,25 +51,25 @@ public class CameraNetFtpController extends BaseController @@ -51,25 +51,25 @@ public class CameraNetFtpController extends BaseController
return cameraNetFtpService.queryPage(params);
}
@RequestMapping("/getNetCfg")
public R getNetCfg(Long cameraId){
Camera camera = cameraService.getById(cameraId);
if(camera.getStatus() == 0){
return R.error("设备未在线");
}
CameraNetFtp cfg = cameraNetFtpService.getNetCfg(camera);
return R.ok().put("data",cfg);
}
@RequestMapping("/editNetCfg")
public R editNetCfg(@RequestBody CameraNetFtp cameraNetFtp){
Camera camera = cameraService.getOne(new QueryWrapper<Camera>().eq("devsn",cameraNetFtp.getDevsn()).eq("status","1"));
if(camera == null){
return R.error("设备未在线");
}
cameraNetFtp.setLoginId(camera.getLoginId());
return cameraNetFtpService.editNetCfg(cameraNetFtp);
}
// @RequestMapping("/getNetCfg")
// public R getNetCfg(Long cameraId){
// Camera camera = cameraService.getById(cameraId);
// if(camera.getStatus() == 0){
// return R.error("设备未在线");
// }
// CameraNetFtp cfg = cameraNetFtpService.getNetCfg(camera);
// return R.ok().put("data",cfg);
// }
//
// @RequestMapping("/editNetCfg")
// public R editNetCfg(@RequestBody CameraNetFtp cameraNetFtp){
// Camera camera = cameraService.getOne(new QueryWrapper<Camera>().eq("devsn",cameraNetFtp.getDevsn()).eq("status","1"));
// if(camera == null){
// return R.error("设备未在线");
// }
// cameraNetFtp.setLoginId(camera.getLoginId());
// return cameraNetFtpService.editNetCfg(cameraNetFtp);
// }
/**

25
ruoyi-code/src/main/java/com/ruoyi/code/camera/domain/Camera.java

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
package com.ruoyi.code.camera.domain;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.utils.StringUtils;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@ -63,23 +63,4 @@ public class Camera implements Serializable @@ -63,23 +63,4 @@ public class Camera implements Serializable
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
private Long platformId;
/** 接入方式 0-4G/5G 1-网络 */
private Long accessType;
/** 摄像机品牌,关联品牌表 */
private Long brand;
private String delFlag;
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String params;
public CameraParams getParamsObject(){
if(StringUtils.isNotBlank(this.params)) {
return JSON.parseObject(this.params, CameraParams.class);
}
return new CameraParams();
}
}

39
ruoyi-code/src/main/java/com/ruoyi/code/camera/domain/CameraBrand.java

@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
package com.ruoyi.code.camera.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableId;
import com.ruoyi.common.annotation.Excel;
import java.io.Serializable;
import lombok.Data;
/**
* brand对象 camera_brand
*
* @author ruoyi
* @date 2022-09-26
*/
@Data
@TableName("camera_brand")
public class CameraBrand implements Serializable
{
private static final long serialVersionUID = 1L;
/** id */
@TableId(type = IdType.INPUT)
private Long id;
/** 品牌名称 */
private String name;
/** 品牌型号 */
private String model;
/** rtsp地址 */
private String rtsp;
}

15
ruoyi-code/src/main/java/com/ruoyi/code/camera/domain/CameraParams.java

@ -1,15 +0,0 @@ @@ -1,15 +0,0 @@
package com.ruoyi.code.camera.domain;
import lombok.Data;
@Data
public class CameraParams {
/** */
private Double lstart;
/** 某一时刻水位+水位上水尺长度,单位m */
private Double tlen;
/** 某一时刻水面上水尺长度(单位米)*/
private Double clen;
/** 和水面上的水尺长度对应像素 */
private Double cp;
}

18
ruoyi-code/src/main/java/com/ruoyi/code/camera/mapper/CameraBrandMapper.java

@ -1,18 +0,0 @@ @@ -1,18 +0,0 @@
package com.ruoyi.code.camera.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import com.ruoyi.code.camera.domain.CameraBrand;
/**
* Mapper接口
*
* @author ruoyi
* @date 2022-09-26
*/
@Mapper
public interface CameraBrandMapper extends BaseMapper<CameraBrand>
{
}

122
ruoyi-code/src/main/java/com/ruoyi/code/camera/scheduled/RegisterServer.java

@ -1,64 +1,60 @@ @@ -1,64 +1,60 @@
package com.ruoyi.code.camera.scheduled;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.code.camera.domain.Camera;
import com.ruoyi.code.camera.service.ICameraService;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.IPUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.List;
/*@Author: tongw
*@CreateDate: 2020/8/11 8:58
*@Description:
**/
@Component
@Configuration
@EnableScheduling
public class RegisterServer {
private static String localip = "";
private static String accessmode = "";
@Autowired
private Environment env;
@PostConstruct
public void config() {
localip = env.getProperty("localip");
accessmode = env.getProperty("accessmode");
}
@Autowired
private ICameraService cameraService;
@Scheduled(initialDelay = 5000, fixedRate = Long.MAX_VALUE)
public void synStart(){
start();
}
private void start(){
//package com.ruoyi.code.camera.scheduled;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
//import com.ruoyi.code.camera.domain.Camera;
//import com.ruoyi.code.camera.service.ICameraService;
//import com.ruoyi.common.core.page.R;
//import com.ruoyi.common.utils.IPUtils;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.env.Environment;
//import org.springframework.scheduling.annotation.EnableScheduling;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.PostConstruct;
//import java.util.ArrayList;
//import java.util.List;
//
///*@Author: tongw
// *@CreateDate: 2020/8/11 8:58
// *@Description:
// **/
//
//@Component
//@Configuration
//@EnableScheduling
//public class RegisterServer {
// private static String sercer_ip = "";
//
// @Autowired
// private Environment env;
//
// @PostConstruct
// public void config() {
// sercer_ip = env.getProperty("localip");
// }
// @Autowired
// private ICameraService cameraService;
//
// @Scheduled(initialDelay = 5000, fixedRate = Long.MAX_VALUE)
// public void synStart(){
// start();
// }
//
// private void start(){
// String ip = IPUtils.getLocalIpAddress();
String ip = "192.168.16.219";
System.out.println(ip);
if(localip.equals(ip) && "0".equals(accessmode)){
R result = cameraService.register(localip);
if("0".equals(result.get("code").toString())){
System.out.println("主动注册服务已启动");
}else{
System.out.println("主动注册服务启动失败");
}
}
}
}
// if(sercer_ip.equals(ip)){
// R result = cameraService.register();
// if("0".equals(result.get("code").toString())){
// System.out.println("主动注册服务已启动");
// }else{
// System.out.println("主动注册服务启动失败");
// }
// }
// }
//
//}

36
ruoyi-code/src/main/java/com/ruoyi/code/camera/scheduled/RtspScreenshotTask.java

@ -1,36 +0,0 @@ @@ -1,36 +0,0 @@
package com.ruoyi.code.camera.scheduled;
import com.ruoyi.code.camera.service.ICameraService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
@Component
@Configuration
@EnableScheduling
public class RtspScreenshotTask {
private static String accessmode = "";
@Autowired
private Environment env;
@PostConstruct
public void config() {
accessmode = env.getProperty("accessmode");
}
@Autowired
private ICameraService cameraService;
@Scheduled(cron = "0 0/5 * * * ?")
public void rtspScreenshot(){
if("1".equals(accessmode)){
cameraService.pullRtspPhoto();
}
}
}

21
ruoyi-code/src/main/java/com/ruoyi/code/camera/service/ICameraBrandService.java

@ -1,21 +0,0 @@ @@ -1,21 +0,0 @@
package com.ruoyi.code.camera.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.page.R;
import java.util.Map;
import com.ruoyi.code.camera.domain.CameraBrand;
/**
* Service接口
*
* @author ruoyi
* @date 2022-09-26
*/
public interface ICameraBrandService extends IService<CameraBrand>
{
/**
* 查询
*/
R queryPage(Map<String, Object> params);
}

6
ruoyi-code/src/main/java/com/ruoyi/code/camera/service/ICameraService.java

@ -20,11 +20,11 @@ public interface ICameraService extends IService<Camera> @@ -20,11 +20,11 @@ public interface ICameraService extends IService<Camera>
*/
R queryPage(Map<String, Object> params);
R register(String localIp);
R register();
R rebootByLoginId(Camera c);
R outLine(String localIp);
R outLine();
void online(String ip,int port,String username,String password,String devsn,String loginID);
@ -33,6 +33,4 @@ public interface ICameraService extends IService<Camera> @@ -33,6 +33,4 @@ public interface ICameraService extends IService<Camera>
List<Camera> getCameraList();
Camera getCameraBySid(Long sid);
void pullRtspPhoto();
}

33
ruoyi-code/src/main/java/com/ruoyi/code/camera/service/impl/CameraBrandServiceImpl.java

@ -1,33 +0,0 @@ @@ -1,33 +0,0 @@
package com.ruoyi.code.camera.service.impl;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.Query;
import org.springframework.stereotype.Service;
import com.ruoyi.code.camera.mapper.CameraBrandMapper;
import com.ruoyi.code.camera.domain.CameraBrand;
import com.ruoyi.code.camera.service.ICameraBrandService;
/**
* Service业务层处理
*
* @author ruoyi
* @date 2022-09-26
*/
@Service("cameraBrandService")
public class CameraBrandServiceImpl extends ServiceImpl<CameraBrandMapper, CameraBrand> implements ICameraBrandService
{
@Override
public R queryPage(Map<String, Object> params) {
IPage<CameraBrand> page = this.page(
new Query<CameraBrand>().getPage(params),
new QueryWrapper<CameraBrand>()
);
return R.ok().put("count", page.getTotal()).put("data", page.getRecords());
}
}

60
ruoyi-code/src/main/java/com/ruoyi/code/camera/service/impl/CameraServiceImpl.java

@ -1,30 +1,20 @@ @@ -1,30 +1,20 @@
package com.ruoyi.code.camera.service.impl;
import cn.hutool.core.util.RuntimeUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.code.camera.domain.CameraBrand;
import com.ruoyi.code.camera.service.ICameraBrandService;
import com.ruoyi.code.sctaationinfo.domain.ScStationInfo;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.annotation.DeptDataScope;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.Query;
import com.ruoyi.code.camera.domain.Camera;
import com.ruoyi.code.camera.mapper.CameraMapper;
import com.ruoyi.code.camera.service.ICameraService;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.sun.jna.NativeLong;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import utils.CameraUtil;
import utils.RegisterUtil;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -38,28 +28,23 @@ import java.util.Map; @@ -38,28 +28,23 @@ import java.util.Map;
@Service("cameraService")
public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> implements ICameraService
{
@Autowired
private ICameraBrandService iCameraBrandService;
@Override
@DeptDataScope(deptAlias="s")
public R queryPage(Map<String, Object> params) {
IPage<Camera> page = baseMapper.queryPage(
new Query<Camera>().getPage(params),
params
);
return R.ok().put("count", page.getTotal()).put("data", page.getRecords());
}
@Override
public R register(String localIp){
public R register(){
//清空所有摄像机状态
List<Camera> list = list();
RegisterUtil window = new RegisterUtil(localIp);
RegisterUtil window = new RegisterUtil();
for (Camera c : list) {
if(StringUtils.isNotBlank(c.getLoginId())){
@ -70,9 +55,9 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> impleme @@ -70,9 +55,9 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> impleme
}
}
updateBatchById(list);
// //先停
//先停
window.onBtnStopRegServer();
// //再开
//再开
boolean result = window.onBtnStartRegServer();
if(result){
return R.ok("服务启动成功,请等待几分钟后重新使用");
@ -97,10 +82,10 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> impleme @@ -97,10 +82,10 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> impleme
}
@Override
public R outLine(String localIp){
public R outLine(){
//清空所有摄像机状态
List<Camera> list = list();
RegisterUtil window = new RegisterUtil(localIp);
RegisterUtil window = new RegisterUtil();
for (Camera c : list) {
if(StringUtils.isNotBlank(c.getLoginId())){
window.logout(new NativeLong(Long.parseLong(c.getLoginId())));
@ -158,35 +143,4 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> impleme @@ -158,35 +143,4 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> impleme
public Camera getCameraBySid(Long sid) {
return baseMapper.queryCameraBYSid(sid);
}
@Override
public void pullRtspPhoto(){
String path = RuoYiConfig.getProfile() + File.separator+"upload"+File.separator+"myftp"+File.separator;
String currentDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + File.separator;
String currentTime = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss").format(new Date()) + ".jpg";
List<Camera> list = list(new QueryWrapper<Camera>().eq("access_type","1"));
for (Camera camera : list) {
boolean isPing = HttpUtils.checkPing(camera.getIp());
System.out.println(camera.getIp()+" isPing = "+isPing);
if(isPing){
camera.setStatus(1);
CameraBrand cameraBrand = iCameraBrandService.getById(camera.getBrand());
String fileName = path + camera.getDevsn() + File.separator + currentDate;
File file = new File(fileName);
if (!file.exists()) {
file.mkdirs();
}
String ffmpeg = "ffmpeg -i rtsp://"+camera.getUsername()+":"+camera.getPassword()+"@"+camera.getIp()+cameraBrand.getRtsp()+" -y -f image2 -t 0.02 "+fileName+ camera.getDevsn() + "_"+currentTime+"";
System.out.println("ffmpeg="+ffmpeg);
RuntimeUtil.execForStr(ffmpeg);
}else{
camera.setStatus(0);
}
}
if(!list.isEmpty()){
updateBatchById(list);
}
System.out.println("ffmpeg 执行结束");
}
}

3
ruoyi-code/src/main/java/com/ruoyi/code/camera/service/impl/WaterPhotoInfoServiceImpl.java

@ -10,7 +10,6 @@ import com.ruoyi.code.camera.mapper.WaterPhotoInfoMapper; @@ -10,7 +10,6 @@ import com.ruoyi.code.camera.mapper.WaterPhotoInfoMapper;
import com.ruoyi.code.camera.service.IWaterPhotoInfoService;
import com.ruoyi.code.sctaationinfo.domain.ScStationInfo;
import com.ruoyi.code.sctaationinfo.service.IScStationInfoService;
import com.ruoyi.common.annotation.DeptDataScope;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.exception.RYException;
import com.ruoyi.common.utils.DateUtils;
@ -35,7 +34,6 @@ public class WaterPhotoInfoServiceImpl extends ServiceImpl<WaterPhotoInfoMapper, @@ -35,7 +34,6 @@ public class WaterPhotoInfoServiceImpl extends ServiceImpl<WaterPhotoInfoMapper,
private IScStationInfoService scStationInfoService;
@Override
@DeptDataScope(deptAlias = "s")
public R queryPage(Map<String, Object> params) {
String startTime = (String) params.get("startTime");
String endTime = (String) params.get("endTime");
@ -58,7 +56,6 @@ public class WaterPhotoInfoServiceImpl extends ServiceImpl<WaterPhotoInfoMapper, @@ -58,7 +56,6 @@ public class WaterPhotoInfoServiceImpl extends ServiceImpl<WaterPhotoInfoMapper,
}
@Override
@DeptDataScope(deptAlias = "s")
public R getScWaterCurrentDataList(Map<String, Object> params) {
IPage<WaterPhotoInfo> page = baseMapper.selectWaterCurrentDataList(
new Query<WaterPhotoInfo>().getPage(params),

113
ruoyi-code/src/main/java/com/ruoyi/code/rtudata/controller/RtuDataController.java

@ -1,113 +0,0 @@ @@ -1,113 +0,0 @@
package com.ruoyi.code.rtudata.controller;
import com.ruoyi.code.rtudata.domain.RtuData;
import com.ruoyi.code.rtudata.service.IRtuDataService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 数据列表Controller
*
* @author ruoyi
* @date 2024-01-17
*/
@RestController
@RequestMapping("/rtudata/rtudata")
public class RtuDataController extends BaseController
{
@Resource
private IRtuDataService rtuDataService;
/**
* 查询列表
*/
@PreAuthorize("@ss.hasPermi('rtudata:rtudata:list')")
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
return rtuDataService.queryPage(params);
}
/**
* 查询标签列表
*/
@PreAuthorize("@ss.hasPermi('rtudata:rtudata:list')")
@RequestMapping("/tabsList")
public R tabsList(){
return rtuDataService.tabsList();
}
/**
* 获取详细信息
*/
@RequestMapping("/info/{id}")
@PreAuthorize("@ss.hasPermi('rtudata:rtudata:query')")
public R info(@PathVariable("id") Long id){
RtuData rtuData = rtuDataService.getById(id);
return R.ok().put("data", rtuData);
}
/**
* 导出列表
*/
@PreAuthorize("@ss.hasPermi('rtudata:rtudata:export')")
@Log(title = "列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RtuData rtuData)
{
List<RtuData> list = rtuDataService.list();
ExcelUtil<RtuData> util = new ExcelUtil<RtuData>(RtuData.class);
util.exportExcel(response, list, "列表数据");
}
/**
* 新增
*/
@RequestMapping("/add")
@Log(title = "RtuData", businessType = BusinessType.INSERT)
@PreAuthorize("@ss.hasPermi('rtudata:rtudata:add')")
public R add(@RequestBody RtuData rtuData){
rtuDataService.save(rtuData);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/edit")
@PreAuthorize("@ss.hasPermi('rtudata:rtudata:edit')")
@Log(title = "RtuData", businessType = BusinessType.UPDATE)
public R edit(@RequestBody RtuData rtuData){
rtuDataService.updateById(rtuData);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete/{ids}")
@PreAuthorize("@ss.hasPermi('rtudata:rtudata:remove')")
@Log(title = "RtuData", businessType = BusinessType.DELETE)
public R delete(@PathVariable Long[] ids){
rtuDataService.removeByIds(Arrays.asList(ids));
return R.ok();
}
@RequestMapping("/getChart")
public R getChart(@RequestParam Map<String, Object> params){
Map<String, Object> map = rtuDataService.getChart(params);
return R.ok().put("data",map);
}
}

54
ruoyi-code/src/main/java/com/ruoyi/code/rtudata/domain/RtuData.java

@ -1,54 +0,0 @@ @@ -1,54 +0,0 @@
package com.ruoyi.code.rtudata.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 数据列表对象 rtu_data
*
* @author ruoyi
* @date 2024-01-17
*/
@Data
@TableName("rtu_data")
public class RtuData implements Serializable
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
@TableId(type = IdType.INPUT)
private Long id;
/** 遥测站地址 */
private Long sid;
/** 遥测站分类码 */
private String type;
/** 监测项 */
private String item;
/** 监测码 */
private String itemCode;
/** 监测值 */
private String val;
/** 单位 */
private String unit;
/** 观测时间 */
private Date dt;
/** 上报时间 */
private Date updDt;
/** 原始数据 */
private String originData;
}

28
ruoyi-code/src/main/java/com/ruoyi/code/rtudata/mapper/RtuDataMapper.java

@ -1,28 +0,0 @@ @@ -1,28 +0,0 @@
package com.ruoyi.code.rtudata.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.code.camera.domain.YcData;
import com.ruoyi.code.rtudata.domain.RtuData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* Mapper接口
*
* @author ruoyi
* @date 2024-01-17
*/
@Mapper
public interface RtuDataMapper extends BaseMapper<RtuData>
{
List<RtuData> tabsList();
List<Integer> getSids(@Param("params") Map<String, Object> params);
List<YcData> selectWaterData(@Param("params") Map<String, Object> params);
}

25
ruoyi-code/src/main/java/com/ruoyi/code/rtudata/service/IRtuDataService.java

@ -1,25 +0,0 @@ @@ -1,25 +0,0 @@
package com.ruoyi.code.rtudata.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.code.rtudata.domain.RtuData;
import com.ruoyi.common.core.page.R;
import java.util.Map;
/**
* Service接口
*
* @author ruoyi
* @date 2024-01-17
*/
public interface IRtuDataService extends IService<RtuData>
{
/**
* 查询
*/
R queryPage(Map<String, Object> params);
R tabsList();
Map<String, Object> getChart(Map<String, Object> params);
}

95
ruoyi-code/src/main/java/com/ruoyi/code/rtudata/service/impl/RtuDataServiceImpl.java

@ -1,95 +0,0 @@ @@ -1,95 +0,0 @@
package com.ruoyi.code.rtudata.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.code.camera.domain.ChartData;
import com.ruoyi.code.camera.domain.YcData;
import com.ruoyi.code.rtudata.domain.RtuData;
import com.ruoyi.code.rtudata.mapper.RtuDataMapper;
import com.ruoyi.code.rtudata.service.IRtuDataService;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.Query;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Service业务层处理
*
* @author ruoyi
* @date 2024-01-17
*/
@Service("rtuDataService")
public class RtuDataServiceImpl extends ServiceImpl<RtuDataMapper, RtuData> implements IRtuDataService
{
@Override
public R queryPage(Map<String, Object> params) {
IPage<RtuData> page = this.page(
new Query<RtuData>().getPage(params),
new QueryWrapper<RtuData>()
.eq(ObjectUtils.isNotEmpty(params.get("itemCode")),"item_code",params.get("itemCode"))
.ge(ObjectUtils.isNotEmpty(params.get("startTime")),"dt",params.get("startTime"))
.le(ObjectUtils.isNotEmpty(params.get("endTime")),"dt",params.get("endTime"))
.orderByDesc("dt")
);
return R.ok().put("count", page.getTotal()).put("data", page.getRecords());
}
@Override
public R tabsList() {
List<RtuData> list = baseMapper.tabsList();
return R.ok().put("data", list);
}
@Override
public Map<String, Object> getChart(Map<String, Object> params) {
Map<String, Object> map = new HashMap<>();
List<String> legend = new ArrayList<>();
List<ChartData> series = new ArrayList<>();
List<Integer> sids = baseMapper.getSids(params);
for (Integer sid : sids) {
params.put("sid", sid);
// 图表的数据
ChartData chartData = getChartOptionData(params);
if (chartData != null) {
series.add(chartData);
legend.add(chartData.getName());
}
}
map.put("legend",legend);
map.put("series",series);
return map;
}
public ChartData getChartOptionData(Map<String, Object> params){
ChartData data = null;
List<YcData> dataList = baseMapper.selectWaterData(params);
if(dataList != null && dataList.size()>0){
data = new ChartData();
data.setId(dataList.get(0).getId());
data.setName(dataList.get(0).getStnm());
String item = (String) params.get("item");
if (item.contains("降水量")){
data.setType("bar");
}else{
data.setType("line");
}
data.setData(formatChartData(dataList));
}
return data;
}
public List<Object> formatChartData(List<YcData> dataList){
List<Object> objs = new ArrayList<>();
for (int j = 0 ; j< dataList.size() ; j++){
objs.add(new Object[]{dataList.get(j).getClock()*1000,dataList.get(j).getValue()});
}
return objs;
}
}

37
ruoyi-code/src/main/java/com/ruoyi/code/sctaationinfo/controller/ScStationInfoController.java

@ -1,22 +1,30 @@ @@ -1,22 +1,30 @@
package com.ruoyi.code.sctaationinfo.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.util.List;
import java.util.Arrays;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import javax.annotation.Resource;
import com.ruoyi.code.camera.domain.Camera;
import com.ruoyi.code.sctaationinfo.domain.ScStationInfo;
import com.ruoyi.code.sctaationinfo.service.IScStationInfoService;
import com.ruoyi.common.core.page.R;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 水尺-测站信息Controller
*
@ -39,11 +47,6 @@ public class ScStationInfoController extends BaseController @@ -39,11 +47,6 @@ public class ScStationInfoController extends BaseController
return scStationInfoService.queryPage(params);
}
@RequestMapping("/listAll")
public R listAll(@RequestParam Map<String, Object> params){
return scStationInfoService.listAll(params);
}
/**
* 获取详细信息
*/
@ -98,9 +101,7 @@ public class ScStationInfoController extends BaseController @@ -98,9 +101,7 @@ public class ScStationInfoController extends BaseController
@PreAuthorize("@ss.hasPermi('system:info:remove')")
@Log(title = "ScStationInfo", businessType = BusinessType.DELETE)
public R delete(@PathVariable Long[] ids){
List<ScStationInfo> list = scStationInfoService.list(new QueryWrapper<ScStationInfo>().in("id",Arrays.asList(ids)));
list.forEach(d ->d.setDelFlag("1"));
scStationInfoService.updateBatchById(list);
scStationInfoService.removeByIds(Arrays.asList(ids));
return R.ok();
}

3
ruoyi-code/src/main/java/com/ruoyi/code/sctaationinfo/service/IScStationInfoService.java

@ -1,9 +1,11 @@ @@ -1,9 +1,11 @@
package com.ruoyi.code.sctaationinfo.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.code.camera.domain.Camera;
import com.ruoyi.code.sctaationinfo.domain.ScStationInfo;
import com.ruoyi.common.core.page.R;
import java.util.List;
import java.util.Map;
/**
@ -19,5 +21,4 @@ public interface IScStationInfoService extends IService<ScStationInfo> @@ -19,5 +21,4 @@ public interface IScStationInfoService extends IService<ScStationInfo>
*/
R queryPage(Map<String, Object> params);
R listAll(Map<String, Object> params);
}

21
ruoyi-code/src/main/java/com/ruoyi/code/sctaationinfo/service/impl/ScStationInfoServiceImpl.java

@ -1,21 +1,18 @@ @@ -1,21 +1,18 @@
package com.ruoyi.code.sctaationinfo.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.code.camera.domain.Camera;
import com.ruoyi.code.sctaationinfo.domain.ScStationInfo;
import com.ruoyi.code.sctaationinfo.mapper.ScStationInfoMapper;
import com.ruoyi.code.sctaationinfo.service.IScStationInfoService;
import com.ruoyi.common.annotation.DeptDataScope;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.Query;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* Service业务层处理
@ -27,7 +24,6 @@ import java.util.Map; @@ -27,7 +24,6 @@ import java.util.Map;
public class ScStationInfoServiceImpl extends ServiceImpl<ScStationInfoMapper, ScStationInfo> implements IScStationInfoService
{
@Override
@DeptDataScope(deptAlias="a")
public R queryPage(Map<String, Object> params) {
IPage<ScStationInfo> page = baseMapper.queryPage(
new Query<ScStationInfo>().getPage(params),
@ -37,16 +33,5 @@ public class ScStationInfoServiceImpl extends ServiceImpl<ScStationInfoMapper, S @@ -37,16 +33,5 @@ public class ScStationInfoServiceImpl extends ServiceImpl<ScStationInfoMapper, S
return R.ok().put("count", page.getTotal()).put("data", page.getRecords());
}
@Override
@DeptDataScope
public R listAll(Map<String, Object> params) {
String sql = (String)params.get("dataScope");
List<ScStationInfo> list = list(
new QueryWrapper<ScStationInfo>()
.eq("del_flag","0")
.last(StringUtils.isNotBlank(sql),sql));
return R.ok().put("data",list);
}
}

5
ruoyi-code/src/main/java/com/ruoyi/code/scwaterdata/domain/ScWaterData.java

@ -8,10 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableName; @@ -8,10 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
/**
@ -34,8 +31,6 @@ public class ScWaterData implements Serializable @@ -34,8 +31,6 @@ public class ScWaterData implements Serializable
private Long stnmId;
/** 时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date tm;
/** 水位值 */

98
ruoyi-code/src/main/java/com/ruoyi/code/warning/controller/WaAlarmController.java

@ -1,98 +0,0 @@ @@ -1,98 +0,0 @@
package com.ruoyi.code.warning.controller;
import com.ruoyi.code.warning.domain.WaAlarm;
import com.ruoyi.code.warning.service.IWaAlarmService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 预警管理Controller
*
* @author ruoyi
* @date 2022-09-19
*/
@RestController
@RequestMapping("/warning/alarm")
public class WaAlarmController extends BaseController
{
@Resource
private IWaAlarmService waAlarmService;
/**
* 查询列表
*/
@PreAuthorize("@ss.hasPermi('warning:alarm:list')")
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
return waAlarmService.queryPage(params);
}
/**
* 获取详细信息
*/
@RequestMapping("/info/{id}")
@PreAuthorize("@ss.hasPermi('warning:alarm:query')")
public R info(@PathVariable("id") Long id){
WaAlarm waAlarm = waAlarmService.getById(id);
return R.ok().put("data", waAlarm);
}
/**
* 导出列表
*/
@PreAuthorize("@ss.hasPermi('warning:alarm:export')")
@Log(title = "列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaAlarm waAlarm)
{
List<WaAlarm> list = waAlarmService.list();
ExcelUtil<WaAlarm> util = new ExcelUtil<WaAlarm>(WaAlarm.class);
util.exportExcel(response, list, "列表数据");
}
/**
* 新增
*/
@RequestMapping("/add")
@Log(title = "WaAlarm", businessType = BusinessType.INSERT)
@PreAuthorize("@ss.hasPermi('warning:alarm:add')")
public R add(@RequestBody WaAlarm waAlarm){
waAlarmService.save(waAlarm);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/edit")
@PreAuthorize("@ss.hasPermi('warning:alarm:edit')")
@Log(title = "WaAlarm", businessType = BusinessType.UPDATE)
public R edit(@RequestBody WaAlarm waAlarm){
waAlarmService.updateById(waAlarm);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete/{ids}")
@PreAuthorize("@ss.hasPermi('warning:alarm:remove')")
@Log(title = "WaAlarm", businessType = BusinessType.DELETE)
public R delete(@PathVariable Long[] ids){
waAlarmService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}

96
ruoyi-code/src/main/java/com/ruoyi/code/warning/controller/WaEmployeeController.java

@ -1,96 +0,0 @@ @@ -1,96 +0,0 @@
package com.ruoyi.code.warning.controller;
import com.ruoyi.code.warning.domain.WaEmployee;
import com.ruoyi.code.warning.service.IWaEmployeeService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 人员管理Controller
*
* @author ruoyi
* @date 2022-09-19
*/
@RestController
@RequestMapping("/warning/employee")
public class WaEmployeeController extends BaseController
{
@Resource
private IWaEmployeeService waEmployeeService;
/**
* 查询列表
*/
@PreAuthorize("@ss.hasPermi('warning:employee:list')")
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
return waEmployeeService.queryPage(params);
}
/**
* 获取详细信息
*/
@RequestMapping("/info/{id}")
@PreAuthorize("@ss.hasPermi('warning:employee:query')")
public R info(@PathVariable("id") Long id){
WaEmployee waEmployee = waEmployeeService.getById(id);
return R.ok().put("data", waEmployee);
}
/**
* 导出列表
*/
@PreAuthorize("@ss.hasPermi('warning:employee:export')")
@Log(title = "列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaEmployee waEmployee)
{
List<WaEmployee> list = waEmployeeService.list();
ExcelUtil<WaEmployee> util = new ExcelUtil<WaEmployee>(WaEmployee.class);
util.exportExcel(response, list, "列表数据");
}
/**
* 新增
*/
@RequestMapping("/add")
@Log(title = "WaEmployee", businessType = BusinessType.INSERT)
@PreAuthorize("@ss.hasPermi('warning:employee:add')")
public R add(@RequestBody WaEmployee waEmployee){
waEmployeeService.save(waEmployee);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/edit")
@PreAuthorize("@ss.hasPermi('warning:employee:edit')")
@Log(title = "WaEmployee", businessType = BusinessType.UPDATE)
public R edit(@RequestBody WaEmployee waEmployee){
waEmployeeService.updateById(waEmployee);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete/{ids}")
@PreAuthorize("@ss.hasPermi('warning:employee:remove')")
@Log(title = "WaEmployee", businessType = BusinessType.DELETE)
public R delete(@PathVariable Long[] ids){
return waEmployeeService.delByIds(Arrays.asList(ids));
}
}

96
ruoyi-code/src/main/java/com/ruoyi/code/warning/controller/WaMessageController.java

@ -1,96 +0,0 @@ @@ -1,96 +0,0 @@
package com.ruoyi.code.warning.controller;
import com.ruoyi.code.warning.domain.WaMessage;
import com.ruoyi.code.warning.service.IWaMessageService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 短信管理Controller
*
* @author ruoyi
* @date 2022-09-19
*/
@RestController
@RequestMapping("/warning/message")
public class WaMessageController extends BaseController
{
@Resource
private IWaMessageService waMessageService;
/**
* 查询列表
*/
@PreAuthorize("@ss.hasPermi('warning:message:list')")
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
return waMessageService.queryPage(params);
}
/**
* 获取详细信息
*/
@RequestMapping("/info/{id}")
@PreAuthorize("@ss.hasPermi('warning:message:query')")
public R info(@PathVariable("id") Long id){
WaMessage waMessage = waMessageService.selectById(id);
return R.ok().put("data", waMessage);
}
/**
* 导出列表
*/
@PreAuthorize("@ss.hasPermi('warning:message:export')")
@Log(title = "列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaMessage waMessage)
{
List<WaMessage> list = waMessageService.list();
ExcelUtil<WaMessage> util = new ExcelUtil<WaMessage>(WaMessage.class);
util.exportExcel(response, list, "列表数据");
}
/**
* 新增
*/
@RequestMapping("/add")
@Log(title = "WaMessage", businessType = BusinessType.INSERT)
@PreAuthorize("@ss.hasPermi('warning:message:add')")
public R add(@RequestBody WaMessage waMessage){
return waMessageService.saveMessage(waMessage);
}
/**
* 修改
*/
@RequestMapping("/edit")
@PreAuthorize("@ss.hasPermi('warning:message:edit')")
@Log(title = "WaMessage", businessType = BusinessType.UPDATE)
public R edit(@RequestBody WaMessage waMessage){
waMessageService.updateByMessage(waMessage);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete/{ids}")
@PreAuthorize("@ss.hasPermi('warning:message:remove')")
@Log(title = "WaMessage", businessType = BusinessType.DELETE)
public R delete(@PathVariable Long[] ids){
waMessageService.delByIds(Arrays.asList(ids));
return R.ok();
}
}

106
ruoyi-code/src/main/java/com/ruoyi/code/warning/controller/WaThresholdController.java

@ -1,106 +0,0 @@ @@ -1,106 +0,0 @@
package com.ruoyi.code.warning.controller;
import java.util.List;
import java.util.Arrays;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import javax.annotation.Resource;
import com.ruoyi.common.core.page.R;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.code.warning.domain.WaThreshold;
import com.ruoyi.code.warning.service.IWaThresholdService;
import com.ruoyi.common.utils.poi.ExcelUtil;
/**
* 阈值管理Controller
*
* @author ruoyi
* @date 2022-09-19
*/
@RestController
@RequestMapping("/warning/threshold")
public class WaThresholdController extends BaseController
{
@Resource
private IWaThresholdService waThresholdService;
/**
* 查询列表
*/
@PreAuthorize("@ss.hasPermi('warning:threshold:list')")
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
return waThresholdService.queryPage(params);
}
/**
* 获取详细信息
*/
@RequestMapping("/info/{id}")
@PreAuthorize("@ss.hasPermi('warning:threshold:query')")
public R info(@PathVariable("id") Long id){
WaThreshold waThreshold = waThresholdService.getById(id);
return R.ok().put("data", waThreshold);
}
/**
* 导出列表
*/
@PreAuthorize("@ss.hasPermi('warning:threshold:export')")
@Log(title = "列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaThreshold waThreshold)
{
List<WaThreshold> list = waThresholdService.list();
ExcelUtil<WaThreshold> util = new ExcelUtil<WaThreshold>(WaThreshold.class);
util.exportExcel(response, list, "列表数据");
}
/**
* 新增
*/
@RequestMapping("/add")
@Log(title = "WaThreshold", businessType = BusinessType.INSERT)
@PreAuthorize("@ss.hasPermi('warning:threshold:add')")
public R add(@RequestBody WaThreshold waThreshold){
waThresholdService.save(waThreshold);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/edit")
@PreAuthorize("@ss.hasPermi('warning:threshold:edit')")
@Log(title = "WaThreshold", businessType = BusinessType.UPDATE)
public R edit(@RequestBody WaThreshold waThreshold){
waThresholdService.updateById(waThreshold);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete/{ids}")
@PreAuthorize("@ss.hasPermi('warning:threshold:remove')")
@Log(title = "WaThreshold", businessType = BusinessType.DELETE)
public R delete(@PathVariable Long[] ids){
waThresholdService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}

49
ruoyi-code/src/main/java/com/ruoyi/code/warning/domain/WaAlarm.java

@ -1,49 +0,0 @@ @@ -1,49 +0,0 @@
package com.ruoyi.code.warning.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 预警管理对象 wa_alarm
*
* @author ruoyi
* @date 2022-09-19
*/
@Data
@TableName("wa_alarm")
public class WaAlarm implements Serializable
{
private static final long serialVersionUID = 1L;
/** 预警id */
@TableId(type = IdType.INPUT)
private Long id;
/** 测站id */
private Long stnmId;
/** 预警内容 */
private String alarmContent;
/** 预警时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date alarmTime;
/** 0 未删除 1 删除 */
// @TableLogic
private Long deleted;
@TableField(exist = false)
private String stnm;
}

36
ruoyi-code/src/main/java/com/ruoyi/code/warning/domain/WaEmpMsg.java

@ -1,36 +0,0 @@ @@ -1,36 +0,0 @@
package com.ruoyi.code.warning.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableId;
import com.ruoyi.common.annotation.Excel;
import java.io.Serializable;
import lombok.Data;
/**
* 短信人员对象 wa_emp_msg
*
* @author ruoyi
* @date 2022-09-20
*/
@Data
@TableName("wa_emp_msg")
public class WaEmpMsg implements Serializable
{
private static final long serialVersionUID = 1L;
/** id */
@TableId(type = IdType.INPUT)
private Long id;
/** 人员id */
private Long empId;
/** 消息id */
private Long msgId;
}

39
ruoyi-code/src/main/java/com/ruoyi/code/warning/domain/WaEmployee.java

@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
package com.ruoyi.code.warning.domain;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.io.Serializable;
/**
* 人员管理对象 wa_employee
*
* @author ruoyi
* @date 2022-09-19
*/
@Data
@TableName("wa_employee")
public class WaEmployee implements Serializable
{
private static final long serialVersionUID = 1L;
/** id */
@TableId(type = IdType.INPUT)
private Long id;
/** 姓名 */
private String name;
/** 手机号 */
private Long phone;
/** 备注 */
private String remarks;
/** 0 未删除 1 删除 */
// @TableLogic
private Long deleted;
}

50
ruoyi-code/src/main/java/com/ruoyi/code/warning/domain/WaMessage.java

@ -1,50 +0,0 @@ @@ -1,50 +0,0 @@
package com.ruoyi.code.warning.domain;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 短信管理对象 wa_message
*
* @author ruoyi
* @date 2022-09-19
*/
@Data
@TableName("wa_message")
public class WaMessage implements Serializable
{
private static final long serialVersionUID = 1L;
/** 短信id */
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/** 短信名称 */
private String msgName;
/** 短信内容 */
private String msgContent;
/** 发送时间 */
private Date sendTime;
/** 消息状态 */
private String sendStaus;
/** 测站id */
private Long stnmId;
/** 人员id */
@TableField(exist = false)
private Long empId;
/** 0 未删除 1 删除 */
// @TableLogic
private Long deleted;
}

40
ruoyi-code/src/main/java/com/ruoyi/code/warning/domain/WaThreshold.java

@ -1,40 +0,0 @@ @@ -1,40 +0,0 @@
package com.ruoyi.code.warning.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* 阈值管理对象 wa_threshold
*
* @author ruoyi
* @date 2022-09-19
*/
@Data
@TableName("wa_threshold")
public class WaThreshold implements Serializable
{
private static final long serialVersionUID = 1L;
/** 阈值id */
@TableId(type = IdType.INPUT)
private Long id;
/** 阈值一级 */
private String thresholdLevelL;
/** 阈值二级 */
private String thresholdLevelLl;
/** 阈值三级 */
private String thresholdLevelLll;
/** 测站id */
private Long stnmId;
}

22
ruoyi-code/src/main/java/com/ruoyi/code/warning/mapper/WaAlarmMapper.java

@ -1,22 +0,0 @@ @@ -1,22 +0,0 @@
package com.ruoyi.code.warning.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.code.warning.domain.WaAlarm;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* Mapper接口
*
* @author ruoyi
* @date 2022-09-19
*/
@Mapper
public interface WaAlarmMapper extends BaseMapper<WaAlarm>
{
List<WaAlarm> queryAlarm(@Param("params") Map<String, Object> params);
}

23
ruoyi-code/src/main/java/com/ruoyi/code/warning/mapper/WaEmpMsgMapper.java

@ -1,23 +0,0 @@ @@ -1,23 +0,0 @@
package com.ruoyi.code.warning.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.code.warning.domain.WaEmpMsg;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* Mapper接口
*
* @author ruoyi
* @date 2022-09-20
*/
@Mapper
public interface WaEmpMsgMapper extends BaseMapper<WaEmpMsg>
{
boolean saveMessageAndStation(@Param("empId")Long empId, @Param("msgId")Long msgId);
Long selectEmpIdByMsgId(Long msgId);
WaEmpMsg selectByMsgId(Long id);
}

18
ruoyi-code/src/main/java/com/ruoyi/code/warning/mapper/WaEmployeeMapper.java

@ -1,18 +0,0 @@ @@ -1,18 +0,0 @@
package com.ruoyi.code.warning.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import com.ruoyi.code.warning.domain.WaEmployee;
/**
* Mapper接口
*
* @author ruoyi
* @date 2022-09-19
*/
@Mapper
public interface WaEmployeeMapper extends BaseMapper<WaEmployee>
{
}

17
ruoyi-code/src/main/java/com/ruoyi/code/warning/mapper/WaMessageMapper.java

@ -1,17 +0,0 @@ @@ -1,17 +0,0 @@
package com.ruoyi.code.warning.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.code.warning.domain.WaMessage;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper接口
*
* @author ruoyi
* @date 2022-09-19
*/
@Mapper
public interface WaMessageMapper extends BaseMapper<WaMessage>
{
}

18
ruoyi-code/src/main/java/com/ruoyi/code/warning/mapper/WaThresholdMapper.java

@ -1,18 +0,0 @@ @@ -1,18 +0,0 @@
package com.ruoyi.code.warning.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import com.ruoyi.code.warning.domain.WaThreshold;
/**
* Mapper接口
*
* @author ruoyi
* @date 2022-09-19
*/
@Mapper
public interface WaThresholdMapper extends BaseMapper<WaThreshold>
{
}

24
ruoyi-code/src/main/java/com/ruoyi/code/warning/service/IWaAlarmService.java

@ -1,24 +0,0 @@ @@ -1,24 +0,0 @@
package com.ruoyi.code.warning.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.code.warning.domain.WaAlarm;
import com.ruoyi.common.core.page.R;
import java.util.List;
import java.util.Map;
/**
* Service接口
*
* @author ruoyi
* @date 2022-09-19
*/
public interface IWaAlarmService extends IService<WaAlarm>
{
/**
* 查询
*/
R queryPage(Map<String, Object> params);
List<WaAlarm> queryAlarm(Map<String, Object> params);
}

21
ruoyi-code/src/main/java/com/ruoyi/code/warning/service/IWaEmpMsgService.java

@ -1,21 +0,0 @@ @@ -1,21 +0,0 @@
package com.ruoyi.code.warning.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.page.R;
import java.util.Map;
import com.ruoyi.code.warning.domain.WaEmpMsg;
/**
* Service接口
*
* @author ruoyi
* @date 2022-09-20
*/
public interface IWaEmpMsgService extends IService<WaEmpMsg>
{
/**
* 查询
*/
R queryPage(Map<String, Object> params);
}

24
ruoyi-code/src/main/java/com/ruoyi/code/warning/service/IWaEmployeeService.java

@ -1,24 +0,0 @@ @@ -1,24 +0,0 @@
package com.ruoyi.code.warning.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.code.warning.domain.WaEmployee;
import com.ruoyi.common.core.page.R;
import java.util.List;
import java.util.Map;
/**
* Service接口
*
* @author ruoyi
* @date 2022-09-19
*/
public interface IWaEmployeeService extends IService<WaEmployee>
{
/**
* 查询
*/
R queryPage(Map<String, Object> params);
R delByIds(List<Long> asList);
}

35
ruoyi-code/src/main/java/com/ruoyi/code/warning/service/IWaMessageService.java

@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
package com.ruoyi.code.warning.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.code.warning.domain.WaMessage;
import com.ruoyi.common.core.page.R;
import java.util.List;
import java.util.Map;
/**
* Service接口
*
* @author ruoyi
* @date 2022-09-19
*/
public interface IWaMessageService extends IService<WaMessage>
{
/**
* 查询
*/
R queryPage(Map<String, Object> params);
/**
* 保存短信
* @param waMessage
* @return
*/
R saveMessage(WaMessage waMessage);
WaMessage selectById(Long id);
void updateByMessage(WaMessage waMessage);
void delByIds(List<Long> asList);
}

22
ruoyi-code/src/main/java/com/ruoyi/code/warning/service/IWaThresholdService.java

@ -1,22 +0,0 @@ @@ -1,22 +0,0 @@
package com.ruoyi.code.warning.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.code.warning.domain.WaThreshold;
import com.ruoyi.common.core.page.R;
import java.util.Map;
/**
* Service接口
*
* @author ruoyi
* @date 2022-09-19
*/
public interface IWaThresholdService extends IService<WaThreshold>
{
/**
* 查询
*/
R queryPage(Map<String, Object> params);
}

44
ruoyi-code/src/main/java/com/ruoyi/code/warning/service/impl/WaAlarmServiceImpl.java

@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
package com.ruoyi.code.warning.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.code.warning.domain.WaAlarm;
import com.ruoyi.code.warning.mapper.WaAlarmMapper;
import com.ruoyi.code.warning.service.IWaAlarmService;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.Query;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* Service业务层处理
*
* @author ruoyi
* @date 2022-09-19
*/
@Service("waAlarmService")
public class WaAlarmServiceImpl extends ServiceImpl<WaAlarmMapper, WaAlarm> implements IWaAlarmService
{
@Override
public R queryPage(Map<String, Object> params) {
Object stnmId = params.get("stnmId");
Object alarmTime = params.get("alarmTime");
IPage<WaAlarm> page = this.page(
new Query<WaAlarm>().getPage(params),
new QueryWrapper<WaAlarm>()
.eq(StringUtils.isNotNull(stnmId),"stnm_id",stnmId)
.eq(StringUtils.isNotNull(alarmTime),"alarm_time",alarmTime)
);
return R.ok().put("count", page.getTotal()).put("data", page.getRecords());
}
@Override
public List<WaAlarm> queryAlarm(Map<String, Object> params){
return baseMapper.queryAlarm(params);
}
}

33
ruoyi-code/src/main/java/com/ruoyi/code/warning/service/impl/WaEmpMsgServiceImpl.java

@ -1,33 +0,0 @@ @@ -1,33 +0,0 @@
package com.ruoyi.code.warning.service.impl;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.Query;
import org.springframework.stereotype.Service;
import com.ruoyi.code.warning.mapper.WaEmpMsgMapper;
import com.ruoyi.code.warning.domain.WaEmpMsg;
import com.ruoyi.code.warning.service.IWaEmpMsgService;
/**
* Service业务层处理
*
* @author ruoyi
* @date 2022-09-20
*/
@Service("waEmpMsgService")
public class WaEmpMsgServiceImpl extends ServiceImpl<WaEmpMsgMapper, WaEmpMsg> implements IWaEmpMsgService
{
@Override
public R queryPage(Map<String, Object> params) {
IPage<WaEmpMsg> page = this.page(
new Query<WaEmpMsg>().getPage(params),
new QueryWrapper<WaEmpMsg>()
);
return R.ok().put("count", page.getTotal()).put("data", page.getRecords());
}
}

59
ruoyi-code/src/main/java/com/ruoyi/code/warning/service/impl/WaEmployeeServiceImpl.java

@ -1,59 +0,0 @@ @@ -1,59 +0,0 @@
package com.ruoyi.code.warning.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.code.warning.domain.WaEmpMsg;
import com.ruoyi.code.warning.domain.WaEmployee;
import com.ruoyi.code.warning.mapper.WaEmpMsgMapper;
import com.ruoyi.code.warning.mapper.WaEmployeeMapper;
import com.ruoyi.code.warning.service.IWaEmployeeService;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.Query;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* Service业务层处理
*
* @author ruoyi
* @date 2022-09-19
*/
@Service("waEmployeeService")
public class WaEmployeeServiceImpl extends ServiceImpl<WaEmployeeMapper, WaEmployee> implements IWaEmployeeService
{
@Autowired
private WaEmpMsgMapper waEmpMsgMapper;
@Override
public R queryPage(Map<String, Object> params) {
Object name = params.get("name");
Object phone = params.get("phone");
IPage<WaEmployee> page = this.page(
new Query<WaEmployee>().getPage(params),
new QueryWrapper<WaEmployee>()
.like(ObjectUtils.isNotEmpty(name),"name",name)
.eq(ObjectUtils.isNotEmpty(phone),"phone",phone)
);
return R.ok().put("count", page.getTotal()).put("data", page.getRecords());
}
@Override
public R delByIds(List<Long> asList) {
if (asList.size() > 0){
List<WaEmpMsg> list = waEmpMsgMapper.selectList(new LambdaQueryWrapper<WaEmpMsg>()
.in(WaEmpMsg::getEmpId, asList));
if (list.size() == 0) {
baseMapper.deleteBatchIds(asList);
return R.ok();
}
}
return R.error("该用户有短信消息,不能删除!");
}
}

90
ruoyi-code/src/main/java/com/ruoyi/code/warning/service/impl/WaMessageServiceImpl.java

@ -1,90 +0,0 @@ @@ -1,90 +0,0 @@
package com.ruoyi.code.warning.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.code.warning.domain.WaEmpMsg;
import com.ruoyi.code.warning.domain.WaMessage;
import com.ruoyi.code.warning.mapper.WaEmpMsgMapper;
import com.ruoyi.code.warning.mapper.WaMessageMapper;
import com.ruoyi.code.warning.service.IWaMessageService;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.Query;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
* Service业务层处理
*
* @author ruoyi
* @date 2022-09-19
*/
@Service("waMessageService")
public class WaMessageServiceImpl extends ServiceImpl<WaMessageMapper, WaMessage> implements IWaMessageService
{
@Autowired
private WaEmpMsgMapper waEmpMsgMapper;
@Override
public R queryPage(Map<String, Object> params) {
Object stnmId = params.get("stnmId");
Object sendTime = params.get("sendTime");
Object sendStatus = params.get("sendStaus");
IPage<WaMessage> page = this.page(
new Query<WaMessage>().getPage(params),
new QueryWrapper<WaMessage>()
.eq(ObjectUtils.isNotEmpty(stnmId),"stnm_id",stnmId)
.eq(ObjectUtils.isNotEmpty(sendTime),"send_time",sendTime)
.eq(ObjectUtils.isNotEmpty(sendStatus),"send_staus",sendStatus)
);
return R.ok().put("count", page.getTotal()).put("data", page.getRecords());
}
@Override
@Transactional
public R saveMessage(WaMessage waMessage) {
int result = baseMapper.insert(waMessage);
System.out.println(waMessage.getId());
if (result > 0){
boolean flag = waEmpMsgMapper.saveMessageAndStation(waMessage.getEmpId(),waMessage.getId());
if(flag){
return R.ok();
}
}
return R.error();
}
@Override
public WaMessage selectById(Long id) {
WaMessage waMessage = baseMapper.selectById(id);
Long msgId = waMessage.getId();
Long empId = waEmpMsgMapper.selectEmpIdByMsgId(msgId);
waMessage.setEmpId(empId);
return waMessage;
}
@Override
public void updateByMessage(WaMessage waMessage) {
baseMapper.updateById(waMessage);
Long empId = waMessage.getEmpId();
WaEmpMsg waEmpMsg = waEmpMsgMapper.selectByMsgId(waMessage.getId());
waEmpMsg.setEmpId(empId);
waEmpMsgMapper.updateById(waEmpMsg);
}
@Override
public void delByIds(List<Long> asList) {
baseMapper.deleteBatchIds(asList);
waEmpMsgMapper.delete(new LambdaQueryWrapper<WaEmpMsg>()
.in(WaEmpMsg::getMsgId,asList));
}
}

36
ruoyi-code/src/main/java/com/ruoyi/code/warning/service/impl/WaThresholdServiceImpl.java

@ -1,36 +0,0 @@ @@ -1,36 +0,0 @@
package com.ruoyi.code.warning.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.code.warning.domain.WaThreshold;
import com.ruoyi.code.warning.mapper.WaThresholdMapper;
import com.ruoyi.code.warning.service.IWaThresholdService;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.Query;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* Service业务层处理
*
* @author ruoyi
* @date 2022-09-19
*/
@Service("waThresholdService")
public class WaThresholdServiceImpl extends ServiceImpl<WaThresholdMapper, WaThreshold> implements IWaThresholdService
{
@Override
public R queryPage(Map<String, Object> params) {
IPage<WaThreshold> page = this.page(
new Query<WaThreshold>().getPage(params),
new QueryWrapper<WaThreshold>()
.eq(ObjectUtils.isNotEmpty(params.get("stnmId")),"stnm_id",params.get("stnmId"))
);
return R.ok().put("count", page.getTotal()).put("data", page.getRecords());
}
}

79
ruoyi-code/src/main/java/utils/Base64Utils.java

@ -1,79 +0,0 @@ @@ -1,79 +0,0 @@
package utils;
import org.apache.commons.codec.binary.Base64;
import java.io.*;
public class Base64Utils {
/**
* 图片转化成base64字符串
*
* @param imgPath
* @return
*/
public static String GetImageStr(String imgPath) {// 将图片文件转化为字节数组字符串,并对其进行Base64编码处理
String imgFile = imgPath;// 待处理的图片
InputStream in = null;
byte[] data = null;
String encode = null; // 返回Base64编码过的字节数组字符串
// 对字节数组Base64编码
Base64 encoder = new Base64();
try {
// 读取图片字节数组
in = new FileInputStream(imgFile);
data = new byte[in.available()];
in.read(data);
encode = encoder.encodeToString(data);
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return encode;
}
/**
* base64字符串转化成图片
*
* @param imgData 图片编码
* @param imgFilePath 存放到本地路径
* @return
* @throws IOException
*/
@SuppressWarnings("finally")
public static boolean GenerateImage(String imgData, String imgFilePath) throws IOException { // 对字节数组字符串进行Base64解码并生成图片
if (imgData == null) // 图像数据为空
return false;
Base64 decoder = new Base64();
OutputStream out = null;
try {
out = new FileOutputStream(imgFilePath);
// Base64解码
byte[] b = decoder.decode(imgData);
for (int i = 0; i < b.length; ++i) {
if (b[i] < 0) {// 调整异常数据
b[i] += 256;
}
}
out.write(b);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
System.out.println(e.getMessage());
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println(e.getMessage());
e.printStackTrace();
} finally {
out.flush();
out.close();
return true;
}
}
}

12
ruoyi-code/src/main/java/utils/CameraUtil.java

@ -15,7 +15,7 @@ public class CameraUtil { @@ -15,7 +15,7 @@ public class CameraUtil {
NetLib.instance.Net_Init(null, null);
String strIp="192.168.1.40";
String strIp="192.168.1.64";
int nPort= 27778;
String strUsername="admin";
String strPassword="admin123";
@ -26,19 +26,13 @@ public class CameraUtil { @@ -26,19 +26,13 @@ public class CameraUtil {
System.out.println("loginID = "+loginID);
run_device_cfg cfg = new run_device_cfg();
Map<String, Object> map = cfg.getAutoRegister(loginID);
// System.out.println(JSON.toJSON(map));
// cfg.setAutoRegister(loginID,1,"121.40.203.197",8020);
// System.out.println("----------------------------------");
// cfg.getAutoRegister(loginID);
Map<String, Object> ligntCfg = cfg.getLigntCfg(loginID);
System.out.println(JSON.toJSON(ligntCfg).toString());
System.out.println("==================================");
//设置参数
// cfg.setLightCfg(loginID, NetEnums.EM_DEV_SUP_LIGHT_MODE.EM_DEV_SUP_LIGHT_MODE_FORCE_AUTO,30,60,"13:50:00","14:00:00");
// System.out.println("==================================");
// cfg.getLigntCfg(loginID);
}
/**

21
ruoyi-code/src/main/java/utils/RegisterUtil.java

@ -15,8 +15,6 @@ import com.sun.jna.Structure; @@ -15,8 +15,6 @@ import com.sun.jna.Structure;
import com.sun.jna.ptr.IntByReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import sdk.java.common.GlobalTool;
import sdk.java.lib.DataUtils;
@ -59,7 +57,9 @@ import java.util.*; @@ -59,7 +57,9 @@ import java.util.*;
/////////////////////////////////////////////////////////////////////////////////////////////////////
@Component
public class RegisterUtil implements ActionListener {
private String m_jtfServerIP = "";
private String m_jtfServerIP = "172.16.46.58";
// private String m_jtfServerIP = "192.168.1.11";
private String m_jtfServerPort = "8020";
private String m_jtfDevUsername = "admin";
private String m_jtfDevPassword = "admin123";
@ -126,14 +126,9 @@ public class RegisterUtil implements ActionListener { @@ -126,14 +126,9 @@ public class RegisterUtil implements ActionListener {
/**
* Create the application.
*/
public RegisterUtil(String m_jtfServerIP)
public RegisterUtil()
{
this.m_jtfServerIP = m_jtfServerIP;
System.out.println("this.m_jtfServerIP="+this.m_jtfServerIP);
String os = System.getProperty("os.name");
if(os.toLowerCase().startsWith("win")){
initialize();
}
initilizeRyNetLib();
loginListenThreadController = new LoginListenThreadController(this);
}
@ -592,12 +587,8 @@ public class RegisterUtil implements ActionListener { @@ -592,12 +587,8 @@ public class RegisterUtil implements ActionListener {
// 用户可以自定义 fDisConnectCB
NetLib.instance.Net_Init(_cbDisConnectCallBack, new NativeLong(1));
String os = System.getProperty("os.name");
if(os.toLowerCase().startsWith("win")){
NetLib.instance.Net_SetLogFolder("D:\\soft\\control\\TmpAutoReg");
}else {
NetLib.instance.Net_SetLogFolder("/usr/local/water-monitor-api/TmpAutoReg");
}
NetLib.instance.Net_SetLogOption(7);
// GlobalTool.createDirectory(this.m_strFilePath);
@ -1096,7 +1087,7 @@ public class RegisterUtil implements ActionListener { @@ -1096,7 +1087,7 @@ public class RegisterUtil implements ActionListener {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
RegisterUtil window = new RegisterUtil("");
RegisterUtil window = new RegisterUtil();
window.m_frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();

301
ruoyi-code/src/main/java/utils/RtspConvert.java

@ -1,301 +0,0 @@ @@ -1,301 +0,0 @@
package utils;
import cn.hutool.core.util.RuntimeUtil;
import com.alibaba.fastjson.JSON;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PreDestroy;
import java.io.*;
import java.util.Date;
import java.util.concurrent.ConcurrentHashMap;
/**
* rtsp hlv协议
*
* @author kzw
*/
@Service
@Slf4j
@EnableScheduling
public class RtspConvert {
//转换map
private static ConcurrentHashMap<String, CoverThread> coverMap = new ConcurrentHashMap<>();
//拉流命令
private static final String ffmpegCmd = "ffmpeg -i \"%s\" -c copy -f hls -hls_time 5.0 -hls_list_size 2 -hls_flags 2 %s";
//ffmpeg -i "rtsp://admin:admin123@192.168.1.40:554/stream/realtime?channel=1&streamtype=0" -c copy -f hls -hls_time 4.0 -hls_list_size 2 -hls_flags 2 "D:\video\test.m3u8"
@PreDestroy
public void closeProcess() {
log.info("关闭ffmpeg转换进程,java程序不一定关闭process进程");
closeAllProcess();
for (String ip : coverMap.keySet()) {
try {
log.error("开始停止{}", ip);
coverMap.get(ip).stopTask();
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* ffmpeg -i "rtsp://admin:xxx@192.168.0.251:554/Streaming/Channels/101" -c copy -f hls -hls_time 5.0 -hls_list_size 5 -hls_flags 2 F:\resources\hls\2000\live.m3u8
*/
/**
* 检查设备ip是否能正常访问
*/
private boolean checkDeviceOnline(String ip) {
String res = HttpUtils.sendGet("http://" + ip);
if (StringUtils.isNotBlank(res)) {
return true;
}
return false;
}
/**
* 转换rtsp并获取hls文件路径
* 视频地址 http.../control-api/upload/hls/{ip}/live.m3u8
*/
public String rtsp2Hls(String ip, String userName, String pwd) {
System.out.println(JSON.toJSON(coverMap));
if (coverMap.containsKey(ip)) {
CoverThread thread = coverMap.get(ip);
if (thread == null || thread.getTaskState() != CoverThread.running) {
} else {
return StringUtils.replace(thread.getM3U8File(), RuoYiConfig.getProfile(), "");
}
}
String rtspUrl = "rtsp://" + userName + ":" + pwd + "@" + ip + ":554/stream/realtime?channel=1&streamtype=0";
String m3u8File = RuoYiConfig.getProfile() + File.separator+"upload" + File.separator + "hls"
// String m3u8File = "D:" + File.separator + "ruoyi" + File.separator + "uploadPath" + File.separator + "hls"
+ File.separator + ip.replaceAll("\\.", "_") + File.separator + "live.m3u8";
startTransform(ip, rtspUrl, m3u8File, userName, pwd);
CoverThread thread = coverMap.get(ip);
if (thread != null) {
return StringUtils.replace(thread.getM3U8File(), RuoYiConfig.getProfile(), "");
}
return null;
}
/**
* 开启转换
*/
private void startTransform(String ip, String rtspUrl, String m3u8Path, String userName, String pwd) {
log.info("转换rtsp, {},{},{}", ip, rtspUrl, m3u8Path);
String memKey = "startLive" + ip;
synchronized (memKey.intern()) {
if (coverMap.containsKey(ip)) {
stopTransform(ip);
}
CoverThread thread = new CoverThread(ip, rtspUrl, m3u8Path, userName, pwd);
coverMap.put(ip, thread);
thread.start();
}
}
/**
* 停止转换
*/
public void stopTransform(String ip) {
String memKey = "startLive" + ip;
synchronized (memKey.intern()) {
System.out.println(JSON.toJSON(coverMap));
if (coverMap.containsKey(ip)) {
CoverThread thread = coverMap.get(ip);
if (thread != null && thread.getTaskState() != CoverThread.fail) {
System.out.println("停止转换ip"+ip);
thread.stopTask();
}
}
}
}
/**
* 监控所有的转换线程
*/
@Scheduled(cron = "0 0/8 * * * ?")
public synchronized void monitorThreads() {
for (String ip : coverMap.keySet()) {
CoverThread thread = coverMap.get(ip);
if (thread != null && thread.getTaskState() != CoverThread.running) {
//线程出现异常
rtsp2Hls(ip, thread.getUserName(), thread.getPwd());
}
}
}
public void closeAllProcess(){
String command = "taskkill /f /im ffmpeg.exe";
if(!isWin()){
command = "/usr/local/water-monitor-api/closeFFmpeg.sh";
}
System.out.println("command ["+command+"]");
String result = RuntimeUtil.execForStr(command);
System.out.println("command result ["+result+"]");
coverMap.clear();
}
public boolean isWin(){
String os = System.getProperty("os.name");
return os.toLowerCase().startsWith("win");
}
public class RunThread extends Thread {
private InputStream is;
private String printType;
RunThread(InputStream is, String printType) {
this.is = is;
this.printType = printType;
}
@Override
public void run() {
try {
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null) {
log.info(printType + ">" + line);
}
} catch (IOException ioe) {
log.info("RunThread error:", ioe);
}
}
}
/**
* 执行命令线程
*/
private class CoverThread extends Thread {
private String ip;
private String rtspUrl;
private String m3u8File;
private String userName;
private String pwd;
private int taskState = 0; //运行状态 0未开始 1进行中 -1失败
private static final int notStart = 0;
private static final int running = 1;
private static final int fail = -1;
private Process process = null;
CoverThread(String ip, String rtspUrl, String m3u8File, String userName, String pwd) {
this.ip = ip;
this.rtspUrl = rtspUrl;
this.m3u8File = m3u8File;
this.userName = userName;
this.pwd = pwd;
setName("m3u8-" + ip);
this.taskState = notStart;
}
@Override
public void run() {
try {
FileUtils.forceMkdir(new File(m3u8File).getParentFile());
if (!checkDeviceOnline(ip)) {
log.warn("设备{},离线", ip);
this.taskState = fail;
return;
}
String command = String.format(ffmpegCmd, rtspUrl, m3u8File);
this.taskState = running;
//判断是操作系统是linu2x还是windows
String[] comds;
if (isWin()) {
comds = new String[]{"cmd", "/c", command};
// comds = new String[]{"cmd", "/c", "start", "/b", "cmd.exe", "/k", command};
} else {
comds = new String[]{"/bin/sh", "-c", command};
}
// 开始执行命令
log.info("执行命令:" + command);
process = Runtime.getRuntime().exec(comds);
//开启线程监听(此处解决 waitFor() 阻塞/锁死 问题)
new RunThread(process.getInputStream(), "INFO").start();
new RunThread(process.getErrorStream(), "ERROR").start();
int flag = process.waitFor();
log.info("结束{}", ip);
} catch (Exception e) {
log.error("出现异常" + e.getMessage(), e);
this.taskState = fail;
} finally {
if (process != null) {
try {
process.exitValue();
} catch (Exception e) {
}
try {
process.destroyForcibly();
} catch (Exception e) {
}
}
}
}
/**
* 获取任务执行状态
*/
public int getTaskState() {
return taskState;
}
/**
* 立即停止任务
*/
public void stopTask() {
if (process != null) {
try {
process.destroy();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public String getM3U8File() {
return this.m3u8File;
}
public String getUserName() {
return userName;
}
public String getPwd() {
return pwd;
}
}
public void openTask(){
}
public static void main(String[] args) throws Exception {
RtspConvert convert = new RtspConvert();
convert.closeAllProcess();
String ip = "192.168.1.40";
String userName = "admin";
String pwd = "admin123";
String m3u8 = convert.rtsp2Hls(ip, userName, pwd);
System.out.println("***********************************" + m3u8);
// Thread.sleep(10 * 1000);
// convert.stopTransform(ip);
// System.out.println("************************************结束**************");
}
}

295
ruoyi-code/src/main/java/utils/run_device_cfg.java

@ -60,7 +60,7 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { @@ -60,7 +60,7 @@ public class run_device_cfg implements ActionListener, ListSelectionListener {
* Create the application.
*/
public run_device_cfg() {
// initialize();
initialize();
initilizeRyNetLib();
}
@ -601,15 +601,8 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { @@ -601,15 +601,8 @@ public class run_device_cfg implements ActionListener, ListSelectionListener {
}else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_SOC_CONSTANT_LAMP == command)
{
stu = new NetStructs.STU_CFG_SOC_CONSTANT_LAMP_PARAM();
}else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_HTTP_REVERSE_REGISTER == command)
{
stu = new NetStructs.STU_CFG_HTTP_REGISTER_PARAM();
}else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_AUTO_REGISTER == command)
{
stu = new NetStructs.STU_CFG_AUTO_REGISTER_PARAM();
}
return stu;
}
@ -3777,70 +3770,6 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { @@ -3777,70 +3770,6 @@ public class run_device_cfg implements ActionListener, ListSelectionListener {
return ftpCfg;
}
public void getHttpCfg(NativeLong loginID){
int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_NET_STORAGE_TRANS;
STU_CFG_NET_STORAGE_TRANS stuCfgNetStorageTrans = getStuCfgNetStorageTrans(loginID,nCommand);
System.out.println("======================");
System.out.println("count="+stuCfgNetStorageTrans.uItemCount);
for(int i=0; i<stuCfgNetStorageTrans.uItemCount; i++)
{
STU_CFG_NET_STORAGE_TRANS_ITEM stuItem = stuCfgNetStorageTrans.stuItemArray[i];
String ftpValue = DataUtils.sdk_data_byteArrayToString(stuItem.szProtocol, GlobalTool.getEncodeType());
System.out.println("-----------------------");
System.out.println("name="+ftpValue);
System.out.println("bOfflineEnable="+stuItem.bOfflineEnable);
System.out.println("address="+DataUtils.sdk_data_byteArrayToString(stuItem.szAddress, GlobalTool.getEncodeType()));
}
}
public void addHttpCfg(NativeLong loginID,String szAddress){
int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_NET_STORAGE_TRANS;
STU_CFG_NET_STORAGE_TRANS stuCfgNetStorageTrans = getStuCfgNetStorageTrans(loginID,nCommand);
System.out.println("========== addHttpCfg ============");
System.out.println(JSON.toJSON(stuCfgNetStorageTrans));
System.out.println("======================");
boolean flag = false;
for(int i=0; i<stuCfgNetStorageTrans.uItemCount; i++)
{
STU_CFG_NET_STORAGE_TRANS_ITEM stuItem = stuCfgNetStorageTrans.stuItemArray[i];
String ftpValue = DataUtils.sdk_data_byteArrayToString(stuItem.szProtocol, GlobalTool.getEncodeType());
if("HttpClient".equalsIgnoreCase(ftpValue)){
flag = true;
stuCfgNetStorageTrans.stuItemArray[i].szAddress = DataUtils.sdk_data_stringToByteArray(szAddress, GlobalTool.getEncodeType());
stuCfgNetStorageTrans.stuItemArray[i].bOfflineEnable = 1;
}
}
if(!flag){
STU_CFG_NET_STORAGE_TRANS_ITEM httpCfg = new STU_CFG_NET_STORAGE_TRANS_ITEM();
httpCfg.szProtocol = DataUtils.sdk_data_stringToByteArray("HttpClient", GlobalTool.getEncodeType());
httpCfg.szAddress = DataUtils.sdk_data_stringToByteArray(szAddress, GlobalTool.getEncodeType());
httpCfg.bOfflineEnable = 1;
stuCfgNetStorageTrans.uItemCount = stuCfgNetStorageTrans.uItemCount + 1;
stuCfgNetStorageTrans.stuItemArray[stuCfgNetStorageTrans.uItemCount] = httpCfg;
}
IntByReference inBufferSize = new IntByReference(0);
inBufferSize.setValue(stuCfgNetStorageTrans.size());
Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue());
DataUtils.sdk_data_structureToPtr(stuCfgNetStorageTrans, ptrInBuffer, 0);
boolean bResult2 = NetLib.instance.Net_SetDeviceCfg(
loginID,
nCommand,
0,
ptrInBuffer,
inBufferSize.getValue(),
6000);
if(!bResult2)
{
int error = NetLib.instance.Net_LastError();
String strError = String.format("Net_setAutoRegister fail, command = %d, errorCode = %d", nCommand, error);
System.out.println("修改失败");
System.out.println(strError);
}
System.out.println("执行结束");
}
//获取自动重启配置
public STU_CFG_AUTO_MAINTAIN getAutoCfg(NativeLong loginID ,int nCommand){
@ -3917,226 +3846,4 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { @@ -3917,226 +3846,4 @@ public class run_device_cfg implements ActionListener, ListSelectionListener {
System.out.println(stuCfgAutoMaintain);
return R.ok();
}
public Map<String, Object> getHttpReverseRegister(NativeLong loginID){
int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_HTTP_REVERSE_REGISTER;
NetStructs.STU_CFG_HTTP_REGISTER_PARAM cfg = getCfgHttpReverseRegister(loginID,nCommand);
System.out.println(JSON.toJSON(cfg));
// 0:禁用,1:启用
int bEnable = cfg.bEnable;
//心跳地址
String heartUrl = DataUtils.sdk_data_byteArrayToString(cfg.szMessageURL, GlobalTool.getEncodeType());
//推图地址
String pushPicUrl = DataUtils.sdk_data_byteArrayToString(cfg.szPushPictureURL, GlobalTool.getEncodeType());
//心跳间隔,单位秒
int heartbeatInterval = cfg.nHeartbeatInterval;
Map<String, Object> map = new HashMap<>();
map.put("bEnable",bEnable);
map.put("heartUrl",heartUrl);
map.put("pushPicUrl",pushPicUrl);
map.put("heartbeatInterval",heartbeatInterval);
return map;
}
public R setHttpReverseRegister(NativeLong loginID,int bEnable,String heartUrl,String pushPicUrl,int heartbeatInterval){
int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_HTTP_REVERSE_REGISTER;
NetStructs.STU_CFG_HTTP_REGISTER_PARAM cfg = getCfgHttpReverseRegister(loginID,nCommand);
cfg.bEnable = bEnable;
cfg.szMessageURL = DataUtils.sdk_data_stringToByteArray(heartUrl, GlobalTool.getEncodeType());;
cfg.szPushPictureURL = DataUtils.sdk_data_stringToByteArray(pushPicUrl, GlobalTool.getEncodeType());;
cfg.nHeartbeatInterval = heartbeatInterval;
IntByReference inBufferSize = new IntByReference(0);
inBufferSize.setValue(cfg.size());
Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue());
DataUtils.sdk_data_structureToPtr(cfg, ptrInBuffer, 0);
boolean bResult2 = NetLib.instance.Net_SetDeviceCfg(
loginID,
nCommand,
0,
ptrInBuffer,
inBufferSize.getValue(),
6000);
if(!bResult2)
{
int error = NetLib.instance.Net_LastError();
String strError = String.format("Net_setHttpReverseRegister fail, command = %d, errorCode = %d", nCommand, error);
System.out.println(strError);
return R.error(500,strError);
}
return R.ok();
}
public R initHttpReverseRegister(NativeLong loginID){
int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_HTTP_REVERSE_REGISTER;
NetStructs.STU_CFG_HTTP_REGISTER_PARAM cfg = getCfgHttpReverseRegister(loginID,nCommand);
cfg.bEnable = 1;
cfg.szMessageURL = DataUtils.sdk_data_stringToByteArray("http://121.40.203.197/control-api/api/camera/heart", GlobalTool.getEncodeType());;
cfg.szPushPictureURL = DataUtils.sdk_data_stringToByteArray("http://121.40.203.197/control-api/api/getPicJson", GlobalTool.getEncodeType());;
cfg.nHeartbeatInterval = 50;
IntByReference inBufferSize = new IntByReference(0);
inBufferSize.setValue(cfg.size());
Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue());
DataUtils.sdk_data_structureToPtr(cfg, ptrInBuffer, 0);
boolean bResult2 = NetLib.instance.Net_SetDeviceCfg(
loginID,
nCommand,
0,
ptrInBuffer,
inBufferSize.getValue(),
6000);
if(!bResult2)
{
int error = NetLib.instance.Net_LastError();
String strError = String.format("Net_setHttpReverseRegister fail, command = %d, errorCode = %d", nCommand, error);
System.out.println(strError);
return R.error(500,strError);
}
return R.ok();
}
public R clearHttpReverseRegister(NativeLong loginID){
int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_HTTP_REVERSE_REGISTER;
NetStructs.STU_CFG_HTTP_REGISTER_PARAM cfg = getCfgHttpReverseRegister(loginID,nCommand);
cfg.bEnable = 1;
cfg.szMessageURL = new byte[256];;
cfg.szPushPictureURL = new byte[256];
cfg.nHeartbeatInterval = 50;
IntByReference inBufferSize = new IntByReference(0);
inBufferSize.setValue(cfg.size());
Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue());
DataUtils.sdk_data_structureToPtr(cfg, ptrInBuffer, 0);
boolean bResult2 = NetLib.instance.Net_SetDeviceCfg(
loginID,
nCommand,
0,
ptrInBuffer,
inBufferSize.getValue(),
6000);
if(!bResult2)
{
int error = NetLib.instance.Net_LastError();
String strError = String.format("Net_setHttpReverseRegister fail, command = %d, errorCode = %d", nCommand, error);
System.out.println(strError);
return R.error(500,strError);
}
return R.ok();
}
public NetStructs.STU_CFG_HTTP_REGISTER_PARAM getCfgHttpReverseRegister(NativeLong loginID, int nCommand){
IntByReference outBufferSize = new IntByReference(0);
IntByReference nReturnSize = new IntByReference(0);
Pointer ptrOutBuffer = initStuData(nCommand, outBufferSize);
boolean bResult = NetLib.instance.Net_GetDeviceCfg(
loginID,
nCommand,
0,
ptrOutBuffer,
outBufferSize.getValue(),
nReturnSize,
6000);
if(!bResult)
{
int error = NetLib.instance.Net_LastError();
String strError = String.format("Net_HttpReverseRegisterCfg fail, command = %d, errorCode = %d", nCommand, error);
System.out.println(strError);
return null;
}
NetStructs.STU_CFG_HTTP_REGISTER_PARAM cfg = new NetStructs.STU_CFG_HTTP_REGISTER_PARAM();
DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, cfg);
return cfg;
}
public Map<String, Object> getAutoRegister(NativeLong loginID){
int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_AUTO_REGISTER;
STU_CFG_AUTO_REGISTER_PARAM cfg = getAutoRegister(loginID,nCommand);
System.out.println(JSON.toJSON(cfg));
// 0:禁用,1:启用
// int bEnable = cfg.bEnable;
// //服务器地址
// String serverAddress = DataUtils.sdk_data_byteArrayToString(cfg.szServerAddress, GlobalTool.getEncodeType());
// //端口号
// int port = cfg.nPort;
// Map<String, Object> map = new HashMap<>();
// map.put("bEnable",bEnable);
// map.put("serverAddress",serverAddress);
// map.put("port",port);
// return map;
return null;
}
public R setAutoRegister(NativeLong loginID,int bEnable,String serverAddress,int port){
int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_AUTO_REGISTER;
NetStructs.STU_CFG_AUTO_REGISTER_PARAM cfg = getAutoRegister(loginID,nCommand);
cfg.bEnable = bEnable;
cfg.szServerAddress = DataUtils.sdk_data_stringToByteArray(serverAddress, GlobalTool.getEncodeType());;
cfg.nPort = port;
IntByReference inBufferSize = new IntByReference(0);
inBufferSize.setValue(cfg.size());
Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue());
DataUtils.sdk_data_structureToPtr(cfg, ptrInBuffer, 0);
boolean bResult2 = NetLib.instance.Net_SetDeviceCfg(
loginID,
nCommand,
0,
ptrInBuffer,
inBufferSize.getValue(),
6000);
if(!bResult2)
{
int error = NetLib.instance.Net_LastError();
String strError = String.format("Net_setAutoRegister fail, command = %d, errorCode = %d", nCommand, error);
System.out.println(strError);
return R.error(500,strError);
}
return R.ok();
}
public STU_CFG_AUTO_REGISTER_PARAM getAutoRegister(NativeLong loginID, int nCommand){
IntByReference outBufferSize = new IntByReference(0);
IntByReference nReturnSize = new IntByReference(0);
Pointer ptrOutBuffer = initStuData(nCommand, outBufferSize);
boolean bResult = NetLib.instance.Net_GetDeviceCfg(
loginID,
nCommand,
0,
ptrOutBuffer,
outBufferSize.getValue(),
nReturnSize,
6000);
if(!bResult)
{
int error = NetLib.instance.Net_LastError();
String strError = String.format("Net_AutoRegisterCfg fail, command = %d, errorCode = %d", nCommand, error);
System.out.println(strError);
return null;
}
STU_CFG_AUTO_REGISTER_PARAM cfg = new STU_CFG_AUTO_REGISTER_PARAM();
DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, cfg);
return cfg;
}
}

10
ruoyi-code/src/main/resources/mapper/camera/CameraMapper.xml

@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="queryCameraList" resultType="com.ruoyi.code.camera.domain.Camera">
select * from camera where devsn not in (
select camera_sn from sc_station_info
) and del_flag='0'
)
</select>
<select id="queryCameraBYSid" resultType="com.ruoyi.code.camera.domain.Camera">
@ -18,21 +18,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -18,21 +18,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sc_station_info s
where
c.devsn = s.camera_sn
and s.id = #{sid} and s.del_flag='0' and c.del_flag='0'
and s.id = #{sid}
</select>
<select id="queryPage" resultType="com.ruoyi.code.camera.domain.Camera">
select c.* from camera c
left join sc_station_info s on c.devsn = s.camera_sn
select * from camera
<where>
c.del_flag='0' and s.del_flag='0'
<if test="params.devsn!= null and params.devsn != ''">
and devsn like concat('%',#{params.devsn},'%')
</if>
<if test="params.name != null and params.name != ''">
and name like concat('%',#{params.name},'%')
</if>
${params.dataScope}
</where>
</select>
</mapper>

6
ruoyi-code/src/main/resources/mapper/camera/WaterPhotoInfoMapper.xml

@ -13,12 +13,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -13,12 +13,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join sc_water_data w on s.id = w.stnm_id
<where>
s.del_flag='0' and c.del_flag='0'
<if test="params.stnm !=null and params.stnm !=''">and s.stnm like concat('%',#{params.stnm},'%')</if>
<if test="params.stcd !=null and params.stcd !=''">and c.name like concat('%',#{params.stcd},'%')</if>
<if test="params.startTime != null and params.startTime !=''"> and w.tm &gt;= #{params.startTime }</if>
<if test="params.endTime != null and params.endTime !=''"> and w.tm &lt;= #{params.endTime}</if>
${params.dataScope}
</where>
order by w.tm desc
</select>
@ -35,10 +33,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -35,10 +33,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join camera c on c.devsn = s.camera_sn
<where>
s.del_flag='0' and c.del_flag='0'
<if test="params.stnm !=null and params.stnm !=''">and s.stnm like concat('%',#{params.stnm},'%')</if>
<if test="params.stcd !=null and params.stcd !=''">and c.name like concat('%',#{params.name},'%')</if>
${params.dataScope}
</where>
</select>
<select id="selectWaterData" resultType="com.ruoyi.code.camera.domain.YcData">
@ -52,7 +48,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -52,7 +48,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sc_station_info s
left join ${params.tableName} w on w.stnm_id = s.id
<where>
s.del_flag='0' and
w.stnm_id = #{params.stnmId}
<if test="params.startTime != null">
and w.tm>=#{params.startTime}
@ -71,7 +66,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -71,7 +66,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sc_station_info s
left join ${params.tableName} w on w.stnm_id = s.id
<where>
s.del_flag='0' and
w.stnm_id = #{params.stnmId}
<if test="params.startTime != null">
and w.tm>=#{params.startTime}

27
ruoyi-code/src/main/resources/mapper/rtudata/RtuDataMapper.xml

@ -1,27 +0,0 @@ @@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.code.rtudata.mapper.RtuDataMapper">
<select id="tabsList" resultType="com.ruoyi.code.rtudata.domain.RtuData">
SELECT DISTINCT item,item_code FROM `rtu_data`
</select>
<select id="getSids" resultType="java.lang.Integer">
SELECT DISTINCT sid FROM rtu_data
<where>
item_code = #{params.itemCode}
<if test="params.startTime != null">
and dt>=#{params.startTime}
</if>
<if test="params.endTime != null">
and dt &lt;=#{params.endTime}
</if>
</where>
</select>
<select id="selectWaterData" resultType="com.ruoyi.code.camera.domain.YcData">
SELECT id, sid as stnm, dt as tm, unix_timestamp(dt) as clock, val as value from rtu_data
where item_code = #{params.itemCode} and sid = #{params.sid} and dt>=#{params.startTime} and dt &lt;=#{params.endTime}
order by dt desc
</select>
</mapper>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save