diff --git a/zc-business/src/main/java/com/zc/business/domain/DcEvent.java b/zc-business/src/main/java/com/zc/business/domain/DcEvent.java index 9140d798..13361a65 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcEvent.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcEvent.java @@ -235,11 +235,6 @@ public class DcEvent extends BaseEntity { * 2014/2/21新增 */ -@ApiModelProperty("所属预案") - private Long emergencyPlansId; - - - /** * */ diff --git a/zc-business/src/main/java/com/zc/business/domain/DcEventTrafficCongestion.java b/zc-business/src/main/java/com/zc/business/domain/DcEventTrafficCongestion.java index 1157c9be..1be93178 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcEventTrafficCongestion.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcEventTrafficCongestion.java @@ -82,6 +82,8 @@ public class DcEventTrafficCongestion extends BaseEntity private Integer locationType; @ApiModelProperty("地点描述") private String locationDescription; + @ApiModelProperty("终止桩号") + private String endStakeMark; @ApiModelProperty("事件信息实体") diff --git a/zc-business/src/main/java/com/zc/business/domain/MdEvent.java b/zc-business/src/main/java/com/zc/business/domain/MdEvent.java index 1d67dbd0..cd6838c7 100644 --- a/zc-business/src/main/java/com/zc/business/domain/MdEvent.java +++ b/zc-business/src/main/java/com/zc/business/domain/MdEvent.java @@ -647,11 +647,51 @@ public class MdEvent // 10-异常天气 // 11-其他事件 String eventType = dcEvent.getEventType().toString(); - /*if ("1".equals(eventType)){ + if ("1".equals(eventType)){ DcEventAccident dcEventAccident = dcEvent.getDcEventAccident(); + //事故天气情况 this.accidentWeather = dcEventAccident.getWeatherCondition(); - this.accidentQueue = dcEventAccident.getTrafficJam(); - }*/ + //事故压车(公里) + this.accidentQueue = new BigDecimal(Float.toString(dcEventAccident.getTrafficJam())); + } else if ("2".equals(eventType)){ + DcEventVehicleAccident dcEventVehicleAccident = dcEvent.getDcEventVehicleAccident(); + //事故天气情况 + this.accidentWeather = dcEventVehicleAccident.getWeatherCondition(); + //事故压车(公里) + this.accidentQueue = new BigDecimal(Float.toString(dcEventVehicleAccident.getTrafficJam())); + } else if ("3".equals(eventType)){ + DcEventTrafficControl dcEventTrafficControl = dcEvent.getDcEventTrafficControl(); + //管制分类 + this.controlCategory = dcEventTrafficControl.getControlType(); + //管制原因类型 + this.controlReasonType = dcEventTrafficControl.getControlCause().toString(); + //管制出入口 + this.controlStation = dcEventTrafficControl.getFacilityId(); + //管制措施 + this.controlStrategy = dcEventTrafficControl.getMeasure(); + //管制限制类型 + this.controlType = dcEventTrafficControl.getLimitedType(); + //管制车辆类型 + this.controlVehicleType = dcEventTrafficControl.getVehicleType(); + } else if ("4".equals(eventType)){ + DcEventTrafficCongestion dcEventTrafficCongestion = dcEvent.getDcEventTrafficCongestion(); + //拥堵里程(公里) + this.congestionPile = dcEventTrafficCongestion.getCongestionMileage().longValue(); + //拥堵原因 + this.congestionReason = dcEventTrafficCongestion.getCongestionCause(); + } else if ("7".equals(eventType)){ + DcEventConstruction dcEventConstruction = dcEvent.getDcEventConstruction(); + //管制分类 + this.controlCategory = dcEventConstruction.getControlMode(); + } else if ("8".equals(eventType)){ + DcEventServiceArea dcEventServiceArea = dcEvent.getDcEventServiceArea(); + //管制出入口 + this.controlStation = dcEventServiceArea.getFacilityId(); + } else if ("10".equals(eventType)){ + DcEventAbnormalWeather dcEventAbnormalWeather = dcEvent.getDcEventAbnormalWeather(); + + + } } } diff --git a/zc-business/src/main/java/com/zc/business/mapper/MiddleDatabaseMapper.java b/zc-business/src/main/java/com/zc/business/mapper/MiddleDatabaseMapper.java index 9b72f0a6..864a86cd 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/MiddleDatabaseMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/MiddleDatabaseMapper.java @@ -1,5 +1,8 @@ package com.zc.business.mapper; +import com.ruoyi.common.annotation.DataScope; +import com.ruoyi.common.annotation.DataSource; +import com.ruoyi.common.enums.DataSourceType; import com.zc.business.domain.DcBoardReleaseLog; import com.zc.business.domain.DcDevice; import com.zc.business.domain.MdDeviceData; @@ -13,7 +16,7 @@ import java.util.List; * @author ruoyi * @date 2024-01-05 */ -public interface MiddleDatabaseMapper +public interface MiddleDatabaseMapper { /** diff --git a/zc-business/src/main/java/com/zc/business/service/IMiddleDatabaseService.java b/zc-business/src/main/java/com/zc/business/service/IMiddleDatabaseService.java index 9ebaf619..1d669667 100644 --- a/zc-business/src/main/java/com/zc/business/service/IMiddleDatabaseService.java +++ b/zc-business/src/main/java/com/zc/business/service/IMiddleDatabaseService.java @@ -1,5 +1,6 @@ package com.zc.business.service; +import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.core.domain.AjaxResult; import com.zc.business.domain.DcBoardPublish; import com.zc.business.domain.DcDevice; diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java index a0c2b780..b922c48d 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java @@ -12,6 +12,7 @@ import com.ruoyi.system.service.ISysDeptService; import com.zc.business.domain.*; import com.zc.business.mapper.*; import com.zc.business.service.IDcEventService; +import com.zc.business.service.IMiddleDatabaseService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -58,6 +59,8 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper; //部门信息 @Autowired private ISysDeptService deptService; + @Autowired + private IMiddleDatabaseService middleDatabaseService; @@ -131,6 +134,11 @@ dcEvent.setUserId(SecurityUtils.getUserId()); int i7 = dcEventMapper.insertDcEvent(dcEvent); if (i7>0){ + + //中间库 +// MdEvent mdEvent = new MdEvent(dcEvent); +// middleDatabaseService.insertMiddleDatabaseEvent(mdEvent); + //获取事件类型 int eventType = Math.toIntExact(dcEvent.getEventType()); switch (eventType){ @@ -205,6 +213,11 @@ dcEvent.setUserId(SecurityUtils.getUserId()); dcEvent.setUpdateTime(DateUtils.getNowDate()); int i7 = dcEventMapper.updateDcEvent(dcEvent); if (i7>0) { + + //中间库 +// MdEvent mdEvent = new MdEvent(dcEvent); +// middleDatabaseService.updateMiddleDatabaseEvent(mdEvent); + int eventType = Math.toIntExact(dcEvent.getEventType()); switch (eventType){ //交通事故 diff --git a/zc-business/src/main/java/com/zc/business/service/impl/MiddleDatabaseServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/MiddleDatabaseServiceImpl.java index be315357..0ea93378 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/MiddleDatabaseServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/MiddleDatabaseServiceImpl.java @@ -1,5 +1,6 @@ package com.zc.business.service.impl; +import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.annotation.DataSource; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.enums.DataSourceType; @@ -11,6 +12,8 @@ import com.zc.business.mapper.MiddleDatabaseMapper; import com.zc.business.service.IMiddleDatabaseService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; import java.util.List; @@ -21,6 +24,8 @@ import java.util.List; * @date 2024-01-03 */ @Service +@DataSource(value = DataSourceType.SLAVE)//切换数据源 +@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) public class MiddleDatabaseServiceImpl implements IMiddleDatabaseService { @@ -34,7 +39,7 @@ public class MiddleDatabaseServiceImpl implements IMiddleDatabaseService { * @param mdDeviceData 气象检测器数据 * @return 结果 */ - @DataSource(value = DataSourceType.SLAVE)//切换数据源 +// @DataSource(value = DataSourceType.SLAVE)//切换数据源 @Override public boolean insertMiddleDatabaseDeviceData(MdDeviceData mdDeviceData) { @@ -48,7 +53,7 @@ public class MiddleDatabaseServiceImpl implements IMiddleDatabaseService { * @param listDevice 设备列表 * @return 结果 */ - @DataSource(value = DataSourceType.SLAVE)//切换数据源 +// @DataSource(value = DataSourceType.SLAVE)//切换数据源 @Override public boolean updateMiddleDatabaseDeviceByList(List listDevice) { @@ -65,7 +70,7 @@ public class MiddleDatabaseServiceImpl implements IMiddleDatabaseService { * @param device 设备 * @return 结果 */ - @DataSource(value = DataSourceType.SLAVE)//切换数据源 +// @DataSource(value = DataSourceType.SLAVE)//切换数据源 @Override public boolean updateMiddleDatabaseDevice(DcDevice device) { @@ -78,13 +83,12 @@ public class MiddleDatabaseServiceImpl implements IMiddleDatabaseService { * @param mdEvent 事件 * @return 结果 */ - @DataSource(value = DataSourceType.SLAVE)//切换数据源 @Override public boolean insertMiddleDatabaseEvent(MdEvent mdEvent){ - LoginUser loginUser = SecurityUtils.getLoginUser(); + /* LoginUser loginUser = SecurityUtils.getLoginUser(); if (loginUser != null) { mdEvent.setCreatorUserId(loginUser.getUserId()); - } + }*/ return middleDatabaseMapper.insertMiddleDatabaseEvent(mdEvent); } @@ -94,7 +98,7 @@ public class MiddleDatabaseServiceImpl implements IMiddleDatabaseService { * @param mdEvent 事件 * @return 结果 */ - @DataSource(value = DataSourceType.SLAVE)//切换数据源 +// @DataSource(value = DataSourceType.SLAVE)//切换数据源 @Override public boolean updateMiddleDatabaseEvent(MdEvent mdEvent){ LoginUser loginUser = SecurityUtils.getLoginUser(); diff --git a/zc-business/src/main/resources/mapper/business/DcEventMapper.xml b/zc-business/src/main/resources/mapper/business/DcEventMapper.xml index b69ee69e..0cfd9128 100644 --- a/zc-business/src/main/resources/mapper/business/DcEventMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcEventMapper.xml @@ -32,7 +32,6 @@ - @@ -66,7 +65,6 @@ - @@ -154,7 +152,6 @@ event_level, event_type, event_title, - emergency_plans_id, CASE event_type WHEN '1' THEN '交通事故' WHEN '2' THEN '车辆故障' @@ -280,7 +277,6 @@ dc_event.in_tunnel, dc_event.road_id, dc_event.event_title, - dc_event.emergency_plans_id, dc_event_type.event_name AS event_name, dc_process_config.node_node AS node_node, @@ -329,7 +325,6 @@ and event_nature = #{eventNature} and event_source_tips = #{eventSourceTips} and in_tunnel = #{inTunnel} - and emergency_plans_id = #{emergencyPlansId} @@ -367,7 +362,6 @@ dc_event.estimated_end_time, dc_event.event_level, dc_event.event_title, - dc_event.emergency_plans_id, dc_event.occurrence_time, dc_event.event_type AS event_type, CASE dc_event.event_type @@ -505,7 +499,6 @@ lang, event_title, occurrence_time, - emergency_plans_id, #{id}, @@ -533,7 +526,6 @@ #{lang}, #{eventTitle}, #{occurrenceTime}, - #{emergencyPlansId}, @@ -564,7 +556,6 @@ road_id = #{lang}, event_title = #{eventTitle}, occurrence_time = #{occurrenceTime}, - emergency_plans_id = #{emergencyPlansId}, where id = #{id} diff --git a/zc-business/src/main/resources/mapper/business/DcEventTrafficCongestionMapper.xml b/zc-business/src/main/resources/mapper/business/DcEventTrafficCongestionMapper.xml index 4214fe7f..f0a83fa1 100644 --- a/zc-business/src/main/resources/mapper/business/DcEventTrafficCongestionMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcEventTrafficCongestionMapper.xml @@ -15,6 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -26,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select location_type,location_description,detailed_reasons,id, congestion_mileage, congestion_cause, facility_id, ramp_id, location,max_congestion_mileage from dc_event_traffic_congestion + select end_stake_mark,location_type,location_description,detailed_reasons,id, congestion_mileage, congestion_cause, facility_id, ramp_id, location,max_congestion_mileage from dc_event_traffic_congestion @@ -41,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" dc_event_traffic_congestion.location_type as location_type, dc_event_traffic_congestion.location_description as location_description, dc_event_traffic_congestion.detailed_reasons as detailed_reasons, + dc_event_traffic_congestion.end_stake_mark as end_stake_mark, dc_facility.other_config as other_config, dc_facility.remark as remark, @@ -81,6 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" location_description, location_type, detailed_reasons, + end_stake_mark, #{id}, @@ -93,6 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{locationDescription}, #{locationType}, #{detailedReasons}, + #{end_stake_mark}, @@ -108,6 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" location_description = #{locationDescription}, location_type = #{locationType}, detailed_reasons = #{detailedReasons}, + end_stake_mark = #{endStakeMark}, where id = #{id}