修改告警相关内容,以保证温州海事局二期项目不报错

This commit is contained in:
2026-01-08 21:31:28 +08:00
parent 0273ce0a9a
commit 955f6ef0c8

View File

@@ -7,19 +7,19 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ltgk.smartFishingPort.common.utils.MybatisUtil;
import com.ltgk.smartFishingPort.domain.dto.VideoIdentificationDto;
import com.ltgk.smartFishingPort.domain.entity.VideoCamera;
import com.ltgk.smartFishingPort.domain.entity.DsVideo;
import com.ltgk.smartFishingPort.domain.entity.VideoIdentification;
import com.ltgk.smartFishingPort.mapper.VideoIdentificationMapper;
import com.ltgk.smartFishingPort.service.IVideoCameraService;
import com.ltgk.smartFishingPort.service.IDsVideoService;
import com.ltgk.smartFishingPort.service.IVideoIdentificationService;
import com.ltgk.smartFishingPort.utils.CameraDegreesUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
@@ -39,8 +39,8 @@ public class VideoIdentificationServiceImpl extends ServiceImpl<VideoIdentificat
@Value("${url.picFile}")
private String picUrl;
@Autowired
IVideoCameraService videoCameraService;
@Resource
IDsVideoService dsVideoService;
/**
* 分页查询渔船识别
@@ -69,10 +69,10 @@ public class VideoIdentificationServiceImpl extends ServiceImpl<VideoIdentificat
if (!StringUtils.isEmpty(videoIdentificationDto.getEndTime())) {
queryWrapper.le("take_time", videoIdentificationDto.getEndTime());
}
if (!ObjectUtils.isEmpty(videoIdentificationDto.getIsHasBoatName()) && videoIdentificationDto.getIsHasBoatName().equals(1)){
queryWrapper.notIn("boat_name", "无船号","未知","");
}else if (!ObjectUtils.isEmpty(videoIdentificationDto.getIsHasBoatName()) && videoIdentificationDto.getIsHasBoatName().equals(2)){
queryWrapper.in("boat_name", "无船号","未知","");
if (!ObjectUtils.isEmpty(videoIdentificationDto.getIsHasBoatName()) && videoIdentificationDto.getIsHasBoatName().equals(1)) {
queryWrapper.notIn("boat_name", "无船号", "未知", "");
} else if (!ObjectUtils.isEmpty(videoIdentificationDto.getIsHasBoatName()) && videoIdentificationDto.getIsHasBoatName().equals(2)) {
queryWrapper.in("boat_name", "无船号", "未知", "");
}
queryWrapper.orderByDesc("take_time");
IPage<VideoIdentification> pageResult = baseMapper.selectPage(pageParam, queryWrapper);
@@ -118,30 +118,30 @@ public class VideoIdentificationServiceImpl extends ServiceImpl<VideoIdentificat
m.setHeight(new BigDecimal(m.getHeightRange().split("-")[0]));
}
String videoName = m.getVideoName();
VideoCamera videoCamera = null;
DsVideo dsVideo = null;
if (!StringUtils.isEmpty(videoName)) {
LambdaQueryWrapper<VideoCamera> videoCameraQueryWrapper = new LambdaQueryWrapper<>();
videoCameraQueryWrapper.eq(VideoCamera::getVideoName, videoName);
videoCameraQueryWrapper.last("limit 1");
videoCamera = videoCameraService.getOne(videoCameraQueryWrapper);
if (!Objects.isNull(videoCamera)) {
m.setVideoCode(videoCamera.getVideoCode());
LambdaQueryWrapper<DsVideo> dsVideoLambdaQueryWrapper = new LambdaQueryWrapper<>();
dsVideoLambdaQueryWrapper.eq(DsVideo::getVideoName, videoName);
dsVideoLambdaQueryWrapper.last("limit 1");
dsVideo = dsVideoService.getOne(dsVideoLambdaQueryWrapper);
if (!Objects.isNull(dsVideo)) {
m.setVideoCode(dsVideo.getVideoCode());
}
}
if (!StringUtils.isEmpty(m.getVideoName())
&& !Objects.isNull(m.getLatitude()) && !Objects.isNull(m.getLongitude())) {
if (Objects.isNull(videoCamera)) {
if (Objects.isNull(dsVideo)) {
m.setDistance(BigDecimal.ZERO);
} else if (Objects.isNull(videoCamera.getLatitude()) || Objects.isNull(videoCamera.getLongitude())) {
} else if (Objects.isNull(dsVideo.getLatitude()) || Objects.isNull(dsVideo.getLongitude())) {
m.setDistance(BigDecimal.ZERO);
} else {
BigDecimal distance = CameraDegreesUtil.getDistance1(videoCamera.getLongitude().doubleValue()
, videoCamera.getLatitude().doubleValue(), m.getLongitude().doubleValue(), m.getLatitude().doubleValue());
BigDecimal distance = CameraDegreesUtil.getDistance1(dsVideo.getLongitude().doubleValue()
, dsVideo.getLatitude().doubleValue(), m.getLongitude().doubleValue(), m.getLatitude().doubleValue());
m.setDistance(distance);
}
}
if (!Objects.isNull(videoCamera) && !StringUtils.isEmpty(videoCamera.getVideoName())) {
m.setVideoName(videoCamera.getVideoBelong() + videoCamera.getVideoName());
if (!Objects.isNull(dsVideo) && !StringUtils.isEmpty(dsVideo.getVideoName())) {
m.setVideoName(dsVideo.getBelongUnit() + dsVideo.getVideoName());
}
if (!Objects.isNull(m.getSpeed())) {
m.setSpeed(m.getSpeed().divide(new BigDecimal(0.5144444), 2, BigDecimal.ROUND_HALF_UP));