From e4043f3eea29b75ab7576f5489ed817985b71aa4 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期三, 06 十二月 2023 17:12:26 +0800
Subject: [PATCH] 增加超脑报警业务
---
ard-work/src/main/java/com/ruoyi/alarm/superbrain/service/impl/ArdAlarmSuperBrainServiceImpl.java | 97 +++++
ard-work/src/main/java/com/ruoyi/alarm/superbrain/domain/ArdAlarmSuperBrain.java | 237 +++++++++++++
ard-work/src/main/java/com/ruoyi/alarm/superbrain/controller/ArdAlarmSuperBrainController.java | 104 +++++
ard-work/src/main/java/com/ruoyi/device/camera/factory/CameraSDK.java | 2
ruoyi-admin/src/main/resources/i18n/messages_zh_CN.properties | 1
ard-work/src/main/java/com/ruoyi/alarm/superbrain/mapper/ArdAlarmSuperBrainMapper.java | 68 +++
ruoyi-admin/src/main/resources/i18n/messages_en_US.properties | 1
ard-work/src/main/java/com/ruoyi/device/camera/factory/CameraSDKFactory.java | 4
ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/service/impl/HikvisionSDK.java | 174 +++++----
ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java | 84 ++++
ruoyi-admin/src/main/resources/i18n/messages.properties | 1
ard-work/src/main/resources/mapper/alarm/ArdAlarmSuperBrainMapper.xml | 190 ++++++++++
ard-work/src/main/java/com/ruoyi/alarm/superbrain/service/IArdAlarmSuperBrainService.java | 61 +++
ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/lib/LoginResultCallBack.java | 3
ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DahuaSDK.java | 2
15 files changed, 942 insertions(+), 87 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java
index 3877892..1d710a9 100644
--- a/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java
@@ -22,6 +22,8 @@
import com.ruoyi.alarm.radar.mapper.ArdAlarmRadarPumpMapper;
import com.ruoyi.alarm.steal.domain.ArdAlarmStealelec;
import com.ruoyi.alarm.steal.mapper.ArdAlarmStealelecMapper;
+import com.ruoyi.alarm.superbrain.domain.ArdAlarmSuperBrain;
+import com.ruoyi.alarm.superbrain.mapper.ArdAlarmSuperBrainMapper;
import com.ruoyi.alarm.tube.domain.ArdAlarmTube;
import com.ruoyi.alarm.tube.mapper.ArdAlarmTubeMapper;
import com.ruoyi.alarm.wall.domain.ArdAlarmWall;
@@ -74,6 +76,8 @@
@Slf4j(topic = "mqtt")
public class GlobalAlarmServiceImpl implements IGlobalAlarmService {
//region 渚濊禆娉ㄥ叆
+ @Resource
+ private ArdAlarmSuperBrainMapper ardAlarmSuperBrainMapper;
@Resource
private ArdAlarmDigitization3Mapper ardAlarmDigitization3Mapper;
@Resource
@@ -153,6 +157,8 @@
countMap.put("1014", count1014);
int count1012 = ardAlarmDigitization3Mapper.selectCountByAlarmTime(refreshTime);
countMap.put("1012", count1012);
+ int count1015 = ardAlarmSuperBrainMapper.selectCountByAlarmTime(refreshTime);
+ countMap.put("1015", count1015);
map.put("20000", countMap);
return map;
}
@@ -325,6 +331,22 @@
.setAltitude(ardAlarmTube.getAltitude())
.setCount(ardAlarmTube.getCount())
.setTotal(ardAlarmTube.getTotal());
+ return globalAlarmData;
+ }).collect(Collectors.toList());
+ case 1015:
+ List<ArdAlarmSuperBrain> ardAlarmSuperBrains = ardAlarmSuperBrainMapper.selectListAllByCommand(refreshTime);
+ return ardAlarmSuperBrains.stream()
+ .map(ardAlarmSuperBrain -> {
+ GlobalAlarmData globalAlarmData = new GlobalAlarmData()
+ .setId(ardAlarmSuperBrain.getId())
+ .setName(ardAlarmSuperBrain.getAlarmType())
+ .setAlarmType(ardAlarmSuperBrain.getAlarmType())
+ .setAlarmTime(ardAlarmSuperBrain.getAlarmTime())
+ .setLongitude(ardAlarmSuperBrain.getLongitude())
+ .setLatitude(ardAlarmSuperBrain.getLatitude())
+ .setAltitude(ardAlarmSuperBrain.getAltitude())
+ .setCount(ardAlarmSuperBrain.getCount())
+ .setTotal(ardAlarmSuperBrain.getTotal());
return globalAlarmData;
}).collect(Collectors.toList());
default:
@@ -500,6 +522,22 @@
.setAltitude(ardAlarmTube.getAltitude())
.setCount(ardAlarmTube.getCount())
.setTotal(ardAlarmTube.getTotal());
+ return globalAlarmData;
+ }).collect(Collectors.toList());
+ case 1015:
+ List<ArdAlarmSuperBrain> ardAlarmSuperBrains = ardAlarmSuperBrainMapper.selectListAllByCommand(refreshTime);
+ return ardAlarmSuperBrains.stream()
+ .map(ardAlarmSuperBrain -> {
+ GlobalAlarmData globalAlarmData = new GlobalAlarmData()
+ .setId(ardAlarmSuperBrain.getId())
+ .setName(ardAlarmSuperBrain.getAlarmType())
+ .setAlarmType(ardAlarmSuperBrain.getAlarmType())
+ .setAlarmTime(ardAlarmSuperBrain.getAlarmTime())
+ .setLongitude(ardAlarmSuperBrain.getLongitude())
+ .setLatitude(ardAlarmSuperBrain.getLatitude())
+ .setAltitude(ardAlarmSuperBrain.getAltitude())
+ .setCount(ardAlarmSuperBrain.getCount())
+ .setTotal(ardAlarmSuperBrain.getTotal());
return globalAlarmData;
}).collect(Collectors.toList());
default:
@@ -692,6 +730,7 @@
if (alarmData1012.size() > 0) {
GlobalAlarmDataList.addAll(alarmData1012);
}
+
List<ArdAlarmTube> ardAlarmTubes = ardAlarmTubeMapper.selectListAllByCommand(refreshTime);
List<GlobalAlarmData> alarmData1014 = ardAlarmTubes.stream()
.map(ardAlarmTube -> {
@@ -710,6 +749,26 @@
if (alarmData1014.size() > 0) {
GlobalAlarmDataList.addAll(alarmData1014);
}
+
+ List<ArdAlarmSuperBrain> ardAlarmSuperBrains = ardAlarmSuperBrainMapper.selectListAllByCommand(refreshTime);
+ List<GlobalAlarmData> alarmData1015 = ardAlarmSuperBrains.stream()
+ .map(ardAlarmSuperBrain -> {
+ GlobalAlarmData globalAlarmData = new GlobalAlarmData()
+ .setId(ardAlarmSuperBrain.getId())
+ .setName(ardAlarmSuperBrain.getAlarmType())
+ .setAlarmTime(ardAlarmSuperBrain.getAlarmTime())
+ .setLongitude(ardAlarmSuperBrain.getLongitude())
+ .setLatitude(ardAlarmSuperBrain.getLatitude())
+ .setAltitude(ardAlarmSuperBrain.getAltitude())
+ .setCount(ardAlarmSuperBrain.getCount())
+ .setTotal(ardAlarmSuperBrain.getTotal())
+ .setAlarmType("1015");
+ return globalAlarmData;
+ }).collect(Collectors.toList());
+ if (alarmData1015.size() > 0) {
+ GlobalAlarmDataList.addAll(alarmData1015);
+ }
+
return GlobalAlarmDataList;
}
@@ -798,6 +857,12 @@
aat.setPageNum(pageNum);
aat.setPageSize(pageSize);
return ardAlarmTubeMapper.selectArdAlarmTubeList(aat);
+ case 1015:
+ ArdAlarmSuperBrain aasb = new ArdAlarmSuperBrain();
+ aasb.setParams(params);
+ aasb.setPageNum(pageNum);
+ aasb.setPageSize(pageSize);
+ return ardAlarmSuperBrainMapper.selectArdAlarmSuperBrainList(aasb);
}
return null;
}
@@ -903,6 +968,14 @@
String alarmTime = fmt.format(ardAlarmTube.getAlarmTime());
ardAlarmTubeMapper.updateViewTimeByTubeId(tubeId, alarmTime, DateUtils.getTime());
return ardAlarmTube;
+ }
+ case 1015:
+ ArdAlarmSuperBrain ardAlarmSuperBrain = ardAlarmSuperBrainMapper.selectArdAlarmSuperBrainById(condition.getId());
+ if (StringUtils.isNotNull(ardAlarmSuperBrain)) {
+ String alarmType = ardAlarmSuperBrain.getAlarmType();
+ String alarmTime = fmt.format(ardAlarmSuperBrain.getAlarmTime());
+ ardAlarmSuperBrainMapper.updateViewTimeByAlarmType(alarmType, alarmTime, DateUtils.getTime());
+ return ardAlarmSuperBrain;
}
default:
return null;
@@ -1245,6 +1318,17 @@
}
//endregion
break;
+ case "superBrain":
+ //region 瓒呰剳鎶ヨ
+ ArdAlarmSuperBrain ardAlarmSuperBrain = JSONObject.parseObject(message, ArdAlarmSuperBrain.class);
+ ardAlarmSuperBrain.setId(IdUtils.simpleUUID());
+ ardAlarmSuperBrain.setCreateTime(new Date());
+ int sbRes = ardAlarmSuperBrainMapper.insertArdAlarmSuperBrain(ardAlarmSuperBrain);
+ if (sbRes > 0) {
+ log.debug("superBrain鍏ュ簱鎴愬姛锛�" + ardAlarmSuperBrain);
+ }
+ //endregion
+ break;
}
} catch (Exception ex) {
log.error("鎺ユ敹鎶ヨ寮傚父:" + ex.getMessage());
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/superbrain/controller/ArdAlarmSuperBrainController.java b/ard-work/src/main/java/com/ruoyi/alarm/superbrain/controller/ArdAlarmSuperBrainController.java
new file mode 100644
index 0000000..5bc66f8
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/superbrain/controller/ArdAlarmSuperBrainController.java
@@ -0,0 +1,104 @@
+package com.ruoyi.alarm.superbrain.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.alarm.superbrain.domain.ArdAlarmSuperBrain;
+import com.ruoyi.alarm.superbrain.service.IArdAlarmSuperBrainService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 瓒呰剳鎶ヨController
+ *
+ * @author ard
+ * @date 2023-12-06
+ */
+@RestController
+@RequestMapping("/alarm/superbrain")
+public class ArdAlarmSuperBrainController extends BaseController
+{
+ @Autowired
+ private IArdAlarmSuperBrainService ardAlarmSuperBrainService;
+
+ /**
+ * 鏌ヨ瓒呰剳鎶ヨ鍒楄〃
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:superbrain:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(ArdAlarmSuperBrain ardAlarmSuperBrain)
+ {
+ startPage();
+ List<ArdAlarmSuperBrain> list = ardAlarmSuperBrainService.selectArdAlarmSuperBrainList(ardAlarmSuperBrain);
+ return getDataTable(list);
+ }
+
+ /**
+ * 瀵煎嚭瓒呰剳鎶ヨ鍒楄〃
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:superbrain:export')")
+ @Log(title = "瓒呰剳鎶ヨ", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, ArdAlarmSuperBrain ardAlarmSuperBrain)
+ {
+ List<ArdAlarmSuperBrain> list = ardAlarmSuperBrainService.selectArdAlarmSuperBrainList(ardAlarmSuperBrain);
+ ExcelUtil<ArdAlarmSuperBrain> util = new ExcelUtil<ArdAlarmSuperBrain>(ArdAlarmSuperBrain.class);
+ util.exportExcel(response, list, "瓒呰剳鎶ヨ鏁版嵁");
+ }
+
+ /**
+ * 鑾峰彇瓒呰剳鎶ヨ璇︾粏淇℃伅
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:superbrain:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") String id)
+ {
+ return success(ardAlarmSuperBrainService.selectArdAlarmSuperBrainById(id));
+ }
+
+ /**
+ * 鏂板瓒呰剳鎶ヨ
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:superbrain:add')")
+ @Log(title = "瓒呰剳鎶ヨ", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody ArdAlarmSuperBrain ardAlarmSuperBrain)
+ {
+ return toAjax(ardAlarmSuperBrainService.insertArdAlarmSuperBrain(ardAlarmSuperBrain));
+ }
+
+ /**
+ * 淇敼瓒呰剳鎶ヨ
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:superbrain:edit')")
+ @Log(title = "瓒呰剳鎶ヨ", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody ArdAlarmSuperBrain ardAlarmSuperBrain)
+ {
+ return toAjax(ardAlarmSuperBrainService.updateArdAlarmSuperBrain(ardAlarmSuperBrain));
+ }
+
+ /**
+ * 鍒犻櫎瓒呰剳鎶ヨ
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:superbrain:remove')")
+ @Log(title = "瓒呰剳鎶ヨ", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable String[] ids)
+ {
+ return toAjax(ardAlarmSuperBrainService.deleteArdAlarmSuperBrainByIds(ids));
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/superbrain/domain/ArdAlarmSuperBrain.java b/ard-work/src/main/java/com/ruoyi/alarm/superbrain/domain/ArdAlarmSuperBrain.java
new file mode 100644
index 0000000..67230e5
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/superbrain/domain/ArdAlarmSuperBrain.java
@@ -0,0 +1,237 @@
+package com.ruoyi.alarm.superbrain.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 瓒呰剳鎶ヨ瀵硅薄 ard_alarm_super_brain
+ *
+ * @author ard
+ * @date 2023-12-06
+ */
+public class ArdAlarmSuperBrain extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 鎶ヨ涓婚敭 */
+ private String id;
+
+ /** 鎶ヨ鍚嶇О */
+ @Excel(name = "鎶ヨ鍚嶇О")
+ private String alarmName;
+
+ /** 鎶ヨ绫诲瀷 */
+ @Excel(name = "鎶ヨ绫诲瀷")
+ private String alarmType;
+
+ /** 鎶ヨ鏃堕棿 */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @Excel(name = "鎶ヨ鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+ private Date alarmTime;
+
+ /** 璁惧id */
+ @Excel(name = "璁惧id")
+ private String deviceId;
+
+ /** 璁惧鍚嶇О */
+ @Excel(name = "璁惧鍚嶇О")
+ private String deviceName;
+
+ /** 閫氶亾鍙� */
+ @Excel(name = "閫氶亾鍙�")
+ private Integer chanNo;
+
+ /** 缁忓害 */
+ @Excel(name = "缁忓害")
+ private Double longitude;
+
+ /** 绾害 */
+ @Excel(name = "绾害")
+ private Double latitude;
+
+ /** 楂樺眰 */
+ @Excel(name = "楂樺眰")
+ private Double altitude;
+
+ /** 鍥剧墖url */
+ @Excel(name = "鍥剧墖url")
+ private String picUrl;
+
+ /** 浜鸿劯鍥剧墖url */
+ @Excel(name = "浜鸿劯鍥剧墖url")
+ private String faceUrl;
+
+ /** 鏌ョ湅鏃堕棿 */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @Excel(name = "鏌ョ湅鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+ private Date viewTime;
+ /**
+ * 鎶ヨ鎬绘暟
+ */
+ private Integer total;
+ /**
+ * 鏈鎶ヨ鏁伴噺
+ */
+ private Integer count;
+
+ public Integer getTotal() {
+ return total;
+ }
+
+ public void setTotal(Integer total) {
+ this.total = total;
+ }
+
+ public Integer getCount() {
+ return count;
+ }
+
+ public void setCount(Integer count) {
+ this.count = count;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+ public void setAlarmName(String alarmName)
+ {
+ this.alarmName = alarmName;
+ }
+
+ public String getAlarmName()
+ {
+ return alarmName;
+ }
+ public void setAlarmType(String alarmType)
+ {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmType()
+ {
+ return alarmType;
+ }
+ public void setAlarmTime(Date alarmTime)
+ {
+ this.alarmTime = alarmTime;
+ }
+
+ public Date getAlarmTime()
+ {
+ return alarmTime;
+ }
+ public void setDeviceId(String deviceId)
+ {
+ this.deviceId = deviceId;
+ }
+
+ public String getDeviceId()
+ {
+ return deviceId;
+ }
+ public void setDeviceName(String deviceName)
+ {
+ this.deviceName = deviceName;
+ }
+
+ public String getDeviceName()
+ {
+ return deviceName;
+ }
+ public void setChanNo(Integer chanNo)
+ {
+ this.chanNo = chanNo;
+ }
+
+ public Integer getChanNo()
+ {
+ return chanNo;
+ }
+ public void setLongitude(Double longitude)
+ {
+ this.longitude = longitude;
+ }
+
+ public Double getLongitude()
+ {
+ return longitude;
+ }
+ public void setLatitude(Double latitude)
+ {
+ this.latitude = latitude;
+ }
+
+ public Double getLatitude()
+ {
+ return latitude;
+ }
+ public void setAltitude(Double altitude)
+ {
+ this.altitude = altitude;
+ }
+
+ public Double getAltitude()
+ {
+ return altitude;
+ }
+ public void setPicUrl(String picUrl)
+ {
+ this.picUrl = picUrl;
+ }
+
+ public String getPicUrl()
+ {
+ return picUrl;
+ }
+ public void setFaceUrl(String faceUrl)
+ {
+ this.faceUrl = faceUrl;
+ }
+
+ public String getFaceUrl()
+ {
+ return faceUrl;
+ }
+ public void setViewTime(Date viewTime)
+ {
+ this.viewTime = viewTime;
+ }
+
+ public Date getViewTime()
+ {
+ return viewTime;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("alarmName", getAlarmName())
+ .append("alarmType", getAlarmType())
+ .append("alarmTime", getAlarmTime())
+ .append("deviceId", getDeviceId())
+ .append("deviceName", getDeviceName())
+ .append("chanNo", getChanNo())
+ .append("longitude", getLongitude())
+ .append("latitude", getLatitude())
+ .append("altitude", getAltitude())
+ .append("picUrl", getPicUrl())
+ .append("faceUrl", getFaceUrl())
+ .append("createBy", getCreateBy())
+ .append("createTime", getCreateTime())
+ .append("updateBy", getUpdateBy())
+ .append("updateTime", getUpdateTime())
+ .append("viewTime", getViewTime())
+ .toString();
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/superbrain/mapper/ArdAlarmSuperBrainMapper.java b/ard-work/src/main/java/com/ruoyi/alarm/superbrain/mapper/ArdAlarmSuperBrainMapper.java
new file mode 100644
index 0000000..67d1312
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/superbrain/mapper/ArdAlarmSuperBrainMapper.java
@@ -0,0 +1,68 @@
+package com.ruoyi.alarm.superbrain.mapper;
+
+import java.util.List;
+import com.ruoyi.alarm.superbrain.domain.ArdAlarmSuperBrain;
+import com.ruoyi.alarm.tube.domain.ArdAlarmTube;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 瓒呰剳鎶ヨMapper鎺ュ彛
+ *
+ * @author ard
+ * @date 2023-12-06
+ */
+public interface ArdAlarmSuperBrainMapper
+{
+ /**
+ * 鏌ヨ瓒呰剳鎶ヨ
+ *
+ * @param id 瓒呰剳鎶ヨ涓婚敭
+ * @return 瓒呰剳鎶ヨ
+ */
+ public ArdAlarmSuperBrain selectArdAlarmSuperBrainById(String id);
+
+ /**
+ * 鏌ヨ瓒呰剳鎶ヨ鍒楄〃
+ *
+ * @param ardAlarmSuperBrain 瓒呰剳鎶ヨ
+ * @return 瓒呰剳鎶ヨ闆嗗悎
+ */
+ public List<ArdAlarmSuperBrain> selectArdAlarmSuperBrainList(ArdAlarmSuperBrain ardAlarmSuperBrain);
+
+ /**
+ * 鏂板瓒呰剳鎶ヨ
+ *
+ * @param ardAlarmSuperBrain 瓒呰剳鎶ヨ
+ * @return 缁撴灉
+ */
+ public int insertArdAlarmSuperBrain(ArdAlarmSuperBrain ardAlarmSuperBrain);
+
+ /**
+ * 淇敼瓒呰剳鎶ヨ
+ *
+ * @param ardAlarmSuperBrain 瓒呰剳鎶ヨ
+ * @return 缁撴灉
+ */
+ public int updateArdAlarmSuperBrain(ArdAlarmSuperBrain ardAlarmSuperBrain);
+
+ /**
+ * 鍒犻櫎瓒呰剳鎶ヨ
+ *
+ * @param id 瓒呰剳鎶ヨ涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteArdAlarmSuperBrainById(String id);
+
+ /**
+ * 鎵归噺鍒犻櫎瓒呰剳鎶ヨ
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteArdAlarmSuperBrainByIds(String[] ids);
+
+
+ public List<ArdAlarmSuperBrain> selectListAllByCommand(@Param("refreshTime")String refreshTime);
+ int selectCountByAlarmTime(@Param("refreshTime")String refreshTime);
+ public int updateViewTimeByAlarmType(@Param("alarmType")String alarmType,@Param("alarmTime") String alarmTime,@Param("viewTime") String viewTime);
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/superbrain/service/IArdAlarmSuperBrainService.java b/ard-work/src/main/java/com/ruoyi/alarm/superbrain/service/IArdAlarmSuperBrainService.java
new file mode 100644
index 0000000..55b5202
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/superbrain/service/IArdAlarmSuperBrainService.java
@@ -0,0 +1,61 @@
+package com.ruoyi.alarm.superbrain.service;
+
+import java.util.List;
+import com.ruoyi.alarm.superbrain.domain.ArdAlarmSuperBrain;
+
+/**
+ * 瓒呰剳鎶ヨService鎺ュ彛
+ *
+ * @author ard
+ * @date 2023-12-06
+ */
+public interface IArdAlarmSuperBrainService
+{
+ /**
+ * 鏌ヨ瓒呰剳鎶ヨ
+ *
+ * @param id 瓒呰剳鎶ヨ涓婚敭
+ * @return 瓒呰剳鎶ヨ
+ */
+ public ArdAlarmSuperBrain selectArdAlarmSuperBrainById(String id);
+
+ /**
+ * 鏌ヨ瓒呰剳鎶ヨ鍒楄〃
+ *
+ * @param ardAlarmSuperBrain 瓒呰剳鎶ヨ
+ * @return 瓒呰剳鎶ヨ闆嗗悎
+ */
+ public List<ArdAlarmSuperBrain> selectArdAlarmSuperBrainList(ArdAlarmSuperBrain ardAlarmSuperBrain);
+
+ /**
+ * 鏂板瓒呰剳鎶ヨ
+ *
+ * @param ardAlarmSuperBrain 瓒呰剳鎶ヨ
+ * @return 缁撴灉
+ */
+ public int insertArdAlarmSuperBrain(ArdAlarmSuperBrain ardAlarmSuperBrain);
+
+ /**
+ * 淇敼瓒呰剳鎶ヨ
+ *
+ * @param ardAlarmSuperBrain 瓒呰剳鎶ヨ
+ * @return 缁撴灉
+ */
+ public int updateArdAlarmSuperBrain(ArdAlarmSuperBrain ardAlarmSuperBrain);
+
+ /**
+ * 鎵归噺鍒犻櫎瓒呰剳鎶ヨ
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑瓒呰剳鎶ヨ涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteArdAlarmSuperBrainByIds(String[] ids);
+
+ /**
+ * 鍒犻櫎瓒呰剳鎶ヨ淇℃伅
+ *
+ * @param id 瓒呰剳鎶ヨ涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteArdAlarmSuperBrainById(String id);
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/superbrain/service/impl/ArdAlarmSuperBrainServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarm/superbrain/service/impl/ArdAlarmSuperBrainServiceImpl.java
new file mode 100644
index 0000000..07f50ac
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/superbrain/service/impl/ArdAlarmSuperBrainServiceImpl.java
@@ -0,0 +1,97 @@
+package com.ruoyi.alarm.superbrain.service.impl;
+
+import java.util.List;
+ import com.ruoyi.common.utils.DateUtils;
+
+import com.ruoyi.common.utils.uuid.IdUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import java.util.ArrayList;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.alarm.superbrain.mapper.ArdAlarmSuperBrainMapper;
+import com.ruoyi.alarm.superbrain.domain.ArdAlarmSuperBrain;
+import com.ruoyi.alarm.superbrain.service.IArdAlarmSuperBrainService;
+
+/**
+ * 瓒呰剳鎶ヨService涓氬姟灞傚鐞�
+ *
+ * @author ard
+ * @date 2023-12-06
+ */
+@Service
+public class ArdAlarmSuperBrainServiceImpl implements IArdAlarmSuperBrainService {
+ @Autowired
+ private ArdAlarmSuperBrainMapper ardAlarmSuperBrainMapper;
+
+ /**
+ * 鏌ヨ瓒呰剳鎶ヨ
+ *
+ * @param id 瓒呰剳鎶ヨ涓婚敭
+ * @return 瓒呰剳鎶ヨ
+ */
+ @Override
+ public ArdAlarmSuperBrain selectArdAlarmSuperBrainById(String id) {
+ return ardAlarmSuperBrainMapper.selectArdAlarmSuperBrainById(id);
+ }
+
+ /**
+ * 鏌ヨ瓒呰剳鎶ヨ鍒楄〃
+ *
+ * @param ardAlarmSuperBrain 瓒呰剳鎶ヨ
+ * @return 瓒呰剳鎶ヨ
+ */
+ @Override
+ public List<ArdAlarmSuperBrain> selectArdAlarmSuperBrainList(ArdAlarmSuperBrain ardAlarmSuperBrain) {
+ return ardAlarmSuperBrainMapper.selectArdAlarmSuperBrainList(ardAlarmSuperBrain);
+ }
+
+ /**
+ * 鏂板瓒呰剳鎶ヨ
+ *
+ * @param ardAlarmSuperBrain 瓒呰剳鎶ヨ
+ * @return 缁撴灉
+ */
+ @Override
+ public int insertArdAlarmSuperBrain(ArdAlarmSuperBrain ardAlarmSuperBrain) {
+ ardAlarmSuperBrain.setId(IdUtils.simpleUUID());
+ ardAlarmSuperBrain.setCreateBy(SecurityUtils.getUsername());
+ ardAlarmSuperBrain.setCreateTime(DateUtils.getNowDate());
+ return ardAlarmSuperBrainMapper.insertArdAlarmSuperBrain(ardAlarmSuperBrain);
+ }
+
+ /**
+ * 淇敼瓒呰剳鎶ヨ
+ *
+ * @param ardAlarmSuperBrain 瓒呰剳鎶ヨ
+ * @return 缁撴灉
+ */
+ @Override
+ public int updateArdAlarmSuperBrain(ArdAlarmSuperBrain ardAlarmSuperBrain) {
+ ardAlarmSuperBrain.setUpdateBy(SecurityUtils.getUsername());
+ ardAlarmSuperBrain.setUpdateTime(DateUtils.getNowDate());
+ return ardAlarmSuperBrainMapper.updateArdAlarmSuperBrain(ardAlarmSuperBrain);
+ }
+
+ /**
+ * 鎵归噺鍒犻櫎瓒呰剳鎶ヨ
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑瓒呰剳鎶ヨ涓婚敭
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteArdAlarmSuperBrainByIds(String[] ids) {
+ return ardAlarmSuperBrainMapper.deleteArdAlarmSuperBrainByIds(ids);
+ }
+
+ /**
+ * 鍒犻櫎瓒呰剳鎶ヨ淇℃伅
+ *
+ * @param id 瓒呰剳鎶ヨ涓婚敭
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteArdAlarmSuperBrainById(String id) {
+ return ardAlarmSuperBrainMapper.deleteArdAlarmSuperBrainById(id);
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/factory/CameraSDK.java b/ard-work/src/main/java/com/ruoyi/device/camera/factory/CameraSDK.java
index 1eea46a..9bbcc39 100644
--- a/ard-work/src/main/java/com/ruoyi/device/camera/factory/CameraSDK.java
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/factory/CameraSDK.java
@@ -98,7 +98,7 @@
boolean recordStopNotToMinio(CameraCmd cmd);
//鑾峰彇鐩告満閫氶亾淇℃伅
- List<ArdChannel> getCameraChannelList(ArdCameras camera);
+ List<ArdChannel> getIPChannelInfo(ArdCameras camera);
//鑾峰彇GIS淇℃伅鏁版嵁
Map<String, Object> getGisInfo(CameraCmd cmd);
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/factory/CameraSDKFactory.java b/ard-work/src/main/java/com/ruoyi/device/camera/factory/CameraSDKFactory.java
index b6f8813..e742291 100644
--- a/ard-work/src/main/java/com/ruoyi/device/camera/factory/CameraSDKFactory.java
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/factory/CameraSDKFactory.java
@@ -37,6 +37,4 @@
throw new IllegalArgumentException("Unsupported device: " + factory);
}
}
-
-
-}
+}
\ No newline at end of file
diff --git a/ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DahuaSDK.java b/ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DahuaSDK.java
index 1cced79..a2e632f 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DahuaSDK.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DahuaSDK.java
@@ -627,7 +627,7 @@
}
@Override
- public List<ArdChannel> getCameraChannelList(ArdCameras camera) {
+ public List<ArdChannel> getIPChannelInfo(ArdCameras camera) {
return null;
}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/lib/LoginResultCallBack.java b/ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/lib/LoginResultCallBack.java
index 14a235e..40511ea 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/lib/LoginResultCallBack.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/lib/LoginResultCallBack.java
@@ -53,8 +53,9 @@
camera.setChanNum((int) lpDeviceinfo.byChanNum);
camera.setStartDChan((int) lpDeviceinfo.byStartDChan);
//鑾峰彇鏈�鏂伴�氶亾
- List<ArdChannel> cameraChannelList = hikClientService.getCameraChannelList(camera);
+ List<ArdChannel> cameraChannelList = hikClientService.getIPChannelInfo(camera);
if (cameraChannelList.size() > 0) {
+ camera.setChanNum(cameraChannelList.size());
//娣诲姞閫氶亾
for (ArdChannel channel : cameraChannelList) {
channel.setId(IdUtils.simpleUUID());
diff --git a/ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/service/impl/HikvisionSDK.java b/ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/service/impl/HikvisionSDK.java
index 4992f17..7c36f42 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/service/impl/HikvisionSDK.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/service/impl/HikvisionSDK.java
@@ -140,37 +140,16 @@
camera.setState("1");
camera.setChanNum((int) m_strDeviceInfo.struDeviceV30.byChanNum);
camera.setStartDChan((int) m_strDeviceInfo.struDeviceV30.byStartDChan);
- ardCamerasService.updateArdCameras(camera);
//鑾峰彇鏈�鏂伴�氶亾
- List<ArdChannel> cameraChannelList = getCameraChannelList(camera);
+ List<ArdChannel> cameraChannelList = getIPChannelInfo(camera);
if (cameraChannelList.size() > 0) {
+ camera.setChannelList(cameraChannelList);
for (ArdChannel channel : cameraChannelList) {
channel.setId(IdUtils.simpleUUID());
ardChannelService.insertArdChannel(channel);
}
//娣诲姞鍒版祦濯掍綋
- for (ArdChannel channel : cameraChannelList) {
- String name = camera.getId() + "_" + channel.getChanNo();
- String rtspSource = "rtsp://" + camera.getUsername() + ":" + camera.getPassword() + "@" + camera.getIp() + ":" + camera.getRtspPort() + "/h264/ch" + channel.getChanNo() + "/main/av_stream";
- Vtdu vtdu = vtduService.selectVtduByName(name);
- if (vtdu != null) {
- vtduService.deleteVtduByName(name);
- }
- //娣诲姞鍒版祦濯掍綋
- vtdu = new Vtdu();
- vtdu.setRtspSource(rtspSource);
- vtdu.setName(camera.getId() + "_" + channel.getChanNo());
- CameraCmd cmd = new CameraCmd(camera.getId(), channel.getChanNo());
- Map<String, Object> videoCompressionCfg = getVideoCompressionCfg(cmd);
- if (videoCompressionCfg.get("videoEncType").equals("鏍囧噯h264")) {
- vtdu.setIsCode("0");//榛樿涓嶈浆鐮�
- } else {
- vtdu.setIsCode("1");//榛樿杞爜
- }
- vtdu.setMode("1");//榛樿CPU杞В鐮�
- vtdu.setCameraId(camera.getId());
- vtduService.insertVtdu(vtdu);
- }
+ addVtdu(camera);
}
//鍒涘缓寮曞闃熷垪
if (!GuidePriorityQueue.cameraQueueMap.containsKey(camera.getId())) {
@@ -178,7 +157,7 @@
PriorityBlockingQueue<GuideTask> priorityQueue = new PriorityBlockingQueue<>(1000, comparator);
GuidePriorityQueue.cameraQueueMap.put(camera.getId(), priorityQueue);
}
-
+ ardCamerasService.updateArdCameras(camera);
} catch (Exception ex) {
log.error("娉ㄥ唽璁惧寮傚父", ex);
}
@@ -242,7 +221,7 @@
//鍒犻櫎绠$悊閫氶亾
ardChannelService.deleteArdChannelByDeviceId(camera.getId());
ardCamerasService.updateArdCameras(camera);
- return ;
+ return;
}
log.debug("Login Success [ " + camera.getIp() + ":" + camera.getPort() + " ]");
@@ -251,7 +230,7 @@
//璁剧疆寮傚父鍥炶皟鍑芥暟(鍙湪鍥炶皟鍑芥暟涓幏鍙栬澶囦笂涓嬬嚎鐘舵�佺瓑)
if (!hCNetSDK.NET_DVR_SetExceptionCallBack_V30(0, 0, fExceptionCallBack, null)) {
log.debug("Set fExceptionCallBack function fail");
- return ;
+ return;
} else {
log.debug("Set fExceptionCallBack function successfully!");
}
@@ -270,48 +249,60 @@
camera.setState("1");
camera.setChanNum((int) m_strDeviceInfo.struDeviceV30.byChanNum);
camera.setStartDChan((int) m_strDeviceInfo.struDeviceV30.byStartDChan);
- ardCamerasService.updateArdCameras(camera);
+
//鑾峰彇鏈�鏂伴�氶亾
- List<ArdChannel> cameraChannelList = getCameraChannelList(camera);
+ List<ArdChannel> cameraChannelList = getIPChannelInfo(camera);
if (cameraChannelList.size() > 0) {
+ camera.setChannelList(cameraChannelList);
+ camera.setChanNum(cameraChannelList.size());
for (ArdChannel channel : cameraChannelList) {
channel.setId(IdUtils.simpleUUID());
ardChannelService.insertArdChannel(channel);
}
- //娣诲姞鍒版祦濯掍綋
- for (ArdChannel channel : cameraChannelList) {
- String name = camera.getId() + "_" + channel.getChanNo();
- String rtspSource = "rtsp://" + camera.getUsername() + ":" + camera.getPassword() + "@" + camera.getIp() + ":" + camera.getRtspPort() + "/h264/ch" + channel.getChanNo() + "/main/av_stream";
- Vtdu vtdu = vtduService.selectVtduByName(name);
- if (vtdu != null) {
- vtduService.deleteVtduByName(name);
- }
- //娣诲姞鍒版祦濯掍綋
- vtdu = new Vtdu();
- vtdu.setRtspSource(rtspSource);
- vtdu.setName(camera.getId() + "_" + channel.getChanNo());
- CameraCmd cmd = new CameraCmd(camera.getId(), channel.getChanNo());
- Map<String, Object> videoCompressionCfg = getVideoCompressionCfg(cmd);
- if (videoCompressionCfg.get("videoEncType").equals("鏍囧噯h264")) {
- vtdu.setIsCode("0");//榛樿涓嶈浆鐮�
- } else {
- vtdu.setIsCode("1");//榛樿杞爜
- }
- vtdu.setMode("1");//榛樿CPU杞В鐮�
- vtdu.setCameraId(camera.getId());
- vtduService.insertVtdu(vtdu);
- }
}
+ ardCamerasService.updateArdCameras(camera);
+ //娣诲姞鍒版祦濯掍綋
+ addVtdu(camera);
//鍒涘缓寮曞闃熷垪
if (!GuidePriorityQueue.cameraQueueMap.containsKey(camera.getId())) {
Comparator<GuideTask> comparator = GuidePriorityQueue.getComparator();
PriorityBlockingQueue<GuideTask> priorityQueue = new PriorityBlockingQueue<>(1000, comparator);
GuidePriorityQueue.cameraQueueMap.put(camera.getId(), priorityQueue);
}
-
} catch (Exception ex) {
log.error("娉ㄥ唽璁惧寮傚父", ex);
}
+ }
+
+ //娣诲姞鍒版祦濯掍綋
+ private void addVtdu(ArdCameras camera) {
+ try {
+ for (ArdChannel channel : camera.getChannelList()) {
+ String name = camera.getId() + "_" + channel.getChanNo();
+ String rtspSource = "rtsp://" + camera.getUsername() + ":" + camera.getPassword() + "@" + camera.getIp() + ":" + camera.getRtspPort() + "/h264/ch" + channel.getChanNo() + "/main/av_stream";
+ Vtdu vtdu = vtduService.selectVtduByName(name);
+ if (vtdu != null) {
+ vtduService.deleteVtduByName(name);
+ }
+ //娣诲姞鍒版祦濯掍綋
+ vtdu = new Vtdu();
+ vtdu.setRtspSource(rtspSource);
+ vtdu.setName(camera.getId() + "_" + channel.getChanNo());
+ CameraCmd cmd = new CameraCmd(camera.getId(), channel.getChanNo());
+ Map<String, Object> videoCompressionCfg = getVideoCompressionCfg(cmd);
+ if (videoCompressionCfg.get("videoEncType").equals("鏍囧噯h264")) {
+ vtdu.setIsCode("0");//榛樿涓嶈浆鐮�
+ } else {
+ vtdu.setIsCode("1");//榛樿杞爜
+ }
+ vtdu.setMode("1");//榛樿CPU杞В鐮�
+ vtdu.setCameraId(camera.getId());
+ vtduService.insertVtdu(vtdu);
+ }
+ } catch (Exception ex) {
+ log.error("閫氶亾娣诲姞鍒版祦濯掍綋寮傚父锛�" + ex.getMessage());
+ }
+
}
/**
@@ -1194,8 +1185,7 @@
if (!bool) {
int code = hCNetSDK.NET_DVR_GetLastError();
log.error("璁剧疆澶滆澶辫触,璇风◢鍚庨噸璇�" + code);
- }
- else {
+ } else {
log.debug("璁剧疆澶滆鎴愬姛");
}
@@ -1682,38 +1672,60 @@
}
//鑾峰彇IP閫氶亾
- @Override
- public List<ArdChannel> getCameraChannelList(ArdCameras camera) {
- /*鑾峰彇閫氶亾*/
+ public List<ArdChannel> getIPChannelInfo(ArdCameras camera) {
+
+ //鑾峰彇閫氶亾
List<ArdChannel> channelList = new ArrayList<>();
try {
- Integer chanNum = camera.getChanNum();
- Integer startDChan = camera.getStartDChan();
- if (chanNum > 0) {
- // 鑾峰彇閫氶亾鍙�
- for (int iChannum = 0; iChannum < chanNum; iChannum++) {
- ArdChannel ardChannel = new ArdChannel();
- int channum = iChannum + startDChan + 1;
- HCNetSDK.NET_DVR_PICCFG_V40 strPicCfg = new HCNetSDK.NET_DVR_PICCFG_V40();
- strPicCfg.dwSize = strPicCfg.size();
- strPicCfg.write();
- Pointer pStrPicCfg = strPicCfg.getPointer();
- NativeLong lChannel = new NativeLong(channum);
- IntByReference pInt = new IntByReference(0);
- boolean b_GetPicCfg = hCNetSDK.NET_DVR_GetDVRConfig(camera.getLoginId(), HCNetSDK.NET_DVR_GET_PICCFG_V40, lChannel.intValue(),
- pStrPicCfg, strPicCfg.size(), pInt);
- if (b_GetPicCfg) {
- strPicCfg.read();
- String channelName = new String(strPicCfg.sChanName, "GBK").trim();
- ardChannel.setName(channelName);
- }
+ if (camera.getGdtype().equals("3")) {
+ camera.setChanNum(64);//瓒呰剳鑾峰彇鍦ㄧ嚎閫氶亾鏁�
+ camera.setStartDChan(0);//瓒呰剳鍒濆閫氶亾涓�0
+ }
+ IntByReference ibrBytesReturned = new IntByReference(0);//鑾峰彇IP鎺ュ叆閰嶇疆鍙傛暟
+ HCNetSDK.NET_DVR_IPPARACFG_V40 m_strIpparaCfg = new HCNetSDK.NET_DVR_IPPARACFG_V40();
+ m_strIpparaCfg.write();
+ //lpIpParaConfig 鎺ユ敹鏁版嵁鐨勭紦鍐叉寚閽�
+ Pointer lpIpParaConfig = m_strIpparaCfg.getPointer();
+ boolean bRet = hCNetSDK.NET_DVR_GetDVRConfig(camera.getLoginId(), HCNetSDK.NET_DVR_GET_IPPARACFG_V40, 0, lpIpParaConfig, m_strIpparaCfg.size(), ibrBytesReturned);
+ m_strIpparaCfg.read();
+ //log.debug("璧峰鏁板瓧閫氶亾鍙凤細" + m_strIpparaCfg.dwStartDChan);//m_strIpparaCfg.dwDChanNum
+ for (int iChannum = 0; iChannum < camera.getChanNum(); iChannum++) {
+ ArdChannel ardChannel = new ArdChannel();
+ int channum = iChannum + camera.getStartDChan() + 1;
+ HCNetSDK.NET_DVR_PICCFG_V40 strPicCfg = new HCNetSDK.NET_DVR_PICCFG_V40();
+ strPicCfg.dwSize = strPicCfg.size();
+ strPicCfg.write();
+ Pointer pStrPicCfg = strPicCfg.getPointer();
+ NativeLong lChannel = new NativeLong(channum);
+ IntByReference pInt = new IntByReference(0);
+ boolean b_GetPicCfg = hCNetSDK.NET_DVR_GetDVRConfig(camera.getLoginId(), HCNetSDK.NET_DVR_GET_PICCFG_V40, lChannel.intValue(),
+ pStrPicCfg, strPicCfg.size(), pInt);
+ if (!b_GetPicCfg) {
+ // log.error("鑾峰彇鍥惧儚鍙傛暟澶辫触锛岄敊璇爜锛�" + hCNetSDK.NET_DVR_GetLastError());
+ }
+ strPicCfg.read();
+ m_strIpparaCfg.struStreamMode[iChannum].read();
+ if (m_strIpparaCfg.struStreamMode[iChannum].byGetStreamType == 0) {
+ m_strIpparaCfg.struStreamMode[iChannum].uGetStream.setType(HCNetSDK.NET_DVR_IPCHANINFO.class);
+ m_strIpparaCfg.struStreamMode[iChannum].uGetStream.struChanInfo.read();
+ int channel = m_strIpparaCfg.struStreamMode[iChannum].uGetStream.struChanInfo.byIPID + m_strIpparaCfg.struStreamMode[iChannum].uGetStream.struChanInfo.byIPIDHigh * 256;
+ String channelName = new String(strPicCfg.sChanName, "GBK").trim();
ardChannel.setDeviceId(camera.getId());
- ardChannel.setChanNo(iChannum + 1);
- channelList.add(ardChannel);
+ ardChannel.setName(channelName);
+ ardChannel.setChanNo(channum);
+ if (camera.getGdtype().equals("3")) {
+ //瓒呰剳鍙幏鍙栧湪绾块�氶亾
+ if (m_strIpparaCfg.struStreamMode[iChannum].uGetStream.struChanInfo.byEnable == 1) {
+ //log.debug("IP閫氶亾" + channum + "鍦ㄧ嚎");
+ channelList.add(ardChannel);
+ }
+ } else {
+ channelList.add(ardChannel);
+ }
}
}
} catch (Exception ex) {
- log.error("鑾峰彇鐩告満閫氶亾寮傚父:" + ex.getMessage());
+ log.error("鑾峰彇IP閫氶亾寮傚父:" + ex.getMessage());
}
return channelList;
}
diff --git a/ard-work/src/main/resources/mapper/alarm/ArdAlarmSuperBrainMapper.xml b/ard-work/src/main/resources/mapper/alarm/ArdAlarmSuperBrainMapper.xml
new file mode 100644
index 0000000..27368c8
--- /dev/null
+++ b/ard-work/src/main/resources/mapper/alarm/ArdAlarmSuperBrainMapper.xml
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.alarm.superbrain.mapper.ArdAlarmSuperBrainMapper">
+
+ <resultMap type="ArdAlarmSuperBrain" id="ArdAlarmSuperBrainResult">
+ <result property="id" column="id"/>
+ <result property="alarmName" column="alarm_name"/>
+ <result property="alarmType" column="alarm_type"/>
+ <result property="alarmTime" column="alarm_time"/>
+ <result property="deviceId" column="device_id"/>
+ <result property="deviceName" column="device_name"/>
+ <result property="chanNo" column="chan_no"/>
+ <result property="longitude" column="longitude"/>
+ <result property="latitude" column="latitude"/>
+ <result property="altitude" column="altitude"/>
+ <result property="picUrl" column="pic_url"/>
+ <result property="faceUrl" column="face_url"/>
+ <result property="createBy" column="create_by"/>
+ <result property="createTime" column="create_time"/>
+ <result property="updateBy" column="update_by"/>
+ <result property="updateTime" column="update_time"/>
+ <result property="viewTime" column="view_time"/>
+ </resultMap>
+
+ <sql id="selectArdAlarmSuperBrainVo">
+ select id,
+ alarm_name,
+ alarm_type,
+ alarm_time,
+ device_id,
+ device_name,
+ chan_no,
+ longitude,
+ latitude,
+ altitude,
+ pic_url,
+ face_url,
+ create_by,
+ create_time,
+ update_by,
+ update_time,
+ view_time
+ from ard_alarm_super_brain
+ </sql>
+
+ <select id="selectArdAlarmSuperBrainList" parameterType="ArdAlarmSuperBrain" resultMap="ArdAlarmSuperBrainResult">
+ <include refid="selectArdAlarmSuperBrainVo"/>
+ <where>
+ <if test="alarmName != null and alarmName != ''">and alarm_name like '%'||#{alarmName}||'%'</if>
+ <if test="alarmType != null and alarmType != ''">and alarm_type = #{alarmType}</if>
+ <if test="alarmTime != null ">and alarm_time = #{alarmTime}</if>
+ <if test="deviceId != null and deviceId != ''">and device_id = #{deviceId}</if>
+ <if test="deviceName != null and deviceName != ''">and device_name like '%'||#{deviceName}||'%'</if>
+ <if test="chanNo != null ">and chan_no = #{chanNo}</if>
+ <if test="longitude != null ">and longitude = #{longitude}</if>
+ <if test="latitude != null ">and latitude = #{latitude}</if>
+ <if test="altitude != null ">and altitude = #{altitude}</if>
+ <if test="picUrl != null and picUrl != ''">and pic_url = #{picUrl}</if>
+ <if test="faceUrl != null and faceUrl != ''">and face_url = #{faceUrl}</if>
+ <if test="viewTime != null ">and view_time = #{viewTime}</if>
+
+ <if test="params.beginTime != null and params.beginTime != ''"><!-- 寮�濮嬫椂闂存绱� -->
+ AND alarm_time >= to_timestamp(#{params.beginTime},'yyyy-MM-DD HH24:MI:ss')
+ </if>
+ <if test="params.endTime != null and params.endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� -->
+ AND alarm_time <= to_timestamp(#{params.endTime},'yyyy-MM-DD HH24:MI:ss')
+ </if>
+
+ </where>
+ </select>
+
+ <select id="selectArdAlarmSuperBrainById" parameterType="String" resultMap="ArdAlarmSuperBrainResult">
+ <include refid="selectArdAlarmSuperBrainVo"/>
+ where id = #{id}
+ </select>
+
+ <insert id="insertArdAlarmSuperBrain" parameterType="ArdAlarmSuperBrain">
+ insert into ard_alarm_super_brain
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">id,</if>
+ <if test="alarmName != null">alarm_name,</if>
+ <if test="alarmType != null">alarm_type,</if>
+ <if test="alarmTime != null">alarm_time,</if>
+ <if test="deviceId != null">device_id,</if>
+ <if test="deviceName != null">device_name,</if>
+ <if test="chanNo != null">chan_no,</if>
+ <if test="longitude != null">longitude,</if>
+ <if test="latitude != null">latitude,</if>
+ <if test="altitude != null">altitude,</if>
+ <if test="picUrl != null">pic_url,</if>
+ <if test="faceUrl != null">face_url,</if>
+ <if test="createBy != null">create_by,</if>
+ <if test="createTime != null">create_time,</if>
+ <if test="updateBy != null">update_by,</if>
+ <if test="updateTime != null">update_time,</if>
+ <if test="viewTime != null">view_time,</if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="id != null">#{id},</if>
+ <if test="alarmName != null">#{alarmName},</if>
+ <if test="alarmType != null">#{alarmType},</if>
+ <if test="alarmTime != null">#{alarmTime},</if>
+ <if test="deviceId != null">#{deviceId},</if>
+ <if test="deviceName != null">#{deviceName},</if>
+ <if test="chanNo != null">#{chanNo},</if>
+ <if test="longitude != null">#{longitude},</if>
+ <if test="latitude != null">#{latitude},</if>
+ <if test="altitude != null">#{altitude},</if>
+ <if test="picUrl != null">#{picUrl},</if>
+ <if test="faceUrl != null">#{faceUrl},</if>
+ <if test="createBy != null">#{createBy},</if>
+ <if test="createTime != null">#{createTime},</if>
+ <if test="updateBy != null">#{updateBy},</if>
+ <if test="updateTime != null">#{updateTime},</if>
+ <if test="viewTime != null">#{viewTime},</if>
+ </trim>
+ </insert>
+
+ <update id="updateArdAlarmSuperBrain" parameterType="ArdAlarmSuperBrain">
+ update ard_alarm_super_brain
+ <trim prefix="SET" suffixOverrides=",">
+ <if test="alarmName != null">alarm_name = #{alarmName},</if>
+ <if test="alarmType != null">alarm_type = #{alarmType},</if>
+ <if test="alarmTime != null">alarm_time = #{alarmTime},</if>
+ <if test="deviceId != null">device_id = #{deviceId},</if>
+ <if test="deviceName != null">device_name = #{deviceName},</if>
+ <if test="chanNo != null">chan_no = #{chanNo},</if>
+ <if test="longitude != null">longitude = #{longitude},</if>
+ <if test="latitude != null">latitude = #{latitude},</if>
+ <if test="altitude != null">altitude = #{altitude},</if>
+ <if test="picUrl != null">pic_url = #{picUrl},</if>
+ <if test="faceUrl != null">face_url = #{faceUrl},</if>
+ <if test="createBy != null">create_by = #{createBy},</if>
+ <if test="createTime != null">create_time = #{createTime},</if>
+ <if test="updateBy != null">update_by = #{updateBy},</if>
+ <if test="updateTime != null">update_time = #{updateTime},</if>
+ <if test="viewTime != null">view_time = #{viewTime},</if>
+ </trim>
+ where id = #{id}
+ </update>
+
+ <delete id="deleteArdAlarmSuperBrainById" parameterType="String">
+ delete
+ from ard_alarm_super_brain
+ where id = #{id}
+ </delete>
+
+ <delete id="deleteArdAlarmSuperBrainByIds" parameterType="String">
+ delete from ard_alarm_super_brain where id in
+ <foreach item="id" collection="array" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </delete>
+ <select id="selectCountByAlarmTime" resultType="Integer">
+ SELECT COUNT(DISTINCT aasb.id)
+ FROM ard_alarm_super_brain aasb
+ WHERE aasb.alarm_time >= CURRENT_TIMESTAMP - INTERVAL '%${refreshTime}%' MINUTE
+ and aasb.view_time is null
+ </select>
+ <select id="selectListAllByCommand" resultMap="ArdAlarmSuperBrainResult">
+ SELECT T.*
+ FROM (
+ SELECT aasb.ID,
+ aasb.alarm_name,
+ aasb.alarm_type,
+ aasb.alarm_time,
+ aasb.longitude,
+ aasb.latitude,
+ aasb.altitude,
+ ROW_NUMBER() OVER ( PARTITION BY aasb.alarm_type ORDER BY aasb.alarm_time DESC ) AS rn, COUNT(CASE WHEN aasb.view_time IS NULL THEN 1 END) OVER ( PARTITION BY aasb.alarm_type ) AS COUNT,
+ COUNT ( aasb.alarm_time ) OVER ( PARTITION BY aasb.alarm_type ) AS total
+ FROM
+ ard_alarm_super_brain aasb
+ WHERE
+ aasb.alarm_time >= ( CURRENT_TIMESTAMP - INTERVAL '%${refreshTime}%' MINUTE )
+ ORDER BY
+ aasb.alarm_time DESC
+ ) T
+ WHERE T.rn = 1
+ </select>
+ <update id="updateViewTimeByAlarmType" parameterType="String">
+ update ard_alarm_super_brain
+ set view_time=#{viewTime}
+ where alarm_type = #{alarmType}
+ and alarm_time <= #{alarmTime}
+ and view_time is null
+ </update>
+</mapper>
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/resources/i18n/messages.properties b/ruoyi-admin/src/main/resources/i18n/messages.properties
index 44b1d24..8dbfd62 100644
--- a/ruoyi-admin/src/main/resources/i18n/messages.properties
+++ b/ruoyi-admin/src/main/resources/i18n/messages.properties
@@ -212,6 +212,7 @@
dic.data.repeat.period.day=\u65E5
dic.data.repeat.period.hour=\u5C0F\u65F6
dic.data.repeat.period.min=\u5206\u949F
+dic.data.alarm.type.ai=AI\u62A5\u8B66
dic.data.alarm.type.elec.steal=\u76D7\u7535\u62A5\u8B66
dic.data.alarm.type.radar=\u96F7\u8FBE\u62A5\u8B66
dic.data.alarm.type.camera=\u901A\u7528\u5149\u7535
diff --git a/ruoyi-admin/src/main/resources/i18n/messages_en_US.properties b/ruoyi-admin/src/main/resources/i18n/messages_en_US.properties
index 2b716d8..b9eff6b 100644
--- a/ruoyi-admin/src/main/resources/i18n/messages_en_US.properties
+++ b/ruoyi-admin/src/main/resources/i18n/messages_en_US.properties
@@ -182,6 +182,7 @@
dic.data.well.type.ketou=ketou
dic.data.work.state.normal=normal
dic.data.work.state.exception=exception
+dic.data.alarm.type.ai=AIAlarm
dic.data.equip.type.alarm=alarmHost
dic.data.equip.type.GPS=GPS
dic.data.equip.type.gycgq=gycgq
diff --git a/ruoyi-admin/src/main/resources/i18n/messages_zh_CN.properties b/ruoyi-admin/src/main/resources/i18n/messages_zh_CN.properties
index 9d70298..68cfc37 100644
--- a/ruoyi-admin/src/main/resources/i18n/messages_zh_CN.properties
+++ b/ruoyi-admin/src/main/resources/i18n/messages_zh_CN.properties
@@ -220,6 +220,7 @@
dic.data.repeat.period.day=\u65E5
dic.data.repeat.period.hour=\u5C0F\u65F6
dic.data.repeat.period.min=\u5206\u949F
+dic.data.alarm.type.ai=AI\u62A5\u8B66
dic.data.alarm.type.elec.steal=\u76D7\u7535\u62A5\u8B66
dic.data.alarm.type.radar=\u96F7\u8FBE\u62A5\u8B66
dic.data.alarm.type.camera=\u901A\u7528\u5149\u7535
--
Gitblit v1.9.3