Browse Source

Merge remote-tracking branch 'origin/develop' into develop

develop
zhaoxianglong 10 months ago
parent
commit
d1784d7815
  1. 23
      zc-business/src/main/java/com/zc/business/controller/DcEventController.java
  2. 23
      zc-business/src/main/java/com/zc/business/controller/DcWarningController.java
  3. 69
      zc-business/src/main/java/com/zc/business/domain/DcEvent.java
  4. 2
      zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java
  5. 2
      zc-business/src/main/java/com/zc/business/mapper/DcEventProcessMapper.java
  6. 11
      zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java
  7. 2
      zc-business/src/main/java/com/zc/business/service/IDcEventProcessService.java
  8. 12
      zc-business/src/main/java/com/zc/business/service/IDcEventService.java
  9. 6
      zc-business/src/main/java/com/zc/business/service/IDcWarningService.java
  10. 5
      zc-business/src/main/java/com/zc/business/service/impl/DcEventProcessServiceImpl.java
  11. 153
      zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
  12. 2
      zc-business/src/main/java/com/zc/business/service/impl/DcFacilityServiceImpl.java
  13. 215
      zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java
  14. 38
      zc-business/src/main/resources/mapper/business/DcEventMapper.xml
  15. 5
      zc-business/src/main/resources/mapper/business/DcEventProcessMapper.xml
  16. 37
      zc-business/src/main/resources/mapper/business/DcWarningMapper.xml

23
zc-business/src/main/java/com/zc/business/controller/DcEventController.java

@ -204,4 +204,27 @@ public class DcEventController extends BaseController
public AjaxResult skipClear(@ApiParam(value="事件id", name="eventId", required=true) @RequestParam ("eventId") String eventId){
return dcEventService.skipClear(eventId);
}
@ApiOperation("调度记录-事件列表 按时间展示交通事件,默认当天时间 。可查询条件 交通事件状态 ,时间范围")
@GetMapping("/dispatchRecordEventList")
public TableDataInfo dispatchRecordEventList(DcEvent dcEvent){
List<DcEvent> list = dcEventService.dispatchRecordEventList(dcEvent);
return getDataTable(list);
}
/**
* @Description 查询关联事件
*
* @author liuwenge
* @date 2024/5/30 14:27
* @param eventId
* @return com.ruoyi.common.core.domain.AjaxResult
*/
@ApiOperation("查询关联事件")
@GetMapping( "/getLinkEvent/{eventId}")
public AjaxResult getLinkEvent(@ApiParam(name = "eventId", value = "事件id", required = true) @PathVariable("eventId") String eventId){
return dcEventService.getLinkEvent(eventId);
}
}

23
zc-business/src/main/java/com/zc/business/controller/DcWarningController.java

@ -160,7 +160,7 @@ public class DcWarningController extends BaseController
return dcWarningService.batchConvert(dcWarningBatchConvert);
}
//指挥调度
//1,指挥调度,查看是否存在记录和资源信息,存在即返回
@PostMapping("/commandAndDispatch")
public AjaxResult commandAndDispatch(@RequestBody DcWarning dcWarning){
if (StringUtils.isBlank(dcWarning.getStakeMark())||StringUtils.isBlank(dcWarning.getId())){
@ -168,6 +168,22 @@ public class DcWarningController extends BaseController
}
return (dcWarningService.commandAndDispatch(dcWarning));
}
//2,指挥调度,当调度信息为空的时候调用智能分配资源
@PostMapping("/intelligentSource")
public AjaxResult intelligentSource(@RequestBody DcWarning dcWarning){
if (StringUtils.isBlank(dcWarning.getStakeMark())){
return AjaxResult.error("参数错误");
}
return (dcWarningService.intelligentSource(dcWarning));
}
//3.指挥调度,新增调度记录信息
@PostMapping("/insertDispatch")
public AjaxResult insertDispatch(@RequestBody HashMap map){
if (map == null || !map.containsKey("eventId")||StringUtils.isBlank(map.get("eventId").toString())){
return AjaxResult.error("参数错误");
}
return (dcWarningService.insertDispatch(map));
}
//指挥调度记录修改
@PostMapping("/updateDispatch")
public AjaxResult insertDispatch(@RequestBody DcDispatch dcDispatch){
@ -176,12 +192,9 @@ public class DcWarningController extends BaseController
}
return toAjax(dcWarningService.insertDispatch(dcDispatch));
}
//指挥调度资源新增
//4.指挥调度资源新增(用户修改弹窗的提交)
@PostMapping("/updateSource")
public AjaxResult insertDispatchSource(@RequestBody HashMap map){
if (map==null||!map.containsKey("dispatchId")){
return AjaxResult.error("参数错误");
}
return toAjax(dcWarningService.insertDispatchSource(map));
}
//感知事件误报

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

