init
commit
ff3fb2cfe1
|
@ -0,0 +1,60 @@
|
|||
#!groovy
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh 'mvn -B -DskipTests clean package'
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
steps {
|
||||
echo 'Testing..'
|
||||
}
|
||||
}
|
||||
stage('Deploy') {
|
||||
steps {
|
||||
echo 'Deploying....'
|
||||
sshPublisher(publishers: [sshPublisherDesc(
|
||||
configName: 'bnhz_test',
|
||||
transfers: [
|
||||
sshTransfer(cleanRemote: false,
|
||||
excludes: '',
|
||||
execCommand: '''
|
||||
JAR_NAME="bnhz-admin.jar";
|
||||
PID=$(ps aux | grep "$JAR_NAME" | grep -v grep | awk \\'{print $2}\\')
|
||||
if [ -n "$PID" ]; then
|
||||
echo "Killing process $PID"
|
||||
sudo kill $PID
|
||||
sleep 5
|
||||
if ps -p $PID > /dev/null; then
|
||||
echo "Process $PID did not terminate, force killing"
|
||||
sudo kill -9 $PID && echo "Process $PID has been force killed"
|
||||
else
|
||||
echo "Process $PID terminated gracefully"
|
||||
fi
|
||||
else
|
||||
echo "No process found related to $JAR_NAME"
|
||||
fi
|
||||
cd app/service
|
||||
source /etc/profile
|
||||
./start.sh
|
||||
echo $?
|
||||
''',
|
||||
execTimeout: 120000, flatten: false,
|
||||
makeEmptyDirs: false,
|
||||
noDefaultExcludes: false,
|
||||
patternSeparator: '[, ]+',
|
||||
remoteDirectory: '/app/service',
|
||||
remoteDirectorySDF: false,
|
||||
removePrefix: 'bnhz-admin/target',
|
||||
sourceFiles: 'bnhz-admin/target/bnhz-admin.jar')],
|
||||
usePromotionTimestamp: false,
|
||||
useWorkspaceInPromotion: false,
|
||||
verbose: true)
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 RuoYi
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,21 @@
|
|||
# 大气环保
|
||||
## 项目构建
|
||||
项目根目录执行
|
||||
```bash
|
||||
mvn clean install
|
||||
```
|
||||
## 项目启动
|
||||
项目产物位置`bnhz-admin/target/bnhz-admin.jar`
|
||||
执行下面命令进行启动
|
||||
```bash
|
||||
java -jar bnhz-admin.jar
|
||||
```
|
||||
## 心跳包说明
|
||||
### 示例
|
||||
心跳包信息:**7e81ZHKCEAMS24080500017e**
|
||||
### 包信息说明
|
||||
**7e**-是包头包尾
|
||||
**81**-代表标识符
|
||||
**HKCEAMS2408050001**-设备编号
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
@echo off
|
||||
echo.
|
||||
echo [信息] 清理工程target生成路径。
|
||||
echo.
|
||||
|
||||
%~d0
|
||||
cd %~dp0
|
||||
|
||||
cd ..
|
||||
call mvn clean
|
||||
|
||||
pause
|
|
@ -0,0 +1,12 @@
|
|||
@echo off
|
||||
echo.
|
||||
echo [信息] 打包Web工程,生成war/jar包文件。
|
||||
echo.
|
||||
|
||||
%~d0
|
||||
cd %~dp0
|
||||
|
||||
cd ..
|
||||
call mvn clean package -Dmaven.test.skip=true
|
||||
|
||||
pause
|
|
@ -0,0 +1,14 @@
|
|||
@echo off
|
||||
echo.
|
||||
echo [<5B><>Ϣ] ʹ<><CAB9>Jar<61><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Web<65><62><EFBFBD>̡<EFBFBD>
|
||||
echo.
|
||||
|
||||
cd %~dp0
|
||||
cd ../bnhz-admin/target
|
||||
|
||||
set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||
|
||||
java -jar %JAVA_OPTS% bnhz-admin.jar
|
||||
|
||||
cd bin
|
||||
pause
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.bnhz</groupId>
|
||||
<artifactId>daqi-back</artifactId>
|
||||
<version>3.8.5</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>bnhz-adapter</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.bnhz</groupId>
|
||||
<artifactId>mqtt-broker</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.bnhz</groupId>
|
||||
<artifactId>sip-server</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bnhz</groupId>
|
||||
<artifactId>bnhz-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,79 @@
|
|||
package com.bnhz.adapter.controller.blackcar;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.bnhz.adapter.model.blackcar.*;
|
||||
import com.bnhz.common.core.domain.BlackCarResult;
|
||||
import com.bnhz.adapter.service.blackcar.IBlackCarService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/6/15 16:03
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/YC")
|
||||
public class BlackCarController {
|
||||
|
||||
@Autowired
|
||||
private IBlackCarService blackCarService;
|
||||
|
||||
|
||||
/**
|
||||
* 新增点位信息
|
||||
*/
|
||||
@PostMapping("/DWXX")
|
||||
public BlackCarResult addDwxx(@RequestBody List<Point> points) {
|
||||
blackCarService.insertPoint(points);
|
||||
return BlackCarResult.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增交通流量信息
|
||||
*/
|
||||
@PostMapping("/JTLL")
|
||||
public BlackCarResult addJtll(@RequestBody List<TrafficFlowInfo> trafficFlowInfos) {
|
||||
blackCarService.insertTrafficFlowInfo(trafficFlowInfos);
|
||||
return BlackCarResult.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增黑烟车信息
|
||||
*/
|
||||
@PostMapping("/HYC")
|
||||
public BlackCarResult addHyc(@RequestBody List<BlackSmokeVehicle> blackSmokeVehicles) {
|
||||
blackCarService.insertBlackSmokeVehicle(blackSmokeVehicles);
|
||||
return BlackCarResult.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增车流量
|
||||
*/
|
||||
@PostMapping("/CLL")
|
||||
public BlackCarResult addCll(@RequestBody List<VehicleFlow> vehicleFlows) {
|
||||
blackCarService.insertVehicleFlow(vehicleFlows);
|
||||
return BlackCarResult.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增摄像头信息
|
||||
*/
|
||||
@PostMapping("/SXTXX")
|
||||
public BlackCarResult addSxtxx(@RequestBody List<CameraInfo> cameraInfos) {
|
||||
blackCarService.insertCameraInfo(cameraInfos);
|
||||
return BlackCarResult.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package com.bnhz.adapter.controller.kacheck;
|
||||
|
||||
import com.bnhz.adapter.model.kacheck.KaCameraInfo;
|
||||
import com.bnhz.adapter.model.kacheck.KaPoint;
|
||||
import com.bnhz.adapter.model.kacheck.KaTrafficFlowInfo;
|
||||
import com.bnhz.adapter.model.kacheck.KaVehicleFlow;
|
||||
import com.bnhz.adapter.service.kacheck.IKaCheckService;
|
||||
import com.bnhz.common.core.domain.BlackCarResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/9/10 11:28
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/KC/YC")
|
||||
public class KaCheckController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private IKaCheckService kaCheckService;
|
||||
|
||||
|
||||
/**
|
||||
* 新增点位信息
|
||||
*/
|
||||
@PostMapping("/DWXX")
|
||||
public BlackCarResult addDwxx(@RequestBody List<KaPoint> points) {
|
||||
kaCheckService.insertPoint(points);
|
||||
return BlackCarResult.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增交通流量信息
|
||||
*/
|
||||
@PostMapping("/JTLL")
|
||||
public BlackCarResult addJtll(@RequestBody List<KaTrafficFlowInfo> trafficFlowInfos) {
|
||||
kaCheckService.insertTrafficFlowInfo(trafficFlowInfos);
|
||||
return BlackCarResult.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增车流量
|
||||
*/
|
||||
@PostMapping("/CLL")
|
||||
public BlackCarResult addCll(@RequestBody List<KaVehicleFlow> vehicleFlows) {
|
||||
kaCheckService.insertVehicleFlow(vehicleFlows);
|
||||
return BlackCarResult.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增摄像头信息
|
||||
*/
|
||||
@PostMapping("/SXTXX")
|
||||
public BlackCarResult addSxtxx(@RequestBody List<KaCameraInfo> cameraInfos) {
|
||||
kaCheckService.insertCameraInfo(cameraInfos);
|
||||
return BlackCarResult.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.bnhz.adapter.model.blackcar;
|
||||
|
||||
import com.bnhz.iot.model.DataId;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/6/28 16:56
|
||||
*/
|
||||
@Data
|
||||
public abstract class BlackCarId implements DataId {
|
||||
|
||||
/**
|
||||
* 点位编号
|
||||
*/
|
||||
@ApiModelProperty("点位编号")
|
||||
@JsonProperty("DWBH")
|
||||
private String dwbh;
|
||||
|
||||
|
||||
public abstract LocalDateTime getDataTime();
|
||||
|
||||
|
||||
@Override
|
||||
public String getSerialNumber() {
|
||||
return this.dwbh;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,284 @@
|
|||
package com.bnhz.adapter.model.blackcar;
|
||||
|
||||
import com.bnhz.common.annotation.Length;
|
||||
import com.bnhz.common.utils.DateUtils;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 黑烟车信息表
|
||||
*
|
||||
* @author Leo
|
||||
* @date 2024/6/15 12:07
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class BlackSmokeVehicle extends BlackCarId {
|
||||
|
||||
private Long id;
|
||||
|
||||
// 黑烟车记录编号
|
||||
@JsonProperty("JLBH")
|
||||
@ApiModelProperty("黑烟车记录编号")
|
||||
private String jlbh;
|
||||
|
||||
|
||||
// 线编号
|
||||
@JsonProperty("XBH")
|
||||
@ApiModelProperty("线编号")
|
||||
private String xbh;
|
||||
|
||||
// 车道序号
|
||||
@JsonProperty("CDXH")
|
||||
@ApiModelProperty("车道序号")
|
||||
private String cdxh;
|
||||
|
||||
// 抓拍时间
|
||||
@JsonProperty("ZPSJ")
|
||||
@ApiModelProperty("抓拍时间")
|
||||
private Date zpsj;
|
||||
|
||||
// 号牌号码
|
||||
@JsonProperty("HPHM")
|
||||
@ApiModelProperty("号牌号码")
|
||||
private String hphm;
|
||||
|
||||
// 车牌颜色
|
||||
@JsonProperty("HPYS")
|
||||
@ApiModelProperty("车牌颜色")
|
||||
private String hpys;
|
||||
|
||||
// 号牌种类
|
||||
@JsonProperty("HPZL")
|
||||
@ApiModelProperty("号牌种类")
|
||||
private String hpzl;
|
||||
|
||||
// 车辆类型
|
||||
@JsonProperty("CLLX")
|
||||
@ApiModelProperty("车辆类型")
|
||||
private String cllx;
|
||||
|
||||
// 公安车辆类型
|
||||
@JsonProperty("GAVTYPE")
|
||||
@ApiModelProperty("公安车辆类型")
|
||||
private String gavtype;
|
||||
|
||||
// 抓拍次数
|
||||
@JsonProperty("ZPCS")
|
||||
@ApiModelProperty("抓拍次数")
|
||||
private Integer zpcs;
|
||||
|
||||
// 黑烟等级
|
||||
@JsonProperty("HYDJ")
|
||||
@ApiModelProperty("黑烟等级")
|
||||
private Integer hydj;
|
||||
|
||||
// 判定结果
|
||||
@JsonProperty("PDJG")
|
||||
@ApiModelProperty("判定结果")
|
||||
private Integer pdjg;
|
||||
|
||||
// 车辆所属地
|
||||
@JsonProperty("CLSSD")
|
||||
@ApiModelProperty("车辆所属地")
|
||||
private String clssd;
|
||||
|
||||
// 后置车尾图片1
|
||||
@JsonProperty("TP1")
|
||||
@ApiModelProperty("后置车尾图片1")
|
||||
@Length(200)
|
||||
private String tp1;
|
||||
|
||||
// 后置车尾图片2
|
||||
@JsonProperty("TP2")
|
||||
@ApiModelProperty("后置车尾图片2")
|
||||
@Length(200)
|
||||
private String tp2;
|
||||
|
||||
// 前置车头图片1
|
||||
@JsonProperty("TP3")
|
||||
@ApiModelProperty("前置车头图片1")
|
||||
@Length(200)
|
||||
private String tp3;
|
||||
|
||||
// 车牌号码图片
|
||||
@JsonProperty("TP4")
|
||||
@ApiModelProperty("车牌号码图片")
|
||||
@Length(200)
|
||||
private String tp4;
|
||||
|
||||
// 黑烟车证据图片
|
||||
@JsonProperty("TP5")
|
||||
@ApiModelProperty("黑烟车证据图片")
|
||||
@Length(200)
|
||||
private String tp5;
|
||||
|
||||
// 前置车头图片2
|
||||
@JsonProperty("TP6")
|
||||
@ApiModelProperty("前置车头图片2")
|
||||
@Length(200)
|
||||
private String tp6;
|
||||
|
||||
// 车牌特写图
|
||||
@JsonProperty("TP7")
|
||||
@ApiModelProperty("车牌特写图")
|
||||
@Length(200)
|
||||
private String tp7;
|
||||
|
||||
// 黑烟车证据视频
|
||||
@ApiModelProperty("黑烟车证据视频")
|
||||
@JsonProperty("SP")
|
||||
@Length(200)
|
||||
private String sp;
|
||||
|
||||
// 是否已推送交警
|
||||
@ApiModelProperty("是否已推送交警")
|
||||
@JsonProperty("SFYTS")
|
||||
private String sfyts;
|
||||
|
||||
// 推送时间
|
||||
@ApiModelProperty("推送时间")
|
||||
@JsonProperty("TSSJ")
|
||||
private Date tssj;
|
||||
|
||||
// 审核时间
|
||||
@JsonProperty("SHSJ")
|
||||
@ApiModelProperty("审核时间")
|
||||
private Date shsj;
|
||||
|
||||
// 燃料种类
|
||||
@JsonProperty("RLZL")
|
||||
@ApiModelProperty("燃料种类")
|
||||
private String rlzl;
|
||||
|
||||
// 城市编号
|
||||
@JsonProperty("CityCode")
|
||||
@ApiModelProperty("城市编号")
|
||||
private String cityCode;
|
||||
|
||||
// 区县编号
|
||||
@JsonProperty("CountyCode")
|
||||
@ApiModelProperty("区县编号")
|
||||
private String countyCode;
|
||||
|
||||
// 车辆速度
|
||||
@JsonProperty("CLSD")
|
||||
@ApiModelProperty("车辆速度")
|
||||
private BigDecimal clsd;
|
||||
|
||||
// 车辆加速度
|
||||
@JsonProperty("CLJSD")
|
||||
@ApiModelProperty("车辆加速度")
|
||||
private BigDecimal cljsd;
|
||||
|
||||
// VSP
|
||||
@JsonProperty("VSP")
|
||||
@ApiModelProperty("VSP")
|
||||
private BigDecimal vsp;
|
||||
|
||||
// 风速
|
||||
@JsonProperty("FS")
|
||||
@ApiModelProperty("风速")
|
||||
private BigDecimal fs;
|
||||
|
||||
// 风向
|
||||
@JsonProperty("FX")
|
||||
@ApiModelProperty("风向")
|
||||
private String fx;
|
||||
|
||||
// 环境温度
|
||||
@JsonProperty("HJWD")
|
||||
@ApiModelProperty("环境温度")
|
||||
private BigDecimal hjwd;
|
||||
|
||||
// 湿度
|
||||
@JsonProperty("SD")
|
||||
@ApiModelProperty("湿度")
|
||||
private BigDecimal sd;
|
||||
|
||||
// 大气压
|
||||
@JsonProperty("DQY")
|
||||
@ApiModelProperty("大气压")
|
||||
private BigDecimal dqy;
|
||||
|
||||
// 地点经度
|
||||
@JsonProperty("DDJD")
|
||||
@ApiModelProperty("地点经度")
|
||||
private BigDecimal ddjd;
|
||||
|
||||
// 地点纬度
|
||||
@JsonProperty("DDWD")
|
||||
@ApiModelProperty("地点纬度")
|
||||
private BigDecimal ddwd;
|
||||
|
||||
// 车道坡度
|
||||
@JsonProperty("CDPD")
|
||||
@ApiModelProperty("车道坡度")
|
||||
private BigDecimal cdpd;
|
||||
|
||||
// 后置车尾图片1的HTTP链接
|
||||
@JsonProperty("TP1_HTTP")
|
||||
@ApiModelProperty("后置车尾图片1的HTTP链接")
|
||||
private String tp1Http;
|
||||
|
||||
// 后置车尾图片2的HTTP链接
|
||||
@JsonProperty("TP2_HTTP")
|
||||
@ApiModelProperty("后置车尾图片2的HTTP链接")
|
||||
private String tp2Http;
|
||||
|
||||
// 前置车头图片1的HTTP链接
|
||||
@JsonProperty("TP3_HTTP")
|
||||
@ApiModelProperty("前置车头图片1的HTTP链接")
|
||||
private String tp3Http;
|
||||
|
||||
// 车牌号码图片的HTTP链接
|
||||
@JsonProperty("TP4_HTTP")
|
||||
@ApiModelProperty("车牌号码图片的HTTP链接")
|
||||
private String tp4Http;
|
||||
|
||||
// 黑烟车证据图片的HTTP链接
|
||||
@JsonProperty("TP5_HTTP")
|
||||
@ApiModelProperty("黑烟车证据图片的HTTP链接")
|
||||
private String tp5Http;
|
||||
|
||||
// 前置车头图片2的HTTP链接
|
||||
@JsonProperty("TP6_HTTP")
|
||||
@ApiModelProperty("前置车头图片2的HTTP链接")
|
||||
private String tp6Http;
|
||||
|
||||
// 车牌特写图的HTTP链接
|
||||
@JsonProperty("TP7_HTTP")
|
||||
@ApiModelProperty("车牌特写图的HTTP链接")
|
||||
private String tp7Http;
|
||||
|
||||
// 黑烟车证据视频的HTTP链接
|
||||
@JsonProperty("SP_HTTP")
|
||||
@ApiModelProperty("黑烟车证据视频的HTTP链接")
|
||||
private String spHttp;
|
||||
|
||||
// 点位地址
|
||||
@JsonProperty("DWDZ")
|
||||
@ApiModelProperty("点位地址")
|
||||
@Length(200)
|
||||
private String dwdz;
|
||||
|
||||
// 设备编号
|
||||
@JsonProperty("SBBH")
|
||||
@ApiModelProperty("设备编号")
|
||||
private String sbbh;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
@Override
|
||||
public LocalDateTime getDataTime() {
|
||||
return DateUtils.toLocalDateTime(zpsj);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
package com.bnhz.adapter.model.blackcar;
|
||||
|
||||
import com.bnhz.common.annotation.Length;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 摄像头信息表
|
||||
* @author Leo
|
||||
* @date 2024/6/15 15:15
|
||||
*/
|
||||
@Data
|
||||
public class CameraInfo extends BlackCarId {
|
||||
|
||||
private Long id;
|
||||
|
||||
// 摄像头编号
|
||||
@JsonProperty("SXTBH")
|
||||
@ApiModelProperty("摄像头编号")
|
||||
private String sxtbh;
|
||||
|
||||
// 摄像头名称
|
||||
@JsonProperty("SXTMC")
|
||||
@ApiModelProperty("摄像头名称")
|
||||
private String sxtmc;
|
||||
|
||||
// 摄像头类型,1: 海康,2: 大华,3: 其他
|
||||
@JsonProperty("SPLX")
|
||||
@ApiModelProperty("摄像头类型")
|
||||
private Integer splx;
|
||||
|
||||
// 是否有效,0: 无效,1: 有效
|
||||
@JsonProperty("SFYX")
|
||||
@ApiModelProperty("是否有效")
|
||||
private Integer sfyx;
|
||||
|
||||
|
||||
// IP地址
|
||||
@JsonProperty("IP")
|
||||
@ApiModelProperty("IP地址")
|
||||
private String ip;
|
||||
|
||||
// 联网状态,0: 断开,1: 在线
|
||||
@JsonProperty("LWZT")
|
||||
@ApiModelProperty("联网状态")
|
||||
private Integer lwzt;
|
||||
|
||||
// 摄像头类型,1: 前置,2: 后置
|
||||
@JsonProperty("SXTLX")
|
||||
@ApiModelProperty("摄像头类型")
|
||||
private Integer sxtlx;
|
||||
|
||||
// 摄像头朝向
|
||||
@JsonProperty("SXTCX")
|
||||
@ApiModelProperty("摄像头朝向")
|
||||
private String sxtcx;
|
||||
|
||||
// 抓拍车道数
|
||||
@JsonProperty("ZPCDS")
|
||||
@ApiModelProperty("抓拍车道数")
|
||||
private Integer zpcds;
|
||||
|
||||
// 通道号
|
||||
@JsonProperty("TDH")
|
||||
@ApiModelProperty("通道号")
|
||||
private String tdh;
|
||||
|
||||
// 摄像头备案号
|
||||
@JsonProperty("SXTBAH")
|
||||
@ApiModelProperty("摄像头备案号")
|
||||
private String sxtbah;
|
||||
|
||||
// HLS播放地址高清
|
||||
@JsonProperty("HLSGQ")
|
||||
@ApiModelProperty("HLS播放地址高清")
|
||||
@Length(200)
|
||||
private String hlsgq;
|
||||
|
||||
// HLS播放地址流畅
|
||||
@JsonProperty("HLSLC")
|
||||
@ApiModelProperty("HLS播放地址流畅")
|
||||
@Length(200)
|
||||
private String hlslc;
|
||||
|
||||
// 是否启用,1: 正常,2: 调试,3: 暂停
|
||||
@JsonProperty("SFQY")
|
||||
@ApiModelProperty("是否启用")
|
||||
private Integer sfqy;
|
||||
|
||||
// 登录账号
|
||||
@JsonProperty("DLZH")
|
||||
@ApiModelProperty("登录账号")
|
||||
private String dlzh;
|
||||
|
||||
// 登录密码
|
||||
@JsonProperty("DLMM")
|
||||
@ApiModelProperty("登录密码")
|
||||
private String dlmm;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
@Override
|
||||
public LocalDateTime getDataTime() {
|
||||
return LocalDateTime.now();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package com.bnhz.adapter.model.blackcar;
|
||||
|
||||
import com.bnhz.common.annotation.Length;
|
||||
import com.bnhz.common.utils.DateUtils;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 点位信息
|
||||
*
|
||||
* @author Leo
|
||||
* @date 2024/6/14 17:46
|
||||
*/
|
||||
|
||||
@ToString
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@FieldNameConstants
|
||||
public class Point extends BlackCarId {
|
||||
|
||||
private Long bisId;
|
||||
|
||||
@JsonProperty("DWMC")
|
||||
@ApiModelProperty("点位名称")
|
||||
private String dwmc;
|
||||
|
||||
@JsonProperty("DWLX")
|
||||
@ApiModelProperty("点位类型")
|
||||
private String dwlx;
|
||||
|
||||
@JsonProperty("YXRQ")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty("运行日期")
|
||||
private Date yxrq;
|
||||
|
||||
@JsonProperty("DWZT")
|
||||
@ApiModelProperty("点位状态")
|
||||
private String dwzt;
|
||||
|
||||
@JsonProperty("DWDZ")
|
||||
@ApiModelProperty("点位地址")
|
||||
@Length(200)
|
||||
private String dwdz;
|
||||
|
||||
@JsonProperty("DDJD")
|
||||
@ApiModelProperty("地点经度")
|
||||
private BigDecimal ddjd;
|
||||
|
||||
@JsonProperty("DDWD")
|
||||
@ApiModelProperty("地点纬度")
|
||||
private BigDecimal ddwd;
|
||||
|
||||
@JsonProperty("CLFX")
|
||||
@ApiModelProperty("车流方向")
|
||||
private String clfx;
|
||||
|
||||
@JsonProperty("CDSL")
|
||||
@ApiModelProperty("车道数量")
|
||||
private Integer cdsl;
|
||||
|
||||
@JsonProperty("CDPD")
|
||||
@ApiModelProperty("车道坡度")
|
||||
private BigDecimal cdpd;
|
||||
|
||||
@JsonProperty("YCXS")
|
||||
@ApiModelProperty("遥测线数")
|
||||
private Integer ycxs;
|
||||
|
||||
@JsonProperty("HPHM")
|
||||
@ApiModelProperty("号牌号码")
|
||||
private String hphm;
|
||||
|
||||
@JsonProperty("CLXH")
|
||||
@ApiModelProperty("装载车型号")
|
||||
private String clxh;
|
||||
|
||||
@JsonProperty("ZYLX")
|
||||
@ApiModelProperty("点位作用类型")
|
||||
private String zylx;
|
||||
|
||||
@JsonProperty("SSSP")
|
||||
@ApiModelProperty("实时视频链接")
|
||||
@Length(value = 200)
|
||||
private String sssp;
|
||||
|
||||
@JsonProperty("CityCode")
|
||||
@ApiModelProperty("城市编号")
|
||||
private String cityCode;
|
||||
|
||||
@JsonProperty("CountyCode")
|
||||
@ApiModelProperty("区县编号")
|
||||
private String countyCode;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
@Override
|
||||
public LocalDateTime getDataTime() {
|
||||
return DateUtils.toLocalDateTime(yxrq);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package com.bnhz.adapter.model.blackcar;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 点位环境空气质量记录表
|
||||
* @author Leo
|
||||
* @date 2024/6/15 11:14
|
||||
*/
|
||||
@Data
|
||||
public class PointEnvironmentalData {
|
||||
|
||||
private Long id;
|
||||
|
||||
// 记录时间,主键,格式为YYYY-MM-DD HH:mm:SS
|
||||
@JsonProperty("JLSJ")
|
||||
//@JsonFormat(pattern = "yyyy-MM-ddTHH:mm:ss")
|
||||
private Date jlsj;
|
||||
|
||||
// 点位编号,主键
|
||||
@JsonProperty("DWBH")
|
||||
private String dwbh;
|
||||
|
||||
// PM2.5浓度,单位为微克/立方米
|
||||
@JsonProperty("PM25")
|
||||
private BigDecimal pm25;
|
||||
|
||||
// PM10浓度,单位为微克/立方米
|
||||
@JsonProperty("PM10")
|
||||
private BigDecimal pm10;
|
||||
|
||||
// 一氧化碳浓度,单位为毫克/立方米
|
||||
@JsonProperty("CO")
|
||||
private BigDecimal co;
|
||||
|
||||
// 二氧化硫浓度,单位为微克/立方米
|
||||
@JsonProperty("SO2")
|
||||
private BigDecimal so2;
|
||||
|
||||
// 臭氧浓度,单位为微克/立方米
|
||||
@JsonProperty("O3")
|
||||
private BigDecimal o3;
|
||||
|
||||
// 二氧化氮浓度,单位为微克/立方米
|
||||
@JsonProperty("NO2")
|
||||
private BigDecimal no2;
|
||||
|
||||
// 氨气浓度,单位为微克/立方米
|
||||
@JsonProperty("NH3")
|
||||
private BigDecimal nh3;
|
||||
|
||||
// 挥发性有机化合物浓度,单位为微克/立方米
|
||||
@JsonProperty("VOC")
|
||||
private BigDecimal voc;
|
||||
|
||||
// 总挥发性有机化合物浓度,单位为微克/立方米
|
||||
@JsonProperty("TVOC")
|
||||
private BigDecimal tvoc;
|
||||
|
||||
// 硫化氢浓度,单位为微克/立方米
|
||||
@JsonProperty("H2S")
|
||||
private BigDecimal h2s;
|
||||
|
||||
// 温度,单位为摄氏度
|
||||
@JsonProperty("WD")
|
||||
private BigDecimal wd;
|
||||
|
||||
// 湿度,百分比
|
||||
@JsonProperty("SD")
|
||||
private BigDecimal sd;
|
||||
|
||||
// 大气压,单位为帕斯卡
|
||||
@JsonProperty("DQY")
|
||||
private BigDecimal dqy;
|
||||
|
||||
// 风速,单位为米/秒
|
||||
@JsonProperty("FS")
|
||||
private BigDecimal fs;
|
||||
|
||||
// 空气质量指数
|
||||
@JsonProperty("AQI")
|
||||
private BigDecimal aqi;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
package com.bnhz.adapter.model.blackcar;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 点位遥测线信息表
|
||||
*
|
||||
* @author Leo
|
||||
* @date 2024/6/14 18:16
|
||||
*/
|
||||
@Data
|
||||
public class PointMonitoringLine {
|
||||
|
||||
private Long id;
|
||||
|
||||
@JsonProperty("DWBH")
|
||||
private String dwbh; // 点位编号
|
||||
|
||||
@JsonProperty("YCXBH")
|
||||
private String ycxbh; // 运测线编号
|
||||
|
||||
@JsonProperty("CDXH")
|
||||
private String cdxh; // 车道序号
|
||||
|
||||
@JsonProperty("JCXTXH")
|
||||
private String jcxtxh; // 监测系统型号
|
||||
|
||||
@JsonProperty("JCXTMC")
|
||||
private String jcxtmc; // 监测系统名称
|
||||
|
||||
@JsonProperty("JCXTBH")
|
||||
private String jcxtbh; // 监测系统编号
|
||||
|
||||
@JsonProperty("JCXTZZC")
|
||||
private String jcxtzzc; // 监测系统制造厂
|
||||
|
||||
@JsonProperty("CSYXH")
|
||||
private String csyxh; // 测速仪型号
|
||||
|
||||
@JsonProperty("CSYSCC")
|
||||
private String csyscc; // 测速仪生产厂
|
||||
|
||||
@JsonProperty("CSYYXQ")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date csyyxq; // 测速仪有效期
|
||||
|
||||
@JsonProperty("QTCSYXH")
|
||||
private String qtcsxh; // 气体测试仪型号
|
||||
|
||||
@JsonProperty("QTCSYSCC")
|
||||
private String qtyssc; // 气体测试仪生产厂
|
||||
|
||||
@JsonProperty("QTCSYYXQ")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date qtcsyyxq; // 气体测试仪有效期
|
||||
|
||||
@JsonProperty("YDJXH")
|
||||
private String ydjxh; // 烟度计型号
|
||||
|
||||
@JsonProperty("YDJSCC")
|
||||
private String ydjscc; // 烟度计生产厂
|
||||
|
||||
@JsonProperty("YDJYXQ")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date ydjyxq; // 烟度计有效期
|
||||
|
||||
@JsonProperty("SXJXH")
|
||||
private String sxjxh; // 摄像机型号
|
||||
|
||||
@JsonProperty("SXXTSCC")
|
||||
private String sxxtscc; // 摄像机生产厂
|
||||
|
||||
@JsonProperty("SXXTYXQ")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date sxxtyxq; // 摄像机有效期
|
||||
|
||||
@JsonProperty("PDJXH")
|
||||
private String pdjxh; // 坡度计型号
|
||||
|
||||
@JsonProperty("PDJSCC")
|
||||
private String pdjscc; // 坡度计生产厂
|
||||
|
||||
@JsonProperty("PDJYXQ")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date pdjyxq; // 坡度计有效期
|
||||
|
||||
@JsonProperty("QXZXH")
|
||||
private String qxzxh; // 气象站型号
|
||||
|
||||
@JsonProperty("QXZSCC")
|
||||
private String qxzscc; // 气象站生产厂
|
||||
|
||||
@JsonProperty("QXZYXQ")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date qxzyxq; // 气象站有效期
|
||||
|
||||
@JsonProperty("YCXLX")
|
||||
private String ycxlx; // 运测线类型
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
package com.bnhz.adapter.model.blackcar;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/6/15 09:56
|
||||
*/
|
||||
@Data
|
||||
public class RunLocationRecord {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 点位编号
|
||||
*/
|
||||
@JsonProperty("DWBH")
|
||||
private String dwbh;
|
||||
|
||||
/**
|
||||
* 遥测线编号
|
||||
*/
|
||||
@JsonProperty("YCXBH")
|
||||
private String ycxbh;
|
||||
|
||||
/**
|
||||
* 监测点位日志号
|
||||
*/
|
||||
@JsonProperty("JCDWRZH")
|
||||
private String jcdwrzh;
|
||||
|
||||
/**
|
||||
* 车道序号
|
||||
*/
|
||||
@JsonProperty("CDXH")
|
||||
private String cdxh;
|
||||
|
||||
/**
|
||||
* 车流方向 1-上行 2-下行
|
||||
*/
|
||||
@JsonProperty("CLFX")
|
||||
private String clfx;
|
||||
|
||||
/**
|
||||
* 运行地址
|
||||
*/
|
||||
@JsonProperty("YXDZ")
|
||||
private String yxdz;
|
||||
|
||||
/**
|
||||
* 地点经度
|
||||
*/
|
||||
@JsonProperty("DDJD")
|
||||
private BigDecimal ddjd;
|
||||
|
||||
/**
|
||||
* 地点纬度
|
||||
*/
|
||||
@JsonProperty("DDWD")
|
||||
private BigDecimal ddwd;
|
||||
|
||||
/**
|
||||
* 车道坡度
|
||||
*/
|
||||
@JsonProperty("CDPD")
|
||||
private BigDecimal cdpd;
|
||||
|
||||
/**
|
||||
* 运行开始时间
|
||||
*/
|
||||
@JsonProperty("YXKSSJ")
|
||||
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date yxkssj;
|
||||
|
||||
/**
|
||||
* 运行结束时间
|
||||
*/
|
||||
@JsonProperty("YXJSSJ")
|
||||
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date yxjssj;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
}
|
|
@ -0,0 +1,195 @@
|
|||
package com.bnhz.adapter.model.blackcar;
|
||||
|
||||
import com.bnhz.common.annotation.Length;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 交通流量信息
|
||||
*
|
||||
* @author Leo
|
||||
* @date 2024/6/15 10:05
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class TrafficFlowInfo extends BlackCarId{
|
||||
|
||||
private Long id;
|
||||
|
||||
|
||||
/**
|
||||
* 流量编号
|
||||
*/
|
||||
@JsonProperty("LLBH")
|
||||
@ApiModelProperty("流量编号")
|
||||
private String llbh;
|
||||
|
||||
/**
|
||||
* 监测点位日志号
|
||||
*/
|
||||
@JsonProperty("JCDWRZH")
|
||||
@ApiModelProperty("监测点位日志号")
|
||||
private String jcdwrzh;
|
||||
|
||||
/**
|
||||
* 所属道路
|
||||
*/
|
||||
@JsonProperty("SSDL")
|
||||
@ApiModelProperty("所属道路")
|
||||
@Length(value = 200)
|
||||
private String ssdl;
|
||||
|
||||
/**
|
||||
* 流量分类
|
||||
*/
|
||||
@JsonProperty("LLFL")
|
||||
@ApiModelProperty("流量分类")
|
||||
private String llfl;
|
||||
|
||||
/**
|
||||
* 统计时长
|
||||
*/
|
||||
@JsonProperty("TJSC")
|
||||
@ApiModelProperty("统计时长")
|
||||
private String tjsc;
|
||||
|
||||
/**
|
||||
* 采集时段
|
||||
*/
|
||||
@JsonProperty("CJSD")
|
||||
@ApiModelProperty("采集时段")
|
||||
private Integer cjsd;
|
||||
|
||||
/**
|
||||
* 采集序号
|
||||
*/
|
||||
@JsonProperty("CJXH")
|
||||
@ApiModelProperty("采集序号")
|
||||
private Integer cjxh;
|
||||
|
||||
/**
|
||||
* 统计日期
|
||||
*/
|
||||
@JsonProperty("TTRQ")
|
||||
@ApiModelProperty("统计日期")
|
||||
private Date ttrq;
|
||||
|
||||
/**
|
||||
* 车道序号
|
||||
*/
|
||||
@JsonProperty("CDXH")
|
||||
@ApiModelProperty("车道序号")
|
||||
private String cdxh;
|
||||
|
||||
/**
|
||||
* 微小型客车数
|
||||
*/
|
||||
@JsonProperty("WXXKCS")
|
||||
@ApiModelProperty("微小型客车数")
|
||||
private Integer wxxkcs;
|
||||
|
||||
/**
|
||||
* 中型客车数
|
||||
*/
|
||||
@JsonProperty("ZXKCS")
|
||||
@ApiModelProperty("中型客车数")
|
||||
private Integer zxkcs;
|
||||
|
||||
/**
|
||||
* 大型客车数
|
||||
*/
|
||||
@JsonProperty("DXKCS")
|
||||
@ApiModelProperty("大型客车数")
|
||||
private Integer dxkcs;
|
||||
|
||||
/**
|
||||
* 小型货车数
|
||||
*/
|
||||
@JsonProperty("XXHCS")
|
||||
@ApiModelProperty("小型货车数")
|
||||
private Integer xxhcs;
|
||||
|
||||
/**
|
||||
* 中型货车数
|
||||
*/
|
||||
@JsonProperty("ZXHCS")
|
||||
@ApiModelProperty("中型货车数")
|
||||
private Integer zxhcs;
|
||||
|
||||
/**
|
||||
* 重型货车数
|
||||
*/
|
||||
@JsonProperty("ZXHCS1")
|
||||
@ApiModelProperty("重型货车数")
|
||||
private Integer zxhcs1;
|
||||
|
||||
/**
|
||||
* 通行车辆数
|
||||
*/
|
||||
@JsonProperty("TXCLS")
|
||||
@ApiModelProperty("通行车辆数")
|
||||
private Integer txcls;
|
||||
|
||||
/**
|
||||
* 平均速度
|
||||
*/
|
||||
@JsonProperty("PJSD")
|
||||
@ApiModelProperty("平均速度")
|
||||
private Integer pjsd;
|
||||
|
||||
/**
|
||||
* 平均排队长度
|
||||
*/
|
||||
@JsonProperty("PJPDCD")
|
||||
@ApiModelProperty("平均排队长度")
|
||||
private Integer pjpdc;
|
||||
|
||||
/**
|
||||
* 汽油车数
|
||||
*/
|
||||
@JsonProperty("QYCS")
|
||||
@ApiModelProperty("汽油车数")
|
||||
private Integer qycs;
|
||||
|
||||
/**
|
||||
* 柴油车数
|
||||
*/
|
||||
@JsonProperty("CYCS")
|
||||
@ApiModelProperty("柴油车数")
|
||||
private Integer cycs;
|
||||
|
||||
/**
|
||||
* 本地市车辆数
|
||||
*/
|
||||
@JsonProperty("BDCS")
|
||||
@ApiModelProperty("本地市车辆数")
|
||||
private Integer bdcs;
|
||||
|
||||
/**
|
||||
* 本省车辆数
|
||||
*/
|
||||
@JsonProperty("BSCS")
|
||||
@ApiModelProperty("本省车辆数")
|
||||
private Integer bscs;
|
||||
|
||||
/**
|
||||
* 外省车辆数
|
||||
*/
|
||||
@JsonProperty("WSCS")
|
||||
@ApiModelProperty("外省车辆数")
|
||||
private Integer wscs;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
@Override
|
||||
public LocalDateTime getDataTime() {
|
||||
return LocalDateTime.now();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
package com.bnhz.adapter.model.blackcar;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 车辆数据信息表
|
||||
* @author Leo
|
||||
* @date 2024/6/15 11:56
|
||||
*/
|
||||
@Data
|
||||
public class VehicleData {
|
||||
|
||||
private Long id;
|
||||
|
||||
// 行政区划代码,符合GB/T2260,车辆注册地的6位区划代码
|
||||
@JsonProperty("XZQHDM")
|
||||
private String xzqhdm;
|
||||
// 号牌号码
|
||||
@JsonProperty("HPHM")
|
||||
private String hphm;
|
||||
// 车牌颜色
|
||||
@JsonProperty("HPYS")
|
||||
private String hpys;
|
||||
// 号牌种类,参考号牌种类数据约束,例如:01
|
||||
@JsonProperty("HPZL")
|
||||
private String hpzl;
|
||||
// 车辆型号
|
||||
@JsonProperty("CLXH")
|
||||
private String clxh;
|
||||
// 生产企业
|
||||
@JsonProperty("SCQY")
|
||||
private String scqy;
|
||||
// 燃料种类
|
||||
@JsonProperty("RLZL")
|
||||
private String rlzl;
|
||||
// 使用性质
|
||||
@JsonProperty("SYXZ")
|
||||
private String syxz;
|
||||
// 初次登记日期,格式YYYY-MM-DD
|
||||
@JsonProperty("CCDJRQ")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date ccdjrq;
|
||||
// 车辆识别代号
|
||||
@JsonProperty("CLSBDH")
|
||||
private String clsbdh;
|
||||
// 排放标准阶段
|
||||
@JsonProperty("PFBZJD")
|
||||
private String pfbzjd;
|
||||
// 车辆类型,参考公安车辆类型数据约束
|
||||
@JsonProperty("GAVTYPE")
|
||||
private String gavtype;
|
||||
// 车辆品牌
|
||||
@JsonProperty("CLPP")
|
||||
private String clpp;
|
||||
// 发动机型号
|
||||
@JsonProperty("FDJXH")
|
||||
private String fdjxh;
|
||||
// 发动机生产厂家
|
||||
@JsonProperty("FDJSCCJ")
|
||||
private String fdjsccj;
|
||||
//车主
|
||||
@JsonProperty("CZ")
|
||||
private String cz;
|
||||
// 车主地址
|
||||
@JsonProperty("CZDZ")
|
||||
private String czdz;
|
||||
// 车主联系电话
|
||||
@JsonProperty("CZLXDH")
|
||||
private String czlxdh;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
package com.bnhz.adapter.model.blackcar;
|
||||
|
||||
import com.bnhz.common.annotation.Length;
|
||||
import com.bnhz.common.utils.DateUtils;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 车流量
|
||||
*
|
||||
* @author Leo
|
||||
* @date 2024/6/15 14:53
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class VehicleFlow extends BlackCarId {
|
||||
|
||||
|
||||
private Long id;
|
||||
|
||||
//车流量记录编号
|
||||
@JsonProperty("LLBH")
|
||||
@ApiModelProperty("车流量记录编号")
|
||||
private String llbh;
|
||||
|
||||
// 车牌号
|
||||
@JsonProperty("HPHM")
|
||||
@ApiModelProperty("车牌号")
|
||||
private String hphm;
|
||||
|
||||
// 车牌颜色
|
||||
@JsonProperty("HPYS")
|
||||
@ApiModelProperty("车牌颜色")
|
||||
private String hpys;
|
||||
// 抓拍时间
|
||||
@JsonProperty("ZPSJ")
|
||||
@ApiModelProperty("抓拍时间")
|
||||
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date zpsj;
|
||||
|
||||
// 是否被抓拍
|
||||
@JsonProperty("SFBZP")
|
||||
@ApiModelProperty("是否被抓拍")
|
||||
private Integer sfbzp;
|
||||
// 行政区划代码
|
||||
@JsonProperty("XZQHDM")
|
||||
@ApiModelProperty("行政区划代码")
|
||||
private String xzqhdm;
|
||||
|
||||
// 车流速度
|
||||
@JsonProperty("CLSD")
|
||||
@ApiModelProperty("车流速度")
|
||||
private BigDecimal clsd;
|
||||
|
||||
// 车辆所属地
|
||||
@JsonProperty("CLSSD")
|
||||
@ApiModelProperty("车辆所属地")
|
||||
private Integer clssd;
|
||||
|
||||
// 车道号
|
||||
@JsonProperty("CDXH")
|
||||
@ApiModelProperty("车道号")
|
||||
private Integer cdxh;
|
||||
|
||||
// 车身颜色中文名(可空)
|
||||
@JsonProperty("CSYS")
|
||||
@ApiModelProperty("车身颜色中文名")
|
||||
private String csys;
|
||||
// 号牌种类(可空)
|
||||
@JsonProperty("HPZL")
|
||||
@ApiModelProperty("号牌种类")
|
||||
private String hpzl;
|
||||
// 车辆类型
|
||||
@JsonProperty("CLLX")
|
||||
@ApiModelProperty("车辆类型")
|
||||
private String cllx;
|
||||
// 燃料种类
|
||||
@JsonProperty("RLZL")
|
||||
@ApiModelProperty("燃料种类")
|
||||
private String rlzl;
|
||||
// 全景图(可空)
|
||||
@JsonProperty("TP1")
|
||||
@ApiModelProperty("全景图")
|
||||
@Length(200)
|
||||
private String tp1;
|
||||
// 号牌图片(可空)
|
||||
@JsonProperty("tp2")
|
||||
@ApiModelProperty("号牌图片")
|
||||
@Length(200)
|
||||
private String tp2;
|
||||
// 视频(可空)
|
||||
@JsonProperty("sp1")
|
||||
@ApiModelProperty("视频")
|
||||
@Length(200)
|
||||
private String sp1;
|
||||
// 后置车尾图片1
|
||||
@JsonProperty("TP1_HTTP")
|
||||
@ApiModelProperty("后置车尾图片1")
|
||||
@Length(200)
|
||||
private String tp1Http;
|
||||
|
||||
@JsonProperty("TP2_HTTP")
|
||||
@ApiModelProperty("后置车尾图片2")
|
||||
@Length(200)
|
||||
private String tp2Http; // 后置车尾图片2
|
||||
|
||||
@JsonProperty("SP1_HTTP")
|
||||
@ApiModelProperty("黑烟车证据视频")
|
||||
@Length(200)
|
||||
private String sp1Http; // 黑烟车证据视频
|
||||
|
||||
@JsonProperty("CityCode")
|
||||
@ApiModelProperty("城市编号")
|
||||
private String cityCode; // 城市编号
|
||||
|
||||
@JsonProperty("CountyCode")
|
||||
@ApiModelProperty("区县编号")
|
||||
private String countyCode; // 区县编号
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
@Override
|
||||
public LocalDateTime getDataTime() {
|
||||
return DateUtils.toLocalDateTime(zpsj);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
package com.bnhz.adapter.model.blackcar;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 遥测设备检查信息表
|
||||
*
|
||||
* @author Leo
|
||||
* @date 2024/6/15 11:44
|
||||
*/
|
||||
@Data
|
||||
public class YcDeviceCheck {
|
||||
|
||||
private Long id;
|
||||
|
||||
// 点位编号
|
||||
@JsonProperty("DWBH")
|
||||
private String dwbh;
|
||||
// 遥测线编号
|
||||
@JsonProperty("YCXBH")
|
||||
private String ycxbh;
|
||||
// 检查记录编号,主键:点位编号+遥测线编号+检查开始时间
|
||||
@JsonProperty("JCJILBH")
|
||||
private String jcjilbh;
|
||||
// 检查类型,1-静态,2-动态
|
||||
@JsonProperty("JCLX")
|
||||
private Integer jclx;
|
||||
// 检查开始时间
|
||||
@JsonProperty("JCKSSJ")
|
||||
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date jckssj;
|
||||
|
||||
// 是否通过,Y/N
|
||||
@JsonProperty("SFTG")
|
||||
private String sftg;
|
||||
// 备注
|
||||
@JsonProperty("BZ")
|
||||
private String bz;
|
||||
// 检查单位
|
||||
@JsonProperty("JCDW")
|
||||
private String jcdw;
|
||||
// 检查人员
|
||||
@JsonProperty("JCRY")
|
||||
private String jcry;
|
||||
// 标气类别,1-高标气(标准)0低标气(检查)
|
||||
@JsonProperty("BQLB")
|
||||
private String bqlb;
|
||||
// 行驶速度,动态检查
|
||||
@JsonProperty("XSSD")
|
||||
private BigDecimal xssd;
|
||||
// CO2标准值
|
||||
@JsonProperty("CO2BZZ")
|
||||
private BigDecimal co2bzz;
|
||||
// CO2测量值
|
||||
@JsonProperty("CO2CLZ")
|
||||
private BigDecimal co2clz;
|
||||
// CO标准值
|
||||
@JsonProperty("COBZZ")
|
||||
private BigDecimal cobzz;
|
||||
// CO测量值
|
||||
@JsonProperty("COCLZ")
|
||||
private BigDecimal cocLz;
|
||||
// NO标准值
|
||||
@JsonProperty("NOBZZ")
|
||||
private BigDecimal nobzz;
|
||||
// NO测量值
|
||||
@JsonProperty("NOCLZ")
|
||||
private BigDecimal noclz;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
package com.bnhz.adapter.model.blackcar;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 遥测设备自检信息表
|
||||
*
|
||||
* @author Leo
|
||||
* @date 2024/6/15 11:30
|
||||
*/
|
||||
@Data
|
||||
public class YcDeviceSelfCheck {
|
||||
|
||||
private Long id;
|
||||
|
||||
@JsonProperty("DWBH")
|
||||
private String dwbh;
|
||||
|
||||
@JsonProperty("YCXBH")
|
||||
private String ycxbh;
|
||||
|
||||
@JsonProperty("ZJJLBH")
|
||||
private String zjjlbh;
|
||||
|
||||
@JsonProperty("ZJKSRQ")
|
||||
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date zjksrq;
|
||||
|
||||
@JsonProperty("SFTG")
|
||||
private String sftg; // 是否通过
|
||||
|
||||
@JsonProperty("BZ")
|
||||
private String bz; // 备注
|
||||
|
||||
@JsonProperty("CO2BZZ")
|
||||
private BigDecimal co2bzz; // CO2标准值
|
||||
|
||||
@JsonProperty("COBZZ")
|
||||
private BigDecimal cobzz; // CO标准值
|
||||
|
||||
@JsonProperty("DEXBZZ")
|
||||
private BigDecimal dexbzz; // 1,3-丁二烯标准值
|
||||
|
||||
@JsonProperty("BWBZZ")
|
||||
private BigDecimal bwbzz; // 丙烷标准值
|
||||
|
||||
@JsonProperty("NOBZZ")
|
||||
private BigDecimal nobzz; // NO标准值
|
||||
|
||||
@JsonProperty("CO2CLZ")
|
||||
private BigDecimal co2clz; // CO2测量值
|
||||
|
||||
@JsonProperty("COCLZ")
|
||||
private BigDecimal coclz; // CO测量值
|
||||
|
||||
@JsonProperty("DEXCLZ")
|
||||
private BigDecimal dexclz; // 1,3-丁二烯测量值
|
||||
|
||||
@JsonProperty("BWCLZ")
|
||||
private BigDecimal bwclz; // 丙烷测量值
|
||||
|
||||
@JsonProperty("NOCLZ")
|
||||
private BigDecimal noclz; // NO测量值
|
||||
|
||||
@JsonProperty("YDP1BZZ")
|
||||
private BigDecimal ydp1bzz; // 烟度片1标准值
|
||||
|
||||
@JsonProperty("YDP2BZZ")
|
||||
private BigDecimal ydp2bzz; // 烟度片2标准值
|
||||
|
||||
@JsonProperty("YDP3BZZ")
|
||||
private BigDecimal ydp3bzz; // 烟度片3标准值
|
||||
|
||||
@JsonProperty("YDP4BZZ")
|
||||
private BigDecimal ydp4bzz; // 烟度片4标准值
|
||||
|
||||
@JsonProperty("YDP5BZZ")
|
||||
private BigDecimal ydp5bzz; // 烟度片5标准值
|
||||
|
||||
@JsonProperty("YDP1CLZ")
|
||||
private BigDecimal ydp1clz; // 烟度片1测量值
|
||||
|
||||
@JsonProperty("YDP2CLZ")
|
||||
private BigDecimal ydp2clz; // 烟度片2测量值
|
||||
|
||||
@JsonProperty("YDP3CLZ")
|
||||
private BigDecimal ydp3clz; // 烟度片3测量值
|
||||
|
||||
@JsonProperty("YDP4CLZ")
|
||||
private BigDecimal ydp4clz; // 烟度片4测量值
|
||||
|
||||
@JsonProperty("YDP5CLZ")
|
||||
private BigDecimal ydp5clz; // 烟度片5测量值
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.bnhz.adapter.model.blackcar;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 遥测不合格表
|
||||
*
|
||||
* @author Leo
|
||||
* @date 2024/6/15 15:20
|
||||
*/
|
||||
@Data
|
||||
public class YcFailure {
|
||||
|
||||
|
||||
private Long id;
|
||||
|
||||
// 监测时间
|
||||
@JsonProperty("JCSJ")
|
||||
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date jcsj;
|
||||
|
||||
|
||||
// 号牌号码
|
||||
@JsonProperty("HPHM")
|
||||
private String hphm;
|
||||
|
||||
// 车牌颜色
|
||||
@JsonProperty("hpys")
|
||||
private String hpys;
|
||||
|
||||
// 车辆类型
|
||||
@JsonProperty("CLLX")
|
||||
private String cllx;
|
||||
|
||||
// 燃料种类
|
||||
@JsonProperty("RLZL")
|
||||
private String rlzl;
|
||||
|
||||
// 在该点位被抓拍次数
|
||||
@JsonProperty("ZPCS")
|
||||
private Integer zpcs;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
}
|
|
@ -0,0 +1,249 @@
|
|||
package com.bnhz.adapter.model.blackcar;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 遥感监测数据信息表
|
||||
* @author Leo
|
||||
* @date 2024/6/15 10:32
|
||||
*/
|
||||
@Data
|
||||
public class YcMonitoringData {
|
||||
|
||||
private Long id;
|
||||
|
||||
// 记录编号,长度为30,不可为空
|
||||
@JsonProperty("JLBH")
|
||||
private String jlbh;
|
||||
|
||||
// 点位编号,长度为10,不可为空
|
||||
@JsonProperty("DWBH")
|
||||
private String dwbh;
|
||||
|
||||
// 遥测线编号,长度为2,不可为空
|
||||
@JsonProperty("YCXBH")
|
||||
private String ycxbh;
|
||||
|
||||
// 监测点位日志号,长度为8,可为空
|
||||
@JsonProperty("JCDWRZH")
|
||||
private String jcdwrzh;
|
||||
|
||||
// 监测人员姓名,长度为50,可为空
|
||||
@JsonProperty("JCRYXM")
|
||||
private String jcryxm;
|
||||
|
||||
// 车道序号,长度为6,不可为空
|
||||
@JsonProperty("CDXH")
|
||||
private String cdxh;
|
||||
|
||||
// 监测时间
|
||||
@JsonProperty("JCRQ")
|
||||
private Date jcrq;
|
||||
|
||||
// 地点经度,长度为10,小数点后5位,不可为空
|
||||
@JsonProperty("DDJD")
|
||||
private BigDecimal ddjd;
|
||||
|
||||
// 地点纬度,长度为10,小数点后5位,不可为空
|
||||
@JsonProperty("DDWD")
|
||||
private BigDecimal ddwd;
|
||||
|
||||
// 车道坡度,长度为3,小数点后2位,不可为空
|
||||
@JsonProperty("CDPD")
|
||||
private BigDecimal cdpd;
|
||||
|
||||
// 判定结果,长度为1,不可为空,0-超标,1-合格,2-不判定,3-无效
|
||||
@JsonProperty("PDJG")
|
||||
private String pdjg;
|
||||
// 号牌号码,长度为18,不可为空
|
||||
@JsonProperty("HPHM")
|
||||
private String hphm;
|
||||
|
||||
// 车牌颜色,长度为2,不可为空
|
||||
@JsonProperty("CPYS")
|
||||
private String cpys;
|
||||
|
||||
// 号牌种类,长度为2,不可为空
|
||||
@JsonProperty("HPZL")
|
||||
private String hpzl;
|
||||
|
||||
// 燃料种类,长度为1,不可为空
|
||||
@JsonProperty("RLZL")
|
||||
private String rlzl;
|
||||
|
||||
// CO2 结果,单位为%,长度为3.2,可为空
|
||||
@JsonProperty("CO2JG")
|
||||
private BigDecimal co2jg;
|
||||
|
||||
// CO/CO2 比率,单位为%,长度为3.2,可为空
|
||||
@JsonProperty("COCO2")
|
||||
private BigDecimal coco2;
|
||||
|
||||
// HC/CO2 比率,单位为%,长度为3.2,可为空
|
||||
@JsonProperty("HCCO2")
|
||||
private BigDecimal hcco2;
|
||||
|
||||
// NO/CO2 比率,单位为%,长度为3.2,可为空
|
||||
@JsonProperty("NOCO2")
|
||||
private BigDecimal noco2;
|
||||
|
||||
// CO 结果,单位为%,长度为3.2,可为空
|
||||
@JsonProperty("COJG")
|
||||
private BigDecimal cojg;
|
||||
|
||||
// HC 结果,单位为ppm,长度为4.2,可为空
|
||||
@JsonProperty("HCJG")
|
||||
private BigDecimal hcjg;
|
||||
|
||||
// NO 结果,单位为ppm,长度为5.2,可为空
|
||||
@JsonProperty("NOJG")
|
||||
private BigDecimal nojg;
|
||||
|
||||
// 不透光度结果,单位为%,长度为3.2,柴油车适用,可为空
|
||||
@JsonProperty("BTGDJG")
|
||||
private BigDecimal btgdjg;
|
||||
|
||||
// 林格曼黑度,0~5,长度为1,可为空
|
||||
@JsonProperty("LGMHD")
|
||||
private Integer lgmhd;
|
||||
|
||||
// CO 限值,单位为%,长度为3.2,可为空
|
||||
@JsonProperty("COXZ")
|
||||
private BigDecimal coxz;
|
||||
|
||||
// NO 限值,单位为ppm,长度为5.2,不可为空
|
||||
@JsonProperty("NOXZ")
|
||||
private BigDecimal noxz;
|
||||
|
||||
// 不透光度限值,单位为%,长度为3.2,柴油车适用,可为空
|
||||
@JsonProperty("BTGDXZ")
|
||||
private BigDecimal btgdxz;
|
||||
|
||||
// 黑度限值,0~5,长度为1,可为空
|
||||
@JsonProperty("HDXZ")
|
||||
private Integer hdxz;
|
||||
|
||||
// HC限值,单位为ppm,长度为5.2,可为空
|
||||
@JsonProperty("HCXZ")
|
||||
private BigDecimal hcxz;
|
||||
|
||||
// 车辆速度,长度为5.2,不可为空
|
||||
@JsonProperty("CLSD")
|
||||
private BigDecimal clsd;
|
||||
|
||||
// 车辆加速度,长度为5.2,不可为空
|
||||
@JsonProperty("CLJSD")
|
||||
private BigDecimal cljsd;
|
||||
|
||||
// VSP,长度为3.2,不可为空
|
||||
@JsonProperty("VSP")
|
||||
private BigDecimal vsp;
|
||||
|
||||
// 风速,单位m/s,长度为3.2,不可为空
|
||||
@JsonProperty("FS")
|
||||
private BigDecimal fs;
|
||||
|
||||
// 风向,长度为3,不可为空
|
||||
@JsonProperty("FX")
|
||||
private String fx;
|
||||
|
||||
// 环境温度,单位℃,长度为3.2,不可为空
|
||||
@JsonProperty("HJWD")
|
||||
private BigDecimal hjwd;
|
||||
|
||||
// 湿度,单位%,长度为3.2,不可为空
|
||||
@JsonProperty("SD")
|
||||
private BigDecimal sd;
|
||||
|
||||
// 大气压,单位kPa,长度为3.2,不可为空
|
||||
@JsonProperty("DQY")
|
||||
private BigDecimal dqy;
|
||||
|
||||
// 轨迹信息编号,长度为12,不可为空
|
||||
@JsonProperty("GJXXBH")
|
||||
private String gjxxbh;
|
||||
|
||||
// 车头图像1,绝对路径,长度为200,不可为空
|
||||
@JsonProperty("TP1")
|
||||
private String tp1;
|
||||
|
||||
// 车头图像2,绝对路径,长度为200,不可为空
|
||||
@JsonProperty("TP2")
|
||||
private String tp2;
|
||||
|
||||
// 车牌图片,绝对路径,长度为200,不可为空
|
||||
@JsonProperty("TP3")
|
||||
private String tp3;
|
||||
|
||||
// 视频文件,绝对路径,长度为200,不可为空
|
||||
@JsonProperty("SP1")
|
||||
private String sp1;
|
||||
|
||||
// 车辆归属地,长度为1,不可为空
|
||||
@JsonProperty("CLSSD")
|
||||
private Integer clssd;
|
||||
|
||||
// 车辆类型,中文名称,长度为20,不可为空
|
||||
@JsonProperty("CLLX")
|
||||
private String cllx;
|
||||
|
||||
// 公安车辆类型,长度为10,可为空
|
||||
@JsonProperty("GAVTYPE")
|
||||
private String gavtype;
|
||||
|
||||
// 车身颜色中文名,长度为2,可为空
|
||||
@JsonProperty("CSYS")
|
||||
private String csys;
|
||||
|
||||
// CO 判定结果,0:不合格,1:合格,长度为1,可为空
|
||||
@JsonProperty("COPDJG")
|
||||
private Integer copdjg;
|
||||
|
||||
// HC 判定结果,0:不合格,1:合格,长度为1,可为空
|
||||
@JsonProperty("HCPDJG")
|
||||
private Integer hcpdjg;
|
||||
|
||||
// NO 判定结果,0:不合格,1:合格,长度为1,不可为空
|
||||
@JsonProperty("NOPDJG")
|
||||
private Integer nopdjg;
|
||||
|
||||
// 不透光度判定结果,0:不合格,1:合格,长度为1,不可为空
|
||||
@JsonProperty("BTGDPDJG")
|
||||
private Integer btgdpdjg;
|
||||
|
||||
// 林格曼黑度判定结果,0:不合格,1:合格,长度为1,不可为空
|
||||
@JsonProperty("LGMHDPDJG")
|
||||
private Integer lgmhdpdjg;
|
||||
|
||||
// 城市编号,长度为6,不可为空
|
||||
@JsonProperty("CityCode")
|
||||
private String cityCode;
|
||||
|
||||
// 区县编号,长度为6,不可为空
|
||||
@JsonProperty("CountyCode")
|
||||
private String countyCode;
|
||||
|
||||
// 车头图像1的HTTP链接,长度为200,不可为空
|
||||
@JsonProperty("TP1_HTTP")
|
||||
private String tp1Http;
|
||||
|
||||
// 车头图像2的HTTP链接,长度为200,不可为空
|
||||
@JsonProperty("TP2_HTTP")
|
||||
private String tp2Http;
|
||||
|
||||
// 车牌图片的HTTP链接,长度为200,不可为空
|
||||
@JsonProperty("TP3_HTTP")
|
||||
private String tp3Http;
|
||||
|
||||
// 视频的HTTP链接,长度为200,不可为空
|
||||
@JsonProperty("SP1_HTTP")
|
||||
private String sp1Http;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package com.bnhz.adapter.model.fumes;
|
||||
|
||||
import com.bnhz.iot.model.DataId;
|
||||
import com.bnhz.common.annotation.Length;
|
||||
import com.bnhz.common.utils.DateUtils;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 报警信息
|
||||
*
|
||||
* @author Leo
|
||||
* @date 2024/7/1 17:14
|
||||
*/
|
||||
@Data
|
||||
public class FumesAlarmMsg implements DataId {
|
||||
|
||||
@JsonProperty("Id")
|
||||
@ApiModelProperty("id")
|
||||
private String bisId;
|
||||
|
||||
@JsonProperty("MN")
|
||||
@ApiModelProperty("设备编号")
|
||||
private String mn;
|
||||
|
||||
@JsonProperty("AcquitAt")
|
||||
@ApiModelProperty("数据收集时间")
|
||||
private long acquitAt;
|
||||
|
||||
@JsonProperty("Owner")
|
||||
@ApiModelProperty("持有人")
|
||||
private String owner;
|
||||
|
||||
@JsonProperty("Content")
|
||||
@ApiModelProperty("内容")
|
||||
@Length(300)
|
||||
private String content;
|
||||
|
||||
@JsonProperty("MsgType")
|
||||
@ApiModelProperty("消息类型")
|
||||
private String msgType;
|
||||
|
||||
@JsonProperty("Addr")
|
||||
@ApiModelProperty("地址")
|
||||
@Length(200)
|
||||
private String addr;
|
||||
|
||||
@JsonProperty("Name")
|
||||
@ApiModelProperty("点位名称")
|
||||
@Length(200)
|
||||
private String name;
|
||||
|
||||
@Override
|
||||
public String getSerialNumber() {
|
||||
return this.mn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalDateTime getDataTime() {
|
||||
return DateUtils.toLocalDateTime(acquitAt * 1000);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package com.bnhz.adapter.model.fumes;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/7/1 16:33
|
||||
*/
|
||||
@Data
|
||||
public class FumesCustomer {
|
||||
|
||||
@JsonProperty("Id")
|
||||
private int id;
|
||||
@JsonProperty("Pid")
|
||||
private String pid;
|
||||
@JsonProperty("BlNo")
|
||||
private String blNo;
|
||||
@JsonProperty("BlName")
|
||||
private String blName;
|
||||
@JsonProperty("Org")
|
||||
private String org;
|
||||
@JsonProperty("Name")
|
||||
private String name;
|
||||
@JsonProperty("Contact")
|
||||
private String contact;
|
||||
@JsonProperty("Mobile")
|
||||
private String mobile;
|
||||
@JsonProperty("Telephone")
|
||||
private String telephone;
|
||||
@JsonProperty("Typ")
|
||||
private int type;
|
||||
@JsonProperty("Creator")
|
||||
private String creator;
|
||||
@JsonProperty("CreateAt")
|
||||
private long createAt;
|
||||
@JsonProperty("Status")
|
||||
private int status;
|
||||
@JsonProperty("Address")
|
||||
private String address;
|
||||
@JsonProperty("Logo")
|
||||
private String logo;
|
||||
@JsonProperty("BusinessHour")
|
||||
private String businessHour;
|
||||
@JsonProperty("Desc")
|
||||
private String desc;
|
||||
@JsonProperty("MaintainerId")
|
||||
private String maintainerId;
|
||||
@JsonProperty("AreaIds")
|
||||
private Object areaIds; // Assuming it is an object; replace with appropriate class if necessary
|
||||
@JsonProperty("AreaIdCascades")
|
||||
private Object areaIdCascades; // Assuming it is an object; replace with appropriate class if necessary
|
||||
@JsonProperty("owner_name")
|
||||
private String ownerName;
|
||||
@JsonProperty("maintainer_name")
|
||||
private String maintainerName;
|
||||
@JsonProperty("Areas")
|
||||
private Object areas; // Assuming it is an object; replace with appropriate class if necessary
|
||||
@JsonProperty("PerPage")
|
||||
private int perPage;
|
||||
@JsonProperty("Page")
|
||||
private int page;
|
||||
@JsonProperty("IsDownload")
|
||||
private boolean isDownload;
|
||||
@JsonProperty("health_code_color")
|
||||
private String healthCodeColor;
|
||||
}
|
|
@ -0,0 +1,207 @@
|
|||
package com.bnhz.adapter.model.fumes;
|
||||
|
||||
import com.bnhz.common.annotation.Length;
|
||||
import com.bnhz.iot.model.DataId;
|
||||
import com.bnhz.common.utils.DateUtils;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
import static com.bnhz.common.utils.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/**
|
||||
* 报警管理-监测
|
||||
* @author Leo
|
||||
* @date 2024/7/1 17:34
|
||||
*/
|
||||
@Data
|
||||
public class FumesDetectorDaily implements DataId {
|
||||
|
||||
@JsonProperty("Id")
|
||||
@ApiModelProperty("id")
|
||||
private String bisId;
|
||||
|
||||
@JsonProperty("MN")
|
||||
@ApiModelProperty("设备编号")
|
||||
private String mn;
|
||||
|
||||
@JsonProperty("FanMN")
|
||||
private String fanMn;
|
||||
|
||||
@JsonProperty("FilterMN")
|
||||
private String filterMn;
|
||||
|
||||
@JsonProperty("Owner")
|
||||
@ApiModelProperty("持有者")
|
||||
private String owner;
|
||||
|
||||
@JsonProperty("AcquitAt")
|
||||
@ApiModelProperty("数据采集时间")
|
||||
private long acquitAt;
|
||||
|
||||
@JsonProperty("AcquitDate")
|
||||
@ApiModelProperty("数据采集日")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date acquitDate;
|
||||
|
||||
@JsonProperty("CreateAt")
|
||||
@ApiModelProperty("创建日期")
|
||||
private long createAt;
|
||||
|
||||
@JsonProperty("CEmissions")
|
||||
@ApiModelProperty("排放物浓度折算")
|
||||
private BigDecimal cEmissions;
|
||||
|
||||
@JsonProperty("CGranule")
|
||||
@ApiModelProperty("颗粒物浓度折算")
|
||||
private BigDecimal cGranule;
|
||||
|
||||
@JsonProperty("CHydrocarbon")
|
||||
@ApiModelProperty("非甲烷总烃浓度折算")
|
||||
private BigDecimal cHydrocarbon;
|
||||
|
||||
@JsonProperty("Emissions")
|
||||
private BigDecimal emissions;
|
||||
|
||||
@JsonProperty("Granule")
|
||||
private BigDecimal granule;
|
||||
|
||||
@JsonProperty("Hydrocarbon")
|
||||
private BigDecimal hydrocarbon;
|
||||
|
||||
@JsonProperty("Velocity")
|
||||
@ApiModelProperty("转速")
|
||||
private BigDecimal velocity;
|
||||
|
||||
@JsonProperty("Temperature")
|
||||
@ApiModelProperty("温度")
|
||||
private BigDecimal temperature;
|
||||
|
||||
@JsonProperty("Moisture")
|
||||
@ApiModelProperty("湿度")
|
||||
private BigDecimal moisture;
|
||||
|
||||
@JsonProperty("RedPm25")
|
||||
@ApiModelProperty("Pm2.5减排量")
|
||||
private BigDecimal redPm25;
|
||||
|
||||
@JsonProperty("RedPm10")
|
||||
@ApiModelProperty("Pm10减排量")
|
||||
private BigDecimal redPm10;
|
||||
|
||||
@JsonProperty("RedEmissions")
|
||||
@ApiModelProperty("排放物减排量")
|
||||
private BigDecimal redEmissions;
|
||||
|
||||
@JsonProperty("RedVocs")
|
||||
@ApiModelProperty("Vocs减排量")
|
||||
private BigDecimal redVocs;
|
||||
|
||||
@JsonProperty("DeviceNum")
|
||||
@ApiModelProperty("设备数")
|
||||
private int deviceNum;
|
||||
|
||||
/**
|
||||
* 1:正常,2:超标,3:正常离线,4异常离线
|
||||
*/
|
||||
@JsonProperty("Status")
|
||||
@ApiModelProperty("状态")
|
||||
private int status;
|
||||
|
||||
@JsonProperty("OnlineStatus")
|
||||
@ApiModelProperty("在线状态")
|
||||
private int onlineStatus;
|
||||
|
||||
@JsonProperty("SystemStatus")
|
||||
@ApiModelProperty("系统状态")
|
||||
private int systemStatus;
|
||||
|
||||
@JsonProperty("FanStatus")
|
||||
private int fanStatus;
|
||||
|
||||
@JsonProperty("FilterStatus")
|
||||
private int filterStatus;
|
||||
|
||||
@JsonProperty("FilterFanLinkRatio")
|
||||
@ApiModelProperty("净化器风机联动比")
|
||||
private int filterFanLinkRatio;
|
||||
|
||||
@JsonProperty("FilterAbnormallyUsed")
|
||||
@ApiModelProperty("净化器是否非正常使用")
|
||||
private boolean filterAbnormallyUsed;
|
||||
|
||||
@JsonProperty("CEmissionsExceedStandard")
|
||||
@ApiModelProperty("排放物超标")
|
||||
private boolean cEmissionsExceedStandard;
|
||||
|
||||
@JsonProperty("CGranuleExceedStandard")
|
||||
@ApiModelProperty("颗粒物超标")
|
||||
private boolean cGranuleExceedStandard;
|
||||
|
||||
@JsonProperty("CHydrocarbonExceedStandard")
|
||||
@ApiModelProperty("非甲烷总烃超标")
|
||||
private boolean cHydrocarbonExceedStandard;
|
||||
|
||||
@JsonProperty("LocaleId")
|
||||
@ApiModelProperty("地区id")
|
||||
private String localeId;
|
||||
|
||||
@JsonProperty("CustomerId")
|
||||
@ApiModelProperty("所属单位Id")
|
||||
private int customerId;
|
||||
|
||||
@JsonProperty("Customer")
|
||||
@ApiModelProperty("用户")
|
||||
private String customer;
|
||||
|
||||
@JsonProperty("LocaleEmissionsSill")
|
||||
@ApiModelProperty("排放物阈值")
|
||||
private BigDecimal localeEmissionsSill;
|
||||
|
||||
@JsonProperty("LocaleGranuleSill")
|
||||
@ApiModelProperty("颗粒物阈值")
|
||||
private BigDecimal localeGranuleSill;
|
||||
|
||||
@JsonProperty("LocaleHydrocarbonSill")
|
||||
@ApiModelProperty("非甲烷总烃阈值")
|
||||
private BigDecimal localeHydrocarbonSill;
|
||||
|
||||
@JsonProperty("LocaleName")
|
||||
@ApiModelProperty("监测点名")
|
||||
@Length(200)
|
||||
private String localeName;
|
||||
|
||||
@JsonProperty("LocaleAddr")
|
||||
@ApiModelProperty("监测点")
|
||||
@Length(200)
|
||||
private String localeAddr;
|
||||
|
||||
@JsonProperty("AbnormalOffline")
|
||||
@ApiModelProperty("异常离线")
|
||||
private boolean abnormalOffline;
|
||||
|
||||
@JsonProperty("StatusDesc")
|
||||
@ApiModelProperty("状态描述")
|
||||
private String statusDesc;
|
||||
|
||||
@JsonProperty("fan_current")
|
||||
private BigDecimal fanCurrent;
|
||||
|
||||
@JsonProperty("pur_current")
|
||||
private BigDecimal purCurrent;
|
||||
|
||||
@Override
|
||||
public String getSerialNumber() {
|
||||
return this.mn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalDateTime getDataTime() {
|
||||
return DateUtils.toLocalDateTime(acquitAt * 1000);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,283 @@
|
|||
package com.bnhz.adapter.model.fumes;
|
||||
|
||||
import com.bnhz.common.annotation.Length;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 监控点信息
|
||||
* @author Leo
|
||||
* @date 2024/7/1 16:31
|
||||
*/
|
||||
@Data
|
||||
public class FumesMonitorPoint {
|
||||
|
||||
@JsonProperty("Id")
|
||||
@ApiModelProperty("业务id")
|
||||
private String bisId;
|
||||
|
||||
@JsonProperty("Name")
|
||||
@ApiModelProperty("烟道名称")
|
||||
@Length(150)
|
||||
private String name;
|
||||
|
||||
@JsonProperty("Owner")
|
||||
@ApiModelProperty("单位")
|
||||
private String owner;
|
||||
|
||||
@JsonProperty("CustomerId")
|
||||
@ApiModelProperty("组织id")
|
||||
private int customerId;
|
||||
|
||||
@JsonProperty("Customer")
|
||||
private FumesCustomer customer;
|
||||
|
||||
@JsonProperty("Cuisine")
|
||||
@ApiModelProperty("菜系")
|
||||
private int cuisine;
|
||||
|
||||
@JsonProperty("CuisineObj")
|
||||
private Object cuisineObj; // Assuming it is an object; replace with appropriate class if necessary
|
||||
|
||||
@JsonProperty("SendMode")
|
||||
private int sendMode;
|
||||
|
||||
@JsonProperty("SurpassCalcMethod")
|
||||
private int surpassCalcMethod;
|
||||
|
||||
@JsonProperty("FanSpeed")
|
||||
@ApiModelProperty("风速")
|
||||
private int fanSpeed;
|
||||
|
||||
@JsonProperty("FanQuantity")
|
||||
@ApiModelProperty("风量")
|
||||
private int fanQuantity;
|
||||
|
||||
@JsonProperty("FanInfo")
|
||||
private String fanInfo;
|
||||
|
||||
@JsonProperty("FanStandardCurrent")
|
||||
private int fanStandardCurrent;
|
||||
@JsonProperty("PowerSupplyMode")
|
||||
private String powerSupplyMode;
|
||||
|
||||
@JsonProperty("PipeArea")
|
||||
@ApiModelProperty("管道截面面积")
|
||||
private int pipeArea;
|
||||
|
||||
@JsonProperty("StoveNum")
|
||||
@ApiModelProperty("灶头数量")
|
||||
private int stoveNum;
|
||||
|
||||
@JsonProperty("StoveLength")
|
||||
@ApiModelProperty("灶头长度")
|
||||
private int stoveLength;
|
||||
|
||||
@JsonProperty("StoveWidth")
|
||||
@ApiModelProperty("灶头宽带")
|
||||
private int stoveWidth;
|
||||
|
||||
@JsonProperty("Samplings")
|
||||
@ApiModelProperty("抽样次数")
|
||||
private int samplings;
|
||||
|
||||
@JsonProperty("LinkStatus")
|
||||
@ApiModelProperty("是否联动")
|
||||
private int linkStatus;
|
||||
|
||||
@JsonProperty("LinkRatioSill")
|
||||
private BigDecimal linkRatioSill;
|
||||
|
||||
@JsonProperty("FanStatus")
|
||||
@ApiModelProperty("风机状态")
|
||||
private int fanStatus;
|
||||
|
||||
@JsonProperty("FilterStandardCurrent")
|
||||
private int filterStandardCurrent;
|
||||
|
||||
@JsonProperty("FilterInfo")
|
||||
@ApiModelProperty("净化器信息")
|
||||
private String filterInfo;
|
||||
|
||||
@JsonProperty("FilterStatus")
|
||||
@ApiModelProperty("净化器状态")
|
||||
private int filterStatus;
|
||||
|
||||
@JsonProperty("OfflineJudge")
|
||||
private int offlineJudge;
|
||||
|
||||
@JsonProperty("EmissionsSill")
|
||||
@ApiModelProperty("超标阈值")
|
||||
private int emissionsSill;
|
||||
|
||||
@JsonProperty("GranuleSill")
|
||||
private int granuleSill;
|
||||
@JsonProperty("HydrocarbonSill")
|
||||
private int hydrocarbonSill;
|
||||
@JsonProperty("StoveArea")
|
||||
@ApiModelProperty("集气灶面积")
|
||||
private int stoveArea;
|
||||
|
||||
@JsonProperty("ExhaustTime")
|
||||
@ApiModelProperty("日均排烟事件")
|
||||
private String exhaustTime;
|
||||
|
||||
@JsonProperty("Remark")
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
@JsonProperty("Addr")
|
||||
@ApiModelProperty("地址")
|
||||
@Length(300)
|
||||
private String addr;
|
||||
|
||||
@JsonProperty("AreaId")
|
||||
@ApiModelProperty("地区")
|
||||
private String areaId;
|
||||
|
||||
@ApiModelProperty("经度")
|
||||
@JsonProperty("Lng")
|
||||
private String lng;
|
||||
|
||||
@ApiModelProperty("纬度")
|
||||
@JsonProperty("Lat")
|
||||
private String lat;
|
||||
|
||||
@ApiModelProperty("创建者")
|
||||
@JsonProperty("Creator")
|
||||
private String creator;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
@JsonProperty("CreateAt")
|
||||
private long createAt;
|
||||
|
||||
@JsonProperty("StartAt")
|
||||
private long startAt;
|
||||
@JsonProperty("Status")
|
||||
private int status;
|
||||
@JsonProperty("StatusOfRecord")
|
||||
@ApiModelProperty("设备状态")
|
||||
private String statusOfRecord;
|
||||
|
||||
@JsonProperty("HealthCodeColor")
|
||||
@ApiModelProperty("健康码颜色")
|
||||
private String healthCodeColor;
|
||||
|
||||
@JsonProperty("LocalePics")
|
||||
private Object localePics; // Assuming it is an object; replace with appropriate class if necessary
|
||||
@JsonProperty("LocalePicS")
|
||||
private List<Object> localePicsList; // Assuming it is a list of objects; replace with appropriate class if necessary
|
||||
@JsonProperty("MnLast")
|
||||
@ApiModelProperty("设备编号")
|
||||
private String mnLast;
|
||||
|
||||
@JsonProperty("MnTypLast")
|
||||
@ApiModelProperty("设备类型")
|
||||
private int mnTypLast;
|
||||
|
||||
@JsonProperty("Mobile")
|
||||
private String mobile;
|
||||
@JsonProperty("Contact")
|
||||
private String contact;
|
||||
|
||||
@JsonProperty("MaintainerId")
|
||||
@ApiModelProperty("运维人员id")
|
||||
private String maintainerId;
|
||||
|
||||
@JsonProperty("HealthCodeX")
|
||||
@ApiModelProperty("绿码")
|
||||
private int healthCodeX;
|
||||
|
||||
@JsonProperty("HealthCodeValue1")
|
||||
private int healthCodeValue1;
|
||||
@JsonProperty("HealthCodeValue2")
|
||||
private int healthCodeValue2;
|
||||
@JsonProperty("HealthCodeValue3")
|
||||
private int healthCodeValue3;
|
||||
@JsonProperty("HealthCodeValue4")
|
||||
private int healthCodeValue4;
|
||||
@JsonProperty("HealthCodeValue5")
|
||||
private int healthCodeValue5;
|
||||
@JsonProperty("HealthCodeValue6")
|
||||
private int healthCodeValue6;
|
||||
@JsonProperty("HealthCodeValue11")
|
||||
private int healthCodeValue11;
|
||||
@JsonProperty("HealthCodeValue12")
|
||||
private int healthCodeValue12;
|
||||
|
||||
@JsonProperty("AbnormalValue7")
|
||||
@ApiModelProperty("油烟浓度7")
|
||||
private BigDecimal abnormalValue7;
|
||||
|
||||
@JsonProperty("AbnormalValue8")
|
||||
@ApiModelProperty("油烟浓度8")
|
||||
private int abnormalValue8;
|
||||
|
||||
@JsonProperty("AbnormalValue9")
|
||||
@ApiModelProperty("油烟浓度9")
|
||||
private int abnormalValue9;
|
||||
|
||||
|
||||
@JsonProperty("AbnormalValue10")
|
||||
@ApiModelProperty("油烟浓度10")
|
||||
private int abnormalValue10;
|
||||
|
||||
@JsonProperty("AliIotDeviceName")
|
||||
@ApiModelProperty("Ali设备名称")
|
||||
private String aliIotDeviceName;
|
||||
@JsonProperty("AliIot")
|
||||
private Object aliIot; // Assuming it is an object; replace with appropriate class if necessary
|
||||
@JsonProperty("CreatedAt")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createdAt;
|
||||
@JsonProperty("UpdatedAt")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updatedAt;
|
||||
@JsonProperty("RemarkOfRecord")
|
||||
private String remarkOfRecord;
|
||||
@JsonProperty("Cause")
|
||||
private String cause;
|
||||
@JsonProperty("scale")
|
||||
private String scale;
|
||||
@JsonProperty("management_types")
|
||||
private String managementTypes;
|
||||
@JsonProperty("fan_brand")
|
||||
private String fanBrand;
|
||||
@JsonProperty("fan_model")
|
||||
private String fanModel;
|
||||
@JsonProperty("fan_power")
|
||||
private int fanPower;
|
||||
@JsonProperty("filter_brand")
|
||||
private String filterBrand;
|
||||
@JsonProperty("filter_model")
|
||||
private String filterModel;
|
||||
@JsonProperty("purifying_rate")
|
||||
private int purifyingRate;
|
||||
@JsonProperty("filter_power")
|
||||
private int filterPower;
|
||||
@JsonProperty("principle")
|
||||
private String principle;
|
||||
@JsonProperty("is_in_time")
|
||||
private int isInTime;
|
||||
@JsonProperty("owner_name")
|
||||
private String ownerName;
|
||||
@JsonProperty("area_name")
|
||||
private String areaName;
|
||||
@JsonProperty("area_detail")
|
||||
private String areaDetail;
|
||||
@JsonProperty("cuisine_name")
|
||||
private String cuisineName;
|
||||
@JsonProperty("maintainer_name")
|
||||
private String maintainerName;
|
||||
@JsonProperty("device_mns")
|
||||
private String deviceMns;
|
||||
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package com.bnhz.adapter.model.fumes;
|
||||
|
||||
import com.bnhz.iot.model.DataId;
|
||||
import com.bnhz.common.annotation.Length;
|
||||
import com.bnhz.common.utils.DateUtils;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 一分钟设备数据
|
||||
* @author Leo
|
||||
* @date 2024/7/1 20:38
|
||||
*/
|
||||
@Data
|
||||
public class FumesOneMin implements DataId {
|
||||
|
||||
@JsonProperty("Id")
|
||||
@ApiModelProperty("id")
|
||||
private String bisId;
|
||||
|
||||
@JsonProperty("Message")
|
||||
@ApiModelProperty("一分钟报文数据")
|
||||
@Length(300)
|
||||
private String message;
|
||||
|
||||
@JsonProperty("MN")
|
||||
@ApiModelProperty("设备编号")
|
||||
private String mn;
|
||||
|
||||
@JsonProperty("AcquitAt")
|
||||
@ApiModelProperty("采集时间")
|
||||
private long acquitAt;
|
||||
|
||||
@JsonProperty("CreateAt")
|
||||
@ApiModelProperty("创建时间")
|
||||
private long createAt;
|
||||
|
||||
@JsonProperty("FanStatus")
|
||||
@ApiModelProperty("风机状态")
|
||||
private String fanStatus;
|
||||
|
||||
@JsonProperty("FilterStatus")
|
||||
@ApiModelProperty("净化器状态")
|
||||
private String filterStatus;
|
||||
|
||||
@JsonProperty("EmissionsConc")
|
||||
@ApiModelProperty("实时油烟排放量")
|
||||
private BigDecimal emissionsConc;
|
||||
|
||||
@JsonProperty("GranuleConc")
|
||||
@ApiModelProperty("颗粒物含量")
|
||||
private BigDecimal granuleConc;
|
||||
|
||||
@JsonProperty("HydrocarbonConc")
|
||||
@ApiModelProperty("非甲烷总烃")
|
||||
private BigDecimal hydrocarbonConc;
|
||||
|
||||
@JsonProperty("Velocity")
|
||||
@ApiModelProperty("流速")
|
||||
private BigDecimal velocity;
|
||||
|
||||
@JsonProperty("Temperature")
|
||||
@ApiModelProperty("温度")
|
||||
private BigDecimal temperature;
|
||||
|
||||
@JsonProperty("Moisture")
|
||||
@ApiModelProperty("湿度")
|
||||
private BigDecimal moisture;
|
||||
|
||||
@JsonProperty("Flag")
|
||||
@ApiModelProperty("设备状态")
|
||||
private String flag;
|
||||
|
||||
@JsonProperty("fan_current")
|
||||
@ApiModelProperty("风机电流值")
|
||||
private BigDecimal fanCurrent;
|
||||
|
||||
@JsonProperty("pur_current")
|
||||
@ApiModelProperty("净化器电流值")
|
||||
private BigDecimal purCurrent;
|
||||
|
||||
@Override
|
||||
public String getSerialNumber() {
|
||||
return this.mn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalDateTime getDataTime() {
|
||||
return DateUtils.toLocalDateTime(acquitAt * 1000);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.bnhz.adapter.model.fumes;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/7/1 16:28
|
||||
*/
|
||||
@Data
|
||||
public class FumesPage<T> {
|
||||
|
||||
@JsonProperty("DeviceNum")
|
||||
private int deviceNum;
|
||||
@JsonProperty("content")
|
||||
private List<T> content;
|
||||
@JsonProperty("total")
|
||||
private int total;
|
||||
|
||||
private ResultsPageInfo resultsPageInfo;
|
||||
|
||||
@Data
|
||||
public static class ResultsPageInfo {
|
||||
|
||||
@JsonProperty("Total")
|
||||
private Integer total;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.bnhz.adapter.model.fumes;
|
||||
|
||||
import com.bnhz.common.annotation.Length;
|
||||
import com.bnhz.iot.model.DataId;
|
||||
import com.bnhz.common.utils.DateUtils;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 所有点位事件处理记录
|
||||
*
|
||||
* @author Leo
|
||||
* @date 2024/7/2 10:17
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class FumesPointEventRecord {
|
||||
|
||||
private List<Event> onlineEventList;
|
||||
|
||||
@Data
|
||||
public static class Event implements DataId {
|
||||
|
||||
@JsonProperty("CalculateDate")
|
||||
@ApiModelProperty("时间戳")
|
||||
private long calculateDate;
|
||||
|
||||
@JsonProperty("LocaleName")
|
||||
@ApiModelProperty("监测点名")
|
||||
private String localeName;
|
||||
|
||||
@JsonProperty("LocaleAddr")
|
||||
@ApiModelProperty("监测点地址")
|
||||
private String localeAddr;
|
||||
|
||||
@JsonProperty("LocaleMn")
|
||||
@ApiModelProperty("设备序列号")
|
||||
private String localeMn;
|
||||
|
||||
@JsonProperty("EventType")
|
||||
@ApiModelProperty("事件类型")
|
||||
private String eventType;
|
||||
|
||||
@JsonProperty("HandleMeasure")
|
||||
@ApiModelProperty("处理措施")
|
||||
@Length(200)
|
||||
private String handleMeasure;
|
||||
|
||||
@Override
|
||||
public String getSerialNumber() {
|
||||
return localeMn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalDateTime getDataTime() {
|
||||
return DateUtils.toLocalDateTime(calculateDate * 1000);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,173 @@
|
|||
package com.bnhz.adapter.model.fumes;
|
||||
|
||||
import com.bnhz.common.annotation.Length;
|
||||
import com.bnhz.common.utils.DateUtils;
|
||||
import com.bnhz.iot.model.DataId;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 实时数据
|
||||
*
|
||||
* @author Leo
|
||||
* @date 2024/8/1 15:58
|
||||
*/
|
||||
@Data
|
||||
public class FumesRealTime implements DataId {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@JsonProperty("Id")
|
||||
@ApiModelProperty(value = "实时数据的设备编号",notes = "中间有“-”连接代表该监测点有多个设备绑定")
|
||||
@Length(200)
|
||||
private String id;
|
||||
|
||||
@JsonProperty("AcquitAt")
|
||||
@ApiModelProperty("采集时间")
|
||||
private long acquitAt;
|
||||
|
||||
@JsonProperty("LastAt")
|
||||
@ApiModelProperty("最后确认时间")
|
||||
private long lastAt;
|
||||
|
||||
@JsonProperty("Data")
|
||||
private String data;
|
||||
|
||||
@JsonProperty("CEmissions")
|
||||
@ApiModelProperty("排放物折算浓度")
|
||||
private BigDecimal cEmissions;
|
||||
|
||||
@JsonProperty("CGranule")
|
||||
@ApiModelProperty("颗粒物折算浓度")
|
||||
private BigDecimal cGranule;
|
||||
|
||||
@JsonProperty("CHydrocarbon")
|
||||
@ApiModelProperty("非甲烷总烃折算浓度")
|
||||
private BigDecimal cHydrocarbon;
|
||||
|
||||
@JsonProperty("EmissionsConc")
|
||||
@ApiModelProperty("实时排放量")
|
||||
private BigDecimal emissionsConc;
|
||||
|
||||
@JsonProperty("GranuleConc")
|
||||
@ApiModelProperty("颗粒物含量")
|
||||
private BigDecimal granuleConc;
|
||||
|
||||
@JsonProperty("HydrocarbonConc")
|
||||
@ApiModelProperty("非甲烷总烃含量")
|
||||
private BigDecimal hydrocarbonConc;
|
||||
|
||||
@JsonProperty("FanStatus")
|
||||
@ApiModelProperty("风机状态")
|
||||
private String fanStatus;
|
||||
|
||||
@JsonProperty("FilterStatus")
|
||||
@ApiModelProperty("净化器状态")
|
||||
private String filterStatus;
|
||||
|
||||
@JsonProperty("Typ")
|
||||
@ApiModelProperty("类型")
|
||||
private int typ;
|
||||
|
||||
@JsonProperty("Status")
|
||||
@ApiModelProperty("状态")
|
||||
private String status;
|
||||
|
||||
@JsonProperty("Velocity")
|
||||
@ApiModelProperty("流速")
|
||||
private BigDecimal velocity;
|
||||
|
||||
@JsonProperty("Temperature")
|
||||
@ApiModelProperty("温度")
|
||||
private BigDecimal temperature;
|
||||
|
||||
@JsonProperty("Moisture")
|
||||
@ApiModelProperty("湿度")
|
||||
private BigDecimal moisture;
|
||||
|
||||
@JsonProperty("Locale")
|
||||
@ApiModelProperty("监测点名称")
|
||||
@Length(100)
|
||||
private String locale;
|
||||
|
||||
@JsonProperty("Lid")
|
||||
@ApiModelProperty("监测点id")
|
||||
private String lid;
|
||||
|
||||
@JsonProperty("Owner")
|
||||
@ApiModelProperty("所属单位")
|
||||
private String owner;
|
||||
|
||||
@JsonProperty("Addr")
|
||||
@ApiModelProperty("安装地址")
|
||||
@Length(200)
|
||||
private String addr;
|
||||
|
||||
@JsonProperty("EmissionsSill")
|
||||
@ApiModelProperty("超标阈值")
|
||||
private BigDecimal emissionsSill;
|
||||
|
||||
@JsonProperty("GranuleSill")
|
||||
@ApiModelProperty("颗粒物超标阈值")
|
||||
private BigDecimal granuleSill;
|
||||
|
||||
@JsonProperty("HydrocarbonSill")
|
||||
@ApiModelProperty("非甲烷总烃超标阈值")
|
||||
private BigDecimal hydrocarbonSill;
|
||||
|
||||
@JsonProperty("LinkStatus")
|
||||
@ApiModelProperty("是否联动")
|
||||
private int linkStatus;
|
||||
|
||||
@JsonProperty("CustomerMobile")
|
||||
@ApiModelProperty("联系电话")
|
||||
private String customerMobile;
|
||||
|
||||
@JsonProperty("CustomeName")
|
||||
private String customeName;
|
||||
|
||||
@JsonProperty("LocaleLng")
|
||||
@ApiModelProperty("经度")
|
||||
private String localeLng;
|
||||
|
||||
@JsonProperty("LocaleLat")
|
||||
@ApiModelProperty("纬度")
|
||||
private String localeLat;
|
||||
|
||||
@JsonProperty("HealthCodeColor")
|
||||
private String healthCodeColor;
|
||||
|
||||
@JsonProperty("fan_current")
|
||||
@ApiModelProperty("风机电流值")
|
||||
private BigDecimal fanCurrent;
|
||||
|
||||
@JsonProperty("pur_current")
|
||||
@ApiModelProperty("净化器电流值")
|
||||
private BigDecimal purCurrent;
|
||||
|
||||
@JsonProperty("SendMode")
|
||||
@ApiModelProperty("监测方式")
|
||||
private int sendMode;
|
||||
|
||||
@JsonProperty("OnlineStatus")
|
||||
@ApiModelProperty(value = "整体状态", notes = "1:在线2:离线3:异常离线")
|
||||
private int onlineStatus;
|
||||
|
||||
@JsonProperty("StatusOfRecord")
|
||||
@ApiModelProperty(value = "记录状态", notes = "NORMAL:正常、OFFLINE:下线、ABANDONED:废弃")
|
||||
private String statusOfRecord;
|
||||
@Override
|
||||
public String getSerialNumber() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalDateTime getDataTime() {
|
||||
return DateUtils.toLocalDateTime(acquitAt * 1000);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
package com.bnhz.adapter.model.fumes;
|
||||
|
||||
import com.bnhz.common.utils.DateUtils;
|
||||
import com.bnhz.iot.model.DataId;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 监测点位减排统计
|
||||
*
|
||||
* @author Leo
|
||||
* @date 2024/8/1 15:38
|
||||
*/
|
||||
@Data
|
||||
public class FumesReduce implements DataId {
|
||||
|
||||
|
||||
@JsonProperty("locale_id")
|
||||
@ApiModelProperty("监测点ID")
|
||||
private String localeId;
|
||||
|
||||
@JsonProperty("owner")
|
||||
@ApiModelProperty("所属单位")
|
||||
private String owner;
|
||||
|
||||
@JsonProperty("mn")
|
||||
@ApiModelProperty("设备序列号")
|
||||
private String mn;
|
||||
|
||||
@JsonProperty("hour")
|
||||
@ApiModelProperty("小时")
|
||||
private BigDecimal hour;
|
||||
|
||||
@JsonProperty("red_emissions")
|
||||
@ApiModelProperty("油烟减排量")
|
||||
private BigDecimal redEmissions;
|
||||
|
||||
@JsonProperty("red_pm25")
|
||||
@ApiModelProperty("PM2.5减排量")
|
||||
private BigDecimal redPm25;
|
||||
|
||||
@JsonProperty("red_pm10")
|
||||
@ApiModelProperty("PM10减排量")
|
||||
private BigDecimal redPm10;
|
||||
|
||||
@JsonProperty("red_vocs")
|
||||
@ApiModelProperty("Vocs减排量")
|
||||
private BigDecimal redVocs;
|
||||
|
||||
@JsonProperty("se_red_emissions")
|
||||
@ApiModelProperty("油烟实际排放量")
|
||||
private BigDecimal seRedEmissions;
|
||||
|
||||
@JsonProperty("se_red_pm25")
|
||||
@ApiModelProperty("PM2.5实际排放量")
|
||||
private BigDecimal seRedPm25;
|
||||
|
||||
@JsonProperty("se_red_pm10")
|
||||
@ApiModelProperty("PM10实际排放量")
|
||||
private BigDecimal seRedPm10;
|
||||
|
||||
@JsonProperty("se_red_vocs")
|
||||
@ApiModelProperty("Vocs实际排放量")
|
||||
private BigDecimal seRedVocs;
|
||||
|
||||
@JsonProperty("acquit_date")
|
||||
@ApiModelProperty("采集时间")
|
||||
private long acquitDate;
|
||||
|
||||
@JsonProperty("avg_red_emissions")
|
||||
@ApiModelProperty("油烟平均折算浓度")
|
||||
private BigDecimal avgRedEmissions;
|
||||
|
||||
@JsonProperty("avg_red_pm25")
|
||||
@ApiModelProperty("PM2.5平均折算浓度")
|
||||
private BigDecimal avgRedPm25;
|
||||
|
||||
@JsonProperty("avg_red_pm10")
|
||||
@ApiModelProperty("PM10平均折算浓度")
|
||||
private BigDecimal avgRedPm10;
|
||||
|
||||
@JsonProperty("avg_red_vocs")
|
||||
@ApiModelProperty("Vocs平均折算浓度")
|
||||
private BigDecimal avgRedVocs;
|
||||
|
||||
@Override
|
||||
public String getSerialNumber() {
|
||||
return mn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalDateTime getDataTime() {
|
||||
return DateUtils.toLocalDateTime(acquitDate * 1000);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.bnhz.adapter.model.fumes;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/7/1 16:27
|
||||
*/
|
||||
@Data
|
||||
public class FumesRes<T> {
|
||||
|
||||
@JsonProperty("Data")
|
||||
private T data;
|
||||
@JsonProperty("Msg")
|
||||
private String msg;
|
||||
@JsonProperty("Status")
|
||||
private int status;
|
||||
|
||||
@Data
|
||||
public static class DataInfo<T> {
|
||||
private List<T> data;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package com.bnhz.adapter.model.fumes;
|
||||
|
||||
import com.bnhz.iot.model.DataId;
|
||||
import com.bnhz.common.utils.DateUtils;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 十分钟设备数据
|
||||
*
|
||||
* @author Leo
|
||||
* @date 2024/7/1 19:53
|
||||
*/
|
||||
@Data
|
||||
public class FumesTenMin implements DataId {
|
||||
|
||||
/**
|
||||
* 设备采集时间戳/600
|
||||
*/
|
||||
@JsonProperty("acquit_at")
|
||||
@ApiModelProperty("设备采集时间")
|
||||
private long acquitAt;
|
||||
|
||||
@JsonProperty("counter")
|
||||
@ApiModelProperty("发送数据的次数")
|
||||
private int counter;
|
||||
|
||||
@JsonProperty("create_at")
|
||||
@ApiModelProperty("创建时间")
|
||||
private long createAt;
|
||||
|
||||
@JsonProperty("emissions_conc")
|
||||
@ApiModelProperty("实时排放量")
|
||||
private BigDecimal emissionsConc;
|
||||
|
||||
@JsonProperty("granule_conc")
|
||||
@ApiModelProperty("颗粒物含量")
|
||||
private BigDecimal granuleConc;
|
||||
|
||||
@JsonProperty("hydrocarbon_conc")
|
||||
@ApiModelProperty("非甲烷总烃")
|
||||
private BigDecimal hydrocarbonConc;
|
||||
|
||||
@JsonProperty("id")
|
||||
@ApiModelProperty("id")
|
||||
private String bisId;
|
||||
|
||||
@JsonProperty("mn")
|
||||
@ApiModelProperty("设备编号")
|
||||
private String mn;
|
||||
|
||||
@JsonProperty("moisture")
|
||||
@ApiModelProperty("湿度")
|
||||
private BigDecimal moisture;
|
||||
|
||||
@JsonProperty("temperature")
|
||||
@ApiModelProperty("温度")
|
||||
private BigDecimal temperature;
|
||||
|
||||
@JsonProperty("velocity")
|
||||
@ApiModelProperty("流速")
|
||||
private BigDecimal velocity;
|
||||
|
||||
@Override
|
||||
public String getSerialNumber() {
|
||||
return this.mn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalDateTime getDataTime() {
|
||||
return DateUtils.toLocalDateTime(acquitAt * 600 * 1000);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
package com.bnhz.adapter.model.kacheck;
|
||||
|
||||
import com.bnhz.adapter.model.blackcar.BlackCarId;
|
||||
import com.bnhz.common.annotation.Length;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 摄像头信息表
|
||||
* @author Leo
|
||||
* @date 2024/6/15 15:15
|
||||
*/
|
||||
@Data
|
||||
public class KaCameraInfo extends BlackCarId {
|
||||
|
||||
private Long id;
|
||||
|
||||
// 摄像头编号
|
||||
@JsonProperty("SXTBH")
|
||||
@ApiModelProperty("摄像头编号")
|
||||
private String sxtbh;
|
||||
|
||||
// 摄像头名称
|
||||
@JsonProperty("SXTMC")
|
||||
@ApiModelProperty("摄像头名称")
|
||||
private String sxtmc;
|
||||
|
||||
// 摄像头类型,1: 海康,2: 大华,3: 其他
|
||||
@JsonProperty("SPLX")
|
||||
@ApiModelProperty("摄像头类型")
|
||||
private Integer splx;
|
||||
|
||||
// 是否有效,0: 无效,1: 有效
|
||||
@JsonProperty("SFYX")
|
||||
@ApiModelProperty("是否有效")
|
||||
private Integer sfyx;
|
||||
|
||||
|
||||
// IP地址
|
||||
@JsonProperty("IP")
|
||||
@ApiModelProperty("IP地址")
|
||||
private String ip;
|
||||
|
||||
// 联网状态,0: 断开,1: 在线
|
||||
@JsonProperty("LWZT")
|
||||
@ApiModelProperty("联网状态")
|
||||
private Integer lwzt;
|
||||
|
||||
// 摄像头类型,1: 前置,2: 后置
|
||||
@JsonProperty("SXTLX")
|
||||
@ApiModelProperty("摄像头类型")
|
||||
private Integer sxtlx;
|
||||
|
||||
// 摄像头朝向
|
||||
@JsonProperty("SXTCX")
|
||||
@ApiModelProperty("摄像头朝向")
|
||||
private String sxtcx;
|
||||
|
||||
// 抓拍车道数
|
||||
@JsonProperty("ZPCDS")
|
||||
@ApiModelProperty("抓拍车道数")
|
||||
private Integer zpcds;
|
||||
|
||||
// 通道号
|
||||
@JsonProperty("TDH")
|
||||
@ApiModelProperty("通道号")
|
||||
private String tdh;
|
||||
|
||||
// 摄像头备案号
|
||||
@JsonProperty("SXTBAH")
|
||||
@ApiModelProperty("摄像头备案号")
|
||||
private String sxtbah;
|
||||
|
||||
// HLS播放地址高清
|
||||
@JsonProperty("HLSGQ")
|
||||
@ApiModelProperty("HLS播放地址高清")
|
||||
@Length(200)
|
||||
private String hlsgq;
|
||||
|
||||
// HLS播放地址流畅
|
||||
@JsonProperty("HLSLC")
|
||||
@ApiModelProperty("HLS播放地址流畅")
|
||||
@Length(200)
|
||||
private String hlslc;
|
||||
|
||||
// 是否启用,1: 正常,2: 调试,3: 暂停
|
||||
@JsonProperty("SFQY")
|
||||
@ApiModelProperty("是否启用")
|
||||
private Integer sfqy;
|
||||
|
||||
// 登录账号
|
||||
@JsonProperty("DLZH")
|
||||
@ApiModelProperty("登录账号")
|
||||
private String dlzh;
|
||||
|
||||
// 登录密码
|
||||
@JsonProperty("DLMM")
|
||||
@ApiModelProperty("登录密码")
|
||||
private String dlmm;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
@Override
|
||||
public LocalDateTime getDataTime() {
|
||||
return LocalDateTime.now();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package com.bnhz.adapter.model.kacheck;
|
||||
|
||||
import com.bnhz.adapter.model.blackcar.BlackCarId;
|
||||
import com.bnhz.common.annotation.Length;
|
||||
import com.bnhz.common.utils.DateUtils;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 点位信息
|
||||
*
|
||||
* @author Leo
|
||||
* @date 2024/6/14 17:46
|
||||
*/
|
||||
|
||||
@ToString
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@FieldNameConstants
|
||||
public class KaPoint extends BlackCarId {
|
||||
|
||||
private Long bisId;
|
||||
|
||||
@JsonProperty("DWMC")
|
||||
@ApiModelProperty("点位名称")
|
||||
private String dwmc;
|
||||
|
||||
@JsonProperty("DWLX")
|
||||
@ApiModelProperty("点位类型")
|
||||
private String dwlx;
|
||||
|
||||
@JsonProperty("YXRQ")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty("运行日期")
|
||||
private Date yxrq;
|
||||
|
||||
@JsonProperty("DWZT")
|
||||
@ApiModelProperty("点位状态")
|
||||
private String dwzt;
|
||||
|
||||
@JsonProperty("DWDZ")
|
||||
@ApiModelProperty("点位地址")
|
||||
private String dwdz;
|
||||
|
||||
@JsonProperty("DDJD")
|
||||
@ApiModelProperty("地点经度")
|
||||
private BigDecimal ddjd;
|
||||
|
||||
@JsonProperty("DDWD")
|
||||
@ApiModelProperty("地点纬度")
|
||||
private BigDecimal ddwd;
|
||||
|
||||
@JsonProperty("CLFX")
|
||||
@ApiModelProperty("车流方向")
|
||||
private String clfx;
|
||||
|
||||
@JsonProperty("CDSL")
|
||||
@ApiModelProperty("车道数量")
|
||||
private Integer cdsl;
|
||||
|
||||
@JsonProperty("CDPD")
|
||||
@ApiModelProperty("车道坡度")
|
||||
private BigDecimal cdpd;
|
||||
|
||||
@JsonProperty("YCXS")
|
||||
@ApiModelProperty("遥测线数")
|
||||
private Integer ycxs;
|
||||
|
||||
@JsonProperty("HPHM")
|
||||
@ApiModelProperty("号牌号码")
|
||||
private String hphm;
|
||||
|
||||
@JsonProperty("CLXH")
|
||||
@ApiModelProperty("装载车型号")
|
||||
private String clxh;
|
||||
|
||||
@JsonProperty("ZYLX")
|
||||
@ApiModelProperty("点位作用类型")
|
||||
private String zylx;
|
||||
|
||||
@JsonProperty("SSSP")
|
||||
@ApiModelProperty("实时视频链接")
|
||||
@Length(value = 200)
|
||||
private String sssp;
|
||||
|
||||
@JsonProperty("CityCode")
|
||||
@ApiModelProperty("城市编号")
|
||||
private String cityCode;
|
||||
|
||||
@JsonProperty("CountyCode")
|
||||
@ApiModelProperty("区县编号")
|
||||
private String countyCode;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
@Override
|
||||
public LocalDateTime getDataTime() {
|
||||
return DateUtils.toLocalDateTime(yxrq);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,196 @@
|
|||
package com.bnhz.adapter.model.kacheck;
|
||||
|
||||
import com.bnhz.adapter.model.blackcar.BlackCarId;
|
||||
import com.bnhz.common.annotation.Length;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 交通流量信息
|
||||
*
|
||||
* @author Leo
|
||||
* @date 2024/6/15 10:05
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class KaTrafficFlowInfo extends BlackCarId {
|
||||
|
||||
private Long id;
|
||||
|
||||
|
||||
/**
|
||||
* 流量编号
|
||||
*/
|
||||
@JsonProperty("LLBH")
|
||||
@ApiModelProperty("流量编号")
|
||||
private String llbh;
|
||||
|
||||
/**
|
||||
* 监测点位日志号
|
||||
*/
|
||||
@JsonProperty("JCDWRZH")
|
||||
@ApiModelProperty("监测点位日志号")
|
||||
private String jcdwrzh;
|
||||
|
||||
/**
|
||||
* 所属道路
|
||||
*/
|
||||
@JsonProperty("SSDL")
|
||||
@ApiModelProperty("所属道路")
|
||||
@Length(value = 200)
|
||||
private String ssdl;
|
||||
|
||||
/**
|
||||
* 流量分类
|
||||
*/
|
||||
@JsonProperty("LLFL")
|
||||
@ApiModelProperty("流量分类")
|
||||
private String llfl;
|
||||
|
||||
/**
|
||||
* 统计时长
|
||||
*/
|
||||
@JsonProperty("TJSC")
|
||||
@ApiModelProperty("统计时长")
|
||||
private String tjsc;
|
||||
|
||||
/**
|
||||
* 采集时段
|
||||
*/
|
||||
@JsonProperty("CJSD")
|
||||
@ApiModelProperty("采集时段")
|
||||
private Integer cjsd;
|
||||
|
||||
/**
|
||||
* 采集序号
|
||||
*/
|
||||
@JsonProperty("CJXH")
|
||||
@ApiModelProperty("采集序号")
|
||||
private Integer cjxh;
|
||||
|
||||
/**
|
||||
* 统计日期
|
||||
*/
|
||||
@JsonProperty("TTRQ")
|
||||
@ApiModelProperty("统计日期")
|
||||
private Date ttrq;
|
||||
|
||||
/**
|
||||
* 车道序号
|
||||
*/
|
||||
@JsonProperty("CDXH")
|
||||
@ApiModelProperty("车道序号")
|
||||
private String cdxh;
|
||||
|
||||
/**
|
||||
* 微小型客车数
|
||||
*/
|
||||
@JsonProperty("WXXKCS")
|
||||
@ApiModelProperty("微小型客车数")
|
||||
private Integer wxxkcs;
|
||||
|
||||
/**
|
||||
* 中型客车数
|
||||
*/
|
||||
@JsonProperty("ZXKCS")
|
||||
@ApiModelProperty("中型客车数")
|
||||
private Integer zxkcs;
|
||||
|
||||
/**
|
||||
* 大型客车数
|
||||
*/
|
||||
@JsonProperty("DXKCS")
|
||||
@ApiModelProperty("大型客车数")
|
||||
private Integer dxkcs;
|
||||
|
||||
/**
|
||||
* 小型货车数
|
||||
*/
|
||||
@JsonProperty("XXHCS")
|
||||
@ApiModelProperty("小型货车数")
|
||||
private Integer xxhcs;
|
||||
|
||||
/**
|
||||
* 中型货车数
|
||||
*/
|
||||
@JsonProperty("ZXHCS")
|
||||
@ApiModelProperty("中型货车数")
|
||||
private Integer zxhcs;
|
||||
|
||||
/**
|
||||
* 重型货车数
|
||||
*/
|
||||
@JsonProperty("ZXHCS1")
|
||||
@ApiModelProperty("重型货车数")
|
||||
private Integer zxhcs1;
|
||||
|
||||
/**
|
||||
* 通行车辆数
|
||||
*/
|
||||
@JsonProperty("TXCLS")
|
||||
@ApiModelProperty("通行车辆数")
|
||||
private Integer txcls;
|
||||
|
||||
/**
|
||||
* 平均速度
|
||||
*/
|
||||
@JsonProperty("PJSD")
|
||||
@ApiModelProperty("平均速度")
|
||||
private Integer pjsd;
|
||||
|
||||
/**
|
||||
* 平均排队长度
|
||||
*/
|
||||
@JsonProperty("PJPDCD")
|
||||
@ApiModelProperty("平均排队长度")
|
||||
private Integer pjpdc;
|
||||
|
||||
/**
|
||||
* 汽油车数
|
||||
*/
|
||||
@JsonProperty("QYCS")
|
||||
@ApiModelProperty("汽油车数")
|
||||
private Integer qycs;
|
||||
|
||||
/**
|
||||
* 柴油车数
|
||||
*/
|
||||
@JsonProperty("CYCS")
|
||||
@ApiModelProperty("柴油车数")
|
||||
private Integer cycs;
|
||||
|
||||
/**
|
||||
* 本地市车辆数
|
||||
*/
|
||||
@JsonProperty("BDCS")
|
||||
@ApiModelProperty("本地市车辆数")
|
||||
private Integer bdcs;
|
||||
|
||||
/**
|
||||
* 本省车辆数
|
||||
*/
|
||||
@JsonProperty("BSCS")
|
||||
@ApiModelProperty("本省车辆数")
|
||||
private Integer bscs;
|
||||
|
||||
/**
|
||||
* 外省车辆数
|
||||
*/
|
||||
@JsonProperty("WSCS")
|
||||
@ApiModelProperty("外省车辆数")
|
||||
private Integer wscs;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
@Override
|
||||
public LocalDateTime getDataTime() {
|
||||
return LocalDateTime.now();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
package com.bnhz.adapter.model.kacheck;
|
||||
|
||||
import com.bnhz.adapter.model.blackcar.BlackCarId;
|
||||
import com.bnhz.common.annotation.Length;
|
||||
import com.bnhz.common.utils.DateUtils;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 车流量
|
||||
*
|
||||
* @author Leo
|
||||
* @date 2024/6/15 14:53
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class KaVehicleFlow extends BlackCarId {
|
||||
|
||||
|
||||
private Long id;
|
||||
|
||||
//车流量记录编号
|
||||
@JsonProperty("LLBH")
|
||||
@ApiModelProperty("车流量记录编号")
|
||||
private String llbh;
|
||||
|
||||
// 车牌号
|
||||
@JsonProperty("HPHM")
|
||||
@ApiModelProperty("车牌号")
|
||||
private String hphm;
|
||||
|
||||
// 车牌颜色
|
||||
@JsonProperty("HPYS")
|
||||
@ApiModelProperty("车牌颜色")
|
||||
private String hpys;
|
||||
// 抓拍时间
|
||||
@JsonProperty("ZPSJ")
|
||||
@ApiModelProperty("抓拍时间")
|
||||
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date zpsj;
|
||||
|
||||
// 是否被抓拍
|
||||
@JsonProperty("SFBZP")
|
||||
@ApiModelProperty("是否被抓拍")
|
||||
private Integer sfbzp;
|
||||
// 行政区划代码
|
||||
@JsonProperty("XZQHDM")
|
||||
@ApiModelProperty("行政区划代码")
|
||||
private String xzqhdm;
|
||||
|
||||
// 车流速度
|
||||
@JsonProperty("CLSD")
|
||||
@ApiModelProperty("车流速度")
|
||||
private BigDecimal clsd;
|
||||
|
||||
// 车辆所属地
|
||||
@JsonProperty("CLSSD")
|
||||
@ApiModelProperty("车辆所属地")
|
||||
private Integer clssd;
|
||||
|
||||
// 车道号
|
||||
@JsonProperty("CDXH")
|
||||
@ApiModelProperty("车道号")
|
||||
private Integer cdxh;
|
||||
|
||||
// 车身颜色中文名(可空)
|
||||
@JsonProperty("CSYS")
|
||||
@ApiModelProperty("车身颜色中文名")
|
||||
private String csys;
|
||||
// 号牌种类(可空)
|
||||
@JsonProperty("HPZL")
|
||||
@ApiModelProperty("号牌种类")
|
||||
private String hpzl;
|
||||
// 车辆类型
|
||||
@JsonProperty("CLLX")
|
||||
@ApiModelProperty("车辆类型")
|
||||
private String cllx;
|
||||
// 燃料种类
|
||||
@JsonProperty("RLZL")
|
||||
@ApiModelProperty("燃料种类")
|
||||
private String rlzl;
|
||||
// 全景图(可空)
|
||||
@JsonProperty("TP1")
|
||||
@ApiModelProperty("全景图")
|
||||
@Length(200)
|
||||
private String tp1;
|
||||
// 号牌图片(可空)
|
||||
@JsonProperty("tp2")
|
||||
@ApiModelProperty("号牌图片")
|
||||
@Length(200)
|
||||
private String tp2;
|
||||
// 视频(可空)
|
||||
@JsonProperty("sp1")
|
||||
@ApiModelProperty("视频")
|
||||
@Length(200)
|
||||
private String sp1;
|
||||
// 后置车尾图片1
|
||||
@JsonProperty("TP1_HTTP")
|
||||
@ApiModelProperty("后置车尾图片1")
|
||||
@Length(200)
|
||||
private String tp1Http;
|
||||
|
||||
@JsonProperty("TP2_HTTP")
|
||||
@ApiModelProperty("后置车尾图片2")
|
||||
@Length(200)
|
||||
private String tp2Http; // 后置车尾图片2
|
||||
|
||||
@JsonProperty("SP1_HTTP")
|
||||
@ApiModelProperty("黑烟车证据视频")
|
||||
@Length(200)
|
||||
private String sp1Http; // 黑烟车证据视频
|
||||
|
||||
@JsonProperty("CityCode")
|
||||
@ApiModelProperty("城市编号")
|
||||
private String cityCode; // 城市编号
|
||||
|
||||
@JsonProperty("CountyCode")
|
||||
@ApiModelProperty("区县编号")
|
||||
private String countyCode; // 区县编号
|
||||
|
||||
@Deprecated
|
||||
@JsonProperty("wspeed")
|
||||
@ApiModelProperty("车速-作废")
|
||||
private BigDecimal wspeed;
|
||||
|
||||
@JsonProperty("SD")
|
||||
@ApiModelProperty("车速")
|
||||
private BigDecimal sd;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
@Override
|
||||
public LocalDateTime getDataTime() {
|
||||
return DateUtils.toLocalDateTime(zpsj);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.bnhz.adapter.service.blackcar;
|
||||
|
||||
import com.bnhz.adapter.model.blackcar.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/6/28 09:58
|
||||
*/
|
||||
public interface IBlackCarService {
|
||||
|
||||
/**
|
||||
* 新增黑烟车信息
|
||||
*
|
||||
* @param blackSmokeVehicles 黑烟车信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertBlackSmokeVehicle(List<BlackSmokeVehicle> blackSmokeVehicles);
|
||||
|
||||
|
||||
/**
|
||||
* 新增摄像头信息
|
||||
*
|
||||
* @param cameraInfos 摄像头信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertCameraInfo(List<CameraInfo> cameraInfos);
|
||||
|
||||
|
||||
/**
|
||||
* 新增点位信息
|
||||
* 一个点位对应一个设备
|
||||
*
|
||||
* @param points 点位信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertPoint(List<Point> points);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增交通流量信息
|
||||
*
|
||||
* @param trafficFlowInfos 交通流量信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertTrafficFlowInfo(List<TrafficFlowInfo> trafficFlowInfos);
|
||||
|
||||
|
||||
/**
|
||||
* 新增车流量
|
||||
*
|
||||
* @param vehicleFlows 车流量
|
||||
* @return 结果
|
||||
*/
|
||||
int insertVehicleFlow(List<VehicleFlow> vehicleFlows);
|
||||
|
||||
}
|
|
@ -0,0 +1,225 @@
|
|||
package com.bnhz.adapter.service.blackcar.impl;
|
||||
|
||||
import com.bnhz.adapter.model.blackcar.*;
|
||||
import com.bnhz.adapter.service.common.CommonService;
|
||||
import com.bnhz.common.constant.BnhzConstant;
|
||||
import com.bnhz.common.utils.DateUtils;
|
||||
import com.bnhz.common.utils.reflect.ReflectUtils;
|
||||
import com.bnhz.iot.domain.Device;
|
||||
import com.bnhz.iot.domain.Product;
|
||||
import com.bnhz.iot.domain.ThingsModel;
|
||||
import com.bnhz.iot.enums.DeviceType;
|
||||
import com.bnhz.iot.model.ThingsModels.ThingsModelEventVO;
|
||||
import com.bnhz.iot.service.IDeviceService;
|
||||
import com.bnhz.iot.service.IProductService;
|
||||
import com.bnhz.iot.service.IThingsModelService;
|
||||
import com.bnhz.iot.service.base.SyncDevice;
|
||||
import com.bnhz.iot.tdengine.service.IColumnModeOperationsService;
|
||||
import com.bnhz.mq.model.ReportDataBo;
|
||||
import com.bnhz.mq.service.IDataHandler;
|
||||
import com.bnhz.adapter.service.blackcar.IBlackCarService;
|
||||
import com.bnhz.adapter.util.ThingsModelUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/6/28 10:00
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class BlackCarServiceImpl implements IBlackCarService, SyncDevice {
|
||||
|
||||
private final IDataHandler dataHandler;
|
||||
|
||||
private final IDeviceService deviceService;
|
||||
|
||||
private final IProductService productService;
|
||||
|
||||
private final IThingsModelService thingsModelService;
|
||||
|
||||
private final IColumnModeOperationsService columnModeOperationsService;
|
||||
|
||||
private final CommonService commonService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int insertPoint(List<Point> points) {
|
||||
//1.初始化设备
|
||||
Product product = initProduct();
|
||||
initModel(new Point(), product.getProductId(), product.getProductName());
|
||||
Device queryDevice = new Device();
|
||||
queryDevice.setProductId(product.getProductId());
|
||||
Map<String, Device> existDeviceMap = deviceService.selectDeviceList(queryDevice)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(Device::getSerialNumber, Function.identity()));
|
||||
points.forEach(point -> {
|
||||
Device existDevice = existDeviceMap.get(point.getDwbh());
|
||||
Device device = addDevice(point, product, ObjectUtils.isEmpty(existDevice) ? null : existDevice.getDeviceId());
|
||||
//2.插入数据属性数据
|
||||
ReportDataBo propertyReportDataBo;
|
||||
try {
|
||||
propertyReportDataBo = ThingsModelUtils.toPropertyReportDataBo(ReflectUtils.getAllFields(point), product.getProductId(), device.getSerialNumber());
|
||||
} catch (IllegalAccessException e) {
|
||||
log.error("转换错误", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
dataHandler.reportData(propertyReportDataBo);
|
||||
});
|
||||
return points.size();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int insertBlackSmokeVehicle(List<BlackSmokeVehicle> blackSmokeVehicles) {
|
||||
commonService.saveEvent(blackSmokeVehicles, BnhzConstant.BlackCarEvent.HYC, DateUtils.getTimestamp());
|
||||
return blackSmokeVehicles.size();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int insertCameraInfo(List<CameraInfo> cameraInfos) {
|
||||
commonService.saveEvent(cameraInfos, BnhzConstant.BlackCarEvent.SXTXX, DateUtils.getTimestamp());
|
||||
return cameraInfos.size();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int insertTrafficFlowInfo(List<TrafficFlowInfo> trafficFlowInfos) {
|
||||
commonService.saveEvent(trafficFlowInfos, BnhzConstant.BlackCarEvent.JTLL, DateUtils.getTimestamp());
|
||||
return trafficFlowInfos.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertVehicleFlow(List<VehicleFlow> vehicleFlows) {
|
||||
commonService.saveEvent(vehicleFlows, BnhzConstant.BlackCarEvent.CLL, DateUtils.getTimestamp());
|
||||
return vehicleFlows.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncDevice() {
|
||||
//黑烟车属于自动推送,入口为insertPoint
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProductName() {
|
||||
return "黑烟车点位设备";
|
||||
}
|
||||
|
||||
private Product initProduct() {
|
||||
Product query = new Product();
|
||||
String transport = BnhzConstant.TRANSPORT.HTTP;
|
||||
query.setTransport(transport);
|
||||
query.setProductName(getProductName());
|
||||
List<Product> products = productService.selectProductList(query);
|
||||
Product product;
|
||||
if (CollectionUtils.isEmpty(products)) {
|
||||
//初始化产品
|
||||
product = new Product();
|
||||
product.setTenantId(1L);
|
||||
product.setProductName(getProductName());
|
||||
product.setTransport(transport);
|
||||
//默认选择其他
|
||||
product.setCategoryId(7L);
|
||||
product.setCategoryName("其他");
|
||||
|
||||
//直连设备
|
||||
product.setDeviceType(DeviceType.DIRECT_DEVICE.getCode());
|
||||
product.setLocationWay(3);
|
||||
//默认以太网
|
||||
product.setNetworkMethod(3);
|
||||
//默认认证方式HTTP
|
||||
product.setVertificateMethod(3);
|
||||
product.setProtocolCode(BnhzConstant.TRANSPORT.HTTP);
|
||||
product.setIsSys(1);
|
||||
product.setRemark("系统自动同步");
|
||||
productService.insertProduct(product);
|
||||
} else {
|
||||
product = products.stream().findFirst().get();
|
||||
}
|
||||
return product;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public void initModel(Point point, Long productId, String productName) {
|
||||
Map<String, ReflectUtils.FieldInfo> allFields = ReflectUtils.getAllFields(point);
|
||||
List<ThingsModelEventVO> thingsModelEventVOS = thingsModelService.listEventModeList(productId);
|
||||
if (CollectionUtils.isEmpty(thingsModelEventVOS)) {
|
||||
//初始化属性
|
||||
List<ThingsModel> propertyThingsModel = ThingsModelUtils.toPropertyThingsModel(allFields, productId, productName);
|
||||
propertyThingsModel.forEach(thingsModelService::insertThingsModel);
|
||||
//初始化事件
|
||||
//1.交通流量
|
||||
Map<String, ReflectUtils.FieldInfo> trafficFlowInfoFields = ReflectUtils.getAllFields(new TrafficFlowInfo());
|
||||
ThingsModel trafficFlowInfoModel = ThingsModelUtils.toEventThingsModel(trafficFlowInfoFields, productId, productName,"交通流量", BnhzConstant.BlackCarEvent.JTLL);
|
||||
thingsModelService.insertThingsModel(trafficFlowInfoModel);
|
||||
//2.黑烟车
|
||||
Map<String, ReflectUtils.FieldInfo> blackCarFields = ReflectUtils.getAllFields(new BlackSmokeVehicle());
|
||||
ThingsModel blackCarModel = ThingsModelUtils.toEventThingsModel(blackCarFields, productId, productName,"黑烟车信息", BnhzConstant.BlackCarEvent.HYC);
|
||||
thingsModelService.insertThingsModel(blackCarModel);
|
||||
//3.车流量
|
||||
Map<String, ReflectUtils.FieldInfo> vehicleFlowFields = ReflectUtils.getAllFields(new VehicleFlow());
|
||||
ThingsModel vehicleFlowModel = ThingsModelUtils.toEventThingsModel(vehicleFlowFields, productId, productName,"车流量", BnhzConstant.BlackCarEvent.CLL);
|
||||
thingsModelService.insertThingsModel(vehicleFlowModel);
|
||||
//4.摄像头信息
|
||||
Map<String, ReflectUtils.FieldInfo> cameraInfoFields = ReflectUtils.getAllFields(new CameraInfo());
|
||||
ThingsModel cameraInfoModel = ThingsModelUtils.toEventThingsModel(cameraInfoFields, productId, productName,"摄像头信息", BnhzConstant.BlackCarEvent.SXTXX);
|
||||
thingsModelService.insertThingsModel(cameraInfoModel);
|
||||
propertyThingsModel.add(trafficFlowInfoModel);
|
||||
propertyThingsModel.add(blackCarModel);
|
||||
propertyThingsModel.add(vehicleFlowModel);
|
||||
propertyThingsModel.add(cameraInfoModel);
|
||||
columnModeOperationsService.ddl(productId, propertyThingsModel);
|
||||
Product productUpdate = new Product();
|
||||
productUpdate.setProductId(productId);
|
||||
productUpdate.setStatus(2);
|
||||
productService.updateProduct(productUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Device addDevice(Point point, Product product, Long deviceId) {
|
||||
Device device = new Device();
|
||||
device.setDeviceId(deviceId);
|
||||
device.setProductId(product.getProductId());
|
||||
device.setProductName(product.getProductName());
|
||||
boolean online = "1".equals(point.getDwzt());
|
||||
device.setStatus(online ? 3 : 4);
|
||||
device.setLocationWay(3);
|
||||
device.setFirmwareVersion(new BigDecimal(1));
|
||||
device.setSerialNumber(point.getDwbh());
|
||||
device.setDeviceType(DeviceType.DIRECT_DEVICE.getCode());
|
||||
device.setIsSimulate(0);
|
||||
device.setDeviceName(point.getDwmc());
|
||||
device.setTenantId(1L);
|
||||
device.setLongitude(point.getDdjd());
|
||||
device.setLatitude(point.getDdwd());
|
||||
device.setRemark("系统自动同步");
|
||||
if (ObjectUtils.isEmpty(device.getDeviceId())) {
|
||||
//第一次保存就为激活时间
|
||||
device.setActiveTime(new Date());
|
||||
deviceService.insertDevice(device);
|
||||
} else {
|
||||
deviceService.updateDevice(device);
|
||||
}
|
||||
return device;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.bnhz.adapter.service.common;
|
||||
|
||||
import com.bnhz.iot.model.DataId;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/7/11 16:58
|
||||
*/
|
||||
public interface CommonService {
|
||||
|
||||
void saveEvent(List<? extends DataId> blackCarIds, String eventId, Long batchNo);
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package com.bnhz.adapter.service.common.impl;
|
||||
|
||||
import com.bnhz.adapter.service.common.CommonService;
|
||||
import com.bnhz.adapter.util.ThingsModelUtils;
|
||||
import com.bnhz.common.utils.reflect.ReflectUtils;
|
||||
import com.bnhz.iot.domain.Device;
|
||||
import com.bnhz.iot.domain.ThingsModel;
|
||||
import com.bnhz.iot.model.DataId;
|
||||
import com.bnhz.iot.service.IDeviceService;
|
||||
import com.bnhz.iot.service.IThingsModelService;
|
||||
import com.bnhz.iot.tdengine.service.IColumnModeOperationsService;
|
||||
import com.bnhz.mq.model.ReportDataBo;
|
||||
import com.bnhz.mq.service.IDataHandler;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/7/11 16:58
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CommonServiceImpl implements CommonService {
|
||||
|
||||
|
||||
private final IDeviceService deviceService;
|
||||
|
||||
private final IThingsModelService thingsModelService;
|
||||
|
||||
|
||||
private final IDataHandler dataHandler;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveEvent(List<? extends DataId> blackCarIds, String eventId, Long batchNo) {
|
||||
if (CollectionUtils.isEmpty(blackCarIds)) {
|
||||
return;
|
||||
}
|
||||
ThingsModel query = new ThingsModel();
|
||||
query.setIdentifier(eventId);
|
||||
Set<String> serNumSet = blackCarIds.stream()
|
||||
.map(item-> item.getSerialNumber().toUpperCase(Locale.ROOT))
|
||||
.collect(Collectors.toSet());
|
||||
Map<String, Device> deviceMap = deviceService.selectDevicesBySerialNumber(serNumSet)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(Device::getSerialNumber, Function.identity()));
|
||||
ThingsModel thingsModel = thingsModelService.selectSingleThingsModel(query);
|
||||
blackCarIds.forEach(dataId -> {
|
||||
String serialNumber = dataId.getSerialNumber();
|
||||
Device device = deviceMap.get(serialNumber);
|
||||
if (ObjectUtils.isEmpty(device)) {
|
||||
return;
|
||||
}
|
||||
ReportDataBo eventReportDataBo;
|
||||
try {
|
||||
eventReportDataBo = ThingsModelUtils.toEventReportDataBo(ReflectUtils.getAllFields(dataId), thingsModel.getProductId(), serialNumber, thingsModel.getModelId(), dataId.getDataTime(), device.getDeviceId(), thingsModel.getIdentifier(), batchNo);
|
||||
} catch (IllegalAccessException e) {
|
||||
log.error("转换错误", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
dataHandler.reportEvent(eventReportDataBo);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package com.bnhz.adapter.service.fumes;
|
||||
|
||||
import com.bnhz.iot.service.base.SyncDevice;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/7/1 15:54
|
||||
*/
|
||||
public interface IFumesService extends SyncDevice {
|
||||
|
||||
/**
|
||||
* 同步报警信息(一小时一次)
|
||||
*/
|
||||
void syncAlarmMsg();
|
||||
|
||||
/**
|
||||
* 报警检测(一天一次)
|
||||
*/
|
||||
void syncDetector();
|
||||
|
||||
|
||||
/**
|
||||
* 十分钟数据(10分钟一次)
|
||||
*/
|
||||
void syncTenData();
|
||||
|
||||
/**
|
||||
* 一分钟数据(5分钟一次)
|
||||
*/
|
||||
void syncOneData();
|
||||
|
||||
/**
|
||||
* 点位事件(1小时一次)
|
||||
*/
|
||||
void syncPointEvent();
|
||||
|
||||
/**
|
||||
* 同步减排统计(一天一次)
|
||||
*/
|
||||
void syncReduce();
|
||||
|
||||
/**
|
||||
* 同步实时数据(5分钟一次)
|
||||
*/
|
||||
void syncRealTimeData();
|
||||
|
||||
}
|
|
@ -0,0 +1,825 @@
|
|||
package com.bnhz.adapter.service.fumes.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bnhz.adapter.model.fumes.*;
|
||||
import com.bnhz.adapter.service.common.CommonService;
|
||||
import com.bnhz.adapter.service.fumes.IFumesService;
|
||||
import com.bnhz.adapter.util.ThingsModelUtils;
|
||||
import com.bnhz.common.constant.BnhzConstant;
|
||||
import com.bnhz.common.core.page.PageResult;
|
||||
import com.bnhz.common.core.redis.RedisCache;
|
||||
import com.bnhz.common.exception.ServiceException;
|
||||
import com.bnhz.common.utils.DateUtils;
|
||||
import com.bnhz.common.utils.PageUtils;
|
||||
import com.bnhz.common.utils.StringUtils;
|
||||
import com.bnhz.common.utils.json.JsonUtils;
|
||||
import com.bnhz.common.utils.reflect.ReflectUtils;
|
||||
import com.bnhz.iot.domain.Device;
|
||||
import com.bnhz.iot.domain.Product;
|
||||
import com.bnhz.iot.domain.ThingsModel;
|
||||
import com.bnhz.iot.enums.DeviceType;
|
||||
import com.bnhz.iot.model.ThingsModels.ThingsModelEventVO;
|
||||
import com.bnhz.iot.model.ThingsModels.ThingsModelQuery;
|
||||
import com.bnhz.iot.service.IDeviceService;
|
||||
import com.bnhz.iot.service.IProductService;
|
||||
import com.bnhz.iot.service.IThingsModelService;
|
||||
import com.bnhz.iot.tdengine.service.IColumnModeOperationsService;
|
||||
import com.bnhz.mq.model.ReportDataBo;
|
||||
import com.bnhz.mq.service.IDataHandler;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.bnhz.common.constant.CacheConstants.*;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/7/1 15:59
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class FumesServiceImpl implements IFumesService {
|
||||
|
||||
@Value("${fumes.host}")
|
||||
private String host;
|
||||
|
||||
@Value("${fumes.username}")
|
||||
private String username;
|
||||
|
||||
@Value("${fumes.password}")
|
||||
private String password;
|
||||
|
||||
@Value("${fumes.areacode}")
|
||||
private String areaCode;
|
||||
|
||||
|
||||
private final RedisCache redisCache;
|
||||
|
||||
private final IProductService productService;
|
||||
|
||||
private final IDeviceService deviceService;
|
||||
|
||||
private final IThingsModelService thingsModelService;
|
||||
|
||||
private final IColumnModeOperationsService columnModeOperationsService;
|
||||
|
||||
private final IDataHandler dataHandler;
|
||||
|
||||
private final CommonService commonService;
|
||||
|
||||
|
||||
private final Executor executor;
|
||||
|
||||
public FumesServiceImpl(RedisCache redisCache, IProductService productService, IDeviceService deviceService, IThingsModelService thingsModelService, IColumnModeOperationsService columnModeOperationsService, IDataHandler dataHandler, CommonService commonService, @Qualifier(value = BnhzConstant.TASK.MESSAGE_CONSUME_TASK) Executor executor) {
|
||||
this.redisCache = redisCache;
|
||||
this.productService = productService;
|
||||
this.deviceService = deviceService;
|
||||
this.thingsModelService = thingsModelService;
|
||||
this.columnModeOperationsService = columnModeOperationsService;
|
||||
this.dataHandler = dataHandler;
|
||||
this.commonService = commonService;
|
||||
this.executor = executor;
|
||||
}
|
||||
|
||||
/**
|
||||
* 登陆
|
||||
*/
|
||||
private final static String AUTH_URL = "/loginAction";
|
||||
|
||||
/**
|
||||
* 监测点信息
|
||||
*/
|
||||
private final static String MONITORING_POINT_URL = "/admin/listLocale";
|
||||
|
||||
/**
|
||||
* 消息管理/报警消息
|
||||
*/
|
||||
private final static String ALARM_MSG_URL = "/admin/listAlarmMsg";
|
||||
|
||||
/**
|
||||
* 报警管理-监测
|
||||
*/
|
||||
private final static String DETECTOR_DAILY_URL = "/admin/queryDataDetectorDaily2";
|
||||
|
||||
/**
|
||||
* 十分钟数据
|
||||
*/
|
||||
private final static String TEN_MIN_URL = "/admin/queryTenMinData";
|
||||
|
||||
/**
|
||||
* 一分钟数据
|
||||
*/
|
||||
private final static String ONE_MIN_URL = "/admin/queryDataDetector";
|
||||
|
||||
/**
|
||||
* 所有点位事件处理记录
|
||||
*/
|
||||
private final static String POINT_EVENT_URL = "/admin/listEventList";
|
||||
|
||||
/**
|
||||
* 监测点位减排统计
|
||||
*/
|
||||
private final static String LOCALE_REDUCE_URL = "/admin/locale_reduce_data";
|
||||
|
||||
/**
|
||||
* 实时数据
|
||||
*/
|
||||
private final static String REAL_TIME_URL = "/admin/listDataIntime";
|
||||
|
||||
/**
|
||||
* 一天一次同步设备信息
|
||||
*/
|
||||
@Override
|
||||
public void syncDevice() {
|
||||
Product product = initProduct();
|
||||
initModel(product.getProductId(), product.getProductName());
|
||||
|
||||
Device queryDevice = new Device();
|
||||
queryDevice.setProductId(product.getProductId());
|
||||
Map<String, Device> existDeviceMap = deviceService.selectDeviceList(queryDevice)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(Device::getSerialNumber, Function.identity()));
|
||||
loopSyncDevice(product, existDeviceMap);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProductName() {
|
||||
return "餐饮油烟点位设备";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void syncAlarmMsg() {
|
||||
int pageNo = 0;
|
||||
int pageSize = 100;
|
||||
boolean next;
|
||||
LocalDateTime lastAlarmTime = getLastAlarmTime();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
do {
|
||||
PageResult<FumesAlarmMsg> alarmMsgPage = getAlarmMsgPage(pageNo, pageSize, lastAlarmTime, now);
|
||||
next = PageUtils.hasNextByStartAt(alarmMsgPage.getTotal(), pageNo, pageSize);
|
||||
List<FumesAlarmMsg> rows = alarmMsgPage.getRows();
|
||||
if (!CollectionUtils.isEmpty(rows)) {
|
||||
rows.forEach(item -> item.setMn(BnhzConstant.FumesBis.INTERFACE_PREFIX + item.getMn()));
|
||||
}
|
||||
commonService.saveEvent(rows, BnhzConstant.FumesEvent.ALARM_MSG, DateUtils.getTimestamp());
|
||||
pageNo = pageNo + pageSize;
|
||||
} while (next);
|
||||
redisCache.setCacheObject(FUMES_ALARM_LAST_TIME, DateUtils.toTimestamp(now));
|
||||
}
|
||||
|
||||
private LocalDateTime getLastAlarmTime() {
|
||||
Object cacheObject = redisCache.getCacheObject(FUMES_ALARM_LAST_TIME);
|
||||
if (!ObjectUtils.isEmpty(cacheObject)) {
|
||||
return DateUtils.toLocalDateTime((Long) cacheObject * 1000);
|
||||
}
|
||||
return LocalDateTime.now().minusDays(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncDetector() {
|
||||
|
||||
int pageNo = 1;
|
||||
int pageSize = 100;
|
||||
boolean next;
|
||||
do {
|
||||
PageResult<FumesDetectorDaily> detectorPage = getDetectorDailyPage(pageNo, pageSize, LocalDate.now().minusDays(1));
|
||||
next = PageUtils.hasNext(detectorPage.getTotal(), pageNo, pageSize);
|
||||
List<FumesDetectorDaily> rows = detectorPage.getRows();
|
||||
if (!CollectionUtils.isEmpty(rows)) {
|
||||
rows.forEach(item -> item.setMn(BnhzConstant.FumesBis.INTERFACE_PREFIX + item.getMn()));
|
||||
}
|
||||
commonService.saveEvent(rows, BnhzConstant.FumesEvent.DETECTOR, DateUtils.getTimestamp());
|
||||
pageNo++;
|
||||
} while (next);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncTenData() {
|
||||
long lastTenDataTime = getLastTenDataTime();
|
||||
Set<String> snSet = getDeviceList()
|
||||
.stream()
|
||||
.map(device -> device.getSerialNumber().replace(BnhzConstant.FumesBis.INTERFACE_PREFIX, ""))
|
||||
.collect(Collectors.toSet());
|
||||
List<FumesTenMin> tenMinData = getTenMinData(null, LocalDateTime.now().minusMinutes(12), LocalDateTime.now())
|
||||
.stream()
|
||||
.filter(fumesTenMin -> snSet.contains(fumesTenMin.getSerialNumber()))
|
||||
.filter(fumesTenMin -> fumesTenMin.getCreateAt() > lastTenDataTime)
|
||||
.peek(fumesTenMin -> fumesTenMin.setMn(BnhzConstant.FumesBis.INTERFACE_PREFIX + fumesTenMin.getMn()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(tenMinData)) {
|
||||
redisCache.setCacheObject(FUMES_TEN_LAST_TIME, tenMinData.iterator().next().getCreateAt());
|
||||
commonService.saveEvent(tenMinData, BnhzConstant.FumesEvent.TEN_DATA, DateUtils.getTimestamp());
|
||||
}
|
||||
}
|
||||
|
||||
private long getLastTenDataTime() {
|
||||
Object cacheObject = redisCache.getCacheObject(FUMES_TEN_LAST_TIME);
|
||||
if (cacheObject instanceof Long) {
|
||||
return (long) cacheObject;
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
|
||||
private List<Device> getDeviceList() {
|
||||
Product query = new Product();
|
||||
String transport = BnhzConstant.TRANSPORT.HTTP;
|
||||
String productName = getProductName();
|
||||
query.setTransport(transport);
|
||||
query.setProductName(productName);
|
||||
List<Product> products = productService.selectProductList(query);
|
||||
Product product = products.iterator().next();
|
||||
Device queryDevice = new Device();
|
||||
queryDevice.setProductId(product.getProductId());
|
||||
return deviceService.selectDeviceList(queryDevice);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncOneData() {
|
||||
LocalDateTime lastOneDataTime = getLastOneDataTime();
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
Set<String> serialNumberSet = getDeviceList().stream()
|
||||
.map(device -> device.getSerialNumber().replace(BnhzConstant.FumesBis.INTERFACE_PREFIX, ""))
|
||||
.collect(Collectors.toSet());
|
||||
List<FumesOneMin> oneMinData = getOneMinData(null, lastOneDataTime, now)
|
||||
.stream()
|
||||
.filter(fumesOneMin -> serialNumberSet.contains(fumesOneMin.getSerialNumber()))
|
||||
.peek(fumesOneMin -> fumesOneMin.setMn(BnhzConstant.FumesBis.INTERFACE_PREFIX + fumesOneMin.getSerialNumber()))
|
||||
.collect(Collectors.toList());
|
||||
commonService.saveEvent(oneMinData, BnhzConstant.FumesEvent.ONE_DATA, DateUtils.getTimestamp());
|
||||
redisCache.setCacheObject(FUMES_ONE_LAST_TIME, DateUtils.toTimestamp(now));
|
||||
}
|
||||
|
||||
private LocalDateTime getLastOneDataTime() {
|
||||
Object cacheObject = redisCache.getCacheObject(FUMES_ONE_LAST_TIME);
|
||||
if (!ObjectUtils.isEmpty(cacheObject)) {
|
||||
LocalDateTime lastOneDataTime = DateUtils.toLocalDateTime((Long) cacheObject * 1000);
|
||||
if (lastOneDataTime.getDayOfYear() != LocalDateTime.now().getDayOfYear()) {
|
||||
lastOneDataTime = LocalDateTime.now().minusMinutes(5);
|
||||
}
|
||||
return timeRangLimit(lastOneDataTime);
|
||||
}
|
||||
return LocalDateTime.now().minusMinutes(30);
|
||||
}
|
||||
|
||||
/**
|
||||
* 时间范围限制
|
||||
* 如果大于10个小时的差值,就取当前时间30分钟前
|
||||
*
|
||||
* @param time 待校验的时间
|
||||
* @return 范围内的时间
|
||||
*/
|
||||
private LocalDateTime timeRangLimit(LocalDateTime time) {
|
||||
long bm = DateUtils.betweenMinute(LocalDateTime.now(), time);
|
||||
if (bm > 60 * 10) {
|
||||
return LocalDateTime.now().minusMinutes(30);
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncPointEvent() {
|
||||
Product query = new Product();
|
||||
String transport = BnhzConstant.TRANSPORT.HTTP;
|
||||
String productName = getProductName();
|
||||
query.setTransport(transport);
|
||||
query.setProductName(productName);
|
||||
List<Product> products = productService.selectProductList(query);
|
||||
Product product = products.iterator().next();
|
||||
ThingsModel modelQuery = new ThingsModel();
|
||||
modelQuery.setProductId(product.getProductId());
|
||||
modelQuery.setIdentifier(BnhzConstant.FumesEvent.POINT_EVENT);
|
||||
ThingsModel eventModel = thingsModelService.selectSingleThingsModel(modelQuery);
|
||||
ThingsModelQuery thingsModelQuery = new ThingsModelQuery();
|
||||
thingsModelQuery.setType(BnhzConstant.ModelType.EVENT);
|
||||
thingsModelQuery.setSize(1);
|
||||
thingsModelQuery.setProductId(product.getProductId());
|
||||
thingsModelQuery.setModelId(eventModel.getModelId());
|
||||
List<Map<String, Object>> responseList = columnModeOperationsService.query(thingsModelQuery);
|
||||
FumesPointEventRecord pointEvent = getPointEvent();
|
||||
List<FumesPointEventRecord.Event> onlineEventList = pointEvent.getOnlineEventList();
|
||||
if (!CollectionUtils.isEmpty(onlineEventList)) {
|
||||
long lastPointEventTime = getLastPointEvent();
|
||||
onlineEventList = onlineEventList.stream()
|
||||
.filter(item -> item.getCalculateDate() > lastPointEventTime)
|
||||
.peek(item -> item.setLocaleMn(BnhzConstant.FumesBis.INTERFACE_PREFIX + item.getLocaleMn()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(onlineEventList)) {
|
||||
redisCache.setCacheObject(FUMES_POINT_EVENT_LAST_TIME, onlineEventList.iterator().next().getCalculateDate());
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isEmpty(responseList)) {
|
||||
commonService.saveEvent(onlineEventList, BnhzConstant.FumesEvent.POINT_EVENT, DateUtils.getTimestamp());
|
||||
} else {
|
||||
String timestamp = responseList.stream()
|
||||
.map(item -> (String) item.get("calculatedate"))
|
||||
.filter(StringUtils::isNotEmpty)
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new ServiceException("同步点位事件报错"));
|
||||
Long min = Long.valueOf(timestamp);
|
||||
List<FumesPointEventRecord.Event> pendingSaveList = onlineEventList.stream()
|
||||
.filter(event -> event.getCalculateDate() - min > 0)
|
||||
.collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(pendingSaveList)) {
|
||||
commonService.saveEvent(pendingSaveList, BnhzConstant.FumesEvent.POINT_EVENT, DateUtils.getTimestamp());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private long getLastPointEvent() {
|
||||
Object cacheObject = redisCache.getCacheObject(FUMES_POINT_EVENT_LAST_TIME);
|
||||
if (cacheObject instanceof Long) {
|
||||
return (long) cacheObject;
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncReduce() {
|
||||
int startAt = 0;
|
||||
int pageSize = 1000;
|
||||
boolean next;
|
||||
do {
|
||||
PageResult<FumesReduce> reduceEventPage = getReduceEventPage(startAt, pageSize);
|
||||
next = PageUtils.hasNextByStartAt(reduceEventPage.getTotal(), startAt, reduceEventPage.getRows().size());
|
||||
List<FumesReduce> rows = reduceEventPage.getRows();
|
||||
if (!CollectionUtils.isEmpty(rows)) {
|
||||
rows.forEach(item -> item.setMn(BnhzConstant.FumesBis.INTERFACE_PREFIX + item.getMn()));
|
||||
}
|
||||
rows.forEach(fumesReduce -> commonService.saveEvent(rows, BnhzConstant.FumesEvent.REDUCE_EVENT, DateUtils.getTimestamp()));
|
||||
startAt = startAt + pageSize;
|
||||
} while (next);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncRealTimeData() {
|
||||
int startAt = 0;
|
||||
int pageSize = 100;
|
||||
boolean next;
|
||||
long lastRealTime = getLastRealTime();
|
||||
long maxAcquitAt = 0L;
|
||||
do {
|
||||
PageResult<FumesRealTime> reduceEventPage = realTimePage(startAt, pageSize);
|
||||
next = PageUtils.hasNextByStartAt(reduceEventPage.getTotal(), startAt, reduceEventPage.getRows().size());
|
||||
List<FumesRealTime> rows = reduceEventPage.getRows();
|
||||
if (!CollectionUtils.isEmpty(rows)) {
|
||||
rows = rows.stream()
|
||||
.filter(item -> item.getAcquitAt() > lastRealTime)
|
||||
.peek(item -> item.setId(BnhzConstant.FumesBis.INTERFACE_PREFIX + item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
if (!CollectionUtil.isEmpty(rows)) {
|
||||
long acquitAt = rows.iterator().next().getAcquitAt();
|
||||
if (acquitAt > maxAcquitAt) {
|
||||
maxAcquitAt = acquitAt;
|
||||
}
|
||||
commonService.saveEvent(unzipRealTimeData(rows), BnhzConstant.FumesEvent.REAL_TIME_EVENT, DateUtils.getTimestamp());
|
||||
}
|
||||
}
|
||||
startAt = startAt + pageSize;
|
||||
} while (next);
|
||||
if (maxAcquitAt > 0) {
|
||||
redisCache.setCacheObject(FUMES_REAL_TIME, maxAcquitAt);
|
||||
}
|
||||
}
|
||||
|
||||
private long getLastRealTime() {
|
||||
Object cacheObject = redisCache.getCacheObject(FUMES_REAL_TIME);
|
||||
if (cacheObject instanceof Long) {
|
||||
return (long) cacheObject;
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
|
||||
|
||||
private void loopSyncDevice(Product product, Map<String, Device> existDeviceMap) {
|
||||
int startAt = 0;
|
||||
int pageSize = 500;
|
||||
boolean next;
|
||||
do {
|
||||
log.info("current index:{}", startAt);
|
||||
PageResult<FumesMonitorPoint> videoDevicePage = getMonitorPointPage(startAt, pageSize);
|
||||
next = startAt + pageSize < videoDevicePage.getTotal();
|
||||
List<FumesMonitorPoint> data = videoDevicePage.getRows();
|
||||
if (!CollectionUtils.isEmpty(data)) {
|
||||
data.forEach(item -> {
|
||||
if (StringUtils.isNotEmpty(item.getMnLast())) {
|
||||
item.setMnLast(BnhzConstant.FumesBis.INTERFACE_PREFIX + item.getMnLast());
|
||||
}
|
||||
});
|
||||
}
|
||||
log.info("[餐饮油烟同步设备],同步数量===》{}", data.size());
|
||||
executor.execute(() -> data.forEach(fumesMonitorPoint -> {
|
||||
if (ObjectUtils.isEmpty(fumesMonitorPoint.getMnLast())) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Device existDevice = existDeviceMap.get(fumesMonitorPoint.getMnLast());
|
||||
addDevice(fumesMonitorPoint, product, ObjectUtils.isEmpty(existDevice) ? null : existDevice.getDeviceId());
|
||||
//2.插入数据属性数据
|
||||
ReportDataBo propertyReportDataBo = ThingsModelUtils.toPropertyReportDataBo(ReflectUtils.getAllFields(fumesMonitorPoint), product.getProductId(), fumesMonitorPoint.getMnLast());
|
||||
dataHandler.reportData(propertyReportDataBo);
|
||||
} catch (Exception e) {
|
||||
log.error("保存设备信息错误", e);
|
||||
}
|
||||
}));
|
||||
startAt = startAt + pageSize;
|
||||
} while (next);
|
||||
}
|
||||
|
||||
|
||||
private String getToken() {
|
||||
String token = redisCache.getCacheObject(FUMES_TOKEN);
|
||||
if (StringUtils.isNotEmpty(token)) {
|
||||
return token;
|
||||
}
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("username", username);
|
||||
paramMap.put("password", password);
|
||||
paramMap.put("noCode", true);
|
||||
String response = HttpUtil.createPost(host + AUTH_URL)
|
||||
.body(JSONObject.toJSONString(paramMap))
|
||||
.execute()
|
||||
.body();
|
||||
FumesRes<Token> tokenFumesRes = JsonUtils.parseObject(response, new TypeReference<FumesRes<Token>>() {
|
||||
});
|
||||
if (tokenFumesRes.getStatus() == 200) {
|
||||
token = tokenFumesRes.getData().getToken();
|
||||
redisCache.setCacheObject(FUMES_TOKEN, token, 24, TimeUnit.HOURS);
|
||||
return token;
|
||||
} else {
|
||||
log.error("[餐饮油烟]获取登陆token失败,返回信息:{}", response);
|
||||
throw new ServiceException("[餐饮油烟]获取登陆token失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public PageResult<FumesMonitorPoint> getMonitorPointPage(Integer pageNo, Integer pageSize) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("StartAt", pageNo);
|
||||
params.put("Size", pageSize);
|
||||
// Map<String, Object> params2 = new HashMap<>();
|
||||
// params2.put("id", "c8t83n56qp1pmvihe0i0");
|
||||
// params.put("Param", params2);
|
||||
|
||||
//c8t83n56qp1pmvihe0i0
|
||||
String body = HttpUtil.createPost(host + MONITORING_POINT_URL)
|
||||
.header("auth", getToken())
|
||||
.body(JSONObject.toJSONString(params))
|
||||
.execute()
|
||||
.body();
|
||||
|
||||
FumesRes<FumesPage<FumesMonitorPoint>> response = JsonUtils.parseObject(body, new TypeReference<FumesRes<FumesPage<FumesMonitorPoint>>>() {
|
||||
});
|
||||
FumesPage<FumesMonitorPoint> data = response.getData();
|
||||
return new PageResult<>(data.getContent(), data.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取报警信息
|
||||
*
|
||||
* @param pageNo 起始页
|
||||
* @param pageSize 每页条数
|
||||
* @param begin 开始时间戳(秒)
|
||||
* @param end 结束时间戳(秒)
|
||||
* @return PageResult<FumesAlarmMsg>
|
||||
*/
|
||||
public PageResult<FumesAlarmMsg> getAlarmMsgPage(Integer pageNo, Integer pageSize, LocalDateTime begin, LocalDateTime end) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
Map<String, Object> innerParams = new HashMap<>();
|
||||
innerParams.put("begin", DateUtils.toTimestamp(begin));
|
||||
innerParams.put("end", DateUtils.toTimestamp(end));
|
||||
params.put("StartAt", pageNo);
|
||||
params.put("Size", pageSize);
|
||||
params.put("Param", innerParams);
|
||||
String body = HttpUtil.createPost(host + ALARM_MSG_URL)
|
||||
.header("auth", getToken())
|
||||
.body(JSONObject.toJSONString(params))
|
||||
.execute()
|
||||
.body();
|
||||
FumesRes<FumesPage<FumesAlarmMsg>> response = JsonUtils.parseObject(body, new TypeReference<FumesRes<FumesPage<FumesAlarmMsg>>>() {
|
||||
});
|
||||
FumesPage<FumesAlarmMsg> data = response.getData();
|
||||
return new PageResult<>(data.getContent(), data.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 报警管理-监测
|
||||
*
|
||||
* @param pageNo 起始页
|
||||
* @param pageSize 每页条数
|
||||
* @param date 日期(yyyy-MM-dd)
|
||||
* @return PageResult<FumesDetectorDaily>
|
||||
*/
|
||||
|
||||
public PageResult<FumesDetectorDaily> getDetectorDailyPage(Integer pageNo, Integer pageSize, LocalDate date) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("Page", pageNo);
|
||||
params.put("Perpage", pageSize);
|
||||
params.put("AcquitDate", DateUtils.toDateStr(date));
|
||||
String body = HttpUtil.createPost(host + DETECTOR_DAILY_URL)
|
||||
.header("auth", getToken())
|
||||
.body(JSONObject.toJSONString(params))
|
||||
.execute()
|
||||
.body();
|
||||
FumesRes<FumesPage<FumesDetectorDaily>> response = JsonUtils.parseObject(body, new TypeReference<FumesRes<FumesPage<FumesDetectorDaily>>>() {
|
||||
});
|
||||
FumesPage<FumesDetectorDaily> data = response.getData();
|
||||
return new PageResult<>(data.getContent(), data.getResultsPageInfo().getTotal());
|
||||
}
|
||||
|
||||
public List<FumesTenMin> getTenMinData(String mn, LocalDateTime beginDateTime, LocalDateTime endDateTime) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
if (StringUtils.isNotEmpty(mn)) {
|
||||
params.put("mn", mn);
|
||||
}
|
||||
params.put("AcquitAtTimeBegin", DateUtils.toDateTimeStr(beginDateTime));
|
||||
params.put("AcquitAtTimeEnd", DateUtils.toDateTimeStr(endDateTime));
|
||||
String body = HttpUtil.createPost(host + TEN_MIN_URL)
|
||||
.header("auth", getToken())
|
||||
.body(JSONObject.toJSONString(params))
|
||||
.execute()
|
||||
.body();
|
||||
|
||||
FumesRes<FumesRes.DataInfo<FumesTenMin>> response = JsonUtils.parseObject(body, new TypeReference<FumesRes<FumesRes.DataInfo<FumesTenMin>>>() {
|
||||
});
|
||||
return response.getData().getData();
|
||||
}
|
||||
|
||||
public List<FumesOneMin> getOneMinData(String mn, LocalDateTime beginDate, LocalDateTime endDate) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
if (StringUtils.isNotEmpty(mn)) {
|
||||
params.put("mn", mn);
|
||||
}
|
||||
params.put("Begin", DateUtils.toTimestamp(beginDate));
|
||||
params.put("End", DateUtils.toTimestamp(endDate));
|
||||
String body = HttpUtil.createPost(host + ONE_MIN_URL)
|
||||
.header("auth", getToken())
|
||||
.body(JSONObject.toJSONString(params))
|
||||
.execute()
|
||||
.body();
|
||||
|
||||
FumesRes<FumesRes.DataInfo<FumesOneMin>> response = JsonUtils.parseObject(body, new TypeReference<FumesRes<FumesRes.DataInfo<FumesOneMin>>>() {
|
||||
});
|
||||
if (ObjectUtils.isEmpty(response.getData())) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return response.getData().getData();
|
||||
}
|
||||
|
||||
private FumesPointEventRecord getPointEvent() {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("AreaCode", areaCode);
|
||||
String body = HttpUtil.createPost(host + POINT_EVENT_URL)
|
||||
.header("auth", getToken())
|
||||
.body(JSONObject.toJSONString(params))
|
||||
.execute()
|
||||
.body();
|
||||
FumesRes<FumesPointEventRecord> response = JsonUtils.parseObject(body, new TypeReference<FumesRes<FumesPointEventRecord>>() {
|
||||
});
|
||||
return response.getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取减排统计数据
|
||||
*
|
||||
* @param startAt 偏移量
|
||||
* @param pageSize 每页条数
|
||||
* @return 减排统计数据
|
||||
*/
|
||||
private PageResult<FumesReduce> getReduceEventPage(Integer startAt, Integer pageSize) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("StartAt", startAt);
|
||||
params.put("Size", pageSize);
|
||||
Map<String, Object> params2 = new HashMap<>();
|
||||
//获取昨天的数据
|
||||
params2.put("acquit_at", DateUtils.toDateStr(LocalDate.now().minusDays(1)));
|
||||
params.put("Param", params2);
|
||||
String body = HttpUtil.createGet(host + LOCALE_REDUCE_URL)
|
||||
.header("auth", getToken())
|
||||
.body(JSONObject.toJSONString(params))
|
||||
.execute()
|
||||
.body();
|
||||
FumesRes<FumesPage<FumesReduce>> response = JsonUtils.parseObject(body, new TypeReference<FumesRes<FumesPage<FumesReduce>>>() {
|
||||
});
|
||||
FumesPage<FumesReduce> data = response.getData();
|
||||
return new PageResult<>(data.getContent(), data.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 实时数据
|
||||
* Id 实时数据的设备编号(中间有“-”连接代表该监测点有多个设备绑定)
|
||||
*
|
||||
* @param startAt 偏移量
|
||||
* @param pageSize 每页条数
|
||||
* @return 实时数据
|
||||
*/
|
||||
|
||||
private PageResult<FumesRealTime> realTimePage(Integer startAt, Integer pageSize) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("StartAt", startAt);
|
||||
params.put("Size", pageSize);
|
||||
params.put("SortMode", "asc");
|
||||
String body = HttpUtil.createPost(host + REAL_TIME_URL)
|
||||
.header("auth", getToken())
|
||||
.body(JSONObject.toJSONString(params))
|
||||
.execute()
|
||||
.body();
|
||||
FumesRes<FumesPage<FumesRealTime>> response = JsonUtils.parseObject(body, new TypeReference<FumesRes<FumesPage<FumesRealTime>>>() {
|
||||
});
|
||||
FumesPage<FumesRealTime> data = response.getData();
|
||||
return new PageResult<>(data.getContent(), data.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 解压实时数据
|
||||
*
|
||||
* @param zipFumesRealTimes 压缩的实时数据
|
||||
* @return 解压后的实时数据
|
||||
*/
|
||||
private List<FumesRealTime> unzipRealTimeData(List<FumesRealTime> zipFumesRealTimes) {
|
||||
return zipFumesRealTimes.stream()
|
||||
.flatMap(fumesRealTime -> {
|
||||
String id = fumesRealTime.getId();
|
||||
if (id.contains("-")) {
|
||||
String[] split = id.split("-");
|
||||
return Arrays.stream(split).map(singleId -> {
|
||||
FumesRealTime unzipRealTime = new FumesRealTime();
|
||||
BeanUtils.copyProperties(fumesRealTime, unzipRealTime);
|
||||
unzipRealTime.setId(singleId);
|
||||
return unzipRealTime;
|
||||
});
|
||||
}
|
||||
return Stream.of(fumesRealTime);
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
private Product initProduct() {
|
||||
Product query = new Product();
|
||||
String transport = BnhzConstant.TRANSPORT.HTTP;
|
||||
String productName = getProductName();
|
||||
query.setTransport(transport);
|
||||
query.setProductName(productName);
|
||||
List<Product> products = productService.selectProductList(query);
|
||||
Product product;
|
||||
if (CollectionUtils.isEmpty(products)) {
|
||||
//初始化产品
|
||||
product = new Product();
|
||||
product.setTenantId(1L);
|
||||
product.setProductName(productName);
|
||||
product.setTransport(transport);
|
||||
//默认选择其他
|
||||
product.setCategoryId(7L);
|
||||
product.setCategoryName("其他");
|
||||
|
||||
//直连设备
|
||||
product.setDeviceType(DeviceType.DIRECT_DEVICE.getCode());
|
||||
product.setLocationWay(3);
|
||||
//默认以太网
|
||||
product.setNetworkMethod(3);
|
||||
//默认认证方式HTTP
|
||||
product.setVertificateMethod(3);
|
||||
product.setProtocolCode(BnhzConstant.TRANSPORT.HTTP);
|
||||
product.setRemark("系统自动同步");
|
||||
productService.insertProduct(product);
|
||||
} else {
|
||||
product = products.stream().findFirst().get();
|
||||
}
|
||||
return product;
|
||||
}
|
||||
|
||||
private Device addDevice(FumesMonitorPoint fumesMonitorPoint, Product product, Long deviceId) {
|
||||
Device device = new Device();
|
||||
device.setDeviceId(deviceId);
|
||||
device.setProductId(product.getProductId());
|
||||
device.setProductName(product.getProductName());
|
||||
boolean online = "NORMAL".equals(fumesMonitorPoint.getStatusOfRecord());
|
||||
device.setStatus(online ? 3 : 4);
|
||||
device.setLocationWay(3);
|
||||
device.setFirmwareVersion(new BigDecimal(1));
|
||||
device.setSerialNumber(fumesMonitorPoint.getMnLast());
|
||||
device.setDeviceType(DeviceType.DIRECT_DEVICE.getCode());
|
||||
device.setIsSimulate(0);
|
||||
device.setDeviceName(fumesMonitorPoint.getName());
|
||||
device.setTenantId(1L);
|
||||
if (!ObjectUtils.isEmpty(fumesMonitorPoint.getLng())) {
|
||||
try {
|
||||
device.setLongitude(new BigDecimal(StringUtils.subByLength(fumesMonitorPoint.getLng(), 10)));
|
||||
} catch (NumberFormatException e) {
|
||||
log.error("转换错误,device SN==>{}, lng==>{}", fumesMonitorPoint.getMnLast(), fumesMonitorPoint.getLng());
|
||||
}
|
||||
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(fumesMonitorPoint.getLat())) {
|
||||
try {
|
||||
device.setLatitude(new BigDecimal(StringUtils.subByLength(fumesMonitorPoint.getLat(), 10)));
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
log.error("转换错误,device SN==>{}, lat==>{}", fumesMonitorPoint.getMnLast(), fumesMonitorPoint.getLat());
|
||||
}
|
||||
}
|
||||
device.setRemark("系统自动同步");
|
||||
if (ObjectUtils.isEmpty(device.getDeviceId())) {
|
||||
//第一次保存就为激活时间
|
||||
device.setActiveTime(new Date());
|
||||
deviceService.insertDevice(device);
|
||||
} else {
|
||||
deviceService.updateDevice(device);
|
||||
}
|
||||
return device;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private void initModel(Long productId, String productName) {
|
||||
List<ThingsModelEventVO> thingsModelEventVOS = thingsModelService.listEventModeList(productId);
|
||||
if (CollectionUtils.isEmpty(thingsModelEventVOS)) {
|
||||
//初始化propertyThingsModel
|
||||
Map<String, ReflectUtils.FieldInfo> propertyAllFields = ReflectUtils.getAllFields(new FumesMonitorPoint());
|
||||
List<ThingsModel> propertyThingsModel = ThingsModelUtils.toPropertyThingsModel(propertyAllFields, productId, productName);
|
||||
propertyThingsModel.forEach(thingsModelService::insertThingsModel);
|
||||
//初始化事件
|
||||
//1.报警信息
|
||||
Map<String, ReflectUtils.FieldInfo> alarmMsgAllFields = ReflectUtils.getAllFields(new FumesAlarmMsg());
|
||||
ThingsModel alarmMsgModel = ThingsModelUtils.toEventThingsModel(alarmMsgAllFields, productId, productName, "消息管理/报警信息", BnhzConstant.FumesEvent.ALARM_MSG);
|
||||
thingsModelService.insertThingsModel(alarmMsgModel);
|
||||
//2.报警管理-监测
|
||||
Map<String, ReflectUtils.FieldInfo> detectorAllFields = ReflectUtils.getAllFields(new FumesDetectorDaily());
|
||||
ThingsModel detectorModel = ThingsModelUtils.toEventThingsModel(detectorAllFields, productId, productName, "报警管理-监测", BnhzConstant.FumesEvent.DETECTOR);
|
||||
thingsModelService.insertThingsModel(detectorModel);
|
||||
//3.十分钟数据
|
||||
Map<String, ReflectUtils.FieldInfo> tenAllFields = ReflectUtils.getAllFields(new FumesTenMin());
|
||||
ThingsModel tenModel = ThingsModelUtils.toEventThingsModel(tenAllFields, productId, productName, "十分钟数据", BnhzConstant.FumesEvent.TEN_DATA);
|
||||
thingsModelService.insertThingsModel(tenModel);
|
||||
//4.一分钟数据
|
||||
Map<String, ReflectUtils.FieldInfo> oneAllFields = ReflectUtils.getAllFields(new FumesOneMin());
|
||||
ThingsModel oneModel = ThingsModelUtils.toEventThingsModel(oneAllFields, productId, productName, "一分钟数据", BnhzConstant.FumesEvent.ONE_DATA);
|
||||
thingsModelService.insertThingsModel(oneModel);
|
||||
//5.点位事件
|
||||
Map<String, ReflectUtils.FieldInfo> pointEventAllFields = ReflectUtils.getAllFields(new FumesPointEventRecord.Event());
|
||||
ThingsModel pointEventModel = ThingsModelUtils.toEventThingsModel(pointEventAllFields, productId, productName, "点位事件", BnhzConstant.FumesEvent.POINT_EVENT);
|
||||
thingsModelService.insertThingsModel(pointEventModel);
|
||||
//6.减排统计
|
||||
Map<String, ReflectUtils.FieldInfo> reduceEventAllFields = ReflectUtils.getAllFields(new FumesReduce());
|
||||
ThingsModel reduceEventModel = ThingsModelUtils.toEventThingsModel(reduceEventAllFields, productId, productName, "监测点位减排统计", BnhzConstant.FumesEvent.REDUCE_EVENT);
|
||||
thingsModelService.insertThingsModel(reduceEventModel);
|
||||
|
||||
//6.实时数据
|
||||
Map<String, ReflectUtils.FieldInfo> realTimeEventAllFields = ReflectUtils.getAllFields(new FumesRealTime());
|
||||
ThingsModel realTimeEventModel = ThingsModelUtils.toEventThingsModel(realTimeEventAllFields, productId, productName, "实时数据", BnhzConstant.FumesEvent.REAL_TIME_EVENT);
|
||||
thingsModelService.insertThingsModel(realTimeEventModel);
|
||||
|
||||
propertyThingsModel.add(alarmMsgModel);
|
||||
propertyThingsModel.add(detectorModel);
|
||||
propertyThingsModel.add(tenModel);
|
||||
propertyThingsModel.add(oneModel);
|
||||
propertyThingsModel.add(pointEventModel);
|
||||
propertyThingsModel.add(reduceEventModel);
|
||||
propertyThingsModel.add(realTimeEventModel);
|
||||
columnModeOperationsService.ddl(productId, propertyThingsModel);
|
||||
Product productUpdate = new Product();
|
||||
productUpdate.setProductId(productId);
|
||||
productUpdate.setStatus(2);
|
||||
productService.updateProduct(productUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
public static class Token {
|
||||
|
||||
@JsonProperty("Token")
|
||||
private String token;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.bnhz.adapter.service.kacheck;
|
||||
|
||||
import com.bnhz.adapter.model.blackcar.*;
|
||||
import com.bnhz.adapter.model.kacheck.KaCameraInfo;
|
||||
import com.bnhz.adapter.model.kacheck.KaPoint;
|
||||
import com.bnhz.adapter.model.kacheck.KaTrafficFlowInfo;
|
||||
import com.bnhz.adapter.model.kacheck.KaVehicleFlow;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/6/28 09:58
|
||||
*/
|
||||
public interface IKaCheckService {
|
||||
|
||||
|
||||
/**
|
||||
* 新增摄像头信息
|
||||
*
|
||||
* @param cameraInfos 摄像头信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertCameraInfo(List<KaCameraInfo> cameraInfos);
|
||||
|
||||
|
||||
/**
|
||||
* 新增点位信息
|
||||
* 一个点位对应一个设备
|
||||
*
|
||||
* @param points 点位信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertPoint(List<KaPoint> points);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增交通流量信息
|
||||
*
|
||||
* @param trafficFlowInfos 交通流量信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertTrafficFlowInfo(List<KaTrafficFlowInfo> trafficFlowInfos);
|
||||
|
||||
|
||||
/**
|
||||
* 新增车流量
|
||||
*
|
||||
* @param vehicleFlows 车流量
|
||||
* @return 结果
|
||||
*/
|
||||
int insertVehicleFlow(List<KaVehicleFlow> vehicleFlows);
|
||||
|
||||
}
|
|
@ -0,0 +1,216 @@
|
|||
package com.bnhz.adapter.service.kacheck.impl;
|
||||
|
||||
import com.bnhz.adapter.model.kacheck.KaCameraInfo;
|
||||
import com.bnhz.adapter.model.kacheck.KaPoint;
|
||||
import com.bnhz.adapter.model.kacheck.KaTrafficFlowInfo;
|
||||
import com.bnhz.adapter.model.kacheck.KaVehicleFlow;
|
||||
import com.bnhz.adapter.service.common.CommonService;
|
||||
import com.bnhz.adapter.service.kacheck.IKaCheckService;
|
||||
import com.bnhz.adapter.util.ThingsModelUtils;
|
||||
import com.bnhz.common.constant.BnhzConstant;
|
||||
import com.bnhz.common.utils.DateUtils;
|
||||
import com.bnhz.common.utils.reflect.ReflectUtils;
|
||||
import com.bnhz.iot.domain.Device;
|
||||
import com.bnhz.iot.domain.Product;
|
||||
import com.bnhz.iot.domain.ThingsModel;
|
||||
import com.bnhz.iot.enums.DeviceType;
|
||||
import com.bnhz.iot.model.ThingsModels.ThingsModelEventVO;
|
||||
import com.bnhz.iot.service.IDeviceService;
|
||||
import com.bnhz.iot.service.IProductService;
|
||||
import com.bnhz.iot.service.IThingsModelService;
|
||||
import com.bnhz.iot.service.base.SyncDevice;
|
||||
import com.bnhz.iot.tdengine.service.IColumnModeOperationsService;
|
||||
import com.bnhz.mq.model.ReportDataBo;
|
||||
import com.bnhz.mq.service.IDataHandler;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/6/28 10:00
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class KaCheckServiceImpl implements IKaCheckService, SyncDevice {
|
||||
|
||||
private final IDataHandler dataHandler;
|
||||
|
||||
private final IDeviceService deviceService;
|
||||
|
||||
private final IProductService productService;
|
||||
|
||||
private final IThingsModelService thingsModelService;
|
||||
|
||||
private final IColumnModeOperationsService columnModeOperationsService;
|
||||
|
||||
private final CommonService commonService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int insertPoint(List<KaPoint> points) {
|
||||
//1.初始化设备
|
||||
Product product = initProduct();
|
||||
initModel(new KaPoint(), product.getProductId(), product.getProductName());
|
||||
Device queryDevice = new Device();
|
||||
queryDevice.setProductId(product.getProductId());
|
||||
Map<String, Device> existDeviceMap = deviceService.selectDeviceList(queryDevice)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(Device::getSerialNumber, Function.identity()));
|
||||
points.forEach(point -> {
|
||||
Device existDevice = existDeviceMap.get(point.getDwbh());
|
||||
Device device = addDevice(point, product, ObjectUtils.isEmpty(existDevice) ? null : existDevice.getDeviceId());
|
||||
//2.插入数据属性数据
|
||||
ReportDataBo propertyReportDataBo;
|
||||
try {
|
||||
propertyReportDataBo = ThingsModelUtils.toPropertyReportDataBo(ReflectUtils.getAllFields(point), product.getProductId(), device.getSerialNumber());
|
||||
} catch (IllegalAccessException e) {
|
||||
log.error("转换错误", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
dataHandler.reportData(propertyReportDataBo);
|
||||
});
|
||||
return points.size();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int insertCameraInfo(List<KaCameraInfo> cameraInfos) {
|
||||
commonService.saveEvent(cameraInfos, BnhzConstant.KaCheckEvent.SXTXX, DateUtils.getTimestamp());
|
||||
return cameraInfos.size();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int insertTrafficFlowInfo(List<KaTrafficFlowInfo> trafficFlowInfos) {
|
||||
commonService.saveEvent(trafficFlowInfos, BnhzConstant.KaCheckEvent.JTLL, DateUtils.getTimestamp());
|
||||
return trafficFlowInfos.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertVehicleFlow(List<KaVehicleFlow> vehicleFlows) {
|
||||
commonService.saveEvent(vehicleFlows, BnhzConstant.KaCheckEvent.CLL, DateUtils.getTimestamp());
|
||||
return vehicleFlows.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncDevice() {
|
||||
//黑烟车属于自动推送,入口为insertPoint
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProductName() {
|
||||
return "卡口点位设备";
|
||||
}
|
||||
|
||||
private Product initProduct() {
|
||||
Product query = new Product();
|
||||
String transport = BnhzConstant.TRANSPORT.HTTP;
|
||||
query.setTransport(transport);
|
||||
query.setProductName(getProductName());
|
||||
List<Product> products = productService.selectProductList(query);
|
||||
Product product;
|
||||
if (CollectionUtils.isEmpty(products)) {
|
||||
//初始化产品
|
||||
product = new Product();
|
||||
product.setTenantId(1L);
|
||||
product.setProductName(getProductName());
|
||||
product.setTransport(transport);
|
||||
//默认选择其他
|
||||
product.setCategoryId(7L);
|
||||
product.setCategoryName("其他");
|
||||
|
||||
//直连设备
|
||||
product.setDeviceType(DeviceType.DIRECT_DEVICE.getCode());
|
||||
product.setLocationWay(3);
|
||||
//默认以太网
|
||||
product.setNetworkMethod(3);
|
||||
//默认认证方式HTTP
|
||||
product.setVertificateMethod(3);
|
||||
product.setProtocolCode(BnhzConstant.TRANSPORT.HTTP);
|
||||
product.setIsSys(1);
|
||||
product.setRemark("系统自动同步");
|
||||
productService.insertProduct(product);
|
||||
} else {
|
||||
product = products.stream().findFirst().get();
|
||||
}
|
||||
return product;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public void initModel(KaPoint point, Long productId, String productName) {
|
||||
Map<String, ReflectUtils.FieldInfo> allFields = ReflectUtils.getAllFields(point);
|
||||
List<ThingsModelEventVO> thingsModelEventVOS = thingsModelService.listEventModeList(productId);
|
||||
if (CollectionUtils.isEmpty(thingsModelEventVOS)) {
|
||||
//初始化属性
|
||||
List<ThingsModel> propertyThingsModel = ThingsModelUtils.toPropertyThingsModel(allFields, productId, productName);
|
||||
propertyThingsModel.forEach(thingsModelService::insertThingsModel);
|
||||
//初始化事件
|
||||
//1.交通流量
|
||||
Map<String, ReflectUtils.FieldInfo> trafficFlowInfoFields = ReflectUtils.getAllFields(new KaTrafficFlowInfo());
|
||||
ThingsModel trafficFlowInfoModel = ThingsModelUtils.toEventThingsModel(trafficFlowInfoFields, productId, productName,"交通流量", BnhzConstant.KaCheckEvent.JTLL);
|
||||
thingsModelService.insertThingsModel(trafficFlowInfoModel);
|
||||
//3.车流量
|
||||
Map<String, ReflectUtils.FieldInfo> vehicleFlowFields = ReflectUtils.getAllFields(new KaVehicleFlow());
|
||||
ThingsModel vehicleFlowModel = ThingsModelUtils.toEventThingsModel(vehicleFlowFields, productId, productName,"车流量", BnhzConstant.KaCheckEvent.CLL);
|
||||
thingsModelService.insertThingsModel(vehicleFlowModel);
|
||||
//4.摄像头信息
|
||||
Map<String, ReflectUtils.FieldInfo> cameraInfoFields = ReflectUtils.getAllFields(new KaCameraInfo());
|
||||
ThingsModel cameraInfoModel = ThingsModelUtils.toEventThingsModel(cameraInfoFields, productId, productName,"摄像头信息", BnhzConstant.KaCheckEvent.SXTXX);
|
||||
thingsModelService.insertThingsModel(cameraInfoModel);
|
||||
propertyThingsModel.add(trafficFlowInfoModel);
|
||||
propertyThingsModel.add(vehicleFlowModel);
|
||||
propertyThingsModel.add(cameraInfoModel);
|
||||
columnModeOperationsService.ddl(productId, propertyThingsModel);
|
||||
Product productUpdate = new Product();
|
||||
productUpdate.setProductId(productId);
|
||||
productUpdate.setStatus(2);
|
||||
productService.updateProduct(productUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Device addDevice(KaPoint point, Product product, Long deviceId) {
|
||||
Device device = new Device();
|
||||
device.setDeviceId(deviceId);
|
||||
device.setProductId(product.getProductId());
|
||||
device.setProductName(product.getProductName());
|
||||
boolean online = "1".equals(point.getDwzt());
|
||||
device.setStatus(online ? 3 : 4);
|
||||
device.setLocationWay(3);
|
||||
device.setFirmwareVersion(new BigDecimal(1));
|
||||
device.setSerialNumber(point.getDwbh());
|
||||
device.setDeviceType(DeviceType.DIRECT_DEVICE.getCode());
|
||||
device.setIsSimulate(0);
|
||||
device.setDeviceName(point.getDwmc());
|
||||
device.setTenantId(1L);
|
||||
device.setLongitude(point.getDdjd());
|
||||
device.setLatitude(point.getDdwd());
|
||||
device.setRemark("系统自动同步");
|
||||
if (ObjectUtils.isEmpty(device.getDeviceId())) {
|
||||
//第一次保存就为激活时间
|
||||
device.setActiveTime(new Date());
|
||||
deviceService.insertDevice(device);
|
||||
} else {
|
||||
deviceService.updateDevice(device);
|
||||
}
|
||||
return device;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package com.bnhz.adapter.service.video;
|
||||
|
||||
import com.bnhz.common.core.page.PageResult;
|
||||
import com.bnhz.common.utils.PageUtils;
|
||||
import com.bnhz.iot.model.ext.video.VideoDeviceInfoVO;
|
||||
import com.bnhz.iot.service.base.SyncDevice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 高空瞭望
|
||||
*
|
||||
* @author Leo
|
||||
* @date 2024/6/11 15:16
|
||||
*/
|
||||
public interface VideoMonitorService extends SyncDevice {
|
||||
|
||||
PageResult<VideoDeviceInfoVO> getVideoDevicePage(Integer pageNo, Integer pageSize);
|
||||
|
||||
String getLiveStream(String channelCode, String protocol);
|
||||
|
||||
void syncLiveStream();
|
||||
|
||||
@Override
|
||||
default void syncDevice() {
|
||||
int pageNo = 1;
|
||||
boolean next = false;
|
||||
int pageSize = 100;
|
||||
do {
|
||||
PageResult<VideoDeviceInfoVO> videoDevicePage = getVideoDevicePage(pageNo, pageSize);
|
||||
next = PageUtils.hasNext(videoDevicePage.getTotal(), pageNo, pageSize);
|
||||
List<VideoDeviceInfoVO> data = videoDevicePage.getRows();
|
||||
register(data);
|
||||
pageNo++;
|
||||
} while (next);
|
||||
}
|
||||
|
||||
/**
|
||||
* 登记设备到平台
|
||||
*
|
||||
* @param videoDeviceInfoVOS 第三方监控
|
||||
*/
|
||||
void register(List<VideoDeviceInfoVO> videoDeviceInfoVOS);
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,279 @@
|
|||
package com.bnhz.adapter.service.video.impl;
|
||||
|
||||
import com.bnhz.adapter.service.common.CommonService;
|
||||
import com.bnhz.adapter.service.video.VideoMonitorService;
|
||||
import com.bnhz.adapter.util.ThingsModelUtils;
|
||||
import com.bnhz.common.constant.BnhzConstant;
|
||||
import com.bnhz.common.utils.DateUtils;
|
||||
import com.bnhz.common.utils.reflect.ReflectUtils;
|
||||
import com.bnhz.iot.domain.Device;
|
||||
import com.bnhz.iot.domain.Product;
|
||||
import com.bnhz.iot.domain.ThingsModel;
|
||||
import com.bnhz.iot.model.ThingsModels.ThingsModelEventVO;
|
||||
import com.bnhz.iot.model.ext.video.VideoDeviceInfoVO;
|
||||
import com.bnhz.iot.model.videoMonitor.*;
|
||||
import com.bnhz.iot.service.IDeviceService;
|
||||
import com.bnhz.iot.service.IProductService;
|
||||
import com.bnhz.iot.service.IThingsModelService;
|
||||
import com.bnhz.iot.tdengine.service.IColumnModeOperationsService;
|
||||
import com.bnhz.mq.model.ReportDataBo;
|
||||
import com.bnhz.mq.service.IDataHandler;
|
||||
import com.bnhz.sip.domain.SipDevice;
|
||||
import com.bnhz.sip.domain.SipDeviceChannel;
|
||||
import com.bnhz.sip.service.ISipDeviceChannelService;
|
||||
import com.bnhz.sip.service.ISipDeviceService;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/6/24 15:43
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public abstract class BaseVideoServiceImpl implements VideoMonitorService {
|
||||
|
||||
|
||||
private final IProductService productService;
|
||||
|
||||
private final IDeviceService deviceService;
|
||||
|
||||
@Getter
|
||||
private final IThingsModelService thingsModelService;
|
||||
|
||||
private final IDataHandler dataHandler;
|
||||
|
||||
@Getter
|
||||
private final IColumnModeOperationsService columnModeOperationsService;
|
||||
|
||||
private final ISipDeviceService sipDeviceService;
|
||||
|
||||
private final ISipDeviceChannelService sipDeviceChannelService;
|
||||
|
||||
@Getter
|
||||
private final CommonService commonService;
|
||||
|
||||
|
||||
|
||||
abstract String getTransport();
|
||||
|
||||
@Override
|
||||
public void syncLiveStream() {
|
||||
Product product = initProduct();
|
||||
SipDeviceChannel querySipDeviceChannel = new SipDeviceChannel();
|
||||
querySipDeviceChannel.setProductId(product.getProductId());
|
||||
List<SipDeviceChannel> sipDeviceChannels = sipDeviceChannelService.selectSipDeviceChannelList(querySipDeviceChannel);
|
||||
List<VideoStream> videoStreams = new ArrayList<>();
|
||||
sipDeviceChannels.forEach(item -> {
|
||||
String hslLiveStream = getLiveStream(item.getChannelSipId(), BnhzConstant.VideoProtocol.HLS);
|
||||
String rtspLiveStream = getLiveStream(item.getChannelSipId(), BnhzConstant.VideoProtocol.RTSP);
|
||||
VideoStream videoStream = new VideoStream();
|
||||
videoStream.setVideoDeviceCode(item.getDeviceSipId());
|
||||
videoStream.setChannelNo(item.getChannelSipId());
|
||||
videoStream.setGenTime(LocalDateTime.now());
|
||||
videoStream.setHlsUrl(hslLiveStream);
|
||||
videoStream.setRtspUrl(rtspLiveStream);
|
||||
videoStreams.add(videoStream);
|
||||
});
|
||||
String eventId = product.getProductName().contains(BnhzConstant.SUFFIX.HIGH_OBS) ? BnhzConstant.VideoEvent.HIGH_OBS_PREVIEW_EVENT : BnhzConstant.VideoEvent.VIDEO_MONITOR_PREVIEW_EVENT;
|
||||
commonService.saveEvent(videoStreams, eventId, DateUtils.getTimestamp());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(List<VideoDeviceInfoVO> videoDeviceInfoVOS) {
|
||||
Product product = initProduct();
|
||||
initModel(product.getProductId());
|
||||
Device queryDevice = new Device();
|
||||
queryDevice.setProductId(product.getProductId());
|
||||
SipDeviceChannel querySipDeviceChannel = new SipDeviceChannel();
|
||||
querySipDeviceChannel.setProductId(product.getProductId());
|
||||
Map<String, SipDeviceChannel> existChannelMap = sipDeviceChannelService.selectSipDeviceChannelList(querySipDeviceChannel)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(SipDeviceChannel::getChannelSipId, Function.identity()));
|
||||
Map<String, Device> existDeviceMap = deviceService.selectDeviceList(queryDevice)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(Device::getSerialNumber, Function.identity()));
|
||||
videoDeviceInfoVOS
|
||||
.forEach(videoDeviceInfoVO -> {
|
||||
Device existDevice = existDeviceMap.get(videoDeviceInfoVO.getVideoDeviceCode());
|
||||
//添加设备
|
||||
Device device = addDevice(videoDeviceInfoVO, product, ObjectUtils.isEmpty(existDevice) ? null : existDevice.getDeviceId());
|
||||
//添加通道
|
||||
List<VideoDeviceInfoVO.Channel> channelList = videoDeviceInfoVO.getChannelList();
|
||||
addChannel(device, channelList, existChannelMap);
|
||||
|
||||
//2.插入数据属性数据
|
||||
ReportDataBo propertyReportDataBo;
|
||||
try {
|
||||
propertyReportDataBo = ThingsModelUtils.toPropertyReportDataBo(ReflectUtils.getAllFields(videoDeviceInfoVO.getData()), product.getProductId(), videoDeviceInfoVO.getVideoDeviceCode());
|
||||
} catch (IllegalAccessException e) {
|
||||
log.error("转换错误", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
dataHandler.reportData(propertyReportDataBo);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void addChannel(Device device, List<VideoDeviceInfoVO.Channel> channelList, Map<String, SipDeviceChannel> exitChannelMap) {
|
||||
//新增Sip设备
|
||||
SipDevice sipDevice = new SipDevice();
|
||||
sipDevice.setProductId(device.getProductId());
|
||||
sipDevice.setDeviceSipId(device.getSerialNumber());
|
||||
sipDevice.setDeviceId(device.getDeviceId());
|
||||
sipDevice.setDeviceName(device.getDeviceName());
|
||||
sipDevice.setTransport(getTransport());
|
||||
sipDevice.setRegistertime(new Date());
|
||||
sipDeviceService.updateDevice(sipDevice);
|
||||
|
||||
channelList.forEach(channel -> {
|
||||
SipDeviceChannel sipDeviceChannel = new SipDeviceChannel();
|
||||
SipDeviceChannel existChannel = exitChannelMap.get((channel.getChannelNo()));
|
||||
sipDeviceChannel.setId(ObjectUtils.isEmpty(existChannel) ? null : existChannel.getId());
|
||||
sipDeviceChannel.setTenantId(device.getTenantId());
|
||||
sipDeviceChannel.setTenantName(device.getTenantName());
|
||||
sipDeviceChannel.setProductId(device.getProductId());
|
||||
sipDeviceChannel.setProductName(device.getProductName());
|
||||
sipDeviceChannel.setDeviceSipId(device.getSerialNumber());
|
||||
sipDeviceChannel.setChannelSipId(channel.getChannelNo());
|
||||
sipDeviceChannel.setChannelName(channel.getChannelName());
|
||||
sipDeviceChannel.setStatus(channel.getOnline() ? 2 : 3);
|
||||
if (ObjectUtils.isEmpty(sipDeviceChannel.getId())) {
|
||||
sipDeviceChannelService.insertSipDeviceChannel(sipDeviceChannel);
|
||||
} else {
|
||||
sipDeviceChannelService.updateSipDeviceChannel(sipDeviceChannel);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private Device addDevice(VideoDeviceInfoVO videoDeviceInfoVO, Product product, Long deviceId) {
|
||||
Device device = new Device();
|
||||
device.setDeviceId(deviceId);
|
||||
device.setProductId(product.getProductId());
|
||||
device.setProductName(product.getProductName());
|
||||
List<VideoDeviceInfoVO.Channel> channelList = videoDeviceInfoVO.getChannelList();
|
||||
boolean online = channelList.stream()
|
||||
.anyMatch(VideoDeviceInfoVO.Channel::getOnline);
|
||||
device.setStatus(online ? 3 : 4);
|
||||
device.setLocationWay(3);
|
||||
device.setFirmwareVersion(new BigDecimal(1));
|
||||
device.setSerialNumber(videoDeviceInfoVO.getVideoDeviceCode());
|
||||
device.setDeviceType(1);
|
||||
device.setIsSimulate(0);
|
||||
device.setDeviceName(videoDeviceInfoVO.getVideoDeviceName());
|
||||
device.setTenantId(1L);
|
||||
device.setRemark("系统自动同步");
|
||||
if (ObjectUtils.isEmpty(device.getDeviceId())) {
|
||||
//第一次保存就为激活时间
|
||||
device.setActiveTime(new Date());
|
||||
deviceService.insertDevice(device);
|
||||
} else {
|
||||
deviceService.updateDevice(device);
|
||||
}
|
||||
return device;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化产品
|
||||
*
|
||||
* @return 产品
|
||||
*/
|
||||
public Product initProduct() {
|
||||
Product query = new Product();
|
||||
query.setTransport(getTransport());
|
||||
query.setProductName(getProductName());
|
||||
List<Product> products = productService.selectProductList(query);
|
||||
Product product;
|
||||
if (CollectionUtils.isEmpty(products)) {
|
||||
//初始化产品
|
||||
product = new Product();
|
||||
product.setTenantId(1L);
|
||||
product.setProductName(getProductName());
|
||||
product.setTransport(getTransport());
|
||||
//默认选择其他
|
||||
product.setCategoryId(7L);
|
||||
product.setCategoryName("其他");
|
||||
|
||||
//监控设备
|
||||
product.setDeviceType(1);
|
||||
product.setLocationWay(3);
|
||||
//默认以太网
|
||||
product.setNetworkMethod(3);
|
||||
//默认认证方式HTTP
|
||||
product.setVertificateMethod(3);
|
||||
product.setProtocolCode(BnhzConstant.TRANSPORT.HTTP);
|
||||
product.setRemark("系统自动同步");
|
||||
productService.insertProduct(product);
|
||||
} else {
|
||||
product = products.stream().findFirst().get();
|
||||
}
|
||||
return product;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private void initModel(Long productId) {
|
||||
String productName = getProductName();
|
||||
List<ThingsModelEventVO> thingsModelEventVOS = thingsModelService.listEventModeList(productId);
|
||||
if (!CollectionUtils.isEmpty(thingsModelEventVOS)) {
|
||||
return;
|
||||
}
|
||||
//华智
|
||||
Map<String, ReflectUtils.FieldInfo> allFields = new HashMap<>();
|
||||
ThingsModel streamModel = new ThingsModel();
|
||||
Map<String, ReflectUtils.FieldInfo> streamMap = ReflectUtils.getAllFields(new VideoStream());
|
||||
if (productName.contains(BnhzConstant.SUFFIX.HZ)) {
|
||||
allFields = ReflectUtils.getAllFields(new VideoMonitorPointVO());
|
||||
//初始化视频预览流事件
|
||||
streamModel = ThingsModelUtils.toEventThingsModel(streamMap, productId, productName, "视频预览流", BnhzConstant.VideoEvent.VIDEO_MONITOR_PREVIEW_EVENT);
|
||||
|
||||
} else if (productName.contains(BnhzConstant.SUFFIX.HIGH_OBS)) {
|
||||
allFields = ReflectUtils.getAllFields(new CameraInfo());
|
||||
//初始化事件
|
||||
Map<String, ReflectUtils.FieldInfo> fieldInfoMap = ReflectUtils.getAllFields(new FireAlarmHistory());
|
||||
ThingsModel fireInfoModel = ThingsModelUtils.toEventThingsModel(fieldInfoMap, productId, productName, "防火组件历史火情列表", BnhzConstant.VideoEvent.HIGH_OBS_FIRE_EVENT);
|
||||
thingsModelService.insertThingsModel(fireInfoModel);
|
||||
columnModeOperationsService.ddl(productId, Collections.singletonList(fireInfoModel));
|
||||
|
||||
Map<String, ReflectUtils.FieldInfo> judgeMap = ReflectUtils.getAllFields(new FireAlarmHistory());
|
||||
ThingsModel judgeModel = ThingsModelUtils.toEventThingsModel(judgeMap, productId, productName, "防火组件预警研判列表", BnhzConstant.VideoEvent.HIGH_OBS_JUDGE_EVENT);
|
||||
thingsModelService.insertThingsModel(judgeModel);
|
||||
columnModeOperationsService.ddl(productId, Collections.singletonList(judgeModel));
|
||||
|
||||
|
||||
Map<String, ReflectUtils.FieldInfo> playBackMap = ReflectUtils.getAllFields(new HighObsPlayBack());
|
||||
ThingsModel playBackModel = ThingsModelUtils.toEventThingsModel(playBackMap, productId, productName, "视频回放数据", BnhzConstant.VideoEvent.HIGH_OBS_PLAY_BACK_EVENT);
|
||||
thingsModelService.insertThingsModel(playBackModel);
|
||||
columnModeOperationsService.ddl(productId, Collections.singletonList(playBackModel));
|
||||
|
||||
//初始化视频预览流事件
|
||||
streamModel = ThingsModelUtils.toEventThingsModel(streamMap, productId, productName, "视频预览流", BnhzConstant.VideoEvent.HIGH_OBS_PREVIEW_EVENT);
|
||||
|
||||
}
|
||||
List<ThingsModel> propertyThingsModel = ThingsModelUtils.toPropertyThingsModel(allFields, productId, productName);
|
||||
propertyThingsModel.forEach(thingsModelService::insertThingsModel);
|
||||
columnModeOperationsService.ddl(productId, propertyThingsModel);
|
||||
|
||||
thingsModelService.insertThingsModel(streamModel);
|
||||
columnModeOperationsService.ddl(productId, Collections.singletonList(streamModel));
|
||||
|
||||
|
||||
Product productUpdate = new Product();
|
||||
productUpdate.setProductId(productId);
|
||||
productUpdate.setStatus(2);
|
||||
productService.updateProduct(productUpdate);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,381 @@
|
|||
package com.bnhz.adapter.service.video.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bnhz.adapter.service.common.CommonService;
|
||||
import com.bnhz.common.constant.BnhzConstant;
|
||||
import com.bnhz.common.core.page.PageResult;
|
||||
import com.bnhz.common.utils.DateUtils;
|
||||
import com.bnhz.common.utils.PageUtils;
|
||||
import com.bnhz.common.utils.StringUtils;
|
||||
import com.bnhz.common.utils.json.JsonUtils;
|
||||
import com.bnhz.iot.domain.Product;
|
||||
import com.bnhz.iot.domain.ThingsModel;
|
||||
import com.bnhz.iot.model.ThingsModels.ThingsModelQuery;
|
||||
import com.bnhz.iot.model.ext.video.VideoDeviceInfoVO;
|
||||
import com.bnhz.iot.model.videoMonitor.CameraInfo;
|
||||
import com.bnhz.iot.model.videoMonitor.FireAlarmHistory;
|
||||
import com.bnhz.iot.model.videoMonitor.HighObsPlayBack;
|
||||
import com.bnhz.iot.model.videoMonitor.HighObsResult;
|
||||
import com.bnhz.iot.model.videoMonitor.res.HighObsPlayBackRes;
|
||||
import com.bnhz.iot.service.IDeviceService;
|
||||
import com.bnhz.iot.service.IProductService;
|
||||
import com.bnhz.iot.service.IThingsModelService;
|
||||
import com.bnhz.iot.tdengine.service.IColumnModeOperationsService;
|
||||
import com.bnhz.mq.service.IDataHandler;
|
||||
import com.bnhz.sip.service.ISipDeviceChannelService;
|
||||
import com.bnhz.sip.service.ISipDeviceService;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
|
||||
import com.hikvision.artemis.sdk.config.ArtemisConfig;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/6/11 15:17
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("highObsServiceImpl")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class HighObsServiceImpl extends BaseVideoServiceImpl {
|
||||
|
||||
public HighObsServiceImpl(IProductService productService, IDeviceService deviceService, IThingsModelService thingsModelService, IDataHandler dataHandler, IColumnModeOperationsService columnModeOperationsService, ISipDeviceService sipDeviceService, ISipDeviceChannelService sipDeviceChannelService, CommonService commonService) {
|
||||
super(productService, deviceService, thingsModelService, dataHandler, columnModeOperationsService, sipDeviceService, sipDeviceChannelService, commonService);
|
||||
}
|
||||
|
||||
@Value("${high-obs.host}")
|
||||
private String host;
|
||||
|
||||
@Value("${high-obs.appKey}")
|
||||
private String appKey;
|
||||
|
||||
@Value("${high-obs.appSecret}")
|
||||
private String appSecret;
|
||||
|
||||
@Value("${high-obs.picUrlPrefix}")
|
||||
private String picUrlPrefix;
|
||||
|
||||
@Value("${server.domain}")
|
||||
private String domain;
|
||||
|
||||
|
||||
private static final String PIC_SPLIT_SYMBOL = "@@@@";
|
||||
|
||||
|
||||
private static final String ARTEMIS_PATH = "/artemis";
|
||||
|
||||
|
||||
public String callPostApiGetCameraList(Integer pageNo, Integer pageSize) throws Exception {
|
||||
|
||||
ArtemisConfig config = initConfig();
|
||||
final String getCamsApi = ARTEMIS_PATH + "/api/resource/v1/cameras";
|
||||
Map<String, Object> paramMap = new HashMap<>();// post请求Form表单参数
|
||||
paramMap.put("pageNo", pageNo);
|
||||
paramMap.put("pageSize", pageSize);
|
||||
String body = JSON.toJSON(paramMap).toString();
|
||||
Map<String, String> path = new HashMap<String, String>(2) {
|
||||
{
|
||||
put("https://", getCamsApi);
|
||||
}
|
||||
};
|
||||
return ArtemisHttpUtil.doPostStringArtemis(config, path, body, null, null, "application/json");
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public HighObsResult<HighObsResult.Page<FireAlarmHistory>> getFireAlarmHistories(LocalDateTime beginTime, LocalDateTime endTime, Integer pageNo, Integer pageSize) {
|
||||
ArtemisConfig config = initConfig();
|
||||
final String getCamsApi = ARTEMIS_PATH + "/api/bforestfire/v1/historyAlarms";
|
||||
Map<String, Object> paramMap = new HashMap<>();// post请求Form表单参数
|
||||
paramMap.put("pageNo", pageNo);
|
||||
paramMap.put("pageSize", pageSize);
|
||||
if (!ObjectUtils.isEmpty(beginTime)) {
|
||||
paramMap.put("beginTime", DateUtils.toISOUtc8Time(beginTime));
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(endTime)) {
|
||||
paramMap.put("endTime", DateUtils.toISOUtc8Time(endTime));
|
||||
}
|
||||
String body = JSON.toJSON(paramMap).toString();
|
||||
Map<String, String> path = new HashMap<String, String>(2) {
|
||||
{
|
||||
put("https://", getCamsApi);
|
||||
}
|
||||
};
|
||||
String response = ArtemisHttpUtil.doPostStringArtemis(config, path, body, null, null, "application/json");
|
||||
|
||||
return toFireAlarmHistory(response);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public HighObsResult<HighObsResult.Page<FireAlarmHistory>> getJudgeList(LocalDateTime beginTime, LocalDateTime endTime, Integer pageNo, Integer pageSize) {
|
||||
ArtemisConfig config = initConfig();
|
||||
final String getCamsApi = ARTEMIS_PATH + "/api/bforestfire/v1/alarms/judge/list";
|
||||
Map<String, Object> paramMap = new HashMap<>();// post请求Form表单参数
|
||||
paramMap.put("pageNo", pageNo);
|
||||
paramMap.put("pageSize", pageSize);
|
||||
if (!ObjectUtils.isEmpty(beginTime)) {
|
||||
paramMap.put("beginTime", DateUtils.toISOUtc8Time(beginTime));
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(endTime)) {
|
||||
paramMap.put("endTime", DateUtils.toISOUtc8Time(endTime));
|
||||
}
|
||||
String body = JSON.toJSON(paramMap).toString();
|
||||
Map<String, String> path = new HashMap<String, String>(2) {
|
||||
{
|
||||
put("https://", getCamsApi);
|
||||
}
|
||||
};
|
||||
String response = ArtemisHttpUtil.doPostStringArtemis(config, path, body, null, null, "application/json");
|
||||
|
||||
return toFireAlarmHistory(response);
|
||||
}
|
||||
|
||||
private HighObsResult<HighObsResult.Page<FireAlarmHistory>> toFireAlarmHistory(String json) {
|
||||
HighObsResult<HighObsResult.Page<FireAlarmHistory>> pageHighObsResult = JsonUtils.parseObject(json, new TypeReference<HighObsResult<HighObsResult.Page<FireAlarmHistory>>>() {
|
||||
});
|
||||
HighObsResult.Page<FireAlarmHistory> data = pageHighObsResult.getData();
|
||||
if (ObjectUtils.isNotEmpty(data)) {
|
||||
data.getList().forEach(fireAlarmHistory -> {
|
||||
String picUrls = fireAlarmHistory.getPicUrls();
|
||||
if (StringUtils.isNotEmpty(picUrls) && picUrls.contains(PIC_SPLIT_SYMBOL)) {
|
||||
String[] split = picUrls.split(PIC_SPLIT_SYMBOL);
|
||||
fireAlarmHistory.setVisPicUrl(picUrlPrefix + split[0]);
|
||||
fireAlarmHistory.setThermalPicUrl(picUrlPrefix + split[1]);
|
||||
}
|
||||
});
|
||||
}
|
||||
return pageHighObsResult;
|
||||
}
|
||||
|
||||
private List<HighObsPlayBack> getPlayBackEventList(List<FireAlarmHistory> fireAlarmHistories) {
|
||||
return fireAlarmHistories.stream()
|
||||
.filter(fireAlarmHistory -> StringUtils.isNotEmpty(fireAlarmHistory.getId()))
|
||||
.map(fireAlarmHistory -> {
|
||||
HighObsPlayBack highObsPlayBack = new HighObsPlayBack();
|
||||
highObsPlayBack.setCameraId(fireAlarmHistory.getCameraId());
|
||||
highObsPlayBack.setFireAlarmId(fireAlarmHistory.getId());
|
||||
Date startDate = fireAlarmHistory.getStartTime();
|
||||
LocalDateTime startTime = DateUtils.toLocalDateTime(startDate);
|
||||
if (ObjectUtils.isNotEmpty(startTime)) {
|
||||
LocalDateTime endTime = startTime.plusMinutes(1);
|
||||
HighObsResult<HighObsPlayBackRes> playBack = getPlayBack(highObsPlayBack.getCameraId(), startTime, endTime);
|
||||
HighObsPlayBackRes data = playBack.getData();
|
||||
if (ObjectUtils.isNotEmpty(data)) {
|
||||
highObsPlayBack.setUrl(data.getUrl());
|
||||
}
|
||||
highObsPlayBack.setStartTime(startTime);
|
||||
highObsPlayBack.setEndTime(endTime);
|
||||
}
|
||||
return highObsPlayBack;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public HighObsResult<HighObsPlayBackRes> getPlayBack(String cameraId, LocalDateTime beginTime, LocalDateTime endTime) {
|
||||
ArtemisConfig config = initConfig();
|
||||
final String getCamsApi = ARTEMIS_PATH + "/api/video/v2/cameras/playbackURLs";
|
||||
Map<String, Object> paramMap = new HashMap<>();// post请求Form表单参数
|
||||
paramMap.put("cameraIndexCode", cameraId);
|
||||
paramMap.put("beginTime", DateUtils.toISOUtc8Time(beginTime));
|
||||
paramMap.put("endTime", DateUtils.toISOUtc8Time(endTime));
|
||||
paramMap.put("protocol", "ws");
|
||||
String body = JSON.toJSON(paramMap).toString();
|
||||
Map<String, String> path = new HashMap<String, String>(2) {
|
||||
{
|
||||
put("https://", getCamsApi);
|
||||
}
|
||||
};
|
||||
String response = ArtemisHttpUtil.doPostStringArtemis(config, path, body, null, null, "application/json");
|
||||
|
||||
return JsonUtils.parseObject(response, new TypeReference<HighObsResult<HighObsPlayBackRes>>() {
|
||||
});
|
||||
}
|
||||
|
||||
private ArtemisConfig initConfig() {
|
||||
ArtemisConfig config = new ArtemisConfig();
|
||||
config.setHost(host); // 代理API网关nginx服务器ip端口
|
||||
config.setAppKey(appKey); // 秘钥appkey
|
||||
config.setAppSecret(appSecret);// 秘钥appSecret
|
||||
return config;
|
||||
}
|
||||
|
||||
|
||||
public String getPreviewUrls(String cameraIndexCode, String protocol) throws Exception {
|
||||
|
||||
ArtemisConfig config = initConfig();
|
||||
final String getCamsApi = ARTEMIS_PATH + "/api/vnsc/mls/v1/preview/openApi/getPreviewParam";
|
||||
Map<String, Object> paramMap = new HashMap<>();// post请求Form表单参数
|
||||
paramMap.put("indexCode", cameraIndexCode);
|
||||
paramMap.put("netZoneCode", "2");
|
||||
paramMap.put("transmode", 1);
|
||||
paramMap.put("streamType", 0);
|
||||
paramMap.put("protocol", protocol);
|
||||
//一小时有效期 单位秒
|
||||
paramMap.put("expireTime", 60 * 60);
|
||||
String body = JSON.toJSON(paramMap).toString();
|
||||
Map<String, String> path = new HashMap<String, String>(2) {
|
||||
{
|
||||
put("https://", getCamsApi);
|
||||
}
|
||||
};
|
||||
log.info("[High-OBS-getPreviewUrls-request]====>{}", body);
|
||||
return ArtemisHttpUtil.doPostStringArtemis(config, path, body, null, null, "application/json");
|
||||
}
|
||||
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public PageResult<VideoDeviceInfoVO> getVideoDevicePage(Integer pageNo, Integer pageSize) {
|
||||
String response = callPostApiGetCameraList(pageNo, pageSize);
|
||||
HighObsResult<HighObsResult.Page<CameraInfo>> result = JsonUtils.parseObject(response, new TypeReference<HighObsResult<HighObsResult.Page<CameraInfo>>>() {
|
||||
});
|
||||
HighObsResult.Page<CameraInfo> data = result.getData();
|
||||
List<VideoDeviceInfoVO> collect = data.getList().stream()
|
||||
.map(cameraInfo -> {
|
||||
VideoDeviceInfoVO<CameraInfo> videoDeviceInfoVO = new VideoDeviceInfoVO<>();
|
||||
videoDeviceInfoVO.setVideoDeviceCode(cameraInfo.getCameraIndexCode());
|
||||
videoDeviceInfoVO.setVideoDeviceName(cameraInfo.getCameraName());
|
||||
videoDeviceInfoVO.setLongitude(cameraInfo.getLongitude());
|
||||
videoDeviceInfoVO.setLatitude(cameraInfo.getLatitude());
|
||||
videoDeviceInfoVO.setData(cameraInfo);
|
||||
VideoDeviceInfoVO.Channel channel = new VideoDeviceInfoVO.Channel();
|
||||
channel.setChannelName(cameraInfo.getChannelTypeName());
|
||||
channel.setChannelNo(cameraInfo.getCameraIndexCode());
|
||||
channel.setOnline(cameraInfo.getStatus() == 1);
|
||||
videoDeviceInfoVO.setChannelList(Collections.singletonList(channel));
|
||||
return videoDeviceInfoVO;
|
||||
}).collect(Collectors.toList());
|
||||
return new PageResult<>(collect, data.getTotal());
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public String getLiveStream(String channelCode, String protocol) {
|
||||
|
||||
String previewUrlJson = getPreviewUrls(channelCode, protocol);
|
||||
JSONObject jsonObject = JSONObject.parseObject(previewUrlJson);
|
||||
String code = jsonObject.getString("code");
|
||||
log.info("[High-OBS-getLiveStream-response]====>{}", previewUrlJson);
|
||||
if ("0".equals(code)) {
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
if (ObjectUtils.isNotEmpty(data)) {
|
||||
return data.getString("url");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void syncFireHistories() {
|
||||
|
||||
Product product = initProduct();
|
||||
ThingsModel modelQuery = new ThingsModel();
|
||||
modelQuery.setProductId(product.getProductId());
|
||||
modelQuery.setIdentifier(BnhzConstant.VideoEvent.HIGH_OBS_FIRE_EVENT);
|
||||
ThingsModel eventModel = getThingsModelService().selectSingleThingsModel(modelQuery);
|
||||
ThingsModelQuery thingsModelQuery = new ThingsModelQuery();
|
||||
thingsModelQuery.setType(BnhzConstant.ModelType.EVENT);
|
||||
thingsModelQuery.setSize(1);
|
||||
thingsModelQuery.setProductId(product.getProductId());
|
||||
thingsModelQuery.setModelId(eventModel.getModelId());
|
||||
String confirmTimeField = FireAlarmHistory.Fields.confirmTime.toLowerCase();
|
||||
thingsModelQuery.setOrderField(confirmTimeField);
|
||||
|
||||
List<Map<String, Object>> responseList = getColumnModeOperationsService().query(thingsModelQuery);
|
||||
|
||||
//获取最近30天的数据
|
||||
LocalDateTime beginTime = LocalDateTime.now().minusDays(30);
|
||||
|
||||
//最新的确认时间
|
||||
LocalDateTime confirmTime = null;
|
||||
|
||||
//获取最新的一条数据
|
||||
if (!CollectionUtils.isEmpty(responseList)) {
|
||||
Map<String, Object> next = responseList.iterator().next();
|
||||
Object date = next.get(confirmTimeField);
|
||||
if (date instanceof Date) {
|
||||
confirmTime = DateUtils.toLocalDateTime((Date) date);
|
||||
}
|
||||
}
|
||||
int pageNo = 1;
|
||||
int pageSize = 500;
|
||||
boolean next;
|
||||
long batchNo = DateUtils.getTimestamp();
|
||||
do {
|
||||
HighObsResult<HighObsResult.Page<FireAlarmHistory>> fireAlarmHistories = getFireAlarmHistories(beginTime, null, pageNo, pageSize);
|
||||
List<FireAlarmHistory> list = fireAlarmHistories.getData().getList();
|
||||
List<FireAlarmHistory> newData = new ArrayList<>();
|
||||
for (FireAlarmHistory fireAlarmHistory : list) {
|
||||
LocalDateTime newDate = DateUtils.toLocalDateTime(fireAlarmHistory.getConfirmTime())
|
||||
.withNano(0);
|
||||
if (ObjectUtils.isEmpty(confirmTime) || confirmTime.withNano(0).isBefore(newDate)) {
|
||||
//兼容中台不能以id做为参数
|
||||
fireAlarmHistory.setAlarmId(fireAlarmHistory.getId());
|
||||
newData.add(fireAlarmHistory);
|
||||
}
|
||||
}
|
||||
getCommonService().saveEvent(newData, BnhzConstant.VideoEvent.HIGH_OBS_FIRE_EVENT, batchNo);
|
||||
List<HighObsPlayBack> playBackEventList = getPlayBackEventList(newData);
|
||||
getCommonService().saveEvent(playBackEventList, BnhzConstant.VideoEvent.HIGH_OBS_PLAY_BACK_EVENT, batchNo);
|
||||
next = PageUtils.hasNext(fireAlarmHistories.getData().getTotal(), pageNo, pageSize);
|
||||
pageNo++;
|
||||
} while (next);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 同步预警研判列表
|
||||
*/
|
||||
public void syncJudgeList() {
|
||||
|
||||
Product product = initProduct();
|
||||
ThingsModel modelQuery = new ThingsModel();
|
||||
modelQuery.setProductId(product.getProductId());
|
||||
modelQuery.setIdentifier(BnhzConstant.VideoEvent.HIGH_OBS_JUDGE_EVENT);
|
||||
ThingsModel eventModel = getThingsModelService().selectSingleThingsModel(modelQuery);
|
||||
ThingsModelQuery thingsModelQuery = new ThingsModelQuery();
|
||||
thingsModelQuery.setType(BnhzConstant.ModelType.EVENT);
|
||||
thingsModelQuery.setSize(1);
|
||||
thingsModelQuery.setProductId(product.getProductId());
|
||||
thingsModelQuery.setModelId(eventModel.getModelId());
|
||||
int pageNo = 1;
|
||||
int pageSize = 500;
|
||||
boolean next;
|
||||
long batchNo = DateUtils.getTimestamp();
|
||||
do {
|
||||
HighObsResult<HighObsResult.Page<FireAlarmHistory>> fireAlarmHistories = getJudgeList(null, null, pageNo, pageSize);
|
||||
List<FireAlarmHistory> list = fireAlarmHistories.getData().getList();
|
||||
list.forEach(fireAlarmHistory -> //兼容中台不能以id做为参数
|
||||
fireAlarmHistory.setAlarmId(fireAlarmHistory.getId()));
|
||||
getCommonService().saveEvent(list, BnhzConstant.VideoEvent.HIGH_OBS_JUDGE_EVENT, batchNo);
|
||||
List<HighObsPlayBack> playBackEventList = getPlayBackEventList(list);
|
||||
getCommonService().saveEvent(playBackEventList, BnhzConstant.VideoEvent.HIGH_OBS_PLAY_BACK_EVENT, batchNo);
|
||||
next = PageUtils.hasNext(fireAlarmHistories.getData().getTotal(), pageNo, pageSize);
|
||||
pageNo++;
|
||||
} while (next);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
String getTransport() {
|
||||
return BnhzConstant.TRANSPORT.HTTP_HIGH_OBS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProductName() {
|
||||
return "高空瞭望" + BnhzConstant.SUFFIX.HIGH_OBS;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,229 @@
|
|||
package com.bnhz.adapter.service.video.impl;
|
||||
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.bnhz.adapter.service.common.CommonService;
|
||||
import com.bnhz.common.constant.BnhzConstant;
|
||||
import com.bnhz.common.core.page.PageResult;
|
||||
import com.bnhz.common.core.redis.RedisCache;
|
||||
import com.bnhz.common.exception.ServiceException;
|
||||
import com.bnhz.common.utils.StringUtils;
|
||||
import com.bnhz.common.utils.json.JsonUtils;
|
||||
import com.bnhz.iot.model.ext.video.VideoDeviceInfoVO;
|
||||
import com.bnhz.iot.model.videoMonitor.VideoMonitorLiveStreamQuery;
|
||||
import com.bnhz.iot.model.videoMonitor.VideoMonitorPage;
|
||||
import com.bnhz.iot.model.videoMonitor.VideoMonitorPointVO;
|
||||
import com.bnhz.iot.model.videoMonitor.VideoMonitorResult;
|
||||
import com.bnhz.iot.service.IDeviceService;
|
||||
import com.bnhz.iot.service.IProductService;
|
||||
import com.bnhz.iot.service.IThingsModelService;
|
||||
import com.bnhz.iot.tdengine.service.IColumnModeOperationsService;
|
||||
import com.bnhz.mq.service.IDataHandler;
|
||||
import com.bnhz.sip.service.ISipDeviceChannelService;
|
||||
import com.bnhz.sip.service.ISipDeviceService;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.bnhz.common.constant.CacheConstants.HUAZHI_VIDEO_TOKEN;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/6/7 17:20
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("huaZhiVideoMonitorServiceImpl")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class HuaZhiVideoMonitorServiceImpl extends BaseVideoServiceImpl {
|
||||
|
||||
public HuaZhiVideoMonitorServiceImpl(IProductService productService, IDeviceService deviceService, IThingsModelService thingsModelService, IDataHandler dataHandler, IColumnModeOperationsService columnModeOperationsService, ISipDeviceService sipDeviceService, ISipDeviceChannelService sipDeviceChannelService, CommonService commonService, RedisCache redisCache) {
|
||||
super(productService, deviceService, thingsModelService, dataHandler, columnModeOperationsService, sipDeviceService, sipDeviceChannelService, commonService);
|
||||
this.redisCache = redisCache;
|
||||
}
|
||||
|
||||
@Value("${hua-zhi.url}")
|
||||
private String domain;
|
||||
|
||||
@Value("${hua-zhi.client_id}")
|
||||
private String clientId;
|
||||
|
||||
@Value("${hua-zhi.client_secret}")
|
||||
private String clientSecret;
|
||||
|
||||
@Value("${server.domain}")
|
||||
private String serverDomain;
|
||||
|
||||
private final RedisCache redisCache;
|
||||
|
||||
/**
|
||||
* 获取token请求路径
|
||||
*/
|
||||
private static String SSO_URL = "/sso/oauth2.0/accessToken";
|
||||
|
||||
/**
|
||||
* 获取设备列表请求路径
|
||||
*/
|
||||
private static String LIST_WITH_DEVICE_URL = "/api/bss/v1/udm/channel/list-with-device";
|
||||
|
||||
/**
|
||||
* 获取视频直播地址
|
||||
*/
|
||||
private static String LIVE_VIDEO_URL = "/api/vms/v2/webuas/live/stream/url";
|
||||
|
||||
|
||||
/**
|
||||
* 在线状态
|
||||
*/
|
||||
private static String ONLINE_STATE = "1";
|
||||
|
||||
|
||||
@Override
|
||||
public PageResult<VideoDeviceInfoVO> getVideoDevicePage(Integer pageNo, Integer pageSize) {
|
||||
|
||||
VideoMonitorResult<VideoMonitorPage<VideoMonitorPointVO>> videoMonitorPageVideoMonitorResult = listWithDevice(pageNo, pageSize);
|
||||
VideoMonitorPage<VideoMonitorPointVO> videoPage = videoMonitorPageVideoMonitorResult.getData();
|
||||
List<VideoMonitorPointVO> videoMonitorPointVOList = videoPage.getData();
|
||||
Map<String, List<VideoMonitorPointVO>> collect = videoMonitorPointVOList.stream()
|
||||
.collect(Collectors.groupingBy(VideoMonitorPointVO::getOwnerApsId));
|
||||
List<VideoDeviceInfoVO> videoDeviceList = collect.entrySet().stream()
|
||||
.map(entry -> {
|
||||
VideoDeviceInfoVO<VideoMonitorPointVO> videoDeviceInfoVO = new VideoDeviceInfoVO<>();
|
||||
videoDeviceInfoVO.setVideoDeviceCode(entry.getKey());
|
||||
VideoMonitorPointVO next = entry.getValue().iterator().next();
|
||||
videoDeviceInfoVO.setVideoDeviceCode(next.getDevApeId());
|
||||
videoDeviceInfoVO.setVideoDeviceName(next.getDevName());
|
||||
videoDeviceInfoVO.setLongitude(next.getLongitude());
|
||||
videoDeviceInfoVO.setLatitude(next.getLatitude());
|
||||
videoDeviceInfoVO.setData(next);
|
||||
List<VideoDeviceInfoVO.Channel> channels = entry.getValue().stream()
|
||||
.map(videoMonitorPointVO -> {
|
||||
VideoDeviceInfoVO.Channel channel = new VideoDeviceInfoVO.Channel();
|
||||
channel.setChannelNo(videoMonitorPointVO.getApeId());
|
||||
channel.setChannelName(videoMonitorPointVO.getName());
|
||||
channel.setOnline(ONLINE_STATE.equals(videoMonitorPointVO.getIsOnline()));
|
||||
return channel;
|
||||
}).collect(Collectors.toList());
|
||||
videoDeviceInfoVO.setChannelList(channels);
|
||||
return videoDeviceInfoVO;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return new PageResult<>(videoDeviceList, videoPage.getPaging().getTotalNum());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLiveStream(String channelCode, String protocol) {
|
||||
VideoMonitorLiveStreamQuery videoMonitorLiveStreamQuery = new VideoMonitorLiveStreamQuery();
|
||||
videoMonitorLiveStreamQuery.setChannelCode(channelCode);
|
||||
videoMonitorLiveStreamQuery.setStreamType(0);
|
||||
int streamMode = 3;
|
||||
if (BnhzConstant.VideoProtocol.RTSP.equals(protocol)) {
|
||||
streamMode = 1;
|
||||
}
|
||||
videoMonitorLiveStreamQuery.setStreamMode(streamMode);
|
||||
|
||||
return getLiveStream(videoMonitorLiveStreamQuery);
|
||||
}
|
||||
|
||||
|
||||
public VideoMonitorResult<VideoMonitorPage<VideoMonitorPointVO>> listWithDevice(Integer pageNo, Integer pageSize) {
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("page_no", pageNo);
|
||||
paramMap.put("page_size", pageSize);
|
||||
HttpResponse response = HttpUtil.createGet(domain + LIST_WITH_DEVICE_URL)
|
||||
.addHeaders(getHeader())
|
||||
.form(paramMap)
|
||||
.execute();
|
||||
String body = response.body();
|
||||
VideoMonitorResult<VideoMonitorPage<VideoMonitorPointVO>> videoMonitorResult = JsonUtils.parseObject(body, new TypeReference<VideoMonitorResult<VideoMonitorPage<VideoMonitorPointVO>>>() {
|
||||
});
|
||||
return videoMonitorResult;
|
||||
}
|
||||
|
||||
|
||||
public String getLiveStream(VideoMonitorLiveStreamQuery videoMonitorLiveStreamQuery) {
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("channel_code", videoMonitorLiveStreamQuery.getChannelCode());
|
||||
paramMap.put("stream_type", videoMonitorLiveStreamQuery.getStreamType());
|
||||
paramMap.put("stream_mode", videoMonitorLiveStreamQuery.getStreamMode());
|
||||
paramMap.put("visit_ip", StringUtils.pickIp(domain));
|
||||
HttpResponse response = HttpUtil.createGet(domain + LIVE_VIDEO_URL)
|
||||
.addHeaders(getHeader())
|
||||
.form(paramMap)
|
||||
.execute();
|
||||
String body = response.body();
|
||||
VideoMonitorResult<String> videoMonitorResult = JsonUtils.parseObject(body, VideoMonitorResult.class);
|
||||
return videoMonitorResult.getData();
|
||||
}
|
||||
|
||||
|
||||
private Map<String, String> getHeader() {
|
||||
|
||||
Map<String, String> headerMap = new HashMap<>();
|
||||
headerMap.put("Authorization", getToken());
|
||||
headerMap.put("User", "usercode:" + clientId);
|
||||
headerMap.put("Cookie", "usercode=" + clientId);
|
||||
headerMap.put("Content-Type", "application/json");
|
||||
return headerMap;
|
||||
}
|
||||
|
||||
private String getToken() {
|
||||
String token = redisCache.getCacheObject(HUAZHI_VIDEO_TOKEN);
|
||||
if (StringUtils.isNotEmpty(token)) {
|
||||
return token;
|
||||
}
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("grant_type", "client_credentials");
|
||||
paramMap.put("client_id", clientId);
|
||||
paramMap.put("client_secret", clientSecret);
|
||||
paramMap.put("format", "json");
|
||||
String response = HttpUtil.get(domain + SSO_URL, paramMap);
|
||||
|
||||
Token tokenData = JsonUtils.parseObject(response, Token.class);
|
||||
|
||||
if (ObjectUtils.isNotEmpty(tokenData)) {
|
||||
redisCache.setCacheObject(HUAZHI_VIDEO_TOKEN, tokenData.getAccessToken(), tokenData.getExpiresIn(), TimeUnit.SECONDS);
|
||||
return tokenData.getAccessToken();
|
||||
} else {
|
||||
log.error("[华智视频监控]获取登陆token失败,返回信息:{}", response);
|
||||
throw new ServiceException("[华智视频监控]获取登陆token失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
String getTransport() {
|
||||
return BnhzConstant.TRANSPORT.HTTP_HZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProductName() {
|
||||
return "华智监控" +BnhzConstant.SUFFIX.HZ;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Token {
|
||||
|
||||
@JsonProperty("access_token")
|
||||
private String accessToken;
|
||||
|
||||
@JsonProperty("tokenType")
|
||||
private String token_type;
|
||||
|
||||
@JsonProperty("expires_in")
|
||||
private Integer expiresIn;
|
||||
|
||||
@JsonProperty("refresh_token")
|
||||
private String refreshToken;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package com.bnhz.adapter.task;
|
||||
|
||||
import com.bnhz.adapter.service.fumes.IFumesService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/7/2 11:50
|
||||
*/
|
||||
@Profile("!test")
|
||||
@Slf4j
|
||||
@Component("SyncFumes")
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/sync/fumes")
|
||||
public class SyncFumesTask {
|
||||
|
||||
private final IFumesService fumesService;
|
||||
|
||||
@PutMapping("/device")
|
||||
public void syncDevice() {
|
||||
log.info("=============================Timer-餐饮油烟同步[设备]开始=============================");
|
||||
fumesService.syncDevice();
|
||||
log.info("=============================Timer-餐饮油烟同步[设备]完成=============================");
|
||||
}
|
||||
|
||||
@PutMapping("/alarm")
|
||||
public void synAlarmMsg() {
|
||||
log.info("=============================Timer-餐饮油烟同步[报警信息]开始=============================");
|
||||
fumesService.syncAlarmMsg();
|
||||
log.info("=============================Timer-餐饮油烟同步[报警信息]完成=============================");
|
||||
}
|
||||
|
||||
/**
|
||||
* 报警监测(一天一次)
|
||||
*/
|
||||
@PutMapping("/detector")
|
||||
public void syncDetector() {
|
||||
log.info("=============================Timer-餐饮油烟同步[报警监测]开始=============================");
|
||||
fumesService.syncDetector();
|
||||
log.info("=============================Timer-餐饮油烟同步[报警监测]完成=============================");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取十分钟数据(十分钟执行一次)
|
||||
*/
|
||||
@PutMapping("/tenData")
|
||||
public void syncTenData() {
|
||||
log.info("=============================Timer-餐饮油烟同步[十分钟数据]开始=============================");
|
||||
fumesService.syncTenData();
|
||||
log.info("=============================Timer-餐饮油烟同步[十分钟数据]完成=============================");
|
||||
}
|
||||
|
||||
/**
|
||||
* 五分钟执行一次
|
||||
*/
|
||||
@PutMapping("/oneData")
|
||||
public void syncOneData() {
|
||||
log.info("=============================Timer-餐饮油烟同步[一分钟数据]开始=============================");
|
||||
fumesService.syncOneData();
|
||||
log.info("=============================Timer-餐饮油烟同步[一分钟数据]完成=============================");
|
||||
|
||||
}
|
||||
|
||||
@PutMapping("/pointEvent")
|
||||
public void syncPointEvent() {
|
||||
log.info("=============================Timer-餐饮油烟同步[点位事件]开始=============================");
|
||||
fumesService.syncPointEvent();
|
||||
log.info("=============================Timer-餐饮油烟同步[点位事件]结束=============================");
|
||||
}
|
||||
|
||||
@PutMapping("/reduceEvent")
|
||||
public void syncReduceEvent() {
|
||||
log.info("=============================Timer-餐饮油烟同步[减排统计]开始=============================");
|
||||
fumesService.syncReduce();
|
||||
log.info("=============================Timer-餐饮油烟同步[减排统计]结束=============================");
|
||||
}
|
||||
@PutMapping("/realTimeData")
|
||||
public void syncRealData() {
|
||||
log.info("=============================Timer-餐饮油烟同步[实时数据]开始=============================");
|
||||
fumesService.syncRealTimeData();
|
||||
log.info("=============================Timer-餐饮油烟同步[实时数据]结束=============================");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
package com.bnhz.adapter.task;
|
||||
|
||||
import com.bnhz.adapter.service.video.impl.BaseVideoServiceImpl;
|
||||
import com.bnhz.adapter.service.video.impl.HighObsServiceImpl;
|
||||
import com.bnhz.framework.util.RedissonLockUtil;
|
||||
import com.bnhz.iot.service.base.SyncDevice;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 系统业务数据初始接口
|
||||
*
|
||||
* @author Leo
|
||||
* @date 2024/6/25 09:56
|
||||
*/
|
||||
@Profile("!test")
|
||||
@Slf4j
|
||||
@Component("SyncVideoDevice")
|
||||
@RequiredArgsConstructor
|
||||
public class SyncVideoDeviceTask {
|
||||
|
||||
private final BaseVideoServiceImpl huaZhiVideoMonitorServiceImpl;
|
||||
|
||||
private final HighObsServiceImpl highObsServiceImpl;
|
||||
|
||||
private final RedissonLockUtil redissonLockUtil;
|
||||
|
||||
|
||||
public void syncHuaZhiDevice() {
|
||||
log.info("=============================Timer-Start华智视频同步设备完成=============================");
|
||||
boolean lock = redissonLockUtil.tryLock("syncHuaZhiDevice", 60L);
|
||||
if (lock) {
|
||||
huaZhiVideoMonitorServiceImpl.syncDevice();
|
||||
} else {
|
||||
log.error("华智视频同步设备-已有任务在进行");
|
||||
}
|
||||
log.info("=============================Timer-End华智视频同步设备完成=============================");
|
||||
}
|
||||
|
||||
|
||||
public void syncHuZhiStream() {
|
||||
log.info("=============================Timer-Start华智视频同步视频流完成=============================");
|
||||
boolean lock = redissonLockUtil.tryLock("syncHuZhiStream", 60L);
|
||||
if (lock) {
|
||||
huaZhiVideoMonitorServiceImpl.syncLiveStream();
|
||||
} else {
|
||||
log.error("华智视频同步视频流-已有任务在进行");
|
||||
}
|
||||
|
||||
log.info("=============================Timer-End华智视频同步视频流完成=============================");
|
||||
}
|
||||
|
||||
|
||||
public void syncHighObsDevice() {
|
||||
log.info("=============================Timer-Start高空瞭望同步设备完成=============================");
|
||||
boolean lock = redissonLockUtil.tryLock("syncHighObsDevice", 60L);
|
||||
if (lock) {
|
||||
highObsServiceImpl.syncDevice();
|
||||
} else {
|
||||
log.error("高空瞭望同步设备-已有任务在进行");
|
||||
}
|
||||
|
||||
log.info("=============================Timer-End高空瞭望同步设备完成=============================");
|
||||
}
|
||||
|
||||
public void syncHighObsStream() {
|
||||
log.info("=============================Timer-Start高空瞭望同步视频流完成=============================");
|
||||
boolean lock = redissonLockUtil.tryLock("syncHighObsStream", 60L);
|
||||
if (lock) {
|
||||
highObsServiceImpl.syncLiveStream();
|
||||
} else {
|
||||
log.error("高空瞭望同步视频流-已有任务在进行");
|
||||
}
|
||||
|
||||
|
||||
log.info("=============================Timer-End高空瞭望同步视频流完成=============================");
|
||||
|
||||
}
|
||||
|
||||
public void syncHigObsFireHistories() {
|
||||
log.info("=============================Timer-Start高空瞭望同步历史火情列表=============================");
|
||||
boolean lock = redissonLockUtil.tryLock("syncHigObsFireHistories", 60L);
|
||||
if (lock) {
|
||||
highObsServiceImpl.syncFireHistories();
|
||||
} else {
|
||||
log.error("高空瞭望同步历史火情列表-已有任务在进行");
|
||||
}
|
||||
log.info("=============================Timer-End高空瞭望同步历史火情列表=============================");
|
||||
}
|
||||
|
||||
public void syncHigObsJudge() {
|
||||
log.info("=============================Timer-Start高空瞭望同步研判列表=============================");
|
||||
boolean lock = redissonLockUtil.tryLock("syncHigObsJudge", 60L);
|
||||
if (lock){
|
||||
highObsServiceImpl.syncJudgeList();
|
||||
}else {
|
||||
log.error("高空瞭望同步研判列表-已有任务在进行");
|
||||
}
|
||||
log.info("=============================Timer-End 高空瞭望同步研判列表=============================");
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,225 @@
|
|||
package com.bnhz.adapter.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bnhz.common.constant.BnhzConstant;
|
||||
import com.bnhz.common.core.thingsModel.ThingsModelSimpleItem;
|
||||
import com.bnhz.common.core.thingsModel.ThingsModelValuesInput;
|
||||
import com.bnhz.common.utils.DateUtils;
|
||||
import com.bnhz.common.utils.reflect.ReflectUtils;
|
||||
import com.bnhz.iot.domain.ThingsModel;
|
||||
import com.bnhz.iot.model.ThingsModelItem.Datatype;
|
||||
import com.bnhz.mq.model.ReportDataBo;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/6/28 11:33
|
||||
*/
|
||||
public class ThingsModelUtils {
|
||||
|
||||
|
||||
public static List<ThingsModel> toPropertyThingsModel(Map<String, ReflectUtils.FieldInfo> allFields, Long productId, String productName) {
|
||||
|
||||
//移除基础字段
|
||||
allFields.remove("id");
|
||||
allFields.remove("createTime");
|
||||
allFields.remove("updateTime");
|
||||
|
||||
return allFields.entrySet().stream()
|
||||
.filter(entry -> {
|
||||
ReflectUtils.FieldInfo value = entry.getValue();
|
||||
//只处理有备注的的属性
|
||||
return !ObjectUtils.isEmpty(value.getComment());
|
||||
})
|
||||
.map(entry -> {
|
||||
ThingsModel thingsModel = new ThingsModel();
|
||||
thingsModel.setIdentifier(entry.getKey());
|
||||
ReflectUtils.FieldInfo value = entry.getValue();
|
||||
String name = value.getType().getName();
|
||||
|
||||
thingsModel.setDatatype(toDataType(name));
|
||||
thingsModel.setProductId(productId);
|
||||
thingsModel.setProductName(productName);
|
||||
thingsModel.setType(BnhzConstant.ModelType.PROPERTY);
|
||||
thingsModel.setModelName(value.getComment());
|
||||
thingsModel.setIsChart(0);
|
||||
thingsModel.setIsMonitor(0);
|
||||
thingsModel.setIsHistory(1);
|
||||
thingsModel.setIsReadonly(0);
|
||||
thingsModel.setSpecs(toSpec(thingsModel.getDatatype(), value.getLength()));
|
||||
thingsModel.setTenantId(1L);
|
||||
thingsModel.setTenantName("System");
|
||||
return thingsModel;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
|
||||
public static ThingsModel toEventThingsModel(Map<String, ReflectUtils.FieldInfo> allFields, Long productId, String productName, String modelName, String identifier) {
|
||||
ThingsModel thingsModel = new ThingsModel();
|
||||
thingsModel.setIdentifier(identifier);
|
||||
thingsModel.setModelName(modelName);
|
||||
thingsModel.setProductId(productId);
|
||||
thingsModel.setProductName(productName);
|
||||
thingsModel.setType(BnhzConstant.ModelType.EVENT);
|
||||
thingsModel.setIsChart(0);
|
||||
thingsModel.setIsMonitor(0);
|
||||
thingsModel.setIsHistory(1);
|
||||
thingsModel.setIsReadonly(0);
|
||||
thingsModel.setTenantId(1L);
|
||||
thingsModel.setDatatype(BnhzConstant.DataType.TYPE_OBJECT);
|
||||
List<com.bnhz.iot.model.ThingsModelItem.ThingsModel> thingsModels = allFields.entrySet()
|
||||
.stream()
|
||||
.filter(entry -> {
|
||||
ReflectUtils.FieldInfo value = entry.getValue();
|
||||
//只处理有备注的的属性
|
||||
return !ObjectUtils.isEmpty(value.getComment());
|
||||
})
|
||||
.map(entry -> {
|
||||
com.bnhz.iot.model.ThingsModelItem.ThingsModel thingsModelInner = new com.bnhz.iot.model.ThingsModelItem.ThingsModel();
|
||||
thingsModelInner.setId(identifier + "_" + entry.getKey());
|
||||
ReflectUtils.FieldInfo value = entry.getValue();
|
||||
String name = value.getType().getName();
|
||||
String dataType = toDataType(name);
|
||||
thingsModelInner.setDatatype(genDatatype(dataType, value.getLength()));
|
||||
thingsModelInner.setType(BnhzConstant.ModelType.PROPERTY);
|
||||
thingsModelInner.setName(value.getComment());
|
||||
thingsModelInner.setIsChart(0);
|
||||
thingsModelInner.setIsMonitor(0);
|
||||
thingsModelInner.setIsHistory(1);
|
||||
thingsModelInner.setIsReadonly(0);
|
||||
return thingsModelInner;
|
||||
}).collect(Collectors.toList());
|
||||
Datatype datatype = new Datatype();
|
||||
datatype.setType("object");
|
||||
datatype.setParams(thingsModels);
|
||||
thingsModel.setSpecs(JSONObject.toJSONString(datatype));
|
||||
return thingsModel;
|
||||
}
|
||||
|
||||
public static ReportDataBo toPropertyReportDataBo(Map<String, ReflectUtils.FieldInfo> allFields, Long productId, String serialNumber) {
|
||||
ReportDataBo reportDataBo = new ReportDataBo();
|
||||
reportDataBo.setProductId(productId);
|
||||
reportDataBo.setSerialNumber(serialNumber);
|
||||
reportDataBo.setType(BnhzConstant.ModelType.PROPERTY);
|
||||
List<ThingsModelSimpleItem> thingsModelSimpleItemList = toThingsModelSimpleItemList(allFields);
|
||||
reportDataBo.setDataList(thingsModelSimpleItemList);
|
||||
ThingsModelValuesInput thingsModelValuesInput = new ThingsModelValuesInput();
|
||||
thingsModelValuesInput.setDataTime(LocalDateTime.now());
|
||||
thingsModelValuesInput.setType(BnhzConstant.ModelType.PROPERTY);
|
||||
thingsModelValuesInput.setThingsModelValueRemarkItem(thingsModelSimpleItemList);
|
||||
reportDataBo.setValuesInput(thingsModelValuesInput);
|
||||
reportDataBo.setRuleEngine(true);
|
||||
return reportDataBo;
|
||||
}
|
||||
|
||||
public static ReportDataBo toEventReportDataBo(Map<String, ReflectUtils.FieldInfo> allFields
|
||||
, Long productId
|
||||
, String serialNumber
|
||||
, Long modelId
|
||||
, LocalDateTime dateTime
|
||||
, Long deviceId
|
||||
, String topic
|
||||
, Long batchNo) {
|
||||
ReportDataBo reportDataBo = new ReportDataBo();
|
||||
reportDataBo.setProductId(productId);
|
||||
reportDataBo.setSerialNumber(serialNumber);
|
||||
reportDataBo.setType(BnhzConstant.ModelType.EVENT);
|
||||
List<ThingsModelSimpleItem> thingsModelSimpleItemList = toThingsModelSimpleItemList(allFields);
|
||||
reportDataBo.setDataList(thingsModelSimpleItemList);
|
||||
//reportDataBo.setMessage(JSONObject.toJSONString(thingsModelSimpleItemList));
|
||||
ThingsModelValuesInput thingsModelValuesInput = new ThingsModelValuesInput();
|
||||
thingsModelValuesInput.setModelId(modelId);
|
||||
thingsModelValuesInput.setProductId(productId);
|
||||
thingsModelValuesInput.setDeviceId(deviceId);
|
||||
thingsModelValuesInput.setDeviceNumber(serialNumber);
|
||||
if (ObjectUtils.isEmpty(dateTime)) {
|
||||
thingsModelValuesInput.setDataTime(LocalDateTime.now());
|
||||
} else {
|
||||
thingsModelValuesInput.setDataTime(dateTime);
|
||||
}
|
||||
|
||||
thingsModelValuesInput.setType(BnhzConstant.ModelType.EVENT);
|
||||
thingsModelValuesInput.setThingsModelValueRemarkItem(thingsModelSimpleItemList);
|
||||
thingsModelValuesInput.setTopic(topic);
|
||||
thingsModelValuesInput.setBatchNo(batchNo);
|
||||
reportDataBo.setValuesInput(thingsModelValuesInput);
|
||||
reportDataBo.setRuleEngine(true);
|
||||
return reportDataBo;
|
||||
}
|
||||
|
||||
private static List<ThingsModelSimpleItem> toThingsModelSimpleItemList(Map<String, ReflectUtils.FieldInfo> allFields) {
|
||||
Date now = new Date();
|
||||
return allFields.entrySet()
|
||||
.stream()
|
||||
.filter(entry -> {
|
||||
ReflectUtils.FieldInfo value = entry.getValue();
|
||||
//只处理有备注的的属性
|
||||
return !ObjectUtils.isEmpty(value.getComment());
|
||||
})
|
||||
.map(entry -> {
|
||||
ThingsModelSimpleItem thingsModelSimpleItem = new ThingsModelSimpleItem();
|
||||
thingsModelSimpleItem.setId(entry.getKey());
|
||||
Object value = entry.getValue().getValue();
|
||||
if (value instanceof Date) {
|
||||
thingsModelSimpleItem.setValue(DateUtils.dateTimeYYYYMDHMS((Date) value));
|
||||
} else if (value instanceof LocalDateTime) {
|
||||
thingsModelSimpleItem.setValue(DateUtils.toDateTimeStr((LocalDateTime) value));
|
||||
} else {
|
||||
thingsModelSimpleItem.setValue(ObjectUtils.isEmpty(value) ? null : String.valueOf(value));
|
||||
}
|
||||
|
||||
thingsModelSimpleItem.setTs(now);
|
||||
return thingsModelSimpleItem;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private static String toDataType(String typeName) {
|
||||
switch (typeName) {
|
||||
case "java.lang.String":
|
||||
return "string";
|
||||
case "java.math.BigDecimal":
|
||||
return "decimal";
|
||||
case "java.lang.Integer":
|
||||
case "int":
|
||||
return "integer";
|
||||
case "java.util.Date":
|
||||
return "date";
|
||||
case "boolean":
|
||||
return "bool";
|
||||
}
|
||||
return "string";
|
||||
}
|
||||
|
||||
private static String toSpec(String dataTypeStr, int length) {
|
||||
return JSONObject.toJSONString(genDatatype(dataTypeStr, length));
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static Datatype genDatatype(String dataTypeStr, int length) {
|
||||
Datatype dataType = new Datatype();
|
||||
dataType.setType(dataTypeStr);
|
||||
if ("integer".equals(dataTypeStr) || "decimal".equals(dataTypeStr)) {
|
||||
dataType.setMin(new BigDecimal(1));
|
||||
dataType.setMax(new BigDecimal(1000));
|
||||
}
|
||||
if ("string".equals(dataTypeStr)) {
|
||||
if (length > 0) {
|
||||
dataType.setMaxLength(length);
|
||||
} else {
|
||||
dataType.setMaxLength(60);
|
||||
}
|
||||
|
||||
}
|
||||
return dataType;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,161 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>daqi-back</artifactId>
|
||||
<groupId>com.bnhz</groupId>
|
||||
<version>3.8.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>bnhz-admin</artifactId>
|
||||
|
||||
<description>
|
||||
web服务入口
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- spring-boot-devtools -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||
</dependency>
|
||||
|
||||
<!-- swagger3-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 -->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql驱动包 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 核心模块-->
|
||||
<dependency>
|
||||
<groupId>com.bnhz</groupId>
|
||||
<artifactId>bnhz-framework</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 定时任务-->
|
||||
<dependency>
|
||||
<groupId>com.bnhz</groupId>
|
||||
<artifactId>bnhz-quartz</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 代码生成-->
|
||||
<dependency>
|
||||
<groupId>com.bnhz</groupId>
|
||||
<artifactId>bnhz-generator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.bnhz</groupId>
|
||||
<artifactId>bnhz-oss</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- controller API模块-->
|
||||
<dependency>
|
||||
<groupId>com.bnhz</groupId>
|
||||
<artifactId>bnhz-open-api</artifactId>
|
||||
</dependency>
|
||||
<!--服务集成启动模块-->
|
||||
<dependency>
|
||||
<groupId>com.bnhz</groupId>
|
||||
<artifactId>boot-strap</artifactId>
|
||||
</dependency>
|
||||
<!--网关集成启动模块-->
|
||||
<dependency>
|
||||
<groupId>com.bnhz</groupId>
|
||||
<artifactId>gateway-boot</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.bnhz</groupId>
|
||||
<artifactId>sip-server</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.bnhz</groupId>
|
||||
<artifactId>bnhz-3rd-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-core</artifactId>
|
||||
<version>2.11.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 通知配置模块 -->
|
||||
<dependency>
|
||||
<groupId>com.bnhz</groupId>
|
||||
<artifactId>bnhz-notify-web</artifactId>
|
||||
</dependency>
|
||||
<!-- 通知api模块 -->
|
||||
<dependency>
|
||||
<groupId>com.bnhz</groupId>
|
||||
<artifactId>bnhz-notify-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- oauth2.0 -->
|
||||
<dependency>
|
||||
<groupId>com.bnhz</groupId>
|
||||
<artifactId>bnhz-oauth</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.bnhz</groupId>
|
||||
<artifactId>bnhz-adapter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.1.1.RELEASE</version>
|
||||
<configuration>
|
||||
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<warName>${project.artifactId}</warName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,23 @@
|
|||
package com.bnhz;
|
||||
|
||||
import com.dtflys.forest.springboot.annotation.ForestScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.kafka.annotation.EnableKafka;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
@ForestScan(basePackages = "com.bnhz.api.client")
|
||||
@EnableKafka
|
||||
public class DaQiApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
SpringApplication.run(DaQiApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.bnhz;
|
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
|
||||
/**
|
||||
* web容器中进行部署
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class DaQiServletInitializer extends SpringBootServletInitializer
|
||||
{
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
|
||||
{
|
||||
return application.sources(DaQiApplication.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.bnhz.test.kafka;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.kafka.annotation.KafkaListener;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/7/19 18:01
|
||||
*/
|
||||
@Configuration
|
||||
public class KafkaConsumer {
|
||||
|
||||
// 指定要监听的 topic
|
||||
//@KafkaListener(topics = "DEVICE-REPORT-TOPIC")
|
||||
public void consumeTopic(String msg) {
|
||||
// 参数: 从topic中收到的 value值
|
||||
System.out.println("收到的信息: " + msg);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.bnhz.test.kafka;
|
||||
|
||||
import com.bnhz.adapter.model.blackcar.Point;
|
||||
import com.bnhz.common.annotation.Anonymous;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
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;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/7/19 18:03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/producer")
|
||||
public class ProducerController {
|
||||
|
||||
@Resource
|
||||
private KafkaTemplate<String, Object> kafka;
|
||||
|
||||
@PostMapping
|
||||
@Anonymous
|
||||
public String data(@RequestBody String msg) {
|
||||
|
||||
Point point = new Point();
|
||||
point.setBisId(123L);
|
||||
point.setDdjd(new BigDecimal("10.982"));
|
||||
point.setYxrq(new Date());
|
||||
|
||||
// 通过Kafka发出数据
|
||||
kafka.send("test", point);
|
||||
return "ok";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.bnhz.test.test;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
||||
import io.netty.util.ReferenceCountUtil;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/6/13 17:40
|
||||
*/
|
||||
|
||||
public class MyClientHandler extends ChannelInboundHandlerAdapter {
|
||||
public static String message;
|
||||
|
||||
public MyClientHandler() {
|
||||
}
|
||||
|
||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
try {
|
||||
ByteBuf byteBuf = (ByteBuf)msg;
|
||||
byte[] bytes = new byte[byteBuf.readableBytes()];
|
||||
byteBuf.readBytes(bytes);
|
||||
message = new String(bytes);
|
||||
MyClientNetty.countDownLatch.countDown();
|
||||
} finally {
|
||||
ReferenceCountUtil.release(msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
|
||||
System.err.println("客户端读取数据完毕");
|
||||
ctx.close();
|
||||
}
|
||||
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
System.err.println("client 读取数据出现异常");
|
||||
ctx.close();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package com.bnhz.test.test;
|
||||
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
public class MyClientNetty {
|
||||
public static CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
public static CountDownLatch countDownLatch2 = new CountDownLatch(1);
|
||||
private String ip;
|
||||
private int port;
|
||||
private static ChannelFuture cf;
|
||||
private static EventLoopGroup bossGroup;
|
||||
|
||||
public MyClientNetty(String ip, int port) {
|
||||
this.ip = ip;
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String sendRecv(String msg) {
|
||||
try {
|
||||
cf.channel().writeAndFlush(Unpooled.copiedBuffer(msg.getBytes()));
|
||||
MyClientNetty.countDownLatch.await();
|
||||
return MyClientHandler.message;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void connect() throws UnsupportedEncodingException, InterruptedException {
|
||||
this.action();
|
||||
countDownLatch2.await();
|
||||
}
|
||||
|
||||
public void close() throws InterruptedException {
|
||||
cf.channel().closeFuture().sync();
|
||||
bossGroup.shutdownGracefully();
|
||||
}
|
||||
|
||||
public void action() throws InterruptedException, UnsupportedEncodingException {
|
||||
bossGroup = new NioEventLoopGroup();
|
||||
final Bootstrap bs = new Bootstrap();
|
||||
|
||||
((Bootstrap) ((Bootstrap) ((Bootstrap) ((Bootstrap) bs.group(bossGroup)).channel(NioSocketChannel.class)).option(ChannelOption.SO_KEEPALIVE, true)).option(ChannelOption.RCVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(65535))).handler(new ChannelInitializer<SocketChannel>() {
|
||||
protected void initChannel(SocketChannel socketChannel) throws Exception {
|
||||
socketChannel.pipeline().addLast(new ChannelHandler[]{new MyClientHandler()});
|
||||
}
|
||||
});
|
||||
|
||||
(new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
MyClientNetty.cf = bs.connect(MyClientNetty.this.ip, MyClientNetty.this.port).sync();
|
||||
MyClientNetty.countDownLatch2.countDown();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
})).start();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
try {
|
||||
// MyClientNetty myClientNetty = new MyClientNetty("182.148.53.138",3312);
|
||||
// MyClientNetty myClientNetty = new MyClientNetty("127.0.0.1", 28888);
|
||||
MyClientNetty myClientNetty = new MyClientNetty("183.223.252.35", 28888);
|
||||
myClientNetty.connect();
|
||||
|
||||
//空气微站
|
||||
// String result = myClientNetty.sendRecv("##1103QN=20240709100001;ST=22;CN=2031;PW=22;MN=1440-0028-sclw-7280;Flag=5;CP=&&DataTime=20240822120000;LA-Min=0.0,LA-Avg=0.0,LA-Max=0.0,LA-Flag=N;a34002-Min=6.872,a34002-Avg=9.011,a34002-Max=66.66,a34002-Flag=N;a34004-Min=3.464,a34004-Avg=4.605,a34004-Max=6.678,a34004-Flag=N;a01007-Min=0.0,a01007-Avg=0.0,a01007-Max=0.0,a01007-Flag=N;a01008-Min=0.0,a01008-Avg=0.0,a01008-Max=0.0,a01008-Flag=N;a01006-Min=0.000,a01006-Avg=0.000,a01006-Max=0.000,a01006-Flag=N;a01001-Min=0.00,a01001-Avg=0.00,a01001-Max=0.00,a01001-Flag=N;a01002-Min=0.0,a01002-Avg=0.0,a01002-Max=0.0,a01002-Flag=N;a21026-Min=3.858,a21026-Avg=4.450,a21026-Max=4.976,a21026-Flag=N;a21004-Min=8.9989,a21004-Avg=7.842,a21004-Max=10.079,a21004-Flag=N;a21005-Min=0.293,a21005-Avg=0.377,a21005-Max=0.454,a21005-Flag=N;a21006-Min=34.468,a21006-Avg=42.000,a21006-Max=50.231,a21006-Flag=N;a31040-Min=0.000,a31040-Avg=0.000,a31040-Max=0.000,a31040-Flag=N;a19104-Min=0.000,a19104-Avg=0.000,a19104-Max=0.000,a19104-Flag=N;a19105-Min=0.000,a19105-Avg=0.000,a19105-Max=0.000,a19105-Flag=N;a19106-Min=0.000,a19106-Avg=0.000,a19106-Max=0.000,a19106-Flag=N&&81C1");
|
||||
//TVOC
|
||||
//String result = myClientNetty.sendRecv("##0948QN=20240826000010189;ST=22;CN=2031;PW=123456;MN=ZHKCEAMS2408060002;Flag=5;CP=&&DataTime=20240825000000;a34004-Avg=33.496,a34004-orignalRtd=0.000,a34004-Flag=N;a34002-Avg=35.499,a34002-orignalRtd=0.000,a34002-Flag=N;a21026-Avg=0.088,a21026-orignalRtd=21.973,a21026-Flag=N;a21005-Avg=0.000,a21005-orignalRtd=66.229,a21005-Flag=N;a21004-Avg=47.552,a21004-orignalRtd=51.611,a21004-Flag=N;a05024-Avg=138.814,a05024-orignalRtd=71.681,a05024-Flag=N;a24088-Avg=215.130,a24088-orignalRtd=78.448,a24088-Flag=N;a01001-Avg=1.000,a01001-orignalRtd=1.000,a01001-Flag=N;a21003-Avg=30.012,a21003-orignalRtd=0.000,a21003-Flag=N;a21002-Avg=29.969,a21002-orignalRtd=0.000,a21002-Flag=N;a01001-Avg=33.671,a01001-orignalRtd=0.000,a01001-Flag=D;a01002-Avg=54.172,a01002-orignalRtd=0.000,a01002-Flag=D;a01006-Avg=94.197,a01006-orignalRtd=0.000,a01006-Flag=D;a01007-Avg=1.350,a01007-orignalRtd=0.000,a01007-Flag=D;a01008-Avg=176.111,a01008-orignalRtd=0.000,a01008-Flag=D&&06C0");
|
||||
|
||||
//VOCs
|
||||
String result = myClientNetty.sendRecv("##1305QN=20240904154505299;ST=31;CN=2031;PW=123456;MN=12345678901234hl9999;Flag=5;CP=&&DataTime=20240901154400;a19001-Min=19.78,a19001-Max=19.8,a19001-Avg=19.784,a19001-Flag=N;a01012-Min=93,a01012-Max=93.47,a01012-Avg=93.168,a01012-Flag=N;a01013-Min=-0.112,a01013-Max=-0.104,a01013-Avg=-0.108,a01013-Flag=N;a01011-Min=17.58,a01011-Max=18.38,a01011-Avg=18.059,a01011-Flag=N;a01014-Min=0.66,a01014-Max=0.67,a01014-Avg=0.669,a01014-Flag=N;a00000-Min=13,a00000-Max=13.6,a00000-Avg=13.362,a00000-Cou=801.7,a00000-Flag=N;a05002-Min=0.735,a05002-Max=0.735,a05002-Avg=0.735,a05002-Cou=0.001,a05002-Flag=N;a24087-Min=74.05,a24087-Max=74.06,a24087-Avg=74.059,a24087-Cou=0.059,a24087-Flag=N;a24088-Min=73.31,a24088-Max=73.32,a24088-Avg=73.319,a24088-Cou=0.059,a24088-Flag=N;a25002-Min=8.76,a25002-Max=8.76,a25002-Avg=8.76,a25002-Cou=0.007,a25002-Flag=N;a25003-Min=1.16,a25003-Max=1.16,a25003-Avg=1.16,a25003-Cou=0.001,a25003-Flag=N;a25005-Min=0.16,a25005-Max=0.16,a25005-Avg=0.16,a25005-Cou=0,a25005-Flag=N;a01001-Min=36.3,a01001-Max=36.4,a01001-Avg=36.317,a01001-Flag=N;a01002-Min=45.6,a01002-Max=46.3,a01002-Avg=45.867,a01002-Flag=N;a01007-Min=0.9,a01007-Max=1.7,a01007-Avg=1.433,a01007-Flag=N;a01006-Min=93.98,a01006-Max=93.99,a01006-Avg=93.983,a01006-Flag=N;a01008-Min=189,a01008-Max=224,a01008-Avg=209.167,a01008-Flag=N&&3C00\n");
|
||||
// String result = myClientNetty.sendRecv("7e81ZHKCEAMS24080500017e");
|
||||
System.out.println("返回信息:" + result);
|
||||
|
||||
myClientNetty.close();
|
||||
|
||||
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
package com.bnhz.web.controller.common;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.annotation.Resource;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.FastByteArrayOutputStream;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.google.code.kaptcha.Producer;
|
||||
import com.bnhz.common.config.DaQiConfig;
|
||||
import com.bnhz.common.constant.CacheConstants;
|
||||
import com.bnhz.common.constant.Constants;
|
||||
import com.bnhz.common.core.domain.AjaxResult;
|
||||
import com.bnhz.common.core.redis.RedisCache;
|
||||
import com.bnhz.common.utils.sign.Base64;
|
||||
import com.bnhz.common.utils.uuid.IdUtils;
|
||||
import com.bnhz.system.service.ISysConfigService;
|
||||
|
||||
/**
|
||||
* 验证码操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "验证码操作")
|
||||
@RestController
|
||||
public class CaptchaController
|
||||
{
|
||||
@Resource(name = "captchaProducer")
|
||||
private Producer captchaProducer;
|
||||
|
||||
@Resource(name = "captchaProducerMath")
|
||||
private Producer captchaProducerMath;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
/**
|
||||
* 生成验证码
|
||||
*/
|
||||
@ApiOperation("获取验证码")
|
||||
@GetMapping("/captchaImage")
|
||||
public AjaxResult getCode(HttpServletResponse response) throws IOException
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
boolean captchaEnabled = configService.selectCaptchaEnabled();
|
||||
ajax.put("captchaEnabled", captchaEnabled);
|
||||
if (!captchaEnabled)
|
||||
{
|
||||
return ajax;
|
||||
}
|
||||
|
||||
// 保存验证码信息
|
||||
String uuid = IdUtils.simpleUUID();
|
||||
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
|
||||
|
||||
String capStr = null, code = null;
|
||||
BufferedImage image = null;
|
||||
|
||||
// 生成验证码
|
||||
String captchaType = DaQiConfig.getCaptchaType();
|
||||
if ("math".equals(captchaType))
|
||||
{
|
||||
String capText = captchaProducerMath.createText();
|
||||
capStr = capText.substring(0, capText.lastIndexOf("@"));
|
||||
code = capText.substring(capText.lastIndexOf("@") + 1);
|
||||
image = captchaProducerMath.createImage(capStr);
|
||||
}
|
||||
else if ("char".equals(captchaType))
|
||||
{
|
||||
capStr = code = captchaProducer.createText();
|
||||
image = captchaProducer.createImage(capStr);
|
||||
}
|
||||
|
||||
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
|
||||
// 转换流信息写出
|
||||
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
|
||||
try
|
||||
{
|
||||
ImageIO.write(image, "jpg", os);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
ajax.put("uuid", uuid);
|
||||
ajax.put("img", Base64.encode(os.toByteArray()));
|
||||
return ajax;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,171 @@
|
|||
package com.bnhz.web.controller.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.bnhz.common.config.DaQiConfig;
|
||||
import com.bnhz.common.constant.Constants;
|
||||
import com.bnhz.common.core.domain.AjaxResult;
|
||||
import com.bnhz.common.utils.StringUtils;
|
||||
import com.bnhz.common.utils.file.FileUploadUtils;
|
||||
import com.bnhz.common.utils.file.FileUtils;
|
||||
import com.bnhz.framework.config.ServerConfig;
|
||||
|
||||
/**
|
||||
* 通用请求处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "通用请求处理")
|
||||
@RestController
|
||||
@RequestMapping("/common")
|
||||
public class CommonController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
||||
|
||||
@Autowired
|
||||
private ServerConfig serverConfig;
|
||||
|
||||
private static final String FILE_DELIMETER = ",";
|
||||
|
||||
/**
|
||||
* 通用下载请求
|
||||
*
|
||||
* @param fileName 文件名称
|
||||
* @param delete 是否删除
|
||||
*/
|
||||
@ApiOperation("文件下载")
|
||||
@GetMapping("/download")
|
||||
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!FileUtils.checkAllowDownload(fileName))
|
||||
{
|
||||
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
||||
}
|
||||
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
||||
String filePath = DaQiConfig.getDownloadPath() + fileName;
|
||||
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
FileUtils.setAttachmentResponseHeader(response, realFileName);
|
||||
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||
if (delete)
|
||||
{
|
||||
FileUtils.deleteFile(filePath);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("下载文件失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用上传请求(单个)
|
||||
*/
|
||||
@ApiOperation("单个文件上传")
|
||||
@PostMapping("/upload")
|
||||
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = DaQiConfig.getUploadPath();
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("url", url);
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||
ajax.put("originalFilename", file.getOriginalFilename());
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用上传请求(多个)
|
||||
*/
|
||||
@ApiOperation("多个文件上传")
|
||||
@PostMapping("/uploads")
|
||||
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = DaQiConfig.getUploadPath();
|
||||
List<String> urls = new ArrayList<String>();
|
||||
List<String> fileNames = new ArrayList<String>();
|
||||
List<String> newFileNames = new ArrayList<String>();
|
||||
List<String> originalFilenames = new ArrayList<String>();
|
||||
for (MultipartFile file : files)
|
||||
{
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
urls.add(url);
|
||||
fileNames.add(fileName);
|
||||
newFileNames.add(FileUtils.getName(fileName));
|
||||
originalFilenames.add(file.getOriginalFilename());
|
||||
}
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
|
||||
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
|
||||
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
|
||||
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 本地资源通用下载
|
||||
*/
|
||||
@GetMapping("/download/resource")
|
||||
@ApiOperation("本地资源通用下载")
|
||||
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
||||
throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!FileUtils.checkAllowDownload(resource))
|
||||
{
|
||||
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
|
||||
}
|
||||
// 本地资源路径
|
||||
String localPath = DaQiConfig.getProfile();
|
||||
// 数据库资源地址
|
||||
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
|
||||
// 下载名称
|
||||
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
FileUtils.setAttachmentResponseHeader(response, downloadName);
|
||||
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("下载文件失败", e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
package com.bnhz.web.controller.monitor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisCallback;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bnhz.common.constant.CacheConstants;
|
||||
import com.bnhz.common.core.domain.AjaxResult;
|
||||
import com.bnhz.common.utils.StringUtils;
|
||||
import com.bnhz.system.domain.SysCache;
|
||||
|
||||
/**
|
||||
* 缓存监控
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "缓存监控")
|
||||
@RestController
|
||||
@RequestMapping("/monitor/cache")
|
||||
public class CacheController
|
||||
{
|
||||
@Autowired
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
private final static List<SysCache> caches = new ArrayList<SysCache>();
|
||||
{
|
||||
caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
|
||||
caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
|
||||
caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典"));
|
||||
caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码"));
|
||||
caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交"));
|
||||
caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理"));
|
||||
caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
|
||||
}
|
||||
|
||||
@ApiOperation("获取缓存信息")
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@GetMapping()
|
||||
public AjaxResult getInfo() throws Exception
|
||||
{
|
||||
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
|
||||
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
|
||||
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
|
||||
|
||||
Map<String, Object> result = new HashMap<>(3);
|
||||
result.put("info", info);
|
||||
result.put("dbSize", dbSize);
|
||||
|
||||
List<Map<String, String>> pieList = new ArrayList<>();
|
||||
commandStats.stringPropertyNames().forEach(key -> {
|
||||
Map<String, String> data = new HashMap<>(2);
|
||||
String property = commandStats.getProperty(key);
|
||||
data.put("name", StringUtils.removeStart(key, "cmdstat_"));
|
||||
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
|
||||
pieList.add(data);
|
||||
});
|
||||
result.put("commandStats", pieList);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
@ApiOperation("缓存列表")
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@GetMapping("/getNames")
|
||||
public AjaxResult cache()
|
||||
{
|
||||
return AjaxResult.success(caches);
|
||||
}
|
||||
|
||||
@ApiOperation("键名列表")
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@GetMapping("/getKeys/{cacheName}")
|
||||
public AjaxResult getCacheKeys(@PathVariable String cacheName)
|
||||
{
|
||||
Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
|
||||
return AjaxResult.success(cacheKeys);
|
||||
}
|
||||
|
||||
@ApiOperation("缓存内容")
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@GetMapping("/getValue/{cacheName}/{cacheKey}")
|
||||
public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
|
||||
{
|
||||
String cacheValue = redisTemplate.opsForValue().get(cacheKey);
|
||||
SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
|
||||
return AjaxResult.success(sysCache);
|
||||
}
|
||||
|
||||
@ApiOperation("清理缓存名称")
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:remove')")
|
||||
@DeleteMapping("/clearCacheName/{cacheName}")
|
||||
public AjaxResult clearCacheName(@PathVariable String cacheName)
|
||||
{
|
||||
Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
|
||||
redisTemplate.delete(cacheKeys);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("清理缓存键名")
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:remove')")
|
||||
@DeleteMapping("/clearCacheKey/{cacheKey}")
|
||||
public AjaxResult clearCacheKey(@PathVariable String cacheKey)
|
||||
{
|
||||
redisTemplate.delete(cacheKey);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("清理所有缓存内容")
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:remove')")
|
||||
@DeleteMapping("/clearCacheAll")
|
||||
public AjaxResult clearCacheAll()
|
||||
{
|
||||
Collection<String> cacheKeys = redisTemplate.keys("*");
|
||||
redisTemplate.delete(cacheKeys);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.bnhz.web.controller.monitor;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bnhz.common.core.domain.AjaxResult;
|
||||
import com.bnhz.framework.web.domain.Server;
|
||||
|
||||
/**
|
||||
* 服务器监控
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "服务器监控")
|
||||
@RestController
|
||||
@RequestMapping("/monitor/server")
|
||||
public class ServerController
|
||||
{
|
||||
@ApiOperation("获取服务器信息")
|
||||
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
|
||||
@GetMapping()
|
||||
public AjaxResult getInfo() throws Exception
|
||||
{
|
||||
Server server = new Server();
|
||||
server.copyTo();
|
||||
return AjaxResult.success(server);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package com.bnhz.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bnhz.common.annotation.Log;
|
||||
import com.bnhz.common.core.controller.BaseController;
|
||||
import com.bnhz.common.core.domain.AjaxResult;
|
||||
import com.bnhz.common.core.page.TableDataInfo;
|
||||
import com.bnhz.common.enums.BusinessType;
|
||||
import com.bnhz.common.utils.poi.ExcelUtil;
|
||||
import com.bnhz.framework.web.service.SysPasswordService;
|
||||
import com.bnhz.system.domain.SysLogininfor;
|
||||
import com.bnhz.system.service.ISysLogininforService;
|
||||
|
||||
/**
|
||||
* 系统访问记录
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "日志管理:登录日志")
|
||||
@RestController
|
||||
@RequestMapping("/monitor/logininfor")
|
||||
public class SysLogininforController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysLogininforService logininforService;
|
||||
|
||||
@Autowired
|
||||
private SysPasswordService passwordService;
|
||||
|
||||
@ApiOperation("获取列表登录信息")
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysLogininfor logininfor)
|
||||
{
|
||||
startPage();
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("导出登录日志列表")
|
||||
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysLogininfor logininfor)
|
||||
{
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
||||
util.exportExcel(response, list, "登录日志");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除登录日志")
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{infoIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] infoIds)
|
||||
{
|
||||
return toAjax(logininforService.deleteLogininforByIds(infoIds));
|
||||
}
|
||||
|
||||
@ApiOperation("清空登录日志信息")
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/clean")
|
||||
public AjaxResult clean()
|
||||
{
|
||||
logininforService.cleanLogininfor();
|
||||
return success();
|
||||
}
|
||||
|
||||
@ApiOperation("账户解锁")
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
|
||||
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/unlock/{userName}")
|
||||
public AjaxResult unlock(@PathVariable("userName") String userName)
|
||||
{
|
||||
passwordService.clearLoginRecordCache(userName);
|
||||
return success();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package com.bnhz.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bnhz.common.annotation.Log;
|
||||
import com.bnhz.common.core.controller.BaseController;
|
||||
import com.bnhz.common.core.domain.AjaxResult;
|
||||
import com.bnhz.common.core.page.TableDataInfo;
|
||||
import com.bnhz.common.enums.BusinessType;
|
||||
import com.bnhz.common.utils.poi.ExcelUtil;
|
||||
import com.bnhz.system.domain.SysOperLog;
|
||||
import com.bnhz.system.service.ISysOperLogService;
|
||||
|
||||
/**
|
||||
* 操作日志记录
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "日志管理:操作日志")
|
||||
@RestController
|
||||
@RequestMapping("/monitor/operlog")
|
||||
public class SysOperlogController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysOperLogService operLogService;
|
||||
|
||||
@ApiOperation("获取操作日志列表")
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysOperLog operLog)
|
||||
{
|
||||
startPage();
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("导出操作日志")
|
||||
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysOperLog operLog)
|
||||
{
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
||||
util.exportExcel(response, list, "操作日志");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除操作日志")
|
||||
@Log(title = "操作日志", businessType = BusinessType.DELETE)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||
@DeleteMapping("/{operIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] operIds)
|
||||
{
|
||||
return toAjax(operLogService.deleteOperLogByIds(operIds));
|
||||
}
|
||||
|
||||
@ApiOperation("清空操作日志")
|
||||
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||
@DeleteMapping("/clean")
|
||||
public AjaxResult clean()
|
||||
{
|
||||
operLogService.cleanOperLog();
|
||||
return success();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
package com.bnhz.web.controller.monitor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bnhz.common.annotation.Log;
|
||||
import com.bnhz.common.constant.CacheConstants;
|
||||
import com.bnhz.common.core.controller.BaseController;
|
||||
import com.bnhz.common.core.domain.AjaxResult;
|
||||
import com.bnhz.common.core.domain.model.LoginUser;
|
||||
import com.bnhz.common.core.page.TableDataInfo;
|
||||
import com.bnhz.common.core.redis.RedisCache;
|
||||
import com.bnhz.common.enums.BusinessType;
|
||||
import com.bnhz.common.utils.StringUtils;
|
||||
import com.bnhz.system.domain.SysUserOnline;
|
||||
import com.bnhz.system.service.ISysUserOnlineService;
|
||||
|
||||
/**
|
||||
* 在线用户监控
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "在线用户监控")
|
||||
@RestController
|
||||
@RequestMapping("/monitor/online")
|
||||
public class SysUserOnlineController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysUserOnlineService userOnlineService;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@ApiOperation("获取在线用户列表")
|
||||
@PreAuthorize("@ss.hasPermi('monitor:online:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(String ipaddr, String userName)
|
||||
{
|
||||
Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
|
||||
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
|
||||
for (String key : keys)
|
||||
{
|
||||
LoginUser user = redisCache.getCacheObject(key);
|
||||
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
|
||||
{
|
||||
if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername()))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
|
||||
}
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(ipaddr))
|
||||
{
|
||||
if (StringUtils.equals(ipaddr, user.getIpaddr()))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
|
||||
}
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
|
||||
{
|
||||
if (StringUtils.equals(userName, user.getUsername()))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
|
||||
}
|
||||
}
|
||||
Collections.reverse(userOnlineList);
|
||||
userOnlineList.removeAll(Collections.singleton(null));
|
||||
return getDataTable(userOnlineList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 强退用户
|
||||
*/
|
||||
@ApiOperation("强制退出在线用户")
|
||||
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
|
||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||
@DeleteMapping("/{tokenId}")
|
||||
public AjaxResult forceLogout(@PathVariable String tokenId)
|
||||
{
|
||||
redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
|
||||
return success();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,146 @@
|
|||
package com.bnhz.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bnhz.common.annotation.Log;
|
||||
import com.bnhz.common.constant.UserConstants;
|
||||
import com.bnhz.common.core.controller.BaseController;
|
||||
import com.bnhz.common.core.domain.AjaxResult;
|
||||
import com.bnhz.common.core.page.TableDataInfo;
|
||||
import com.bnhz.common.enums.BusinessType;
|
||||
import com.bnhz.common.utils.poi.ExcelUtil;
|
||||
import com.bnhz.system.domain.SysConfig;
|
||||
import com.bnhz.system.service.ISysConfigService;
|
||||
|
||||
/**
|
||||
* 参数配置 信息操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "参数设置")
|
||||
@RestController
|
||||
@RequestMapping("/system/config")
|
||||
public class SysConfigController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
/**
|
||||
* 获取参数配置列表
|
||||
*/
|
||||
@ApiOperation("获取参数配置列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:config:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysConfig config)
|
||||
{
|
||||
startPage();
|
||||
List<SysConfig> list = configService.selectConfigList(config);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("导出参数配置列表")
|
||||
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:config:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysConfig config)
|
||||
{
|
||||
List<SysConfig> list = configService.selectConfigList(config);
|
||||
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
||||
util.exportExcel(response, list, "参数数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数编号获取详细信息
|
||||
*/
|
||||
@ApiOperation("根据参数编号获取详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('system:config:query')")
|
||||
@GetMapping(value = "/{configId}")
|
||||
public AjaxResult getInfo(@PathVariable Long configId)
|
||||
{
|
||||
return success(configService.selectConfigById(configId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数键名查询参数值
|
||||
*/
|
||||
@ApiOperation("根据参数键名查询参数值")
|
||||
@GetMapping(value = "/configKey/{configKey}")
|
||||
public AjaxResult getConfigKey(@PathVariable String configKey)
|
||||
{
|
||||
return success(configService.selectConfigByKey(configKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增参数配置
|
||||
*/
|
||||
@ApiOperation("新增参数配置")
|
||||
@PreAuthorize("@ss.hasPermi('system:config:add')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysConfig config)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||
{
|
||||
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setCreateBy(getUsername());
|
||||
return toAjax(configService.insertConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改参数配置
|
||||
*/
|
||||
@ApiOperation("修改参数配置")
|
||||
@PreAuthorize("@ss.hasPermi('system:config:edit')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysConfig config)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||
{
|
||||
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setUpdateBy(getUsername());
|
||||
return toAjax(configService.updateConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除参数配置
|
||||
*/
|
||||
@ApiOperation("批量删除参数配置")
|
||||
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{configIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] configIds)
|
||||
{
|
||||
configService.deleteConfigByIds(configIds);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新参数缓存
|
||||
*/
|
||||
@ApiOperation("刷新参数缓存")
|
||||
@PreAuthorize("@ss.hasPermi('system:config:refresh')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/refreshCache")
|
||||
public AjaxResult refreshCache()
|
||||
{
|
||||
configService.resetConfigCache();
|
||||
return success();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,286 @@
|
|||
package com.bnhz.web.controller.system;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.bnhz.common.annotation.Log;
|
||||
import com.bnhz.common.constant.UserConstants;
|
||||
import com.bnhz.common.core.controller.BaseController;
|
||||
import com.bnhz.common.core.domain.AjaxResult;
|
||||
import com.bnhz.common.core.domain.entity.*;
|
||||
import com.bnhz.common.enums.BusinessType;
|
||||
import com.bnhz.common.exception.ServiceException;
|
||||
import com.bnhz.common.utils.StringUtils;
|
||||
import com.bnhz.iot.mapper.DeviceMapper;
|
||||
import com.bnhz.iot.model.RegisterUserInput;
|
||||
import com.bnhz.iot.model.RegisterUserOutput;
|
||||
import com.bnhz.iot.service.IToolService;
|
||||
import com.bnhz.system.domain.vo.SysDeptTypeVO;
|
||||
import com.bnhz.system.mapper.SysRoleDeptMapper;
|
||||
import com.bnhz.system.service.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 机构信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "机构管理")
|
||||
@RestController
|
||||
@RequestMapping("/system/dept")
|
||||
public class SysDeptController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
@Resource
|
||||
private IToolService toolService;
|
||||
|
||||
@Resource
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@Resource
|
||||
private SysRoleDeptMapper sysRoleDeptMapper;
|
||||
|
||||
@Resource
|
||||
private ISysDictDataService sysDictDataService;
|
||||
|
||||
@Resource
|
||||
private ISysRoleService sysRoleService;
|
||||
|
||||
@Resource
|
||||
private ISysMenuService sysMenuService;
|
||||
|
||||
@Resource
|
||||
private DeviceMapper deviceMapper;
|
||||
|
||||
/**
|
||||
* 获取机构列表
|
||||
*/
|
||||
@ApiOperation("获取机构列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SysDept dept)
|
||||
{
|
||||
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||
return success(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询机构列表(排除节点)
|
||||
*/
|
||||
@ApiOperation("查询机构列表(排除节点)")
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||
@GetMapping("/list/exclude/{deptId}")
|
||||
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
|
||||
{
|
||||
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
||||
depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
|
||||
return success(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据机构编号获取详细信息
|
||||
*/
|
||||
@ApiOperation("根据机构编号获取详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:query')")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@GetMapping(value = "/{deptId}")
|
||||
public AjaxResult getInfo(@PathVariable Long deptId)
|
||||
{
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
SysDept sysDept = deptService.selectDeptById(deptId);
|
||||
if (null != sysDept && null != sysDept.getDeptUserId()) {
|
||||
SysUser sysUser = sysUserService.selectUserById(sysDept.getDeptUserId());
|
||||
sysDept.setUserName(sysUser.getUserName());
|
||||
sysDept.setPhone(sysUser.getPhonenumber());
|
||||
}
|
||||
return success(sysDept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增机构
|
||||
*/
|
||||
@ApiOperation("新增机构")
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:add')")
|
||||
@Log(title = "机构管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDept dept)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||
{
|
||||
return error("新增机构'" + dept.getDeptName() + "'失败,机构名称已存在");
|
||||
}
|
||||
dept.setCreateBy(getUsername());
|
||||
// 校验系统账号信息
|
||||
if (StringUtils.isNotEmpty(dept.getUserName())) {
|
||||
SysUser sysUser = sysUserService.selectUserByUserName(dept.getUserName());
|
||||
if (ObjectUtil.isNotNull(sysUser)) {
|
||||
throw new ServiceException("系统账号名称已存在,请修改后重试");
|
||||
}
|
||||
if (!dept.getPassword().equals(dept.getConfirmPassword())) {
|
||||
throw new ServiceException("两次密码不一致,请重新输入");
|
||||
}
|
||||
}
|
||||
int result = deptService.insertDept(dept);
|
||||
// 新增机构关联系统账号
|
||||
if (result > 0) {
|
||||
// 添加管理员角色,给所有权限
|
||||
// 查询所有权限
|
||||
// List<SysMenu> sysMenuList = sysMenuService.selectMenuList(new SysMenu(), 1L);
|
||||
SysDept sysDept = deptService.selectDeptById(dept.getParentId());
|
||||
List<SysMenu> sysMenuList = sysMenuService.selectMenuList(new SysMenu(), sysDept.getDeptUserId());
|
||||
Long[] menuIdList = sysMenuList.stream().map(SysMenu::getMenuId).toArray(Long[]::new);
|
||||
SysRole sysRole = new SysRole();
|
||||
sysRole.setRoleName("管理员");
|
||||
sysRole.setRoleKey("manager");
|
||||
sysRole.setRoleSort(1);
|
||||
sysRole.setStatus("0");
|
||||
sysRole.setDeptId(dept.getDeptId());
|
||||
sysRole.setMenuIds(menuIdList);
|
||||
sysRoleService.insertRole(sysRole);
|
||||
|
||||
// 注册机构管理员用户
|
||||
RegisterUserInput registerUserInput = new RegisterUserInput();
|
||||
registerUserInput.setUsername(dept.getUserName());
|
||||
registerUserInput.setPassword(dept.getPassword());
|
||||
registerUserInput.setPhonenumber(dept.getPhone());
|
||||
registerUserInput.setDeptId(dept.getDeptId());
|
||||
registerUserInput.setRoleIds(new Long[]{sysRole.getRoleId()});
|
||||
RegisterUserOutput registerUserOutput = toolService.registerNoCaptcha(registerUserInput);
|
||||
if (StringUtils.isNotEmpty(registerUserOutput.getMsg())) {
|
||||
deptService.deleteDeptById(dept.getDeptId());
|
||||
sysRoleService.deleteRoleById(sysRole.getRoleId());
|
||||
return AjaxResult.error(registerUserOutput.getMsg());
|
||||
}
|
||||
// 更新机构管理员角色绑定信息
|
||||
deptService.updateDeptUserId(dept.getDeptId(), registerUserOutput.getSysUserId());
|
||||
}
|
||||
return toAjax(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改机构
|
||||
*/
|
||||
@ApiOperation("修改机构")
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
|
||||
@Log(title = "机构管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysDept dept)
|
||||
{
|
||||
Long deptId = dept.getDeptId();
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||
{
|
||||
return error("修改机构'" + dept.getDeptName() + "'失败,机构名称已存在");
|
||||
}
|
||||
else if (dept.getParentId().equals(deptId))
|
||||
{
|
||||
return error("修改机构'" + dept.getDeptName() + "'失败,上级机构不能是自己");
|
||||
}
|
||||
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
|
||||
{
|
||||
return error("该机构包含未停用的子机构!");
|
||||
}
|
||||
dept.setUpdateBy(getUsername());
|
||||
return toAjax(deptService.updateDept(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除机构
|
||||
*/
|
||||
@ApiOperation("根据机构编号删除机构")
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
||||
@Log(title = "机构管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{deptId}")
|
||||
public AjaxResult remove(@PathVariable Long deptId)
|
||||
{
|
||||
if (deptService.hasChildByDeptId(deptId))
|
||||
{
|
||||
return warn("存在下级机构,不允许删除");
|
||||
}
|
||||
// if (deptService.checkDeptExistUser(deptId))
|
||||
// {
|
||||
// return warn("机构存在用户,不允许删除");
|
||||
// }
|
||||
// 有设备不允许删除
|
||||
SysDept sysDept = deptService.selectDeptById(deptId);
|
||||
int deviceCount = deviceMapper.countByTenantId(sysDept.getDeptUserId());
|
||||
if (deviceCount > 0) {
|
||||
return warn("请先把该机构设备回收或删除后重试!");
|
||||
}
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
// 删除机构绑定角色和用户
|
||||
List<Long> roleIdList = sysRoleDeptMapper.selectByDeptId(deptId);
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(roleIdList)) {
|
||||
sysRoleService.deleteRoleByIds(roleIdList.toArray(new Long[roleIdList.size()]));
|
||||
sysUserService.deleteUserByDeptID(deptId);
|
||||
}
|
||||
return toAjax(deptService.deleteDeptById(deptId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机构类型
|
||||
* @param deptType 父级类型
|
||||
* @return com.bnhz.common.core.domain.AjaxResult
|
||||
*/
|
||||
@GetMapping("/getDeptType")
|
||||
public AjaxResult getDeptType(Integer deptType, Boolean showOwner) {
|
||||
SysDictData sysDictData = new SysDictData();
|
||||
sysDictData.setDictType("department_type");
|
||||
List<SysDictData> sysDictDataList = sysDictDataService.selectDictDataList(sysDictData);
|
||||
if (CollectionUtils.isEmpty(sysDictDataList)) {
|
||||
return success();
|
||||
}
|
||||
List<SysDeptTypeVO> result = new ArrayList<>();
|
||||
for (SysDictData dictData : sysDictDataList) {
|
||||
SysDeptTypeVO sysDeptTypeVO = new SysDeptTypeVO();
|
||||
sysDeptTypeVO.setDeptType(Integer.valueOf(dictData.getDictValue()));
|
||||
sysDeptTypeVO.setDeptTypeName(dictData.getDictLabel());
|
||||
sysDeptTypeVO.setAncestors(dictData.getRemark());
|
||||
result.add(sysDeptTypeVO);
|
||||
}
|
||||
if (null == deptType) {
|
||||
return success(result);
|
||||
}
|
||||
SysDeptTypeVO sysDeptTypeVO = result.stream().filter(d -> deptType.equals(d.getDeptType())).findFirst().orElse(null);
|
||||
if (ObjectUtil.isNull(sysDeptTypeVO)) {
|
||||
return success(new ArrayList<>());
|
||||
}
|
||||
String ancestors = sysDeptTypeVO.getAncestors();
|
||||
result = result.stream().filter(d -> ancestors.contains(d.getDeptType().toString())).collect(Collectors.toList());
|
||||
if (showOwner) {
|
||||
List<SysDeptTypeVO> newResult = new ArrayList<>();
|
||||
newResult.add(sysDeptTypeVO);
|
||||
newResult.addAll(result);
|
||||
return success(newResult);
|
||||
}
|
||||
return success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机构角色
|
||||
* @param deptId 机构id
|
||||
* @return com.bnhz.common.core.domain.AjaxResult
|
||||
*/
|
||||
@GetMapping("/getRole")
|
||||
public AjaxResult getRole(Long deptId) {
|
||||
AjaxResult success = AjaxResult.success();
|
||||
List<SysRole> sysRoleList = deptService.getRole(deptId);
|
||||
success.put("roles", sysRoleList);
|
||||
success.put("roleIds", sysRoleList.stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
||||
return success;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
package com.bnhz.web.controller.system;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bnhz.common.annotation.Log;
|
||||
import com.bnhz.common.core.controller.BaseController;
|
||||
import com.bnhz.common.core.domain.AjaxResult;
|
||||
import com.bnhz.common.core.domain.entity.SysDictData;
|
||||
import com.bnhz.common.core.page.TableDataInfo;
|
||||
import com.bnhz.common.enums.BusinessType;
|
||||
import com.bnhz.common.utils.StringUtils;
|
||||
import com.bnhz.common.utils.poi.ExcelUtil;
|
||||
import com.bnhz.system.service.ISysDictDataService;
|
||||
import com.bnhz.system.service.ISysDictTypeService;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/dict/data")
|
||||
public class SysDictDataController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysDictDataService dictDataService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysDictData dictData)
|
||||
{
|
||||
startPage();
|
||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysDictData dictData)
|
||||
{
|
||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
||||
util.exportExcel(response, list, "字典数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典数据详细
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
@GetMapping(value = "/{dictCode}")
|
||||
public AjaxResult getInfo(@PathVariable Long dictCode)
|
||||
{
|
||||
return success(dictDataService.selectDictDataById(dictCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据信息
|
||||
*/
|
||||
@GetMapping(value = "/type/{dictType}")
|
||||
public AjaxResult dictType(@PathVariable String dictType)
|
||||
{
|
||||
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
|
||||
if (StringUtils.isNull(data))
|
||||
{
|
||||
data = new ArrayList<SysDictData>();
|
||||
}
|
||||
return success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDictData dict)
|
||||
{
|
||||
dict.setCreateBy(getUsername());
|
||||
return toAjax(dictDataService.insertDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysDictData dict)
|
||||
{
|
||||
dict.setUpdateBy(getUsername());
|
||||
return toAjax(dictDataService.updateDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictCodes}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictCodes)
|
||||
{
|
||||
dictDataService.deleteDictDataByIds(dictCodes);
|
||||
return success();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
package com.bnhz.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bnhz.common.annotation.Log;
|
||||
import com.bnhz.common.constant.UserConstants;
|
||||
import com.bnhz.common.core.controller.BaseController;
|
||||
import com.bnhz.common.core.domain.AjaxResult;
|
||||
import com.bnhz.common.core.domain.entity.SysDictType;
|
||||
import com.bnhz.common.core.page.TableDataInfo;
|
||||
import com.bnhz.common.enums.BusinessType;
|
||||
import com.bnhz.common.utils.poi.ExcelUtil;
|
||||
import com.bnhz.system.service.ISysDictTypeService;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "字典管理")
|
||||
@RestController
|
||||
@RequestMapping("/system/dict/type")
|
||||
public class SysDictTypeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
@ApiOperation("获取字典分页列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysDictType dictType)
|
||||
{
|
||||
startPage();
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("导出字典列表")
|
||||
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysDictType dictType)
|
||||
{
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
||||
util.exportExcel(response, list, "字典类型");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典类型详细
|
||||
*/
|
||||
@ApiOperation("查询字典类型详细")
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
@GetMapping(value = "/{dictId}")
|
||||
public AjaxResult getInfo(@PathVariable Long dictId)
|
||||
{
|
||||
return success(dictTypeService.selectDictTypeById(dictId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@ApiOperation("新增字典类型")
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDictType dict)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||
{
|
||||
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setCreateBy(getUsername());
|
||||
return toAjax(dictTypeService.insertDictType(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*/
|
||||
@ApiOperation("新增字典类型")
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysDictType dict)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||
{
|
||||
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setUpdateBy(getUsername());
|
||||
return toAjax(dictTypeService.updateDictType(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*/
|
||||
@ApiOperation("删除字典类型")
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictIds)
|
||||
{
|
||||
dictTypeService.deleteDictTypeByIds(dictIds);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新字典缓存
|
||||
*/
|
||||
@ApiOperation("刷新字典缓存")
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:refresh')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/refreshCache")
|
||||
public AjaxResult refreshCache()
|
||||
{
|
||||
dictTypeService.resetDictCache();
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典选择框列表
|
||||
*/
|
||||
@ApiOperation("获取字典选择框列表")
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
||||
return success(dictTypes);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.bnhz.web.controller.system;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bnhz.common.config.DaQiConfig;
|
||||
import com.bnhz.common.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 首页
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
public class SysIndexController
|
||||
{
|
||||
/** 系统基础配置 */
|
||||
@Autowired
|
||||
private DaQiConfig daQiConfig;
|
||||
|
||||
/**
|
||||
* 访问首页,提示语
|
||||
*/
|
||||
@RequestMapping("/")
|
||||
public String index()
|
||||
{
|
||||
return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", daQiConfig.getName(), daQiConfig.getVersion());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
package com.bnhz.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bnhz.common.constant.Constants;
|
||||
import com.bnhz.common.core.domain.AjaxResult;
|
||||
import com.bnhz.common.core.domain.entity.SysMenu;
|
||||
import com.bnhz.common.core.domain.entity.SysUser;
|
||||
import com.bnhz.common.core.domain.model.LoginBody;
|
||||
import com.bnhz.common.utils.SecurityUtils;
|
||||
import com.bnhz.framework.web.service.SysLoginService;
|
||||
import com.bnhz.framework.web.service.SysPermissionService;
|
||||
import com.bnhz.system.service.ISysMenuService;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "登录验证")
|
||||
@RestController
|
||||
public class SysLoginController
|
||||
{
|
||||
@Autowired
|
||||
private SysLoginService loginService;
|
||||
|
||||
@Autowired
|
||||
private ISysMenuService menuService;
|
||||
|
||||
@Autowired
|
||||
private SysPermissionService permissionService;
|
||||
@Value("${server.broker.enabled}")
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
* @param loginBody 登录信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ApiOperation("用户登录")
|
||||
@PostMapping("/login")
|
||||
public AjaxResult login(@RequestBody LoginBody loginBody)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
// 生成令牌
|
||||
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
||||
loginBody.getUuid(), loginBody.getSourceType());
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return ajax;
|
||||
}
|
||||
@ApiOperation("卡口用户登录")
|
||||
@PostMapping("/KC/login")
|
||||
public AjaxResult kaCheckUserLogin(@RequestBody LoginBody loginBody)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
// 生成令牌
|
||||
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
||||
loginBody.getUuid(), loginBody.getSourceType());
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@ApiOperation("获取用户信息")
|
||||
@GetMapping("getInfo")
|
||||
public AjaxResult getInfo()
|
||||
{
|
||||
SysUser user = SecurityUtils.getLoginUser().getUser();
|
||||
// 角色集合
|
||||
Set<String> roles = permissionService.getRolePermission(user);
|
||||
// 权限集合
|
||||
Set<String> permissions = permissionService.getMenuPermission(user);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("user", user);
|
||||
ajax.put("roles", roles);
|
||||
ajax.put("permissions", permissions);
|
||||
ajax.put("mqtt",enabled);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取路由信息
|
||||
*
|
||||
* @return 路由信息
|
||||
*/
|
||||
@ApiOperation("获取路由信息")
|
||||
@GetMapping("getRouters")
|
||||
public AjaxResult getRouters()
|
||||
{
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
|
||||
return AjaxResult.success(menuService.buildMenus(menus));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,158 @@
|
|||
package com.bnhz.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.bnhz.common.annotation.Log;
|
||||
import com.bnhz.common.constant.UserConstants;
|
||||
import com.bnhz.common.core.controller.BaseController;
|
||||
import com.bnhz.common.core.domain.AjaxResult;
|
||||
import com.bnhz.common.core.domain.entity.SysMenu;
|
||||
import com.bnhz.common.enums.BusinessType;
|
||||
import com.bnhz.common.utils.StringUtils;
|
||||
import com.bnhz.system.service.ISysMenuService;
|
||||
|
||||
/**
|
||||
* 菜单信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "菜单管理")
|
||||
@RestController
|
||||
@RequestMapping("/system/menu")
|
||||
public class SysMenuController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysMenuService menuService;
|
||||
|
||||
/**
|
||||
* 获取菜单列表
|
||||
*/
|
||||
@ApiOperation("获取菜单列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SysMenu menu)
|
||||
{
|
||||
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||
return success(menus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据菜单编号获取详细信息
|
||||
*/
|
||||
@ApiOperation("根据菜单编号获取详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:query')")
|
||||
@GetMapping(value = "/{menuId}")
|
||||
public AjaxResult getInfo(@PathVariable Long menuId)
|
||||
{
|
||||
return success(menuService.selectMenuById(menuId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单下拉树列表
|
||||
*/
|
||||
@ApiOperation("获取菜单下拉树列表")
|
||||
@GetMapping("/treeselect")
|
||||
public AjaxResult treeselect(SysMenu menu)
|
||||
{
|
||||
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||
return success(menuService.buildMenuTreeSelect(menus));
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载对应角色菜单列表树
|
||||
*/
|
||||
@ApiOperation("加载对应角色菜单列表树")
|
||||
@GetMapping(value = "/roleMenuTreeselect")
|
||||
public AjaxResult roleMenuTreeselect(@RequestParam Long roleId, @RequestParam Long deptId)
|
||||
{
|
||||
List<SysMenu> menus = menuService.deptRoleMenuTreeselect(deptId, roleId);
|
||||
// List<SysMenu> menus = menuService.selectMenuList(getUserId());
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
|
||||
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增菜单
|
||||
*/
|
||||
@ApiOperation("新增菜单")
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:add')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysMenu menu)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
||||
{
|
||||
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
}
|
||||
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
||||
{
|
||||
return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
}
|
||||
menu.setCreateBy(getUsername());
|
||||
return toAjax(menuService.insertMenu(menu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单
|
||||
*/
|
||||
@ApiOperation("修改菜单")
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:edit')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysMenu menu)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
||||
{
|
||||
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
}
|
||||
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
||||
{
|
||||
return error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
}
|
||||
else if (menu.getMenuId().equals(menu.getParentId()))
|
||||
{
|
||||
return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
||||
}
|
||||
menu.setUpdateBy(getUsername());
|
||||
return toAjax(menuService.updateMenu(menu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
*/
|
||||
@ApiOperation("删除菜单")
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:remove')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{menuId}")
|
||||
public AjaxResult remove(@PathVariable("menuId") Long menuId)
|
||||
{
|
||||
if (menuService.hasChildByMenuId(menuId))
|
||||
{
|
||||
return warn("存在子菜单,不允许删除");
|
||||
}
|
||||
if (menuService.checkMenuExistRole(menuId))
|
||||
{
|
||||
return warn("菜单已分配,不允许删除");
|
||||
}
|
||||
return toAjax(menuService.deleteMenuById(menuId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载对应部门菜单列表树
|
||||
*/
|
||||
@ApiOperation("加载对应部门菜单列表树")
|
||||
@GetMapping(value = "/deptMenuTreeselect/{deptId}")
|
||||
public AjaxResult deptMenuTreeselect(@PathVariable("deptId") Long deptId)
|
||||
{
|
||||
List<SysMenu> menus = menuService.deptMenuTreeselect(deptId);
|
||||
return success(menuService.buildMenuTreeSelect(menus));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package com.bnhz.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bnhz.common.annotation.Log;
|
||||
import com.bnhz.common.core.controller.BaseController;
|
||||
import com.bnhz.common.core.domain.AjaxResult;
|
||||
import com.bnhz.common.core.page.TableDataInfo;
|
||||
import com.bnhz.common.enums.BusinessType;
|
||||
import com.bnhz.system.domain.SysNotice;
|
||||
import com.bnhz.system.service.ISysNoticeService;
|
||||
|
||||
/**
|
||||
* 公告 信息操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "通知公告")
|
||||
@RestController
|
||||
@RequestMapping("/system/notice")
|
||||
public class SysNoticeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
|
||||
/**
|
||||
* 获取通知公告列表
|
||||
*/
|
||||
@ApiOperation("获取通知公告列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysNotice notice)
|
||||
{
|
||||
startPage();
|
||||
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据通知公告编号获取详细信息
|
||||
*/
|
||||
@ApiOperation("根据通知公告编号获取详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:query')")
|
||||
@GetMapping(value = "/{noticeId}")
|
||||
public AjaxResult getInfo(@PathVariable Long noticeId)
|
||||
{
|
||||
return success(noticeService.selectNoticeById(noticeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增通知公告
|
||||
*/
|
||||
@ApiOperation("新增通知公告")
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:add')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysNotice notice)
|
||||
{
|
||||
notice.setCreateBy(getUsername());
|
||||
return toAjax(noticeService.insertNotice(notice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改通知公告
|
||||
*/
|
||||
@ApiOperation("修改通知公告")
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysNotice notice)
|
||||
{
|
||||
notice.setUpdateBy(getUsername());
|
||||
return toAjax(noticeService.updateNotice(notice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除通知公告
|
||||
*/
|
||||
@ApiOperation("删除通知公告")
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{noticeIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] noticeIds)
|
||||
{
|
||||
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,141 @@
|
|||
package com.bnhz.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bnhz.common.annotation.Log;
|
||||
import com.bnhz.common.constant.UserConstants;
|
||||
import com.bnhz.common.core.controller.BaseController;
|
||||
import com.bnhz.common.core.domain.AjaxResult;
|
||||
import com.bnhz.common.core.page.TableDataInfo;
|
||||
import com.bnhz.common.enums.BusinessType;
|
||||
import com.bnhz.common.utils.poi.ExcelUtil;
|
||||
import com.bnhz.system.domain.SysPost;
|
||||
import com.bnhz.system.service.ISysPostService;
|
||||
|
||||
/**
|
||||
* 岗位信息操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "岗位管理")
|
||||
@RestController
|
||||
@RequestMapping("/system/post")
|
||||
public class SysPostController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysPostService postService;
|
||||
|
||||
/**
|
||||
* 获取岗位列表
|
||||
*/
|
||||
@ApiOperation("获取岗位列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:post:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysPost post)
|
||||
{
|
||||
startPage();
|
||||
List<SysPost> list = postService.selectPostList(post);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("导出岗位列表")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:post:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysPost post)
|
||||
{
|
||||
List<SysPost> list = postService.selectPostList(post);
|
||||
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
||||
util.exportExcel(response, list, "岗位数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据岗位编号获取详细信息
|
||||
*/
|
||||
@ApiOperation("根据岗位编号获取详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('system:post:query')")
|
||||
@GetMapping(value = "/{postId}")
|
||||
public AjaxResult getInfo(@PathVariable Long postId)
|
||||
{
|
||||
return success(postService.selectPostById(postId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增岗位
|
||||
*/
|
||||
@ApiOperation("新增岗位")
|
||||
@PreAuthorize("@ss.hasPermi('system:post:add')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysPost post)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
||||
{
|
||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
}
|
||||
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
||||
{
|
||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
post.setCreateBy(getUsername());
|
||||
return toAjax(postService.insertPost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改岗位
|
||||
*/
|
||||
@ApiOperation("修改岗位")
|
||||
@PreAuthorize("@ss.hasPermi('system:post:edit')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysPost post)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
||||
{
|
||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
}
|
||||
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
||||
{
|
||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
post.setUpdateBy(getUsername());
|
||||
return toAjax(postService.updatePost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除岗位
|
||||
*/
|
||||
@ApiOperation("删除岗位")
|
||||
@PreAuthorize("@ss.hasPermi('system:post:remove')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{postIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] postIds)
|
||||
{
|
||||
return toAjax(postService.deletePostByIds(postIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位选择框列表
|
||||
*/
|
||||
@ApiOperation("获取岗位选择框列表")
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
List<SysPost> posts = postService.selectPostAll();
|
||||
return success(posts);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,163 @@
|
|||
package com.bnhz.web.controller.system;
|
||||
|
||||
import com.bnhz.common.annotation.Log;
|
||||
import com.bnhz.common.config.DaQiConfig;
|
||||
import com.bnhz.common.constant.UserConstants;
|
||||
import com.bnhz.common.core.controller.BaseController;
|
||||
import com.bnhz.common.core.domain.AjaxResult;
|
||||
import com.bnhz.common.core.domain.entity.SysUser;
|
||||
import com.bnhz.common.core.domain.model.LoginUser;
|
||||
import com.bnhz.common.enums.BusinessType;
|
||||
import com.bnhz.common.enums.SocialPlatformType;
|
||||
import com.bnhz.common.utils.SecurityUtils;
|
||||
import com.bnhz.common.utils.StringUtils;
|
||||
import com.bnhz.common.utils.file.FileUploadUtils;
|
||||
import com.bnhz.common.utils.file.MimeTypeUtils;
|
||||
import com.bnhz.framework.web.service.TokenService;
|
||||
import com.bnhz.iot.domain.UserSocialProfile;
|
||||
import com.bnhz.iot.service.IUserSocialProfileService;
|
||||
import com.bnhz.system.service.ISysUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 个人信息 业务处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "个人中心")
|
||||
@RestController
|
||||
@RequestMapping("/system/user/profile")
|
||||
public class SysProfileController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private IUserSocialProfileService iUserSocialProfileService;
|
||||
|
||||
/**
|
||||
* 个人信息
|
||||
*/
|
||||
@ApiOperation("获取个人信息")
|
||||
@GetMapping
|
||||
public AjaxResult profile()
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
SysUser user = loginUser.getUser();
|
||||
AjaxResult ajax = AjaxResult.success(user);
|
||||
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
|
||||
ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
|
||||
List<UserSocialProfile> socialProfileList = iUserSocialProfileService.selectUserSocialProfile(loginUser.getUserId());
|
||||
UserSocialProfile userSocialProfile = socialProfileList.stream().filter(s -> SocialPlatformType.listWechatPlatform.contains(s.getSourceClient()) && "1".equals(s.getStatus())).findFirst().orElse(null);
|
||||
ajax.put("socialGroup", socialProfileList);
|
||||
ajax.put("wxBind", userSocialProfile != null);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@ApiOperation("修改个人信息")
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult updateProfile(@RequestBody SysUser user)
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
SysUser sysUser = loginUser.getUser();
|
||||
user.setUserName(sysUser.getUserName());
|
||||
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||
{
|
||||
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(user.getEmail())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||
{
|
||||
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setUserId(sysUser.getUserId());
|
||||
user.setPassword(null);
|
||||
user.setAvatar(null);
|
||||
user.setDeptId(sysUser.getDeptId());
|
||||
if (userService.updateUserProfile(user) > 0)
|
||||
{
|
||||
// 更新缓存用户信息
|
||||
sysUser.setNickName(user.getNickName());
|
||||
sysUser.setPhonenumber(user.getPhonenumber());
|
||||
sysUser.setEmail(user.getEmail());
|
||||
sysUser.setSex(user.getSex());
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return success();
|
||||
}
|
||||
return error("修改个人信息异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*/
|
||||
@ApiOperation("重置密码")
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/updatePwd")
|
||||
public AjaxResult updatePwd(String oldPassword, String newPassword)
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
String userName = loginUser.getUsername();
|
||||
String password = loginUser.getPassword();
|
||||
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
||||
{
|
||||
return error("修改密码失败,旧密码错误");
|
||||
}
|
||||
if (SecurityUtils.matchesPassword(newPassword, password))
|
||||
{
|
||||
return error("新密码不能与旧密码相同");
|
||||
}
|
||||
if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
|
||||
{
|
||||
// 更新缓存用户密码
|
||||
loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return success();
|
||||
}
|
||||
return error("修改密码异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 头像上传
|
||||
*/
|
||||
@ApiOperation("头像上传")
|
||||
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/avatar")
|
||||
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception
|
||||
{
|
||||
if (!file.isEmpty())
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
String avatar = FileUploadUtils.upload(DaQiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
|
||||
if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("imgUrl", avatar);
|
||||
// 更新缓存用户头像
|
||||
loginUser.getUser().setAvatar(avatar);
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return ajax;
|
||||
}
|
||||
}
|
||||
return error("上传图片异常,请联系管理员");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.bnhz.web.controller.system;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bnhz.common.core.controller.BaseController;
|
||||
import com.bnhz.common.core.domain.AjaxResult;
|
||||
import com.bnhz.common.core.domain.model.RegisterBody;
|
||||
import com.bnhz.common.utils.StringUtils;
|
||||
import com.bnhz.framework.web.service.SysRegisterService;
|
||||
import com.bnhz.system.service.ISysConfigService;
|
||||
|
||||
/**
|
||||
* 注册验证
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "注册账号")
|
||||
@RestController
|
||||
public class SysRegisterController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private SysRegisterService registerService;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@ApiOperation("注册账号")
|
||||
@PostMapping("/register")
|
||||
public AjaxResult register(@RequestBody RegisterBody user)
|
||||
{
|
||||
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
|
||||
{
|
||||
return error("当前系统没有开启注册功能!");
|
||||
}
|
||||
String msg = registerService.register(user);
|
||||
return StringUtils.isEmpty(msg) ? success() : error(msg);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,298 @@
|
|||
package com.bnhz.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.bnhz.common.constant.HttpStatus;
|
||||
import com.bnhz.common.utils.collection.CollectionUtils;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bnhz.common.annotation.Log;
|
||||
import com.bnhz.common.core.controller.BaseController;
|
||||
import com.bnhz.common.core.domain.AjaxResult;
|
||||
import com.bnhz.common.core.domain.entity.SysDept;
|
||||
import com.bnhz.common.core.domain.entity.SysRole;
|
||||
import com.bnhz.common.core.domain.entity.SysUser;
|
||||
import com.bnhz.common.core.domain.model.LoginUser;
|
||||
import com.bnhz.common.core.page.TableDataInfo;
|
||||
import com.bnhz.common.enums.BusinessType;
|
||||
import com.bnhz.common.utils.StringUtils;
|
||||
import com.bnhz.common.utils.poi.ExcelUtil;
|
||||
import com.bnhz.framework.web.service.SysPermissionService;
|
||||
import com.bnhz.framework.web.service.TokenService;
|
||||
import com.bnhz.system.domain.SysUserRole;
|
||||
import com.bnhz.system.service.ISysDeptService;
|
||||
import com.bnhz.system.service.ISysRoleService;
|
||||
import com.bnhz.system.service.ISysUserService;
|
||||
|
||||
/**
|
||||
* 角色信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "角色管理")
|
||||
@RestController
|
||||
@RequestMapping("/system/role")
|
||||
public class SysRoleController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private SysPermissionService permissionService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
@ApiOperation("获取角色分页列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysRole role, Integer pageNum, Integer pageSize)
|
||||
{
|
||||
// startPage();
|
||||
List<SysRole> list = roleService.selectRoleList(role);
|
||||
TableDataInfo tableDataInfo = new TableDataInfo();
|
||||
tableDataInfo.setCode(HttpStatus.SUCCESS);
|
||||
tableDataInfo.setMsg("查询成功");
|
||||
if (org.apache.commons.collections4.CollectionUtils.isEmpty(list)) {
|
||||
tableDataInfo.setRows(list);
|
||||
tableDataInfo.setTotal(0);
|
||||
} else {
|
||||
List list1 = CollectionUtils.startPage(list, pageNum, pageSize);
|
||||
tableDataInfo.setRows(list1);
|
||||
tableDataInfo.setTotal(new PageInfo(list).getTotal());
|
||||
}
|
||||
return tableDataInfo;
|
||||
}
|
||||
|
||||
@ApiOperation("导出角色列表")
|
||||
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:role:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysRole role)
|
||||
{
|
||||
List<SysRole> list = roleService.selectRoleList(role);
|
||||
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
||||
util.exportExcel(response, list, "角色数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色编号获取详细信息
|
||||
*/
|
||||
@ApiOperation("根据角色编号获取详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||
@GetMapping(value = "/{roleId}")
|
||||
public AjaxResult getInfo(@PathVariable Long roleId)
|
||||
{
|
||||
roleService.checkRoleDataScope(roleId);
|
||||
return success(roleService.selectRoleById(roleId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增角色
|
||||
*/
|
||||
@ApiOperation("新增角色")
|
||||
@PreAuthorize("@ss.hasPermi('system:role:add')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysRole role)
|
||||
{
|
||||
// if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
||||
// {
|
||||
// return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
// }
|
||||
// else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
||||
// {
|
||||
// return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
// }
|
||||
if ("manager".equals(role.getRoleKey())) {
|
||||
return error("不允许设置管理员角色标识");
|
||||
}
|
||||
role.setCreateBy(getUsername());
|
||||
return toAjax(roleService.insertRole(role));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存角色
|
||||
*/
|
||||
@ApiOperation("修改角色")
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
// if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
||||
// {
|
||||
// return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
// }
|
||||
// else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
||||
// {
|
||||
// return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
// }
|
||||
role.setUpdateBy(getUsername());
|
||||
|
||||
if (roleService.updateRole(role) > 0)
|
||||
{
|
||||
// 更新缓存用户权限
|
||||
LoginUser loginUser = getLoginUser();
|
||||
if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
|
||||
{
|
||||
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
|
||||
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
|
||||
tokenService.setLoginUser(loginUser);
|
||||
}
|
||||
return success();
|
||||
}
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存数据权限
|
||||
*/
|
||||
@ApiOperation("修改保存数据权限")
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/dataScope")
|
||||
public AjaxResult dataScope(@RequestBody SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
return toAjax(roleService.authDataScope(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态修改
|
||||
*/
|
||||
@ApiOperation("修改角色状态")
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
role.setUpdateBy(getUsername());
|
||||
return toAjax(roleService.updateRoleStatus(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
*/
|
||||
@ApiOperation("删除角色")
|
||||
@PreAuthorize("@ss.hasPermi('system:role:remove')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{roleIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] roleIds)
|
||||
{
|
||||
return toAjax(roleService.deleteRoleByIds(roleIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色选择框列表
|
||||
*/
|
||||
@ApiOperation("获取角色选择框列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
return success(roleService.selectRoleAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询已分配用户角色列表
|
||||
*/
|
||||
@ApiOperation("查询已分配用户角色列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@GetMapping("/authUser/allocatedList")
|
||||
public TableDataInfo allocatedList(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectAllocatedList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询未分配用户角色列表
|
||||
*/
|
||||
@ApiOperation("查询未分配用户角色列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@GetMapping("/authUser/unallocatedList")
|
||||
public TableDataInfo unallocatedList(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectUnallocatedList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消授权用户
|
||||
*/
|
||||
@ApiOperation("取消授权用户")
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/cancel")
|
||||
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
|
||||
{
|
||||
return toAjax(roleService.deleteAuthUser(userRole));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量取消授权用户
|
||||
*/
|
||||
@ApiOperation("批量取消授权用户")
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/cancelAll")
|
||||
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
|
||||
{
|
||||
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量选择用户授权
|
||||
*/
|
||||
@ApiOperation("批量选择用户授权")
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/selectAll")
|
||||
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
|
||||
{
|
||||
roleService.checkRoleDataScope(roleId);
|
||||
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取对应角色部门树列表
|
||||
*/
|
||||
@ApiOperation("获取对应角色部门树列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||
@GetMapping(value = "/deptTree/{roleId}")
|
||||
public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
||||
ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
|
||||
return ajax;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,301 @@
|
|||
package com.bnhz.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.bnhz.common.annotation.Log;
|
||||
import com.bnhz.common.constant.UserConstants;
|
||||
import com.bnhz.common.core.controller.BaseController;
|
||||
import com.bnhz.common.core.domain.AjaxResult;
|
||||
import com.bnhz.common.core.domain.entity.SysDept;
|
||||
import com.bnhz.common.core.domain.entity.SysRole;
|
||||
import com.bnhz.common.core.domain.entity.SysUser;
|
||||
import com.bnhz.common.core.page.TableDataInfo;
|
||||
import com.bnhz.common.enums.BusinessType;
|
||||
import com.bnhz.common.utils.SecurityUtils;
|
||||
import com.bnhz.common.utils.StringUtils;
|
||||
import com.bnhz.common.utils.poi.ExcelUtil;
|
||||
import com.bnhz.system.service.ISysDeptService;
|
||||
import com.bnhz.system.service.ISysPostService;
|
||||
import com.bnhz.system.service.ISysRoleService;
|
||||
import com.bnhz.system.service.ISysUserService;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "用户管理")
|
||||
@RestController
|
||||
@RequestMapping("/system/user")
|
||||
public class SysUserController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
@Autowired
|
||||
private ISysPostService postService;
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
@ApiOperation("获取用户分页列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:user:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
if (null == user.getDeptId()) {
|
||||
user.setDeptId(getLoginUser().getDeptId());
|
||||
}
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("导出用户列表")
|
||||
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:user:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysUser user)
|
||||
{
|
||||
if (null == user.getDeptId()) {
|
||||
user.setDeptId(getLoginUser().getDeptId());
|
||||
}
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
util.exportExcel(response, list, "用户数据");
|
||||
}
|
||||
|
||||
@ApiOperation("批量导入用户")
|
||||
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:user:import')")
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
||||
{
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
List<SysUser> userList = util.importExcel(file.getInputStream());
|
||||
String operName = getUsername();
|
||||
String message = userService.importUser(userList, updateSupport, operName);
|
||||
return success(message);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("下载用户导入模板")
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response)
|
||||
{
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
util.importTemplateExcel(response, "用户数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户编号获取详细信息
|
||||
*/
|
||||
@ApiOperation("根据用户编号获取详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||
@GetMapping(value = { "/", "/{userId}" })
|
||||
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
|
||||
{
|
||||
userService.checkUserDataScope(userId);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
// List<SysRole> roles = roleService.selectRoleAll();
|
||||
// ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||
ajax.put("posts", postService.selectPostAll());
|
||||
if (StringUtils.isNotNull(userId))
|
||||
{
|
||||
SysUser sysUser = userService.selectUserById(userId);
|
||||
ajax.put(AjaxResult.DATA_TAG, sysUser);
|
||||
ajax.put("postIds", postService.selectPostListByUserId(userId));
|
||||
SysRole sysRole = new SysRole();
|
||||
sysRole.setDeptId(sysUser.getDeptId());
|
||||
sysRole.setShowChild(false);
|
||||
List<SysRole> sysRoleList = roleService.selectRoleList(sysRole);
|
||||
ajax.put("roles", sysRoleList);
|
||||
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
||||
}
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*/
|
||||
@ApiOperation("新增用户")
|
||||
@PreAuthorize("@ss.hasPermi('system:user:add')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysUser user)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user)))
|
||||
{
|
||||
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||
{
|
||||
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getEmail())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||
{
|
||||
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setCreateBy(getUsername());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
return toAjax(userService.insertUser(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@ApiOperation("修改用户")
|
||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysUser user)
|
||||
{
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user)))
|
||||
{
|
||||
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||
{
|
||||
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getEmail())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||
{
|
||||
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setUpdateBy(getUsername());
|
||||
return toAjax(userService.updateUser(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
*/
|
||||
@ApiOperation("删除用户")
|
||||
@PreAuthorize("@ss.hasPermi('system:user:remove')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{userIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] userIds)
|
||||
{
|
||||
if (ArrayUtils.contains(userIds, getUserId()))
|
||||
{
|
||||
return error("当前用户不能删除");
|
||||
}
|
||||
return toAjax(userService.deleteUserByIds(userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*/
|
||||
@ApiOperation("重置用户密码")
|
||||
@PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/resetPwd")
|
||||
public AjaxResult resetPwd(@RequestBody SysUser user)
|
||||
{
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
user.setUpdateBy(getUsername());
|
||||
return toAjax(userService.resetPwd(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态修改
|
||||
*/
|
||||
@ApiOperation("修改用户状态")
|
||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody SysUser user)
|
||||
{
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
user.setUpdateBy(getUsername());
|
||||
return toAjax(userService.updateUserStatus(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户编号获取授权角色
|
||||
*/
|
||||
@ApiOperation("根据用户编号获取授权角色")
|
||||
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||
@GetMapping("/authRole/{userId}")
|
||||
public AjaxResult authRole(@PathVariable("userId") Long userId)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
SysUser user = userService.selectUserById(userId);
|
||||
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||
ajax.put("user", user);
|
||||
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权角色
|
||||
*/
|
||||
@ApiOperation("为用户授权角色")
|
||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authRole")
|
||||
public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
|
||||
{
|
||||
userService.checkUserDataScope(userId);
|
||||
userService.insertUserAuth(userId, roleIds);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门树列表
|
||||
*/
|
||||
@ApiOperation("获取部门树列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:user:list')")
|
||||
@GetMapping("/deptTree")
|
||||
public AjaxResult deptTree(SysDept dept)
|
||||
{
|
||||
return success(deptService.selectDeptTreeList(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取终端用户列表
|
||||
* @param user 用户信息
|
||||
* @return com.bnhz.common.core.page.TableDataInfo
|
||||
*/
|
||||
@ApiOperation("获取用户分页列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:user:list')")
|
||||
@GetMapping("/listTerminal")
|
||||
public TableDataInfo listTerminal(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.listTerminal(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.bnhz.web.controller.tool;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.bnhz.common.core.controller.BaseController;
|
||||
|
||||
/**
|
||||
* swagger 接口
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/tool/swagger")
|
||||
public class SwaggerController extends BaseController
|
||||
{
|
||||
@PreAuthorize("@ss.hasPermi('tool:swagger:view')")
|
||||
@GetMapping()
|
||||
public String index()
|
||||
{
|
||||
return redirect("/swagger-ui.html");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
package com.bnhz.web.core.config;
|
||||
|
||||
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.bnhz.common.config.DaQiConfig;
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* Swagger2的接口配置
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Configuration
|
||||
public class SwaggerConfig
|
||||
{
|
||||
/** 系统基础配置 */
|
||||
@Autowired
|
||||
private DaQiConfig daQiConfig;
|
||||
|
||||
/** 是否开启swagger */
|
||||
@Value("${swagger.enabled}")
|
||||
private boolean enabled;
|
||||
|
||||
/** 设置请求的统一前缀 */
|
||||
@Value("${swagger.pathMapping}")
|
||||
private String pathMapping;
|
||||
|
||||
/**
|
||||
* 创建API
|
||||
*/
|
||||
@Bean
|
||||
public Docket createRestApi()
|
||||
{
|
||||
return new Docket(DocumentationType.OAS_30)
|
||||
// 是否启用Swagger
|
||||
.enable(enabled)
|
||||
// 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
|
||||
.apiInfo(apiInfo())
|
||||
// 设置哪些接口暴露给Swagger展示
|
||||
.select()
|
||||
// 扫描所有有注解的api,用这种方式更灵活
|
||||
// .apis(RequestHandlerSelectors.withMethodAnnotation(ApiAdd.class))
|
||||
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||
// 扫描指定包中的swagger注解
|
||||
// .apis(RequestHandlerSelectors.basePackage("com.bnhz.project.tool.swagger"))
|
||||
// 扫描所有 .apis(RequestHandlerSelectors.any())
|
||||
.paths(PathSelectors.any())
|
||||
.build()
|
||||
/* 设置安全模式,swagger可以设置访问token */
|
||||
.securitySchemes(securitySchemes())
|
||||
.securityContexts(securityContexts())
|
||||
.pathMapping(pathMapping);
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全模式,这里指定token通过Authorization头请求头传递
|
||||
*/
|
||||
private List<SecurityScheme> securitySchemes()
|
||||
{
|
||||
List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
|
||||
apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
|
||||
return apiKeyList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全上下文
|
||||
*/
|
||||
private List<SecurityContext> securityContexts()
|
||||
{
|
||||
List<SecurityContext> securityContexts = new ArrayList<>();
|
||||
securityContexts.add(
|
||||
SecurityContext.builder()
|
||||
.securityReferences(defaultAuth())
|
||||
.operationSelector(o -> o.requestMappingPattern().matches("/.*"))
|
||||
.build());
|
||||
return securityContexts;
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认的安全上引用
|
||||
*/
|
||||
private List<SecurityReference> defaultAuth()
|
||||
{
|
||||
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
|
||||
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
||||
authorizationScopes[0] = authorizationScope;
|
||||
List<SecurityReference> securityReferences = new ArrayList<>();
|
||||
securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
|
||||
return securityReferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加摘要信息
|
||||
*/
|
||||
private ApiInfo apiInfo()
|
||||
{
|
||||
// 用ApiInfoBuilder进行定制
|
||||
return new ApiInfoBuilder()
|
||||
// 设置标题
|
||||
.title("大气环保物联网平台接口文档")
|
||||
// 描述
|
||||
.description("描述:大气环保物联网平台")
|
||||
// 作者信息
|
||||
.contact(new Contact(daQiConfig.getName(), null, null))
|
||||
// 版本
|
||||
.version("版本号:" + daQiConfig.getVersion())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
restart.include.json=/com.alibaba.fastjson2.*.jar
|
|
@ -0,0 +1,173 @@
|
|||
# 数据源配置
|
||||
spring:
|
||||
kafka:
|
||||
bootstrap-servers: home.com:9092
|
||||
producer:
|
||||
key-serializer: org.apache.kafka.common.serialization.StringSerializer
|
||||
value-serializer: org.apache.kafka.common.serialization.StringSerializer
|
||||
consumer:
|
||||
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
||||
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
||||
#指定消费者组的 group_id
|
||||
group-id: bnhz-dev
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://49.234.239.14:3306/atmosphere?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: mmdev
|
||||
password: Mmdev8848#
|
||||
# url: jdbc:mysql://182.148.53.138:3313/atmosphere?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# username: root
|
||||
# password: bnhz8866.@
|
||||
# url: jdbc:mysql://home.com:3306/atmosphere?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# username: leo
|
||||
# password: ljc123456
|
||||
# 从库数据源
|
||||
slave:
|
||||
enabled: false # 从数据源开关/默认关闭
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# TDengine数据库
|
||||
tdengine-server:
|
||||
enabled: true # 默认不启用TDengine,true=启用,false=不启用
|
||||
driverClassName: com.taosdata.jdbc.TSDBDriver
|
||||
url: jdbc:TAOS://test-td1:6030/daqi_log?timezone=UTC-8&charset=utf-8
|
||||
username: daqi
|
||||
password: daqi8866
|
||||
dbName: daqi_log
|
||||
|
||||
initialSize: 5 # 初始连接数
|
||||
minIdle: 10 # 最小连接池数量
|
||||
maxActive: 20 # 最大连接池数量
|
||||
maxWait: 60000 # 配置获取连接等待超时的时间
|
||||
timeBetweenEvictionRunsMillis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000 # 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000 # 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
validationQuery: SELECT 1 FROM DUAL # 配置检测连接是否有效
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: bnhz
|
||||
login-password: bnhz
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
# redis 配置
|
||||
redis:
|
||||
host: localhost # 地址
|
||||
port: 6379 # 端口,默认为6379
|
||||
database: 1 # 数据库索引
|
||||
password: # 密码
|
||||
timeout: 10s # 连接超时时间
|
||||
lettuce:
|
||||
pool:
|
||||
min-idle: 0 # 连接池中的最小空闲连接
|
||||
max-idle: 8 # 连接池中的最大空闲连接
|
||||
max-active: 8 # 连接池的最大数据库连接数
|
||||
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
# mqtt 配置
|
||||
mqtt:
|
||||
username: bnhz # 账号
|
||||
password: bnhz # 密码
|
||||
host-url: tcp://localhost:1883 # mqtt连接tcp地址
|
||||
client-id: ${random.int} # 客户端Id,不能相同,采用随机数 ${random.value}
|
||||
default-topic: test # 默认主题
|
||||
timeout: 30 # 超时时间
|
||||
keepalive: 30 # 保持连接
|
||||
clearSession: true # 清除会话(设置为false,断开连接,重连后使用原来的会话 保留订阅的主题,能接收离线期间的消息)
|
||||
|
||||
# sip 配置
|
||||
sip:
|
||||
enabled: false # 是否启用视频监控SIP,true为启用
|
||||
## 本地调试时,绑定网卡局域网IP,设备在同一局域网,设备接入IP填写绑定IP
|
||||
## 部署服务端时,默认绑定容器IP,设备接入IP填写服务器公网IP
|
||||
ip: 177.7.0.13
|
||||
port: 5061 # SIP端口(保持默认)
|
||||
domain: 3402000000 # 由省级、市级、区级、基层编号组成
|
||||
id: 34020000002000000001 # 同上,另外增加编号,(可保持默认)
|
||||
password: 12345678 # 监控设备接入的密码
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.bnhz: debug
|
||||
com.yomahub: debug
|
||||
org.dromara: warn
|
||||
org.springframework: warn
|
||||
|
||||
# Swagger配置
|
||||
swagger:
|
||||
enabled: true # 是否开启swagger
|
||||
pathMapping: # 请求前缀
|
||||
|
||||
liteflow:
|
||||
#FlowExecutor的execute2Future的线程数,默认为64
|
||||
main-executor-works: 64
|
||||
#FlowExecutor的execute2Future的自定义线程池Builder
|
||||
main-executor-class: com.bnhz.mq.ruleEngine.MainExecutorBuilder
|
||||
#并行节点的线程池Builder
|
||||
thread-executor-class: com.bnhz.mq.ruleEngine.WhenExecutorBuilder
|
||||
rule-source-ext-data-map:
|
||||
# 应用名称,规则链和脚本组件名称需要一致,不要修改
|
||||
applicationName: bnhz
|
||||
#是否开启SQL日志
|
||||
sqlLogEnabled: true
|
||||
# 规则多时,启用快速加载模式
|
||||
fast-load: false
|
||||
#是否开启SQL数据轮询自动刷新机制 默认不开启
|
||||
pollingEnabled: false
|
||||
pollingIntervalSeconds: 60
|
||||
pollingStartSeconds: 60
|
||||
#以下是chain表的配置
|
||||
chainTableName: iot_scene
|
||||
chainApplicationNameField: application_name
|
||||
chainNameField: chain_name
|
||||
elDataField: el_data
|
||||
chainEnableField: enable
|
||||
#以下是script表的配置
|
||||
scriptTableName: iot_script
|
||||
scriptApplicationNameField: application_name
|
||||
scriptIdField: script_id
|
||||
scriptNameField: script_name
|
||||
scriptDataField: script_data
|
||||
scriptTypeField: script_type
|
||||
scriptLanguageField: script_language
|
||||
scriptEnableField: enable
|
||||
hua-zhi:
|
||||
url: http://182.148.53.138:11125
|
||||
client_id: lvsejixiaotest
|
||||
client_secret: huanzhi123
|
||||
high-obs:
|
||||
host: 183.221.119.74:1443
|
||||
appKey: 27429972
|
||||
appSecret: YiJycH8a4bdjyuoHyWcS
|
||||
picUrlPrefix: https://172.100.0.141:1443/bforestfire/v1/picture/preview?picUrl=
|
||||
fumes:
|
||||
host: http://116.62.234.187:8120
|
||||
username: gaoxin_sjjk
|
||||
password: gxqjg@123
|
||||
areacode: gxnq
|
||||
|
||||
server:
|
||||
domain: http://demo.youfans.cn
|
||||
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
# 数据源配置
|
||||
spring:
|
||||
kafka:
|
||||
bootstrap-servers: 192.168.0.20:9092
|
||||
# 生产者 key value的序列化方式
|
||||
producer:
|
||||
key-serializer: org.apache.kafka.common.serialization.StringSerializer
|
||||
value-serializer: org.springframework.kafka.support.serializer.JsonSerializer
|
||||
consumer:
|
||||
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
||||
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
||||
#指定消费者组的 group_id
|
||||
group-id: bnhz-prod
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://49.234.239.14:3306/atmosphere?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: mmdev
|
||||
password: Mmdev8848#
|
||||
# 从库数据源
|
||||
slave:
|
||||
enabled: false # 从数据源开关/默认关闭
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# TDengine数据库
|
||||
tdengine-server:
|
||||
enabled: false # 默认不启用TDengine,true=启用,false=不启用
|
||||
driverClassName: com.taosdata.jdbc.TSDBDriver
|
||||
url: jdbc:TAOS://bnhz:6030/bnhz_log?timezone=Asia/Beijing&charset=utf-8
|
||||
username: root
|
||||
password: taosdata
|
||||
dbName: bnhz_log
|
||||
|
||||
initialSize: 5 # 初始连接数
|
||||
minIdle: 10 # 最小连接池数量
|
||||
maxActive: 20 # 最大连接池数量
|
||||
maxWait: 60000 # 配置获取连接等待超时的时间
|
||||
timeBetweenEvictionRunsMillis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000 # 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000 # 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
validationQuery: SELECT 1 FROM DUAL # 配置检测连接是否有效
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: bnhz
|
||||
login-password: bnhz
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
# redis 配置
|
||||
redis:
|
||||
host: localhost # 地址
|
||||
port: 6379 # 端口,默认为6379
|
||||
database: 0 # 数据库索引
|
||||
password: bnhz # 密码
|
||||
timeout: 10s # 连接超时时间
|
||||
lettuce:
|
||||
pool:
|
||||
min-idle: 0 # 连接池中的最小空闲连接
|
||||
max-idle: 8 # 连接池中的最大空闲连接
|
||||
max-active: 8 # 连接池的最大数据库连接数
|
||||
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
# mqtt 配置
|
||||
mqtt:
|
||||
username: bnhz # 账号(仅用于后端自认证)
|
||||
password: bnhz # 密码(仅用于后端自认证)
|
||||
host-url: tcp://177.7.0.12:1883 # 连接 Emqx 消息服务器地址
|
||||
# host-url: tcp://177.7.0.13:1883 # 内置netty mqtt broker地址
|
||||
client-id: ${random.int} # 客户端Id,不能相同,采用随机数 ${random.value}
|
||||
default-topic: test # 默认主题
|
||||
timeout: 30 # 超时时间
|
||||
keepalive: 30 # 保持连接
|
||||
clearSession: true # 清除会话(设置为false,断开连接,重连后使用原来的会话 保留订阅的主题,能接收离线期间的消息)
|
||||
|
||||
# sip 配置
|
||||
sip:
|
||||
enabled: false # 是否启用视频监控SIP,true为启用
|
||||
## 本地调试时,绑定网卡局域网IP,设备在同一局域网,设备接入IP填写绑定IP
|
||||
## 部署服务端时,默认绑定容器IP,设备接入IP填写服务器公网IP
|
||||
ip: 177.7.0.13
|
||||
port: 5061 # SIP端口(保持默认)
|
||||
domain: 3402000000 # 由省级、市级、区级、基层编号组成
|
||||
id: 34020000002000000001 # 同上,另外增加编号,(可保持默认)
|
||||
password: 12345678 # 监控设备接入的密码
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.bnhz: error
|
||||
com.yomahub: warn
|
||||
org.dromara: warn
|
||||
org.springframework: warn
|
||||
|
||||
# Swagger配置
|
||||
swagger:
|
||||
enabled: true # 是否开启swagger
|
||||
pathMapping: /prod-api # 请求前缀
|
||||
|
||||
|
||||
liteflow:
|
||||
#FlowExecutor的execute2Future的线程数
|
||||
main-executor-works: 128
|
||||
#FlowExecutor的execute2Future的自定义线程池Builder
|
||||
main-executor-class: com.bnhz.mq.ruleEngine.MainExecutorBuilder
|
||||
#并行节点的线程池Builder
|
||||
thread-executor-class: com.bnhz.mq.ruleEngine.WhenExecutorBuilder
|
||||
rule-source-ext-data-map:
|
||||
# 应用名称,规则链和脚本组件名称需要一致,不要修改
|
||||
applicationName: bnhz
|
||||
#是否开启SQL日志
|
||||
sqlLogEnabled: true
|
||||
# 规则多时,启用快速加载模式
|
||||
fast-load: false
|
||||
#是否开启SQL数据轮询自动刷新机制 默认不开启
|
||||
pollingEnabled: false
|
||||
pollingIntervalSeconds: 60
|
||||
pollingStartSeconds: 60
|
||||
#以下是chain表的配置
|
||||
chainTableName: iot_scene
|
||||
chainApplicationNameField: application_name
|
||||
chainNameField: chain_name
|
||||
elDataField: el_data
|
||||
chainEnableField: enable
|
||||
#以下是script表的配置
|
||||
scriptTableName: iot_script
|
||||
scriptApplicationNameField: application_name
|
||||
scriptIdField: script_id
|
||||
scriptNameField: script_name
|
||||
scriptDataField: script_data
|
||||
scriptTypeField: script_type
|
||||
scriptLanguageField: script_language
|
||||
scriptEnableField: enable
|
||||
huazhi:
|
||||
url: http://182.148.53.138:11125
|
||||
client_id: lvsejixiaotest
|
||||
client_secret: huanzhi123
|
||||
high-obs:
|
||||
host: 183.221.119.74:1443
|
||||
appKey: 27429972
|
||||
appSecret: YiJycH8a4bdjyuoHyWcS
|
||||
picUrlPrefix: https://172.100.0.141:1443/bforestfire/v1/picture/preview?picUrl=
|
||||
fumes:
|
||||
host: http://116.62.234.187:8120
|
||||
username: gaoxin_sjjk
|
||||
password: gxqjg@123
|
||||
areacode: gxnq
|
|
@ -0,0 +1,177 @@
|
|||
server:
|
||||
domain: http://123
|
||||
# 数据源配置
|
||||
spring:
|
||||
kafka:
|
||||
bootstrap-servers: 192.168.0.20:9092
|
||||
# 生产者 key value的序列化方式
|
||||
producer:
|
||||
key-serializer: org.apache.kafka.common.serialization.StringSerializer
|
||||
value-serializer: org.springframework.kafka.support.serializer.JsonSerializer
|
||||
# 消费者 key value的反序列化方式(当前项目暂时不需要消费)
|
||||
consumer:
|
||||
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
||||
value-deserializer: org.springframework.kafka.support.serializer.JsonDeserializer
|
||||
properties:
|
||||
spring:
|
||||
json:
|
||||
trusted:
|
||||
packages: "com.bnhz.adapter.model.blackcar"
|
||||
value:
|
||||
default:
|
||||
type: "com.bnhz.adapter.model.blackcar.Point"
|
||||
#指定消费者组的 group_id
|
||||
group-id: bnhz-test
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://49.234.239.14:3306/atmosphere?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: mmdev
|
||||
password: Mmdev8848#
|
||||
# 从库数据源
|
||||
slave:
|
||||
enabled: false # 从数据源开关/默认关闭
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# TDengine数据库
|
||||
tdengine-server:
|
||||
enabled: true # 默认不启用TDengine,true=启用,false=不启用
|
||||
driverClassName: com.taosdata.jdbc.TSDBDriver
|
||||
# url: jdbc:TAOS://test-td1:6030/daqi_log?timezone=UTC-8&charset=utf-8
|
||||
url: jdbc:TAOS://49.234.239.14:6030/daqi_log?timezone=UTC-8&charset=utf-8
|
||||
username: daqi
|
||||
password: daqi8866
|
||||
dbName: daqi_log
|
||||
|
||||
initialSize: 5 # 初始连接数
|
||||
minIdle: 10 # 最小连接池数量
|
||||
maxActive: 20 # 最大连接池数量
|
||||
maxWait: 60000 # 配置获取连接等待超时的时间
|
||||
timeBetweenEvictionRunsMillis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000 # 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000 # 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
validationQuery: SELECT 1 FROM DUAL # 配置检测连接是否有效
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: bnhz
|
||||
login-password: bnhz
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
# redis 配置
|
||||
redis:
|
||||
host: localhost # 地址
|
||||
port: 6379 # 端口,默认为6379
|
||||
database: 1 # 数据库索引
|
||||
password: # 密码
|
||||
timeout: 10s # 连接超时时间
|
||||
lettuce:
|
||||
pool:
|
||||
min-idle: 0 # 连接池中的最小空闲连接
|
||||
max-idle: 8 # 连接池中的最大空闲连接
|
||||
max-active: 8 # 连接池的最大数据库连接数
|
||||
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
# mqtt 配置
|
||||
mqtt:
|
||||
username: bnhz # 账号
|
||||
password: bnhz # 密码
|
||||
host-url: tcp://localhost:1883 # mqtt连接tcp地址
|
||||
client-id: ${random.int} # 客户端Id,不能相同,采用随机数 ${random.value}
|
||||
default-topic: test # 默认主题
|
||||
timeout: 30 # 超时时间
|
||||
keepalive: 30 # 保持连接
|
||||
clearSession: true # 清除会话(设置为false,断开连接,重连后使用原来的会话 保留订阅的主题,能接收离线期间的消息)
|
||||
|
||||
# sip 配置
|
||||
sip:
|
||||
enabled: false # 是否启用视频监控SIP,true为启用
|
||||
## 本地调试时,绑定网卡局域网IP,设备在同一局域网,设备接入IP填写绑定IP
|
||||
## 部署服务端时,默认绑定容器IP,设备接入IP填写服务器公网IP
|
||||
ip: 177.7.0.13
|
||||
port: 5061 # SIP端口(保持默认)
|
||||
domain: 3402000000 # 由省级、市级、区级、基层编号组成
|
||||
id: 34020000002000000001 # 同上,另外增加编号,(可保持默认)
|
||||
password: 12345678 # 监控设备接入的密码
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.bnhz: debug
|
||||
com.yomahub: debug
|
||||
org.dromara: warn
|
||||
org.springframework: warn
|
||||
|
||||
# Swagger配置
|
||||
swagger:
|
||||
enabled: true # 是否开启swagger
|
||||
pathMapping: # 请求前缀
|
||||
|
||||
liteflow:
|
||||
#FlowExecutor的execute2Future的线程数,默认为64
|
||||
main-executor-works: 64
|
||||
#FlowExecutor的execute2Future的自定义线程池Builder
|
||||
main-executor-class: com.bnhz.mq.ruleEngine.MainExecutorBuilder
|
||||
#并行节点的线程池Builder
|
||||
thread-executor-class: com.bnhz.mq.ruleEngine.WhenExecutorBuilder
|
||||
rule-source-ext-data-map:
|
||||
# 应用名称,规则链和脚本组件名称需要一致,不要修改
|
||||
applicationName: bnhz
|
||||
#是否开启SQL日志
|
||||
sqlLogEnabled: true
|
||||
# 规则多时,启用快速加载模式
|
||||
fast-load: false
|
||||
#是否开启SQL数据轮询自动刷新机制 默认不开启
|
||||
pollingEnabled: false
|
||||
pollingIntervalSeconds: 60
|
||||
pollingStartSeconds: 60
|
||||
#以下是chain表的配置
|
||||
chainTableName: iot_scene
|
||||
chainApplicationNameField: application_name
|
||||
chainNameField: chain_name
|
||||
elDataField: el_data
|
||||
chainEnableField: enable
|
||||
#以下是script表的配置
|
||||
scriptTableName: iot_script
|
||||
scriptApplicationNameField: application_name
|
||||
scriptIdField: script_id
|
||||
scriptNameField: script_name
|
||||
scriptDataField: script_data
|
||||
scriptTypeField: script_type
|
||||
scriptLanguageField: script_language
|
||||
scriptEnableField: enable
|
||||
hua-zhi:
|
||||
url: http://182.148.53.138:11125
|
||||
client_id: lvsejixiaotest
|
||||
client_secret: huanzhi123
|
||||
high-obs:
|
||||
host: 183.221.119.74:1443
|
||||
appKey: 27429972
|
||||
appSecret: YiJycH8a4bdjyuoHyWcS
|
||||
picUrlPrefix: https://172.100.0.141:1443/bforestfire/v1/picture/preview?picUrl=
|
||||
|
||||
fumes:
|
||||
host: http://116.62.234.187:8120
|
||||
username: gaoxin_sjjk
|
||||
password: gxqjg@123
|
||||
areacode: gxnq
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
# 项目相关配置
|
||||
bnhz:
|
||||
name: bnhz # 名称
|
||||
version: 3.8.5 # 版本
|
||||
copyrightYear: 2023 # 版权年份
|
||||
demoEnabled: true # 实例演示开关
|
||||
# 文件路径,以uploadPath结尾 示例( Windows配置 D:/uploadPath,Linux配置 /uploadPath)
|
||||
profile: /uploadPath
|
||||
addressEnabled: true # 获取ip地址开关
|
||||
captchaType: math # 验证码类型 math 数组计算 char 字符验证
|
||||
workId: 1
|
||||
distributed: false
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
port: 8080 # 服务器的HTTP端口,默认为8080
|
||||
servlet:
|
||||
context-path: / # 应用的访问路径
|
||||
tomcat:
|
||||
uri-encoding: UTF-8 # tomcat的URI编码
|
||||
accept-count: 1000 # 连接数满后的排队数,默认为100
|
||||
threads:
|
||||
max: 800 # tomcat最大线程数,默认为200
|
||||
min-spare: 100 # Tomcat启动初始化的线程数,默认值10
|
||||
# 基于netty的服务器
|
||||
broker:
|
||||
enabled: true # mqttBroker类型选择, true: 基于netty的mqttBroker和webSocket false: emq的mqttBroker
|
||||
broker-node: node1 # 服务器集群节点
|
||||
port: 1883
|
||||
openws: true # 控制webSocket是否开启
|
||||
websocket-port: 8083
|
||||
websocket-path: /mqtt
|
||||
keep-alive: 70 # 默认的全部客户端心跳上传时间
|
||||
#TCP服务端口
|
||||
tcp:
|
||||
enabled: true # 控制tcp端口是否开启
|
||||
port: 8888
|
||||
keep-alive: 70
|
||||
delimiter: 0x7e
|
||||
udp:
|
||||
enabled: false # 控制udp端口是否开启
|
||||
port: 8889
|
||||
read-idle: 300 # udp保活时间 默认5分钟
|
||||
#平台判断离线时间 是心跳时间的2倍
|
||||
device:
|
||||
platform:
|
||||
expried: 120
|
||||
|
||||
# Spring配置
|
||||
spring:
|
||||
# 环境配置,dev=开发环境,prod=生产环境
|
||||
profiles:
|
||||
active: dev # 环境配置,dev=开发环境,prod=生产环境
|
||||
# 资源信息
|
||||
messages:
|
||||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 10MB # 单个文件大小
|
||||
max-request-size: 20MB # 设置总上传的文件大小
|
||||
# 服务模块
|
||||
devtools:
|
||||
restart:
|
||||
enabled: true # 热部署开关
|
||||
task:
|
||||
execution:
|
||||
pool:
|
||||
core-size: 20 # 最小连接数
|
||||
max-size: 200 # 最大连接数
|
||||
queue-capacity: 3000 # 最大容量
|
||||
keep-alive: 60
|
||||
|
||||
#集群配置
|
||||
cluster:
|
||||
enable: true
|
||||
type: redis
|
||||
|
||||
|
||||
# 用户配置
|
||||
user:
|
||||
password:
|
||||
maxRetryCount: 5 # 密码最大错误次数
|
||||
lockTime: 10 # 密码锁定时间(默认10分钟)
|
||||
|
||||
# token配置
|
||||
token:
|
||||
header: Authorization # 令牌自定义标识
|
||||
secret: abcdefghijklfastbeesmartrstuvwxyz # 令牌密钥
|
||||
expireTime: 1440 # 令牌有效期(默认30分钟)1440为一天
|
||||
|
||||
# MyBatis配置
|
||||
#mybatis:
|
||||
# typeAliasesPackage: com.bnhz.**.domain # 搜索指定包别名
|
||||
# mapperLocations: classpath*:mapper/**/*Mapper.xml # 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
# configLocation: classpath:mybatis/mybatis-config.xml # 加载全局的配置文件
|
||||
|
||||
# mybatis-plus配置
|
||||
mybatis-plus:
|
||||
typeAliasesPackage: com.bnhz.**.domain # 搜索指定包别名
|
||||
mapperLocations: classpath*:mapper/**/*Mapper.xml # 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
configLocation: classpath:mybatis/mybatis-config.xml # 加载全局的配置文件
|
||||
global-config:
|
||||
db-config:
|
||||
id-type: AUTO # 自增 ID
|
||||
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
|
||||
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
||||
|
||||
# PageHelper分页插件
|
||||
pagehelper:
|
||||
helperDialect: mysql
|
||||
supportMethodsArguments: true
|
||||
params: count=countSql
|
||||
|
||||
# 防止XSS攻击
|
||||
xss:
|
||||
enabled: true # 过滤开关
|
||||
excludes: /system/notice # 排除链接(多个用逗号分隔)
|
||||
urlPatterns: /system/*,/monitor/*,/tool/* # 匹配链接
|
|
@ -0,0 +1,2 @@
|
|||
Application Version: ${bnhz.version}
|
||||
Spring Boot Version: ${spring-boot.version}
|
|
@ -0,0 +1,37 @@
|
|||
#错误消息
|
||||
not.null=* 必须填写
|
||||
user.jcaptcha.error=验证码错误
|
||||
user.jcaptcha.expire=验证码已失效
|
||||
user.not.exists=用户不存在/密码错误
|
||||
user.password.not.match=用户不存在/密码错误
|
||||
user.password.retry.limit.count=密码输入错误{0}次
|
||||
user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟
|
||||
user.password.delete=对不起,您的账号已被删除
|
||||
user.blocked=用户已封禁,请联系管理员
|
||||
role.blocked=角色已封禁,请联系管理员
|
||||
user.logout.success=退出成功
|
||||
|
||||
length.not.valid=长度必须在{min}到{max}个字符之间
|
||||
|
||||
user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
|
||||
user.password.not.valid=* 5-50个字符
|
||||
|
||||
user.email.not.valid=邮箱格式错误
|
||||
user.mobile.phone.number.not.valid=手机号格式错误
|
||||
user.login.success=登录成功
|
||||
user.register.success=注册成功
|
||||
user.notfound=请重新登录
|
||||
user.forcelogout=管理员强制退出,请重新登录
|
||||
user.unknown.error=未知错误,请重新登录
|
||||
|
||||
##文件上传消息
|
||||
upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB!
|
||||
upload.filename.exceed.length=上传的文件名最长{0}个字符
|
||||
|
||||
##权限
|
||||
no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]
|
|
@ -0,0 +1,142 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 当天实时日志输出 -->
|
||||
<appender name="file_console" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-console.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-console.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 2天 -->
|
||||
<maxHistory>7</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<!-- <level>INFO</level>-->
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-debug.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-debug.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>10</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 DEBUG-->
|
||||
<level>DEBUG</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>100</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>100</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 用户访问日志输出 -->
|
||||
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-user.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 按天回滚 daily -->
|
||||
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>100</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.bnhz" level="debug" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_debug"/>
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
<appender-ref ref="file_console" />
|
||||
</root>
|
||||
|
||||
<!--系统用户操作日志-->
|
||||
<logger name="sys-user" level="info">
|
||||
<appender-ref ref="sys-user"/>
|
||||
</logger>
|
||||
</configuration>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
<!-- 全局参数 -->
|
||||
<settings>
|
||||
<!-- 使全局的映射器启用或禁用缓存 -->
|
||||
<setting name="cacheEnabled" value="true" />
|
||||
<!-- 允许JDBC 支持自动生成主键 -->
|
||||
<setting name="useGeneratedKeys" value="true" />
|
||||
<!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
|
||||
<setting name="defaultExecutorType" value="SIMPLE" />
|
||||
<!-- 指定 MyBatis 所用日志的具体实现 -->
|
||||
<setting name="logImpl" value="SLF4J" />
|
||||
<!-- 使用驼峰命名法转换字段 -->
|
||||
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
|
||||
</settings>
|
||||
|
||||
</configuration>
|
|
@ -0,0 +1,29 @@
|
|||
package com.bnhz;
|
||||
|
||||
import com.bnhz.adapter.model.blackcar.Point;
|
||||
import com.bnhz.adapter.service.blackcar.impl.BlackCarServiceImpl;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.annotation.Rollback;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/7/3 17:29
|
||||
*/
|
||||
@ActiveProfiles("test")
|
||||
@SpringBootTest
|
||||
@Disabled
|
||||
public class BlackCarTest {
|
||||
|
||||
@Autowired
|
||||
private BlackCarServiceImpl blackCarService;
|
||||
|
||||
@Test
|
||||
@Rollback
|
||||
public void initModelTest() {
|
||||
blackCarService.initModel(new Point(), 999L, "测试模型导入");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
package com.bnhz;
|
||||
|
||||
import com.bnhz.adapter.model.fumes.FumesOneMin;
|
||||
import com.bnhz.adapter.service.fumes.IFumesService;
|
||||
import com.bnhz.adapter.util.ThingsModelUtils;
|
||||
import com.bnhz.common.constant.BnhzConstant;
|
||||
import com.bnhz.common.utils.reflect.ReflectUtils;
|
||||
import com.bnhz.iot.domain.ThingsModel;
|
||||
import com.bnhz.iot.model.ThingsModels.ThingsModelEventVO;
|
||||
import com.bnhz.iot.model.ThingsModels.ThingsModelQuery;
|
||||
import com.bnhz.iot.service.IEventLogService;
|
||||
import com.bnhz.iot.service.IThingsModelService;
|
||||
import com.bnhz.iot.tdengine.service.IColumnModeOperationsService;
|
||||
import lombok.SneakyThrows;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/7/2 14:00
|
||||
*/
|
||||
@ActiveProfiles("test")
|
||||
@SpringBootTest
|
||||
@Disabled
|
||||
public class FumesTest {
|
||||
|
||||
@Autowired
|
||||
private IFumesService fumesService;
|
||||
|
||||
@Autowired
|
||||
private IEventLogService eventLogService;
|
||||
|
||||
@Autowired
|
||||
private IThingsModelService thingsModelService;
|
||||
|
||||
@Autowired
|
||||
private IColumnModeOperationsService columnModeOperationsService;
|
||||
|
||||
|
||||
@Test
|
||||
public void syncDeviceTest() {
|
||||
fumesService.syncDevice();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void syncAlarmMsgTest() {
|
||||
fumesService.syncAlarmMsg();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void syncDetectorTest() {
|
||||
fumesService.syncDetector();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void syncTenDataTest() {
|
||||
fumesService.syncTenData();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void syncOneDataTest() {
|
||||
fumesService.syncOneData();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void syncPointEventTest() {
|
||||
fumesService.syncPointEvent();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void syncReduceTest() {
|
||||
fumesService.syncReduce();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void syncRealTimeDataTest() {
|
||||
fumesService.syncRealTimeData();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void listColumnEventTest() {
|
||||
ThingsModelQuery thingsModelQuery = new ThingsModelQuery();
|
||||
thingsModelQuery.setProductId(163L);
|
||||
thingsModelQuery.setModelId(1313L);
|
||||
thingsModelQuery.setDeviceId(437L);
|
||||
thingsModelQuery.setStartDateTime(LocalDateTime.now().minusDays(5));
|
||||
thingsModelQuery.setEndDateTime(LocalDateTime.now());
|
||||
List<Map<String, Object>> maps = eventLogService.listColumnEvent(thingsModelQuery);
|
||||
System.out.println(maps.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void listEventModeListTest() {
|
||||
List<ThingsModelEventVO> thingsModelEventVOS = thingsModelService.listEventModeList(163L);
|
||||
System.out.println(thingsModelEventVOS);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Test
|
||||
public void initOneDataTest() {
|
||||
Map<String, ReflectUtils.FieldInfo> oneAllFields = ReflectUtils.getAllFields(new FumesOneMin());
|
||||
ThingsModel oneModel = ThingsModelUtils.toEventThingsModel(oneAllFields, 198L, "餐饮油烟点位设备", "一分钟数据", BnhzConstant.FumesEvent.ONE_DATA);
|
||||
thingsModelService.insertThingsModel(oneModel);
|
||||
columnModeOperationsService.ddl(198L, Arrays.asList(oneModel));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
package com.bnhz;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bnhz.adapter.model.blackcar.Point;
|
||||
import com.bnhz.adapter.model.fumes.FumesAlarmMsg;
|
||||
import com.bnhz.adapter.util.ThingsModelUtils;
|
||||
import com.bnhz.common.core.thingsModel.ThingsModelSimpleItem;
|
||||
import com.bnhz.common.core.thingsModel.ThingsModelValuesInput;
|
||||
import com.bnhz.common.utils.reflect.ReflectUtils;
|
||||
import com.bnhz.iot.domain.ThingsModel;
|
||||
import com.bnhz.iot.model.ThingsModels.ThingsModelQuery;
|
||||
import com.bnhz.iot.model.dto.ColumnDto;
|
||||
import com.bnhz.iot.tdengine.dao.TDDynamicDAO;
|
||||
import com.bnhz.iot.tdengine.service.IColumnModeOperationsService;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/6/27 11:24
|
||||
*/
|
||||
@ActiveProfiles("test")
|
||||
@SpringBootTest
|
||||
@Disabled
|
||||
public class TDengineTest {
|
||||
|
||||
@Autowired
|
||||
private IColumnModeOperationsService columnModeOperationsService;
|
||||
|
||||
@Autowired
|
||||
private TDDynamicDAO tdDynamicDAO;
|
||||
|
||||
|
||||
@Test
|
||||
public void ddlTest() {
|
||||
String json = "{\"templateId\":null,\"templateName\":\"测试DDL\",\"userId\":null,\"userName\":null,\"tenantId\":null,\"tenantName\":null,\"identifier\":\"abc\",\"modelOrder\":0,\"type\":\"3\",\"datatype\":\"object\",\"isSys\":null,\"isChart\":0,\"isHistory\":1,\"isMonitor\":0,\"isReadonly\":1,\"isSharePerm\":0,\"delFlag\":null,\"createBy\":\"admin\",\"createTime\":null,\"updateBy\":null,\"updateTime\":null,\"remark\":null,\"owner\":null,\"specs\":\"{\\\"type\\\":\\\"object\\\",\\\"params\\\":[{\\\"name\\\":\\\"二硫化碳天累计值\\\",\\\"id\\\":\\\"abc_a99051-Cou-D\\\",\\\"order\\\":1,\\\"datatype\\\":{\\\"type\\\":\\\"decimal\\\",\\\"min\\\":0,\\\"max\\\":1000,\\\"unit\\\":\\\"毫克/立方米\\\",\\\"step\\\":1},\\\"isChart\\\":0,\\\"isHistory\\\":1,\\\"isSharePerm\\\":0,\\\"isMonitor\\\":1,\\\"isReadonly\\\":1},{\\\"name\\\":\\\"二硫化碳时累计值\\\",\\\"id\\\":\\\"abc_a99051-Cou-H\\\",\\\"order\\\":1,\\\"datatype\\\":{\\\"type\\\":\\\"decimal\\\",\\\"min\\\":0,\\\"max\\\":1000,\\\"unit\\\":\\\"毫克/立方米\\\",\\\"step\\\":1},\\\"isChart\\\":0,\\\"isHistory\\\":1,\\\"isSharePerm\\\":0,\\\"isMonitor\\\":1,\\\"isReadonly\\\":1},{\\\"name\\\":\\\"丙烯腈时累计值\\\",\\\"id\\\":\\\"abc_a99010-Cou-H\\\",\\\"order\\\":1,\\\"datatype\\\":{\\\"type\\\":\\\"decimal\\\",\\\"min\\\":0,\\\"max\\\":1000,\\\"unit\\\":\\\"毫克/立方米\\\",\\\"step\\\":1},\\\"isChart\\\":0,\\\"isHistory\\\":1,\\\"isSharePerm\\\":0,\\\"isMonitor\\\":1,\\\"isReadonly\\\":1}]}\"}";
|
||||
ThingsModel thingsModel = JSONObject.parseObject(json, ThingsModel.class);
|
||||
thingsModel.setProductId(1L);
|
||||
thingsModel.setModelId(1000L);
|
||||
columnModeOperationsService.ddl(thingsModel.getProductId(), Arrays.asList(thingsModel));
|
||||
|
||||
columnModeOperationsService.save(mockThingsModelValuesInput());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ddlEntityTest() throws IllegalAccessException {
|
||||
Map<String, ReflectUtils.FieldInfo> allFields = ReflectUtils.getAllFields(new Point());
|
||||
Long productId = 1L;
|
||||
List<ThingsModel> propertyThingsModel = ThingsModelUtils.toPropertyThingsModel(allFields, productId, "测试产品2");
|
||||
columnModeOperationsService.ddl(productId, propertyThingsModel);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void queryTest() {
|
||||
//columnModeOperationsService.save(mockThingsModelValuesInput());
|
||||
ThingsModelQuery thingsModelQuery = new ThingsModelQuery();
|
||||
thingsModelQuery.setType(3);
|
||||
thingsModelQuery.setProductId(164L);
|
||||
thingsModelQuery.setDeviceId(1L);
|
||||
thingsModelQuery.setModelId(1514L);
|
||||
thingsModelQuery.setStartDateTime(LocalDateTime.now().minusDays(2));
|
||||
thingsModelQuery.setEndDateTime(LocalDateTime.now());
|
||||
thingsModelQuery.setOrderField("create_time");
|
||||
List<Map<String, Object>> query = columnModeOperationsService.query(thingsModelQuery);
|
||||
System.out.println(query.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void columnNameTest() {
|
||||
Set<String> columnNames = tdDynamicDAO.queryColumnName("daqi_log", "abc");
|
||||
System.out.println(columnNames);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tableNameTest() {
|
||||
Set<String> tableList = tdDynamicDAO.queryTableList("daqi_log");
|
||||
System.out.println(tableList);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addColumnTest() {
|
||||
ColumnDto columnDto = new ColumnDto();
|
||||
columnDto.setColumnName("a_b_c");
|
||||
columnDto.setType("string");
|
||||
tdDynamicDAO.addColumn("daqi_log", "event_999_1473", columnDto);
|
||||
}
|
||||
|
||||
private ThingsModelValuesInput mockThingsModelValuesInput() {
|
||||
ThingsModelValuesInput thingsModelValuesInput = new ThingsModelValuesInput();
|
||||
thingsModelValuesInput.setDataTime(LocalDateTime.now().minusDays(1));
|
||||
thingsModelValuesInput.setType(3);
|
||||
thingsModelValuesInput.setProductId(1L);
|
||||
thingsModelValuesInput.setDeviceId(1L);
|
||||
thingsModelValuesInput.setModelId(1000L);
|
||||
thingsModelValuesInput.setDeviceNumber("S001");
|
||||
ThingsModelSimpleItem thingsModelSimpleItem1 = new ThingsModelSimpleItem();
|
||||
thingsModelSimpleItem1.setId("a99010_cou_h");
|
||||
thingsModelSimpleItem1.setValue("10.2");
|
||||
ThingsModelSimpleItem thingsModelSimpleItem2 = new ThingsModelSimpleItem();
|
||||
thingsModelSimpleItem2.setId("a99051_cou_d");
|
||||
thingsModelSimpleItem2.setValue("10.3");
|
||||
ThingsModelSimpleItem thingsModelSimpleItem3 = new ThingsModelSimpleItem();
|
||||
thingsModelSimpleItem3.setId("a99051_cou_h");
|
||||
thingsModelSimpleItem3.setValue("10.4");
|
||||
thingsModelValuesInput.setThingsModelValueRemarkItem(Arrays.asList(thingsModelSimpleItem1, thingsModelSimpleItem2, thingsModelSimpleItem3));
|
||||
return thingsModelValuesInput;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package com.bnhz;
|
||||
|
||||
import com.bnhz.adapter.service.video.impl.HighObsServiceImpl;
|
||||
import com.bnhz.adapter.service.video.impl.HuaZhiVideoMonitorServiceImpl;
|
||||
import com.bnhz.common.constant.BnhzConstant;
|
||||
import com.bnhz.common.core.page.PageResult;
|
||||
import com.bnhz.iot.model.ext.video.VideoDeviceInfoVO;
|
||||
import com.bnhz.iot.model.videoMonitor.*;
|
||||
import com.bnhz.iot.model.videoMonitor.res.HighObsPlayBackRes;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/6/11 11:32
|
||||
*/
|
||||
@ActiveProfiles("test")
|
||||
@SpringBootTest
|
||||
@Disabled
|
||||
public class VideoMonitorTest {
|
||||
|
||||
@Autowired
|
||||
private HuaZhiVideoMonitorServiceImpl huaZhiVideoMonitorServiceImpl;
|
||||
|
||||
@Autowired
|
||||
private HighObsServiceImpl highObsServiceImpl;
|
||||
|
||||
|
||||
@Test
|
||||
public void listWithDeviceTest() {
|
||||
VideoMonitorResult<VideoMonitorPage<VideoMonitorPointVO>> videoMonitorPageVideoMonitorResult = huaZhiVideoMonitorServiceImpl.listWithDevice(1, 100);
|
||||
System.out.println(videoMonitorPageVideoMonitorResult.getErrorCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getLiveStreamTest() {
|
||||
VideoMonitorLiveStreamQuery videoMonitorLiveStreamQuery = new VideoMonitorLiveStreamQuery();
|
||||
videoMonitorLiveStreamQuery.setChannelCode("10000000001311000070");
|
||||
videoMonitorLiveStreamQuery.setStreamType(0);
|
||||
videoMonitorLiveStreamQuery.setStreamMode(5);
|
||||
String liveStream = huaZhiVideoMonitorServiceImpl.getLiveStream(videoMonitorLiveStreamQuery);
|
||||
System.out.println(liveStream);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getVideoDevicePageHuaZhiTest() {
|
||||
PageResult<VideoDeviceInfoVO> videoDevicePage = huaZhiVideoMonitorServiceImpl.getVideoDevicePage(1, 100);
|
||||
System.out.println(videoDevicePage.getTotal());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getLiveStreamHuzZhiTest() {
|
||||
String liveStream = huaZhiVideoMonitorServiceImpl.getLiveStream("10000000001311000070", "hsl");
|
||||
System.out.println(liveStream);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getVideoDevicePageHighObsTest() {
|
||||
PageResult<VideoDeviceInfoVO> videoDevicePage = highObsServiceImpl.getVideoDevicePage(1, 100);
|
||||
System.out.println(videoDevicePage.getTotal());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getLiveStreamHighObsTest() {
|
||||
String liveStream = highObsServiceImpl.getLiveStream("107203ff6b48480b97b8dda4dc1d108e", BnhzConstant.VideoProtocol.RTSP);
|
||||
System.out.println(liveStream);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void huaZhiSyncTest() {
|
||||
huaZhiVideoMonitorServiceImpl.syncDevice();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void highObsSyncTest() {
|
||||
highObsServiceImpl.syncDevice();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getFireAlarmHistoriesTest() {
|
||||
HighObsResult<HighObsResult.Page<FireAlarmHistory>> fireAlarmHistories = highObsServiceImpl.getFireAlarmHistories(null, null, 2, 1000);
|
||||
System.out.println(fireAlarmHistories.getData());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void syncFireHistoriesTest() {
|
||||
highObsServiceImpl.syncFireHistories();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void syncJudgeTest() {
|
||||
highObsServiceImpl.syncJudgeList();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getJudgeList() {
|
||||
HighObsResult<HighObsResult.Page<FireAlarmHistory>> fireAlarmHistories = highObsServiceImpl.getJudgeList(null, null, 1, 1000);
|
||||
System.out.println(fireAlarmHistories.getData());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPlayBackTest() {
|
||||
HighObsResult<HighObsPlayBackRes> playBack = highObsServiceImpl.getPlayBack("f670c60e4c3e4e72b86ef15e44be5828", LocalDateTime.of(2024, 7, 3, 6, 20,0), LocalDateTime.of(2024, 7, 3, 6, 30,0));
|
||||
System.out.println(playBack);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.bnhz.common;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.redisson.api.RBloomFilter;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @date 2024/9/9 16:29
|
||||
*/
|
||||
@ActiveProfiles("test")
|
||||
@SpringBootTest
|
||||
@Disabled
|
||||
public class RedissonTest {
|
||||
|
||||
|
||||
@Autowired
|
||||
private RedissonClient redissonClient;
|
||||
|
||||
@Test
|
||||
public void bloomFilterTest() {
|
||||
RBloomFilter<String> bloomFilter = redissonClient.getBloomFilter("phoneList");
|
||||
//初始化布隆过滤器:预计元素为100000000L,误差率为3%
|
||||
bloomFilter.tryInit(5000000L, 0.03);
|
||||
//将号码10086插入到布隆过滤器中
|
||||
bloomFilter.add("10086");
|
||||
|
||||
//判断下面号码是否在布隆过滤器中
|
||||
System.out.println(bloomFilter.contains("123456"));//false
|
||||
System.out.println(bloomFilter.contains("10086"));//true
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,200 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>daqi-back</artifactId>
|
||||
<groupId>com.bnhz</groupId>
|
||||
<version>3.8.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>bnhz-common</artifactId>
|
||||
|
||||
<description>
|
||||
common通用工具
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- Spring框架基本的核心工具 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringWeb模块 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- spring security 安全认证 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- mybatis-plus -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-generator</artifactId>
|
||||
<version>${mybatis-plus-generator.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- pagehelper 分页插件 -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 自定义验证注解 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--常用工具类 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JSON工具类 -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 动态数据源 -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
<version>3.5.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里JSON解析器 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- io常用工具类 -->
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 文件上传工具类 -->
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- excel工具 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- yml解析器 -->
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Token生成与解析-->
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Jaxb -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- redis 缓存操作 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- pool 对象池 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 解析客户端操作系统、浏览器等 -->
|
||||
<dependency>
|
||||
<groupId>eu.bitwalker</groupId>
|
||||
<artifactId>UserAgentUtils</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- servlet包 -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.6.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.paho</groupId>
|
||||
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||
<version>1.2.5</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.redisson</groupId>-->
|
||||
<!-- <artifactId>redisson-spring-boot-starter</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 短信快捷包 -->
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-spring-boot-starter</artifactId>
|
||||
<version>3.0.4</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,19 @@
|
|||
package com.bnhz.common.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 匿名访问不鉴权注解
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Target({ ElementType.METHOD, ElementType.TYPE })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface Anonymous
|
||||
{
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.bnhz.common.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 此注解下表示新增的api接口
|
||||
*
|
||||
* @author Leo
|
||||
* @date 2024/7/2 18:00
|
||||
*/
|
||||
|
||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface ApiAdd {
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue