|
|
@ -1,17 +1,20 @@ |
|
|
|
package com.zc.business.service.impl; |
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult; |
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser; |
|
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
|
import com.ruoyi.common.utils.SecurityUtils; |
|
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
|
import com.zc.business.domain.DcEventProcess; |
|
|
|
import com.zc.business.domain.*; |
|
|
|
import com.zc.business.mapper.*; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import com.zc.business.mapper.DcEventImportantFileMapper; |
|
|
|
import com.zc.business.domain.DcEventImportantFile; |
|
|
|
import com.zc.business.service.IDcEventImportantFileService; |
|
|
|
|
|
|
|
/** |
|
|
@ -27,6 +30,16 @@ public class DcEventImportantFileServiceImpl implements IDcEventImportantFileSer |
|
|
|
private DcEventImportantFileMapper dcEventImportantFileMapper; |
|
|
|
@Autowired |
|
|
|
private DcEventProcessServiceImpl dcEventProcessService; |
|
|
|
@Autowired |
|
|
|
private DcEventServiceImpl dcEventService; |
|
|
|
@Autowired |
|
|
|
private DcEventMapper dcEventMapper; |
|
|
|
@Autowired |
|
|
|
private DcEventAccidentMapper dcEventAccidentMapper; |
|
|
|
@Autowired |
|
|
|
private DcEventTrafficCongestionMapper dcEventTrafficCongestionMapper; |
|
|
|
@Autowired |
|
|
|
private DcEventImportantMapper dcEventImportantMapper; |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询重要事件文件内容 |
|
|
@ -153,4 +166,225 @@ public class DcEventImportantFileServiceImpl implements IDcEventImportantFileSer |
|
|
|
return AjaxResult.success(num); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 生成重要事件文件内容 |
|
|
|
* |
|
|
|
* @author liuwenge |
|
|
|
* @date 2024/5/8 15:51 |
|
|
|
* @param eventId 事件id |
|
|
|
* @param type 类型 1:初报,2续报,3终报 |
|
|
|
* @return com.ruoyi.common.core.domain.AjaxResult |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public AjaxResult generate(String eventId,String type){ |
|
|
|
|
|
|
|
if (StringUtils.isEmpty(eventId) || StringUtils.isEmpty(type)){ |
|
|
|
return AjaxResult.error("参数错误!"); |
|
|
|
} |
|
|
|
DcEvent dcEvent = dcEventMapper.selectDcEventById(eventId); |
|
|
|
if (dcEvent == null){ |
|
|
|
return AjaxResult.error("事件查询失败,请检查事件id是否正确!"); |
|
|
|
} |
|
|
|
String eventType = dcEvent.getEventType().toString(); |
|
|
|
if ("1".equals(eventType) && "4".equals(eventType)){ |
|
|
|
return AjaxResult.error("事件类型错误!"); |
|
|
|
} |
|
|
|
|
|
|
|
DcEventImportantFile dcEventImportantFile = new DcEventImportantFile(); |
|
|
|
dcEventImportantFile.setFromDept("齐鲁高速股份有限公司"); |
|
|
|
SimpleDateFormat df = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分"); |
|
|
|
String createTime = df.format(new Date()); |
|
|
|
dcEventImportantFile.setCreateTime(createTime); |
|
|
|
|
|
|
|
String title = "关于G35济菏高速" + dcEvent.getStakeMark() + "交通事故"; |
|
|
|
if ("1".equals(type)){ |
|
|
|
title += "的初报"; |
|
|
|
} else if ("2".equals(type)){ |
|
|
|
title += "的续报"; |
|
|
|
} else if ("3".equals(type)){ |
|
|
|
title += "的终报"; |
|
|
|
} |
|
|
|
dcEventImportantFile.setTitle(title); |
|
|
|
|
|
|
|
dcEventImportantFile.setToDept("智慧管理中心:"); |
|
|
|
|
|
|
|
String content = "\t" + df.format(dcEvent.getOccurrenceTime()) + ",G35济菏高速" + dcEvent.getStakeMark(); |
|
|
|
if ("1".equals(dcEvent.getDirection()) || "菏泽方向".equals(dcEvent.getDirection())) { |
|
|
|
content += "菏泽方向"; |
|
|
|
} else if ("3".equals(dcEvent.getDirection()) || "济南方向".equals(dcEvent.getDirection())) { |
|
|
|
content += "济南方向"; |
|
|
|
} |
|
|
|
content += "发生"; |
|
|
|
if ("1-1".equals(dcEvent.getEventSubclass()) || "追尾".equals(dcEvent.getEventSubclass())) { |
|
|
|
content += "追尾"; |
|
|
|
} else if ("1-2".equals(dcEvent.getEventSubclass()) || "侧翻".equals(dcEvent.getEventSubclass())) { |
|
|
|
content += "侧翻"; |
|
|
|
} else if ("1-3".equals(dcEvent.getEventSubclass()) || "撞护栏".equals(dcEvent.getEventSubclass())) { |
|
|
|
content += "撞护栏"; |
|
|
|
} else if ("1-4".equals(dcEvent.getEventSubclass()) || "自燃".equals(dcEvent.getEventSubclass())) { |
|
|
|
content += "自燃"; |
|
|
|
} else if ("1-5".equals(dcEvent.getEventSubclass()) || "其他".equals(dcEvent.getEventSubclass())){ |
|
|
|
content += "其他"; |
|
|
|
} else if ("4-1".equals(dcEvent.getEventSubclass()) || "道路拥堵".equals(dcEvent.getEventSubclass())){ |
|
|
|
content += "道路拥堵"; |
|
|
|
} else if ("4-2".equals(dcEvent.getEventSubclass()) || "立交拥堵".equals(dcEvent.getEventSubclass())){ |
|
|
|
content += "立交拥堵"; |
|
|
|
} else if ("4-3".equals(dcEvent.getEventSubclass()) || "收费站拥堵".equals(dcEvent.getEventSubclass())){ |
|
|
|
content += "收费站拥堵"; |
|
|
|
} else if ("4-4".equals(dcEvent.getEventSubclass()) || "服务区拥堵".equals(dcEvent.getEventSubclass())){ |
|
|
|
content += "服务区拥堵"; |
|
|
|
} |
|
|
|
content += "事故。"; |
|
|
|
|
|
|
|
if ("1".equals(type) || "2".equals(type)) { |
|
|
|
|
|
|
|
//占用车道
|
|
|
|
if (StringUtils.isNotEmpty(dcEvent.getLang())) { |
|
|
|
String[] langArr = dcEvent.getLang().split(","); |
|
|
|
content += "事故占用"; |
|
|
|
for (String lang : langArr) { |
|
|
|
if ("0".equals(lang)) { |
|
|
|
content += "应急车道、"; |
|
|
|
} else if ("1".equals(lang)) { |
|
|
|
content += "行1车道、"; |
|
|
|
} else if ("2".equals(lang)) { |
|
|
|
content += "行2车道、"; |
|
|
|
} else if ("3".equals(lang)) { |
|
|
|
content += "行3车道、"; |
|
|
|
} else if ("4".equals(lang)) { |
|
|
|
content += "行4车道、"; |
|
|
|
} |
|
|
|
} |
|
|
|
content = content.substring(0, content.length() - 1); |
|
|
|
content += ","; |
|
|
|
|
|
|
|
String[] langAll = {"1", "2", "3", "4", "0"}; |
|
|
|
HashSet<String> diff = new HashSet<>(Arrays.asList(langAll)); |
|
|
|
diff.removeAll(Arrays.asList(langArr)); |
|
|
|
for (String s : diff) { |
|
|
|
if ("0".equals(s)) { |
|
|
|
content += "应急车道、"; |
|
|
|
} else if ("1".equals(s)) { |
|
|
|
content += "行1车道、"; |
|
|
|
} else if ("2".equals(s)) { |
|
|
|
content += "行2车道、"; |
|
|
|
} else if ("3".equals(s)) { |
|
|
|
content += "行3车道、"; |
|
|
|
} else if ("4".equals(s)) { |
|
|
|
content += "行4车道、"; |
|
|
|
} |
|
|
|
} |
|
|
|
content = content.substring(0, content.length() - 1); |
|
|
|
content += "正常通行,"; |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
content += "行1车道、行2车道、行3车道、行4车道、应急车道正常通行,"; |
|
|
|
} |
|
|
|
|
|
|
|
//压车情况
|
|
|
|
if ("1".equals(eventType)) { |
|
|
|
DcEventAccident dcEventAccident = dcEventAccidentMapper.selectDcEventAccidentById(eventId); |
|
|
|
if (dcEventAccident != null && dcEventAccident.getTrafficJam() != null && dcEventAccident.getTrafficJam() > 0f) { |
|
|
|
content += "压车" + dcEventAccident.getTrafficJam() + "公里。\n\t"; |
|
|
|
} else { |
|
|
|
content += "无压车。\n\t"; |
|
|
|
} |
|
|
|
} else if ("4".equals(eventType)){ |
|
|
|
DcEventTrafficCongestion dcEventTrafficCongestion = dcEventTrafficCongestionMapper.selectDcEventTrafficCongestionById(eventId); |
|
|
|
if (dcEventTrafficCongestion != null && dcEventTrafficCongestion.getCongestionMileage() != null && dcEventTrafficCongestion.getCongestionMileage() > 0f) { |
|
|
|
content += "压车" + dcEventTrafficCongestion.getCongestionMileage() + "公里。\n\t"; |
|
|
|
} else { |
|
|
|
content += "无压车。\n\t"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//到达现场情况
|
|
|
|
DcEventImportant dcEventImportant = dcEventImportantMapper.selectDcEventImportantByEventId(eventId); |
|
|
|
if (dcEventImportant == null){ |
|
|
|
dcEventImportant = new DcEventImportant(); |
|
|
|
dcEventImportant.setEventId(eventId); |
|
|
|
dcEventImportant.setTrafficPoliceStatus(0); |
|
|
|
dcEventImportant.setMedicalStatus(0); |
|
|
|
dcEventImportant.setFireStatus(0); |
|
|
|
dcEventImportant.setBoardStatus(0); |
|
|
|
dcEventImportantMapper.insertDcEventImportant(dcEventImportant); |
|
|
|
} |
|
|
|
if (StringUtils.isNotEmpty(dcEventImportant.getPlateNumber())) { |
|
|
|
content += "现场事故车辆及车牌号信息:" + dcEventImportant.getPlateNumber() + "。"; |
|
|
|
} |
|
|
|
|
|
|
|
String arrived = ""; |
|
|
|
String notArrived = "路管、"; |
|
|
|
if (dcEventImportant.getTrafficPoliceStatus() == 1) { |
|
|
|
arrived += "交警、"; |
|
|
|
} else { |
|
|
|
notArrived += "交警、"; |
|
|
|
} |
|
|
|
if (dcEventImportant.getMedicalStatus() == 1) { |
|
|
|
arrived += "医疗、"; |
|
|
|
} else { |
|
|
|
notArrived += "医疗、"; |
|
|
|
} |
|
|
|
if (dcEventImportant.getFireStatus() == 1) { |
|
|
|
arrived += "消防、"; |
|
|
|
} else { |
|
|
|
notArrived += "消防、"; |
|
|
|
} |
|
|
|
if (arrived.length() > 0) { |
|
|
|
arrived = arrived.substring(0, arrived.length() - 1); |
|
|
|
content += arrived + "等单位已到达现场。"; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(dcEventImportant.getCurrentProgress())) { |
|
|
|
content += "事故目前处置进度为" + dcEventImportant.getCurrentProgress() + "。"; |
|
|
|
} |
|
|
|
if (StringUtils.isNotEmpty(dcEventImportant.getTakeSteps())) { |
|
|
|
content += "已采取的措施:" + dcEventImportant.getTakeSteps() + "。"; |
|
|
|
} |
|
|
|
if (StringUtils.isNotEmpty(dcEventImportant.getTakeSteps())) { |
|
|
|
content += "在" + dcEventImportant.getTakeSteps() + "进行分流。"; |
|
|
|
} |
|
|
|
|
|
|
|
if (dcEventImportant.getBoardStatus() == 1) { |
|
|
|
content += "事故点后方情报板已经做好信息提示。"; |
|
|
|
} |
|
|
|
content += "\n"; |
|
|
|
|
|
|
|
notArrived = notArrived.substring(0, notArrived.length() - 1); |
|
|
|
content += "\t" + notArrived + "等单位正在赶往现场。"; |
|
|
|
|
|
|
|
if ("1".equals(type)) { |
|
|
|
content += "具体情况稍后报告。"; |
|
|
|
} else if ("2".equals(type)) { |
|
|
|
if (dcEvent.getEstimatedEndTime() != null) { |
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("HH时mm分"); |
|
|
|
content += "预计结束时间为" + dateFormat.format(dcEvent.getEstimatedEndTime()) + "。"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
dcEventImportantFile.setContent(content); |
|
|
|
|
|
|
|
|
|
|
|
} else if ("3".equals(type)){ |
|
|
|
content += "\n\t"; |
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("HH时mm分"); |
|
|
|
content += dateFormat.format(new Date()) + ",事故处理完毕,道路恢复畅通。"; |
|
|
|
dcEventImportantFile.setContent(content); |
|
|
|
|
|
|
|
} else { |
|
|
|
return AjaxResult.error("文件类型错误!"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SysUser user = SecurityUtils.getLoginUser().getUser(); |
|
|
|
dcEventImportantFile.setCreateName(user.getNickName()); |
|
|
|
dcEventImportantFile.setPhoneNumber(user.getPhonenumber()); |
|
|
|
dcEventImportantFile.setType(type); |
|
|
|
dcEventImportantFile.setStatus("0"); |
|
|
|
|
|
|
|
return AjaxResult.success(dcEventImportantFile); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|