Browse Source

事件录入判断

develop
王兴琳 1 year ago
parent
commit
d2556b6616
  1. 2
      zc-business/src/main/java/com/zc/business/domain/DcEvent.java
  2. 101
      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-4 服务区封闭和限行
*/
@Excel(name = "设备编号")
@Excel(name = "事件类型")
@ApiModelProperty("事件子类 例:事件子类:* 1-1 追尾* 1-2 侧翻* 1-3 撞护栏* 1-4 自然* 1-5 其他事故* 2-1 车辆故障")
private String eventSubclass;

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

@ -1,13 +1,5 @@
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.SecurityUtils;
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.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 事件信息Service业务层处理
@ -29,14 +25,13 @@ import org.springframework.transaction.annotation.Transactional;
*/
@Service
@Transactional
public class DcEventServiceImpl implements IDcEventService
{
public class DcEventServiceImpl implements IDcEventService {
@Autowired
private DcEventMapper dcEventMapper;
//异常天气
@Autowired
private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper;
//交通事故事件
@Autowired
private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper;
//交通事故事件
@Autowired
private DcEventAccidentMapper dcEventAccidentMapper;
//施工建设
@ -51,7 +46,7 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper;
//车辆事故事件
@Autowired
private DcEventVehicleAccidentMapper dcEventVehicleAccidentMapper;
//交通管制事件
//交通管制事件
@Autowired
private DcEventTrafficControlMapper dcEventTrafficControlMapper;
@ -66,7 +61,6 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper;
private IMiddleDatabaseService middleDatabaseService;
/**
* 查询事件信息
*
@ -74,8 +68,7 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper;
* @return 事件信息
*/
@Override
public DcEvent selectDcEventById( String id)
{
public DcEvent selectDcEventById(String id) {
DcEvent dcEvent = dcEventMapper.selectDcEventById(id);
List<DcProcessConfig> processConfigList = dcProcessConfigMapper.selectDcProcessConfigByEventType(Math.toIntExact(dcEvent.getEventType()));
@ -90,9 +83,8 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper;
* @return 事件信息
*/
@Override
public List<DcEvent> selectDcEventList(DcEvent dcEvent)
{
if (dcEvent.getStakeMark()!=null){
public List<DcEvent> selectDcEventList(DcEvent dcEvent) {
if (dcEvent.getStakeMark() != null) {
//处理URl地址栏获取参数+号消失
String replace = dcEvent.getStakeMark().replace(" ", "+");
dcEvent.setStakeMark(replace);
@ -120,23 +112,21 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper;
* @return 结果
*/
@Override
public int insertDcEvent(DcEvent dcEvent)
{
public int insertDcEvent(DcEvent dcEvent) {
//设置事件Id UUID无下划线格式32
String uuid = IdUtils.fastSimpleUUID();
dcEvent.setId(uuid);
dcEvent.setEventState(0L);
//获取部门信息
dcEvent.setDeptId(SecurityUtils.getDeptId());
dcEvent.setDeptId(SecurityUtils.getDeptId());
//用户
dcEvent.setUserId(SecurityUtils.getUserId());
dcEvent.setUserId(SecurityUtils.getUserId());
dcEvent.setCreateTime(DateUtils.getNowDate());
int i7 = dcEventMapper.insertDcEvent(dcEvent);
if (i7>0){
if (i7 > 0) {
//中间库
// MdEvent mdEvent = new MdEvent(dcEvent);
@ -144,26 +134,36 @@ dcEvent.setUserId(SecurityUtils.getUserId());
//获取事件类型
int eventType = Math.toIntExact(dcEvent.getEventType());
switch (eventType){
switch (eventType) {
//交通事故
case 1:
if (dcEvent.getDcEventAccident() != null) {
dcEvent.getDcEventAccident().setId(uuid);
int i1 = dcEventAccidentMapper.insertDcEventAccident(dcEvent.getDcEventAccident());
}
break;
//车辆事故
case 2:
if (dcEvent.getDcEventVehicleAccident()!=null){
dcEvent.getDcEventVehicleAccident().setId(uuid);
int i5 = dcEventVehicleAccidentMapper.insertDcEventVehicleAccident(dcEvent.getDcEventVehicleAccident());
}
break;
//交通管制
case 3:
if (dcEvent.getDcEventTrafficControl()!=null){
dcEvent.getDcEventTrafficControl().setId(uuid);
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl());
}
break;
//交通拥堵
case 4:
if (dcEvent.getDcEventTrafficCongestion()!=null){
dcEvent.getDcEventTrafficCongestion().setId(uuid);
int i4 = dcEventTrafficCongestionMapper.insertDcEventTrafficCongestion(dcEvent.getDcEventTrafficCongestion());
}
break;
//非法上路
@ -174,21 +174,28 @@ dcEvent.setUserId(SecurityUtils.getUserId());
break;
//施工建设
case 7:
if (dcEvent.getDcEventConstruction()!=null){
dcEvent.getDcEventConstruction().setId(uuid);
int i2 = dcEventConstructionMapper.insertDcEventConstruction(dcEvent.getDcEventConstruction());
}
break;
//服务区异常
case 8:
if (dcEvent.getDcEventServiceArea()!=null){
dcEvent.getDcEventServiceArea().setId(uuid);
int i3 = dcEventServiceAreaMapper.insertDcEventServiceArea(dcEvent.getDcEventServiceArea());
}
break;
//设施设备隐患
case 9:
break;
//异常天气
case 10:
if (dcEvent.getDcEventAbnormalWeather()!=null){
dcEvent.getDcEventAbnormalWeather().setId(uuid);
int i = dcEventAbnormalWeatherMapper.insertDcEventAbnormalWeather(dcEvent.getDcEventAbnormalWeather());
}
break;
//其他事件
case 11:
@ -199,7 +206,7 @@ dcEvent.setUserId(SecurityUtils.getUserId());
}
return i7;
}else {
} else {
return -1;
}
}
@ -211,18 +218,17 @@ dcEvent.setUserId(SecurityUtils.getUserId());
* @return 结果
*/
@Override
public int updateDcEvent(DcEvent dcEvent)
{
public int updateDcEvent(DcEvent dcEvent) {
dcEvent.setUpdateTime(DateUtils.getNowDate());
int i7 = dcEventMapper.updateDcEvent(dcEvent);
if (i7>0) {
if (i7 > 0) {
//中间库
// MdEvent mdEvent = new MdEvent(dcEvent);
// middleDatabaseService.updateMiddleDatabaseEvent(mdEvent);
int eventType = Math.toIntExact(dcEvent.getEventType());
switch (eventType){
switch (eventType) {
//交通事故
case 1:
int i1 = dcEventAccidentMapper.updateDcEventAccident(dcEvent.getDcEventAccident());
@ -270,7 +276,7 @@ dcEvent.setUserId(SecurityUtils.getUserId());
}
return i7;
}else {
} else {
return -1;
}
@ -283,10 +289,9 @@ dcEvent.setUserId(SecurityUtils.getUserId());
* @return 结果
*/
@Override
public int deleteDcEventByIds( int eventType,String[] ids)
{
public int deleteDcEventByIds(int eventType, String[] ids) {
int i7 = dcEventMapper.deleteDcEventByIds(ids);
if (i7>0){
if (i7 > 0) {
switch (eventType) {
//交通事故
case 1:
@ -334,10 +339,11 @@ dcEvent.setUserId(SecurityUtils.getUserId());
break;
}
return i7;
}else {
} else {
return -1;
}
}
/**
* 删除事件信息信息
*
@ -345,12 +351,12 @@ dcEvent.setUserId(SecurityUtils.getUserId());
* @return 结果
*/
@Override
public int deleteDcEventById(String id)
{
public int deleteDcEventById(String id) {
return dcEventMapper.deleteDcEventById(id);
}
/**调度记录-事件列表 按时间展示交通事件默认当天时间 可查询条件 交通事件状态 时间范围
*
/**
* 调度记录-事件列表 按时间展示交通事件默认当天时间 可查询条件 交通事件状态 时间范围
*/
@Override
public List<DcEvent> selectDispatchEventList(DcEvent dcEvent) {
@ -359,6 +365,7 @@ dcEvent.setUserId(SecurityUtils.getUserId());
/**
* 获取事件以及子类详细信息
*
* @param eventType
* @param id
* @return
@ -424,17 +431,17 @@ dcEvent.setUserId(SecurityUtils.getUserId());
}
@Override
public Map<String,Object> selectCount() {
Map<String,Object> map = new HashMap<>();
public Map<String, Object> selectCount() {
Map<String, Object> map = new HashMap<>();
int i = dcWarningMapper.selectCount();
System.out.println("***********************************"+i);
List<Map<String,String>> strings = dcEventMapper.selectCount();
System.out.println("***********************************" + i);
List<Map<String, String>> strings = dcEventMapper.selectCount();
for (int i1 = 0; i1 < strings.size(); i1++) {
strings.get(i1).get("status");
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;
}
}

Loading…
Cancel
Save