@ -1,16 +1,16 @@
package com.zc.business.domain;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.ruoyi.common.annotation.Excel;
import java.util.Date;
import java.util.List;
/**
* 事件信息对象 dc_event
@ -58,8 +58,8 @@ public class DcEvent {
* 2-
* 3-
*/
@Excel(name = "方向", readConverterExp = "1=菏泽方向,3=济南方向")
//@Excel(name = "方向")
@Excel(name = "方向", readConverterExp = "1=菏泽方向,3=济南方向")
//@Excel(name = "方向")
@ApiModelProperty("方向")
private String direction;
@ -69,7 +69,7 @@ public class DcEvent {
@ApiModelProperty("处理人员")
private Long userId;
@ApiModelProperty("事件子类")
@ApiModelProperty("事件子类")
private String eventSubclassName;
/**
@ -156,12 +156,12 @@ public class DcEvent {
private String description;
/**
* 事件状态
事件状态
0-待确认
1-已确认
2-处理中
3-已完成
4-已撤销
* 事件状态
* 0-待确认
* 1-已确认
* 2-处理中
* 3-已完成
* 4-已撤销
*/
@ApiModelProperty("事件状态 事件状态:* 0-未解决1-已解决2-已关闭")
private Long eventState;
@ -200,7 +200,7 @@ public class DcEvent {
/**
* 是否处在隧道
*/
@Excel(name = "是否处在隧道" , readConverterExp = "0=否,1=是")
@Excel(name = "是否处在隧道", readConverterExp = "0=否,1=是")
@ApiModelProperty("是否处在隧道 0 表示 false,1 表示 true")
private Integer inTunnel;
//@Excel(name = "高速")
@ -214,27 +214,27 @@ public class DcEvent {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("发生时间")
private Date occurrenceTime;
@Excel(name = "是否是感知事件" , readConverterExp = "0=否,1=是")
@Excel(name = "是否是感知事件", readConverterExp = "0=否,1=是")
@ApiModelProperty("是否是感知事件 0 表示 false,1 表示 true")
private Integer isPerceived;
@Excel(name = "影响车道")
@ApiModelProperty("影响车道 车道占用:0-应急1-行1,2-行2,3-行3,4-行4")
@ApiModelProperty("影响车道 车道占用:0-应急1-行1,2-行2,3-行3,4-行4")
private String lang;
@ApiModelProperty("高速名")
@TableField(exist = false)
private String roadName;
private String roadName;
@ApiModelProperty("机构")
@TableField(exist = false)
private String organizationName;
private String organizationName;
@ApiModelProperty("事件流程")
@TableField(exist = false)
private List<DcProcessConfig> processConfigList;
@ApiModelProperty("事件标题")
private List<DcProcessConfig> processConfigList;
@ApiModelProperty("事件标题")
private String eventTitle;
@ApiModelProperty("维度")
@ApiModelProperty("维度")
private String dimension;
@ApiModelProperty("经度")
@ApiModelProperty("经度")
private String longitude;
/**
* 2014/2/21新增
@ -291,20 +291,29 @@ public class DcEvent {
private String processNode;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
/**
* 更新时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/** 备注 */
/**
* 备注
*/
private String remark;
private String subclass;
@ApiModelProperty("关联管制事件id")
private String linkId;
@ApiModelProperty("关联管制事件id")
private String linkId;
@TableField(exist = false)
private List<DcEventProcess> dcEventProcessList;
}

2
zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java

@ -119,6 +119,8 @@ public interface DcEventMapper extends BaseMapper<DcEvent>
boolean completeEvent(@Param("eventId") String eventId);
int selectClearInfo(String eventId);
List<DcEvent> dispatchRecordEventList(DcEvent dcEvent);
}

2
zc-business/src/main/java/com/zc/business/mapper/DcEventProcessMapper.java

@ -87,4 +87,6 @@ public interface DcEventProcessMapper
* @return 状态 0未完成 1已完成
*/
int selectPreviousNodeStatus(@Param("eventId") String eventId, @Param("processId") Long processId);
List<DcEventProcess> selectDcEventProcessByEventId(String eventId);
}

11
zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java

@ -99,6 +99,7 @@ public interface DcWarningMapper
public Integer updateEndSection(@Param("dcWarningList") List<DcWarning> dcWarningList);
//查询当天全部可以结束的事件
public List<DcWarning> selectEndSection();
//依据桩号返回驻点id
public Long selectSectionId(@Param("stakeMark")String stakeMark,@Param("direction")String direction);
//依据桩号获取最近距离的驻点
@ -130,6 +131,8 @@ public interface DcWarningMapper
public HashMap<String,Object> selectOrganization();
//选中的人员信息
public List<HashMap<String,Object>> selectEmployeesChoice(@Param("dispatchId")Long dispatchId);
//查询最近的交警人员和电话
public List<HashMap<String,Object>> selectTrafficPolice(@Param("organizationId")Long organizationId);
//选中的车辆信息
public List<HashMap<String,Object>> selectVehiclesChoice(@Param("dispatchId")Long dispatchId);
public Integer deleteDispatchResource(@Param("dispatchId")Long dispatchId);
@ -137,4 +140,12 @@ public interface DcWarningMapper
DcDispatch selectDcDispatchById(@Param("id") Long id);
//误报解除
public Integer falseAlarmResolution(DcWarning dcWarning);
//依据人员id查询人员名称
public String employeesName(Long id);
//依据车辆id查询车辆信息,前提车辆可用
public String vehiclesName(Long id);
//依据车辆id查询车辆信息,前提车辆可用
public String vehiclesType(Long id);
//依据机构id查询机构名称
public String organizationName(Long id);
}

2
zc-business/src/main/java/com/zc/business/service/IDcEventProcessService.java

@ -83,4 +83,6 @@ public interface IDcEventProcessService
* @return status 0未完成 1已完成
*/
int selectPreviousNodeStatus(String eventId, Long processId);
List<DcEventProcess> selectDcEventProcessByEventId(String eventId);
}

12
zc-business/src/main/java/com/zc/business/service/IDcEventService.java

@ -127,4 +127,16 @@ public interface IDcEventService
* @return com.ruoyi.common.core.domain.AjaxResult
*/
AjaxResult skipClear(String eventId);
/**
* @Description 查询关联事件
*
* @author liuwenge
* @date 2024/5/30 14:28
* @param eventId
* @return com.ruoyi.common.core.domain.AjaxResult
*/
AjaxResult getLinkEvent(String eventId);
List<DcEvent> dispatchRecordEventList(DcEvent dcEvent);
}

6
zc-business/src/main/java/com/zc/business/service/IDcWarningService.java

@ -91,8 +91,12 @@ public interface IDcWarningService
//定时结束部分事件
Integer updateEndSection();
//指挥调度
//1.指挥调度
AjaxResult commandAndDispatch(DcWarning dcWarning);
//2.指挥调度,当调度信息为空的时候调用智能分配资源
AjaxResult intelligentSource(DcWarning dcWarning);
//3.指挥调度新增资源
AjaxResult insertDispatch(HashMap map);
//修改指挥调度资源记录
public Integer insertDispatch(DcDispatch dcDispatch);
//新增指挥调度资源记录

5
zc-business/src/main/java/com/zc/business/service/impl/DcEventProcessServiceImpl.java

@ -163,4 +163,9 @@ public class DcEventProcessServiceImpl implements IDcEventProcessService
return dcEventProcessMapper.selectPreviousNodeStatus(eventId,processId);
}
@Override
public List<DcEventProcess> selectDcEventProcessByEventId(String eventId) {
return dcEventProcessMapper.selectDcEventProcessByEventId(eventId);
}
}

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

