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

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