| | |
| | | package com.ycl.service.caseHandler.impl; |
| | | |
| | | import com.ycl.entity.caseHandler.BaseCase; |
| | | import com.ycl.entity.caseHandler.Violations; |
| | | import com.ycl.entity.video.VideoAlarmReport; |
| | | import com.ycl.mapper.caseHandler.ViolationsMapper; |
| | | import com.ycl.service.caseHandler.IViolationsService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.common.util.UtilNumber; |
| | | 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.enums.common.DictTypeEnum; |
| | | import com.ycl.mapper.caseHandler.BaseCaseMapper; |
| | | import com.ycl.mapper.caseHandler.ViolationsMapper; |
| | | import com.ycl.service.caseHandler.IBaseCaseService; |
| | | import com.ycl.service.caseHandler.IViolationsService; |
| | | import com.ycl.service.dict.IDataDictionaryService; |
| | | import com.ycl.service.video.impl.IVideoPointService; |
| | | import com.ycl.vo.cockpit.enforcementEvents.VideoAndAreaVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Service |
| | | public class ViolationsServiceImpl extends ServiceImpl<ViolationsMapper, Violations> implements IViolationsService { |
| | | |
| | | private IVideoPointService videoPointService; |
| | | private IBaseCaseService baseCaseService; |
| | | private IDataDictionaryService dataDictionaryService; |
| | | |
| | | @Resource |
| | | BaseCaseMapper baseCaseMapper; |
| | | |
| | | @Autowired |
| | | UtilNumber utilNumber; |
| | | |
| | | @Autowired |
| | | public void setVideoPointService(IVideoPointService videoPointService) { |
| | | this.videoPointService = videoPointService; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setBaseCaseService(IBaseCaseService baseCaseService) { |
| | | this.baseCaseService = baseCaseService; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setDataDictionaryService(IDataDictionaryService dataDictionaryService) { |
| | | this.dataDictionaryService = dataDictionaryService; |
| | | } |
| | | |
| | | @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()) |
| | | .or().eq(VideoPoint::getCode, 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()) |
| | | .code(utilNumber.createCaseCode()).createTime(LocalDateTime.now()).createUser(0L).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.setSite(videoPoint.getAddress()); |
| | | baseCase.setGridId(videoPoint.getGridId()); |
| | | baseCase.setSite(videoPoint.getAddress()); |
| | | |
| | | BaseCase baseCase = BaseCase.builder().build(); |
| | | baseCaseService.save(baseCase); |
| | | violations.setId(baseCase.getId()); |
| | | violations.setVideoAlarmReportId(videoAlarmReport.getId()); |
| | | violations.setVideoPointId(videoPoint.getId()); |
| | | violations.setDescription(videoAlarmReport.getAlgoName()); |
| | | |
| | | List<DataDictionary> list = dataDictionaryService.queryByCode(DictTypeEnum.EVENT_GRADE_TYPE.getCode(), videoAlarmReport.getAlarmName().trim()); |
| | | if (list.size() > 0) { |
| | | violations.setGradeId(list.get(0).getId()); |
| | | } |
| | | |
| | | baseMapper.insert(violations); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<VideoAndAreaVO> selectType() { |
| | | return baseCaseMapper.selectType(); |
| | | } |
| | | } |