From d2556b6616431b24bf5b175b5ad506fd31d5940f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com> Date: Fri, 23 Feb 2024 17:38:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=BD=95=E5=85=A5=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/zc/business/domain/DcEvent.java | 2 +- .../service/impl/DcEventServiceImpl.java | 247 +++++++++--------- 2 files changed, 128 insertions(+), 121 deletions(-) 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 08faa2b1..aa408fac 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 @@ -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; 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 818869e1..aba999b6 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 @@ -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; //施工建设 @@ -50,8 +45,8 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper; private DcEventTrafficCongestionMapper dcEventTrafficCongestionMapper; //车辆事故事件 @Autowired - private DcEventVehicleAccidentMapper dcEventVehicleAccidentMapper; -//交通管制事件 + private DcEventVehicleAccidentMapper dcEventVehicleAccidentMapper; + //交通管制事件 @Autowired private DcEventTrafficControlMapper dcEventTrafficControlMapper; @@ -66,7 +61,6 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper; private IMiddleDatabaseService middleDatabaseService; - /** * 查询事件信息 * @@ -74,12 +68,11 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper; * @return 事件信息 */ @Override - public DcEvent selectDcEventById( String id) - { + public DcEvent selectDcEventById(String id) { DcEvent dcEvent = dcEventMapper.selectDcEventById(id); List processConfigList = dcProcessConfigMapper.selectDcProcessConfigByEventType(Math.toIntExact(dcEvent.getEventType())); - dcEvent.setProcessConfigList(processConfigList); + dcEvent.setProcessConfigList(processConfigList); return dcEvent; } @@ -90,9 +83,8 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper; * @return 事件信息 */ @Override - public List selectDcEventList(DcEvent dcEvent) - { - if (dcEvent.getStakeMark()!=null){ + public List selectDcEventList(DcEvent dcEvent) { + if (dcEvent.getStakeMark() != null) { //处理URl地址栏获取参数+号消失 String replace = dcEvent.getStakeMark().replace(" ", "+"); dcEvent.setStakeMark(replace); @@ -101,7 +93,7 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper; } List dcEventList = dcEventMapper.selectDcEventList(dcEvent); - for (DcEvent dcEvents : dcEventList) { + for (DcEvent dcEvents : dcEventList) { // 根据 deptId 获取部门名称 Long deptId = dcEvents.getDeptId(); String deptName = deptService.selectDeptById(deptId).getDeptName(); @@ -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: - dcEvent.getDcEventAccident().setId(uuid); - int i1 = dcEventAccidentMapper.insertDcEventAccident(dcEvent.getDcEventAccident()); + if (dcEvent.getDcEventAccident() != null) { + dcEvent.getDcEventAccident().setId(uuid); + int i1 = dcEventAccidentMapper.insertDcEventAccident(dcEvent.getDcEventAccident()); + } + break; //车辆事故 case 2: - dcEvent.getDcEventVehicleAccident().setId(uuid); - int i5 = dcEventVehicleAccidentMapper.insertDcEventVehicleAccident(dcEvent.getDcEventVehicleAccident()); + if (dcEvent.getDcEventVehicleAccident()!=null){ + dcEvent.getDcEventVehicleAccident().setId(uuid); + int i5 = dcEventVehicleAccidentMapper.insertDcEventVehicleAccident(dcEvent.getDcEventVehicleAccident()); + } + break; //交通管制 case 3: - dcEvent.getDcEventTrafficControl().setId(uuid); - int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl()); + if (dcEvent.getDcEventTrafficControl()!=null){ + dcEvent.getDcEventTrafficControl().setId(uuid); + int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl()); + } break; //交通拥堵 case 4: - dcEvent.getDcEventTrafficCongestion().setId(uuid); - int i4 = dcEventTrafficCongestionMapper.insertDcEventTrafficCongestion(dcEvent.getDcEventTrafficCongestion()); + 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: - dcEvent.getDcEventConstruction().setId(uuid); - int i2 = dcEventConstructionMapper.insertDcEventConstruction(dcEvent.getDcEventConstruction()); + if (dcEvent.getDcEventConstruction()!=null){ + dcEvent.getDcEventConstruction().setId(uuid); + int i2 = dcEventConstructionMapper.insertDcEventConstruction(dcEvent.getDcEventConstruction()); + } + break; //服务区异常 case 8: - dcEvent.getDcEventServiceArea().setId(uuid); - int i3 = dcEventServiceAreaMapper.insertDcEventServiceArea(dcEvent.getDcEventServiceArea()); + if (dcEvent.getDcEventServiceArea()!=null){ + dcEvent.getDcEventServiceArea().setId(uuid); + int i3 = dcEventServiceAreaMapper.insertDcEventServiceArea(dcEvent.getDcEventServiceArea()); + } break; //设施设备隐患 case 9: break; //异常天气 case 10: - dcEvent.getDcEventAbnormalWeather().setId(uuid); - int i = dcEventAbnormalWeatherMapper.insertDcEventAbnormalWeather(dcEvent.getDcEventAbnormalWeather()); + 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: @@ -333,11 +338,12 @@ dcEvent.setUserId(SecurityUtils.getUserId()); default: break; } - return i7; - }else { + return i7; + } 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 selectDispatchEventList(DcEvent dcEvent) { @@ -359,82 +365,83 @@ dcEvent.setUserId(SecurityUtils.getUserId()); /** * 获取事件以及子类详细信息 + * * @param eventType * @param id * @return */ @Override public DcEvent selectEventSubclassById(int eventType, String id) { - //todo - DcEvent dcEvent = dcEventMapper.selectDcEventById(id); - switch (eventType) { - //交通事故 - case 1: - DcEventAccident dcEventAccident = dcEventAccidentMapper.selectDcEventAccidentById(id); - dcEvent.setDcEventAccident(dcEventAccident); - break; - //车辆事故 - case 2: - DcEventVehicleAccident dcEventVehicleAccident = dcEventVehicleAccidentMapper.selectDcEventVehicleAccidentById(id); - dcEvent.setDcEventVehicleAccident(dcEventVehicleAccident); - break; - //交通管制 - case 3: - DcEventTrafficControl dcEventTrafficControl = dcEventTrafficControlMapper.selectDcEventTrafficControlById(id); - dcEvent.setDcEventTrafficControl(dcEventTrafficControl); - break; - //交通拥堵 - case 4: - DcEventTrafficCongestion dcEventTrafficCongestion = dcEventTrafficCongestionMapper.selectDcEventTrafficCongestionById(id); - dcEvent.setDcEventTrafficCongestion(dcEventTrafficCongestion); - break; - //非法上路 - case 5: - break; - //路障清除 - case 6: - break; - //施工建设 - case 7: - DcEventConstruction dcEventConstruction = dcEventConstructionMapper.selectDcEventConstructionById(id); - dcEvent.setDcEventConstruction(dcEventConstruction); - break; - //服务区异常 - case 8: - DcEventServiceArea dcEventServiceArea = dcEventServiceAreaMapper.selectDcEventServiceAreaById(id); - dcEvent.setDcEventServiceArea(dcEventServiceArea); - break; - //设施设备隐患 - case 9: - break; - //异常天气 - case 10: - DcEventAbnormalWeather dcEventAbnormalWeather = dcEventAbnormalWeatherMapper.selectDcEventAbnormalWeatherById(id); - dcEvent.setDcEventAbnormalWeather(dcEventAbnormalWeather); - break; - //其他事件 - case 11: - break; - // - default: - break; - } - return dcEvent; + //todo + DcEvent dcEvent = dcEventMapper.selectDcEventById(id); + switch (eventType) { + //交通事故 + case 1: + DcEventAccident dcEventAccident = dcEventAccidentMapper.selectDcEventAccidentById(id); + dcEvent.setDcEventAccident(dcEventAccident); + break; + //车辆事故 + case 2: + DcEventVehicleAccident dcEventVehicleAccident = dcEventVehicleAccidentMapper.selectDcEventVehicleAccidentById(id); + dcEvent.setDcEventVehicleAccident(dcEventVehicleAccident); + break; + //交通管制 + case 3: + DcEventTrafficControl dcEventTrafficControl = dcEventTrafficControlMapper.selectDcEventTrafficControlById(id); + dcEvent.setDcEventTrafficControl(dcEventTrafficControl); + break; + //交通拥堵 + case 4: + DcEventTrafficCongestion dcEventTrafficCongestion = dcEventTrafficCongestionMapper.selectDcEventTrafficCongestionById(id); + dcEvent.setDcEventTrafficCongestion(dcEventTrafficCongestion); + break; + //非法上路 + case 5: + break; + //路障清除 + case 6: + break; + //施工建设 + case 7: + DcEventConstruction dcEventConstruction = dcEventConstructionMapper.selectDcEventConstructionById(id); + dcEvent.setDcEventConstruction(dcEventConstruction); + break; + //服务区异常 + case 8: + DcEventServiceArea dcEventServiceArea = dcEventServiceAreaMapper.selectDcEventServiceAreaById(id); + dcEvent.setDcEventServiceArea(dcEventServiceArea); + break; + //设施设备隐患 + case 9: + break; + //异常天气 + case 10: + DcEventAbnormalWeather dcEventAbnormalWeather = dcEventAbnormalWeatherMapper.selectDcEventAbnormalWeatherById(id); + dcEvent.setDcEventAbnormalWeather(dcEventAbnormalWeather); + break; + //其他事件 + case 11: + break; + // + default: + break; + } + return dcEvent; } @Override - public Map selectCount() { -Map map = new HashMap<>(); + public Map selectCount() { + Map map = new HashMap<>(); int i = dcWarningMapper.selectCount(); - System.out.println("***********************************"+i); - List> strings = dcEventMapper.selectCount(); + System.out.println("***********************************" + i); + List> 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; } }