|
@@ -212,10 +212,10 @@ public class GeoHazardMonitorTokenController {
|
|
|
msgAlarm.setAlarmTime(new Date(reqMsgAlarmVo.getAlarmTime()));
|
|
|
log.info("时间++++get" + msgAlarm.getAlarmTime());
|
|
|
BaseCameraManagement bcm = msgAlarmService.getBaseCameraManagementByCamereCode(msgAlarm.getCameraCode());
|
|
|
- BaseCameraVO baseCameraVO=new BaseCameraVO();
|
|
|
+ BaseCameraVO baseCameraVO = new BaseCameraVO();
|
|
|
baseCameraVO.setCameraCode(bcm.getCameraCode());
|
|
|
baseCameraVO.setChannel(bcm.getChannel());
|
|
|
- redisService.addToSet(Constants.ALARM_SET,baseCameraVO);
|
|
|
+ redisService.addToSet(Constants.ALARM_SET, baseCameraVO);
|
|
|
msgAlarmService.getNormalBaseCameraManagementsCache(Constants.ALARM_SET);
|
|
|
msgAlarmService.save(msgAlarm);
|
|
|
msgAlarmVice.setImageUrl(url.substring(0, url.length() - 1));
|
|
@@ -287,7 +287,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
|
|
|
@GetMapping("/test/{code}")
|
|
|
public void test(@PathVariable String code) {
|
|
|
- String alarmUrl = alarmHistoryPlay(code, code,new Date());
|
|
|
+ String alarmUrl = alarmHistoryPlay(code, code, new Date());
|
|
|
log.info(alarmUrl);
|
|
|
}
|
|
|
|
|
@@ -315,21 +315,32 @@ public class GeoHazardMonitorTokenController {
|
|
|
BaseUser admin = baseUserService.getUserName("admin");
|
|
|
lw.eq(BaseDeviceDynamicManagement::getCameraCode, reqDeviceVo.getCameraCode());
|
|
|
BaseDeviceDynamicManagement baseDynamicManagement = baseDeviceDynamicManagementService.getOne(lw);
|
|
|
- baseDynamicManagement.setElectricity(reqDeviceVo.getElectricity());
|
|
|
- if (reqDeviceVo.getTime().toString().length() == 10) {
|
|
|
- reqDeviceVo.setTime(reqDeviceVo.getTime() * 1000);
|
|
|
- }
|
|
|
- baseDynamicManagement.setUpdateTime(new Date(reqDeviceVo.getTime()));
|
|
|
- baseDynamicManagement.setUpdateBy(admin.getUserId());
|
|
|
- log.info("reqDeviceVo:{}", baseDynamicManagement);
|
|
|
- if (baseDeviceDynamicManagementService.updateById(baseDynamicManagement)) {
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ Date targetDate = dateFormat.parse("2024-10-25 00:00:00");
|
|
|
+ log.info("修改时间----" + baseDynamicManagement.getUpdateTime());
|
|
|
+ log.info("自己定义的时间----" + targetDate);
|
|
|
+ if (!baseDynamicManagement.getUpdateTime().equals(targetDate)) {
|
|
|
+ baseDynamicManagement.setElectricity(reqDeviceVo.getElectricity());
|
|
|
+ if (reqDeviceVo.getTime().toString().length() == 10) {
|
|
|
+ reqDeviceVo.setTime(reqDeviceVo.getTime() * 1000);
|
|
|
+ }
|
|
|
+ baseDynamicManagement.setUpdateTime(new Date(reqDeviceVo.getTime()));
|
|
|
+ baseDynamicManagement.setUpdateBy(admin.getUserId());
|
|
|
+ log.info("reqDeviceVo:{}", baseDynamicManagement);
|
|
|
+ if (baseDeviceDynamicManagementService.updateById(baseDynamicManagement)) {
|
|
|
+ jsonObject.put("resultCode", 1);
|
|
|
+ jsonObject.put("message", "成功");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
+ } else {
|
|
|
+ jsonObject.put("resultCode", 0);
|
|
|
+ jsonObject.put("message", "设备状态数据传输失败");
|
|
|
+ return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
jsonObject.put("resultCode", 1);
|
|
|
jsonObject.put("message", "成功");
|
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
}
|
|
|
- jsonObject.put("resultCode", 0);
|
|
|
- jsonObject.put("message", "设备状态数据传输失败");
|
|
|
- return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
|
} else {
|
|
|
jsonObject.put("resultCode", 2);
|
|
|
jsonObject.put("message", "token验证失败");
|
|
@@ -340,11 +351,12 @@ public class GeoHazardMonitorTokenController {
|
|
|
|
|
|
/**
|
|
|
* 报警视频回放新
|
|
|
+ *
|
|
|
* @param channel
|
|
|
* @param cameraCode
|
|
|
* @return
|
|
|
*/
|
|
|
- public String alarmHistoryPlay(String channel,String cameraCode,Date alarmDate) {
|
|
|
+ public String alarmHistoryPlay(String channel, String cameraCode, Date alarmDate) {
|
|
|
// 获取当前时间
|
|
|
// 将Date对象转换为Instant对象
|
|
|
Instant instant = alarmDate.toInstant();
|
|
@@ -375,15 +387,15 @@ public class GeoHazardMonitorTokenController {
|
|
|
try {
|
|
|
result = HttpClientUtil.get(url);
|
|
|
if ("200".equals(result)) {
|
|
|
- String path = apiSummary(cameraCode + "/" + channel+"/"+seconds+"-"+second);
|
|
|
- if (org.apache.commons.lang3.StringUtils.isNotEmpty(path)){
|
|
|
- String codes = HttpUtils.sendGet(startRecording(cameraCode + "/" + channel+"/"+seconds+"-"+second));
|
|
|
+ String path = apiSummary(cameraCode + "/" + channel + "/" + seconds + "-" + second);
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotEmpty(path)) {
|
|
|
+ String codes = HttpUtils.sendGet(startRecording(cameraCode + "/" + channel + "/" + seconds + "-" + second));
|
|
|
log.info("codes------>" + codes);
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
// 使用SimpleDateFormat将Date对象格式化为指定样式的字符串
|
|
|
String formattedDate = sdf.format(alarmDate);
|
|
|
log.info("-----formattedDate-----------" + formattedDate);
|
|
|
- String records = getQueryRecords(cameraCode + "/" + channel+"/"+seconds+"-"+second, formattedDate,"mp4");
|
|
|
+ String records = getQueryRecords(cameraCode + "/" + channel + "/" + seconds + "-" + second, formattedDate, "mp4");
|
|
|
log.info("-----records-----------" + records);
|
|
|
return records;
|
|
|
}
|
|
@@ -400,7 +412,7 @@ public class GeoHazardMonitorTokenController {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public String apiSummary(String path) {
|
|
|
+ public String apiSummary(String path) {
|
|
|
int maxRetries = 5;
|
|
|
int retryCount = 0;
|
|
|
boolean success = false;
|
|
@@ -442,14 +454,13 @@ public class GeoHazardMonitorTokenController {
|
|
|
* @param cameraCode 相机编码
|
|
|
* @return
|
|
|
*/
|
|
|
- public String startRecording(String cameraCode) {
|
|
|
+ public String startRecording(String cameraCode) {
|
|
|
log.info("-----startRecording------" + bakUrl + "/recordpro/api/start?streamPath=" + cameraCode + "&type=mp4");
|
|
|
- return bakUrl + "/recordpro/api/start?streamPath=" + cameraCode +"&type=mp4";
|
|
|
+ return bakUrl + "/recordpro/api/start?streamPath=" + cameraCode + "&type=mp4";
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据设备id和通道ID和日期获取设备录像文件
|
|
|
- *
|
|
|
*/
|
|
|
public String getQueryRecords(String streamPath, String date, String type) {
|
|
|
|