修复引导过程中修改相机导致引导队列中止出队的问题
增加一键派警描述字段
| | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.ExecutionException; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | log.info("相机:" + cameraId + "未开启报警引导功能"); |
| | | return; |
| | | } |
| | | |
| | | SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); |
| | | GuideTask guideTask = new GuideTask(); |
| | | //相机ID |
| | |
| | | */ |
| | | private String getNearbyCamera(double[] targetPosition) { |
| | | String minDistanceCameraId = ""; |
| | | try { |
| | | //获取所有大光电 |
| | | List<ArdCameras> ardCamerasList = ardCamerasMapper.selectArdCamerasList(new ArdCameras("1")); |
| | | //统计所有大光电可视范围内与报警点的距离 |
| | | Map<String, Double> distanceMap = new HashMap<>(); |
| | | Map<String, Integer> guideMap = new HashMap<>(); |
| | | for (ArdCameras camera : ardCamerasList) { |
| | | if (camera.getCamMaxVisibleDistance() == null) { |
| | | continue; |
| | | } |
| | | double[] camPosition = new double[]{camera.getLongitude(), camera.getLatitude()}; |
| | | double distance = GisTool.getDistance(targetPosition, camPosition); |
| | | if (distance != 0.0 && distance <= camera.getCamMaxVisibleDistance()) { |
| | |
| | | return " "; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | log.error("获取附近开启报警引导功能光电异常:"+ex.getMessage()); |
| | | } |
| | | return minDistanceCameraId; |
| | | } |
| | | |
| | |
| | | public void addTaskToQueue(String cameraId, GuideTask task) { |
| | | /*通过相机ID获取引导队列,并将引导任务加入队列*/ |
| | | PriorityBlockingQueue<GuideTask> guideTaskQueue = GuidePriorityQueue.cameraQueueMap.get(cameraId); |
| | | if(StringUtils.isNull(guideTaskQueue)) |
| | | { |
| | | if (StringUtils.isNull(guideTaskQueue)) { |
| | | log.info("相机未登录,没有队列,无法入队引导"); |
| | | return; |
| | | } |
| | |
| | | /*获取该相机的当前执行线程*/ |
| | | TaskThread currentTaskThread = threadMap.get(cameraId); |
| | | //如果队列当前线程正在运行,若入队任务优先级大于当前任务优先级,则终止当前线程 |
| | | if (currentTaskThread != null && task.getPriority() > currentTaskThread.getCurrentTask().getPriority()) { |
| | | if (currentTaskThread != null){ |
| | | if (task.getPriority() > currentTaskThread.getCurrentTask().getPriority()) { |
| | | currentTaskThread.getThread().interrupt(); |
| | | } |
| | | if (!currentTaskThread.getThread().isAlive()) { |
| | | Thread newThread = createThread(cameraId, guideTaskQueue); |
| | | threadMap.put(cameraId, new TaskThread(newThread, task)); |
| | | newThread.start(); |
| | | } |
| | | } |
| | | //如果队列当前没有线程正在运行,则启动新线程 |
| | | if (currentTaskThread == null || !currentTaskThread.getThread().isAlive()) { |
| | | else { |
| | | Thread newThread = createThread(cameraId, guideTaskQueue); |
| | | threadMap.put(cameraId, new TaskThread(newThread, task)); |
| | | newThread.start(); |
| | |
| | | |
| | | import com.ruoyi.common.annotation.SdkOperate; |
| | | import com.ruoyi.common.utils.file.FileUtils; |
| | | import com.ruoyi.common.utils.file.MimeTypeUtils; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.device.camera.domain.CameraCmd; |
| | | import com.ruoyi.device.camera.service.IArdCamerasService; |
| | |
| | | //存储到minio |
| | | String BucketName = "pic"; |
| | | String ObjectName = "capture/" + IdUtils.simpleUUID() + ".jpeg"; |
| | | String ContentType = "image/JPEG"; |
| | | InputStream input = new ByteArrayInputStream(array); |
| | | String url = ""; |
| | | try { |
| | | boolean b = minioUtil.uploadObject(BucketName, ObjectName, input, input.available(), ContentType); |
| | | boolean b = minioUtil.uploadObject(BucketName, ObjectName, input, input.available(), MimeTypeUtils.IMAGE_JPEG); |
| | | if (b) { |
| | | url = minioUtil.getBucketObjectUrl(BucketName, ObjectName); |
| | | log.debug("上传文件成功!" + url); |
| | |
| | | log.debug("录像停止"); |
| | | //存入minio |
| | | String BucketName = cmd.getRecordBucketName(); |
| | | String ObjectName = cmd.getRecordObjectName(); |
| | | String ContentType = "video/MP4"; |
| | | String ObjectName = cmd.getRecordObjectName()+".mp4"; |
| | | FileInputStream stream = new FileInputStream(path); |
| | | String time = new SimpleDateFormat("yyyyMMdd").format(new Date()); |
| | | String recordName = cameraId + "/" + time + "/" + ObjectName + ".mp4"; |
| | | boolean b = minioUtil.uploadObject(BucketName, recordName, stream, stream.available(), ContentType); |
| | | boolean b = minioUtil.uploadObject(BucketName, ObjectName, stream, stream.available(), "video/MP4"); |
| | | if (b) { |
| | | url = endpoint + "/" + BucketName + "/" + recordName; |
| | | url = minioUtil.getBucketObjectUrl(BucketName, ObjectName); |
| | | log.debug("上传文件成功!" + url); |
| | | } |
| | | return url; |
| | |
| | | } |
| | | } |
| | | //创建引导队列 |
| | | if(!GuidePriorityQueue.cameraQueueMap.containsKey(camera.getId())) |
| | | { |
| | | Comparator<GuideTask> comparator = GuidePriorityQueue.getComparator(); |
| | | PriorityBlockingQueue<GuideTask> priorityQueue = new PriorityBlockingQueue<>(1000, comparator); |
| | | GuidePriorityQueue.cameraQueueMap.put(camera.getId(), priorityQueue); |
| | | } |
| | | |
| | | } else { |
| | | log.debug(camera.getIp() + ":" + camera.getPort() + "登录失败"); |
| | | camera.setChanNum(0); |
| | |
| | | @Excel(name = "派警名称") |
| | | private String name; |
| | | |
| | | /** 描述 */ |
| | | @Excel(name = "描述") |
| | | private String text; |
| | | |
| | | /** 经度 */ |
| | | @Excel(name = "经度") |
| | | private Double longitude; |
| | |
| | | public void setArdDispatchPoliceUserList(List<String> ardDispatchPoliceUserList) { |
| | | this.ardDispatchPoliceUserList = ardDispatchPoliceUserList; |
| | | } |
| | | |
| | | public String getText() { |
| | | return text; |
| | | } |
| | | |
| | | public void setText(String text) { |
| | | this.text = text; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.common.utils.ConfigUtils; |
| | | import com.ruoyi.common.utils.DictUtils; |
| | | import com.ruoyi.common.utils.file.ImageUtils; |
| | | import com.sun.imageio.plugins.common.ImageUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | public class ReadAccessDatabase { |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | // 多个数据库文件路径 |
| | | String[] dbPaths = { |
| | | "D:\\Workspaces\\ard\\安瑞达工作资料\\mdb\\道路中心线.mdb" |
| | |
| | | <resultMap type="ArdDispatchPolice" id="ArdDispatchPoliceResult"> |
| | | <result property="id" column="id"/> |
| | | <result property="name" column="name"/> |
| | | <result property="text" column="text"/> |
| | | <result property="longitude" column="longitude"/> |
| | | <result property="latitude" column="latitude"/> |
| | | <result property="deptId" column="dept_id"/> |
| | |
| | | <sql id="selectArdDispatchPoliceVo"> |
| | | SELECT ID, |
| | | NAME, |
| | | text, |
| | | longitude, |
| | | latitude, |
| | | dept_id, |
| | |
| | | resultMap="ArdDispatchPoliceArdDispatchPoliceUserResult"> |
| | | select a.id, |
| | | a.name, |
| | | a.text, |
| | | a.longitude, |
| | | a.latitude, |
| | | a.dept_id, |
| | |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="name != null">name,</if> |
| | | <if test="text != null">text,</if> |
| | | <if test="longitude != null">longitude,</if> |
| | | <if test="latitude != null">latitude,</if> |
| | | <if test="deptId != null">dept_id,</if> |
| | |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id},</if> |
| | | <if test="name != null">#{name},</if> |
| | | <if test="text != null">#{text},</if> |
| | | <if test="longitude != null">#{longitude},</if> |
| | | <if test="latitude != null">#{latitude},</if> |
| | | <if test="deptId != null">#{deptId},</if> |
| | |
| | | update ard_dispatch_police |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="name != null">name = #{name},</if> |
| | | <if test="text != null">text = #{text},</if> |
| | | <if test="longitude != null">longitude = #{longitude},</if> |
| | | <if test="latitude != null">latitude = #{latitude},</if> |
| | | <if test="deptId != null">dept_id = #{deptId},</if> |
| | |
| | | public static final String IMAGE_BMP = "image/bmp"; |
| | | |
| | | public static final String IMAGE_GIF = "image/gif"; |
| | | |
| | | public static final String Video_MP4 = "video/mp4"; |
| | | |
| | | public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" }; |
| | | |
| | |
| | | import java.util.List; |
| | | import java.util.Properties; |
| | | import com.ruoyi.common.utils.Arith; |
| | | import com.ruoyi.common.utils.file.ImageUtils; |
| | | import com.ruoyi.common.utils.ip.IpUtils; |
| | | import com.ruoyi.framework.web.domain.server.Cpu; |
| | | import com.ruoyi.framework.web.domain.server.Jvm; |