Commit f55ddf28 authored by tongzuqi's avatar tongzuqi

0625提交

parent 3d1dd2f6
...@@ -8,6 +8,8 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw.RealT ...@@ -8,6 +8,8 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw.RealT
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw.RealTimeVehicleWsClient; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw.RealTimeVehicleWsClient;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner; import org.springframework.boot.ApplicationRunner;
...@@ -50,7 +52,7 @@ public class WsApplicationRunner implements ApplicationRunner { ...@@ -50,7 +52,7 @@ public class WsApplicationRunner implements ApplicationRunner {
@Value("${qxsd.xlw.organizationId}") @Value("${qxsd.xlw.organizationId}")
private String organizationId; private String organizationId;
//设备列表 //设备列表
public static Map<String,String> deviceMap = null; public static Map<String,String> deviceMap = new HashedMap();
@Override @Override
...@@ -61,12 +63,18 @@ public class WsApplicationRunner implements ApplicationRunner { ...@@ -61,12 +63,18 @@ public class WsApplicationRunner implements ApplicationRunner {
XlwOrganizationId xlwOrganizationId = new XlwOrganizationId(); XlwOrganizationId xlwOrganizationId = new XlwOrganizationId();
xlwOrganizationId.setOrganizationId(organizationId); xlwOrganizationId.setOrganizationId(organizationId);
try { try {
for (int i = 1; i < 11; i++) {
List<XlwDeviceInfoDTO> deviceInfoList = xlwClientFeign.deviceInfo(xlwOrganizationId).getData(); List<XlwDeviceInfoDTO> deviceInfoList = xlwClientFeign.deviceInfo(xlwOrganizationId).getData();
if (deviceInfoList!=null) { if (CollectionUtils.isNotEmpty(deviceInfoList)){
deviceMap = deviceInfoList.stream().filter(e -> e.getDeviceSn() != null && e.getMilestone() != null) deviceMap = deviceInfoList.stream().filter(e -> e.getDeviceSn() != null && e.getMilestone() != null)
.collect(Collectors.toMap(XlwDeviceInfoDTO::getDeviceSn, XlwDeviceInfoDTO::getMilestone)); .collect(Collectors.toMap(XlwDeviceInfoDTO::getDeviceSn, XlwDeviceInfoDTO::getMilestone));
log.info("获得设备列表信息成功");
break;
}else{
log.error("获得设备列表信息为空,重试:{}次",i);
} }
}
log.info("获得设备列表信息:{}条",deviceMap.size());
//事件 //事件
// realTimeEventWsClient.connectAndHandleMessage(xlwWsUrl +"/client/event",tunnelDownId); // realTimeEventWsClient.connectAndHandleMessage(xlwWsUrl +"/client/event",tunnelDownId);
realTimeEventWsClient.connectAndHandleMessage(xlwWsUrl +"/client/event",tunnelUpId); realTimeEventWsClient.connectAndHandleMessage(xlwWsUrl +"/client/event",tunnelUpId);
...@@ -78,9 +86,18 @@ public class WsApplicationRunner implements ApplicationRunner { ...@@ -78,9 +86,18 @@ public class WsApplicationRunner implements ApplicationRunner {
//realTimeEventWsClient.connectAndHandleMessage("ws://ucloud.weisea.xyz:8888/pushx/client/event",tunnelDownId); //realTimeEventWsClient.connectAndHandleMessage("ws://ucloud.weisea.xyz:8888/pushx/client/event",tunnelDownId);
//realTimeVehicleWsClient.connectAndHandleMessage(xlwWsUrl + "/client/carInfo",tunnelDownId,"下行"); //realTimeVehicleWsClient.connectAndHandleMessage(xlwWsUrl + "/client/carInfo",tunnelDownId,"下行");
try {
//测试本地
realTimeEventWsClient.connectAndHandleMessage("ws://127.0.0.1:8765",tunnelUpId);
realTimeVehicleWsClient.connectAndHandleMessage("ws://127.0.0.1:8766",tunnelUpId,"上行",215808);
} catch (Exception e) {
log.error("=============ws异常:没有开启本地python的ws服务,如需测试请开启本地python的ws服务!==============");
}
//将第三方事件设置为完成状态 //将第三方事件设置为完成状态
} catch (Exception e) { } catch (Exception e) {
log.error("=============ws异常:{}==============",e.getMessage()); log.error("=============ws异常:{}==============",e.getMessage());
} }
} }
} }
package com.cico.nest.lcdp.boot.core.qxsd.adapter.web; package com.cico.nest.lcdp.boot.core.qxsd.adapter.web;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson2.JSONObject;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.event.EventDetailAlarmVO;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.event.EventDetailDispelReqVO; import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.event.EventDetailDispelReqVO;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.event.EventDetailPageReqVO; import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.event.EventDetailPageReqVO;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.event.EventDetailRespVO; import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.event.EventDetailRespVO;
...@@ -7,12 +13,17 @@ import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.event.EventHisRespVO; ...@@ -7,12 +13,17 @@ import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.event.EventHisRespVO;
import com.cico.nest.lcdp.boot.core.qxsd.application.service.EventDetailService; import com.cico.nest.lcdp.boot.core.qxsd.application.service.EventDetailService;
import com.cico.nest.lcdp.boot.core.qxsd.application.service.HistoryService; import com.cico.nest.lcdp.boot.core.qxsd.application.service.HistoryService;
import com.cico.nest.lcdp.boot.core.qxsd.domain.gateway.EventGateway; import com.cico.nest.lcdp.boot.core.qxsd.domain.gateway.EventGateway;
import com.cico.nest.lcdp.boot.core.qxsd.domain.gateway.HistoryGateway;
import com.cico.nest.lcdp.boot.core.qxsd.domain.vehicle.TunnelRealTimeVehicle;
import com.cico.nest.lcdp.boot.core.qxsd.domain.vehicle.VehicleInfo;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.common.constatnt.RedisConstants;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.common.constatnt.XlwConstants; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.common.constatnt.XlwConstants;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.common.result.XlwResultData; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.common.result.XlwResultData;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.EventDetailMapper; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.EventDetailMapper;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.EventDetailDO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.EventDetailDO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.ISdgkApiService; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.ISdgkApiService;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.sdgk.dto.SdgkEventAlarmDTO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.sdgk.dto.SdgkEventAlarmDTO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.XlwEventMapper;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto.XlwBayonetPictureDTO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto.XlwBayonetPictureDTO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto.XlwBayonetPictureSearchDTO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto.XlwBayonetPictureSearchDTO;
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;
...@@ -26,11 +37,24 @@ import io.swagger.v3.oas.annotations.Parameter; ...@@ -26,11 +37,24 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import static com.cico.nest.lcdp.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR; import static com.cico.nest.lcdp.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
import static com.cico.nest.lcdp.framework.common.pojo.CommonResult.success; import static com.cico.nest.lcdp.framework.common.pojo.CommonResult.success;
...@@ -40,6 +64,7 @@ import static com.cico.nest.lcdp.framework.common.pojo.CommonResult.success; ...@@ -40,6 +64,7 @@ import static com.cico.nest.lcdp.framework.common.pojo.CommonResult.success;
@RestController @RestController
@RequestMapping("/qxsd/event-detail") @RequestMapping("/qxsd/event-detail")
@Validated @Validated
@Slf4j
public class EventDetailController { public class EventDetailController {
@Resource @Resource
...@@ -47,6 +72,10 @@ public class EventDetailController { ...@@ -47,6 +72,10 @@ public class EventDetailController {
@Resource @Resource
private EventGateway eventGateway; private EventGateway eventGateway;
@Resource @Resource
private XlwEventMapper xlwEventMapper;
@Resource
private HistoryGateway historyGateway;
@Resource
private XlwClientFeign xlwClientFeign; private XlwClientFeign xlwClientFeign;
@Resource @Resource
private HistoryService historyService; private HistoryService historyService;
...@@ -56,6 +85,8 @@ public class EventDetailController { ...@@ -56,6 +85,8 @@ public class EventDetailController {
private String xlwImagePath; private String xlwImagePath;
@Resource @Resource
private ISdgkApiService sdgkApiService; private ISdgkApiService sdgkApiService;
@Resource
private StringRedisTemplate stringRedisTemplate;
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得事件详情") @Operation(summary = "获得事件详情")
...@@ -68,21 +99,24 @@ public class EventDetailController { ...@@ -68,21 +99,24 @@ public class EventDetailController {
@PostMapping("/page") @PostMapping("/page")
@Operation(summary = "获得事件详情分页") @Operation(summary = "获得事件详情分页")
public CommonResult<PageResult<EventDetailRespVO>> getEventDetailPage(@Valid @RequestBody EventDetailPageReqVO pageReqVO) { public CommonResult<PageResult<EventDetailRespVO>> getEventDetailPage(@Valid @RequestBody EventDetailPageReqVO pageReqVO) {
// 调用eventDetailService的getEventDetailPage方法,传入pageReqVO参数,获得PageResult对象
PageResult pageResult = eventDetailService.getEventDetailPage(pageReqVO); PageResult pageResult = eventDetailService.getEventDetailPage(pageReqVO);
// 将PageResult对象中的list属性转换为EventDetailRespVO对象,并设置xlwImagePath属性
pageResult.setList(EventDetailDO.convert2VO(pageResult.getList(),xlwImagePath)); pageResult.setList(EventDetailDO.convert2VO(pageResult.getList(),xlwImagePath));
// 返回成功结果,包含PageResult对象
return success(pageResult); return success(pageResult);
} }
@PostMapping("/dispelEvent") @PostMapping("/dispelEvent")
@Operation(summary = "事件消除") @Operation(summary = "事件消除")
public CommonResult<String> dispelEvent(@Valid @RequestBody EventDetailDispelReqVO reqVO){ public CommonResult<String> dispelEvent(@Valid @RequestBody EventDetailDispelReqVO reqVO){
eventDetailService.dispelEvent(reqVO.getId(),reqVO.getDispelCause()); eventDetailService.dispelEvent(reqVO.getId(),reqVO.getDispelCause(),reqVO.getProcessingOperationsName());
return CommonResult.success("操作成功"); return CommonResult.success("操作成功");
} }
@GetMapping("/report") @GetMapping("/report")
@Operation(summary = "事件上报给隧道管控") @Operation(summary = "事件上报给隧道管控")
public CommonResult<String> reportEvent(@RequestParam("id") String id){ public CommonResult<String> reportEvent(@RequestParam("id") String id,@RequestParam(value = "processingOperationsName",required = false) String processingOperationsName){
EventDetailDO eventDetail = eventDetailService.getEventDetail(id); EventDetailDO eventDetail = eventDetailService.getEventDetail(id);
if (eventDetail==null){ if (eventDetail==null){
throw new ServiceException(INTERNAL_SERVER_ERROR.getCode(),"事件不存在。"); throw new ServiceException(INTERNAL_SERVER_ERROR.getCode(),"事件不存在。");
...@@ -90,6 +124,9 @@ public class EventDetailController { ...@@ -90,6 +124,9 @@ public class EventDetailController {
if (eventDetail.getEventSource()== XlwConstants.EVENT_SOURCE_SDGK){ if (eventDetail.getEventSource()== XlwConstants.EVENT_SOURCE_SDGK){
throw new ServiceException(INTERNAL_SERVER_ERROR.getCode(),"该事件来源属于隧道管控,不需要上报。"); throw new ServiceException(INTERNAL_SERVER_ERROR.getCode(),"该事件来源属于隧道管控,不需要上报。");
} }
eventDetail.setProcessingType(1);
eventDetail.setProcessingOperationsName(processingOperationsName);
eventDetail.setProcessingTime(new Date());
eventDetailService.reporEventToSdgk(eventDetail); eventDetailService.reporEventToSdgk(eventDetail);
return CommonResult.success("操作成功"); return CommonResult.success("操作成功");
} }
...@@ -101,6 +138,13 @@ public class EventDetailController { ...@@ -101,6 +138,13 @@ public class EventDetailController {
return CommonResult.success("操作成功"); return CommonResult.success("操作成功");
} }
@GetMapping("/syncEventDetailByStr")
@Operation(summary = "同步指定时间内的事件")
public CommonResult<String> syncEventDetailByStr(@RequestParam("startDateTime") String startDateTime,@RequestParam("endDateTime") String endDateTime) {
xlwEventMapper.syncEventDetailListV2(startDateTime,endDateTime);
return CommonResult.success("操作成功");
}
@PostMapping("/getBayonetPicture") @PostMapping("/getBayonetPicture")
@Operation(summary = "获取卡口图片") @Operation(summary = "获取卡口图片")
...@@ -121,8 +165,10 @@ public class EventDetailController { ...@@ -121,8 +165,10 @@ public class EventDetailController {
@GetMapping("/saveEventHis") @GetMapping("/saveEventHis")
public CommonResult<String> saveEventHis(@RequestParam String eventId){ public CommonResult<String> saveEventHis(@RequestParam String eventId){
EventDetailDO eventDetailDO = eventDetailMapper.selectById(eventId); Arrays.stream(eventId.split(",")).forEach(id->{
EventDetailDO eventDetailDO = eventDetailMapper.selectById(id);
historyService.saveEventHistoryData(eventDetailDO); historyService.saveEventHistoryData(eventDetailDO);
});
return success("操作成功"); return success("操作成功");
} }
...@@ -140,4 +186,93 @@ public class EventDetailController { ...@@ -140,4 +186,93 @@ public class EventDetailController {
return success(result); return success(result);
} }
@GetMapping("/alarm")
@Operation(summary = "获取事件告警的弹窗需要数据")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
public CommonResult<EventDetailAlarmVO> alarm(@RequestParam("id") String id){
EventDetailAlarmVO vo = new EventDetailAlarmVO();
long startTimeDetail = System.currentTimeMillis();
vo.setEventDetailRespVO(getEventDetail(id).getData());
log.info("告警的弹窗,详情:{},耗时:{}毫秒",id,System.currentTimeMillis() - startTimeDetail);
long startTimeHis = System.currentTimeMillis();
vo.setEventHisRespVO(getEventHisDetail(id).getData());
log.info("告警的弹窗,历史:{},耗时:{}毫秒",id,System.currentTimeMillis() - startTimeHis);
// 额外处理
long startTimeOther = System.currentTimeMillis();
vo.getEventDetailRespVO().getCarInfoList().forEach(carInfo->{
//危是否化品车辆,枚举:0否、1是
carInfo.setIsDangerous(carInfo.getVehicleType()==0);
//是否重点标记
if(StringUtils.isNotEmpty(carInfo.getCarId())){
//取交集(当前重点标记的车辆)
String redisStr = stringRedisTemplate.opsForValue().get(RedisConstants.REDIS_FOCUS_VEHICLE_MARK_KEY + carInfo.getCarId());
if(StringUtils.isNotEmpty(redisStr) && redisStr.equals(carInfo.getCarId())){
carInfo.setIsFocusMark(true);
}
}
// 查询实时车流如果不存在说明已经驶出隧道,否则还在隧道内
String realTimeVehicleJson = stringRedisTemplate.opsForValue().get(RedisConstants.REDIS_REAL_TIME_VEHICLE_KEY.concat(vo.getEventDetailRespVO().getTunnelId()));
TunnelRealTimeVehicle realTimeVehicle =JSONObject.parseObject(realTimeVehicleJson, TunnelRealTimeVehicle.class);
if(Objects.nonNull(realTimeVehicle) && CollectionUtils.isNotEmpty(realTimeVehicle.getVehicleInfoList())) {
realTimeVehicle.getVehicleInfoList().forEach(vehicleInfo -> {
if (carInfo.getCarId().equals(vehicleInfo.getCarId())) {
carInfo.setIsDriveTunnel(true);
}
});
}
Map<String,String> map = new HashMap<>(8);
if(CollectionUtils.isNotEmpty(vo.getEventHisRespVO().getVehicleInTunnelTime())){
for(Object o : vo.getEventHisRespVO().getVehicleInTunnelTime()){
Map<String,String> tempMap = (Map<String,String>)o;
map.putAll(tempMap);
}
}
String dateStr= map.get(carInfo.getCarPlate());
carInfo.setInTunnelTimeStr(dateStr);
// 车辆还在隧道内
if(carInfo.getIsDriveTunnel()){
if(StringUtils.isNotEmpty(dateStr)){
try {
Date date = DateUtil.parse(dateStr,"yyyy-MM-dd HH:mm:ss");
long diffMinTime = ((System.currentTimeMillis() - date.getTime())/1000/60);
if(diffMinTime < 0){
diffMinTime = 0;
}
carInfo.setRetainedMinutesTime((int) diffMinTime);
} catch (Exception e) {
log.error("时间格式转换异常,his车辆入隧时间",e);
}
}
}
log.info("告警的弹窗,其他处理:{},耗时:{}毫秒",id,System.currentTimeMillis() - startTimeOther);
});
return success(vo);
}
/**
* 测试推送给前端的事件数据
* @param eventId
* @return
*/
@GetMapping("/pushRealTimeEventData")
public CommonResult pushRealTimeEventData(@RequestParam("tunnelId") String tunnelId,@RequestParam("eventId") String eventId){
Arrays.stream(eventId.split(",")).forEach(id->{
eventGateway.pushRealTimeEventData(tunnelId,id);
});
return success("操作成功");
}
/**
* 测试保存切片视频,需要通过打印的日志作为参数进行保存
* @return
*/
@GetMapping("/videoPuller")
public CommonResult videoPuller(@RequestParam("rtspUrl") String rtspUrl,@RequestParam("outputFile") String outputFile){
historyGateway.videoPuller(rtspUrl, outputFile);
return success("操作成功");
}
} }
package com.cico.nest.lcdp.boot.core.qxsd.adapter.web; package com.cico.nest.lcdp.boot.core.qxsd.adapter.web;
import cn.hutool.core.date.DateUtil;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.ReportCarTypeFlowVO; import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.ReportCarTypeFlowVO;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.StatisticalByEventType;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.StatisticalHoleVo;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.TableStatsReqVO; import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.TableStatsReqVO;
import com.cico.nest.lcdp.boot.core.qxsd.application.service.StatisticalReportsService; import com.cico.nest.lcdp.boot.core.qxsd.application.service.StatisticalReportsService;
import com.cico.nest.lcdp.boot.core.qxsd.application.service.TunnelHoleService;
import com.cico.nest.lcdp.boot.core.qxsd.domain.event.EventType;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.EventDetailMapper;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.EventDetailDO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.TunnelHoleV2DO;
import com.cico.nest.lcdp.framework.common.pojo.CommonResult; import com.cico.nest.lcdp.framework.common.pojo.CommonResult;
import com.cico.nest.lcdp.framework.mybatis.core.query.LambdaQueryWrapperX;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -28,6 +42,10 @@ public class StatisticalReportsController { ...@@ -28,6 +42,10 @@ public class StatisticalReportsController {
@Resource @Resource
private StatisticalReportsService statisticalReportsService; private StatisticalReportsService statisticalReportsService;
@Resource
private TunnelHoleService tunnelHoleService;
@Resource
private EventDetailMapper eventDetailMapper;
/** /**
* 通行车次统计 * 通行车次统计
...@@ -73,4 +91,90 @@ public class StatisticalReportsController { ...@@ -73,4 +91,90 @@ public class StatisticalReportsController {
return CommonResult.success(statisticalReportsService.carTypeSpeedTrend(tableStatsReqVO)); return CommonResult.success(statisticalReportsService.carTypeSpeedTrend(tableStatsReqVO));
} }
/**
* 整个隧道今日流量
* @param tableStatsReqVO
* @return
*/
@PostMapping("/tunnelStatisticalTodayByHole")
@Operation(summary = "整个隧道今日流量")
CommonResult<StatisticalHoleVo> tunnelStatisticalTodayByHole(@RequestBody TableStatsReqVO tableStatsReqVO){
StatisticalHoleVo statisticalHoleVo = new StatisticalHoleVo();
String day = DateUtil.today().replaceAll("-","");
tableStatsReqVO.setStartStatisticsDay(day);
tableStatsReqVO.setEndStatisticsDay(day);
List<TunnelHoleV2DO> holeV2DOList = tunnelHoleService.getTunnelBaseId(tableStatsReqVO.getTunnelBaseId());
for (TunnelHoleV2DO tunnelHoleV2DO : holeV2DOList) {
if("tunnel_up".equals(tunnelHoleV2DO.getSfHoleId())){
tableStatsReqVO.setXlwTunnelId(tunnelHoleV2DO.getSfHoleId());
List<ReportCarTypeFlowVO> list = statisticalReportsService.carTypeFlow(tableStatsReqVO);
if(CollectionUtils.isNotEmpty(list)){
Integer count = list.stream().filter(item -> "全部".equals(item.getCatType())).findFirst().map(ReportCarTypeFlowVO::getCount).orElse(0);
statisticalHoleVo.setTunnelUpOld(count);
}
}
}
return CommonResult.success(statisticalHoleVo);
}
/**
* 整个隧道事件统计
* @return
*/
@PostMapping("/tunnelStatisticalByEventType")
@Operation(summary = "整个隧道今日流量")
CommonResult<Map<String, EventType.TypeStatistics>> carTypeFlowByHole(@Validated @RequestBody StatisticalByEventType statisticalByEventType ){
String startTime = "";
String endTime = "";
// 1:今日;2:本月;3:本年;
if( 1 == statisticalByEventType.getType()){
startTime = DateUtil.today() + " 00:00:00";
endTime = DateUtil.today() + " 23:59:59";
}else if( 2 == statisticalByEventType.getType()){
startTime = getCurrentMonthStartTime();
endTime = getCurrentMonthEndTime();
}else if( 3 == statisticalByEventType.getType()){
startTime = DateUtil.year(new Date()) + "-01-01 00:00:00";
endTime = DateUtil.year(new Date()) + "-12-31 23:59:59";
}
LambdaQueryWrapperX<EventDetailDO> wrapper = new LambdaQueryWrapperX<>();
wrapper.eq(EventDetailDO::getBaseTunnelId, statisticalByEventType.getTunnelBaseId());
wrapper.between(EventDetailDO::getEventStartTime,startTime,endTime);
List<EventDetailDO> list = eventDetailMapper.selectList(wrapper);
Map<String, EventType.TypeStatistics> map = EventType.getTypeStatistics();
for (String key : map.keySet()) {
EventType.TypeStatistics typeStatistics = map.get(key);
if(CollectionUtils.isNotEmpty(typeStatistics.getTypes())){
long count = list.stream().filter(item -> typeStatistics.getTypes().contains(item.getEventType())).count();
typeStatistics.setCount(count);
}
}
return CommonResult.success(map);
}
/**
* 获取当前月份开始时间并转换到字符串
* 如 当前为10月1日,返回2024-10-01 00:00:00
* @return 2024-10-01 00:00:00
*/
public static String getCurrentMonthStartTime() {
LocalDate startOfMonth = LocalDate.now().withDayOfMonth(1);
return startOfMonth.atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
}
/**
* 获取当前月份结束时间并转换到字符串
* 如 当前为10月1日,返回2024-10-31 23:59:59
* @return 2024-10-31 23:59:59
*/
public static String getCurrentMonthEndTime() {
LocalDate endOfMonth = LocalDate.now().withDayOfMonth(LocalDate.now().lengthOfMonth());
return endOfMonth.atTime(23, 59, 59).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
}
} }
package com.cico.nest.lcdp.boot.core.qxsd.adapter.web; package com.cico.nest.lcdp.boot.core.qxsd.adapter.web;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.request.LocusDataRequest; import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.request.LocusDataRequest;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.request.PassingProfileRequest; import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.request.PassingProfileRequest;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.request.RealTimeVehicleQueryRequest; import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.request.RealTimeVehicleQueryRequest;
...@@ -8,6 +10,7 @@ import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.PassingProfileVO; ...@@ -8,6 +10,7 @@ import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.PassingProfileVO;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.RealTimeVehicleVO; import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.RealTimeVehicleVO;
import com.cico.nest.lcdp.boot.core.qxsd.application.service.TunnelBaseService; import com.cico.nest.lcdp.boot.core.qxsd.application.service.TunnelBaseService;
import com.cico.nest.lcdp.boot.core.qxsd.application.service.VehicleService; import com.cico.nest.lcdp.boot.core.qxsd.application.service.VehicleService;
import com.cico.nest.lcdp.boot.core.qxsd.domain.gateway.HistoryGateway;
import com.cico.nest.lcdp.boot.core.qxsd.domain.vehicle.HistoryTunnelVehicle; import com.cico.nest.lcdp.boot.core.qxsd.domain.vehicle.HistoryTunnelVehicle;
import com.cico.nest.lcdp.boot.core.qxsd.domain.vehicle.TunnelRealTimeVehicle; import com.cico.nest.lcdp.boot.core.qxsd.domain.vehicle.TunnelRealTimeVehicle;
import com.cico.nest.lcdp.boot.core.qxsd.domain.vehicle.VehicleInfo; import com.cico.nest.lcdp.boot.core.qxsd.domain.vehicle.VehicleInfo;
...@@ -17,6 +20,7 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.qjmh.dt ...@@ -17,6 +20,7 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.qjmh.dt
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.qjmh.dto.QjmhCarParamPageDTO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.qjmh.dto.QjmhCarParamPageDTO;
import com.cico.nest.lcdp.framework.common.pojo.CommonResult; import com.cico.nest.lcdp.framework.common.pojo.CommonResult;
import com.cico.nest.lcdp.framework.common.pojo.PageResult; import com.cico.nest.lcdp.framework.common.pojo.PageResult;
import com.cico.nest.lcdp.framework.common.util.date.DateUtils;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
...@@ -27,6 +31,8 @@ import org.apache.commons.lang3.StringUtils; ...@@ -27,6 +31,8 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -49,6 +55,10 @@ public class VehicleController { ...@@ -49,6 +55,10 @@ public class VehicleController {
private IQjmhCarService qjmhCarService; private IQjmhCarService qjmhCarService;
@Value("${qxsd.qjmh.tunnel-name}") @Value("${qxsd.qjmh.tunnel-name}")
private String qjmhTunnelName; private String qjmhTunnelName;
@Value("${qxsd.xlw.images}")
private String xlwImagePath;
@Resource
private HistoryGateway historyGateway;
/** /**
* 留存车辆列表 * 留存车辆列表
...@@ -151,5 +161,16 @@ public class VehicleController { ...@@ -151,5 +161,16 @@ public class VehicleController {
public CommonResult<List<HistoryTunnelVehicle>> getCarLocusData(@RequestBody LocusDataRequest request){ public CommonResult<List<HistoryTunnelVehicle>> getCarLocusData(@RequestBody LocusDataRequest request){
return CommonResult.success(vehicleService.getCarLocusData(request)); return CommonResult.success(vehicleService.getCarLocusData(request));
} }
// @Operation(summary = "获取车辆卡口图片")
// @GetMapping("/getCarBayonetImageList")
// public CommonResult<List<String>> getCarBayonetImageList(@RequestParam("carPlate") String carPlate, @RequestParam("time") String time){
// // todo 说是新老洞的取发不同
// List<String> list = new ArrayList<>();
// list = historyGateway.saveBayonetImage(carPlate,DateUtil.parse(time, DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND));
// if(CollUtil.isNotEmpty(list)){
// list.stream().filter(e->e.startsWith("/")).map(xlwImagePath::concat).toList();
// }
// return CommonResult.success(list);
// }
} }
...@@ -2,6 +2,7 @@ package com.cico.nest.lcdp.boot.core.qxsd.adapter.web.request; ...@@ -2,6 +2,7 @@ package com.cico.nest.lcdp.boot.core.qxsd.adapter.web.request;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors;
/** /**
* @author zws * @author zws
...@@ -9,6 +10,7 @@ import lombok.Data; ...@@ -9,6 +10,7 @@ import lombok.Data;
*/ */
@Data @Data
@Accessors(chain = true)
public class LocusDataRequest { public class LocusDataRequest {
@Schema(description = "隧道id") @Schema(description = "隧道id")
......
package com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
/**
* @author tongzuqi
* @create 2025/6/22 11:47 AM
*/
@Data
public class StatisticalByEventType {
//隧道id
private String tunnelBaseId ="59b968f5-5438-4069-9e36-d68940e36765";
@NotNull(message = "type不能为空")
@Range(min = 1 ,max= 3,message = "类型不在范围")
private Integer type;
}
package com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo;
import lombok.Data;
/**
* @author tongzuqi
* @create 2025/6/22 11:46 AM
*/
@Data
public class StatisticalByEventTypeVo {
}
package com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo;
import lombok.Data;
/**
* @author tongzuqi
* @create 2025/6/22 11:31 AM
*/
@Data
public class StatisticalHoleVo {
private Integer tunnelUpOld = 0;
private Integer tunnelUpNew = 0;
private Integer tunnelDownOld = 0;
private Integer tunnelDownNew = 0;
}
...@@ -16,7 +16,10 @@ public class TableStatsReqVO { ...@@ -16,7 +16,10 @@ public class TableStatsReqVO {
private String endStatisticsDay; private String endStatisticsDay;
//隧道id //隧道id
private String tunnelBaseId ="59b968f5-5438-4069-9e36-d68940e36765";
//隧道id(qxsd_tunnel_detail)如(xl_tunnel_up)
private String tunnelId; private String tunnelId;
private String xlwTunnelId;
//开始统计时间,格式:yyyyMMddhh //开始统计时间,格式:yyyyMMddhh
private String startStatisticsHour; private String startStatisticsHour;
......
package com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.event;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - 事件告警 Response VO")
@Data
public class EventDetailAlarmVO {
private EventDetailRespVO eventDetailRespVO;
private EventHisRespVO eventHisRespVO;
}
...@@ -20,4 +20,9 @@ public class EventDetailDispelReqVO { ...@@ -20,4 +20,9 @@ public class EventDetailDispelReqVO {
@NotNull @NotNull
private String dispelCause; private String dispelCause;
/**
* 处理操作人姓名
*/
private String processingOperationsName;
} }
package com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.event; package com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.event;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;
...@@ -14,9 +16,23 @@ import org.springframework.format.annotation.DateTimeFormat; ...@@ -14,9 +16,23 @@ import org.springframework.format.annotation.DateTimeFormat;
@ToString(callSuper = true) @ToString(callSuper = true)
public class EventDetailPageReqVO extends PageParam { public class EventDetailPageReqVO extends PageParam {
@Schema(description = "隧道id", example = "6586")
/**
* 主键id
*/
private String id;
@Schema(description = "隧道id-(目前保存的是隧道信息的id)", example = "6586")
private String tunnelId; private String tunnelId;
@Schema(description = "所属隧道id", example = "6586")
private String baseTunnelId;
@Schema(description = "所属隧道code", example = "6586")
private String baseTunnelCode;
@Schema(description = "所属洞id", example = "6586")
private String holeId;
@Schema(description = "方向 上行/下行") @Schema(description = "方向 上行/下行")
private List<String> direction; private List<String> direction;
...@@ -56,6 +72,9 @@ public class EventDetailPageReqVO extends PageParam { ...@@ -56,6 +72,9 @@ public class EventDetailPageReqVO extends PageParam {
@Schema(description = "车辆号码") @Schema(description = "车辆号码")
private String eventCarPlate; private String eventCarPlate;
/**
* 事件列表关键词
*/
@Schema(description = "关键词") @Schema(description = "关键词")
private String keyword; private String keyword;
...@@ -74,4 +93,11 @@ public class EventDetailPageReqVO extends PageParam { ...@@ -74,4 +93,11 @@ public class EventDetailPageReqVO extends PageParam {
*/ */
private String alarmId; private String alarmId;
/**
* 首页-实时事件-关键词
* 桩号 + 隧道方向
*/
@Schema(description = "关键词")
private String keyword2;
} }
...@@ -22,9 +22,24 @@ public class EventDetailRespVO { ...@@ -22,9 +22,24 @@ public class EventDetailRespVO {
@ExcelProperty("三方系统id") @ExcelProperty("三方系统id")
private String thirdPartyId; private String thirdPartyId;
/**
* 隧道id-(目前保存的是隧道信息的id)
*/
@Schema(description = "隧道id", example = "6586") @Schema(description = "隧道id", example = "6586")
@ExcelProperty("隧道id") @ExcelProperty("隧道id")
private String tunnelId; private String tunnelId;
/**
* 所属隧道id
*/
@Schema(description = "所属隧道id", example = "6586")
@ExcelProperty("所属隧道id")
private String baseTunnelId;
/**
* 所属洞id
*/
@Schema(description = "所属洞id", example = "6586")
@ExcelProperty("所属洞id")
private String holeId;
@Schema(description = "方向 上行/下行") @Schema(description = "方向 上行/下行")
@ExcelProperty("方向 上行/下行") @ExcelProperty("方向 上行/下行")
...@@ -37,6 +52,9 @@ public class EventDetailRespVO { ...@@ -37,6 +52,9 @@ public class EventDetailRespVO {
@Schema(description = "桩号") @Schema(description = "桩号")
@ExcelProperty("桩号") @ExcelProperty("桩号")
private String milestone; private String milestone;
@Schema(description = "桩号(显示)")
@ExcelProperty("桩号")
private String milestoneStr;
@Schema(description = "车道号") @Schema(description = "车道号")
@ExcelProperty("车道号") @ExcelProperty("车道号")
...@@ -48,6 +66,12 @@ public class EventDetailRespVO { ...@@ -48,6 +66,12 @@ public class EventDetailRespVO {
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date eventStartTime; private Date eventStartTime;
@Schema(description = "事件开始时间(格式化)")
@ExcelProperty("事件开始时间(格式化)")
@JsonFormat(timezone = "GMT+8", pattern = "MM-dd HH:mm")
@DateTimeFormat(pattern = "MM-dd HH:mm")
private Date eventStartTimeFormat;
@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;
...@@ -146,5 +170,18 @@ public class EventDetailRespVO { ...@@ -146,5 +170,18 @@ public class EventDetailRespVO {
@Schema(description = "现场情况") @Schema(description = "现场情况")
private String situationSpot; private String situationSpot;
/**
* 处置方式(1:上报事件;2:消除事件;)
*/
private Integer processingType;
/**
* 处置操作人姓名
*/
private String processingOperationsName;
/**
* 处置时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date processingTime;
} }
...@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONArray; ...@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONArray;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -20,6 +21,11 @@ public class EventHisRespVO { ...@@ -20,6 +21,11 @@ public class EventHisRespVO {
@Schema(description = "事件id", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "事件id", requiredMode = Schema.RequiredMode.REQUIRED)
private String eventId; private String eventId;
/**
* 车辆入隧时间
*/
@Schema(description = "车辆入隧时间", requiredMode = Schema.RequiredMode.REQUIRED)
private JSONArray vehicleInTunnelTime;
/** /**
* 历史车辆轨迹 * 历史车辆轨迹
*/ */
...@@ -38,6 +44,11 @@ public class EventHisRespVO { ...@@ -38,6 +44,11 @@ public class EventHisRespVO {
@Schema(description = "卡口图片", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "卡口图片", requiredMode = Schema.RequiredMode.REQUIRED)
private List<Map> bayonetImage; private List<Map> bayonetImage;
/**
* 海康摄像头唯一编码
*/
private String cameraIndexCode;
/** /**
* 视频地址 * 视频地址
*/ */
......
...@@ -38,6 +38,7 @@ public class RealTimeEventWs extends AbstractRealTimeEventWs { ...@@ -38,6 +38,7 @@ public class RealTimeEventWs extends AbstractRealTimeEventWs {
public void onOpen(Session session){ public void onOpen(Session session){
session.setMaxIdleTimeout(60000); session.setMaxIdleTimeout(60000);
sessionList.add(session); sessionList.add(session);
logger.info("ws建立连接-realTimeEvent,当前连接数:{}",sessionList.size());
} }
/** /**
......
...@@ -37,6 +37,7 @@ public class RealTimeEventWs1 extends AbstractRealTimeEventWs { ...@@ -37,6 +37,7 @@ public class RealTimeEventWs1 extends AbstractRealTimeEventWs {
public void onOpen(Session session){ public void onOpen(Session session){
session.setMaxIdleTimeout(60000); session.setMaxIdleTimeout(60000);
sessionList.add(session); sessionList.add(session);
logger.info("ws建立连接-realTimeEvent1,当前连接数:{}",sessionList.size());
} }
/** /**
......
...@@ -38,6 +38,9 @@ public class RealTimeVehicleWs extends AbstractRealTimeVehicleWs { ...@@ -38,6 +38,9 @@ public class RealTimeVehicleWs extends AbstractRealTimeVehicleWs {
public void onOpen(Session session){ public void onOpen(Session session){
session.setMaxIdleTimeout(60000); session.setMaxIdleTimeout(60000);
sessionList.add(session); sessionList.add(session);
logger.info("ws建立连接-realTimeCar,当前连接数:{}",sessionList.size());
} }
/** /**
......
...@@ -39,6 +39,7 @@ public class RealTimeVehicleWs1 extends AbstractRealTimeVehicleWs { ...@@ -39,6 +39,7 @@ public class RealTimeVehicleWs1 extends AbstractRealTimeVehicleWs {
public void onOpen(Session session){ public void onOpen(Session session){
session.setMaxIdleTimeout(60000); session.setMaxIdleTimeout(60000);
sessionList.add(session); sessionList.add(session);
logger.info("ws建立连接-realTimeCar1,当前连接数:{}",sessionList.size());
} }
/** /**
......
...@@ -34,7 +34,7 @@ public interface EventDetailService{ ...@@ -34,7 +34,7 @@ public interface EventDetailService{
* 事件消除 * 事件消除
* @param id 事件id * @param id 事件id
*/ */
void dispelEvent(String id,String dispelCause); void dispelEvent(String id,String dispelCause,String processingOperationsName);
/** /**
* 上报隧道管控新事件 * 上报隧道管控新事件
......
...@@ -5,6 +5,8 @@ import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.tunnelHole.*; ...@@ -5,6 +5,8 @@ import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.tunnelHole.*;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.TunnelHoleV2DO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.TunnelHoleV2DO;
import com.cico.nest.lcdp.framework.common.pojo.PageResult; import com.cico.nest.lcdp.framework.common.pojo.PageResult;
import java.util.List;
/** /**
* 隧道设施上下行洞 Service 接口 * 隧道设施上下行洞 Service 接口
* *
...@@ -50,4 +52,20 @@ public interface TunnelHoleService { ...@@ -50,4 +52,20 @@ public interface TunnelHoleService {
*/ */
PageResult<TunnelHoleV2DO> getTunnelHolePage(TunnelHolePageReqVO pageReqVO); PageResult<TunnelHoleV2DO> getTunnelHolePage(TunnelHolePageReqVO pageReqVO);
/**
* 根据sfHoleId获取隧道设施上下行洞
* @param sfHoleId
* @return
*/
TunnelHoleV2DO getTunnelSfHoleId(String sfHoleId);
/**
* 获得隧道tunnelId 关联的洞信息
*
* @param baseTunnelId 编号
* @return 隧道设施上下行洞
*/
List<TunnelHoleV2DO> getTunnelBaseId(String baseTunnelId);
} }
...@@ -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.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;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -83,7 +84,7 @@ public class EventDetailServiceImpl implements EventDetailService { ...@@ -83,7 +84,7 @@ public class EventDetailServiceImpl implements EventDetailService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void dispelEvent(String id,String dispelCause) { public void dispelEvent(String id,String dispelCause,String processingOperationsName) {
EventDetailDO eventDetailDO = eventDetailMapper.selectById(id); EventDetailDO eventDetailDO = eventDetailMapper.selectById(id);
if(Objects.isNull(eventDetailDO)){ if(Objects.isNull(eventDetailDO)){
throw new ServiceException(INTERNAL_SERVER_ERROR.getCode(),"事件不存在"); throw new ServiceException(INTERNAL_SERVER_ERROR.getCode(),"事件不存在");
...@@ -97,6 +98,9 @@ public class EventDetailServiceImpl implements EventDetailService { ...@@ -97,6 +98,9 @@ public class EventDetailServiceImpl implements EventDetailService {
} }
eventDetailDO.setEventStatus(EventStatus.disposing_end.type); eventDetailDO.setEventStatus(EventStatus.disposing_end.type);
eventDetailDO.setDispelCause(dispelCause); eventDetailDO.setDispelCause(dispelCause);
eventDetailDO.setProcessingType(2);
eventDetailDO.setProcessingOperationsName(processingOperationsName);
eventDetailDO.setProcessingTime(new Date());
eventDetailMapper.updateById(eventDetailDO); eventDetailMapper.updateById(eventDetailDO);
} }
...@@ -120,9 +124,11 @@ public class EventDetailServiceImpl implements EventDetailService { ...@@ -120,9 +124,11 @@ public class EventDetailServiceImpl implements EventDetailService {
@Override @Override
public EventHisRespVO getEventHisDetail(String eventId) { public EventHisRespVO getEventHisDetail(String eventId) {
EventHisDO eventHis = eventHisMapper.selectByEventId(eventId); EventHisDO eventHis = eventHisMapper.selectByEventId(eventId);
EventDetailDO eventDetailDO = eventDetailMapper.selectById(eventId);
EventHisRespVO respVO = new EventHisRespVO(); EventHisRespVO respVO = new EventHisRespVO();
respVO.setEventId(eventId); EventDetailDO eventDetailDO = eventDetailMapper.selectById(eventId);
if(Objects.isNull(eventDetailDO)){
return respVO;
}
if(Objects.isNull(eventHis)){ if(Objects.isNull(eventHis)){
//取实时的事件图片 //取实时的事件图片
List<String> eventImagesPath = eventDetailDO.getEventImagesPath(); List<String> eventImagesPath = eventDetailDO.getEventImagesPath();
...@@ -130,6 +136,7 @@ public class EventDetailServiceImpl implements EventDetailService { ...@@ -130,6 +136,7 @@ public class EventDetailServiceImpl implements EventDetailService {
respVO.setEventImagesPath(eventImagesPath.stream().filter(e->e.startsWith("/")).map(e->xlwImagesPath.concat(e)).toList()); respVO.setEventImagesPath(eventImagesPath.stream().filter(e->e.startsWith("/")).map(e->xlwImagesPath.concat(e)).toList());
} }
}else{ }else{
BeanUtils.copyProperties(eventHis,respVO);
respVO.setExistHisData(true); respVO.setExistHisData(true);
List<String> eventImagesPath = eventHis.getEventImagesPath(); List<String> eventImagesPath = eventHis.getEventImagesPath();
if(CollUtil.isNotEmpty(eventImagesPath)){ if(CollUtil.isNotEmpty(eventImagesPath)){
...@@ -152,6 +159,7 @@ public class EventDetailServiceImpl implements EventDetailService { ...@@ -152,6 +159,7 @@ public class EventDetailServiceImpl implements EventDetailService {
respVO.setBayonetImage(bayonetImagePath); respVO.setBayonetImage(bayonetImagePath);
} }
respVO.setHisVehicleInfo(eventHis.getHisVehicleInfo()); respVO.setHisVehicleInfo(eventHis.getHisVehicleInfo());
respVO.setCameraIndexCode(eventHis.getCameraIndexCode());
//视频 //视频
String videoPath = eventHis.getVideoPath(); String videoPath = eventHis.getVideoPath();
if(StrUtil.isNotBlank(videoPath) && !videoPath.contains("error")){ if(StrUtil.isNotBlank(videoPath) && !videoPath.contains("error")){
......
...@@ -3,6 +3,7 @@ package com.cico.nest.lcdp.boot.core.qxsd.application.service.impl; ...@@ -3,6 +3,7 @@ package com.cico.nest.lcdp.boot.core.qxsd.application.service.impl;
import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.request.LocusDataRequest;
import com.cico.nest.lcdp.boot.core.qxsd.application.service.HistoryService; import com.cico.nest.lcdp.boot.core.qxsd.application.service.HistoryService;
import com.cico.nest.lcdp.boot.core.qxsd.domain.gateway.HistoryGateway; import com.cico.nest.lcdp.boot.core.qxsd.domain.gateway.HistoryGateway;
import com.cico.nest.lcdp.boot.core.qxsd.domain.vehicle.HistoryTunnelVehicle; import com.cico.nest.lcdp.boot.core.qxsd.domain.vehicle.HistoryTunnelVehicle;
...@@ -11,15 +12,21 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.Tun ...@@ -11,15 +12,21 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.Tun
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.EventDetailDO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.EventDetailDO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.EventHisDO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.EventHisDO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.TunnelDetailDO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.TunnelDetailDO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.TunnelDeviceDO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.hk.HkVideoMapper; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.hk.HkVideoMapper;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto.XlwHolographicTimeHistoryDTO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto.XlwHolographicTimeHistoryDTO;
import com.cico.nest.lcdp.framework.common.util.date.DateUtils;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.multimap.HashSetValuedHashMap;
import org.apache.commons.lang3.StringUtils;
import org.simpleframework.xml.Path; import org.simpleframework.xml.Path;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author zws * @author zws
...@@ -36,16 +43,73 @@ public class HistoryServiceImpl implements HistoryService { ...@@ -36,16 +43,73 @@ public class HistoryServiceImpl implements HistoryService {
private EventHisMapper eventHisMapper; private EventHisMapper eventHisMapper;
@Resource @Resource
private TunnelDetailMapper tunnelDetailMapper; private TunnelDetailMapper tunnelDetailMapper;
@Value("${spring.profiles.active}")
private String activeProfile;
/** /**
* 保存事件历史数据 * 事件完成时保存事件历史数据
* v1 事件完成后被调用,his表做新增动作
* v2 事件未完成或者完成都会被调用,未完成时保存卡口,及事件图片,完成时调用如果保存卡口 或者 事件图片 为空,再保存一次
* 有可能第一次的执行还没结束,第二次又进来了,
* @param eventDetailDO 事件信息 * @param eventDetailDO 事件信息
*/ */
@Override @Override
public void saveEventHistoryData(EventDetailDO eventDetailDO) { public void saveEventHistoryData(EventDetailDO eventDetailDO) {
// 为0需要更新其他信息
boolean isEventEnd = Objects.equals(eventDetailDO.getThirdEventStatus(), 0);
log.info("保存事件历史表,eventId:{},开始,三方事件状态是否结束={},",eventDetailDO.getId(),isEventEnd?"结束":"未结束");
EventHisDO eventHisDO = new EventHisDO(); EventHisDO eventHisDO = new EventHisDO();
eventHisDO.setEventId(eventDetailDO.getId()); eventHisDO.setEventId(eventDetailDO.getId());
eventHisDO.setCreateTime(new Date()); EventHisDO mysqlEventHisDO = eventHisMapper.selectByEventId(eventDetailDO.getId());
if(Objects.nonNull(mysqlEventHisDO)){
eventHisDO = mysqlEventHisDO;
}else{
eventHisMapper.insertOrUpdate(eventHisDO);
}
// todo 写入 vehicleInTunnelTime 字段 车辆入隧时间
// 事件完成 && 字段为空 更新 轨迹数据 字段
if( isEventEnd && CollectionUtils.isEmpty(eventHisDO.getHisVehicleInfo()) ){
//轨迹数据
this.getHisVehicleInfo( eventDetailDO, eventHisDO);
log.info("保存事件历史表,eventId:{},【轨迹数据】完成",eventDetailDO.getId());
}
// 事件图片 不存在 更新 事件图片 字段
if( CollectionUtils.isEmpty(eventHisDO.getEventImagesPath()) ){
this.getEventImage( eventDetailDO, eventHisDO);
log.info("保存事件历史表,eventId:{},【事件图片】完成",eventDetailDO.getId());
}
// 卡口图片 不存在 更新 卡口图片 字段 因为为空需去里面判断
// if( CollectionUtils.isEmpty(eventHisDO.getBayonetImage()) ){
this.getBayonetImage( eventDetailDO, eventHisDO);
log.info("保存事件历史表,eventId:{},【卡口图片】完成",eventDetailDO.getId());
// }
// 事件完成 && 字段为空 || 存储是 包含"error" 更新 历史视频数据 字段
if( isEventEnd && (StringUtils.isEmpty(eventHisDO.getVideoPath()) || eventHisDO.getVideoPath().indexOf("error")>-1 )){
//历史视频数据 非 localhost 环境会下载,本地就不测试了 todo
if(!"localhost1".equals(activeProfile)){
this.getVideoPath( eventDetailDO, eventHisDO);
log.info("保存事件历史表,eventId:{},【历史视频数据】完成",eventDetailDO.getId());
}else{
log.info("保存事件历史表,eventId:{},【历史视频数据】localhost环境不进行下载",eventDetailDO.getId());
}
}
try {
eventHisMapper.insertOrUpdate(eventHisDO);
log.info("保存事件历史表,eventId:{},结束",eventDetailDO.getId());
} catch (Exception e) {
log.error("保存事件历史表,eventId:{},保存事件历史数据异常",eventDetailDO.getId(),e);
}
}
private void getEventImage(EventDetailDO eventDetailDO,EventHisDO eventHisDO) {
//保存事件图片 //保存事件图片
try { try {
List<String> eventImagesPathList = eventDetailDO.getEventImagesPath(); List<String> eventImagesPathList = eventDetailDO.getEventImagesPath();
...@@ -66,19 +130,25 @@ public class HistoryServiceImpl implements HistoryService { ...@@ -66,19 +130,25 @@ public class HistoryServiceImpl implements HistoryService {
} catch (Exception e) { } catch (Exception e) {
} }
}
private void getHisVehicleInfo(EventDetailDO eventDetailDO,EventHisDO eventHisDO) {
//获取轨迹数据 //获取轨迹数据
try{ try{
TunnelDetailDO tunnelDetailDO = tunnelDetailMapper.selectById(eventDetailDO.getTunnelId()); List<HistoryTunnelVehicle> historyTunnelVehicleList = historyGateway.getVehicleInfo(
List<HistoryTunnelVehicle> historyTunnelVehicleList = new LocusDataRequest()
historyGateway.getVehicleInfo(eventDetailDO.getThirdPartyId(), .setTunnelId(eventDetailDO.getTunnelId())
eventDetailDO.getTunnelId(), .setStartTime(DateUtil.format(eventDetailDO.getEventStartTime(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND))
eventDetailDO.getDirection(), .setEndTime(DateUtil.format(eventDetailDO.getEventEndTime(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND))
tunnelDetailDO.getStartMilestone()); );
eventHisDO.setHisVehicleInfo(JSONArray.from(historyTunnelVehicleList)); eventHisDO.setHisVehicleInfo(JSONArray.from(historyTunnelVehicleList));
}catch (Throwable e){ }catch (Throwable e){
eventHisDO.setHisVehicleInfo(JSONArray.from(new ArrayList<>())); eventHisDO.setHisVehicleInfo(JSONArray.from(new ArrayList<>()));
log.error("获取轨迹数据失败",e); log.error("获取轨迹数据失败",e);
} }
}
private void getVideoPath(EventDetailDO eventDetailDO,EventHisDO eventHisDO) {
//获取历史视频数据 //获取历史视频数据
try{ try{
Date eventStartTime = eventDetailDO.getEventStartTime(); Date eventStartTime = eventDetailDO.getEventStartTime();
...@@ -89,16 +159,25 @@ public class HistoryServiceImpl implements HistoryService { ...@@ -89,16 +159,25 @@ public class HistoryServiceImpl implements HistoryService {
String endTime = DateUtil.format(eventEndTime,"yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); String endTime = DateUtil.format(eventEndTime,"yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
if(diffSecond > 24){ if(diffSecond > 24){
endTime = DateUtil.format(DateUtil.offsetSecond(eventStartTime,24),"yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); endTime = DateUtil.format(DateUtil.offsetSecond(eventStartTime,24),"yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
log.info("getVideoPath,时长:{}>24s,重新设置结束时间:{}",diffSecond,endTime);
} }
log.info("获取历史视频,eventId:{},开始时间:{},结束时间:{},时长:{}",eventDetailDO.getId(),beginTime,endTime,diffSecond);
int direction = 0; int direction = 100700;
if("下行".equals(eventDetailDO.getDirection())){ if("下行".equals(eventDetailDO.getDirection())){
direction = 1; direction = 100701;
} }
//todo 自动生成的id不能写死啊 我日 TunnelDeviceDO tunnelDeviceDO = historyGateway.getDevice(eventDetailDO.getBaseTunnelCode()
String videoUrl = historyGateway.saveVideo("d08071ebf16f0047ee5ff770bff1752f" ,eventDetailDO.getHoleId()
,Integer.valueOf(eventDetailDO.getDeviceMilestone()) ,Integer.valueOf(eventDetailDO.getDeviceMilestone())
,direction ,direction);
if(Objects.isNull(tunnelDeviceDO)){
log.error("未找到对应摄像头,tunnelCode:{},holeId:{},deviceMilestone:{},direction:{}", eventDetailDO.getBaseTunnelCode(), eventDetailDO.getHoleId(), Integer.valueOf(eventDetailDO.getDeviceMilestone()), direction);
eventHisDO.setVideoPath("error未找到对应摄像头,事件桩号:" + eventDetailDO.getDeviceMilestone());
return;
}
//保存
eventHisDO.setCameraIndexCode(tunnelDeviceDO.getCameraIndexCode());
String videoUrl = historyGateway.saveVideo(tunnelDeviceDO.getCameraIndexCode()
,beginTime ,beginTime
,endTime ,endTime
,eventDetailDO.getId() + ".mp4"); ,eventDetailDO.getId() + ".mp4");
...@@ -108,26 +187,46 @@ public class HistoryServiceImpl implements HistoryService { ...@@ -108,26 +187,46 @@ public class HistoryServiceImpl implements HistoryService {
eventHisDO.setVideoPath("error获取历史视频失败"); eventHisDO.setVideoPath("error获取历史视频失败");
log.error("获取历史视频失败",e); log.error("获取历史视频失败",e);
} }
}
private void getBayonetImage(EventDetailDO eventDetailDO,EventHisDO eventHisDO) {
List<String> catPlateErrorList = Arrays.asList("人","未知","默A00000");
Map<String,List<String>> map = new HashMap<>(8);
if(CollectionUtils.isNotEmpty(eventHisDO.getBayonetImage())){
for(Object o : eventHisDO.getBayonetImage()){
Map<String,List<String>> tempMap = (Map<String,List<String>>)o;
map.putAll(tempMap);
}
}
//获取卡口图片 //获取卡口图片
try { try {
List<String> carPlateList = eventDetailDO.getEventCarPlate(); List<String> carPlateList = eventDetailDO.getEventCarPlate();
JSONArray jsonArray = new JSONArray(); JSONArray jsonArray = new JSONArray();
for(String carPlate : carPlateList){ for(String carPlate : carPlateList){
// 卡口图片存在,并且集合>0
if(map.containsKey(carPlate) && CollectionUtils.isNotEmpty(map.get(carPlate))){
jsonArray.add(Map.of(carPlate,map.get(carPlate)));
}else{
try{ try{
if(catPlateErrorList.contains(carPlate)){
log.info("保存事件历史表,eventId:{},【卡口图片】carPlate={},定义为无卡口信息不进行查询",eventDetailDO.getId(),carPlate);
jsonArray.add(Map.of(carPlate,new ArrayList()));
}else{
List<String> bayonetImageList = historyGateway.saveBayonetImage(carPlate,eventDetailDO.getEventStartTime()); List<String> bayonetImageList = historyGateway.saveBayonetImage(carPlate,eventDetailDO.getEventStartTime());
Map<String,Object> bayonetImageMap = Map.of(carPlate,bayonetImageList); jsonArray.add(Map.of(carPlate,bayonetImageList));
jsonArray.add(bayonetImageMap); }
}catch (Throwable e){ }catch (Throwable e){
log.error("获取卡口图片失败",e); log.error("获取卡口图片失败",e);
} }
} }
}
eventHisDO.setBayonetImage(jsonArray); eventHisDO.setBayonetImage(jsonArray);
} catch (Exception e) { } catch (Exception e) {
}
eventHisMapper.insert(eventHisDO);
} }
}
......
...@@ -9,6 +9,7 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dat ...@@ -9,6 +9,7 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dat
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto.XlwTableStatsDTO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto.XlwTableStatsDTO;
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 jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -36,8 +37,12 @@ public class StatisticalReportsServiceImpl implements StatisticalReportsService ...@@ -36,8 +37,12 @@ public class StatisticalReportsServiceImpl implements StatisticalReportsService
public List<ReportCarTypeFlowVO> carTypeFlow(TableStatsReqVO tableStatsReqVO) { public List<ReportCarTypeFlowVO> carTypeFlow(TableStatsReqVO tableStatsReqVO) {
XlwTableStatsDTO dto = new XlwTableStatsDTO(); XlwTableStatsDTO dto = new XlwTableStatsDTO();
BeanUtils.copyProperties(tableStatsReqVO,dto); BeanUtils.copyProperties(tableStatsReqVO,dto);
if(StringUtils.isEmpty(tableStatsReqVO.getXlwTunnelId())){
TunnelDetailDO tunnelDetailDO = tunnelDetailMapper.selectById(tableStatsReqVO.getTunnelId()); TunnelDetailDO tunnelDetailDO = tunnelDetailMapper.selectById(tableStatsReqVO.getTunnelId());
dto.setTunnelId(tunnelDetailDO.getXlwTunnelId()); dto.setTunnelId(tunnelDetailDO.getXlwTunnelId());
}else{
dto.setTunnelId(tableStatsReqVO.getXlwTunnelId());
}
XlwResultData<List<Map<String,Object>>> resultData = xlwClientFeign.carFlowPageDay(dto); XlwResultData<List<Map<String,Object>>> resultData = xlwClientFeign.carFlowPageDay(dto);
List<Map<String,Object>> data = resultData.getData(); List<Map<String,Object>> data = resultData.getData();
//危化品车辆数量 //危化品车辆数量
......
...@@ -334,7 +334,8 @@ public class TunnelBaseServiceImpl implements TunnelBaseService { ...@@ -334,7 +334,8 @@ public class TunnelBaseServiceImpl implements TunnelBaseService {
//查询上下行洞 //查询上下行洞
LambdaQueryWrapper<TunnelHoleV2DO> holeWrapper = new LambdaQueryWrapperX<TunnelHoleV2DO>() LambdaQueryWrapper<TunnelHoleV2DO> holeWrapper = new LambdaQueryWrapperX<TunnelHoleV2DO>()
.eq(TunnelHoleV2DO::getTunnelId,tunnelId) .eq(TunnelHoleV2DO::getTunnelId,tunnelId)
.eq(TunnelHoleV2DO::getDeleted,0); .eq(TunnelHoleV2DO::getDeleted,0)
.orderByAsc(TunnelHoleV2DO::getOrderNo);
List<TunnelHoleV2DO> holeV2DOS = tunnelHoleMapper.selectList(holeWrapper); List<TunnelHoleV2DO> holeV2DOS = tunnelHoleMapper.selectList(holeWrapper);
List<TunnelHoleRespVO> holeRespVOS = BeanUtils.toBean(holeV2DOS, TunnelHoleRespVO.class); List<TunnelHoleRespVO> holeRespVOS = BeanUtils.toBean(holeV2DOS, TunnelHoleRespVO.class);
//查询标志线 //查询标志线
......
...@@ -9,6 +9,9 @@ import jakarta.annotation.Resource; ...@@ -9,6 +9,9 @@ import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import com.cico.nest.lcdp.framework.common.pojo.PageResult; import com.cico.nest.lcdp.framework.common.pojo.PageResult;
import com.cico.nest.lcdp.framework.common.util.object.BeanUtils; import com.cico.nest.lcdp.framework.common.util.object.BeanUtils;
import java.util.List;
import static com.cico.nest.lcdp.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR; import static com.cico.nest.lcdp.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
import static com.cico.nest.lcdp.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cico.nest.lcdp.framework.common.exception.util.ServiceExceptionUtil.exception;
...@@ -66,4 +69,12 @@ public class TunnelHoleServiceImpl implements TunnelHoleService { ...@@ -66,4 +69,12 @@ public class TunnelHoleServiceImpl implements TunnelHoleService {
return tunnelHoleMapper.selectPage(pageReqVO); return tunnelHoleMapper.selectPage(pageReqVO);
} }
@Override
public TunnelHoleV2DO getTunnelSfHoleId(String sfHoleId) {
return tunnelHoleMapper.selectOne(TunnelHoleV2DO::getSfHoleId, sfHoleId);
}
@Override
public List<TunnelHoleV2DO> getTunnelBaseId(String baseTunnelId) {
return tunnelHoleMapper.selectList(TunnelHoleV2DO::getTunnelId, baseTunnelId);
}
} }
package com.cico.nest.lcdp.boot.core.qxsd.domain.event; package com.cico.nest.lcdp.boot.core.qxsd.domain.event;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @author zws * @author zws
* @date 2024/8/15 * @date 2024/8/15
...@@ -13,9 +21,29 @@ public enum EventType { ...@@ -13,9 +21,29 @@ public enum EventType {
retrograde(4,"逆行"), retrograde(4,"逆行"),
congestion(5,"拥堵"), congestion(5,"拥堵"),
suspicious_events(6,"可疑事件"), suspicious_events(6,"可疑事件"),
rear_end_chase(7,"追尾"), rear_end_chase(7,"事故"),
parking(8,"停车"), parking(8,"违章停车"),
other(100,"其他");
slow_driving(9,"缓慢行驶"),
super_slow_driving(10,"超慢行驶"),
stop(11,"停驶"),
pedestrian(12,"行人"),
spill(13,"抛洒物"),
fire(14,"火灾"),
abnormal_weather(15,"异常天气"),
overspeed(16,"超速"),
intrude(17,"闯入"),
not_flow_lane(18,"不按车道行驶"),
non_motor(19,"非机动车"),
danger_truck(20,"危化品车辆"),
other(100,"其他"),
nothing(99,"无"),
motor_intrude(22,"机动车闯禁行"),
bus(21,"大型客车"),
;
public final int type; public final int type;
...@@ -37,4 +65,28 @@ public enum EventType { ...@@ -37,4 +65,28 @@ public enum EventType {
return other; return other;
} }
/**
* 首页需要分组的
* 交通事故:追尾、刮擦、翻车、撞固定物、撞行人、撞抛洒物、车辆起火(火灾)
* 路面状况:抛洒物、违章停车、停驶、逆行、非机动车、行人、急加速、急减速、蛇形驾驶、机动车闯禁行、不按车道行驶、拥堵、缓慢行驶、危化品车、大型客车、违法变道、超速、可疑事件
* 车辆故障:抛锚、爆胎、
* 道路施工:日常养护(占道)、专项工程(占道)、临时抢修(占道)、日常养护(断路)、专项工程(断路)、临时抢修(断路)、专项工程(借道))、临时抢修(借道)、拓宽施工
* 其他:
*/
public static Map<String,TypeStatistics> getTypeStatistics(){
Map<String,TypeStatistics> map = new HashMap(5);
map.put("交通事故",new EventType.TypeStatistics().setTypes(List.of(7,14)));
map.put("路面状况",new TypeStatistics().setTypes(List.of(0,1,2,3,4,5,6,8,16,22,21,9,10,11,12,13,17,18,19,20)));
map.put("车辆故障",new TypeStatistics());
map.put("道路施工",new TypeStatistics());
map.put("其他",new TypeStatistics().setTypes(List.of(100,99,15)));
return map;
}
@Data
@Accessors(chain = true)
public static class TypeStatistics{
private List<Integer> types = new ArrayList<>();
private long count = 0;
}
} }
...@@ -14,8 +14,9 @@ public interface EventGateway { ...@@ -14,8 +14,9 @@ public interface EventGateway {
/** /**
* 推送实时事件数据 * 推送实时事件数据
* @param tunnelId 隧道id * @param tunnelId 隧道id
* @param eventDetailId 事件详情id
*/ */
void pushRealTimeEventData(String tunnelId); void pushRealTimeEventData(String tunnelId,String eventDetailId);
/** /**
* 查询事件列表 * 查询事件列表
......
package com.cico.nest.lcdp.boot.core.qxsd.domain.gateway; package com.cico.nest.lcdp.boot.core.qxsd.domain.gateway;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.request.LocusDataRequest;
import com.cico.nest.lcdp.boot.core.qxsd.domain.vehicle.HistoryTunnelVehicle; import com.cico.nest.lcdp.boot.core.qxsd.domain.vehicle.HistoryTunnelVehicle;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.TunnelDeviceDO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto.XlwHolographicTimeHistoryDTO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto.XlwHolographicTimeHistoryDTO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw.dto.XlwRealTimeVehicleDTO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw.dto.XlwRealTimeVehicleDTO;
...@@ -30,17 +32,31 @@ public interface HistoryGateway { ...@@ -30,17 +32,31 @@ public interface HistoryGateway {
List<String> saveBayonetImage(String carPlate, Date eventStartTime); List<String> saveBayonetImage(String carPlate, Date eventStartTime);
/** /**
* 获取视频流 * 获取设备信息
* @param deviceMilestone 设备桩号 * @param deviceMilestone 设备桩号
* @return TunnelDeviceDO 设备信息
*/
TunnelDeviceDO getDevice(String tunnelCode,String holeId,Integer deviceMilestone,Integer direction);
/**
* 获取视频流
* @param cameraIndexCode 海康摄像机唯一编号
* @return 视频数据 * @return 视频数据
*/ */
String saveVideo(String facilityId,Integer deviceMilestone,Integer direction,String beginTime,String endTime,String outputFile); String saveVideo(String cameraIndexCode,String beginTime,String endTime,String outputFile);
/** /**
* 获取事件车辆信息 * 获取事件车辆信息
* @param eventId 事件id * @param eventId 事件id
* @return 车辆数据 * @return 车辆数据
*/ */
List<HistoryTunnelVehicle> getVehicleInfo(String eventId,String tunnelId,String direction,int startMilestone); List<HistoryTunnelVehicle> getVehicleInfo(LocusDataRequest locusDataRequest);
/**
* 保存切片视频
* @param rtspUrl 视频流
* @param outputFile 保存路径
*/
void videoPuller(String rtspUrl, String outputFile);
} }
package com.cico.nest.lcdp.boot.core.qxsd.infrastructure.common.constatnt; package com.cico.nest.lcdp.boot.core.qxsd.infrastructure.common.constatnt;
import java.util.Arrays;
import java.util.List;
/** /**
* @author zws * @author zws
* @date 2024/8/7 * @date 2024/8/7
...@@ -14,7 +17,7 @@ public interface XlwConstants { ...@@ -14,7 +17,7 @@ public interface XlwConstants {
/** /**
* 登录接口 * 登录接口
*/ */
String LOGIN_INTERFACE = "/common/login.htm"; List<String> LOGIN_INTERFACE_LIST = Arrays.asList("/common/login.htm","/backDoor/getDemoSessionId.htm");
/** /**
......
...@@ -11,6 +11,7 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto ...@@ -11,6 +11,7 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw.dto.XlwRealTimeEventDTO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw.dto.XlwRealTimeEventDTO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw.dto.XlwRealTimeVehicleDTO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw.dto.XlwRealTimeVehicleDTO;
import com.cico.nest.lcdp.framework.common.util.date.DateUtils; import com.cico.nest.lcdp.framework.common.util.date.DateUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -25,10 +26,12 @@ import static com.cico.nest.lcdp.boot.core.qxsd.domain.vehicle.VehicleType.*; ...@@ -25,10 +26,12 @@ import static com.cico.nest.lcdp.boot.core.qxsd.domain.vehicle.VehicleType.*;
* @author zws * @author zws
* @date 2024/8/8 * @date 2024/8/8
*/ */
@Slf4j
public class VehicleConvertor { public class VehicleConvertor {
public static TunnelRealTimeVehicle convert2TunnelRTV(XlwRealTimeVehicleDTO dto,String tunnelId,String direction,int startMilestone) { public static TunnelRealTimeVehicle convert2TunnelRTV(XlwRealTimeVehicleDTO dto,String tunnelId,String direction,int startMilestone) {
TunnelRealTimeVehicle tunnelRealTimeVehicle = new TunnelRealTimeVehicle(); TunnelRealTimeVehicle tunnelRealTimeVehicle = new TunnelRealTimeVehicle();
BeanUtils.copyProperties(dto,tunnelRealTimeVehicle); BeanUtils.copyProperties(dto,tunnelRealTimeVehicle);
...@@ -88,6 +91,10 @@ public class VehicleConvertor { ...@@ -88,6 +91,10 @@ public class VehicleConvertor {
vehicleInfo.setRetainedMinutesTime(5); vehicleInfo.setRetainedMinutesTime(5);
if(Objects.nonNull(xlwCarInfo.getInTunnelTime())){ if(Objects.nonNull(xlwCarInfo.getInTunnelTime())){
long diffMinTime = ((currentTime - xlwCarInfo.getInTunnelTime())/1000/60); long diffMinTime = ((currentTime - xlwCarInfo.getInTunnelTime())/1000/60);
if(diffMinTime < 0){
// log.error("留存时间计算异常:值{},currentTime:{}-xlwCarInfo.getInTunnelTime():{}",diffMinTime,DateUtil.formatDateTime(new Date(currentTime)),DateUtil.formatDateTime(new Date(xlwCarInfo.getInTunnelTime())));
diffMinTime = 0;
}
vehicleInfo.setRetainedMinutesTime((int) diffMinTime); vehicleInfo.setRetainedMinutesTime((int) diffMinTime);
} }
//进入隧道时间转换 //进入隧道时间转换
......
...@@ -4,15 +4,21 @@ import cn.hutool.core.collection.CollUtil; ...@@ -4,15 +4,21 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.extra.spring.SpringUtil; import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.event.EventDetailPageReqVO;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.event.EventDetailRespVO; import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.event.EventDetailRespVO;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.ws.AbstractRealTimeEventWs; import com.cico.nest.lcdp.boot.core.qxsd.adapter.ws.AbstractRealTimeEventWs;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.ws.IRealTimeWs; import com.cico.nest.lcdp.boot.core.qxsd.adapter.ws.IRealTimeWs;
import com.cico.nest.lcdp.boot.core.qxsd.application.service.EventDetailService;
import com.cico.nest.lcdp.boot.core.qxsd.domain.gateway.EventGateway; import com.cico.nest.lcdp.boot.core.qxsd.domain.gateway.EventGateway;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.EventDetailMapper; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.EventDetailMapper;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.EventDetailDO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.EventDetailDO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.EventMapper; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.EventMapper;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw.vo.RealTimeEventWsVO;
import com.cico.nest.lcdp.framework.common.pojo.PageResult;
import com.cico.nest.lcdp.framework.common.util.date.DateUtils; import com.cico.nest.lcdp.framework.common.util.date.DateUtils;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -26,34 +32,34 @@ import java.util.concurrent.ConcurrentHashMap; ...@@ -26,34 +32,34 @@ import java.util.concurrent.ConcurrentHashMap;
* @author zws * @author zws
* @date 2024/8/15 * @date 2024/8/15
*/ */
@Slf4j
@Service @Service
public class EventGatewayImpl implements EventGateway { public class EventGatewayImpl implements EventGateway {
@Resource @Resource
private EventMapper eventMapper; private EventMapper eventMapper;
@Resource @Resource
private EventDetailMapper eventDetailMapper; private EventDetailMapper eventDetailMapper;
@Resource
private EventDetailService eventDetailService;
public final Map<String, IRealTimeWs> realTimeWsMap = new ConcurrentHashMap<>(); public final Map<String, IRealTimeWs> realTimeWsMap = new ConcurrentHashMap<>();
@Override @Override
public void pushRealTimeEventData(String tunnelId) { public void pushRealTimeEventData(String tunnelId,String eventDetailId) {
List<EventDetailDO> eventDetailDOList = eventDetailMapper.selectByTunnelIdAndThirdEventStatusNotFinish(tunnelId); //组装数据并推送
List<EventDetailRespVO> eventDetailRespList = eventDetailDOList.stream().map(eventDetailDO -> { RealTimeEventWsVO realTimeEventWsVO = new RealTimeEventWsVO()
EventDetailRespVO eventDetailRespVO = new EventDetailRespVO(); // 事件未完成集合
BeanUtils.copyProperties(eventDetailDO,eventDetailRespVO); .setEventThirdEventStatusNotFinishList(this.selectByTunnelIdAndThirdEventStatusNotFinish(tunnelId))
if(Objects.nonNull(eventDetailDO.getCarInfoList())){ .setEventCount(this.getEventCount(tunnelId))
eventDetailRespVO.setCarInfoList(JSONArray.parseArray(eventDetailDO.getCarInfoList().toJSONString(), EventDetailDO.EventCarInfo.class)); .setEventDetailRespVO(this.getEventDetailById(tunnelId,eventDetailId))
} ;
long diffSecond = DateUtils.diff(new Date(),eventDetailDO.getEventStartTime())/1000; String eventDetailJson = JSONObject.toJSONString(realTimeEventWsVO);
int excessSecond = (int)diffSecond % 60; // String eventDetailJson = JSONObject.toJSONString(eventDetailRespList);
int minute = (int)diffSecond / 60;
eventDetailRespVO.setRetainedTime(minute+"分"+excessSecond+"秒");
return eventDetailRespVO;
}).toList();
String eventDetailJson = JSONObject.toJSONString(eventDetailRespList);
IRealTimeWs realTimeWs = getRealTimeWs(tunnelId); IRealTimeWs realTimeWs = getRealTimeWs(tunnelId);
log.info("------------------推送开始-----------------");
log.info("推送事件给前端:{}",eventDetailJson);
log.info("------------------推送结束-----------------");
realTimeWs.sendMessage(eventDetailJson); realTimeWs.sendMessage(eventDetailJson);
} }
...@@ -69,10 +75,74 @@ public class EventGatewayImpl implements EventGateway { ...@@ -69,10 +75,74 @@ public class EventGatewayImpl implements EventGateway {
if(CollUtil.isNotEmpty(beansOfType)){ if(CollUtil.isNotEmpty(beansOfType)){
for(Map.Entry<String, AbstractRealTimeEventWs> entry : beansOfType.entrySet()){ for(Map.Entry<String, AbstractRealTimeEventWs> entry : beansOfType.entrySet()){
AbstractRealTimeEventWs abstractRealTimeEventWs = entry.getValue(); AbstractRealTimeEventWs abstractRealTimeEventWs = entry.getValue();
if(StringUtils.isEmpty(abstractRealTimeEventWs.tunnelId())){
log.error("隧道ID为空,无法推送事件数据,class:{}",abstractRealTimeEventWs.getClass().getName());
}else{
realTimeWsMap.put(abstractRealTimeEventWs.tunnelId(),abstractRealTimeEventWs); realTimeWsMap.put(abstractRealTimeEventWs.tunnelId(),abstractRealTimeEventWs);
} }
} }
} }
}
return realTimeWsMap.get(tunnelId); return realTimeWsMap.get(tunnelId);
} }
/**
* 根据隧道ID查询事件信息
* 第三方事件状态事件状态 0结束、1预警、2处理中 = != 0 的信息
* @param tunnelId
* @return
*/
public List<EventDetailRespVO> selectByTunnelIdAndThirdEventStatusNotFinish(String tunnelId){
List<EventDetailDO> eventDetailDOList = eventDetailMapper.selectByTunnelIdAndThirdEventStatusNotFinish(tunnelId);
return eventDetailDOList.stream().map(eventDetailDO -> {
EventDetailRespVO eventDetailRespVO = new EventDetailRespVO();
BeanUtils.copyProperties(eventDetailDO,eventDetailRespVO);
if(Objects.nonNull(eventDetailDO.getCarInfoList())){
eventDetailRespVO.setCarInfoList(JSONArray.parseArray(eventDetailDO.getCarInfoList().toJSONString(), EventDetailDO.EventCarInfo.class));
}
long diffSecond = DateUtils.diff(new Date(),eventDetailDO.getEventStartTime())/1000;
int excessSecond = (int)diffSecond % 60;
int minute = (int)diffSecond / 60;
eventDetailRespVO.setRetainedTime(minute+"分"+excessSecond+"秒");
return eventDetailRespVO;
}).toList();
}
/**
* 查询当前事件总数
* @param tunnelId
* @return
*/
public Long getEventCount(String tunnelId){
// 查询当前事件列表 未处理完成的总数,这里之间调用列表分页接口
EventDetailPageReqVO pageReqVO = new EventDetailPageReqVO();
pageReqVO.setPageNo(1);
pageReqVO.setPageSize(1);
pageReqVO.setTunnelId(tunnelId);
pageReqVO.setEventStatusSearch(0);
PageResult pageResult = eventDetailMapper.selectPage(pageReqVO);
if(Objects.nonNull(pageResult)){
return pageResult.getTotal();
}
return 0L;
}
/**
* 查询当前事件
* @param tunnelId
* @return
*/
public EventDetailRespVO getEventDetailById(String tunnelId,String eventDetailId){
// 查询当前事件列表 未处理完成的总数,这里之间调用列表分页接口
EventDetailDO eventDetailDO = eventDetailMapper.selectOne(
EventDetailDO::getId,eventDetailId,
EventDetailDO::getTunnelId,tunnelId
);
if(Objects.nonNull(eventDetailDO)){
return EventDetailDO.convert2VO(eventDetailDO,"");
}
log.error("事件详情查询失败,eventDetailId:{}",eventDetailId);
return new EventDetailRespVO();
}
} }
...@@ -2,24 +2,34 @@ package com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl; ...@@ -2,24 +2,34 @@ package com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.request.LocusDataRequest;
import com.cico.nest.lcdp.boot.core.qxsd.application.service.TunnelDetailService;
import com.cico.nest.lcdp.boot.core.qxsd.application.service.TunnelDeviceService;
import com.cico.nest.lcdp.boot.core.qxsd.domain.gateway.HistoryGateway; import com.cico.nest.lcdp.boot.core.qxsd.domain.gateway.HistoryGateway;
import com.cico.nest.lcdp.boot.core.qxsd.domain.gateway.VehicleGateway;
import com.cico.nest.lcdp.boot.core.qxsd.domain.vehicle.HistoryTunnelVehicle; import com.cico.nest.lcdp.boot.core.qxsd.domain.vehicle.HistoryTunnelVehicle;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.common.result.HkVideoResultData; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.common.result.HkVideoResultData;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.common.result.XlwResultData; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.common.result.XlwResultData;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.convertor.VehicleConvertor; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.convertor.VehicleConvertor;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.TunnelDeviceMapper;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.TunnelEquipmentMapper; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.TunnelEquipmentMapper;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.TunnelDeviceDO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.TunnelEquipmentDO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.TunnelEquipmentDO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.HistoryMapper; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.HistoryMapper;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.hk.HkVideoMapper; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.hk.HkVideoMapper;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto.XlwHolographicTimeHistoryDTO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto.XlwHolographicTimeHistoryDTO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw.dto.XlwRealTimeVehicleDTO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw.dto.XlwRealTimeVehicleDTO;
import com.cico.nest.lcdp.boot.core.system.dal.dataobject.social.SocialUserDO;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.bytedeco.ffmpeg.global.avcodec; import org.bytedeco.ffmpeg.global.avcodec;
import org.bytedeco.javacv.*; import org.bytedeco.javacv.*;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
...@@ -29,12 +39,15 @@ import java.util.Objects; ...@@ -29,12 +39,15 @@ import java.util.Objects;
* @date 2024/8/20 * @date 2024/8/20
*/ */
@Slf4j
@Service @Service
public class HistoryGatewayImpl implements HistoryGateway { public class HistoryGatewayImpl implements HistoryGateway {
@Resource @Resource
private HistoryMapper historyMapper; private HistoryMapper historyMapper;
@Resource @Resource
private TunnelEquipmentMapper equipmentMapper; private VehicleGateway vehicleGateway;
@Resource
private TunnelDeviceMapper tunnelDeviceMapper;
@Resource @Resource
private HkVideoMapper hkVideoMapper; private HkVideoMapper hkVideoMapper;
@Value("${qxsd.video.eventHisSavePath}") @Value("${qxsd.video.eventHisSavePath}")
...@@ -50,34 +63,59 @@ public class HistoryGatewayImpl implements HistoryGateway { ...@@ -50,34 +63,59 @@ public class HistoryGatewayImpl implements HistoryGateway {
return historyMapper.saveBayonetImage(carPlate,eventStartTime); return historyMapper.saveBayonetImage(carPlate,eventStartTime);
} }
@Override @Override
public String saveVideo(String facilityId,Integer deviceMilestone,Integer direction,String beginTime,String endTime,String outputFile) { public TunnelDeviceDO getDevice(String tunnelCode,String holeId,Integer deviceMilestone,Integer direction) {
TunnelEquipmentDO tunnelEquipmentDO = new TunnelEquipmentDO(); TunnelDeviceDO tunnelDeviceDO = tunnelDeviceMapper.selectOne(new LambdaQueryWrapper<TunnelDeviceDO>()
tunnelEquipmentDO.setBelongFacilityId(facilityId); .eq(TunnelDeviceDO::getTunnelCode, tunnelCode)
tunnelEquipmentDO.setEquipmentStation(deviceMilestone); .eq(TunnelDeviceDO::getHoleId, holeId)
tunnelEquipmentDO.setUplinkDownlinkRoad(direction); .eq(TunnelDeviceDO::getDirectionUpdown, direction)
List<TunnelEquipmentDO> equipmentList = equipmentMapper.getEquipmentList(tunnelEquipmentDO); .eq(TunnelDeviceDO::getCameraLable, 1)
if(CollUtil.isEmpty(equipmentList)){ .gt(TunnelDeviceDO::getMileStart, deviceMilestone)
return "error未找到对应摄像头"; ,false);
// 摄像头 查询几个点
// 同一个tunnel_code,hole_id,上下行方向:100700上行/100701下行
// camera_lable(摄像机标签) = 1(全息相机)
// deviceMilestone:215838,direction:100700
// 条件是lt 查询到的: 215700 < 215838
// 条件是gt 查询到的: 216100 > 215838
// 小于号是这样表示的:&lt ;大于号是这样表示的:&gt ;
// todo 是否需要判断超出最大桩号?
return tunnelDeviceDO;
} }
TunnelEquipmentDO equipmentDO = equipmentList.get(0);
String hkVideoResultDataStr = hkVideoMapper.getPlaybackURLs(equipmentDO.getCameraIndexCode(),beginTime,endTime); @Override
public String saveVideo(String cameraIndexCode,String beginTime,String endTime,String outputFile) {
String hkVideoResultDataStr = hkVideoMapper.getPlaybackURLs(cameraIndexCode,beginTime,endTime);
HkVideoResultData hkVideoResultData = JSONObject.parseObject(hkVideoResultDataStr, HkVideoResultData.class); HkVideoResultData hkVideoResultData = JSONObject.parseObject(hkVideoResultDataStr, HkVideoResultData.class);
Object urlObject = hkVideoResultData.getData().get("url"); Object urlObject = hkVideoResultData.getData().get("url");
if(Objects.nonNull(urlObject)){ if(Objects.nonNull(urlObject)){
try {
videoPuller(urlObject.toString(),eventHisSaveVideoPath + "/" + outputFile); videoPuller(urlObject.toString(),eventHisSaveVideoPath + "/" + outputFile);
return outputFile; return outputFile;
} catch (Exception e) {
return "error保存回放视频流失败";
}
} }
return "error获取回放视频流失败"; return "error获取回放视频流失败";
} }
@Override @Override
public List<HistoryTunnelVehicle> getVehicleInfo(String eventId,String tunnelId,String direction,int startMilestone) { public List<HistoryTunnelVehicle> getVehicleInfo(LocusDataRequest locusDataRequest) {
List<XlwHolographicTimeHistoryDTO> xlwHistoryEventList = historyMapper.getVehicleInfo(eventId); // List<XlwHolographicTimeHistoryDTO> xlwHistoryEventList = historyMapper.getVehicleInfo(guid);
return VehicleConvertor.convert2HistoryTunnelVehicle(xlwHistoryEventList,tunnelId,direction,startMilestone); // if(CollUtil.isEmpty(xlwHistoryEventList)){
// log.error("获取事件全息回放数据为空,guid:{}", guid);
// return new ArrayList<>();
// }
// return VehicleConvertor.convert2HistoryTunnelVehicle(xlwHistoryEventList,tunnelId,direction,startMilestone);
// 2025-06 说让调用 4.5 todo
return vehicleGateway.getCarLocusData(locusDataRequest);
} }
public static void videoPuller(String rtspUrl, String outputFile) { @Override
public void videoPuller(String rtspUrl, String outputFile) {
log.info("保存视频-保存切片视频:{},outputFile:{}",rtspUrl,outputFile);
// 创建抓取器 // 创建抓取器
FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(rtspUrl); FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(rtspUrl);
try { try {
......
...@@ -24,10 +24,14 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dat ...@@ -24,10 +24,14 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dat
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.*;
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.qxsd.infrastructure.gatewayimpl.ws.xlw.RealTimeVehicleWsClient; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw.RealTimeVehicleWsClient;
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 com.cico.nest.lcdp.framework.common.util.json.JsonUtils;
import com.google.common.collect.HashBasedTable; import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table; import com.google.common.collect.Table;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
...@@ -38,11 +42,15 @@ import java.util.concurrent.ConcurrentHashMap; ...@@ -38,11 +42,15 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.cico.nest.lcdp.boot.api.infra.enums.ErrorCodeConstants.CODEGEN_TABLE_EXISTS;
import static com.cico.nest.lcdp.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
import static com.cico.nest.lcdp.framework.common.exception.util.ServiceExceptionUtil.exception;
/** /**
* @author zws * @author zws
* @date 2024/8/5 * @date 2024/8/5
*/ */
@Slf4j
@Service @Service
public class VehicleGatewayImpl implements VehicleGateway { public class VehicleGatewayImpl implements VehicleGateway {
@Resource @Resource
...@@ -79,12 +87,12 @@ public class VehicleGatewayImpl implements VehicleGateway { ...@@ -79,12 +87,12 @@ public class VehicleGatewayImpl implements VehicleGateway {
} }
} }
} }
//取差集(删除标记缓存) // //取差集(删除标记缓存)
List<String> delRedisMarkKey = CollUtil.subtractToList(redisMrkVehicleCarIds,realTimeVehicleCarIds); // List<String> delRedisMarkKey = CollUtil.subtractToList(redisMrkVehicleCarIds,realTimeVehicleCarIds);
delRedisMarkKey = delRedisMarkKey.stream() // delRedisMarkKey = delRedisMarkKey.stream()
.map(RedisConstants.REDIS_FOCUS_VEHICLE_MARK_KEY::concat) // .map(RedisConstants.REDIS_FOCUS_VEHICLE_MARK_KEY::concat)
.collect(Collectors.toList()); // .collect(Collectors.toList());
stringRedisTemplate.delete(delRedisMarkKey); // stringRedisTemplate.delete(delRedisMarkKey);
String realTimeVehicleJson = JSON.toJSONString(realTimeVehicle,SerializerFeature.WriteMapNullValue); String realTimeVehicleJson = JSON.toJSONString(realTimeVehicle,SerializerFeature.WriteMapNullValue);
stringRedisTemplate.opsForValue().set(RedisConstants.REDIS_REAL_TIME_VEHICLE_KEY.concat(tunnelId),realTimeVehicleJson,10, TimeUnit.SECONDS); stringRedisTemplate.opsForValue().set(RedisConstants.REDIS_REAL_TIME_VEHICLE_KEY.concat(tunnelId),realTimeVehicleJson,10, TimeUnit.SECONDS);
...@@ -168,9 +176,15 @@ public class VehicleGatewayImpl implements VehicleGateway { ...@@ -168,9 +176,15 @@ public class VehicleGatewayImpl implements VehicleGateway {
@Override @Override
public List<HistoryTunnelVehicle> getCarLocusData(LocusDataRequest request) { public List<HistoryTunnelVehicle> getCarLocusData(LocusDataRequest request) {
XlwLocusDataSearchDTO searchDTO = new XlwLocusDataSearchDTO(); XlwLocusDataSearchDTO searchDTO = new XlwLocusDataSearchDTO();
searchDTO.setTunnelId(request.getTunnelId());
searchDTO.setStartTime(request.getStartTime()); searchDTO.setStartTime(request.getStartTime());
searchDTO.setEndTime(request.getEndTime()); searchDTO.setEndTime(request.getEndTime());
XlwResultData<List<XlwHolographicTimeHistoryDTO>> resultData = xlwClientFeign.getCarLocusData(searchDTO); XlwResultData<List<XlwHolographicTimeHistoryDTO>> resultData = xlwClientFeign.getCarLocusData(searchDTO);
if(CollectionUtils.isEmpty(resultData.getData())){
log.error("调用4.5接口获取车辆轨迹数据为空,参数:{}", JsonUtils.toJsonString(searchDTO));
log.error("调用4.5接口获取车辆轨迹数据为空,返回值:{}", resultData.getMessage());
return new ArrayList<>();
}
List<XlwHolographicTimeHistoryDTO> dtos = resultData.getData(); List<XlwHolographicTimeHistoryDTO> dtos = resultData.getData();
TunnelDetailDO tunnelDetailDO = tunnelDetailMapper.selectById(request.getTunnelId()); TunnelDetailDO tunnelDetailDO = tunnelDetailMapper.selectById(request.getTunnelId());
dtos = dtos.stream().filter(s->tunnelDetailDO.getXlwTunnelId().equals(s.getTunnelId())).toList(); dtos = dtos.stream().filter(s->tunnelDetailDO.getXlwTunnelId().equals(s.getTunnelId())).toList();
......
...@@ -10,6 +10,7 @@ import com.cico.nest.lcdp.framework.common.pojo.PageResult; ...@@ -10,6 +10,7 @@ import com.cico.nest.lcdp.framework.common.pojo.PageResult;
import com.cico.nest.lcdp.framework.mybatis.core.mapper.BaseMapperX; import com.cico.nest.lcdp.framework.mybatis.core.mapper.BaseMapperX;
import com.cico.nest.lcdp.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cico.nest.lcdp.framework.mybatis.core.query.LambdaQueryWrapperX;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**
...@@ -23,14 +24,24 @@ public interface EventDetailMapper extends BaseMapperX<EventDetailDO> { ...@@ -23,14 +24,24 @@ public interface EventDetailMapper extends BaseMapperX<EventDetailDO> {
default PageResult<EventDetailDO> selectPage(EventDetailPageReqVO reqVO) { default PageResult<EventDetailDO> selectPage(EventDetailPageReqVO reqVO) {
Integer retainedTime = reqVO.getRetainedTime(); Integer retainedTime = reqVO.getRetainedTime();
LambdaQueryWrapperX<EventDetailDO> wrapper = new LambdaQueryWrapperX<EventDetailDO>() LambdaQueryWrapperX<EventDetailDO> wrapper = new LambdaQueryWrapperX<EventDetailDO>()
.eqIfPresent(EventDetailDO::getId, reqVO.getId())
.geIfPresent(EventDetailDO::getEventStartTime,reqVO.getEventStartTimeSearchStart()) .geIfPresent(EventDetailDO::getEventStartTime,reqVO.getEventStartTimeSearchStart())
.leIfPresent(EventDetailDO::getEventStartTime,reqVO.getEventStartTimeSearchEnd()) .leIfPresent(EventDetailDO::getEventStartTime,reqVO.getEventStartTimeSearchEnd())
.eqIfPresent(EventDetailDO::getTunnelId, reqVO.getTunnelId()) .eqIfPresent(EventDetailDO::getTunnelId, reqVO.getTunnelId())
.eqIfPresent(EventDetailDO::getBaseTunnelId, reqVO.getBaseTunnelId())
.eqIfPresent(EventDetailDO::getHoleId, reqVO.getHoleId())
.inIfPresent(EventDetailDO::getDirection, reqVO.getDirection()) .inIfPresent(EventDetailDO::getDirection, reqVO.getDirection())
// .inIfPresent(EventDetailDO::getEventType, reqVO.getEventType()) // .inIfPresent(EventDetailDO::getEventType, reqVO.getEventType())
.likeIfPresent(EventDetailDO::getEventCarPlate, reqVO.getEventCarPlate()) .likeIfPresent(EventDetailDO::getEventCarPlate, reqVO.getEventCarPlate())
.eqIfPresent(EventDetailDO::getEventStatus,reqVO.getEventStatus()); .eqIfPresent(EventDetailDO::getEventStatus,reqVO.getEventStatus());
wrapper.ne(EventDetailDO::getIsRepeat,1);//只筛选不重复的事件 wrapper.ne(EventDetailDO::getIsRepeat,1);//只筛选不重复的事件
// keyword2 桩号 + 隧道方向
// 桩号 模糊查询 如 k215/k215+838 可以搜的到 215838 数据 参数不为空,去掉k去掉+ 左匹配
Optional.ofNullable(reqVO.getKeyword2()).ifPresent(
keyword2 -> wrapper.and(q -> q.likeRight(EventDetailDO::getMilestone,keyword2.replace("k","").replace("K","").replace("zk","").replace("ZK","").replace("+",""))
.or().like(EventDetailDO::getDirectionName, keyword2)
));
if (CollectionUtils.isNotEmpty(reqVO.getEventType()) && reqVO.getEventType().size()>0){ if (CollectionUtils.isNotEmpty(reqVO.getEventType()) && reqVO.getEventType().size()>0){
wrapper.inIfPresent(EventDetailDO::getEventType, reqVO.getEventType()); wrapper.inIfPresent(EventDetailDO::getEventType, reqVO.getEventType());
} }
......
...@@ -44,9 +44,21 @@ public class EventDetailDO { ...@@ -44,9 +44,21 @@ public class EventDetailDO {
*/ */
private String thirdPartyId; private String thirdPartyId;
/** /**
* 隧道id-(目前保存的是信路威洞的id) * 隧道id-(目前保存的是隧道信息的id)
*/ */
private String tunnelId; private String tunnelId;
/**
* 所属隧道id
*/
private String baseTunnelId;
/**
* 所属隧道code
*/
private String baseTunnelCode;
/**
* 所属洞id
*/
private String holeId;
/** /**
* 方向 上行/下行 * 方向 上行/下行
*/ */
...@@ -157,6 +169,20 @@ public class EventDetailDO { ...@@ -157,6 +169,20 @@ public class EventDetailDO {
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private java.util.Date reportTime; private java.util.Date reportTime;
/**
* 处置方式(1:上报事件;2:消除事件;)
*/
private Integer processingType;
/**
* 处置操作人姓名
*/
private String processingOperationsName;
/**
* 处置时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date processingTime;
/** /**
* 创建时间 * 创建时间
*/ */
...@@ -212,6 +238,25 @@ public class EventDetailDO { ...@@ -212,6 +238,25 @@ public class EventDetailDO {
* 车牌图片 * 车牌图片
*/ */
private String plateImageUrl; private String plateImageUrl;
/**
* 危是否化品车辆,枚举:0否、1是
*/
private Boolean isDangerous = false;
//是否重点标记
private Boolean isFocusMark = false;
//留存时间(分钟)
private Integer retainedMinutesTime = 0;
//是否驶出隧道
private Boolean isDriveTunnel = false;
/**
* 进隧道时间
*/
private String inTunnelTimeStr;
} }
...@@ -254,11 +299,11 @@ public class EventDetailDO { ...@@ -254,11 +299,11 @@ public class EventDetailDO {
singMultiCar="单车"; singMultiCar="单车";
} }
} }
String eventSituation = DateUtil.format(eventDetail.getEventStartTime(),"yyyy-MM-dd HH:mm"); String eventSituation = "";
TunnelDetailService tunnelDetailService = SpringUtil.getBean(TunnelDetailService.class); TunnelDetailService tunnelDetailService = SpringUtil.getBean(TunnelDetailService.class);
TunnelDetailDO tunnelDetailDO = tunnelDetailService.getTunnelDetail(eventDetail.getTunnelId()); TunnelDetailDO tunnelDetailDO = tunnelDetailService.getTunnelDetail(eventDetail.getTunnelId());
if(Objects.nonNull(tunnelDetailDO)){ if(Objects.nonNull(tunnelDetailDO)){
eventSituation = eventSituation.concat(" ").concat(tunnelDetailDO.getTunnelName()) eventSituation = eventSituation.concat(tunnelDetailDO.getTunnelName())
.concat(tunnelDetailDO.getDirectionName()); .concat(tunnelDetailDO.getDirectionName());
} }
EventType eventType = EventType.findByType(eventDetail.getEventType()); EventType eventType = EventType.findByType(eventDetail.getEventType());
...@@ -295,8 +340,12 @@ public class EventDetailDO { ...@@ -295,8 +340,12 @@ public class EventDetailDO {
if(CollUtil.isNotEmpty(eventImagesPath)){ if(CollUtil.isNotEmpty(eventImagesPath)){
eventDetailRespVO.setEventImagesPath(eventImagesPath.stream().filter(e->e.startsWith("/")).map(xlwImagePath::concat).toList()); eventDetailRespVO.setEventImagesPath(eventImagesPath.stream().filter(e->e.startsWith("/")).map(xlwImagePath::concat).toList());
} }
//事件开始时间格式化
if(Objects.nonNull(eventDetail.getEventStartTime())){
eventDetailRespVO.setEventStartTimeFormat(eventDetail.getEventStartTime());
}
eventDetailRespVO.setEventSituation(eventSituation); eventDetailRespVO.setEventSituation(eventSituation);
eventDetailRespVO.setMilestoneStr(milestone);
eventDetailRespVO.setDirectionalPosition(directionalPosition); eventDetailRespVO.setDirectionalPosition(directionalPosition);
eventDetailRespVO.setSituationSpot(situationSpot); eventDetailRespVO.setSituationSpot(situationSpot);
return eventDetailRespVO; return eventDetailRespVO;
......
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.cico.nest.lcdp.boot.core.qxsd.domain.vehicle.HistoryTunnelVehicle; import com.cico.nest.lcdp.boot.core.qxsd.domain.vehicle.HistoryTunnelVehicle;
import com.cico.nest.lcdp.framework.mybatis.core.type.StringListTypeHandler; import com.cico.nest.lcdp.framework.mybatis.core.type.StringListTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import org.checkerframework.checker.units.qual.A; import org.checkerframework.checker.units.qual.A;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
...@@ -39,6 +40,11 @@ public class EventHisDO { ...@@ -39,6 +40,11 @@ public class EventHisDO {
*/ */
private String eventId; private String eventId;
/**
* 车辆入隧时间
*/
@TableField(typeHandler = JacksonTypeHandler.class)
private JSONArray vehicleInTunnelTime;
/** /**
* 历史车辆轨迹 * 历史车辆轨迹
*/ */
...@@ -57,6 +63,10 @@ public class EventHisDO { ...@@ -57,6 +63,10 @@ public class EventHisDO {
@TableField(typeHandler = JacksonTypeHandler.class) @TableField(typeHandler = JacksonTypeHandler.class)
private JSONArray bayonetImage; private JSONArray bayonetImage;
/**
* 海康摄像头唯一编码
*/
private String cameraIndexCode;
/** /**
* 视频路径 * 视频路径
*/ */
......
...@@ -19,4 +19,6 @@ public interface EventMapper { ...@@ -19,4 +19,6 @@ public interface EventMapper {
*/ */
List<EventDetailDO> syncEventDetailList(Date startDateTime, Date endDateTime); List<EventDetailDO> syncEventDetailList(Date startDateTime, Date endDateTime);
List<EventDetailDO> syncEventDetailListV2(String startDateTime, String endDateTime);
} }
...@@ -55,7 +55,9 @@ public class XlwAuthMapper implements AuthMapper { ...@@ -55,7 +55,9 @@ public class XlwAuthMapper implements AuthMapper {
XlwResultData<Map<String, Object>> loginResult = xlwClientFeign.login(xlwLoginDTO); XlwResultData<Map<String, Object>> loginResult = xlwClientFeign.login(xlwLoginDTO);
Map<String, Object> resultData = loginResult.getData(); Map<String, Object> resultData = loginResult.getData();
token = (String) resultData.get("sessionId"); token = (String) resultData.get("sessionId");
stringRedisTemplate.opsForValue().set(XlwConstants.REDIS_TOKEN_KEY, token, 6, TimeUnit.HOURS); // token 这里的有效期要小于新路威token 的有效期,不让就会 redis 中还存在,其实登陆失败了
// stringRedisTemplate.opsForValue().set(XlwConstants.REDIS_TOKEN_KEY, token, 6, TimeUnit.HOURS);
stringRedisTemplate.opsForValue().set(XlwConstants.REDIS_TOKEN_KEY, token, 5, TimeUnit.MINUTES);
} }
return token; return token;
} }
......
...@@ -2,6 +2,7 @@ package com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw; ...@@ -2,6 +2,7 @@ package com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.common.result.XlwResultData; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.common.result.XlwResultData;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.EventDetailMapper; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.EventDetailMapper;
...@@ -10,6 +11,7 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.EventMa ...@@ -10,6 +11,7 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.EventMa
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.*;
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 jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.*; import java.util.*;
...@@ -19,6 +21,7 @@ import java.util.stream.Collectors; ...@@ -19,6 +21,7 @@ import java.util.stream.Collectors;
* @author zws * @author zws
* @date 2024/8/21 * @date 2024/8/21
*/ */
@Slf4j
@Component @Component
public class XlwEventMapper implements EventMapper { public class XlwEventMapper implements EventMapper {
...@@ -34,6 +37,7 @@ public class XlwEventMapper implements EventMapper { ...@@ -34,6 +37,7 @@ public class XlwEventMapper implements EventMapper {
XlwResultData<XlwPageDTO<XlwEventListDTO>> resultData = xlwClientFeign.allEventList(xlwEventListSearchDTO); XlwResultData<XlwPageDTO<XlwEventListDTO>> resultData = xlwClientFeign.allEventList(xlwEventListSearchDTO);
XlwPageDTO<XlwEventListDTO> xlwPageDTO = resultData.getData(); XlwPageDTO<XlwEventListDTO> xlwPageDTO = resultData.getData();
long total = xlwPageDTO.getTotal(); long total = xlwPageDTO.getTotal();
log.info("syncEventDetailList,total:{}",total);
List<XlwEventListDTO> xlwEventListDTOList = new ArrayList<>(); List<XlwEventListDTO> xlwEventListDTOList = new ArrayList<>();
if(total > 1000){ if(total > 1000){
int pageSize = 1000; int pageSize = 1000;
...@@ -91,4 +95,74 @@ public class XlwEventMapper implements EventMapper { ...@@ -91,4 +95,74 @@ public class XlwEventMapper implements EventMapper {
} }
return detailDOList; return detailDOList;
} }
@Override
public List<EventDetailDO> syncEventDetailListV2(String startDateTime, String endDateTime) {
XlwEventListSearchDTO xlwEventListSearchDTO = new XlwEventListSearchDTO();
xlwEventListSearchDTO.setPage(1);
xlwEventListSearchDTO.setPageSize(10);
xlwEventListSearchDTO.setStartTime(startDateTime);
xlwEventListSearchDTO.setEndTime(endDateTime);
XlwResultData<XlwPageDTO<XlwEventListDTO>> resultData = xlwClientFeign.allEventList(xlwEventListSearchDTO);
XlwPageDTO<XlwEventListDTO> xlwPageDTO = resultData.getData();
long total = xlwPageDTO.getTotal();
log.info("syncEventDetailListV2,条件查询,startDateTime:{},endDateTime:{}获取total:{}",startDateTime,endDateTime,total);
List<XlwEventListDTO> xlwEventListDTOList = new ArrayList<>();
if(total > 1000){
int pageSize = 1000;
int maxPageNo = ((int)total/pageSize) + 1;
for(int i = 1; i <= maxPageNo; i++){
xlwEventListSearchDTO.setPage(i);
xlwEventListSearchDTO.setPageSize(pageSize);
resultData = xlwClientFeign.allEventList(xlwEventListSearchDTO);
xlwPageDTO = resultData.getData();
xlwEventListDTOList.addAll(xlwPageDTO.getRows());
}
}else{
xlwEventListSearchDTO.setPageSize(Integer.valueOf(total+""));
resultData = xlwClientFeign.allEventList(xlwEventListSearchDTO);
xlwPageDTO = resultData.getData();
xlwEventListDTOList = xlwPageDTO.getRows();
}
LambdaQueryWrapper<EventDetailDO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(EventDetailDO::getThirdPartyId);
queryWrapper.ge(EventDetailDO::getEventStartTime,startDateTime);
queryWrapper.le(EventDetailDO::getEventStartTime,endDateTime);
List<EventDetailDO> eventDetailDOList = eventDetailMapper.selectList(queryWrapper);
List<String> thirdPartyIdList = eventDetailDOList.stream().map(EventDetailDO::getThirdPartyId).toList();
List<String> eventIdList = xlwEventListDTOList.stream().map(XlwEventListDTO::getGuid).toList();
//取差集需要同步的event
List<String> syncEventIdList = CollUtil.subtractToList(eventIdList,thirdPartyIdList);
if(CollUtil.isEmpty(eventIdList)){
return List.of();
}
log.info("syncEventDetailListV2,syncEventIdList.size():{}",syncEventIdList.size());
xlwEventListDTOList = xlwEventListDTOList.stream().filter(event-> syncEventIdList.contains(event.getGuid())).toList();
List<EventDetailDO> detailDOList = XlwEventListDTO.convert2DO(xlwEventListDTOList);
Map<String,List<XlwEventImageDTO>> eventIdImageListMap = new HashMap<>();
for(XlwEventListDTO xlwEventListDTO : xlwEventListDTOList){
XlwEventIdDTO xlwEventIdDTO = new XlwEventIdDTO(xlwEventListDTO.getGuid());
XlwResultData<List<XlwEventImageDTO>> imageResultData = xlwClientFeign.getEventImageById(xlwEventIdDTO);
List<XlwEventImageDTO> imageList = imageResultData.getData();
eventIdImageListMap.put(xlwEventListDTO.getGuid(),imageList);
}
for(EventDetailDO eventDetailDO : detailDOList){
List<XlwEventImageDTO> imageList = eventIdImageListMap.get(eventDetailDO.getThirdPartyId());
List<String> imagePathList = new ArrayList<>();
if(Objects.nonNull(imageList)){
imageList.forEach(eventImage->{
if(StrUtil.isNotBlank(eventImage.getHeadImage())){
imagePathList.add(eventImage.getHeadImage());
}
if(StrUtil.isNotBlank(eventImage.getTailImage())){
imagePathList.add(eventImage.getTailImage());
}
});
}
eventDetailDO.setEventImagesPath(imagePathList);
}
// eventDetailMapper.insertBatch(detailDOList);
return detailDOList;
}
} }
...@@ -10,6 +10,7 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.History ...@@ -10,6 +10,7 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.History
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.*;
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.qxsd.infrastructure.gatewayimpl.ws.xlw.dto.XlwRealTimeVehicleDTO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw.dto.XlwRealTimeVehicleDTO;
import com.cico.nest.lcdp.framework.common.util.json.JsonUtils;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -85,14 +86,17 @@ public class XlwHistoryMapper implements HistoryMapper { ...@@ -85,14 +86,17 @@ public class XlwHistoryMapper implements HistoryMapper {
try { try {
XlwPageDTO<XlwBayonetPictureDTO> pageDTO = xlwClientFeign.getBayonetPicture(searchDTO).getData(); XlwPageDTO<XlwBayonetPictureDTO> pageDTO = xlwClientFeign.getBayonetPicture(searchDTO).getData();
pictureDTOS = pageDTO.getRows(); pictureDTOS = pageDTO.getRows();
log.info("查询信路威抓拍流水卡口图片,参数:{},返回条数:{}" ,searchDTO,pageDTO.getRows().size() );
} catch (Exception e) { } catch (Exception e) {
log.info("查询信路威抓拍流水卡口图片参数:{}" , JsonUtils.toJsonString(searchDTO));
log.info("查询信路威抓拍流水卡口图片异常:{}" ,e.getMessage()); log.info("查询信路威抓拍流水卡口图片异常:{}" ,e.getMessage());
return new ArrayList<>();
} }
List<String> bayonetImageUrls = new ArrayList<>(); List<String> bayonetImageUrls = new ArrayList<>();
if(!pictureDTOS.isEmpty()){ if(!pictureDTOS.isEmpty()){
XlwBayonetPictureDTO bayonetPictureDTO = pictureDTOS.get(0); XlwBayonetPictureDTO bayonetPictureDTO = pictureDTOS.get(0);
String plateImageUrl = bayonetPictureDTO.getPlateImage(); String plateImageUrl = bayonetPictureDTO.getPlateImage();
log.info("车牌卡口图片路径:" + plateImageUrl); log.info("查询信路威抓拍流水卡口图片,车牌【{}】,卡口图片路径:{}" ,carPlate, plateImageUrl);
if(StringUtils.isEmpty(plateImageUrl)){ if(StringUtils.isEmpty(plateImageUrl)){
return bayonetImageUrls; return bayonetImageUrls;
} }
...@@ -110,7 +114,7 @@ public class XlwHistoryMapper implements HistoryMapper { ...@@ -110,7 +114,7 @@ public class XlwHistoryMapper implements HistoryMapper {
bayonetImageUrls.add("/" + dateFolder + "/" + plateUrlPaths[plateUrlPaths.length - 1]); bayonetImageUrls.add("/" + dateFolder + "/" + plateUrlPaths[plateUrlPaths.length - 1]);
} }
String headImageUrl = bayonetPictureDTO.getHeadImage(); String headImageUrl = bayonetPictureDTO.getHeadImage();
log.info("车头图片路径:" + headImageUrl); log.info("查询信路威抓拍流水卡口图片,车牌【{}】,车头图片路径:{}" ,carPlate, headImageUrl);
String [] headUrlPaths = headImageUrl.split("/"); String [] headUrlPaths = headImageUrl.split("/");
String headSaveImageUrl = bayonetSavePath + "/" + dateFolder + "/" + headUrlPaths[headUrlPaths.length - 1]; String headSaveImageUrl = bayonetSavePath + "/" + dateFolder + "/" + headUrlPaths[headUrlPaths.length - 1];
String headSavePath = doSaveImage( xlwImagePath +headImageUrl,headSaveImageUrl); String headSavePath = doSaveImage( xlwImagePath +headImageUrl,headSaveImageUrl);
......
...@@ -11,6 +11,9 @@ import lombok.Data; ...@@ -11,6 +11,9 @@ import lombok.Data;
@Data @Data
public class XlwLocusDataSearchDTO { public class XlwLocusDataSearchDTO {
//隧道ID
private String tunnelId;
//开始时间 //开始时间
private String startTime; private String startTime;
......
...@@ -18,10 +18,12 @@ public interface XlwClientFeign { ...@@ -18,10 +18,12 @@ public interface XlwClientFeign {
/** /**
* 登录接口 * 登录接口
* 1.6 /common/login.htm 老
* 1.3 /backDoor/getDemoSessionId.htm 新
* @param loginDTO 请求参数 * @param loginDTO 请求参数
* @return result * @return result
*/ */
@PostMapping("/common/login.htm") @PostMapping("/backDoor/getDemoSessionId.htm")
XlwResultData<Map<String,Object>> login(@RequestBody XlwLoginDTO loginDTO); XlwResultData<Map<String,Object>> login(@RequestBody XlwLoginDTO loginDTO);
/** /**
......
...@@ -14,7 +14,7 @@ public class XlwClientFeignIntercept implements RequestInterceptor { ...@@ -14,7 +14,7 @@ public class XlwClientFeignIntercept implements RequestInterceptor {
@Override @Override
public void apply(RequestTemplate requestTemplate) { public void apply(RequestTemplate requestTemplate) {
//跳过登录接口 //跳过登录接口
if(!requestTemplate.url().equals(XlwConstants.LOGIN_INTERFACE)){ if(!XlwConstants.LOGIN_INTERFACE_LIST.contains(requestTemplate.url())){
AuthMapper authMapper = SpringUtil.getBean(AuthMapper.class); AuthMapper authMapper = SpringUtil.getBean(AuthMapper.class);
String token = authMapper.getXlwLoginToken(); String token = authMapper.getXlwLoginToken();
//请求头中添加sessionId //请求头中添加sessionId
......
...@@ -61,14 +61,17 @@ public class SdgkTrafficEventHandler implements MqttMessageHandler<SdgkEventMqRe ...@@ -61,14 +61,17 @@ public class SdgkTrafficEventHandler implements MqttMessageHandler<SdgkEventMqRe
//查找本地已有事件 //查找本地已有事件
EventDetailDO detailDO = eventDetailMapper.selectByThirdPartyId(eventDetailDO.getThirdPartyId()); EventDetailDO detailDO = eventDetailMapper.selectByThirdPartyId(eventDetailDO.getThirdPartyId());
if(Objects.isNull(detailDO) ){ if(Objects.isNull(detailDO) ){
// 事是否是重复事件:0不是,1是
eventDetailDO.setReportTime(eventDetailDO.getIsRepeat()!=1?new Date():null); eventDetailDO.setReportTime(eventDetailDO.getIsRepeat()!=1?new Date():null);
if(eventDetailDO.getIsRepeat()!=1){
//发送给前端数据库
eventGateway.pushRealTimeEventData(tunnelId,eventDetailDO.getId());
}
eventDetailMapper.insert(eventDetailDO); eventDetailMapper.insert(eventDetailDO);
}else{ }else{
eventDetailDO.setId(detailDO.getId()); eventDetailDO.setId(detailDO.getId());
eventDetailMapper.updateById(eventDetailDO); eventDetailMapper.updateById(eventDetailDO);
} }
//发送给前端数据库
eventGateway.pushRealTimeEventData(tunnelId);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
log.error("接收隧道管控事件的上报处理异常,{}",e.getMessage()); log.error("接收隧道管控事件的上报处理异常,{}",e.getMessage());
} }
......
...@@ -4,7 +4,9 @@ import cn.hutool.core.util.StrUtil; ...@@ -4,7 +4,9 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.cico.nest.lcdp.boot.core.qxsd.application.service.EventDetailService; import com.cico.nest.lcdp.boot.core.qxsd.application.service.EventDetailService;
import com.cico.nest.lcdp.boot.core.qxsd.application.service.HistoryService; import com.cico.nest.lcdp.boot.core.qxsd.application.service.HistoryService;
import com.cico.nest.lcdp.boot.core.qxsd.application.service.TunnelBaseService;
import com.cico.nest.lcdp.boot.core.qxsd.application.service.TunnelDetailService; import com.cico.nest.lcdp.boot.core.qxsd.application.service.TunnelDetailService;
import com.cico.nest.lcdp.boot.core.qxsd.application.service.TunnelHoleService;
import com.cico.nest.lcdp.boot.core.qxsd.domain.event.EventSource; import com.cico.nest.lcdp.boot.core.qxsd.domain.event.EventSource;
import com.cico.nest.lcdp.boot.core.qxsd.domain.event.EventTypeAllEnum; import com.cico.nest.lcdp.boot.core.qxsd.domain.event.EventTypeAllEnum;
import com.cico.nest.lcdp.boot.core.qxsd.domain.gateway.EventGateway; import com.cico.nest.lcdp.boot.core.qxsd.domain.gateway.EventGateway;
...@@ -12,12 +14,15 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.common.constatnt.XlwCons ...@@ -12,12 +14,15 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.common.constatnt.XlwCons
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.common.result.XlwResultData; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.common.result.XlwResultData;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.EventDetailMapper; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.EventDetailMapper;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.EventDetailDO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.EventDetailDO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.TunnelBaseDO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.TunnelDetailDO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.TunnelDetailDO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.TunnelHoleV2DO;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.XlwAuthMapper; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.XlwAuthMapper;
import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw.dto.XlwRealTimeEventDTO; import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw.dto.XlwRealTimeEventDTO;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.socket.CloseStatus; import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.TextMessage;
...@@ -52,9 +57,14 @@ public class RealTimeEventWsClient { ...@@ -52,9 +57,14 @@ public class RealTimeEventWsClient {
@Resource @Resource
private EventGateway eventGateway; private EventGateway eventGateway;
@Resource
private TunnelBaseService tunnelBaseService;
@Resource @Resource
private TunnelDetailService tunnelDetailService; private TunnelDetailService tunnelDetailService;
@Resource @Resource
private TunnelHoleService tunnelHoleService;
@Resource
private HistoryService historyService; private HistoryService historyService;
private final ExecutorService service = Executors.newFixedThreadPool(5); private final ExecutorService service = Executors.newFixedThreadPool(5);
...@@ -66,15 +76,15 @@ public class RealTimeEventWsClient { ...@@ -66,15 +76,15 @@ public class RealTimeEventWsClient {
public void handleTextMessage(WebSocketSession session, TextMessage message) { public void handleTextMessage(WebSocketSession session, TextMessage message) {
// 处理从服务器接收到的消息 // 处理从服务器接收到的消息
try{ try{
log.info("接收到的事件数据:" + message.getPayload()); log.info("detailTunnelId:{},接收到的事件实时数据:{}" ,tunnelId, message.getPayload());
if(StrUtil.isBlank(message.getPayload())){
return;
}
XlwResultData<JSONObject> xlwResultData = JSONObject.parseObject(message.getPayload(), XlwResultData.class); XlwResultData<JSONObject> xlwResultData = JSONObject.parseObject(message.getPayload(), XlwResultData.class);
XlwRealTimeEventDTO xlwRealTimeEventDTO = JSONObject.parseObject(xlwResultData.getData().toString(),XlwRealTimeEventDTO.class); XlwRealTimeEventDTO xlwRealTimeEventDTO = JSONObject.parseObject(xlwResultData.getData().toString(),XlwRealTimeEventDTO.class);
EventDetailDO eventDetailDO = XlwRealTimeEventDTO.convert2DO(xlwRealTimeEventDTO); EventDetailDO eventDetailDO = XlwRealTimeEventDTO.convert2DO(xlwRealTimeEventDTO);
eventDetailDO.setTunnelId(tunnelId); // 补全隧道信息 如果要考虑性能,可以考虑缓存
eventDetailDO.setCreateTime(new Date()); completionTunnelHole(tunnelId,eventDetailDO);
TunnelDetailDO tunnelDetailDO = tunnelDetailService.getTunnelDetail(tunnelId);
eventDetailDO.setDirection(tunnelDetailDO.getDirection());
eventDetailDO.setDirectionName(tunnelDetailDO.getDirectionName());
eventDetailDO.setThirdEventStatus(xlwRealTimeEventDTO.getEventStatus()); eventDetailDO.setThirdEventStatus(xlwRealTimeEventDTO.getEventStatus());
EventDetailDO detailDO = eventDetailMapper.selectByThirdPartyId(eventDetailDO.getThirdPartyId()); EventDetailDO detailDO = eventDetailMapper.selectByThirdPartyId(eventDetailDO.getThirdPartyId());
// 判断跟隧道管控事件去重 如果隧道管控同车同类型事件已存在 则标记重复 // 判断跟隧道管控事件去重 如果隧道管控同车同类型事件已存在 则标记重复
...@@ -95,8 +105,10 @@ public class RealTimeEventWsClient { ...@@ -95,8 +105,10 @@ public class RealTimeEventWsClient {
} }
if(Objects.isNull(detailDO) ){ if(Objects.isNull(detailDO) ){
eventDetailMapper.insert(eventDetailDO); eventDetailMapper.insert(eventDetailDO);
eventGateway.pushRealTimeEventData(tunnelId); //推送实时事件数据到前端websocket服务
eventGateway.pushRealTimeEventData(tunnelId,eventDetailDO.getId());
}else{ }else{
eventDetailDO.setId(detailDO.getId());
//如果已存在事件,则只做状态的更新 //如果已存在事件,则只做状态的更新
EventDetailDO updateDetailDO = new EventDetailDO(); EventDetailDO updateDetailDO = new EventDetailDO();
updateDetailDO.setId(detailDO.getId()); updateDetailDO.setId(detailDO.getId());
...@@ -106,13 +118,14 @@ public class RealTimeEventWsClient { ...@@ -106,13 +118,14 @@ public class RealTimeEventWsClient {
} }
updateDetailDO.setUpdateTime(new Date()); updateDetailDO.setUpdateTime(new Date());
eventDetailMapper.updateById(updateDetailDO); eventDetailMapper.updateById(updateDetailDO);
log.info("更新事件状态成功,id:{},guid:{},三方状态:{}",detailDO.getId(),eventDetailDO.getThirdPartyId(),xlwRealTimeEventDTO.getEventStatus());
} }
if(xlwRealTimeEventDTO.getEventStatus() == 0){ // if(xlwRealTimeEventDTO.getEventStatus() == 0){
//当第二次收到信路威结束事件时, 异步获取车流数据和视频回放数据 //当第二次收到信路威结束事件时, 异步获取车流数据和视频回放数据
service.submit(()->{ service.submit(()->{
historyService.saveEventHistoryData(eventDetailDO); historyService.saveEventHistoryData(eventDetailDO);
}); });
} // }
}catch (Exception e){ }catch (Exception e){
log.error("处理实时数据失败",e); log.error("处理实时数据失败",e);
} }
...@@ -135,6 +148,30 @@ public class RealTimeEventWsClient { ...@@ -135,6 +148,30 @@ public class RealTimeEventWsClient {
WebSocketHttpHeaders webSocketHttpHeaders = new WebSocketHttpHeaders(); WebSocketHttpHeaders webSocketHttpHeaders = new WebSocketHttpHeaders();
webSocketHttpHeaders.add(XlwConstants.AUTH_HEADER,xlwAuthMapper.getXlwLoginToken()); webSocketHttpHeaders.add(XlwConstants.AUTH_HEADER,xlwAuthMapper.getXlwLoginToken());
client.execute(handler, webSocketHttpHeaders, new URI(url)); client.execute(handler, webSocketHttpHeaders, new URI(url));
log.info("websocket连接成功,连接地址:{}",url);
}
private void completionTunnelHole(String tunnelDetailId,EventDetailDO eventDetailDO){
eventDetailDO.setTunnelId(tunnelDetailId);
TunnelDetailDO tunnelDetailDO = tunnelDetailService.getTunnelDetail(tunnelDetailId);
if(Objects.isNull(tunnelDetailDO)){
log.error("ws事件数据异常,tunnelDetailId:{},TunnelDetailDO对象为空",tunnelDetailId);
}
eventDetailDO.setDirection(tunnelDetailDO.getDirection());
eventDetailDO.setDirectionName(tunnelDetailDO.getDirectionName());
TunnelHoleV2DO tunnelHoleV2DO = tunnelHoleService.getTunnelSfHoleId(tunnelDetailDO.getXlwTunnelId());
if(Objects.isNull(tunnelHoleV2DO)){
log.error("ws事件数据异常,xlwTunnelId:{},tunnelHoleV2DO对象为空",tunnelDetailDO.getXlwTunnelId());
}
TunnelBaseDO tunnelBaseDO = tunnelBaseService.getTunnelBase(tunnelHoleV2DO.getTunnelId());
if(Objects.isNull(tunnelBaseDO)){
log.error("ws事件数据异常,tunnelId:{},tunnelBaseDO对象为空",tunnelHoleV2DO.getTunnelId());
}
eventDetailDO.setBaseTunnelId(tunnelHoleV2DO.getTunnelId());
eventDetailDO.setBaseTunnelCode(tunnelBaseDO.getTunnelCode());
eventDetailDO.setHoleId(tunnelHoleV2DO.getId());
eventDetailDO.setCreateTime(new Date());
} }
} }
package com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw; package com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.cico.nest.lcdp.boot.core.qxsd.domain.gateway.VehicleGateway; import com.cico.nest.lcdp.boot.core.qxsd.domain.gateway.VehicleGateway;
import com.cico.nest.lcdp.boot.core.qxsd.domain.vehicle.TunnelRealTimeVehicle; import com.cico.nest.lcdp.boot.core.qxsd.domain.vehicle.TunnelRealTimeVehicle;
...@@ -11,13 +13,16 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw.dto.X ...@@ -11,13 +13,16 @@ import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw.dto.X
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.websocket.WebSocketContainer; import jakarta.websocket.WebSocketContainer;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.tomcat.websocket.WsWebSocketContainer; import org.apache.tomcat.websocket.WsWebSocketContainer;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.socket.*; import org.springframework.web.socket.*;
import org.springframework.web.socket.client.standard.StandardWebSocketClient; import org.springframework.web.socket.client.standard.StandardWebSocketClient;
import org.springframework.web.socket.handler.TextWebSocketHandler; import org.springframework.web.socket.handler.TextWebSocketHandler;
import java.net.URI; import java.net.URI;
import java.util.List;
/** /**
* 对接 信路威 车辆实时信息 websocket 客户端 * 对接 信路威 车辆实时信息 websocket 客户端
...@@ -28,6 +33,8 @@ import java.net.URI; ...@@ -28,6 +33,8 @@ import java.net.URI;
@Slf4j @Slf4j
public class RealTimeVehicleWsClient { public class RealTimeVehicleWsClient {
@Resource
private StringRedisTemplate stringRedisTemplate;
@Resource @Resource
private XlwAuthMapper xlwAuthMapper; private XlwAuthMapper xlwAuthMapper;
@Resource @Resource
...@@ -50,9 +57,24 @@ public class RealTimeVehicleWsClient { ...@@ -50,9 +57,24 @@ public class RealTimeVehicleWsClient {
public void handleTextMessage(WebSocketSession session, TextMessage message) { public void handleTextMessage(WebSocketSession session, TextMessage message) {
try{ try{
//处理从服务器接收到的消息 //处理从服务器接收到的消息
//log.info(tunnelId +"接收到的车辆数据:" + message.getPayload()); // log.info("detailTunnelId:{},接收到的车辆实时数据:{}" ,tunnelId, message.getPayload());
if(StrUtil.isBlank(message.getPayload())){
return;
}
XlwResultData<JSONObject> xlwResultData = JSONObject.parseObject(message.getPayload(), XlwResultData.class); XlwResultData<JSONObject> xlwResultData = JSONObject.parseObject(message.getPayload(), XlwResultData.class);
XlwRealTimeVehicleDTO xlwRealTimeVehicleDTO = JSONObject.parseObject(xlwResultData.getData().toString(), XlwRealTimeVehicleDTO.class); XlwRealTimeVehicleDTO xlwRealTimeVehicleDTO = JSONObject.parseObject(xlwResultData.getData().toString(), XlwRealTimeVehicleDTO.class);
/*********************************************************************************/
//todo 测试事件和车辆交集 从redis中获取key的值,往List<CarInfo>中添加数据 让车辆一直保留在隧道中
String redisKey = "VehicleWs:addCarInfo";
String vehicleJson = stringRedisTemplate.opsForValue().get(redisKey);
List<XlwRealTimeVehicleDTO.CarInfo> carInfoList = JSONArray.parseArray(vehicleJson, XlwRealTimeVehicleDTO.CarInfo.class);
if(CollectionUtils.isNotEmpty(carInfoList)){
log.info("测试事件和车辆交集,原:{}条",xlwRealTimeVehicleDTO.getCarInfo().size());
log.info("从redis中获取:{},的值,往List<CarInfo>中添加数据 让车辆一直保留在隧道中,插入{}条数据",redisKey,carInfoList.size());
xlwRealTimeVehicleDTO.getCarInfo().addAll(carInfoList);
log.info("测试事件和车辆交集,操作后:{}条",xlwRealTimeVehicleDTO.getCarInfo().size());
}
/*********************************************************************************/
TunnelRealTimeVehicle tunnelRealTimeVehicle = VehicleConvertor.convert2TunnelRTV(xlwRealTimeVehicleDTO,tunnelId,direction,startMilestone); TunnelRealTimeVehicle tunnelRealTimeVehicle = VehicleConvertor.convert2TunnelRTV(xlwRealTimeVehicleDTO,tunnelId,direction,startMilestone);
vehicleGateway.pushRealTimeVehicleData(tunnelRealTimeVehicle,tunnelId); vehicleGateway.pushRealTimeVehicleData(tunnelRealTimeVehicle,tunnelId);
}catch (Exception e){ }catch (Exception e){
......
package com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.ws.xlw.vo;
import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.event.EventDetailRespVO;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
/**
* @author tongzuqi
* @create 2025/6/14 10:42 AM
*/
@Accessors(chain = true)
@Data
public class RealTimeEventWsVO {
/**
* 事件列表数量
*/
Long eventCount = 0L;
/**
* 事件未完成集合
*/
List<EventDetailRespVO> eventThirdEventStatusNotFinishList;
/**
* 当前推送事件信息
*/
EventDetailRespVO eventDetailRespVO;
}
server: server:
port: 48088 port: 48078
tomcat: tomcat:
connection-timeout: 60000 connection-timeout: 60000
...@@ -53,9 +53,9 @@ spring: ...@@ -53,9 +53,9 @@ spring:
datasource: datasource:
master: master:
name: nest-qxsd-xl name: nest-qxsd-xl
url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 url: jdbc:mysql://192.168.1.196:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
username: root username: root
password: root password: 123456
#slave: # 模拟从库,可根据自己需要修改 #slave: # 模拟从库,可根据自己需要修改
# name: nest-fbi # name: nest-fbi
# lazy: true # 开启懒加载,保证启动速度 # lazy: true # 开启懒加载,保证启动速度
...@@ -64,10 +64,10 @@ spring: ...@@ -64,10 +64,10 @@ spring:
# password: YUkXGpfH!3ZjP%TN # password: YUkXGpfH!3ZjP%TN
data: data:
redis: redis:
host: 127.0.0.1 # 地址 host: 192.168.1.210 # 地址
port: 6379 # 端口 port: 6379 # 端口
database: 1 # 数据库索引 database: 11 # 数据库索引
#password: YUkXGpfH!3ZjP%TN password: 123456
--- #################### 定时任务相关配置 #################### --- #################### 定时任务相关配置 ####################
...@@ -272,8 +272,12 @@ qxsd: ...@@ -272,8 +272,12 @@ qxsd:
http: http://33.64.92.130:8091 http: http://33.64.92.130:8091
ws: ws://33.64.92.130:8093 ws: ws://33.64.92.130:8093
images: http://33.64.92.130:8800 images: http://33.64.92.130:8800
loginName: gaoxin #1.3 xwl 新账号密码
loginPwd: 7cc2cf8a95f80a8ea500ff997f9623e4 #MD5(1234zxcv) loginName: ForShowDemo
loginPwd: 5416d7cd6ef195a0f7622a9c56b55e84
#1.6 xwl 老账号密码
# loginName: gaoxin
# loginPwd: 7cc2cf8a95f80a8ea500ff997f9623e4 #MD5(1234zxcv)
organizationId: org0001 organizationId: org0001
hk: hk:
host: 12.1.89.1:443 host: 12.1.89.1:443
...@@ -281,12 +285,12 @@ qxsd: ...@@ -281,12 +285,12 @@ qxsd:
appSecret: EvCN2P1jYX20UWn2ZrGh appSecret: EvCN2P1jYX20UWn2ZrGh
images: images:
bayonetDownPath: http://33.67.51.196:10000/iot/images bayonetDownPath: http://33.67.51.196:10000/iot/images
eventSavePath: /home/gaoxin/nest-qxsd/web/images/event eventSavePath: /Users/tongzuqi/Desktop/tzq/dongchi/upload-gaoxin/nest-qxsd/web/images/event
bayonetSavePath: /home/gaoxin/nest-qxsd/web/images/bayonet bayonetSavePath: /Users/tongzuqi/Desktop/tzq/dongchi/upload-gaoxin/nest-qxsd/web/images/bayonet
#eventSavePath: D:\\home\\images\\event #eventSavePath: D:\\home\\images\\event
#bayonetSavePath: D:\\home\\images\\bayonet #bayonetSavePath: D:\\home\\images\\bayonet
video: video:
eventHisSavePath: /home/gaoxin/nest-qxsd/web/video/eventHis eventHisSavePath: /Users/tongzuqi/Desktop/tzq/dongchi/upload-gaoxin/nest-qxsd/web/video/eventHis
#eventHisSavePath: D:\\home\\video\\eventHis #eventHisSavePath: D:\\home\\video\\eventHis
static-resource: static-resource:
event-images: http://12.1.97.101:9888/images/event event-images: http://12.1.97.101:9888/images/event
......
server:
port: 48078
tomcat:
connection-timeout: 60000
--- #################### 数据库相关配置 ####################
spring:
autoconfigure:
exclude:
#- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
#- org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration # 默认 local 环境,不开启 Quartz 的自动配置
- com.xingyuv.justauth.autoconfigure.JustAuthAutoConfiguration # 禁用 三方授权
- com.binarywang.spring.starter.wxjava.mp.config.WxMpAutoConfiguration #禁用 微信公众
- com.binarywang.spring.starter.wxjava.miniapp.config.WxMaAutoConfiguration #禁用 微信小程序
- de.codecentric.boot.admin.server.config.AdminServerAutoConfiguration # 禁用 Spring Boot Admin 的 Server 的自动配置
- de.codecentric.boot.admin.server.ui.config.AdminServerUiAutoConfiguration # 禁用 Spring Boot Admin 的 Server UI 的自动配置
- de.codecentric.boot.admin.client.config.SpringBootAdminClientAutoConfiguration # 禁用 Spring Boot Admin 的 Client 的自动配置
# 数据源配置项
datasource:
druid: # Druid 【监控】相关的全局配置
web-stat-filter:
enabled: true
stat-view-servlet:
enabled: true
allow: # 设置白名单,不填则允许所有访问
url-pattern: /druid/*
login-username: admin # 控制台管理用户名和密码
login-password: 8aHZNxn93Vfj
filter:
stat:
enabled: true
log-slow-sql: true # 慢 SQL 记录
slow-sql-millis: 100
merge-sql: true
wall:
config:
multi-statement-allow: true
dynamic: # 多数据源配置
druid: # Druid 【连接池】相关的全局配置
initial-size: 1 # 初始连接数
min-idle: 1 # 最小连接池数量
max-active: 20 # 最大连接池数量
max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒
time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒
min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒
max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒
validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效
test-while-idle: true
test-on-borrow: false
test-on-return: false
primary: master
datasource:
master:
name: nest-qxsd-xl-v2
url: jdbc:mysql://12.1.89.111:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
username: zeiet
password: YUkXGpfH!3ZjP%TN
#slave: # 模拟从库,可根据自己需要修改
# name: nest-fbi
# lazy: true # 开启懒加载,保证启动速度
# url: jdbc:mysql://10.126.10.160:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
# username: iep
# password: YUkXGpfH!3ZjP%TN
data:
redis:
host: 12.1.89.111 # 地址
port: 6379 # 端口
database: 3 # 数据库索引
password: YUkXGpfH!3ZjP%TN
--- #################### 定时任务相关配置 ####################
# Quartz 配置项,对应 QuartzProperties 配置类
spring:
quartz:
auto-startup: true # 本地开发环境,尽量不要开启 Job
scheduler-name: schedulerName # Scheduler 名字。默认为 schedulerName
job-store-type: jdbc # Job 存储器类型。默认为 memory 表示内存,可选 jdbc 使用数据库。
wait-for-jobs-to-complete-on-shutdown: true # 应用关闭时,是否等待定时任务执行完成。默认为 false ,建议设置为 true
properties: # 添加 Quartz Scheduler 附加属性,更多可以看 http://www.quartz-scheduler.org/documentation/2.4.0-SNAPSHOT/configuration.html 文档
org:
quartz:
# Scheduler 相关配置
scheduler:
instanceName: schedulerName
instanceId: AUTO # 自动生成 instance ID
# JobStore 相关配置
jobStore:
# JobStore 实现类。可见博客:https://blog.csdn.net/weixin_42458219/article/details/122247162
class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
isClustered: true # 是集群模式
clusterCheckinInterval: 15000 # 集群检查频率,单位:毫秒。默认为 15000,即 15 秒
misfireThreshold: 60000 # misfire 阀值,单位:毫秒。
# 线程池相关配置
threadPool:
threadCount: 25 # 线程池大小。默认为 10 。
threadPriority: 5 # 线程优先级
class: org.quartz.simpl.SimpleThreadPool # 线程池类型
jdbc: # 使用 JDBC 的 JobStore 的时候,JDBC 的配置
initialize-schema: NEVER # 是否自动使用 SQL 初始化 Quartz 表结构。这里设置成 never ,我们手动创建表结构。
--- #################### 服务保障相关配置 ####################
# Lock4j 配置项
lock4j:
acquire-timeout: 3000 # 获取分布式锁超时时间,默认为 3000 毫秒
expire: 30000 # 分布式锁的超时时间,默认为 30 毫秒
# Resilience4j 配置项
resilience4j:
ratelimiter:
instances:
backendA:
limit-for-period: 1 # 每个周期内,允许的请求数。默认为 50
limit-refresh-period: 60s # 每个周期的时长,单位:微秒。默认为 500
timeout-duration: 1s # 被限流时,阻塞等待的时长,单位:微秒。默认为 5s
register-health-indicator: true # 是否注册到健康监测
--- #################### 监控相关配置 ####################
# Actuator 监控端点的配置项
management:
endpoints:
web:
base-path: /actuator # 配置端点访问前缀
exposure:
include: '*' # 暴露指定端点
exclude: env,heapdump,loggers
enabled-by-default: false
endpoint:
health:
show-details: always
enabled: false
shutdown:
# 通过指定接口关闭 SpringBoot
enabled: false
heapdump:
enabled: false
# Spring Boot Admin 配置项
spring:
boot:
admin:
# Spring Boot Admin Client 客户端的相关配置
client:
url: http://127.0.0.1:${server.port}/${spring.boot.admin.context-path} # 设置 Spring Boot Admin Server 地址
instance:
service-host-type: IP # 注册实例时,优先使用 IP [IP, HOST_NAME, CANONICAL_HOST_NAME]
# Spring Boot Admin Server 服务端的相关配置
context-path: /admin # 配置 Spring
# 日志文件配置
logging:
level:
# 配置自己写的 MyBatis Mapper 打印日志
com.cico.nest.lcdp.boot.core.infra.dal.mysql.job.JobLogMapper: INFO # 配置 JobLogMapper 的日志级别为 info
com.cico.nest.lcdp.boot.core.infra.dal.mysql.file.FileConfigMapper: INFO # 配置 FileConfigMapper 的日志级别为 info
com.cico.nest.lcdp.boot.core.system.dal.mysql: INFO
com.cico.nest.lcdp.boot.core.system.dal.mysql.sensitiveword.SensitiveWordMapper: INFO # 配置 SensitiveWordMapper 的日志级别为 info
com.cico.nest.lcdp.boot.core.system.dal.mysql.sms.SmsChannelMapper: INFO # 配置 SmsChannelMapper 的日志级别为 info
# org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR # TODO:先禁用,Spring Boot 3.X 存在部分错误的 WARN 提示
com.cico.nest.lcdp: INFO
file:
path: /home/gaoxin/nest-qxsd-v2/logs # 日志文件名,全路径
debug: false
# lcdp配置项,设置当前项目所有自定义的配置
lcdp:
upload:
# 本地:local\Minio:minio\阿里云:alioss
type: local
# 文件上传根目录 设置
path: files
desform:
theme-color: '#1890ff'
captcha:
enable: false # 本地环境,暂时关闭图片验证码,方便登录等接口的测试;
security:
mock-enable: false
xss:
enable: false
exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系
- ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求
- ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求
error-code: # 错误码相关配置项
enable: false
demo: false # 关闭演示模式
--- #################### 接口文档配置 ####################
springdoc:
api-docs:
enabled: true
path: /v3/api-docs
swagger-ui:
enabled: true
path: /swagger-ui
default-flat-param-object: true # 参见 https://doc.xiaominfo.com/docs/faq/v4/knife4j-parameterobject-flat-param 文档
# knife4j的增强配置,不需要增强可以不配
knife4j:
enable: true
# 开启Swagger的Basic认证功能,默认是false
basic:
enable: true
# Basic认证用户名
username: nest-swagger
# Basic认证密码
password: Nboot@2008.
setting:
language: zh_cn
# Sa-Token 配置
sa-token:
# -------sso-client相关配置
sso-client:
# SSO-Server 端主机地址
server-url: http://127.0.0.1:18080
# 打开模式三(使用Http请求校验ticket)
is-http: true
sign:
# API 接口调用秘钥
secret-key: kQwIOrYvnXmSDkwEiFngrKidMcdrgKor
# ---- 除了以上配置项,你还需要为 Sa-Token 配置http请求处理器(文档有步骤说明)
# 配置Sa-Token单独使用的Redis连接 (此处需要和SSO-Server端连接同一个Redis)
alone-redis:
# Redis数据库索引
database: 1
# Redis服务器地址
host: 127.0.0.1
# Redis服务器连接端口
port: 6379
# Redis服务器连接密码(默认为空)
password:
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池最大连接数
max-active: 200
# 连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
# 连接池中的最大空闲连接
max-idle: 10
# 连接池中的最小空闲连接
min-idle: 0
flowable:
dmn:
enabled: false
cmmn:
enabled: false
idm:
enabled: false
async-history-executor-activate: false
async-executor-activate: true
check-process-definitions: false
content:
enabled: false
app:
enabled: false
eventregistry:
enabled: false
qxsd:
tunnel:
down-id: xl_tunnel_down
up-id: xl_tunnel_up
xlw:
http: http://33.64.92.130:8091
ws: ws://33.64.92.130:8093
images: http://33.64.92.130:8800
# xwl 新老切换 1:密码调整,2:接口请求 2处地方
#1.3 xwl 新账号密码
loginName: ForShowDemo
loginPwd: 5416d7cd6ef195a0f7622a9c56b55e84
#1.6 xwl 老账号密码
# loginName: gaoxin
# loginPwd: 7cc2cf8a95f80a8ea500ff997f9623e4 #MD5(1234zxcv)
organizationId: org0001
hk:
host: 12.1.89.1:443
appKey: 23516385
appSecret: EvCN2P1jYX20UWn2ZrGh
images:
bayonetDownPath: http://33.64.92.130:8800
eventSavePath: /home/gaoxin/nest-qxsd-v2/web/images/event
bayonetSavePath: /home/gaoxin/nest-qxsd-v2/web/images/bayonet
video:
eventHisSavePath: /home/gaoxin/nest-qxsd-v2/web/video/eventHis
static-resource:
event-images: http://12.1.89.111:9878/images/event
bayonet-images: http://12.1.89.111:9878/images/bayonet
event-his-video: http://12.1.89.111:9878/video/eventHis
#全景门户留存车辆
qjmh:
base-url: http://12.1.150.111:9195/open-api/nest
retent-car-list-path: http://12.1.150.111:9195/open-api/nest/tunnel/details
tunnel-name: 新岭隧道
#隧道管控
sdgk:
base-url: http://33.64.92.5:8090
loginName: xl
password: Xl@123456
#免密跳转的地址
freelogin-path: http://33.64.92.5:8090/login?phone=%s&secretKey=%s
secretKey: r*3s3KnDB9fK
passwordDESKey: 4werwero2396i678;
mqtt:
enable: false
client-id-prefix: qxsd-xl-prd
server-uris:
- tcp://33.64.92.5:1883
username: admin
password: public
keep-alive-interval: 60
message-mapper: com.cico.nest.lcdp.framework.mq.mqtt.core.support.MqttJsonMessageMapper #使用JSON序列化
handler-packages: com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.mqtt.handler #消息处理类所在包
sub-topics:
- tunnel-event/qxsd
- event/+/videoEvent
- notice/+/videoEventConfirm
...@@ -2,7 +2,7 @@ spring: ...@@ -2,7 +2,7 @@ spring:
application: application:
name: nest-lcdp-boot name: nest-lcdp-boot
profiles: profiles:
active: xl active: localhost
main: main:
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。 allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
# Servlet 配置 # Servlet 配置
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
</root> </root>
</springProfile> </springProfile>
<!-- 其它环境 --> <!-- 其它环境 -->
<springProfile name="249,localhost,gfj,xl"> <springProfile name="249,localhost,gfj,xl,xl-v2">
<root level="INFO"> <root level="INFO">
<appender-ref ref="STDOUT"/> <appender-ref ref="STDOUT"/>
<appender-ref ref="ASYNC"/> <appender-ref ref="ASYNC"/>
......
#!/bin/sh -l
function mvn_server(){
source ~/.zshrc
export JAVA_HOME=$JAVA_HOME_17
# 执行maven命令
log_yellow "切换jdk17"
log_black `java -version`
log_black "mvn clean package -Dmaven.test.skip=true"
mvn clean package -Dmaven.test.skip=true
export JAVA_HOME=$JAVA_HOME_8
log_black `java -version`
log_yellow "切换jdk8"
LOG "编译完成"
}
function git_pull()
{
# # 切换临时目录
# log_black "rm -rf $temp_project_path"
# rm -rf $temp_project_path
# log_black "cd $temp_base_path"
# cd $temp_base_path
# # 拉取代码
# log_black "git clone http://gitlab.totalapp.cn:8880/$GIT_SERVICE_TYPE/$GIT_SERVICE_NAME.git"
# git clone http://gitlab.totalapp.cn:8880/$GIT_SERVICE_TYPE/$GIT_SERVICE_NAME.git
# log_black "cd $GIT_SERVICE_NAME"
# cd $GIT_SERVICE_NAME
#切换分支
log_black "git checkout $branch"
branch_retuen=`git checkout $branch`
if [[ ! $branch_retuen ]]; then
LOG "输入的分支错误,请核实"
exit 1
else
LOG "切换[$branch]分支,返回:"$branch_retuen
fi
}
# 绿字
function LOG(){
echo -e "\033[32m $1 \033[0m"
}
# 黄字
function log_yellow(){
echo -e "\033[33m $1 \033[0m"
}
# 红字
function log_red(){
echo -e "\033[31m $1 \033[0m"
}
# 黑字
function log_black(){
echo -e "\033[47;30m $1 \033[0m"
}
log_red "使用此脚本拉取git并使用maven配置进行打包,需要记得修改,请注意!!!!"
log_red "temp_base_path sh脚本目录"
log_red "mvm_path maven文件jar目录"
branch="提交过代码后的"
cd /Users/tongzuqi/pro/dongchi/gaoxin/nestqxsdboot
pwd=`pwd`
mvm_path=/Users/ONE/maven/apache-maven-3.6.1/lib/repo
log_red "maven路径:"$mvm_path
log_red "当前路径:"$pwd
log_red "分支名:"$branch
rm -rf /Users/tongzuqi/pro/dongchi/gaoxin/nestqxsdboot/nest-lcdp-boot-server/target/
LOG "-------编译中:-----------"
mvn_server;
LOG "-------删除git临时目录-------"
set -x
pwd
chmod 755 /Users/tongzuqi/pro/dongchi/gaoxin/nestqxsdboot/nest-lcdp-boot-server/target/*.jar
scp -r /Users/tongzuqi/pro/dongchi/gaoxin/nestqxsdboot/nest-lcdp-boot-server/target/nest-lcdp-boot-server.jar root@12.1.89.111:/home/gaoxin/nest-qxsd-v2/nest-lcdp-boot-server-v2.jar
ssh -tt -p 22 root@12.1.89.111 <<EOF
cd /home/gaoxin/nest-qxsd-v2/
sh run.sh restart
echo "启动服务结束"
exit
EOF
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