| | |
| | | </dependency> |
| | | |
| | | <!-- 通用工具--> |
| | | <dependency> |
| | | <groupId>commons-codec</groupId> |
| | | <artifactId>commons-codec</artifactId> |
| | | <version>1.10</version> |
| | | </dependency> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>commons-codec</groupId>--> |
| | | <!-- <artifactId>commons-codec</artifactId>--> |
| | | <!-- <version>1.10</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-common</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </dependency> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.projectlombok</groupId>--> |
| | | <!-- <artifactId>lombok</artifactId>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <!--海康录像机二次开发依赖jar包--> |
| | | <dependency> |
| | |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <configuration> |
| | | <includeSystemScope>true</includeSystemScope> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | </project> |
| | |
| | | @GetMapping("/List") |
| | | @ApiOperation(value = "历史报警聚合接口",notes = "通过command和时间查询历史数据") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name="command",value="报警标识",dataType="integer",paramType="query",example="1001",required=true), |
| | | @ApiImplicitParam(name="beginTime",value="开始时间",dataType="string",paramType="query",example="2023-06-15 00:00:00",required=true), |
| | | @ApiImplicitParam(name="endTime",value="结束时间",dataType="string",paramType="query",example="2023-06-15 14:18:23",required=true), |
| | | @ApiImplicitParam(name="pageNum",value="页码",dataType="integer",paramType="query",example="1",required=true), |
| | | @ApiImplicitParam(name="pageSize",value="页数量",dataType="integer",paramType="query",example="10",required=true) |
| | | @ApiImplicitParam(name="command",value="报警标识",dataType="integer",paramType="query",example="1001",required=true,dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name="beginTime",value="开始时间",dataType="string",paramType="query",example="2023-06-15 00:00:00",required=true,dataTypeClass = String.class), |
| | | @ApiImplicitParam(name="endTime",value="结束时间",dataType="string",paramType="query",example="2023-06-15 14:18:23",required=true,dataTypeClass = String.class), |
| | | @ApiImplicitParam(name="pageNum",value="页码",dataType="integer",paramType="query",example="1",required=true,dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name="pageSize",value="页数量",dataType="integer",paramType="query",example="10",required=true,dataTypeClass = Integer.class) |
| | | }) |
| | | public TableDataInfo selectAlarmList(Integer command, String beginTime, String endTime,Integer pageNum,Integer pageSize) { |
| | | startPage(); |
| | |
| | | domainUrl = getYmlNew("minio.endpoint"); |
| | | accessKey = getYmlNew("minio.accessKey"); |
| | | secretKey = getYmlNew("minio.secretKey"); |
| | | log.info("minio信息:" + domainUrl + "(" + accessKey + "/" + secretKey + ")"); |
| | | log.debug("minio信息:" + domainUrl + "(" + accessKey + "/" + secretKey + ")"); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.common.annotation.SdkOperate; |
| | | import com.ruoyi.common.utils.file.FileUtils; |
| | | import com.ruoyi.device.camera.domain.CameraCmd; |
| | | import com.ruoyi.device.camera.mapper.ArdCamerasMapper; |
| | | import com.ruoyi.device.camera.service.IArdCamerasService; |
| | | import com.ruoyi.device.hiksdk.common.GlobalVariable; |
| | | import com.ruoyi.device.camera.domain.ArdCameras; |
| | |
| | | import com.sun.jna.ptr.IntByReference; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import sun.misc.BASE64Encoder; |
| | | import java.util.Base64; |
| | | import javax.annotation.Resource; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | |
| | | } |
| | | //打印海康sdk日志 |
| | | if (Platform.isWindows()) { |
| | | |
| | | String WIN_PATH = System.getProperty("user.dir") + File.separator + "ardLog" + File.separator + "logs" + File.separator; |
| | | hCNetSDK.NET_DVR_SetLogToFile(3, WIN_PATH, true); |
| | | } else { |
| | |
| | | boolean is = hCNetSDK.NET_DVR_CaptureJPEGPicture_NEW(userId, channelNum, jpeg, jpegBuffer, 1024 * 1024, a); |
| | | log.info("-----------这里开始图片存入内存----------" + is); |
| | | |
| | | BASE64Encoder encoder = new BASE64Encoder(); |
| | | String png_base64 = encoder.encodeBuffer(jpegBuffer);//转换成base64串 |
| | | Base64.Encoder decoder = Base64.getEncoder(); |
| | | // BASE64Encoder encoder = new BASE64Encoder(); |
| | | String png_base64 = decoder.encodeToString(jpegBuffer.array());//转换成base64串 |
| | | png_base64 = png_base64.replaceAll("\n", "").replaceAll("\r", "");//删除 \r\n |
| | | log.info("-----------处理完成截图数据----------"); |
| | | return png_base64; |
| | |
| | | } |
| | | if (dwResult == 1) { |
| | | GlobalVariable.loginMap.put(camera.getId(), lUserID); |
| | | log.info(camera.getIp() + ":" + camera.getPort() + "登录成功"); |
| | | log.debug(camera.getIp() + ":" + camera.getPort() + "登录成功"); |
| | | camera.setLoginId(lUserID); |
| | | camera.setChannel((int) lpDeviceinfo.byChanNum); |
| | | //创建引导队列 |
| | |
| | | PriorityBlockingQueue<GuideTask> priorityQueue = new PriorityBlockingQueue<>(1000,comparator); |
| | | GuidePriorityQueue.cameraQueueMap.put(camera.getId(), priorityQueue); |
| | | } else { |
| | | log.info(camera.getIp() + ":" + camera.getPort() + "登录失败"); |
| | | log.debug(camera.getIp() + ":" + camera.getPort() + "登录失败"); |
| | | camera.setChannel(0); |
| | | camera.setLoginId(-1); |
| | | } |
| | |
| | | package com.ruoyi.utils.forest; |
| | | |
| | | import com.dtflys.forest.annotation.DataVariable; |
| | | import com.dtflys.forest.annotation.Get; |
| | | import com.dtflys.forest.annotation.JSONBody; |
| | | import com.dtflys.forest.annotation.Post; |
| | | import com.dtflys.forest.annotation.*; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | @UavAuth(token = "${token}") |
| | | @Get(IP + "${url}") |
| | | String GET(@DataVariable("url") String url, @DataVariable("token") String token, @JSONBody String body); |
| | | String GET(@Var("url") String url, @Var("token") String token, @JSONBody String body); |
| | | |
| | | @UavAuth(token = "${token}") |
| | | @Post(IP + "${url}") |
| | | String POST(@DataVariable("url") String url, @DataVariable("token") String token, @JSONBody String body); |
| | | String POST(@Var("url") String url, @Var("token") String token, @JSONBody String body); |
| | | @UavAuth(token = "${token}") |
| | | @Post(IP + "${url}") |
| | | String DELETE(@DataVariable("url") String url, @DataVariable("token") String token, @JSONBody String body); |
| | | String DELETE(@Var("url") String url, @Var("token") String token, @JSONBody String body); |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @Override |
| | | public void run(ApplicationArguments args) { |
| | | log.info("初始化并启动mqtt......"); |
| | | log.debug("初始化并启动mqtt......"); |
| | | if(PropertiesUtil.MQTT_ENABLED) |
| | | { |
| | | this.connect(); |
| | |
| | | if (null == client) { |
| | | client = new MqttClient(PropertiesUtil.MQTT_HOST, PropertiesUtil.MQTT_CLIENT_ID, new MemoryPersistence()); |
| | | } |
| | | log.info("--创建mqtt客户端"); |
| | | log.debug("--创建mqtt客户端"); |
| | | } catch (Exception e) { |
| | | log.error("创建mqtt客户端异常:" + e); |
| | | } |
| | |
| | | options.setKeepAliveInterval(PropertiesUtil.MQTT_KEEP_ALIVE); |
| | | // 是否清除session |
| | | options.setCleanSession(true); |
| | | log.info("--生成mqtt配置对象"); |
| | | log.debug("--生成mqtt配置对象"); |
| | | return options; |
| | | } |
| | | |
| | |
| | | */ |
| | | qos[i] = 1; |
| | | } |
| | | log.info("--设置消息发布质量"); |
| | | log.debug("--设置消息发布质量"); |
| | | return qos; |
| | | } |
| | | |
| | |
| | | public void create(MqttConnectOptions options, String[] topic, int[] qos) { |
| | | try { |
| | | client.setCallback(new MqttConsumerCallback(client, options, topic, qos)); |
| | | log.info("--添加回调处理类"); |
| | | log.debug("--添加回调处理类"); |
| | | client.connect(options); |
| | | } catch (Exception e) { |
| | | log.info("装载实例或订阅主题异常:" + e); |
| | | log.error("装载实例或订阅主题异常:" + e); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | public void subscribe(String topic, int qos) { |
| | | try { |
| | | log.info("topic:" + topic); |
| | | log.debug("topic:" + topic); |
| | | client.subscribe(topic, qos); |
| | | } catch (MqttException e) { |
| | | e.printStackTrace(); |
| | |
| | | * 发布 |
| | | */ |
| | | public static void publish(int qos, boolean retained, String topic, String pushMessage) { |
| | | log.info("【主题】:" + topic + "【qos】:" + qos + "【pushMessage】:" + pushMessage); |
| | | log.debug("【主题】:" + topic + "【qos】:" + qos + "【pushMessage】:" + pushMessage); |
| | | MqttMessage message = new MqttMessage(); |
| | | message.setQos(qos); |
| | | message.setRetained(retained); |
| | |
| | | token = mTopic.publish(message); |
| | | token.waitForCompletion(); |
| | | if (token.isComplete()) { |
| | | log.info("消息发送成功"); |
| | | log.debug("消息发送成功"); |
| | | } |
| | | } catch (MqttPersistenceException e) { |
| | | e.printStackTrace(); |
| | |
| | | </buildArgs> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | </plugin> |
| | | </plugins> |
| | | <finalName>${project.artifactId}</finalName> |
| | | </build> |
| | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Size; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 部门ID */ |
| | | @TableId |
| | | private Long deptId; |
| | | |
| | | /** 父部门ID */ |
| | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import com.ruoyi.common.annotation.Excel.ColumnType; |
| | |
| | | * 用户ID |
| | | */ |
| | | @Excel(name = "用户序号", cellType = ColumnType.STRING, prompt = "用户编号") |
| | | @TableId |
| | | private String userId; |
| | | |
| | | /** |