@ -197,7 +197,7 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
dcEvent.setStakeMark(extracted(facilityId));
}
//桩号校验
if (!com.ruoyi.common.utils.StakeMarkUtils.checkStakeMark(dcEvent.getStakeMark())){
if (!com.ruoyi.common.utils.StakeMarkUtils.checkStakeMark(dcEvent.getStakeMark())) {
return -1;
}
@ -232,9 +232,11 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
break;
//交通管制
case 3:
//交通管制事件 不做 首因关联
if (dcEvent.getDcEventTrafficControl() != null) {
if (dcEventId == null) {//非首页进入
if (dcEvent.getDcEventTrafficControl().getFacilityIds() ==null ) {
if (dcEvent.getDcEventTrafficControl().getFacilityIds() == null) {
dcEvent.getDcEventTrafficControl().setId(uuid);
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl());
break;
@ -245,22 +247,46 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
updateDcEventState(dcEvent.getId(), 1);
dcEvent.getDcEventTrafficControl().setId(uuid);
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl());
DcEvent dcEvent1 = new DcEvent();
dcEvent1.setId(dcEventId);//事件id
dcEvent1.setEventNature(1l);//首发事件
dcEvent1.setLinkId(uuid);//关联管制事件id
dcEventMapper.updateDcEventLinkId(dcEvent1);//修改事件性质
//查询事件
DcEvent dcEvent2 = dcEventMapper.selectDcEventById(dcEventId);
//判断事件 关联事件id是否为空
if (dcEvent2.getLinkId() == null) {
DcEvent dcEvent1 = new DcEvent();
dcEvent1.setId(dcEventId);//事件id
if (dcEvent2.getEventType() != 3) {
dcEvent1.setEventNature(1l);//首发事件
dcEvent1.setLinkId(uuid);//关联管制事件id
dcEventMapper.updateDcEventLinkId(dcEvent1);//修改事件性质
}
} else {
DcEvent dcEvent1 = new DcEvent();
dcEvent1.setId(dcEventId);//事件id
if (dcEvent2.getEventType() != 3) {
dcEvent1.setEventNature(1l);//首发事件
dcEvent1.setLinkId(dcEvent2.getLinkId() + "," + uuid);//关联管制事件id
dcEventMapper.updateDcEventLinkId(dcEvent1);//修改事件性质
}
}
break;
}
// 插入多个收费站
if (dcEvent.getDcEventTrafficControl().getFacilityIds().length == 1) {//facilityIds==1 说明只选择了一个收费站
if (dcEventId != null && !dcEventId.equals("")) {//不等于空 事件处置页面 修改
DcEvent dcEvent2 = dcEventMapper.selectDcEventById(dcEventId);
DcEvent dcEvent1 = new DcEvent();
dcEvent1.setId(dcEventId);//事件id
dcEvent1.setEventNature(1l);//首发事件
dcEvent1.setLinkId(uuid);//关联管制事件id
dcEventMapper.updateDcEventLinkId(dcEvent1);//修改事件性质
if (dcEvent2.getEventType() != 3) {
dcEvent1.setEventNature(1l);//首发事件
dcEvent1.setLinkId(dcEvent2.getLinkId()+","+uuid);//关联管制事件id
dcEventMapper.updateDcEventLinkId(dcEvent1);//修改事件性质
}
dcEvent.getDcEventTrafficControl().setId(uuid);
dcEvent.getDcEventTrafficControl().setFacilityId(dcEvent.getDcEventTrafficControl().getFacilityIds()[0]);//取出数组字段赋值 设施id
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl());//
@ -277,10 +303,14 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
} else if (dcEvent.getDcEventTrafficControl().getFacilityIds().length > 1) {//facilityIds1=1 说明只选择了多个收费站
if (dcEventId != null) {//不等于空 事件处置页面 修改
DcEvent dcEvent2 = dcEventMapper.selectDcEventById(dcEventId);
dcEventMapper.deleteDcEventById(uuid);//删除添加的事件主类
DcEvent dcEvent1 = new DcEvent();
dcEvent1.setId(dcEventId);//事件id
dcEvent1.setEventNature(1l);//首发事件
dcEvent1.setEventNature(1l);//首发事件
Map<String, String> map = new HashMap<>();
for (int i = 0; i < dcEvent.getDcEventTrafficControl().getFacilityIds().length; i++) { //设置事件Id UUID无下划线格式32
String facilityUUID = IdUtils.fastSimpleUUID();
@ -297,8 +327,13 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
a++;
}
String linkId2 = sb2.toString();
dcEvent1.setLinkId(linkId2);//关联管制事件id
dcEventMapper.updateDcEventLinkId(dcEvent1);//修改事件性质
dcEvent1.setLinkId(dcEvent2.getLinkId()+","+linkId2);//关联管制事件id
if (dcEvent2.getEventType() != 3) {
dcEventMapper.updateDcEventLinkId(dcEvent1);//修改事件性质
}
for (int i = 0; i < dcEvent.getDcEventTrafficControl().getFacilityIds().length; i++) {
dcEvent.getDcEventTrafficControl().setId(map.get("facilityId" + i));//交通管制事件id
dcEvent.getDcEventTrafficControl().setFacilityId(dcEvent.getDcEventTrafficControl().getFacilityIds()[i]);//取出数组字段赋值 设施id
@ -394,6 +429,7 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
}
break;
//交通拥堵
case 4:
@ -509,7 +545,7 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
/* if (dcEvent.getDcEventAccident() != null) {
}*/
DcEventAccident dcEventAccident =new DcEventAccident();
DcEventAccident dcEventAccident = new DcEventAccident();
dcEvent.setDcEventAccident(dcEventAccident);
dcEvent.getDcEventAccident().setId(uuid);
dcEvent.getDcEventAccident().setReporterName("视频AI");
@ -522,7 +558,7 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
/* if (dcEvent.getDcEventVehicleAccident() != null) {
}*/
DcEventVehicleAccident dcEventVehicleAccident =new DcEventVehicleAccident();
DcEventVehicleAccident dcEventVehicleAccident = new DcEventVehicleAccident();
dcEvent.setDcEventVehicleAccident(dcEventVehicleAccident);
dcEvent.getDcEventVehicleAccident().setReporterName("视频AI");
dcEvent.getDcEventVehicleAccident().setReporterPhoneNumber("96659");
@ -535,7 +571,7 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
/* if (dcEvent.getDcEventTrafficControl() != null) {
} */
DcEventTrafficControl dcEventTrafficControl =new DcEventTrafficControl();
DcEventTrafficControl dcEventTrafficControl = new DcEventTrafficControl();
dcEvent.setDcEventTrafficControl(dcEventTrafficControl);
dcEvent.getDcEventTrafficControl().setControlType(1L);//限行
dcEvent.getDcEventTrafficControl().setControlCause(2L);//交通事故
@ -547,7 +583,7 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
/* if (dcEvent.getDcEventTrafficCongestion() != null) {
}*/
DcEventTrafficCongestion dcEventTrafficCongestion =new DcEventTrafficCongestion();
DcEventTrafficCongestion dcEventTrafficCongestion = new DcEventTrafficCongestion();
dcEvent.setDcEventTrafficCongestion(dcEventTrafficCongestion);
dcEvent.getDcEventTrafficCongestion().setId(uuid);
dcEvent.getDcEventTrafficCongestion().setCongestionMileage(0F);//拥堵里程(公里)
@ -566,7 +602,7 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
/* if (dcEvent.getDcEventConstruction() != null) {
}*/
DcEventConstruction dcEventConstruction =new DcEventConstruction();
DcEventConstruction dcEventConstruction = new DcEventConstruction();
dcEvent.setDcEventConstruction(dcEventConstruction);
dcEvent.getDcEventConstruction().setId(uuid);
dcEvent.getDcEventConstruction().setControlMode(1l);//封闭
@ -577,7 +613,7 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
/* if (dcEvent.getDcEventServiceArea() != null) {
}*/
DcEventServiceArea dcEventServiceArea =new DcEventServiceArea();
DcEventServiceArea dcEventServiceArea = new DcEventServiceArea();
dcEvent.setDcEventServiceArea(dcEventServiceArea);
dcEvent.getDcEventServiceArea().setId(uuid);
int i3 = dcEventServiceAreaMapper.insertDcEventServiceArea(dcEvent.getDcEventServiceArea());
@ -589,7 +625,7 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
case 10:
/* if (dcEvent.getDcEventAbnormalWeather() != null) {
}*/
DcEventAbnormalWeather dcEventAbnormalWeather =new DcEventAbnormalWeather();
DcEventAbnormalWeather dcEventAbnormalWeather = new DcEventAbnormalWeather();
dcEvent.setDcEventAbnormalWeather(dcEventAbnormalWeather);
dcEvent.getDcEventAbnormalWeather().setId(uuid);
dcEvent.getDcEventAbnormalWeather().setWeatherSituation("1-1");//雨雾
@ -783,7 +819,7 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
int i7 = dcEventMapper.updateDcEvent(dcEvent);
if (i7 > 0) {
String context = comparisonInfo(oldEvent, dcEvent);
if (context.length() > 0){
if (context.length() > 0) {
//事件处置流程记录
DcEventProcess dcEventProcess = new DcEventProcess();
dcEventProcess.setEventId(dcEvent.getId());
@ -1131,11 +1167,11 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
dcEventProcessService.insertDcEventProcess(dcEventProcess);
//插入调度默认数据
ArrayList<HashMap<String,Object>> hashMaps = new ArrayList<>();
ArrayList<HashMap<String, Object>> hashMaps = new ArrayList<>();
String stakeMark = dcEvent.getStakeMark();//传入桩号
List<HashMap<String, Object>> mapList = dcWarningMapper.selectRecentlySection();//全部机构的桩号和名称
for (HashMap<String,Object> map:mapList){
if (org.apache.commons.lang3.StringUtils.isBlank(map.get("stakeMark").toString())){
for (HashMap<String, Object> map : mapList) {
if (org.apache.commons.lang3.StringUtils.isBlank(map.get("stakeMark").toString())) {
continue;
}
Long sectionId = (Long) map.get("id");//机构的id
@ -1143,15 +1179,16 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
com.zc.business.utils.StakeMarkUtils stakeMarkUtils = new StakeMarkUtils();
Integer itselfStakeMark = stakeMarkUtils.stakeMarkToInt(stakeMarkNew);//机构本身的米数
Integer afferentStakeMark = stakeMarkUtils.stakeMarkToInt(stakeMark);//传入的桩号米数
Integer difference =Math.abs(afferentStakeMark-itselfStakeMark); //计算距离绝对值
map.put("difference",difference/1000.0);//米转公里加入到map
map.put("id",sectionId);
Integer difference = Math.abs(afferentStakeMark - itselfStakeMark); //计算距离绝对值
map.put("difference", difference / 1000.0);//米转公里加入到map
map.put("id", sectionId);
hashMaps.add(map);
}
List<HashMap<String, Object>> sortedHashMaps = hashMaps.stream().sorted(Comparator.comparing(map -> {
return (Double) map.get("difference"); })).collect(Collectors.toList());
return (Double) map.get("difference");
})).collect(Collectors.toList());
HashMap<String, Object> hashMap = dcWarningMapper.selectDcDispatch(id);//查询事件是否已经有转的调度记录
if (!sortedHashMaps.isEmpty()&&hashMap==null) {
if (!sortedHashMaps.isEmpty() && hashMap == null) {
HashMap<String, Object> map = sortedHashMaps.get(0);
Long sortId = (Long) map.get("id");//取出最近的机构id
if (sortId != null) {
@ -1165,7 +1202,7 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
dcWarningMapper.insertDcDispatch(dcDispatch);//事件绑定信息记录
Long dispatchId = dcDispatch.getId();//信息记录id
List<HashMap<String, Object>> employeesMap = dcWarningMapper.selectOrganizationEmployees(sortId);//人员map
if (employeesMap != null&&employeesMap.size()>0) {
if (employeesMap != null && employeesMap.size() > 0) {
// 生成一个随机索引,范围在0到列表长度减1之间
int randomIndex = ThreadLocalRandom.current().nextInt(employeesMap.size());
HashMap<String, Object> randomEmployee = employeesMap.get(randomIndex);
@ -1176,7 +1213,7 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
dcWarningMapper.insertDispatchResource(dcDispatchResource);
}
List<HashMap<String, Object>> vehiclesMap = dcWarningMapper.selectVehicles(sortId);//车辆map
if (vehiclesMap != null&&vehiclesMap.size()>0) {
if (vehiclesMap != null && vehiclesMap.size() > 0) {
// 生成一个随机索引,范围在0到列表长度减1之间
int randomIndex = ThreadLocalRandom.current().nextInt(vehiclesMap.size());
HashMap<String, Object> randomEmployee = employeesMap.get(randomIndex);
@ -1235,10 +1272,10 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
} else if ("direction".equals(result.getRightPath())) {
if (("1".equals(result.getRight()) || "上行".equals(result.getRight()) || "菏泽方向".equals(result.getRight()))
&& ("1".equals(result.getLeft()) || "上行".equals(result.getLeft()) || "菏泽方向".equals(result.getLeft()))){
&& ("1".equals(result.getLeft()) || "上行".equals(result.getLeft()) || "菏泽方向".equals(result.getLeft()))) {
continue;
} else if(("3".equals(result.getRight()) || "下行".equals(result.getRight()) || "济南方向".equals(result.getRight()))
&& ("3".equals(result.getLeft()) || "下行".equals(result.getLeft()) || "济南方向".equals(result.getLeft()))){
} else if (("3".equals(result.getRight()) || "下行".equals(result.getRight()) || "济南方向".equals(result.getRight()))
&& ("3".equals(result.getLeft()) || "下行".equals(result.getLeft()) || "济南方向".equals(result.getLeft()))) {
continue;
}
@ -1762,6 +1799,24 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
return AjaxResult.success("无需清障成功");
}
/**
* 调度记录
*
* @param dcEvent
* @return
*/
@Override
public List<DcEvent> dispatchRecordEventList(DcEvent dcEvent) {
dcEvent.setEventState(2l);
List<DcEvent> dcEvents = dcEventMapper.dispatchRecordEventList(dcEvent);
for (DcEvent event : dcEvents) {
List<DcEventProcess> dcEventProcess = dcEventProcessService.selectDcEventProcessByEventId(event.getId());
event.setDcEventProcessList(dcEventProcess);
}
return dcEvents;
}
//时间比对
public static String getDatePoor(Date endDate, Date nowDate) {
@ -1786,4 +1841,34 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
}
/**
* @param eventId
* @return com.ruoyi.common.core.domain.AjaxResult
* @Description 查询关联事件
* @author liuwenge
* @date 2024/5/30 14:29
*/
@Override
public AjaxResult getLinkEvent(String eventId) {
List<Map<String, Object>> result = new ArrayList<>();
DcEvent dcEvent = dcEventMapper.selectDcEventById(eventId);
if (StringUtils.isNotEmpty(dcEvent.getLinkId())) {
Map<String, Object> item = new HashMap<>();
item.put("eventId", eventId);
item.put("eventNature", dcEvent.getEventNature());
result.add(item);
String[] linkIds = dcEvent.getLinkId().split(",");
for (String linkId : linkIds) {
item = new HashMap<>();
item.put("eventId", linkId);
item.put("eventNature", 2);
result.add(item);
}
}
return AjaxResult.success(result);
}
}

2
zc-business/src/main/java/com/zc/business/service/impl/DcFacilityServiceImpl.java

@ -50,7 +50,7 @@ public class DcFacilityServiceImpl extends ServiceImpl<DcFacilityMapper, DcFacil
// 设备类型
if (Objects.nonNull(dcFacility.getFacilityType())) {
queryWrapper.like(DcFacility::getFacilityType, dcFacility.getFacilityType());
queryWrapper.eq(DcFacility::getFacilityType, dcFacility.getFacilityType());
}
// 名称

215
zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java

@ -27,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.Array;
import java.rmi.MarshalledObject;
import java.util.Objects;
import java.util.concurrent.ThreadLocalRandom;
import javax.annotation.Resource;
import java.util.ArrayList;
@ -508,68 +509,10 @@ public class DcWarningServiceImpl implements IDcWarningService
dcEvent.setCreateTime(DateUtils.getNowDate());//创建时间
dcEvent.setUserId(SecurityUtils.getUserId());//处置人员
dcEvent.setRoadId(1L);//高速公路(济菏高速)
int insertDcEvent = dcEventService.insertDcEventWarning(dcEvent);
if (insertDcEvent==0){
return AjaxResult.error("操作失败");
}
List<HashMap<String, Object>> mapList = dcWarningMapper.selectRecentlySection();//全部机构的桩号和名称
for (HashMap<String,Object> map:mapList){
if (StringUtils.isBlank(map.get("stakeMark").toString())){
continue;
}
Long id = (Long) map.get("id");//机构的id
String stakeMarkNew = map.get("stakeMark").toString();//机构桩号
StakeMarkUtils stakeMarkUtils = new StakeMarkUtils();
Integer itselfStakeMark = stakeMarkUtils.stakeMarkToInt(stakeMarkNew);//机构本身的米数
Integer afferentStakeMark = stakeMarkUtils.stakeMarkToInt(stakeMark);//传入的桩号米数
Integer difference =Math.abs(afferentStakeMark-itselfStakeMark); //计算距离绝对值
map.put("difference",difference/1000.0);//米转公里加入到map
map.put("id",id);
hashMaps.add(map);
}
List<HashMap<String, Object>> sortedHashMaps = hashMaps.stream().sorted(Comparator.comparing(map -> {
return (Double) map.get("difference"); })).collect(Collectors.toList());
HashMap<String, Object> hashMap = dcWarningMapper.selectDcDispatch(dcWarning.getId());//查询事件是否已经有转的调度记录
if (!sortedHashMaps.isEmpty()&&hashMap==null) {
HashMap<String, Object> map = sortedHashMaps.get(0);
Long id = (Long) map.get("id");//取出最近的机构id
if (id != null) {
DcDispatch dcDispatch = new DcDispatch();
DcDispatchResource dcDispatchResource = new DcDispatchResource();
dcDispatch.setDeptId(SecurityUtils.getLoginUser().getDeptId());
dcDispatch.setEventId(dcWarning.getId());
dcDispatch.setStartTime(DateUtils.getNowDate());
dcDispatch.setDispatchStatus(2L);//进行中状态
dcDispatch.setRemark(dcWarning.getRemark());
dcWarningMapper.insertDcDispatch(dcDispatch);//事件绑定信息记录
Long dispatchId = dcDispatch.getId();//信息记录id
List<HashMap<String, Object>> employeesMap = dcWarningMapper.selectOrganizationEmployees(id);//人员map
if (employeesMap != null&&employeesMap.size()>0) {
// 生成一个随机索引,范围在0到列表长度减1之间
int randomIndex = ThreadLocalRandom.current().nextInt(employeesMap.size());
HashMap<String, Object> randomEmployee = employeesMap.get(randomIndex);
Long employeesId = (Long) randomEmployee.get("id");//随机人员id
dcDispatchResource.setResourceId(employeesId);//资源id
dcDispatchResource.setDispatchType(1);//资源类型
dcDispatchResource.setDispatchId(dispatchId);//信息记录id
dcWarningMapper.insertDispatchResource(dcDispatchResource);
}
List<HashMap<String, Object>> vehiclesMap = dcWarningMapper.selectVehicles(id);//车辆map
if (vehiclesMap != null&&vehiclesMap.size()>0) {
// 生成一个随机索引,范围在0到列表长度减1之间
int randomIndex = ThreadLocalRandom.current().nextInt(vehiclesMap.size());
HashMap<String, Object> randomEmployee = employeesMap.get(randomIndex);
Long vehiclesId = (Long) randomEmployee.get("id");//随机车辆id
dcDispatchResource.setResourceId(vehiclesId);//资源id
dcDispatchResource.setDispatchType(2);//资源类型
dcDispatchResource.setDispatchId(dispatchId);//信息记录id
dcWarningMapper.insertDispatchResource(dcDispatchResource);//绑定车辆信息
}
}
}
return AjaxResult.success("操作成功");
}
@ -670,10 +613,12 @@ public class DcWarningServiceImpl implements IDcWarningService
@Override
public AjaxResult commandAndDispatch(DcWarning dcWarning) {
Map<String, Object> mapAll = new HashMap<>();
HashMap<String, Object> dcDispatch = dcWarningMapper.selectDcDispatch(dcWarning.getId());//查询是否存在调度记录
//逻辑,调用全部的机构信息,计算传入的桩号与机构桩号的距离作为排序使用,使用机构的id调出车辆,人员,值班等信息
List<HashMap<String, Object>> mapList = dcWarningMapper.selectRecentlySection();//全部机构的桩号和名称
ArrayList<HashMap<String,Object>> hashMaps = new ArrayList<>();
Map<String, Object> mapAll = new HashMap<>();
for (HashMap<String,Object> map:mapList){
if (StringUtils.isBlank(map.get("stakeMark").toString())){
continue;
@ -684,7 +629,7 @@ public class DcWarningServiceImpl implements IDcWarningService
Integer afferentStakeMark = stakeMarkUtils.stakeMarkToInt(dcWarning.getStakeMark());//传入的桩号米数
Integer difference =Math.abs(afferentStakeMark-itselfStakeMark); //计算距离绝对值
map.put("difference",difference/1000.0);//米转公里加入到map
Long id = (Long) map.get("id");//机构的id,用户获取人员、值班、车辆等信息
Long id =Long.parseLong(map.get("id").toString());//机构的id,用户获取人员、值班、车辆等信息
List<HashMap<String, Object>> employeesMap = dcWarningMapper.selectEmployeesDispatch(id,dcWarning.getId());//人员map
List<HashMap<String, Object>> vehiclesMap = dcWarningMapper.selectVehiclesDispatch(id,dcWarning.getId());//车辆map
map.put("employeesMap",employeesMap);
@ -692,20 +637,31 @@ public class DcWarningServiceImpl implements IDcWarningService
hashMaps.add(map);
}
List<HashMap<String, Object>> sortedHashMaps = hashMaps.stream().sorted(Comparator.comparing(map -> {
return (Double) map.get("difference"); })).collect(Collectors.toList());
return (Double) map.get("difference"); })).collect(Collectors.toList());
mapAll.put("listData",sortedHashMaps);
if (!sortedHashMaps.isEmpty()) {
HashMap<String, Object> map = sortedHashMaps.get(0);
Long id = Long.parseLong(map.get("id").toString());//取出最近的机构id
List<HashMap<String, Object>> trafficPolice = dcWarningMapper.selectTrafficPolice(id);//交警人员信息
mapAll.put("trafficPolice",trafficPolice);
}
if (dcDispatch==null){
mapAll.put("existence",0);
return AjaxResult.success(mapAll);
}
mapAll.put("existence",1);
HashMap<String, Object> map = dcWarningMapper.selectDcDispatch(dcWarning.getId());//获取机构id与资源id
if (map!=null){
HashMap<Object, Object> hashMap = new HashMap<>();
Long id = (Long) map.get("id");//调度记录id
Long id =Long.parseLong(map.get("id").toString());//调度记录id
Object deptName =map.get("deptName");//部门名称
List<HashMap<String, Object>> shifts = dcWarningMapper.selectShiftsEmployees();//值班为空把全部的人员信息作为值班人员信息
//List<HashMap<String, Object>> shifts = dcWarningMapper.selectShiftsEmployees();//值班为空把全部的人员信息作为值班人员信息
List<HashMap<String, Object>> resource = dcWarningMapper.selectDispatchResource(id);//全部资源信息
List<HashMap<String, Object>> employeesChoice = dcWarningMapper.selectEmployeesChoice(id);//选中人员信息
List<HashMap<String, Object>> vehiclesChoice = dcWarningMapper.selectVehiclesChoice(id);//选中车辆信息
hashMap.put("id",id);//调度记录id
hashMap.put("deptName",deptName);
hashMap.put("shifts",shifts);
//hashMap.put("shifts",shifts);
hashMap.put("resource",resource);
mapAll.put("resource",hashMap);
mapAll.put("employeesChoice",employeesChoice);
@ -713,6 +669,120 @@ public class DcWarningServiceImpl implements IDcWarningService
}
return AjaxResult.success(mapAll);
}
//指挥调度,当调度信息为空的时候调用智能分配资源
@Override
public AjaxResult intelligentSource(DcWarning dcWarning) {
String stakeMark = dcWarning.getStakeMark();
ArrayList<HashMap<String,Object>> hashMaps = new ArrayList<>();
Map<String, Object> mapAll = new HashMap<>();
List<HashMap<String, Object>> mapList = dcWarningMapper.selectRecentlySection();//全部机构的桩号和名称
for (HashMap<String,Object> map:mapList){
HashMap<String, Object> mapValue = new HashMap<>();
if (StringUtils.isBlank(map.get("stakeMark").toString())){
continue;
}
StakeMarkUtils stakeMarkUtils = new StakeMarkUtils();
String stakeMarkValue = map.get("stakeMark").toString();
Integer itselfStakeMark = stakeMarkUtils.stakeMarkToInt(stakeMarkValue);//桩号本身的米数
Integer afferentStakeMark = stakeMarkUtils.stakeMarkToInt(dcWarning.getStakeMark());//传入的桩号米数
Integer difference =Math.abs(afferentStakeMark-itselfStakeMark); //计算距离绝对值
mapValue.put("difference",difference/1000.0);//米转公里加入到map
Long id =Long.parseLong(map.get("id").toString());//机构的id,用户获取人员、车辆等信息
List<HashMap<String, Object>> employeesMap = dcWarningMapper.selectEmployeesDispatch(id,dcWarning.getId());//人员map
List<HashMap<String, Object>> vehiclesMap = dcWarningMapper.selectVehiclesDispatch(id,dcWarning.getId());//车辆map
String organizationName = dcWarningMapper.organizationName(id);
mapValue.put("employeesMap",employeesMap);
mapValue.put("vehiclesMap",vehiclesMap);
mapValue.put("organizationId",id);
mapValue.put("organizationName",organizationName);
hashMaps.add(mapValue);
}
mapAll.put("selectData",hashMaps);
List<HashMap<String, Object>> sortedHashMaps = hashMaps.stream().sorted(Comparator.comparing(map -> {
return (Double) map.get("difference"); })).collect(Collectors.toList());
if (!sortedHashMaps.isEmpty()) {
HashMap<String, Object> map = sortedHashMaps.get(0);
Long id = Long.parseLong(map.get("organizationId").toString());//取出最近的机构id
if (id != null) {
List<HashMap<String, Object>> employeesMap = dcWarningMapper.selectOrganizationEmployees(id);//人员map
if (employeesMap != null&&employeesMap.size()>0) {
HashMap<String, Object> employeesHashMap = new HashMap<>();
// 生成一个随机索引,范围在0到列表长度减1之间
int randomIndex = ThreadLocalRandom.current().nextInt(employeesMap.size());
HashMap<String, Object> randomEmployee = employeesMap.get(randomIndex);
Long employeesId = Long.parseLong(randomEmployee.get("id").toString());//随机人员id
String employeesName = dcWarningMapper.employeesName(employeesId);//随机人员姓名
employeesHashMap.put("employeesId",employeesId);
employeesHashMap.put("employeesName",employeesName);
mapAll.put("employees",employeesHashMap);
}
List<HashMap<String, Object>> vehiclesMap = dcWarningMapper.selectVehicles(id);//车辆map
if (vehiclesMap != null&&vehiclesMap.size()>0) {
HashMap<String, Object> vehiclesHashMap = new HashMap<>();
// 生成一个随机索引,范围在0到列表长度减1之间
int randomIndex = ThreadLocalRandom.current().nextInt(vehiclesMap.size());
HashMap<String, Object> randomEmployee = vehiclesMap.get(randomIndex);
Long vehiclesId =Long.parseLong(randomEmployee.get("id").toString());//随机车辆id
String vehiclesName = dcWarningMapper.vehiclesName(vehiclesId);//随机车辆
String vehiclesType = dcWarningMapper.vehiclesType(vehiclesId);//随机车辆
vehiclesHashMap.put("vehiclesId",vehiclesId);
vehiclesHashMap.put("vehiclesName",vehiclesName);
vehiclesHashMap.put("vehiclesType",vehiclesType);
mapAll.put("vehicles",vehiclesHashMap);
}
}
}
return AjaxResult.success(mapAll);
}
//3.指挥调度新增资源
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult insertDispatch(HashMap map) {
//事件id、事件备注、机构id、资源id
String eventId = map.get("eventId").toString();//事件id
String remark = Objects.toString(map.get("remark"), "");
Long employees=null;
if (map.get("employeesId")!=null){
employees = Long.parseLong(map.get("employeesId").toString());//人员
}
Long vehicles=null;
if (map.get("vehiclesId").toString()!=null){
vehicles = Long.parseLong(map.get("vehiclesId").toString());//车辆
}
DcDispatch dcDispatch = new DcDispatch();
DcDispatchResource dcDispatchResource = new DcDispatchResource();
dcDispatch.setDeptId(SecurityUtils.getLoginUser().getDeptId());
dcDispatch.setEventId(eventId);
dcDispatch.setStartTime(DateUtils.getNowDate());
dcDispatch.setDispatchStatus(2L);//进行中状态
dcDispatch.setRemark(remark);
Integer integer = dcWarningMapper.insertDcDispatch(dcDispatch);//事件绑定信息记录
if (integer==0){
return AjaxResult.error();
}
Long dispatchId = dcDispatch.getId();//信息记录id
if (employees!=null) {
dcDispatchResource.setResourceId(employees);//资源id
dcDispatchResource.setDispatchType(1);//资源类型
dcDispatchResource.setDispatchId(dispatchId);//信息记录id
Integer employeesSource = dcWarningMapper.insertDispatchResource(dcDispatchResource);
if (employeesSource==0){
return AjaxResult.error("人员调度异常");
}
}
if (vehicles!=null) {
// 生成一个随机索引,范围在0到列表长度减1之间
dcDispatchResource.setResourceId(vehicles);//资源id
dcDispatchResource.setDispatchType(2);//资源类型
dcDispatchResource.setDispatchId(dispatchId);//信息记录id
Integer dispatchResource = dcWarningMapper.insertDispatchResource(dcDispatchResource);//绑定车辆信息
if (dispatchResource==0){
return AjaxResult.error("车辆调度异常");
}
}
return AjaxResult.success();
}
@Override
public Integer insertDispatch(DcDispatch dcDispatch) {
@ -725,12 +795,19 @@ public class DcWarningServiceImpl implements IDcWarningService
@Override
@Transactional(rollbackFor = Exception.class)
public Integer insertDispatchSource(HashMap map) {
String eventId = map.get("eventId").toString();//事件id
String remark = Objects.toString(map.get("remark"), "");
DcDispatch dcDispatch = new DcDispatch();
DcDispatchResource dcDispatchResource = new DcDispatchResource();
Integer pat = (Integer) map.get("dispatchId");
long dispatchId = pat.longValue();
dcDispatch.setDeptId(SecurityUtils.getLoginUser().getDeptId());
dcDispatch.setEventId(eventId);
dcDispatch.setStartTime(DateUtils.getNowDate());
dcDispatch.setDispatchStatus(2L);//进行中状态
dcDispatch.setRemark(remark);
dcWarningMapper.insertDcDispatch(dcDispatch);//事件绑定信息记录
Long dispatchId = dcDispatch.getId();
dcWarningMapper.deleteDispatchResource(dispatchId);//删除全部属于该调度记录下的全部资源
ArrayList<Map<String,Object>> employeesArray = (ArrayList<Map<String,Object>>) map.get("employees");//取出人员
String context = "";
if (employeesArray!=null&&employeesArray.size()>0) {
context += "路管人员";
@ -768,9 +845,9 @@ public class DcWarningServiceImpl implements IDcWarningService
context += "参与事件救援";
}
DcDispatch dcDispatch = dcWarningMapper.selectDcDispatchById(dispatchId);
DcDispatch dcDispatchEventId = dcWarningMapper.selectDcDispatchById(dispatchId);
DcEventProcess dcEventProcess = new DcEventProcess();
dcEventProcess.setEventId(dcDispatch.getEventId());
dcEventProcess.setEventId(dcDispatchEventId.getEventId());
dcEventProcess.setSource(1);
dcEventProcess.setContext(context);
dcEventProcessService.insertDcEventProcess(dcEventProcess);

38
zc-business/src/main/resources/mapper/business/DcEventMapper.xml

@ -812,4 +812,42 @@
update dc_event set end_time = now(),event_state = '2'
where id = #{eventId}
</update>
<select id="dispatchRecordEventList" parameterType="DcEvent" resultMap="DcEventResult">
<include refid="selectDcEventVo"/>
<where>
<if test="deptId != null ">and dept_id = #{deptId}</if>
<if test="id != null ">and id = #{id}</if>
<if test="stakeMark != null and stakeMark != ''">and stake_mark BETWEEN #{stakeMark} and #{endStakeMark}
</if>
<if test="direction != null and direction != ''">and direction = #{direction}</if>
<if test="userId != null ">and user_id = #{userId}</if>
<if test="endTime != null ">and end_time BETWEEN #{startTime} and #{endTime}</if>
<if test="eventLevel != null ">and event_level = #{eventLevel}</if>
<if test="eventType != null ">and event_type = #{eventType}</if>
<if test="eventSubclass != null and eventSubclass != ''">and event_subclass = #{eventSubclass}</if>
<if test="eventCause != null and eventCause != ''">and event_cause = #{eventCause}</if>
<if test="description != null and description != ''">and description = #{description}</if>
<if test="eventState != null ">and event_state = #{eventState}</if>
<if test="eventSource != null ">and event_source = #{eventSource}</if>
<if test="eventNature != null ">and event_nature = #{eventNature}</if>
<if test="eventSourceTips != null and eventSourceTips != ''">and event_source_tips = #{eventSourceTips}
</if>
<if test="inTunnel != null ">and in_tunnel = #{inTunnel}</if>
<if test="isPerceived != null ">and is_perceived = #{isPerceived}</if>
</where>
<choose>
<when test="eventState == 0">
ORDER BY occurrence_time DESC
</when>
<when test="eventState == 1">
ORDER BY start_time DESC
</when>
<when test="eventState == 2">
ORDER BY end_time DESC
</when>
<otherwise>
ORDER BY create_time DESC
</otherwise>
</choose>
</select>
</mapper>

5
zc-business/src/main/resources/mapper/business/DcEventProcessMapper.xml

@ -150,4 +150,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where event_id = #{eventId} and process_type = '1' and process_id = #{processId} - 1
</select>
<select id="selectDcEventProcessByEventId" parameterType="string" resultMap="DcEventProcessResult">
<include refid="selectDcEventProcessVo"/>
where event_id = #{eventId} and type = 'text'
</select>
</mapper>

37
zc-business/src/main/resources/mapper/business/DcWarningMapper.xml

@ -255,6 +255,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
where id = #{id}
</update>
<delete id="deleteDcWarningById" parameterType="Integer">
delete from dc_warning where id = #{id}
</delete>
@ -278,6 +279,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from dc_dispatch_resource where dispatch_id=#{dispatchId}
</delete>
<select id="selectCount" resultType="int">
SELECT COUNT(*)AS count FROM dc_warning
</select>
@ -317,7 +319,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where parent_id!=0
</select>
<select id="selectOrganizationEmployees" resultType="java.util.HashMap">
select id, name,contact_number contactNumber from dc_employees where organization_id=#{organizationId} and employees_type=2
select id, name,contact_number contactNumber from dc_employees where organization_id=#{organizationId}
</select>
<select id="selectShifts" resultType="java.util.HashMap">
select shifts.scheduling,employees.name shiftsName,employees.contact_number shiftsNumber from dc_shifts as shifts
@ -368,11 +370,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectEmployeesDispatch" resultType="java.util.HashMap">
SELECT DISTINCT dc_employees.id,
dc_employees.name,
dc_employees.contact_number AS contactNumber,
CASE
WHEN t.id IS NOT NULL THEN 1 -- 连接成立
ELSE 0 -- 连接不成立
END AS state
dc_employees.contact_number AS contactNumber
from dc_employees
LEFT JOIN(
select employees.id id, employees.name, employees.contact_number contactNumber
@ -380,19 +378,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left JOIN dc_dispatch_resource as respurce on respurce.resource_id = employees.id
LEFT JOIN dc_dispatch as path on path.id = respurce.dispatch_id
where employees.organization_id = #{organizationId}
and employees.employees_type = 2
and respurce.dispatch_type = 1
and path.event_id = #{eventId}) as t on t.id = dc_employees.id
where organization_id = #{organizationId}
where organization_id = #{organizationId} and dc_employees.employees_type=1
</select>
<select id="selectVehiclesDispatch" resultType="java.util.HashMap">
select DISTINCT dc_vehicles.id,
dc_vehicles.vehicle_type vehicleType,
dc_vehicles.vehicle_plate vehiclePlate,
CASE
WHEN t.id IS NOT NULL THEN 1 -- 连接成立
ELSE 0 -- 连接不成立
END AS state
dc_vehicles.vehicle_plate vehiclePlate
from dc_vehicles
LEFT JOIN(
select vehicles.id, vehicles.vehicle_type vehicleType, vehicles.vehicle_plate vehiclePlate
@ -400,11 +393,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN dc_dispatch_resource as resource on resource.resource_id = vehicles.id
LEFT JOIN dc_dispatch as path on path.id = resource.dispatch_id
where vehicles.organization_id = #{organizationId}
and vehicles.vehicle_status = 1
and resource.dispatch_type = 2
and path.event_id = #{eventId}) as t on t.id = dc_vehicles.id
where vehicle_status = 1
and organization_id = #{organizationId}
and organization_id = #{organizationId} and dc_vehicles.vehicle_status = 1
</select>
<select id="selectOrganization" resultType="java.util.HashMap">
select id from dc_organization where parent_id=0;
@ -423,5 +415,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDcDispatchById" resultType="com.zc.business.domain.DcDispatch">
select * from dc_dispatch where id = #{id}
</select>
<select id="employeesName" resultType="java.lang.String">
select name from dc_employees where id=#{id}
</select>
<select id="vehiclesName" resultType="java.lang.String">
select vehicle_plate from dc_vehicles where id=#{id}
</select>
<select id="organizationName" resultType="java.lang.String">
select organization_name from dc_organization where id=#{id}
</select>
<select id="vehiclesType" resultType="java.lang.String">
select vehicle_type from dc_vehicles where id=#{id}
</select>
<select id="selectTrafficPolice" resultType="java.util.HashMap">
select name,contact_number contactNumber from dc_employees where organization_id=#{organizationId} and employees_type=2
</select>
</mapper>

Loading…
Cancel
Save