|
|
@ -2,21 +2,16 @@ package com.storeroom.modules.device.controller; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty; |
|
|
|
|
|
|
|
import com.storeroom.annotaion.rest.AnonymousDeleteMapping; |
|
|
|
import com.storeroom.annotaion.rest.AnonymousGetMapping; |
|
|
|
import com.storeroom.annotaion.rest.AnonymousPostMapping; |
|
|
|
import com.storeroom.exception.BaseException; |
|
|
|
import com.storeroom.modules.device.domain.AlarmDeseCaBinetLog; |
|
|
|
import com.storeroom.modules.device.domain.DeviceInfo; |
|
|
|
import com.storeroom.modules.device.service.ArchivesCasesService; |
|
|
|
import com.storeroom.modules.device.service.DeviceService; |
|
|
|
import com.storeroom.modules.device.service.OperatingStateService; |
|
|
|
import com.storeroom.modules.device.domain.*; |
|
|
|
import com.storeroom.modules.device.service.*; |
|
|
|
import com.storeroom.modules.storeroom3d.service.AlarmInfoService; |
|
|
|
import com.storeroom.modules.storeroom3d.service.ThirdApiService; |
|
|
|
import com.storeroom.utils.ApiResponse; |
|
|
|
import com.storeroom.utils.HttpUtils; |
|
|
|
import com.storeroom.utils.StringUtils; |
|
|
|
import com.storeroom.utils.*; |
|
|
|
import com.storeroom.utils.enums.ResponseStatus; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
@ -30,10 +25,7 @@ import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
@RestController |
|
|
|
@RequiredArgsConstructor |
|
|
@ -46,6 +38,8 @@ public class DeviceController { |
|
|
|
private final ArchivesCasesService archivesCaseService; |
|
|
|
private final AlarmInfoService alarmInfoService; |
|
|
|
private final ThirdApiService thirdApiService; |
|
|
|
private final CameraInfoService cameraInfoService; |
|
|
|
private final DeviceCamerBindService deviceCamerBindService; |
|
|
|
|
|
|
|
@ApiOperation("获取所有设备") |
|
|
|
@AnonymousGetMapping("all") |
|
|
@ -166,8 +160,31 @@ public class DeviceController { |
|
|
|
@ApiOperation("第三方对接-上传密集架报警信息") |
|
|
|
@AnonymousPostMapping("log") |
|
|
|
public Object deseCabinetAlarmLog(@RequestBody AlarmDeseCaBinetLog alarmDeseCaBinetLog) { |
|
|
|
|
|
|
|
if (StringUtils.isEmpty(alarmDeseCaBinetLog.getI64Ts())) { |
|
|
|
alarmDeseCaBinetLog.setI64Ts(DateUtils.getNowTimeInMillis()); |
|
|
|
} |
|
|
|
deviceService.upLoadAlarmLog(alarmDeseCaBinetLog); |
|
|
|
|
|
|
|
//只记录报警日志下载视频,操作开架视频下载由自己接口提供 |
|
|
|
if (alarmDeseCaBinetLog.getUsLevel() == 1) { |
|
|
|
List<CameraInfo> cameraInfoList = new ArrayList<>(); |
|
|
|
|
|
|
|
List<DeviceCamerBind> list = deviceCamerBindService.queryStoreroomCode(alarmDeseCaBinetLog.getStoreCode()); |
|
|
|
list.forEach(item -> { |
|
|
|
CameraInfo cameraInfo = new CameraInfo(); |
|
|
|
cameraInfo.setId(NanoIdUtils.randomNanoId()); |
|
|
|
cameraInfo.setDeviceCamerBindId(item); |
|
|
|
cameraInfo.setDescription(alarmDeseCaBinetLog.getCContext()); |
|
|
|
cameraInfo.setEvent("密集架报警"); |
|
|
|
//循环从第三方设备下载视频到服务器 |
|
|
|
String fileName = deviceCamerBindService.downloadVideo(alarmDeseCaBinetLog.getI64Ts(), item.getDeviceInfoId(), item.getId()); |
|
|
|
cameraInfo.setDownloadLink(fileName); |
|
|
|
cameraInfoList.add(cameraInfo); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
cameraInfoService.createAll(cameraInfoList); |
|
|
|
} |
|
|
|
Map<String, Object> objectMap = new HashMap<>(); |
|
|
|
objectMap.put("code", ""); |
|
|
|
objectMap.put("errorinfo", ""); |
|
|
|