|
@@ -40,9 +40,7 @@ import javax.validation.constraints.NotNull;
|
|
|
import java.io.InputStream;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Comparator;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -631,6 +629,66 @@ public class BaseCameraManagementController extends BaseController {
|
|
|
return new AjaxResult(200, "ok", CameraUtil.getPlayFlv(cameraCode, one.getChannel(), flay));
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation("查询回放视频根据报警ID")
|
|
|
+ @GetMapping("/api/getRecordByAlarmId")
|
|
|
+ @Log(title = "相机台账管理", businessType = BusinessType.OTHER)
|
|
|
+ public AjaxResult getRecordByAlarmId(@RequestParam("alarmId") String alarmId) {
|
|
|
+ LambdaQueryWrapper<MsgAlarm> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(MsgAlarm::getAlarmId, alarmId);
|
|
|
+ MsgAlarm msgAlarm = msgAlarmService.getOne(wrapper);
|
|
|
+ if (ObjectUtils.isEmpty(msgAlarm.getReleasedUrl())) {
|
|
|
+ LambdaQueryWrapper<BaseRailwayManagement> wrapperRailway = new LambdaQueryWrapper<>();
|
|
|
+ if (!ObjectUtils.isEmpty(msgAlarm.getRailwayCode())) {
|
|
|
+ wrapperRailway.eq(BaseRailwayManagement::getRailwayCode, msgAlarm.getRailwayCode());
|
|
|
+ }
|
|
|
+ BaseRailwayManagement baseRailwayManagement = baseRailwayManagementService.getOne(wrapperRailway);
|
|
|
+ if (StringUtils.isEmptySunhh(baseRailwayManagement)) {
|
|
|
+ return AjaxResult.error("报警线路编码:" + msgAlarm.getRailwayCode() + "不存在!");
|
|
|
+ }
|
|
|
+ // 查询里程位置最近的相机
|
|
|
+ LambdaQueryWrapper<BaseCameraManagement> lw = new LambdaQueryWrapper<>();
|
|
|
+ if (!StringUtils.isEmptySunhh(msgAlarm.getRailwayCode())) {
|
|
|
+ lw.eq(BaseCameraManagement::getRailwayCode, msgAlarm.getRailwayCode());
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmptySunhh(msgAlarm.getAlarmMile())) {
|
|
|
+ lw.le(BaseCameraManagement::getBeginMile, msgAlarm.getAlarmMile());
|
|
|
+ lw.gt(BaseCameraManagement::getEndMile, msgAlarm.getAlarmMile());
|
|
|
+ }
|
|
|
+ List<BaseCameraManagement> baseCameraManagementList = baseCameraManagementService.list(lw);
|
|
|
+ BaseCameraManagement baseCameraManagement = new BaseCameraManagement();
|
|
|
+ if (!StringUtils.isEmptySunhh(baseCameraManagementList) && baseCameraManagementList.size() > 0) {
|
|
|
+ baseCameraManagement = baseCameraManagementList.get(0);
|
|
|
+ } else {
|
|
|
+ return AjaxResult.error("报警里程范围内:" + msgAlarm.getAlarmMile() + "没有可查看的相机!");
|
|
|
+ }
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("isLock", msgAlarm.getIsRelease());
|
|
|
+ map.put("releasedTime", msgAlarm.getReleasedTime());
|
|
|
+ map.put("alarmTime", msgAlarm.getAlarmMile());
|
|
|
+ map.put("channel", baseCameraManagement.getChannel());
|
|
|
+ map.put("cameraCode", baseCameraManagement.getCameraCode());
|
|
|
+ // Map<String, Object> map = baseCameraManagementService.getCameraChannelByAlarmId(alarmId);
|
|
|
+ if (!ObjectUtils.isEmpty(map)
|
|
|
+ && map.size() > 0
|
|
|
+ && !org.apache.commons.lang3.StringUtils.isBlank(map.get("channel").toString())) {
|
|
|
+ String url = null;
|
|
|
+ if (map.get("isLock").toString().equals("1")) {
|
|
|
+ url = com.ozs.web.core.util.CameraUtil.historyPlayListStr(map.get("channel").toString(),
|
|
|
+ (Date) map.get("alarmTime"),
|
|
|
+ (Date) map.get("releasedTime"),
|
|
|
+ true);
|
|
|
+ msgAlarm.setReleasedUrl(url);
|
|
|
+ msgAlarmService.updateById(msgAlarm);
|
|
|
+ }
|
|
|
+ return error("报警ID为:【" + alarmId + "】的相机信息还未生成报警回放视频");
|
|
|
+ } else {
|
|
|
+ return error("报警ID为:【" + alarmId + "】的相机信息不存在");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return new AjaxResult(200, "ok", caneraConfig.getRecordUrl() + msgAlarm.getReleasedUrl());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation("播放回放-new")
|
|
|
@PostMapping("/api/record")
|
|
|
@Log(title = "相机台账管理", businessType = BusinessType.OTHER)
|