ard-work/pom.xml
@@ -14,6 +14,12 @@ </description> <dependencies> <dependency> <groupId>net.sf.ucanaccess</groupId> <artifactId>ucanaccess</artifactId> <version>5.0.1</version> </dependency> <!-- 通用工具--> <dependency> <groupId>commons-codec</groupId> ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java
@@ -58,6 +58,13 @@ return getDataTable(list); } @PreAuthorize("@ss.hasPermi('alarmpoints:well:list')") @GetMapping("/nonPageList") @ApiOperation("查询井列表-不分页") public AjaxResult nonPageList(ArdAlarmpointsWell ardAlarmpointsWell) { List<ArdAlarmpointsWell> list = ardAlarmpointsWellService.selectArdAlarmpointsWellList(ardAlarmpointsWell); return success(list); } /** * 导出井管理列表 */ ard-work/src/main/java/com/ruoyi/app/position/controller/ArdAppPositionController.java
File was renamed from ard-work/src/main/java/com/ruoyi/app/controller/ArdAppPositionController.java @@ -1,19 +1,28 @@ package com.ruoyi.app.controller; package com.ruoyi.app.position.controller; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.ruoyi.app.domain.ArdAppPosition; import com.ruoyi.app.service.IArdAppPositionService; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.app.position.domain.ArdAppPosition; import com.ruoyi.app.position.service.IArdAppPositionService; import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.device.hiksdk.util.minio.MinioUtils; import com.ruoyi.rongcloud.service.RongCloudService; import com.ruoyi.system.domain.SysUserOnline; import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysUserOnlineService; import com.ruoyi.system.service.ISysUserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; @@ -27,12 +36,9 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.core.page.TableDataInfo; import org.springframework.web.multipart.MultipartFile; import java.util.ArrayList; import java.util.List; import java.util.Set; import static org.bytedeco.javacv.FrameGrabber.list; import java.util.*; /** * app位置Controller @@ -50,7 +56,7 @@ @Autowired private ISysUserService sysUserService; @Autowired private ISysRoleService roleService; private RongCloudService rongCloudService; /** * 查询app位置列表 @@ -134,6 +140,58 @@ return AjaxResult.success(list); } /** * 获取所有app用户 */ @ApiOperation("获取所有app用户") @GetMapping("/getAppUserlist") public AjaxResult getAppUserlist(Long deptId) { SysUser user=new SysUser(); user.setDeptId(deptId); List<SysUser> list = sysUserService.selectAppUserList(user); return AjaxResult.success(list); } /** * 获取所有app用户 */ @ApiOperation("获取所有app用户pc") @GetMapping("/getAppUserForPclist") public AjaxResult getAppUserForPclist(Long deptId) { SysUser user=new SysUser(); user.setDeptId(deptId); List<SysUser> list = sysUserService.selectAppUserList(user); List<SysUser> onLineList=new ArrayList<>(); List<SysUser> offLineList=new ArrayList<>(); for(SysUser sysUser:list) { Boolean online = rongCloudService.checkOnline(sysUser.getUserId()); if(online) { onLineList.add(sysUser); } else { offLineList.add(sysUser); } } Map<String,Object> onlineMap=new HashMap<>(); onlineMap.put("children",onLineList); onlineMap.put("name","在线用户("+onLineList.size()+")"); onlineMap.put("disabled",true); onlineMap.put("id","onLine"); Map<String,Object> offlineMap=new HashMap<>(); offlineMap.put("children",offLineList); offlineMap.put("name","离线用户("+offLineList.size()+")"); offlineMap.put("disabled",true); offlineMap.put("id","offLine"); List< Map<String,Object> > lists = new ArrayList<>(); lists.add(onlineMap); lists.add(offlineMap); return AjaxResult.success(lists); } /** * 获取用户详情 */ @ApiOperation("获取用户详情") @@ -143,4 +201,11 @@ SysUser sysUser = sysUserService.selectUserById(userId); return AjaxResult.success(sysUser); } @PostMapping("/uploadFile") @ApiOperation("上传文件") public AjaxResult uploadFile(MultipartFile file,String type) { String url = MinioUtils.putObjectAndGetUrl("app",type, file); return AjaxResult.success(url); } } ard-work/src/main/java/com/ruoyi/app/position/domain/ArdAppPosition.java
File was renamed from ard-work/src/main/java/com/ruoyi/app/domain/ArdAppPosition.java @@ -1,4 +1,4 @@ package com.ruoyi.app.domain; package com.ruoyi.app.position.domain; import lombok.Data; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; ard-work/src/main/java/com/ruoyi/app/position/mapper/ArdAppPositionMapper.java
File was renamed from ard-work/src/main/java/com/ruoyi/app/mapper/ArdAppPositionMapper.java @@ -1,7 +1,7 @@ package com.ruoyi.app.mapper; package com.ruoyi.app.position.mapper; import java.util.List; import com.ruoyi.app.domain.ArdAppPosition; import com.ruoyi.app.position.domain.ArdAppPosition; /** ard-work/src/main/java/com/ruoyi/app/position/service/IArdAppPositionService.java
File was renamed from ard-work/src/main/java/com/ruoyi/app/service/IArdAppPositionService.java @@ -1,7 +1,7 @@ package com.ruoyi.app.service; package com.ruoyi.app.position.service; import java.util.List; import com.ruoyi.app.domain.ArdAppPosition; import com.ruoyi.app.position.domain.ArdAppPosition; /** ard-work/src/main/java/com/ruoyi/app/position/service/impl/ArdAppPositionServiceImpl.java
File was renamed from ard-work/src/main/java/com/ruoyi/app/service/impl/ArdAppPositionServiceImpl.java @@ -1,12 +1,10 @@ package com.ruoyi.app.service.impl; package com.ruoyi.app.position.service.impl; import com.ruoyi.app.domain.ArdAppPosition; import com.ruoyi.app.mapper.ArdAppPositionMapper; import com.ruoyi.app.service.IArdAppPositionService; import com.ruoyi.app.position.domain.ArdAppPosition; import com.ruoyi.app.position.mapper.ArdAppPositionMapper; import com.ruoyi.app.position.service.IArdAppPositionService; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.uuid.IdUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; ard-work/src/main/java/com/ruoyi/device/hiksdk/util/minio/MinioUtils.java
@@ -10,6 +10,7 @@ import io.minio.messages.Item; import lombok.extern.slf4j.Slf4j; import org.springframework.web.multipart.MultipartFile; import java.io.*; import java.util.*; import java.util.concurrent.TimeUnit; @@ -151,15 +152,14 @@ boolean exsit = exitsBucket(bucketName); if (!exsit) { boolean bucket = createBucket(bucketName); if(bucket) { if (bucket) { log.info(bucketName + "-桶不存在,成功创建桶"); } } //文件名 String originalFilename = file.getOriginalFilename(); //新的文件名 String fileName = IdUtils.fastSimpleUUID()+"_"+ originalFilename; String fileName = IdUtils.fastSimpleUUID() + "_" + originalFilename; try { InputStream inputStream = file.getInputStream(); /*上传对象*/ @@ -180,7 +180,59 @@ .method(Method.GET) .build(); String presignedObjectUrl = MinioClientSingleton.getMinioClient().getPresignedObjectUrl(getPresignedObjectUrlArgs); String ObjectUrl = presignedObjectUrl.substring(0, presignedObjectUrl.indexOf("?")); String ObjectUrl = presignedObjectUrl.substring(0, presignedObjectUrl.indexOf("?")); return ObjectUrl; } catch (Exception ex) { log.error("上传对象返回url异常:" + ex.getMessage()); } return ""; } /** * @描述 上传MultipartFile文件返回url * @参数 [bucketName, file] * @返回值 java.lang.String * @创建人 刘苏义 * @创建时间 2023/5/18 12:16 * @修改人和其它信息 */ public static String putObjectAndGetUrl(String bucketName, String folder, MultipartFile file) { //判断文件是否为空 if (null == file || 0 == file.getSize()) { log.error("上传minio文件服务器错误,上传文件为空"); } boolean exsit = exitsBucket(bucketName); if (!exsit) { boolean bucket = createBucket(bucketName); if (bucket) { log.info(bucketName + "-桶不存在,成功创建桶"); } } //文件名 String originalFilename = file.getOriginalFilename(); //新的文件名 String fileName = folder + "/" + IdUtils.fastSimpleUUID() + "_" + originalFilename; try { InputStream inputStream = file.getInputStream(); /*上传对象*/ PutObjectArgs putObjectArgs = PutObjectArgs .builder() .bucket(bucketName) .object(fileName) .stream(inputStream, file.getSize(), -1) .contentType(file.getContentType()) .build(); MinioClientSingleton.getMinioClient().putObject(putObjectArgs); inputStream.close(); /*获取url*/ GetPresignedObjectUrlArgs getPresignedObjectUrlArgs = GetPresignedObjectUrlArgs .builder() .bucket(bucketName) .object(fileName) .method(Method.GET) .build(); String presignedObjectUrl = MinioClientSingleton.getMinioClient().getPresignedObjectUrl(getPresignedObjectUrlArgs); String ObjectUrl = presignedObjectUrl.substring(0, presignedObjectUrl.indexOf("?")); return ObjectUrl; } catch (Exception ex) { log.error("上传对象返回url异常:" + ex.getMessage()); @@ -435,14 +487,14 @@ } /** *@描述 获取桶中所有对象 *@参数 [bucketName] *@返回值 java.lang.Iterable<io.minio.Result<io.minio.messages.Item>> *@创建人 刘苏义 *@创建时间 2023/2/6 10:32 *@修改人和其它信息 * @描述 获取桶中所有对象 * @参数 [bucketName] * @返回值 java.lang.Iterable<io.minio.Result < io.minio.messages.Item>> * @创建人 刘苏义 * @创建时间 2023/2/6 10:32 * @修改人和其它信息 */ public static Iterable<Result<Item>> getObjectsByBucket(String bucketName) { public static Iterable<Result<Item>> getObjectsByBucket(String bucketName) { Iterable<Result<Item>> listObjects = MinioClientSingleton.getMinioClient().listObjects(ListObjectsArgs.builder() .bucket(bucketName) .recursive(true) ard-work/src/main/java/com/ruoyi/media/service/impl/MediaService.java
@@ -59,7 +59,7 @@ @Override public String addPath(String name, String rtspPath, String mode) { String rtspUrl = "rtsp://" + mediamtxHost + ":8554/"; String rtspUrl = "rtsp://" + mediamtxHost + ":7554/"; Conf mediaInfo = new Conf(); //-vcodec libx264 //指定视频编码器为 libx264,使用 H.264 编码格式进行视频压缩 //-preset ultrafast //--preset的参数主要调节编码速度和质量的平衡,有ultrafast(转码速度最快,视频往往也最模糊)、superfast、veryfast、faster、fast、medium、slow、slower、veryslow、placebo这10个选项,从快到慢 @@ -223,7 +223,7 @@ String name = item.getName(); info.setName(name); //RTSP播放地址 String rtspUrl = "rtsp://" + mediamtxHost + ":8554/" + name; String rtspUrl = "rtsp://" + mediamtxHost + ":7554/" + name; info.setRtspUrl(rtspUrl); Source source = item.getSource(); if (source == null) { ard-work/src/main/java/com/ruoyi/rongcloud/controller/RongCloudController.java
@@ -38,13 +38,7 @@ return AjaxResult.success(token); } @PostMapping("/uploadPic") @ApiOperation("上传用户头像") public AjaxResult uploadPic(MultipartFile file) { String url = MinioUtils.putObjectAndGetUrl("useravatar", file); return AjaxResult.success(url); } @PostMapping("/checkOnline") @ApiOperation("查询用户在线状态") ard-work/src/main/java/com/ruoyi/rongcloud/service/Impl/RongCloudServiceImpl.java
@@ -67,6 +67,18 @@ return onlineMap; } @Override public Boolean checkOnline(String userId) { RongCloudParam param = new RongCloudParam(); param.setUserId(userId); Map isOnline = rongCloudClient.checkOnline(getRongCloudHead(), param); if (isOnline.get("status").equals("1")) { return true; } else { return false; } } /** * 获取融云签名信息 */ @@ -76,11 +88,11 @@ String nonce = RandomStringUtils.randomNumeric(18); String timestamp = String.valueOf(new Date().getTime()); String signature = DigestUtils.sha1Hex(appSecret + nonce + timestamp);//App Secret + Nonce + T Map<String, Object> headerMap=new HashMap<>(); headerMap.put("App-Key",appKey); headerMap.put("Nonce",nonce); headerMap.put("Timestamp",timestamp); headerMap.put("Signature",signature); Map<String, Object> headerMap = new HashMap<>(); headerMap.put("App-Key", appKey); headerMap.put("Nonce", nonce); headerMap.put("Timestamp", timestamp); headerMap.put("Signature", signature); return headerMap; } } ard-work/src/main/java/com/ruoyi/rongcloud/service/RongCloudService.java
@@ -14,4 +14,5 @@ String getToken(String userId,String name); Map checkOnline(List<String>userIds); Boolean checkOnline(String userId); } ard-work/src/main/java/com/ruoyi/test/ReadAccessDatabase.java
New file @@ -0,0 +1,85 @@ package com.ruoyi.test; /** * @Description: * @ClassName: ReadAccessDatabase * @Author: 刘苏义 * @Date: 2023年07月21日16:00:57 * @Version: 1.0 **/ import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; import java.sql.*; public class ReadAccessDatabase { public static void main(String[] args) { // 多个数据库文件路径 String[] dbPaths = { "D:\\mdb\\道路中心线.mdb", "D:\\mdb\\防风林-灌木.mdb", // 添加更多的数据库文件路径 }; // 遍历每个数据库文件 for (String dbPath : dbPaths) { readDataFromAccessDatabase(dbPath); } } public static void readDataFromAccessDatabase(String dbPath) { try { // 加载JDBC驱动 Class.forName("net.ucanaccess.jdbc.UcanaccessDriver"); // 连接Access数据库 String url = "jdbc:ucanaccess://" + dbPath + ";encoding=gb2312;"; Connection connection = DriverManager.getConnection(url); // 获取所有表的元数据 DatabaseMetaData metaData = connection.getMetaData(); ResultSet tables = metaData.getTables(null, null, null, new String[]{"TABLE"}); // 遍历表 while (tables.next()) { String tableName = tables.getString("TABLE_NAME"); if (!tableName.equals("道路中心线")) { continue; } System.out.println("表名: " + tableName); // 获取表的字段元数据 // ResultSet column = metaData.getColumns(null, null, tableName, null); // 遍历字段 // while (column.next()) { // String columnName = column.getString("COLUMN_NAME"); // System.out.println("字段名: " + columnName); // } // column.close(); // 执行查询操作 String sql = "SELECT * FROM " + tableName; // 替换为你要查询的表名 Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery(sql); // 处理查询结果 while (resultSet.next()) { // 读取每一行数据 String id = resultSet.getString(1); // 根据表中的列名获取数据 String name = resultSet.getString("编号"); // 可以根据具体的表结构继续获取其他字段的数据 // 在这里处理获取到的数据,例如输出到控制台或保存到集合中 System.out.println("ID: " + id + ", Name: " + name); } // 关闭连接 resultSet.close(); statement.close(); } tables.close(); connection.close(); } catch (ClassNotFoundException | SQLException e) { e.printStackTrace(); } } } ard-work/src/main/resources/mapper/app/ArdAppPositionMapper.xml
@@ -2,7 +2,7 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.ruoyi.app.mapper.ArdAppPositionMapper"> <mapper namespace="com.ruoyi.app.position.mapper.ArdAppPositionMapper"> <resultMap type="ArdAppPosition" id="ArdAppPositionResult"> <result property="id" column="id"/> <result property="userId" column="user_id"/> lib/mediamtx/ffmpeg.exeBinary files differ
lib/mediamtx/mediamtx.yml
@@ -40,17 +40,17 @@ # Enable the HTTP API. api: yes # Address of the API listener. apiAddress: 192.168.1.227:9997 apiAddress: 127.0.0.1:9997 # Enable Prometheus-compatible metrics. metrics: no # Address of the metrics listener. metricsAddress: 192.168.1.227:9998 metricsAddress: 127.0.0.1:9998 # Enable pprof-compatible endpoint to monitor performances. pprof: no # Address of the pprof listener. pprofAddress: 192.168.1.227:9999 pprofAddress: 127.0.0.1:9999 # Command to run when a client connects to the server. # Prepend ./ to run an executable in the current folder (example: "./ffmpeg") @@ -77,19 +77,19 @@ # Available values are "no", "strict", "optional". encryption: "no" # Address of the TCP/RTSP listener. This is needed only when encryption is "no" or "optional". rtspAddress: :8554 rtspAddress: :7554 # Address of the TCP/TLS/RTSPS listener. This is needed only when encryption is "strict" or "optional". rtspsAddress: :8322 rtspsAddress: :7322 # Address of the UDP/RTP listener. This is needed only when "udp" is in protocols. rtpAddress: :8000 rtpAddress: :7000 # Address of the UDP/RTCP listener. This is needed only when "udp" is in protocols. rtcpAddress: :8001 rtcpAddress: :7001 # IP range of all UDP-multicast listeners. This is needed only when "multicast" is in protocols. multicastIPRange: 224.1.0.0/16 # Port of all UDP-multicast/RTP listeners. This is needed only when "multicast" is in protocols. multicastRTPPort: 8002 multicastRTPPort: 7002 # Port of all UDP-multicast/RTCP listeners. This is needed only when "multicast" is in protocols. multicastRTCPPort: 8003 multicastRTCPPort: 7003 # Path to the server key. This is needed only when encryption is "strict" or "optional". # This can be generated with: # openssl genrsa -out server.key 2048 @@ -105,7 +105,7 @@ # RTMP parameters # Disable support for the RTMP protocol. rtmpDisable: no rtmpDisable: yes # Address of the RTMP listener. This is needed only when encryption is "no" or "optional". rtmpAddress: :1935 # Encrypt connections with TLS (RTMPS). @@ -125,7 +125,7 @@ # HLS parameters # Disable support for the HLS protocol. hlsDisable: no hlsDisable: yes # Address of the HLS listener. hlsAddress: :8888 # Enable TLS/HTTPS on the HLS server. @@ -181,7 +181,7 @@ # WebRTC parameters # Disable support for the WebRTC protocol. webrtcDisable: no webrtcDisable: yes # Address of the WebRTC listener. webrtcAddress: :8889 # Enable TLS/HTTPS on the WebRTC server. ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
@@ -18,7 +18,13 @@ * @return 用户信息集合信息 */ public List<SysUser> selectUserList(SysUser sysUser); /** * 根据条件分页查询APP用户列表 * * @param sysUser APP用户信息 * @return 用户信息集合信息 */ public List<SysUser> selectAppUserList(SysUser sysUser); /** * 根据条件分页查询已配用户角色列表 * ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
@@ -1,6 +1,7 @@ package com.ruoyi.system.service; import java.util.List; import java.util.Map; import com.ruoyi.common.core.domain.entity.SysUser; @@ -17,6 +18,14 @@ * @return 用户信息集合信息 */ public List<SysUser> selectUserList(SysUser user); /** * 根据条件分页查询APP用户列表 * * @param user APP用户信息 * @return 用户信息集合信息 */ public List<SysUser> selectAppUserList(SysUser user); /** * 根据条件分页查询已分配用户角色列表 @@ -225,4 +234,5 @@ * @param userIds 用户id数组 */ public void clearUserCache(String[] userIds); } ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -128,6 +128,11 @@ public List<SysUser> selectUserList(SysUser user) { return userMapper.selectUserList(user); } @Override @DataScope(deptAlias = "d", userAlias = "u") public List<SysUser> selectAppUserList(SysUser user) { return userMapper.selectAppUserList(user); } /** * 根据条件分页查询已分配用户角色列表 ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -117,7 +117,17 @@ <!-- 数据范围过滤 --> ${params.dataScope} </select> <select id="selectAppUserList" parameterType="SysUser" resultMap="SysUserResult"> <include refid="selectUserVo"/> where u.del_flag = '0' and r.role_name like '%app%' <if test="deptId != null and deptId != 0"> AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE cast(#{deptId} as varchar) = any(string_to_array(ancestors,',')) )) </if> <!-- 数据范围过滤 --> ${params.dataScope} </select> <select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult"> select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time from sys_user u