Commit 36eb5def authored by tongzuqi's avatar tongzuqi

优化 出入时间获取

parent 1f3d581e
...@@ -75,6 +75,14 @@ public class EventDetailRespVO { ...@@ -75,6 +75,14 @@ public class EventDetailRespVO {
@Schema(description = "0急加速1急减速2实线变道3蛇形驾驶4逆行5拥堵6可疑事件7追尾8停车", example = "2") @Schema(description = "0急加速1急减速2实线变道3蛇形驾驶4逆行5拥堵6可疑事件7追尾8停车", example = "2")
@ExcelProperty("0急加速1急减速2实线变道3蛇形驾驶4逆行5拥堵6可疑事件7追尾8停车") @ExcelProperty("0急加速1急减速2实线变道3蛇形驾驶4逆行5拥堵6可疑事件7追尾8停车")
private Integer eventType; private Integer eventType;
/**
* 事件详情
*/
private String eventTypeDesc;
/**
* 事件详情附带(单车/多车)
*/
private String eventTypeDescStr;
@Schema(description = "事件状态 0待处置1处置中2已处置", example = "1") @Schema(description = "事件状态 0待处置1处置中2已处置", example = "1")
@ExcelProperty("事件状态 0待处置1处置中2已处置") @ExcelProperty("事件状态 0待处置1处置中2已处置")
......
...@@ -19,6 +19,7 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.mqtt.handler ...@@ -19,6 +19,7 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.mqtt.handler
import com.cico.nest.lcdp.framework.common.exception.ServiceException; import com.cico.nest.lcdp.framework.common.exception.ServiceException;
import com.cico.nest.lcdp.framework.common.pojo.PageResult; import com.cico.nest.lcdp.framework.common.pojo.PageResult;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -165,13 +166,18 @@ public class EventDetailServiceImpl implements EventDetailService { ...@@ -165,13 +166,18 @@ public class EventDetailServiceImpl implements EventDetailService {
if(StrUtil.isNotBlank(videoPath) && !videoPath.contains("error")){ if(StrUtil.isNotBlank(videoPath) && !videoPath.contains("error")){
respVO.setVideoPath(staticResourceEventHisVideoPath + videoPath); respVO.setVideoPath(staticResourceEventHisVideoPath + videoPath);
} }
//拓展对象 if(CollectionUtils.isNotEmpty(respVO.getExpandInfo())){
for (int i = 0; i < respVO.getExpandInfo().size(); i++) { //拓展对象
EventHisDO.EventHisExpandInfo x = EventHisDO.getEventHisExpandInfo(respVO.getExpandInfo(),respVO.getExpandInfo().getJSONObject(i).getString("carPlate")); for (int i = 0; i < respVO.getExpandInfo().size(); i++) {
x.setSmallSideImage(staticResourceBayonetImagesPath + x.getSmallSideImage()); EventHisDO.EventHisExpandInfo x = EventHisDO.getEventHisExpandInfo(respVO.getExpandInfo(),respVO.getExpandInfo().getJSONObject(i).getString("carPlate"));
respVO.setExpandInfo(EventHisDO.setEventHisExpandInfo(respVO.getExpandInfo(),x)); x.setSmallSideImage(staticResourceBayonetImagesPath + x.getSmallSideImage());
respVO.setExpandInfo(EventHisDO.setEventHisExpandInfo(respVO.getExpandInfo(),x));
}
}else{
respVO.setExpandInfo(new JSONArray());
} }
} }
return respVO; return respVO;
} }
......
...@@ -21,6 +21,7 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto ...@@ -21,6 +21,7 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto.XlwPageDTO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto.XlwPageDTO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto.XlwPassingProfileDTO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto.XlwPassingProfileDTO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto.XlwPassingProfileSearchDTO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto.XlwPassingProfileSearchDTO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto.XlwRemainDetailDTO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.feign.XlwClientFeign; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.feign.XlwClientFeign;
import com.cico.nest.lcdp.boot.core.system.dal.dataobject.dict.DictDataDO; import com.cico.nest.lcdp.boot.core.system.dal.dataobject.dict.DictDataDO;
import com.cico.nest.lcdp.boot.core.system.dal.mysql.dict.DictDataMapper; import com.cico.nest.lcdp.boot.core.system.dal.mysql.dict.DictDataMapper;
...@@ -80,7 +81,7 @@ public class HistoryServiceImpl implements HistoryService { ...@@ -80,7 +81,7 @@ public class HistoryServiceImpl implements HistoryService {
eventHisMapper.insertOrUpdate(eventHisDO); eventHisMapper.insertOrUpdate(eventHisDO);
} }
// 通过轨迹查询获取进出时间 // 获取事件车辆进出时间
this.setProfileSearch(eventDetailDO, eventHisDO); this.setProfileSearch(eventDetailDO, eventHisDO);
// 事件图片 不存在 更新 事件图片 字段 // 事件图片 不存在 更新 事件图片 字段
...@@ -148,33 +149,58 @@ public class HistoryServiceImpl implements HistoryService { ...@@ -148,33 +149,58 @@ public class HistoryServiceImpl implements HistoryService {
private void setProfileSearch(EventDetailDO eventDetailDO,EventHisDO eventHisDO) { private void setProfileSearch(EventDetailDO eventDetailDO,EventHisDO eventHisDO) {
if(StringUtils.isEmpty(eventDetailDO.getTrackId())){ if(StringUtils.isEmpty(eventDetailDO.getTrackId())){
log.error("调用5.1接口,eventId:{},缺少trackId",eventDetailDO.getId()); log.error("获取事件入口时间,eventId:{},缺少trackId",eventDetailDO.getId());
return; return;
} }
EventHisDO.EventHisExpandInfo x = EventHisDO.getEventHisExpandInfo(eventHisDO.getExpandInfo(),eventDetailDO.getEventCarPlate().get(0)); EventHisDO.EventHisExpandInfo x = EventHisDO.getEventHisExpandInfo(eventHisDO.getExpandInfo(),eventDetailDO.getEventCarPlate().get(0));
x.setEventId(eventDetailDO.getId()); x.setEventId(eventDetailDO.getId());
x.setEventStartTime(DateUtil.format(eventDetailDO.getEventStartTime(),"yyyy-MM-dd HH:mm:ss")); x.setEventStartTime(DateUtil.format(eventDetailDO.getEventStartTime(),"yyyy-MM-dd HH:mm:ss"));
if(StringUtils.isNotEmpty(x.getVehicleInTunnelTime()) && StringUtils.isNotEmpty(x.getVehicleOutTunnelTime())){
log.info("获取事件入口时间,eventId:{},数据已经完整,不需要重新获取",eventDetailDO.getId());
return;
}else if(StringUtils.isNotEmpty(x.getVehicleInTunnelTime()) && StringUtils.isEmpty(x.getVehicleOutTunnelTime())){
// 入口不为空,出口为空,说明临时轨迹详情查询以前获取过
this.getPassingProfile(eventDetailDO,x);
}
if(StringUtils.isEmpty(x.getVehicleInTunnelTime()) || StringUtils.isEmpty(x.getVehicleOutTunnelTime()) ) { if(StringUtils.isEmpty(x.getVehicleInTunnelTime()) || StringUtils.isEmpty(x.getVehicleOutTunnelTime()) ) {
//通过 5.1 获取通行记录列表数据 trackId 查询车辆的入口开始时间 //临时轨迹详情查询 先获取入口时间,如果不存在再获取5.1
XlwPassingProfileSearchDTO searchDTO = new XlwPassingProfileSearchDTO(); this.getRemainDetail(eventDetailDO,x);
searchDTO.setPage(1);
searchDTO.setPageSize(1);
searchDTO.setTunnelId(eventDetailDO.getXlwTunnelId());
searchDTO.setPassProfileId(eventDetailDO.getTrackId());
XlwResultData<XlwPageDTO<XlwPassingProfileDTO>> resultData = xlwClientFeign.getPassingProfile(searchDTO);
if(Objects.nonNull(resultData) && resultData.getData().getRows().size()>0){
XlwPassingProfileDTO passingProfile = resultData.getData().getRows().get(0);
log.info("调用5.1接口,eventId:{},trackId:{},入口开始时间:{},结束时间:{},",eventDetailDO.getId(),eventDetailDO.getTrackId(),passingProfile.getFirstTime(),passingProfile.getLastTime());
// 保存拓展对象
x.setVehicleInTunnelTime(passingProfile.getFirstTime());
x.setVehicleOutTunnelTime(passingProfile.getLastTime());
}else{
log.info("调用5.1接口,eventId:{},trackId:{},返回对象为空",eventDetailDO.getId(),eventDetailDO.getTrackId());
}
} }
eventHisDO.setExpandInfo(EventHisDO.setEventHisExpandInfo(eventHisDO.getExpandInfo(),x)); eventHisDO.setExpandInfo(EventHisDO.setEventHisExpandInfo(eventHisDO.getExpandInfo(),x));
} }
private void getRemainDetail(EventDetailDO eventDetailDO,EventHisDO.EventHisExpandInfo x){
XlwResultData<XlwPassingProfileDTO> resultData = xlwClientFeign.getRemainDetail(new XlwRemainDetailDTO().setSecondTrackTempId(eventDetailDO.getTrackId()));
if(Objects.nonNull(resultData) && Objects.nonNull(resultData.getData())){
XlwPassingProfileDTO passingProfile = resultData.getData();
log.info("调用临时轨迹详情查询接口,eventId:{},trackId:{},入口开始时间:{}",eventDetailDO.getId(),eventDetailDO.getTrackId(),passingProfile.getFirstTime());
// 保存拓展对象
x.setVehicleInTunnelTime(passingProfile.getFirstTime());
//x.setVehicleOutTunnelTime(passingProfile.getLastTime());这个不准
}else{
log.info("调用临时轨迹详情查询接口,eventId:{},trackId:{},返回对象为空",eventDetailDO.getId(),eventDetailDO.getTrackId());
this.getPassingProfile(eventDetailDO, x);
}
}
private void getPassingProfile(EventDetailDO eventDetailDO,EventHisDO.EventHisExpandInfo x){
//通过 5.1 获取通行记录列表数据 trackId 查询车辆的入口开始时间
XlwPassingProfileSearchDTO searchDTO = new XlwPassingProfileSearchDTO();
searchDTO.setPage(1);
searchDTO.setPageSize(1);
searchDTO.setTunnelId(eventDetailDO.getXlwTunnelId());
searchDTO.setPassProfileId(eventDetailDO.getTrackId());
XlwResultData<XlwPageDTO<XlwPassingProfileDTO>> resultData = xlwClientFeign.getPassingProfile(searchDTO);
if(Objects.nonNull(resultData) && resultData.getData().getRows().size()>0){
XlwPassingProfileDTO passingProfile = resultData.getData().getRows().get(0);
log.info("调用5.1接口,eventId:{},trackId:{},入口开始时间:{},结束时间:{},",eventDetailDO.getId(),eventDetailDO.getTrackId(),passingProfile.getFirstTime(),passingProfile.getLastTime());
// 保存拓展对象
x.setVehicleInTunnelTime(passingProfile.getFirstTime());
x.setVehicleOutTunnelTime(passingProfile.getLastTime());
}else{
log.info("调用5.1接口,eventId:{},trackId:{},返回对象为空",eventDetailDO.getId(),eventDetailDO.getTrackId());
}
}
/** /**
......
...@@ -348,9 +348,9 @@ public class EventDetailDO { ...@@ -348,9 +348,9 @@ public class EventDetailDO {
} }
situationSpot = situationSpot.concat("发现").concat(eventType.desc); situationSpot = situationSpot.concat("发现").concat(eventType.desc);
//非车辆事件不显示单车多车标识 //非车辆事件不显示单车多车标识
if(nonVehicleFlag){ if(!nonVehicleFlag){
eventSituation.concat("(").concat(singMultiCar).concat(")"); eventSituation = eventSituation.concat("(").concat(singMultiCar).concat(")");
situationSpot.concat("(").concat(singMultiCar).concat(")"); situationSpot = situationSpot.concat("(").concat(singMultiCar).concat(")");
} }
//事件图片 //事件图片
List<String> eventImagesPath = eventDetail.getEventImagesPath(); List<String> eventImagesPath = eventDetail.getEventImagesPath();
...@@ -362,6 +362,8 @@ public class EventDetailDO { ...@@ -362,6 +362,8 @@ public class EventDetailDO {
eventDetailRespVO.setEventStartTimeFormat(eventDetail.getEventStartTime()); eventDetailRespVO.setEventStartTimeFormat(eventDetail.getEventStartTime());
} }
eventDetailRespVO.setNonVehicleFlag(nonVehicleFlag); eventDetailRespVO.setNonVehicleFlag(nonVehicleFlag);
eventDetailRespVO.setEventTypeDesc(eventType.desc);
eventDetailRespVO.setEventTypeDescStr(nonVehicleFlag?eventType.desc:eventType.desc.concat("(").concat(singMultiCar).concat(")"));
eventDetailRespVO.setEventSituation(eventSituation); eventDetailRespVO.setEventSituation(eventSituation);
eventDetailRespVO.setMilestoneStr(milestone); eventDetailRespVO.setMilestoneStr(milestone);
eventDetailRespVO.setDirectionalPosition(directionalPosition); eventDetailRespVO.setDirectionalPosition(directionalPosition);
......
package com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @author tongzuqi
* @create 2025/7/10 2:05 PM
*/
@Data
@Accessors(chain = true)
public class XlwRemainDetailDTO {
/**
* 轨迹id
* qxsd_event_detail.track_id
*/
private String secondTrackTempId;
}
...@@ -145,4 +145,12 @@ public interface XlwClientFeign { ...@@ -145,4 +145,12 @@ public interface XlwClientFeign {
*/ */
@PostMapping("/trafficStatistic/speedTrend.htm") @PostMapping("/trafficStatistic/speedTrend.htm")
XlwResultData<List<Map<String,Object>>> speedTrend(@RequestBody XlwTableStatsDTO tableStatsDTO); XlwResultData<List<Map<String,Object>>> speedTrend(@RequestBody XlwTableStatsDTO tableStatsDTO);
/**
* 临时轨迹详情查询
* @param remainDetailDTO
* @return 目前这个接口只取了入口时间,如果以后取别的返回值需要边下
*/
@PostMapping("/passManager/remain/detail.htm")
XlwResultData<XlwPassingProfileDTO> getRemainDetail(@RequestBody XlwRemainDetailDTO remainDetailDTO);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment