| | |
| | | package com.ycl.service.caseHandler.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ycl.entity.caseHandler.BaseCase; |
| | | import com.ycl.entity.caseHandler.EventSource; |
| | | import com.ycl.entity.caseHandler.QuestionCategory; |
| | | import com.ycl.entity.caseHandler.Violations; |
| | | import com.ycl.entity.dict.DataDictionary; |
| | | import com.ycl.entity.video.VideoAlarmReport; |
| | | import com.ycl.entity.video.VideoPoint; |
| | | import com.ycl.mapper.caseHandler.ViolationsMapper; |
| | | import com.ycl.service.caseHandler.IBaseCaseService; |
| | | import com.ycl.service.caseHandler.IViolationsService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.service.video.impl.IVideoPointService; |
| | | import com.ycl.service.video.impl.VideoPointServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Service |
| | | public class ViolationsServiceImpl extends ServiceImpl<ViolationsMapper, Violations> implements IViolationsService { |
| | | |
| | | private IVideoPointService videoPointService; |
| | | private IBaseCaseService baseCaseService; |
| | | |
| | | @Autowired |
| | | public void setVideoPointService(IVideoPointService videoPointService) { |
| | | this.videoPointService = videoPointService; |
| | | } |
| | | @Autowired |
| | | public void setBaseCaseService(IBaseCaseService baseCaseService) { |
| | | this.baseCaseService = baseCaseService; |
| | | } |
| | | |
| | | @Override |
| | | public void saveFromVideo(List<VideoAlarmReport> videoAlarmReports) { |
| | | for (VideoAlarmReport videoAlarmReport : videoAlarmReports) { |
| | | VideoPoint videoPoint = null; |
| | | LambdaQueryWrapper<VideoPoint> queryWrapper = new LambdaQueryWrapper<VideoPoint>().eq(VideoPoint::getPlatResourceId, videoAlarmReport.getPlatResourceId()); |
| | | List<VideoPoint> pointList = videoPointService.list(queryWrapper); |
| | | if (pointList.size() > 0) { |
| | | videoPoint = pointList.get(0); |
| | | } |
| | | BaseCase baseCase = BaseCase.builder().eventSource(EventSource.VIDEO.getCode()).category(QuestionCategory.VIOLATION.getCode()) |
| | | .createTime(LocalDateTime.now()).createUser(0).state(1).alarmTime(videoAlarmReport.getAlarmTime()).build(); |
| | | Violations violations = new Violations(); |
| | | if (videoPoint != null) { |
| | | baseCase.setLatitude(videoPoint.getLatitude()); |
| | | baseCase.setLongitude(videoPoint.getLongitude()); |
| | | baseCase.setStreetId(videoPoint.getStreetId()); |
| | | baseCase.setCommunityId(videoPoint.getCommunityId()); |
| | | |
| | | BaseCase baseCase = BaseCase.builder().build(); |
| | | } |
| | | baseCaseService.save(baseCase); |
| | | violations.setId(baseCase.getId()); |
| | | violations.setVideoAlarmReportId(videoAlarmReport.getId()); |
| | | baseMapper.insert(violations); |
| | | } |
| | | } |
| | | } |