Browse Source

事件录入判断

develop
王兴琳 1 year ago
parent
commit
d2556b6616
  1. 2
      zc-business/src/main/java/com/zc/business/domain/DcEvent.java
  2. 247
      zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java

2
zc-business/src/main/java/com/zc/business/domain/DcEvent.java

@ -136,7 +136,7 @@ public class DcEvent extends BaseEntity {
* 3-3 立交封闭和限行 * 3-3 立交封闭和限行
* 3-4 服务区封闭和限行 * 3-4 服务区封闭和限行
*/ */
@Excel(name = "设备编号") @Excel(name = "事件类型")
@ApiModelProperty("事件子类 例:事件子类:* 1-1 追尾* 1-2 侧翻* 1-3 撞护栏* 1-4 自然* 1-5 其他事故* 2-1 车辆故障") @ApiModelProperty("事件子类 例:事件子类:* 1-1 追尾* 1-2 侧翻* 1-3 撞护栏* 1-4 自然* 1-5 其他事故* 2-1 车辆故障")
private String eventSubclass; private String eventSubclass;

247
zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java

@ -1,13 +1,5 @@
package com.zc.business.service.impl; package com.zc.business.service.impl;
import java.awt.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.common.utils.uuid.IdUtils;
@ -20,6 +12,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 事件信息Service业务层处理 * 事件信息Service业务层处理
@ -29,14 +25,13 @@ import org.springframework.transaction.annotation.Transactional;
*/ */
@Service @Service
@Transactional @Transactional
public class DcEventServiceImpl implements IDcEventService public class DcEventServiceImpl implements IDcEventService {
{
@Autowired @Autowired
private DcEventMapper dcEventMapper; private DcEventMapper dcEventMapper;
//异常天气 //异常天气
@Autowired @Autowired
private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper; private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper;
//交通事故事件 //交通事故事件
@Autowired @Autowired
private DcEventAccidentMapper dcEventAccidentMapper; private DcEventAccidentMapper dcEventAccidentMapper;
//施工建设 //施工建设
@ -50,8 +45,8 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper;
private DcEventTrafficCongestionMapper dcEventTrafficCongestionMapper; private DcEventTrafficCongestionMapper dcEventTrafficCongestionMapper;
//车辆事故事件 //车辆事故事件
@Autowired @Autowired
private DcEventVehicleAccidentMapper dcEventVehicleAccidentMapper; private DcEventVehicleAccidentMapper dcEventVehicleAccidentMapper;
//交通管制事件 //交通管制事件
@Autowired @Autowired
private DcEventTrafficControlMapper dcEventTrafficControlMapper; private DcEventTrafficControlMapper dcEventTrafficControlMapper;
@ -66,7 +61,6 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper;
private IMiddleDatabaseService middleDatabaseService; private IMiddleDatabaseService middleDatabaseService;
/** /**
* 查询事件信息 * 查询事件信息
* *
@ -74,12 +68,11 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper;
* @return 事件信息 * @return 事件信息
*/ */
@Override @Override
public DcEvent selectDcEventById( String id) public DcEvent selectDcEventById(String id) {
{
DcEvent dcEvent = dcEventMapper.selectDcEventById(id); DcEvent dcEvent = dcEventMapper.selectDcEventById(id);
List<DcProcessConfig> processConfigList = dcProcessConfigMapper.selectDcProcessConfigByEventType(Math.toIntExact(dcEvent.getEventType())); List<DcProcessConfig> processConfigList = dcProcessConfigMapper.selectDcProcessConfigByEventType(Math.toIntExact(dcEvent.getEventType()));
dcEvent.setProcessConfigList(processConfigList); dcEvent.setProcessConfigList(processConfigList);
return dcEvent; return dcEvent;
} }
@ -90,9 +83,8 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper;
* @return 事件信息 * @return 事件信息
*/ */
@Override @Override
public List<DcEvent> selectDcEventList(DcEvent dcEvent) public List<DcEvent> selectDcEventList(DcEvent dcEvent) {
{ if (dcEvent.getStakeMark() != null) {
if (dcEvent.getStakeMark()!=null){
//处理URl地址栏获取参数+号消失 //处理URl地址栏获取参数+号消失
String replace = dcEvent.getStakeMark().replace(" ", "+"); String replace = dcEvent.getStakeMark().replace(" ", "+");
dcEvent.setStakeMark(replace); dcEvent.setStakeMark(replace);
@ -101,7 +93,7 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper;
} }
List<DcEvent> dcEventList = dcEventMapper.selectDcEventList(dcEvent); List<DcEvent> dcEventList = dcEventMapper.selectDcEventList(dcEvent);
for (DcEvent dcEvents : dcEventList) { for (DcEvent dcEvents : dcEventList) {
// 根据 deptId 获取部门名称 // 根据 deptId 获取部门名称
Long deptId = dcEvents.getDeptId(); Long deptId = dcEvents.getDeptId();
String deptName = deptService.selectDeptById(deptId).getDeptName(); String deptName = deptService.selectDeptById(deptId).getDeptName();
@ -120,23 +112,21 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper;
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertDcEvent(DcEvent dcEvent) public int insertDcEvent(DcEvent dcEvent) {
{
//设置事件Id UUID无下划线格式32 //设置事件Id UUID无下划线格式32
String uuid = IdUtils.fastSimpleUUID(); String uuid = IdUtils.fastSimpleUUID();
dcEvent.setId(uuid); dcEvent.setId(uuid);
dcEvent.setEventState(0L); dcEvent.setEventState(0L);
//获取部门信息 //获取部门信息
dcEvent.setDeptId(SecurityUtils.getDeptId()); dcEvent.setDeptId(SecurityUtils.getDeptId());
//用户 //用户
dcEvent.setUserId(SecurityUtils.getUserId()); dcEvent.setUserId(SecurityUtils.getUserId());
dcEvent.setCreateTime(DateUtils.getNowDate()); dcEvent.setCreateTime(DateUtils.getNowDate());
int i7 = dcEventMapper.insertDcEvent(dcEvent); int i7 = dcEventMapper.insertDcEvent(dcEvent);
if (i7>0){ if (i7 > 0) {
//中间库 //中间库
// MdEvent mdEvent = new MdEvent(dcEvent); // MdEvent mdEvent = new MdEvent(dcEvent);
@ -144,26 +134,36 @@ dcEvent.setUserId(SecurityUtils.getUserId());
//获取事件类型 //获取事件类型
int eventType = Math.toIntExact(dcEvent.getEventType()); int eventType = Math.toIntExact(dcEvent.getEventType());
switch (eventType){ switch (eventType) {
//交通事故 //交通事故
case 1: case 1:
dcEvent.getDcEventAccident().setId(uuid); if (dcEvent.getDcEventAccident() != null) {
int i1 = dcEventAccidentMapper.insertDcEventAccident(dcEvent.getDcEventAccident()); dcEvent.getDcEventAccident().setId(uuid);
int i1 = dcEventAccidentMapper.insertDcEventAccident(dcEvent.getDcEventAccident());
}
break; break;
//车辆事故 //车辆事故
case 2: case 2:
dcEvent.getDcEventVehicleAccident().setId(uuid); if (dcEvent.getDcEventVehicleAccident()!=null){
int i5 = dcEventVehicleAccidentMapper.insertDcEventVehicleAccident(dcEvent.getDcEventVehicleAccident()); dcEvent.getDcEventVehicleAccident().setId(uuid);
int i5 = dcEventVehicleAccidentMapper.insertDcEventVehicleAccident(dcEvent.getDcEventVehicleAccident());
}
break; break;
//交通管制 //交通管制
case 3: case 3:
dcEvent.getDcEventTrafficControl().setId(uuid); if (dcEvent.getDcEventTrafficControl()!=null){
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl()); dcEvent.getDcEventTrafficControl().setId(uuid);
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl());
}
break; break;
//交通拥堵 //交通拥堵
case 4: case 4:
dcEvent.getDcEventTrafficCongestion().setId(uuid); if (dcEvent.getDcEventTrafficCongestion()!=null){
int i4 = dcEventTrafficCongestionMapper.insertDcEventTrafficCongestion(dcEvent.getDcEventTrafficCongestion()); dcEvent.getDcEventTrafficCongestion().setId(uuid);
int i4 = dcEventTrafficCongestionMapper.insertDcEventTrafficCongestion(dcEvent.getDcEventTrafficCongestion());
}
break; break;
//非法上路 //非法上路
@ -174,21 +174,28 @@ dcEvent.setUserId(SecurityUtils.getUserId());
break; break;
//施工建设 //施工建设
case 7: case 7:
dcEvent.getDcEventConstruction().setId(uuid); if (dcEvent.getDcEventConstruction()!=null){
int i2 = dcEventConstructionMapper.insertDcEventConstruction(dcEvent.getDcEventConstruction()); dcEvent.getDcEventConstruction().setId(uuid);
int i2 = dcEventConstructionMapper.insertDcEventConstruction(dcEvent.getDcEventConstruction());
}
break; break;
//服务区异常 //服务区异常
case 8: case 8:
dcEvent.getDcEventServiceArea().setId(uuid); if (dcEvent.getDcEventServiceArea()!=null){
int i3 = dcEventServiceAreaMapper.insertDcEventServiceArea(dcEvent.getDcEventServiceArea()); dcEvent.getDcEventServiceArea().setId(uuid);
int i3 = dcEventServiceAreaMapper.insertDcEventServiceArea(dcEvent.getDcEventServiceArea());
}
break; break;
//设施设备隐患 //设施设备隐患
case 9: case 9:
break; break;
//异常天气 //异常天气
case 10: case 10:
dcEvent.getDcEventAbnormalWeather().setId(uuid); if (dcEvent.getDcEventAbnormalWeather()!=null){
int i = dcEventAbnormalWeatherMapper.insertDcEventAbnormalWeather(dcEvent.getDcEventAbnormalWeather()); dcEvent.getDcEventAbnormalWeather().setId(uuid);
int i = dcEventAbnormalWeatherMapper.insertDcEventAbnormalWeather(dcEvent.getDcEventAbnormalWeather());
}
break; break;
//其他事件 //其他事件
case 11: case 11:
@ -199,7 +206,7 @@ dcEvent.setUserId(SecurityUtils.getUserId());
} }
return i7; return i7;
}else { } else {
return -1; return -1;
} }
} }
@ -211,18 +218,17 @@ dcEvent.setUserId(SecurityUtils.getUserId());
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateDcEvent(DcEvent dcEvent) public int updateDcEvent(DcEvent dcEvent) {
{
dcEvent.setUpdateTime(DateUtils.getNowDate()); dcEvent.setUpdateTime(DateUtils.getNowDate());
int i7 = dcEventMapper.updateDcEvent(dcEvent); int i7 = dcEventMapper.updateDcEvent(dcEvent);
if (i7>0) { if (i7 > 0) {
//中间库 //中间库
// MdEvent mdEvent = new MdEvent(dcEvent); // MdEvent mdEvent = new MdEvent(dcEvent);
// middleDatabaseService.updateMiddleDatabaseEvent(mdEvent); // middleDatabaseService.updateMiddleDatabaseEvent(mdEvent);
int eventType = Math.toIntExact(dcEvent.getEventType()); int eventType = Math.toIntExact(dcEvent.getEventType());
switch (eventType){ switch (eventType) {
//交通事故 //交通事故
case 1: case 1:
int i1 = dcEventAccidentMapper.updateDcEventAccident(dcEvent.getDcEventAccident()); int i1 = dcEventAccidentMapper.updateDcEventAccident(dcEvent.getDcEventAccident());
@ -270,7 +276,7 @@ dcEvent.setUserId(SecurityUtils.getUserId());
} }
return i7; return i7;
}else { } else {
return -1; return -1;
} }
@ -283,10 +289,9 @@ dcEvent.setUserId(SecurityUtils.getUserId());
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteDcEventByIds( int eventType,String[] ids) public int deleteDcEventByIds(int eventType, String[] ids) {
{
int i7 = dcEventMapper.deleteDcEventByIds(ids); int i7 = dcEventMapper.deleteDcEventByIds(ids);
if (i7>0){ if (i7 > 0) {
switch (eventType) { switch (eventType) {
//交通事故 //交通事故
case 1: case 1:
@ -333,11 +338,12 @@ dcEvent.setUserId(SecurityUtils.getUserId());
default: default:
break; break;
} }
return i7; return i7;
}else { } else {
return -1; return -1;
} }
} }
/** /**
* 删除事件信息信息 * 删除事件信息信息
* *
@ -345,12 +351,12 @@ dcEvent.setUserId(SecurityUtils.getUserId());
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteDcEventById(String id) public int deleteDcEventById(String id) {
{
return dcEventMapper.deleteDcEventById(id); return dcEventMapper.deleteDcEventById(id);
} }
/**调度记录-事件列表 按时间展示交通事件默认当天时间 可查询条件 交通事件状态 时间范围
* /**
* 调度记录-事件列表 按时间展示交通事件默认当天时间 可查询条件 交通事件状态 时间范围
*/ */
@Override @Override
public List<DcEvent> selectDispatchEventList(DcEvent dcEvent) { public List<DcEvent> selectDispatchEventList(DcEvent dcEvent) {
@ -359,82 +365,83 @@ dcEvent.setUserId(SecurityUtils.getUserId());
/** /**
* 获取事件以及子类详细信息 * 获取事件以及子类详细信息
*
* @param eventType * @param eventType
* @param id * @param id
* @return * @return
*/ */
@Override @Override
public DcEvent selectEventSubclassById(int eventType, String id) { public DcEvent selectEventSubclassById(int eventType, String id) {
//todo //todo
DcEvent dcEvent = dcEventMapper.selectDcEventById(id); DcEvent dcEvent = dcEventMapper.selectDcEventById(id);
switch (eventType) { switch (eventType) {
//交通事故 //交通事故
case 1: case 1:
DcEventAccident dcEventAccident = dcEventAccidentMapper.selectDcEventAccidentById(id); DcEventAccident dcEventAccident = dcEventAccidentMapper.selectDcEventAccidentById(id);
dcEvent.setDcEventAccident(dcEventAccident); dcEvent.setDcEventAccident(dcEventAccident);
break; break;
//车辆事故 //车辆事故
case 2: case 2:
DcEventVehicleAccident dcEventVehicleAccident = dcEventVehicleAccidentMapper.selectDcEventVehicleAccidentById(id); DcEventVehicleAccident dcEventVehicleAccident = dcEventVehicleAccidentMapper.selectDcEventVehicleAccidentById(id);
dcEvent.setDcEventVehicleAccident(dcEventVehicleAccident); dcEvent.setDcEventVehicleAccident(dcEventVehicleAccident);
break; break;
//交通管制 //交通管制
case 3: case 3:
DcEventTrafficControl dcEventTrafficControl = dcEventTrafficControlMapper.selectDcEventTrafficControlById(id); DcEventTrafficControl dcEventTrafficControl = dcEventTrafficControlMapper.selectDcEventTrafficControlById(id);
dcEvent.setDcEventTrafficControl(dcEventTrafficControl); dcEvent.setDcEventTrafficControl(dcEventTrafficControl);
break; break;
//交通拥堵 //交通拥堵
case 4: case 4:
DcEventTrafficCongestion dcEventTrafficCongestion = dcEventTrafficCongestionMapper.selectDcEventTrafficCongestionById(id); DcEventTrafficCongestion dcEventTrafficCongestion = dcEventTrafficCongestionMapper.selectDcEventTrafficCongestionById(id);
dcEvent.setDcEventTrafficCongestion(dcEventTrafficCongestion); dcEvent.setDcEventTrafficCongestion(dcEventTrafficCongestion);
break; break;
//非法上路 //非法上路
case 5: case 5:
break; break;
//路障清除 //路障清除
case 6: case 6:
break; break;
//施工建设 //施工建设
case 7: case 7:
DcEventConstruction dcEventConstruction = dcEventConstructionMapper.selectDcEventConstructionById(id); DcEventConstruction dcEventConstruction = dcEventConstructionMapper.selectDcEventConstructionById(id);
dcEvent.setDcEventConstruction(dcEventConstruction); dcEvent.setDcEventConstruction(dcEventConstruction);
break; break;
//服务区异常 //服务区异常
case 8: case 8:
DcEventServiceArea dcEventServiceArea = dcEventServiceAreaMapper.selectDcEventServiceAreaById(id); DcEventServiceArea dcEventServiceArea = dcEventServiceAreaMapper.selectDcEventServiceAreaById(id);
dcEvent.setDcEventServiceArea(dcEventServiceArea); dcEvent.setDcEventServiceArea(dcEventServiceArea);
break; break;
//设施设备隐患 //设施设备隐患
case 9: case 9:
break; break;
//异常天气 //异常天气
case 10: case 10:
DcEventAbnormalWeather dcEventAbnormalWeather = dcEventAbnormalWeatherMapper.selectDcEventAbnormalWeatherById(id); DcEventAbnormalWeather dcEventAbnormalWeather = dcEventAbnormalWeatherMapper.selectDcEventAbnormalWeatherById(id);
dcEvent.setDcEventAbnormalWeather(dcEventAbnormalWeather); dcEvent.setDcEventAbnormalWeather(dcEventAbnormalWeather);
break; break;
//其他事件 //其他事件
case 11: case 11:
break; break;
// //
default: default:
break; break;
} }
return dcEvent; return dcEvent;
} }
@Override @Override
public Map<String,Object> selectCount() { public Map<String, Object> selectCount() {
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
int i = dcWarningMapper.selectCount(); int i = dcWarningMapper.selectCount();
System.out.println("***********************************"+i); System.out.println("***********************************" + i);
List<Map<String,String>> strings = dcEventMapper.selectCount(); List<Map<String, String>> strings = dcEventMapper.selectCount();
for (int i1 = 0; i1 < strings.size(); i1++) { for (int i1 = 0; i1 < strings.size(); i1++) {
strings.get(i1).get("status"); strings.get(i1).get("status");
strings.get(i1).get("count"); strings.get(i1).get("count");
map.put(strings.get(i1).get("status"),strings.get(i1).get("count")); map.put(strings.get(i1).get("status"), strings.get(i1).get("count"));
} }
map.put("warningCount",i); map.put("warningCount", i);
return map; return map;
} }
} }

Loading…
Cancel
Save