From 94e964d96cdacef8bf255c09cb90c0366a074c68 Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期四, 29 九月 2022 17:47:25 +0800 Subject: [PATCH] 案件上传优化 --- ycl-platform/src/main/java/com/ycl/remote/service/CityPlatformService.java | 4 +- ycl-platform/src/main/resources/logback-spring.xml | 0 ycl-platform/src/main/java/com/ycl/remote/dto/ResultResponseDto.java | 4 +- ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java | 8 ++- ycl-platform/src/main/resources/application.yml | 1 ycl-platform/src/main/java/com/ycl/remote/dto/EventProcessResponseDto.java | 3 + ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java | 52 +++++++++++++------------ ycl-platform/src/main/java/com/ycl/config/feign/MessageConverter.java | 2 8 files changed, 41 insertions(+), 33 deletions(-) diff --git a/ycl-platform/src/main/java/com/ycl/config/feign/MessageConverter.java b/ycl-platform/src/main/java/com/ycl/config/feign/MessageConverter.java index d78f77e..858cb0d 100644 --- a/ycl-platform/src/main/java/com/ycl/config/feign/MessageConverter.java +++ b/ycl-platform/src/main/java/com/ycl/config/feign/MessageConverter.java @@ -9,7 +9,7 @@ public class MessageConverter extends MappingJackson2HttpMessageConverter { public MessageConverter(){ List<MediaType> mediaTypes = new ArrayList<>(); - mediaTypes.add(MediaType.TEXT_PLAIN); + mediaTypes.add(MediaType.APPLICATION_JSON); setSupportedMediaTypes(mediaTypes); } } \ No newline at end of file diff --git a/ycl-platform/src/main/java/com/ycl/remote/dto/EventProcessResponseDto.java b/ycl-platform/src/main/java/com/ycl/remote/dto/EventProcessResponseDto.java index ed38fea..e4dd551 100644 --- a/ycl-platform/src/main/java/com/ycl/remote/dto/EventProcessResponseDto.java +++ b/ycl-platform/src/main/java/com/ycl/remote/dto/EventProcessResponseDto.java @@ -1,5 +1,7 @@ package com.ycl.remote.dto; +import lombok.Data; + /** * EventProcessResponseDto 妗堜欢璇︽儏 * @@ -7,6 +9,7 @@ * @author: AI * @date: 2022-09-28 16:03 **/ +@Data public class EventProcessResponseDto { private String taskcode; private String statusName; diff --git a/ycl-platform/src/main/java/com/ycl/remote/dto/ResultResponseDto.java b/ycl-platform/src/main/java/com/ycl/remote/dto/ResultResponseDto.java index 5fe52d5..61feae6 100644 --- a/ycl-platform/src/main/java/com/ycl/remote/dto/ResultResponseDto.java +++ b/ycl-platform/src/main/java/com/ycl/remote/dto/ResultResponseDto.java @@ -10,8 +10,8 @@ * @date: 2022-09-28 16:00 **/ @Data -public class ResultResponseDto<T> { +public class ResultResponseDto { private String msg; private Integer code; - private T result; + private String result; } diff --git a/ycl-platform/src/main/java/com/ycl/remote/service/CityPlatformService.java b/ycl-platform/src/main/java/com/ycl/remote/service/CityPlatformService.java index 3923a42..0271955 100644 --- a/ycl-platform/src/main/java/com/ycl/remote/service/CityPlatformService.java +++ b/ycl-platform/src/main/java/com/ycl/remote/service/CityPlatformService.java @@ -24,7 +24,7 @@ * @date 2022-09-28 16:12 */ @PostMapping("/unauthorized/external/event/add") - ResultResponseDto<EventAddResponseDto> addEvent(EventAddParamDto paramDto); + String addEvent(EventAddParamDto paramDto); /** * 浜嬩欢璇︽儏 @@ -35,7 +35,7 @@ * @date 2022-09-28 16:12 */ @PostMapping("/unauthorized/external/event/process") - ResultResponseDto<EventProcessResponseDto> getEventProcess(EventProcessParamDto paramDto); + String getEventProcess(EventProcessParamDto paramDto); } diff --git a/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java index a4cd580..f157999 100644 --- a/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java +++ b/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java @@ -1,5 +1,6 @@ package com.ycl.service.caseHandler.impl; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ycl.bo.casePool.CasePoolIllegalBuildingDO; @@ -44,17 +45,17 @@ @Service public class BaseCaseServiceImpl extends ServiceImpl<BaseCaseMapper, BaseCase> implements IBaseCaseService { - // private CityPlatformService cityPlatformService; + 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 setCityPlatformService(CityPlatformService cityPlatformService) { + this.cityPlatformService = cityPlatformService; + } @Autowired public void setViolationsService(IViolationsService violationsService) { @@ -89,33 +90,34 @@ medias = stringBuilder.toString(); } } - EventAddParamDto dto = EventAddParamDto.builder().y84(baseCase.getLatitude().toString()).x84(baseCase.getLongitude().toString()) + EventAddParamDto dto = EventAddParamDto.builder().y84(baseCase.getLatitude() != null ? baseCase.getLatitude().toString() : "") + .x84(baseCase.getLongitude() != null ? baseCase.getLongitude().toString() : "") .source(11).address(baseCase.getSite()).eventDesc(eventDesc).eventSign(baseCase.getCode()).medias(medias).build(); -// ResultResponseDto<EventAddResponseDto> 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(); -// } - return null; + String msg = cityPlatformService.addEvent(dto); + ResultResponseDto result = JSONObject.parseObject(msg, ResultResponseDto.class); + if (result.getCode() == 0) { + EventAddResponseDto responseDto = JSONObject.parseObject(result.getResult(), EventAddResponseDto.class); + 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<EventProcessResponseDto> responseDto = cityPlatformService.getEventProcess(paramDto); -// if (responseDto.getCode() == 0) { -// EventProcessResponseDto eventProcessResponseDto = responseDto.getResult(); -// /*********** 鏈鐞嗗競骞冲彴杩斿洖鏁版嵁 ***************/ -// return null; -// } else { -// return responseDto.getMsg(); -// } - return null; + String msg = cityPlatformService.getEventProcess(paramDto); + ResultResponseDto responseDto = JSONObject.parseObject(msg, ResultResponseDto.class); + if (responseDto.getCode() == 0) { + EventProcessResponseDto eventProcessResponseDto = JSONObject.parseObject(responseDto.getResult(), EventProcessResponseDto.class); + /*********** 鏈鐞嗗競骞冲彴杩斿洖鏁版嵁 ***************/ + return null; + } else { + return responseDto.getMsg(); + } } @Override diff --git a/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java index d5cbed7..d2016ca 100644 --- a/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java +++ b/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java @@ -14,6 +14,7 @@ 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; @@ -33,10 +34,11 @@ private IVideoPointService videoPointService; private IBaseCaseService baseCaseService; + @Autowired public void setVideoPointService(IVideoPointService videoPointService) { this.videoPointService = videoPointService; } - + @Autowired public void setBaseCaseService(IBaseCaseService baseCaseService) { this.baseCaseService = baseCaseService; } @@ -51,7 +53,7 @@ videoPoint = pointList.get(0); } BaseCase baseCase = BaseCase.builder().eventSource(EventSource.VIDEO.getCode()).category(QuestionCategory.VIOLATION.getCode()) - .createTime(LocalDateTime.now()).createUser(0).alarmTime(videoAlarmReport.getAlarmTime()).build(); + .createTime(LocalDateTime.now()).createUser(0).state(1).alarmTime(videoAlarmReport.getAlarmTime()).build(); Violations violations = new Violations(); if (videoPoint != null) { baseCase.setLatitude(videoPoint.getLatitude()); @@ -59,10 +61,10 @@ baseCase.setStreetId(videoPoint.getStreetId()); baseCase.setCommunityId(videoPoint.getCommunityId()); - violations.setVideoAlarmReportId(videoAlarmReport.getId()); } baseCaseService.save(baseCase); violations.setId(baseCase.getId()); + violations.setVideoAlarmReportId(videoAlarmReport.getId()); baseMapper.insert(violations); } } diff --git a/ycl-platform/src/main/resources/application.yml b/ycl-platform/src/main/resources/application.yml index 3558824..4e81bc2 100644 --- a/ycl-platform/src/main/resources/application.yml +++ b/ycl-platform/src/main/resources/application.yml @@ -86,3 +86,4 @@ - /dict/** - /sccg-region/** - /**/system/portal/logo/search + - /**/unauthorized/** diff --git a/ycl-platform/src/main/resources/logback.xml b/ycl-platform/src/main/resources/logback-spring.xml similarity index 100% rename from ycl-platform/src/main/resources/logback.xml rename to ycl-platform/src/main/resources/logback-spring.xml -- Gitblit v1.8.0