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.BaseCaseMapper; import com.ycl.remote.dto.*; import com.ycl.remote.service.CityPlatformService; import com.ycl.service.caseHandler.IBaseCaseService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ycl.service.caseHandler.IViolationsService; import com.ycl.service.video.IVideoAlarmReportService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; /** *

* 案件基本信息 服务实现类 *

* * @author wl * @since 2022-09-24 */ @Service public class BaseCaseServiceImpl extends ServiceImpl implements IBaseCaseService { private CityPlatformService cityPlatformService; private IViolationsService violationsService; private IVideoAlarmReportService videoAlarmReportService; @Value("${fdfs.fileUrl}") private String fileUrl; @Autowired public void setCityPlatformService(CityPlatformService cityPlatformService) { this.cityPlatformService = cityPlatformService; } @Autowired public void setViolationsService(IViolationsService violationsService) { this.violationsService = violationsService; } @Autowired public void setVideoAlarmReportService(IVideoAlarmReportService videoAlarmReportService) { this.videoAlarmReportService = videoAlarmReportService; } @Override public String uploadEvent(Integer caseId) { BaseCase baseCase = this.getById(caseId); Violations violations = violationsService.getById(caseId); String medias = ""; String eventDesc = ""; if (violations != null) { eventDesc = violations.getDescription(); VideoAlarmReport videoAlarmReport = videoAlarmReportService.getById(violations.getVideoAlarmReportId()); if (videoAlarmReport != null) { StringBuilder stringBuilder = new StringBuilder().append("[{'mediaURL':'").append(fileUrl).append(videoAlarmReport.getPicData()).append("'}]"); medias = stringBuilder.toString(); } } EventAddParamDto dto = EventAddParamDto.builder().y84(baseCase.getLatitude().toString()).x84(baseCase.getLongitude().toString()) .source(11).address(baseCase.getSite()).eventDesc(eventDesc).eventSign(baseCase.getCode()).medias(medias).build(); ResultResponseDto result = cityPlatformService.addEvent(dto); if (result.getCode() == 0) { EventAddResponseDto responseDto = result.getResult(); baseCase.setTaskCode(responseDto.getTaskcode()); this.updateById(baseCase); return null; } else { return result.getMsg(); } } @Override public String processEvent(Integer caseId) { BaseCase baseCase = this.getById(caseId); EventProcessParamDto paramDto = EventProcessParamDto.builder().eventSign(baseCase.getCode()).taskcode(baseCase.getTaskCode()).build(); ResultResponseDto responseDto = cityPlatformService.getEventProcess(paramDto); if (responseDto.getCode() == 0) { EventProcessResponseDto eventProcessResponseDto = responseDto.getResult(); /*********** 未处理市平台返回数据 ***************/ return null; } else { return responseDto.getMsg(); } } }