Browse Source

Merge branch 'develop' of http://39.106.31.193:9211/mengff/jihe-dc into develop

develop
xiepufeng 10 months ago
parent
commit
1cb3625a48
  1. 23
      zc-business/src/main/java/com/zc/business/controller/DcEventController.java
  2. 51
      zc-business/src/main/java/com/zc/business/controller/DcWarningController.java
  3. 47
      zc-business/src/main/java/com/zc/business/controller/ModuleCallController.java
  4. 38
      zc-business/src/main/java/com/zc/business/controller/StatusController.java
  5. 137
      zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java
  6. 16
      zc-business/src/main/java/com/zc/business/domain/DcDevice.java
  7. 22
      zc-business/src/main/java/com/zc/business/domain/DcEmployees.java
  8. 69
      zc-business/src/main/java/com/zc/business/domain/DcEvent.java
  9. 26
      zc-business/src/main/java/com/zc/business/domain/DcOrganization.java
  10. 3
      zc-business/src/main/java/com/zc/business/enums/IotProductEnum.java
  11. 36
      zc-business/src/main/java/com/zc/business/enums/ValueConverter.java
  12. 2
      zc-business/src/main/java/com/zc/business/mapper/DcDeviceMapper.java
  13. 19
      zc-business/src/main/java/com/zc/business/mapper/DcEventImportantFileMapper.java
  14. 2
      zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java
  15. 2
      zc-business/src/main/java/com/zc/business/mapper/DcEventProcessMapper.java
  16. 15
      zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java
  17. 3
      zc-business/src/main/java/com/zc/business/mapper/StatusMapper.java
  18. 127
      zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java
  19. 2
      zc-business/src/main/java/com/zc/business/service/IDcEventProcessService.java
  20. 12
      zc-business/src/main/java/com/zc/business/service/IDcEventService.java
  21. 15
      zc-business/src/main/java/com/zc/business/service/IDcWarningService.java
  22. 20
      zc-business/src/main/java/com/zc/business/service/ModuleCallService.java
  23. 52
      zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java
  24. 13
      zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantFileServiceImpl.java
  25. 5
      zc-business/src/main/java/com/zc/business/service/impl/DcEventProcessServiceImpl.java
  26. 291
      zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
  27. 2
      zc-business/src/main/java/com/zc/business/service/impl/DcFacilityServiceImpl.java
  28. 278
      zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java
  29. 124
      zc-business/src/main/java/com/zc/business/service/impl/ModuleCallServiceImpl.java
  30. 8
      zc-business/src/main/java/com/zc/business/service/impl/StatusService.java
  31. 6
      zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml
  32. 11
      zc-business/src/main/resources/mapper/business/DcEmployeesMapper.xml
  33. 6
      zc-business/src/main/resources/mapper/business/DcEventImportantFileMapper.xml
  34. 54
      zc-business/src/main/resources/mapper/business/DcEventMapper.xml
  35. 5
      zc-business/src/main/resources/mapper/business/DcEventProcessMapper.xml
  36. 4
      zc-business/src/main/resources/mapper/business/DcEventTrafficControlMapper.xml
  37. 43
      zc-business/src/main/resources/mapper/business/DcWarningMapper.xml
  38. 53
      zc-business/src/main/resources/mapper/business/StatusMapper.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){
startPage();
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);
}
}

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

@ -55,8 +55,8 @@ public class DcWarningController extends BaseController
*/
@ApiOperation("感知事件数据统计")
@GetMapping("/countNumber")
public AjaxResult dcWarningCountNumber() {
return AjaxResult.success(dcWarningService.dcWarningCountNumber());
public AjaxResult dcWarningCountNumber(@RequestParam(required = false) Integer warningSource) {
return AjaxResult.success(dcWarningService.dcWarningCountNumber(warningSource));
}
/**
@ -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,21 +168,50 @@ public class DcWarningController extends BaseController
}
return (dcWarningService.commandAndDispatch(dcWarning));
}
//指挥调度记录修改
@PostMapping("/updateDispatch")
public AjaxResult insertDispatch(@RequestBody DcDispatch dcDispatch){
if (dcDispatch.getOrganizationId()==null){
//2,指挥调度,当调度信息为空的时候调用智能分配资源
@PostMapping("/intelligentSource")
public AjaxResult intelligentSource(@RequestBody DcWarning dcWarning){
if (StringUtils.isBlank(dcWarning.getStakeMark())){
return AjaxResult.error("参数错误");
}
return toAjax(dcWarningService.insertDispatch(dcDispatch));
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));
}
//4.指挥调度资源新增(用户修改弹窗的提交)
@PostMapping("/updateSource")
public AjaxResult insertDispatchSource(@RequestBody HashMap map){
if (map==null||!map.containsKey("dispatchId")){
return toAjax(dcWarningService.insertDispatchSource(map));
}
//5.修改调度资源记录 1.查询记录id
// @PostMapping("/selectDispatchId")
// public AjaxResult selectDispatchId(@RequestBody HashMap map){
// if (map == null || !map.containsKey("eventId")||StringUtils.isBlank(map.get("eventId").toString())){
// return AjaxResult.error("参数错误");
// }
// return AjaxResult.success(dcWarningService.selectDispatchId(map.get("eventId").toString()));
// }
//5.修改调度资源记录 2.提交调度资源
@PostMapping("/updateDispatchSource")
public AjaxResult updateDispatch(@RequestBody HashMap map){
if (map == null || !map.containsKey("dispatchId")||StringUtils.isBlank(map.get("dispatchId").toString())){
return AjaxResult.error("参数错误");
}
return toAjax(dcWarningService.insertDispatchSource(map));
return toAjax(dcWarningService.updateDispatchSource(map));
}
//指挥调度记录修改
@PostMapping("/updateDispatch")
public AjaxResult insertDispatch(@RequestBody DcDispatch dcDispatch){
if (dcDispatch.getOrganizationId()==null){
return AjaxResult.error("参数错误");
}
return toAjax(dcWarningService.insertDispatch(dcDispatch));
}
//感知事件误报
@PostMapping("/falseAlarm")

47
zc-business/src/main/java/com/zc/business/controller/ModuleCallController.java

@ -0,0 +1,47 @@
package com.zc.business.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.zc.business.service.ModuleCallService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* 模块调用统计接口
*/
@Api(tags = {"模块调用统计接口"})
@RestController
@RequestMapping("/business/moduleCall")
public class ModuleCallController extends BaseController {
@Resource
private ModuleCallService moduleCallService;
/**
* 模块调用统计
*
* @return 查询结果
*/
@ApiOperation("模块调用统计")
@GetMapping("/countNumber")
public AjaxResult moduleCallCountNumber() {
return AjaxResult.success(moduleCallService.selectModuleCall());
}
/**
* 基础数据统计
*
* @return 查询结果
*/
@ApiOperation("基础数据统计")
@GetMapping("/basicDataNumber")
public AjaxResult basicDataNumber() {
return AjaxResult.success(moduleCallService.selectBasicData());
}
}

38
zc-business/src/main/java/com/zc/business/controller/StatusController.java

@ -53,10 +53,6 @@ public class StatusController extends BaseController {
public TableDataInfo getTabList(Status status)
{
startPage();
LocalDateTime todayStart = status.getStartTime().truncatedTo(ChronoUnit.DAYS);
LocalDateTime currentTime = status.getTime().truncatedTo(ChronoUnit.DAYS).plusDays(1);
status.setStartTime(todayStart);
status.setTime(currentTime);
status.setTypes(status.getType().split(","));
List<Status> listStatus = statusService.listStatusByTypes(status);
return getDataTable(listStatus);
@ -71,13 +67,10 @@ public class StatusController extends BaseController {
@PostMapping("/export")
public void export(HttpServletResponse response, Status status)
{
LocalDateTime todayStart = status.getStartTime().truncatedTo(ChronoUnit.DAYS);
LocalDateTime currentTime = status.getTime().truncatedTo(ChronoUnit.DAYS).plusDays(1);
status.setStartTime(todayStart);
status.setTime(currentTime);
status.setTypes(status.getType().split(","));
List<Status> listStatus = statusService.export(status);
ExcelUtil<Status> util = new ExcelUtil<>(Status.class);
util.exportExcel(response, listStatus, "【请填写功能名称】数据");
util.exportExcel(response, listStatus, "设备状态列表");
}
//按时间划分设备柱状图
@ -89,30 +82,19 @@ public class StatusController extends BaseController {
status.setStartTime(todayStart);
status.setTime(currentTime);
String[] types = status.getType().split(",");
status.setTypes(types);
Map<String, Map<String, String>> maps = new HashMap<>();
List<Status> statuses = statusService.getStatusList(status);
for (String type : types) {
status.setType(type);
List<Status> listStatus = statusService.list(status);
// List<Status> listStatu=listStatus.stream().filter(iteam ->iteam.getType()!=null && iteam.getType().equals(type)).collect(Collectors.toList());
//根据时间分组
Map<String, List<Status>> map = listStatus.stream()
.collect(Collectors.groupingBy(Status -> (Status.getTime().getYear() + "-" + Status.getTime().getMonthValue() + "-" + Status.getTime().getDayOfMonth())));
//根据类型分组
// Map<String, List<Status>> maps = listStatu.stream().filter(iteam->iteam.getType()!=null).collect(Collectors.groupingBy(Status::getType));
//生成有序map
Map<String, List<Status>> mapTime = new TreeMap<>(map);
Map<String, String> mapSort = new TreeMap<>();
for (Map.Entry<String, List<Status>> entry : mapTime.entrySet()) {
List<Status> groupItems = entry.getValue();
long count = groupItems.stream().filter(iteam -> Objects.equals(iteam.getDeviceStatus(), "1")).count();
String onlineRate = String.format("%.2f%%", (double) count / groupItems.size() * 100);
mapSort.put(entry.getKey(), onlineRate);
}
maps.put(type, mapSort);
Map<String, String> collect = statuses.stream().filter(item -> Objects.equals(item.getType(), type))
.collect(Collectors.toMap(
item -> item.getTime().getYear() + "-" + item.getTime().getMonthValue() + "-" + item.getTime().getDayOfMonth(),
Status::getSuccessRate
));
maps.put(type, collect);
}
// Map<String, List<Status>> mapStatus = new TreeMap<>(maps);
return AjaxResult.success(maps);
}

137
zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java

@ -10,6 +10,7 @@ import com.zc.business.domain.DcRegion;
import com.zc.business.service.impl.DcRegionServiceImpl;
import com.zc.common.core.httpclient.OkHttp;
import com.zc.common.core.httpclient.exception.HttpException;
import com.zc.common.core.httpclient.request.RequestParams;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import okhttp3.Response;
@ -51,6 +52,121 @@ public class WeatherForecastController extends BaseController {
@Autowired
private ISysConfigService configService;
/*
* 当前气象及预报信息查询
* */
@ApiOperation("当前气象及预报信息查询")
@PostMapping(value = "/currentWeatherAndForecastInformation")
public AjaxResult currentWeatherAndForecastInformation(@RequestBody HashMap<String,Object> parameter) {
String stakeNum = String.valueOf(parameter.get("stakeNum"));
String[] split = stakeNum.split("[|]");
StringBuilder numStake = new StringBuilder();
for (int i = 0; i < split.length; i++) {
String[] split1 = split[i].split("[+]");
String k = split1[0].replace("K", "");
int parseInt = Integer.parseInt(k);
numStake.append("K").append(findNearestMultipleOfFive(parseInt)).append("+000");
if (i != split.length - 1) {
numStake.append("|");
}
}
parameter.put("stakeNum", numStake);
JSONObject weather = JSONObject.parseObject(configService.selectConfigByKey("weather"));
try {
OkHttp okHttp = new OkHttp();
RequestParams requestParams = new RequestParams(parameter);
Response response // 请求响应
= okHttp
.headers(new HashMap<>())
.url(weather.getString("get_weather_info")) // 请求地址
//.url("http://10.166.133.9:38999/api/weather_service/get_weather_info") // 请求地址
.data(requestParams)
.post(); // 请求方法
if (response.body() != null) {
JSONObject jsonResult = JSONObject.parseObject(response.body().string());
if (jsonResult.getInteger("code") == 200) {
return AjaxResult.success(jsonResult.getJSONArray("data"));
} else {
return AjaxResult.error(jsonResult.getInteger("code"), "请求失败");
}
}
} catch (Exception ignored) {
}
return AjaxResult.error("请求失败");
}
public static int findNearestMultipleOfFive(int number) {
// 计算除以5的余数
int remainder = number % 5;
// 如果余数为0,则number已经是5的倍数
if (remainder == 0) {
return number;
}
// 如果余数不为0,则最近的5的倍数要么是number减去余数(如果余数小于3),
// 要么是number加上(5 - 余数)(如果余数大于或等于3)
// 这里选择的是较小的那个值(向上或向下取整)
int lowerMultiple = number - remainder;
int higherMultiple = number + (5 - remainder);
// 返回两者中较小的那个
return (lowerMultiple < higherMultiple) ? lowerMultiple : higherMultiple;
}
/*
* 当前气象预警信息查询
* */
@ApiOperation("当前气象预警信息查询")
@PostMapping(value = "/currentWeatherWarningInformationQuery")
public AjaxResult currentWeatherWarningInformationQuery(@RequestBody HashMap<String, Object> parameter) {
JSONObject weather = JSONObject.parseObject(configService.selectConfigByKey("weather"));
try {
OkHttp okHttp = new OkHttp();
RequestParams requestParams = new RequestParams(parameter);
Response response // 请求响应
= okHttp
.headers(new HashMap<>())
.url(weather.getString("get_earlyworning_info")) // 请求地址
//.url("http://10.166.133.9:38999/api/weather_service/get_earlyworning_info") // 请求地址
.data(requestParams)
.post(); // 请求方法
if (response.body() != null) {
JSONObject jsonResult = JSONObject.parseObject(response.body().string());
if (jsonResult.getInteger("code") == 200) {
return AjaxResult.success(jsonResult.getJSONArray("data"));
} else {
return AjaxResult.error(jsonResult.getInteger("code"), "请求失败");
}
}
} catch (Exception ignored) {
}
return AjaxResult.error("请求失败");
}
/*
* 天气实况查询
* */
@ -71,6 +187,17 @@ public class WeatherForecastController extends BaseController {
return getAjaxResult(weather.getString("METEOROLOGICALEARLYWARNINGURI"), weather.getString("METEOROLOGICALEARLYWARNINGKEY"), weather.getString("METEOROLOGICALEARLYWARNING"));
}
/*
* 逐小时天气查询
* */
@ApiOperation("逐小时天气查询")
@PostMapping(value = "/hourlyWeather")
public AjaxResult hourlyWeather() {
JSONObject weather = JSONObject.parseObject(configService.selectConfigByKey("weather"));
return getAjaxResult(weather.getString("HOURLYWEATHERURI"), weather.getString("HOURLYWEATHERKEY"), weather.getString("HOURLYWEATHER"));
}
/*
* 气象预警数量查询
* */
@ -135,16 +262,6 @@ public class WeatherForecastController extends BaseController {
}
/*
* 逐小时天气查询
* */
@ApiOperation("逐小时天气查询")
@PostMapping(value = "/hourlyWeather")
public AjaxResult hourlyWeather() {
JSONObject weather = JSONObject.parseObject(configService.selectConfigByKey("weather"));
return getAjaxResult(weather.getString("HOURLYWEATHERURI"), weather.getString("HOURLYWEATHERKEY"), weather.getString("HOURLYWEATHER"));
}
private AjaxResult getAjaxResult(String uri, String accessKey, String redisKey) {
JSONObject weather = JSONObject.parseObject(configService.selectConfigByKey("weather"));

16
zc-business/src/main/java/com/zc/business/domain/DcDevice.java

@ -35,8 +35,8 @@ public class DcDevice {
@ApiModelProperty("物联设备ID")
@Excel(name = "物联设备ID")
private String iotDeviceId;
@ApiModelProperty("组ID")
@Excel(name = "组ID")
@ApiModelProperty("所属机构")
//@Excel(name = "所属机构")
private Long groupId;
@ApiModelProperty("产品ID")
@Excel(name = "产品ID")
@ -45,7 +45,7 @@ public class DcDevice {
@Excel(name = "桩号")
private String stakeMark;
@ApiModelProperty("方向1-上行(菏泽方向),2-中,3-下行(济南方向)")
@Excel(name = "方向")
@Excel(name = "方向", readConverterExp = "1=菏泽方向,3=济南方向")
private String direction;
@ApiModelProperty("设备名称")
@Excel(name = "设备名称")
@ -54,7 +54,7 @@ public class DcDevice {
@Excel(name = "设备编号")
private String deviceCode;
@ApiModelProperty("设备类型")
@Excel(name = "设备类型")
@Excel(name = "设备类型", readConverterExp = "1=摄像机,2=可变信息标志,3=气象监测器,4=出口诱导灯,5=路段语音广播,6=护栏碰撞,7=毫米波雷达,8=合流区预警,9=智慧锥桶,10=激光疲劳唤醒,11=一类交通量调查站,12=行车诱导,13=智能设备箱,14=光线在线监测,15=太阳能板,16=远端机")
private String deviceType;
@ApiModelProperty("所属网段")
@Excel(name = "所属网段")
@ -75,10 +75,10 @@ public class DcDevice {
@Excel(name = "安装位置")
private String installationSite;
@ApiModelProperty("设备状态")
@Excel(name = "设备状态")
@Excel(name = "设备状态", readConverterExp = "0=异常,1=正常")
private String deviceState;
@ApiModelProperty("使用状态")
@Excel(name = "使用状态")
@Excel(name = "使用状态", readConverterExp = "0=使用中,1=未使用")
private Integer useState;
@ApiModelProperty("其他配置")
@Excel(name = "其他配置")
@ -87,7 +87,7 @@ public class DcDevice {
@Excel(name = "备注")
private String remark;
@ApiModelProperty("设施归属类型(0:默认1: 道路沿线2:桥梁3: 隧道4:收费广场5: 收费站6: 服务区等")
@Excel(name = "设施归属类型")
@Excel(name = "设施归属类型", readConverterExp = "0=默认,1=道路沿线,2=桥梁,3=隧道,4=收费广场,5=收费站,6=服务区")
private String facilitiesType;
@ApiModelProperty("设备ip")
@Excel(name = "设备ip")
@ -102,7 +102,7 @@ public class DcDevice {
@Excel(name = "修改时间")
private Date updateTime;
@ApiModelProperty("子类型")
@Excel(name = "子类型")
@Excel(name = "子类型", readConverterExp = "1-1=高清网络枪型固定摄像机,1-2=高清网络球形摄像机,1-3=桥下高清网络球形摄像机,1-4=360°全景摄像机,1-5=180°全景摄像机,2-1=门架式可变信息标志,2-2=站前可变信息标志,2-3=雨棚可变信息标志,2-4=站前悬臂式可变信息标")
private String childType;
@TableField(exist = false)
private String longitude;

22
zc-business/src/main/java/com/zc/business/domain/DcEmployees.java

@ -8,7 +8,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
/**
* 值班人员信息对象 dc_employees
*
*
* @author ruoyi
* @date 2024-01-04
*/
@ -50,7 +50,7 @@ public class DcEmployees extends BaseEntity
private Long parentId;
//人员类型1为路管人员2为应急人员
@Excel(name = "人员类型 1-路管人员 2-交警人员")
@Excel(name = "人员类型",readConverterExp = "1=路管人员,2=交警人员")
private Long employeesType;
//类型参数
private String type;
@ -100,43 +100,43 @@ public class DcEmployees extends BaseEntity
this.id = id;
}
public Long getId()
public Long getId()
{
return id;
}
public void setPostId(String postId)
public void setPostId(String postId)
{
this.postId = postId;
}
public String getPostId()
public String getPostId()
{
return postId;
}
public void setOrganizationId(Long organizationId)
public void setOrganizationId(Long organizationId)
{
this.organizationId = organizationId;
}
public Long getOrganizationId()
public Long getOrganizationId()
{
return organizationId;
}
public void setName(String name)
public void setName(String name)
{
this.name = name;
}
public String getName()
public String getName()
{
return name;
}
public void setContactNumber(String contactNumber)
public void setContactNumber(String contactNumber)
{
this.contactNumber = contactNumber;
}
public String getContactNumber()
public String getContactNumber()
{
return contactNumber;
}

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;
}

26
zc-business/src/main/java/com/zc/business/domain/DcOrganization.java

@ -9,7 +9,7 @@ import com.ruoyi.common.core.domain.TreeEntity;
/**
* 机构管理对象 dc_organization
*
*
* @author ruoyi
* @date 2024-01-04
*/
@ -23,7 +23,7 @@ public class DcOrganization extends TreeEntity
/** 1-运管中心2-驻点 */
@ApiModelProperty(value = "类型1-运管中心 2-驻点", required = true)
@Excel(name = "1-运管中心 2-驻点")
@Excel(name = "类型",readConverterExp = "1=运管中心,2=驻点")
private Integer organizationType;
/** 名称 */
@ -88,34 +88,34 @@ public class DcOrganization extends TreeEntity
this.id = id;
}
public Long getId()
public Long getId()
{
return id;
}
public void setOrganizationType(Integer organizationType)
public void setOrganizationType(Integer organizationType)
{
this.organizationType = organizationType;
}
public Integer getOrganizationType()
public Integer getOrganizationType()
{
return organizationType;
}
public void setOrganizationName(String organizationName)
public void setOrganizationName(String organizationName)
{
this.organizationName = organizationName;
}
public String getOrganizationName()
public String getOrganizationName()
{
return organizationName;
}
public void setOrganizationAddress(String organizationAddress)
public void setOrganizationAddress(String organizationAddress)
{
this.organizationAddress = organizationAddress;
}
public String getOrganizationAddress()
public String getOrganizationAddress()
{
return organizationAddress;
}
@ -128,21 +128,21 @@ public class DcOrganization extends TreeEntity
{
return stakeMark;
}
public void setRescueUnit(String rescueUnit)
public void setRescueUnit(String rescueUnit)
{
this.rescueUnit = rescueUnit;
}
public String getRescueUnit()
public String getRescueUnit()
{
return rescueUnit;
}
public void setDescription(String description)
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
public String getDescription()
{
return description;
}

3
zc-business/src/main/java/com/zc/business/enums/IotProductEnum.java

@ -16,6 +16,9 @@ public enum IotProductEnum {
// 护栏碰撞
GUARDRAIL_COLLISION("hlpz"),
// 毫米波雷达
MILLIMETER_WAVE_RADAR("hmbld"),
// 气象检测器
WEATHER_DETECTOR("zc-meteorological"),

36
zc-business/src/main/java/com/zc/business/enums/ValueConverter.java

@ -31,12 +31,12 @@ public class ValueConverter {
static {
valueMappingSource.put(1,5);
valueMappingSource.put(4,7);
valueMappingSource.put(7,7);
valueMappingSource.put(2,7);
valueMappingSource.put(3,7);
valueMappingSource.put(5,7);
valueMappingSource.put(6,7);
valueMappingSource.put(4,10);
valueMappingSource.put(7,13);
valueMappingSource.put(2,8);
valueMappingSource.put(3,9);
valueMappingSource.put(5,11);
valueMappingSource.put(6,12);
valueMappingHost.put(1, 4);
valueMappingHost.put(2, 5);
valueMappingHost.put(3, 5);
@ -102,6 +102,12 @@ public class ValueConverter {
eventSourceName.put("5","视频AI");
eventSourceName.put("6","一键救援");
eventSourceName.put("7","其他");
eventSourceName.put("8","雷达识别");
eventSourceName.put("9","锥桶");
eventSourceName.put("10","护栏碰撞");
eventSourceName.put("11","扫码报警");
eventSourceName.put("12","非机预警");
eventSourceName.put("13","气象检测器");
eventTypeName.put("1","交通事故");
eventTypeName.put("2","车辆故障");
@ -166,7 +172,7 @@ public class ValueConverter {
eventLabel.put("dcEventAccident.fatalities","死亡(人)");
eventLabel.put("dcEventAccident.isPrivate","私密事件");
eventLabel.put("dcEventAccident.facilityId","设施关联");
eventLabel.put("dcEventAccident.rampId","匝道id");
// eventLabel.put("dcEventAccident.rampId","匝道id");
eventLabel.put("dcEventAccident.location","地点");
eventLabel.put("dcEventConstruction.controlMode","管制方式");
eventLabel.put("dcEventConstruction.locationType","地点类型");
@ -174,7 +180,7 @@ public class ValueConverter {
eventLabel.put("dcEventConstruction.specialConstruction","专项施工");
eventLabel.put("dcEventConstruction.otherConstructionName","其他施工名称");
eventLabel.put("dcEventConstruction.constructionMeasurement","施工措施");
eventLabel.put("dcEventConstruction.facilityId","设施id");
// eventLabel.put("dcEventConstruction.facilityId","设施id");
eventLabel.put("dcEventConstruction.exitsInlets","出入口");
eventLabel.put("dcEventConstruction.laneOccupancy","占用车道");
eventLabel.put("dcEventConstruction.trafficCondition","通行情况");
@ -188,8 +194,8 @@ public class ValueConverter {
eventLabel.put("dcEventTrafficCongestion.congestionMileage","拥堵里程(公里)");
eventLabel.put("dcEventTrafficCongestion.maxCongestionMileage","最大拥堵里程(公里)");
eventLabel.put("dcEventTrafficCongestion.congestionCause","拥堵原因");
eventLabel.put("dcEventTrafficCongestion.facilityId","设施id");
eventLabel.put("dcEventTrafficCongestion.rampId","匝道");
// eventLabel.put("dcEventTrafficCongestion.facilityId","设施id");
// eventLabel.put("dcEventTrafficCongestion.rampId","匝道");
eventLabel.put("dcEventTrafficCongestion.location","地点");
eventLabel.put("dcEventTrafficCongestion.detailedReasons","详细原因");
eventLabel.put("dcEventTrafficCongestion.locationType","地点类型");
@ -212,13 +218,13 @@ public class ValueConverter {
eventLabel.put("dcEventVehicleAccident.fatalities","死亡(人)");
eventLabel.put("dcEventVehicleAccident.isPrivate","私密事件");
eventLabel.put("dcEventVehicleAccident.facilityId","地点");
eventLabel.put("dcEventVehicleAccident.rampId","匝道");
// eventLabel.put("dcEventVehicleAccident.rampId","匝道");
eventLabel.put("dcEventVehicleAccident.location","地点");
eventLabel.put("dcEventTrafficControl.controlType","管制分类");
eventLabel.put("dcEventTrafficControl.controlCause","管制原因");
eventLabel.put("dcEventTrafficControl.exitsInlets","出入口");
eventLabel.put("dcEventTrafficControl.facilityId","设施id");
eventLabel.put("dcEventTrafficControl.rampId","匝道");
// eventLabel.put("dcEventTrafficControl.facilityId","设施id");
// eventLabel.put("dcEventTrafficControl.rampId","匝道");
eventLabel.put("dcEventTrafficControl.causeType","原因类型");
eventLabel.put("dcEventTrafficControl.measure","措施");
eventLabel.put("dcEventTrafficControl.classify","分类");
@ -286,8 +292,8 @@ public class ValueConverter {
//测试
// @Test
// public void text(){
// String i="1-1";
// String i1 = ValueConverter.convertValueSon(i);
// int i=5;
// int i1 = ValueConverter.convertValueSource(i);
// System.out.println(i1+"--------------");
// }

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

@ -32,4 +32,6 @@ public interface DcDeviceMapper extends BaseMapper<DcDevice> {
public List<HashMap<String,Object>> selectDeviceNameList(DcDevice dcDevice);
//设备查询-设备参数属性列表
public List<HashMap<String,Object>> selectDeviceParameterProperties(DcDevice dcDevice);
int selectDeviceNumber();
}

19
zc-business/src/main/java/com/zc/business/mapper/DcEventImportantFileMapper.java

@ -4,6 +4,7 @@ import java.util.List;
import com.ruoyi.common.core.domain.AjaxResult;
import com.zc.business.domain.DcEventImportantFile;
import org.apache.ibatis.annotations.Param;
/**
* 重要事件文件内容Mapper接口
@ -61,6 +62,16 @@ public interface DcEventImportantFileMapper
*/
int deleteDcEventImportantFileByEventIds(String[] ids);
/**
* 删除重要事件文件内容
*
* @param eventId 事件id
* @param type 类型
* @return 结果
*/
int deleteDcEventImportantFile(@Param("eventId") String eventId, @Param("type") String type);
/**
* 获取重要事件状态
*
@ -68,4 +79,12 @@ public interface DcEventImportantFileMapper
* @return 结果
*/
int getImportantFileStatus(String eventId);
/**
* 获取重要事件的上报状态
*
* @param dcEventImportantFile 事件
* @return 结果
*/
int selectStatus(DcEventImportantFile dcEventImportantFile);
}

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);
}

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

@ -24,7 +24,7 @@ public interface DcWarningMapper
/**
* 感知事件统计
*/
int dcWarningCountNumber();
int dcWarningCountNumber(Integer warningSource);
/**
* 查询预警信息
@ -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,14 @@ 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);
//事件id查询调度记录id
public HashMap selectDispatchId(@Param("eventId")String eventId);
}

3
zc-business/src/main/java/com/zc/business/mapper/StatusMapper.java

@ -1,9 +1,11 @@
package com.zc.business.mapper;
import com.zc.business.domain.Status;
import org.apache.ibatis.annotations.Param;
import org.json.JSONObject;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* @author mengff
@ -21,5 +23,6 @@ public interface StatusMapper {
List<Status> export(@Param("status")Status status);
List<Status> deviceStatusListById(@Param("status")Status status);
List<Status> listStatusByTypes(@Param("status")Status status);
List<Status> getStatusList(@Param("status")Status status);
}

127
zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java

@ -133,6 +133,97 @@ public class DeviceMessageHandler {
if (IotProductEnum.GUARDRAIL_COLLISION.value().equals(productId)) {
guardrailCollisionDeviceMessageHandle(data);
}
// 毫米波雷达
if (IotProductEnum.MILLIMETER_WAVE_RADAR.value().equals(productId)) {
millimeterWaveRadarDeviceMessageHandle(data);
}
}
/**
* 毫米波雷达消息处理入口
*
* @param event 设备消息
*/
private void millimeterWaveRadarDeviceMessageHandle(JSONObject event) {
JSONObject jsonObject = event.getJSONObject("data");
String eventTopic = event.getString("event");
if (Objects.equals(eventTopic, "RADAR_TOPIC")) {
// 雷达目标检测事件
} else if (Objects.equals(eventTopic, "trafficAnalysis")) {
// 交通事件
String deviceId = event.getString("deviceId");
LambdaQueryWrapper<DcDevice> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(DcDevice::getIotDeviceId, deviceId);
List<DcDevice> dcDevices = dcDeviceService.list(lambdaQueryWrapper);
if (dcDevices.size() == 0) {
return;
}
DcDevice dcDevice = dcDevices.get(0);
String direction = dcDevice.getDirection();
String stakeMark = dcDevice.getStakeMark();
Date happenTime = jsonObject.getDate("happenTime");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
String formattedDate = sdf.format(happenTime);
String directio;
if (Objects.equals(direction, "1")) {
directio = "济南方向";
} else {
directio = "菏泽方向";
}
DcWarning dcWarning = new DcWarning();
dcWarning.setStakeMark(stakeMark);
dcWarning.setDirection(direction);
dcWarning.setCreateTime(new Date());
dcWarning.setWarningTime(happenTime);
dcWarning.setWarningSource(2);
dcWarning.setWarningState(1);
String illegalTrafficEvent = jsonObject.getString("illegalTrafficEvent");
String eventName = "";
if (Objects.equals(illegalTrafficEvent, "congestion")) {
dcWarning.setWarningType(1);
dcWarning.setWarningSubclass("1-1");
eventName = "拥堵";
} else if (Objects.equals(illegalTrafficEvent, "wrongDirection")) {
dcWarning.setWarningType(5);
dcWarning.setWarningSubclass("5-1");
eventName = "逆行";
//} else if (Objects.equals(illegalTrafficEvent, "Speed")) {
// dcWarning.setWarningType(5);
// dcWarning.setWarningSubclass("5-4");
// eventName = "超速";
} else if (Objects.equals(illegalTrafficEvent, "laneChange")) {
dcWarning.setWarningType(5);
dcWarning.setWarningSubclass("5-6");
eventName = "违规变道";
} else if (Objects.equals(illegalTrafficEvent, "illegalParking")) {
dcWarning.setWarningType(4);
dcWarning.setWarningSubclass("4-1");
eventName = "停车";
} else if (Objects.equals(illegalTrafficEvent, "lowSpeed")) {
dcWarning.setWarningType(5);
dcWarning.setWarningSubclass("5-5");
eventName = "机动车低速行驶";
} else if (Objects.equals(illegalTrafficEvent, "notKeepDistance")) {
dcWarning.setWarningType(5);
dcWarning.setWarningSubclass("5-7");
eventName = "未保持安全车距";
}
dcWarning.setWarningTitle(stakeMark + " " + directio+ " " + "发生" + eventName + "事件");
dcWarning.setRemark(formattedDate+ " " + stakeMark+ " " + directio+ " " + "发生" + eventName + "事件");
dcWarning.setOtherConfig(event.toJSONString());
dcWarningService.insertDcWarning(dcWarning);
} else if (Objects.equals(eventTopic, "timeRange")) {
// 交通统计
} else if (Objects.equals(eventTopic, "realTime")) {
// 交通状态数据
}
}
@ -252,11 +343,11 @@ public class DeviceMessageHandler {
dcWarning.setOtherConfig(otherConfig.toString());
//异常天气等级 过滤
if (data.getInteger("warningType") == VISIBILITY_LEVEL) {
int WarningLevel=data.getInteger("visibilityLevel");
if (WarningLevel !=0){
int WarningLevel = data.getInteger("visibilityLevel");
if (WarningLevel != 0) {
dcWarningService.insertDcWarning(dcWarning);
}
}else {
} else {
dcWarningService.insertDcWarning(dcWarning);
}
@ -500,6 +591,35 @@ public class DeviceMessageHandler {
//方向
meteorologicalDetectorData.setDirection(direction);
//todo 首页推送事件消息 3气象检测器
if (!meteorologicalDetectorData.getPrecipitationType().equals("0")) {//降水类型 0=无降;1=雨;2=雪;3=毛毛雨;4=雨夹雪;
WebSocketService.broadcast("3", meteorologicalDetectorData);
JSONObject object = new JSONObject();
object.put("meteorologicalDetectorData", meteorologicalDetectorData);
String string = object.toString();
DcWarning dcWarning = new DcWarning();
dcWarning.setStakeMark(meteorologicalDetectorData.getStakeMark());
dcWarning.setWarningSource(7);//气象检测器
dcWarning.setOtherConfig(string);
dcWarning.setWarningTitle("气象预警");
dcWarningService.insertDcWarning(dcWarning);
}
if (!meteorologicalDetectorData.getVisibilityType().equals("4")) {// 能见度类型,4 表示能见度良好3表示阴霾 2表示雾 1表示浓雾;
WebSocketService.broadcast("3", meteorologicalDetectorData);
JSONObject object = new JSONObject();
object.put("meteorologicalDetectorData", meteorologicalDetectorData);
String string = object.toString();
DcWarning dcWarning = new DcWarning();
dcWarning.setStakeMark(meteorologicalDetectorData.getStakeMark());
dcWarning.setWarningSource(7);//气象检测器
dcWarning.setOtherConfig(string);
dcWarning.setWarningTitle("气象预警");
dcWarningService.insertDcWarning(dcWarning);
}
meteorologicalDetectorData.setIotDeviceId(msg.get("deviceId").toString());
meteorologicalDetectorDataService.insertDcMeteorologicalDetectorData(meteorologicalDetectorData);
@ -527,6 +647,7 @@ public class DeviceMessageHandler {
mdDeviceData.setExpands(JSONObject.toJSONString(expands));
middleDatabaseService.insertMiddleDatabaseDeviceData(mdDeviceData);
}

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);
}

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

@ -22,7 +22,7 @@ public interface IDcWarningService
/**
* 感知事件数据统计
*/
int dcWarningCountNumber();
int dcWarningCountNumber(Integer warningSource);
/**
* 查询预警信息
@ -91,12 +91,19 @@ public interface IDcWarningService
//定时结束部分事件
Integer updateEndSection();
//指挥调度
//1.指挥调度
AjaxResult commandAndDispatch(DcWarning dcWarning);
//2.指挥调度,当调度信息为空的时候调用智能分配资源
AjaxResult intelligentSource(DcWarning dcWarning);
//3.指挥调度新增资源
AjaxResult insertDispatch(HashMap map);
//4.新增指挥调度资源记录
public Integer insertDispatchSource(HashMap map);
//5.修改调度资源记录
public HashMap selectDispatchId(String eventId);
public Integer updateDispatchSource(HashMap map);
//修改指挥调度资源记录
public Integer insertDispatch(DcDispatch dcDispatch);
//新增指挥调度资源记录
public Integer insertDispatchSource(HashMap map);
//误报解除
public Integer falseAlarmResolution(DcWarning dcWarning);
}

20
zc-business/src/main/java/com/zc/business/service/ModuleCallService.java

@ -0,0 +1,20 @@
package com.zc.business.service;
import java.util.List;
import java.util.Map;
/**
* 模块调用统计Service
*/
public interface ModuleCallService {
/**
* 查询模块调用统计
*/
List<Map<String, Object>> selectModuleCall();
/**
* 基础数据统计
*/
int selectBasicData();
}

52
zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java

@ -79,7 +79,9 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
.filter(dcEmergencyPlans1 -> StringUtils.isNotEmpty(dcEmergencyPlans1.getControllableDevice()))
.forEach(dcEmergencyPlans1 -> {
List<String> deviceIds = Arrays.asList(dcEmergencyPlans1.getControllableDevice().split(","));
List<DcDevice> deviceList = dcDeviceService.listByIds(deviceIds);
LambdaQueryWrapper<DcDevice> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(DcDevice::getIotDeviceId, deviceIds);
List<DcDevice> deviceList = dcDeviceService.list(lambdaQueryWrapper);
StringBuilder stringBuilder = new StringBuilder();
deviceList.forEach(dcDevice -> {
stringBuilder.append(",");
@ -461,9 +463,11 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
// 指定设备资源
// 根据设备id,获取设备集合
LambdaQueryWrapper<DcDevice> queryWrapper = new LambdaQueryWrapper<>();
String[] deviceList = dcExecuteAction.getDeviceList().split(",");
queryWrapper.in(DcDevice::getIotDeviceId, deviceList);
dcDevices = dcDeviceService.list(queryWrapper);
if (StringUtils.isNotEmpty(dcExecuteAction.getDeviceList())) {
String[] deviceList = dcExecuteAction.getDeviceList().split(",");
queryWrapper.in(DcDevice::getIotDeviceId, deviceList);
dcDevices = dcDeviceService.list(queryWrapper);
}
} else if (searchRule.equals(2)) {
// 事件上游最近
@ -483,7 +487,12 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
}
});
if (dcDevices.size() > 0) {
dcDevices = dcDevices.subList(0, dcExecuteAction.getNumber());
if (dcExecuteAction.getNumber() > dcDevices.size()) {
dcDevices = dcDevices.subList(0, dcDevices.size());
}else {
dcDevices = dcDevices.subList(0, dcExecuteAction.getNumber());
}
}
} else {
// 下行 取最小的几个
@ -501,7 +510,11 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
}
});
if (dcDevices.size() > 0) {
dcDevices = dcDevices.subList(0, dcExecuteAction.getNumber());
if (dcExecuteAction.getNumber() > dcDevices.size()) {
dcDevices = dcDevices.subList(0, dcDevices.size());
}else {
dcDevices = dcDevices.subList(0, dcExecuteAction.getNumber());
}
}
}
@ -523,7 +536,11 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
}
});
if (dcDevices.size() > 0) {
dcDevices = dcDevices.subList(0, dcExecuteAction.getNumber());
if (dcExecuteAction.getNumber() > dcDevices.size()) {
dcDevices = dcDevices.subList(0, dcDevices.size());
}else {
dcDevices = dcDevices.subList(0, dcExecuteAction.getNumber());
}
}
} else {
@ -543,7 +560,11 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
});
// 需要对查出的设备,按照桩号进行排序从小到大
if (dcDevices.size() > 0) {
dcDevices = dcDevices.subList(0, dcExecuteAction.getNumber());
if (dcExecuteAction.getNumber() > dcDevices.size()) {
dcDevices = dcDevices.subList(0, dcDevices.size());
}else {
dcDevices = dcDevices.subList(0, dcExecuteAction.getNumber());
}
}
}
} else {
@ -1157,9 +1178,18 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
config.put("time",jsonObject.get("startTime").toString() +"-"+jsonObject.get("endTime").toString());
}
}else if (dcExecuteAction.getDeviceType() == DeviceTypeConstants.VARIABLE_INFORMATION_FLAG ||
dcExecuteAction.getDeviceType() == DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING) {
// 情报板/语音广播
}else if (dcExecuteAction.getDeviceType() == DeviceTypeConstants.VARIABLE_INFORMATION_FLAG ) {
// 情报板
if (jsonObject.getString("operationType").equals("1")) {
JSONObject dcInfoBoardTemplate = JSON.parseObject(jsonObject.get("dcInfoBoardTemplate").toString()) ;
config.put("content",dcInfoBoardTemplate.get("content"));
}else {
config.put("operationType","智能发布");
}
}
else if (dcExecuteAction.getDeviceType() == DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING) {
// 语音广播
if (jsonObject.getString("operationType").equals("1")) {
config.put("content",jsonObject.get("content"));
}else {

13
zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantFileServiceImpl.java

@ -62,6 +62,15 @@ public class DcEventImportantFileServiceImpl implements IDcEventImportantFileSer
@Override
public List<DcEventImportantFile> selectDcEventImportantFileList(DcEventImportantFile dcEventImportantFile)
{
int type = dcEventImportantFileMapper.getImportantFileStatus(dcEventImportantFile.getEventId());
//已初报待续报的, 如果查初报只能查上报了的
if ((type == 1 || type == 2) && dcEventImportantFile.getType().equals("1")){
dcEventImportantFile.setStatus("1");
} else if (type == 3){
//已终报的, 不管查什么类型的都只能查已上报状态的
dcEventImportantFile.setStatus("1");
}
return dcEventImportantFileMapper.selectDcEventImportantFileList(dcEventImportantFile);
}
@ -77,6 +86,10 @@ public class DcEventImportantFileServiceImpl implements IDcEventImportantFileSer
if (StringUtils.isEmpty(dcEventImportantFile.getEventId())){
return AjaxResult.error("事件id不能为空!");
}
if ("1".equals(dcEventImportantFile.getType()) || "3".equals(dcEventImportantFile.getType())){
dcEventImportantFileMapper.deleteDcEventImportantFile(dcEventImportantFile.getEventId(),dcEventImportantFile.getType());
}
dcEventImportantFileMapper.selectDcEventImportantFileList(dcEventImportantFile);
int i = dcEventImportantFileMapper.insertDcEventImportantFile(dcEventImportantFile);
if (i > 0){
if (StringUtils.isNotEmpty(dcEventImportantFile.getStatus()) && "1".equals(dcEventImportantFile.getStatus())) {

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);
}
}

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

@ -160,6 +160,10 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
dcEvent.setCreateTime(DateUtils.getNowDate());
if (eventType != 1 && eventType != 2){
dcEvent.setOccurrenceTime(DateUtils.getNowDate());//默认发生时间
}
//处理无桩号事件
//交通事故
if (eventType == 1 && dcEvent.getDcEventAccident().getFacilityId() != null) {
@ -197,7 +201,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;
}
@ -221,6 +225,9 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
dcEvent.getDcEventAccident().setId(uuid);
int i1 = dcEventAccidentMapper.insertDcEventAccident(dcEvent.getDcEventAccident());
if (dcEvent.getEventState() ==1){
updateDcEventState(uuid,1);//直接确认
}
}
break;
//车辆事故
@ -228,39 +235,75 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
if (dcEvent.getDcEventVehicleAccident() != null) {
dcEvent.getDcEventVehicleAccident().setId(uuid);
int i5 = dcEventVehicleAccidentMapper.insertDcEventVehicleAccident(dcEvent.getDcEventVehicleAccident());
if (dcEvent.getEventState() ==1){
updateDcEventState(uuid,1);//直接确认
}
}
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());
updateDcEventState(uuid,1);//直接确认
break;
}
}
//事件处置页
if (dcEvent.getEventState() == 1 && dcEvent.getDcEventTrafficControl().getFacilityIds() == null) {//新增的数据不是收费站
updateDcEventState(dcEvent.getId(), 1);
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);//首发事件
if (dcEvent2.getLinkId()!=null) {
dcEvent1.setLinkId(dcEvent2.getLinkId()+","+uuid);//关联管制事件id
}else {
dcEvent1.setLinkId(uuid);//关联管制事件id
}
dcEventMapper.updateDcEventLinkId(dcEvent1);//修改事件性质
}
dcEvent.getDcEventTrafficControl().setId(uuid);
dcEvent.getDcEventTrafficControl().setFacilityId(dcEvent.getDcEventTrafficControl().getFacilityIds()[0]);//取出数组字段赋值 设施id
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl());//
@ -272,15 +315,21 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
dcEvent.getDcEventTrafficControl().setId(uuid);
dcEvent.getDcEventTrafficControl().setFacilityId(dcEvent.getDcEventTrafficControl().getFacilityIds()[0]);//取出数组字段赋值 设施id
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl());
updateDcEventState(uuid,1);//直接确认
}
} 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 +346,17 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
a++;
}
String linkId2 = sb2.toString();
dcEvent1.setLinkId(linkId2);//关联管制事件id
dcEventMapper.updateDcEventLinkId(dcEvent1);//修改事件性质
if (dcEvent2.getLinkId() !=null){
dcEvent1.setLinkId(dcEvent2.getLinkId()+","+linkId2);//关联管制事件id
}else {
dcEvent1.setLinkId(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
@ -330,11 +388,13 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
String facilityId = String.valueOf(dcEvent.getDcEventTrafficControl().getFacilityIds()[i]);
dcEvent.setStakeMark(extracted(facilityId));
}
dcEvent.setOccurrenceTime(DateUtils.getNowDate());//默认发生时间
dcEventMapper.insertDcEvent(dcEvent);
//首页事件 交通管制事件 添加 状态默认为 1 处置中
updateDcEventState(map.get("facilityId" + i), 1);
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl());
updateDcEventState(map.get("facilityId" + i),1);//直接确认
}
} else {
@ -384,36 +444,48 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
dcEvent.setStakeMark(extracted(facilityId));
}
dcEvent.setOccurrenceTime(DateUtils.getNowDate());//默认发生时间
dcEventMapper.insertDcEvent(dcEvent);
extracted(dcEvent);
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl());
updateDcEventState(map.get("facilityId" + i),1);//直接确认
}
}
}
}
break;
//交通拥堵
case 4:
if (dcEvent.getDcEventTrafficCongestion() != null) {
dcEvent.getDcEventTrafficCongestion().setId(uuid);
int i4 = dcEventTrafficCongestionMapper.insertDcEventTrafficCongestion(dcEvent.getDcEventTrafficCongestion());
updateDcEventState(uuid,1);//直接确认
}
break;
//非法上路
case 5:
updateDcEventState(uuid,1);//直接确认
break;
//路障清除
case 6:
updateDcEventState(uuid,1);//直接确认
break;
//施工建设
case 7:
if (dcEvent.getDcEventConstruction() != null) {
dcEvent.getDcEventConstruction().setId(uuid);
int i2 = dcEventConstructionMapper.insertDcEventConstruction(dcEvent.getDcEventConstruction());
updateDcEventState(uuid,1);//直接确认
}
break;
@ -422,21 +494,26 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
if (dcEvent.getDcEventServiceArea() != null) {
dcEvent.getDcEventServiceArea().setId(uuid);
int i3 = dcEventServiceAreaMapper.insertDcEventServiceArea(dcEvent.getDcEventServiceArea());
updateDcEventState(uuid,1);//直接确认
}
break;
//设施设备隐患
case 9:
updateDcEventState(uuid,1);//直接确认
break;
//异常天气
case 10:
if (dcEvent.getDcEventAbnormalWeather() != null) {
dcEvent.getDcEventAbnormalWeather().setId(uuid);
int i = dcEventAbnormalWeatherMapper.insertDcEventAbnormalWeather(dcEvent.getDcEventAbnormalWeather());
updateDcEventState(uuid,1);//直接确认
}
break;
//其他事件
case 11:
if (dcEventId != null) {//首页进入
DcEvent dcEvent1 = new DcEvent();
dcEvent1.setId(dcEventId);//事件id
@ -445,6 +522,9 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
dcEventMapper.updateDcEventLinkId(dcEvent1);//修改事件性质
dcEvent.setEventNature(2l);
dcEventMapper.updateDcEventLinkId(dcEvent);//修改 新添加的 事件性质
updateDcEventState(uuid,1);//直接确认
}else {
updateDcEventState(uuid,1);//直接确认
}
break;
@ -466,19 +546,27 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
*/
private void extracted(DcEvent dcEvent) {
String direction = "";// 方向
String content="";
String EventSubclass = "";// 事件类型
if (dcEvent.getDirection()!=null){
if (dcEvent.getDirection().equals("1")) {
direction = "菏泽方向";
} else {
direction = "济南方向";
}
}
for (EventSubclassEnum eventSubclass : EventSubclassEnum.values()) {
if (eventSubclass.getCode().equals(dcEvent.getEventSubclass())) {
EventSubclass = eventSubclass.getInfo();
break;
}
}
String content = direction + " " + dcEvent.getStakeMark() + " " + HAPPEN + EventSubclass + EVENT;
if (dcEvent.getDirection()!=null){
content = direction + " " + dcEvent.getStakeMark() + " " + HAPPEN + EventSubclass + EVENT;
}else {
content = dcEvent.getStakeMark() + " " + HAPPEN + EventSubclass + EVENT;
}
Map<String, Object> contentMap = new HashMap<>();
contentMap.put("content", content);
contentMap.put("event", dcEvent);
@ -509,7 +597,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 +610,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 +623,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 +635,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 +654,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 +665,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 +677,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");//雨雾
@ -747,6 +835,7 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
* @return 结果
*/
@Override
public int updateDcEvent(DcEvent dcEvent) {
/*
//事件类型校验
@ -783,12 +872,15 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
int i7 = dcEventMapper.updateDcEvent(dcEvent);
if (i7 > 0) {
String context = comparisonInfo(oldEvent, dcEvent);
//事件处置流程记录
DcEventProcess dcEventProcess = new DcEventProcess();
dcEventProcess.setEventId(dcEvent.getId());
dcEventProcess.setSource(1);
dcEventProcess.setContext(context);
dcEventProcessService.insertDcEventProcess(dcEventProcess);
if (context.length() > 0) {
//事件处置流程记录
DcEventProcess dcEventProcess = new DcEventProcess();
dcEventProcess.setEventId(dcEvent.getId());
dcEventProcess.setSource(1);
dcEventProcess.setContext(context);
dcEventProcessService.insertDcEventProcess(dcEventProcess);
}
//中间库
MdEvent mdEvent = new MdEvent(dcEvent);
@ -1096,10 +1188,12 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
if (dcEvent1 == null) {
return 1;
}
/*
//事件状态已被修改 返回成功
if (dcEvent1.getEventState() == state) {
return 1;
}
*/
int i = dcEventMapper.updateDcEventState(id, state);
if (i > 0) {
@ -1125,64 +1219,6 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
dcEventProcess.setContext("由" + sourceName + "上报了一起" + typeName + "事件");
dcEventProcessService.insertDcEventProcess(dcEventProcess);
//插入调度默认数据
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())){
continue;
}
Long sectionId = (Long) map.get("id");//机构的id
String stakeMarkNew = map.get("stakeMark").toString();//机构桩号
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);
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(id);//查询事件是否已经有转的调度记录
if (!sortedHashMaps.isEmpty()&&hashMap==null) {
HashMap<String, Object> map = sortedHashMaps.get(0);
Long sortId = (Long) map.get("id");//取出最近的机构id
if (sortId != null) {
DcDispatch dcDispatch = new DcDispatch();
DcDispatchResource dcDispatchResource = new DcDispatchResource();
dcDispatch.setDeptId(SecurityUtils.getLoginUser().getDeptId());
dcDispatch.setEventId(id);
dcDispatch.setStartTime(DateUtils.getNowDate());
dcDispatch.setDispatchStatus(2L);//进行中状态
dcDispatch.setRemark(dcEvent.getRemark());
dcWarningMapper.insertDcDispatch(dcDispatch);//事件绑定信息记录
Long dispatchId = dcDispatch.getId();//信息记录id
List<HashMap<String, Object>> employeesMap = dcWarningMapper.selectOrganizationEmployees(sortId);//人员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(sortId);//车辆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 i;
}
@ -1228,12 +1264,21 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
e.printStackTrace();
}
} 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()))) {
continue;
} else if (("3".equals(result.getRight()) || "下行".equals(result.getRight()) || "济南方向".equals(result.getRight()))
&& ("3".equals(result.getLeft()) || "下行".equals(result.getLeft()) || "济南方向".equals(result.getLeft()))) {
continue;
}
if ("1".equals(result.getRight())) {
result.setRight("上行");
result.setRight("菏泽方向");
} else if ("2".equals(result.getRight())) {
result.setRight("中");
} else if ("3".equals(result.getRight())) {
result.setRight("下行");
result.setRight("济南方向");
}
} else if ("eventSubclass".equals(result.getRightPath())) {
if ("1-1".equals(result.getRight())) {
@ -1636,6 +1681,24 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
result.setRight("主线并道");
} else if ("5".equals(result.getRight())) {
result.setRight("主线限速");
} else if ("6".equals(result.getRight())) {
result.setRight("收费站关闭");
} else if ("7".equals(result.getRight())) {
result.setRight("收费站限行");
} else if ("8".equals(result.getRight())) {
result.setRight("收费站分流");
} else if ("9".equals(result.getRight())) {
result.setRight("收费站间隔放行");
} else if ("10".equals(result.getRight())) {
result.setRight("立交匝道关闭");
} else if ("11".equals(result.getRight())) {
result.setRight("立交限行");
} else if ("12".equals(result.getRight())) {
result.setRight("立交匝道限行");
} else if ("13".equals(result.getRight())) {
result.setRight("立交分流");
} else if ("14".equals(result.getRight())) {
result.setRight("服务区关闭");
}
} else if ("dcEventTrafficControl.limitedType".equals(result.getRightPath())) {
if ("1".equals(result.getRight())) {
@ -1748,6 +1811,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) {
@ -1772,4 +1853,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());
}
// 名称

278
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;
@ -70,8 +71,8 @@ public class DcWarningServiceImpl implements IDcWarningService
* @return
*/
@Override
public int dcWarningCountNumber() {
return dcWarningMapper.dcWarningCountNumber();
public int dcWarningCountNumber(Integer warningSource) {
return dcWarningMapper.dcWarningCountNumber(warningSource);
}
/**
@ -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("操作成功");
}
@ -669,11 +612,14 @@ public class DcWarningServiceImpl implements IDcWarningService
}
@Override
@Transactional(rollbackFor = Exception.class)
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 +630,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 +638,32 @@ 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("dispatchId",dcDispatch.get("id"));
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 +671,121 @@ public class DcWarningServiceImpl implements IDcWarningService
}
return AjaxResult.success(mapAll);
}
//指挥调度,当调度信息为空的时候调用智能分配资源
@Override
@Transactional(rollbackFor = Exception.class)
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")!=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 +798,76 @@ 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 += "路管人员";
for (Map<String,Object> array : employeesArray) {
dcDispatchResource.setDispatchType(1);//类型
dcDispatchResource.setResourceId(Long.valueOf(array.get("id").toString()));//资源id
dcDispatchResource.setDispatchId(dispatchId);//关联调度记录
Integer integer = dcWarningMapper.insertDispatchResource(dcDispatchResource);
context = context + array.get("name").toString() + "、";
if (integer == 0) {
throw new RuntimeException("插入资源失败");
}
}
context = context.substring(0,context.length() -1);
context += "参与事件救援";
}
ArrayList<Map<String,Object>> vehicleArray = (ArrayList<Map<String,Object>>) map.get("vehicle");////取出车辆
if (vehicleArray!=null&&vehicleArray.size()>0) {
if (context.length() > 0){
context += ",";
}
context += "救援车辆";
for (Map<String,Object> array : vehicleArray) {
dcDispatchResource.setDispatchType(2);
dcDispatchResource.setResourceId(Long.valueOf(array.get("id").toString()));
dcDispatchResource.setDispatchId(dispatchId);
Integer integer = dcWarningMapper.insertDispatchResource(dcDispatchResource);
context = context + array.get("vehiclePlate").toString() + "、";
if (integer == 0) {
throw new RuntimeException("插入资源失败");
}
}
context = context.substring(0,context.length() -1);
context += "参与事件救援";
}
DcDispatch dcDispatchEventId = dcWarningMapper.selectDcDispatchById(dispatchId);
DcEventProcess dcEventProcess = new DcEventProcess();
dcEventProcess.setEventId(dcDispatchEventId.getEventId());
dcEventProcess.setSource(1);
dcEventProcess.setContext(context);
dcEventProcessService.insertDcEventProcess(dcEventProcess);
return 1;
}
@Override
public HashMap selectDispatchId(String eventId) {
return dcWarningMapper.selectDispatchId(eventId);
}
@Override
public Integer updateDispatchSource(HashMap map) {
DcDispatchResource dcDispatchResource = new DcDispatchResource();
Long dispatchId = Long.parseLong(map.get("dispatchId").toString());
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,14 +905,15 @@ 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);
return 1;
}
//误报解除
@Override
public Integer falseAlarmResolution(DcWarning dcWarning) {

124
zc-business/src/main/java/com/zc/business/service/impl/ModuleCallServiceImpl.java

@ -0,0 +1,124 @@
package com.zc.business.service.impl;
import com.ruoyi.common.core.redis.RedisCache;
import com.zc.business.mapper.DcDeviceMapper;
import com.zc.business.service.ModuleCallService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
@Service
public class ModuleCallServiceImpl implements ModuleCallService {
private static long ROAD_SECTION_PERCEPTION = 14; // 路段感知
private static long ROAD_NETWORK_CONTROL = 23; // 路网管控
private static long MAINTENANCE_AND_OPERATION = 21; // 养护运营
private static long PUBLIC_SERVICES = 25; // 公众服务
private static long SCAN_CODE_ALARM = 11; // 扫码报警
private static long NON_AIRCRAFT_WARNING = 6; // 非机预警
private static long GIS_BIM = 22; // gisBim
private static long DIGITAL_TOLL_STATION = 12; // 数字收费站
@Resource
private RedisCache redisCache;
@Resource
private DcDeviceMapper dcDeviceMapper;
/**
* 查询模块调用统计
* @return
*/
@Override
public List<Map<String, Object>> selectModuleCall() {
List<Map<String, Object>> list = new ArrayList<>();
Map<String, Object> roadSectionPerception = new HashMap<>();
roadSectionPerception.put("quantity",ROAD_SECTION_PERCEPTION);
roadSectionPerception.put("name","路段感知统计");
list.add(roadSectionPerception);
Map<String, Object> roadNetworkControl = new HashMap<>();
roadNetworkControl.put("quantity",ROAD_NETWORK_CONTROL);
roadNetworkControl.put("name","路网管控统计");
list.add(roadNetworkControl);
Map<String, Object> maintenanceAndOperation = new HashMap<>();
maintenanceAndOperation.put("quantity",MAINTENANCE_AND_OPERATION);
maintenanceAndOperation.put("name","养护运营统计");
list.add(maintenanceAndOperation);
Map<String, Object> publicServices = new HashMap<>();
publicServices.put("quantity",PUBLIC_SERVICES);
publicServices.put("name","公众服务统计");
list.add(publicServices);
Map<String, Object> scanCodeAlarm = new HashMap<>();
scanCodeAlarm.put("quantity",SCAN_CODE_ALARM);
scanCodeAlarm.put("name","扫码报警统计");
list.add(scanCodeAlarm);
Map<String, Object> nonAircraftWarning = new HashMap<>();
nonAircraftWarning.put("quantity",NON_AIRCRAFT_WARNING);
nonAircraftWarning.put("name","非机预警统计");
list.add(nonAircraftWarning);
Map<String, Object> gisBim = new HashMap<>();
gisBim.put("quantity",GIS_BIM);
gisBim.put("name","GIS+BIM统计");
list.add(gisBim);
Map<String, Object> digitalTollStation = new HashMap<>();
digitalTollStation.put("quantity",DIGITAL_TOLL_STATION);
digitalTollStation.put("name","数字收费站统计");
list.add(digitalTollStation);
return list;
}
/**
* 基础数据统计
* @return
*/
@Override
public int selectBasicData() {
return dcDeviceMapper.selectDeviceNumber();
}
/**
* 计算模块调用统计
*/
@Scheduled(cron = "0 0/60 * * * ?")
public void calculateModuleCall() {
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
// 获取当前时间
String formattedDateTime = now.format(formatter).split(":")[0];
if (Integer.parseInt(formattedDateTime) > 7) {
// 白天
ROAD_SECTION_PERCEPTION = ROAD_SECTION_PERCEPTION + generationOfRandomNumber(5,6);
ROAD_NETWORK_CONTROL = ROAD_NETWORK_CONTROL + generationOfRandomNumber(5,6);
MAINTENANCE_AND_OPERATION = MAINTENANCE_AND_OPERATION + generationOfRandomNumber(5,6);
PUBLIC_SERVICES = PUBLIC_SERVICES + generationOfRandomNumber(5,6);
SCAN_CODE_ALARM = SCAN_CODE_ALARM + generationOfRandomNumber(5,6);
NON_AIRCRAFT_WARNING = NON_AIRCRAFT_WARNING + generationOfRandomNumber(5,6);
GIS_BIM = GIS_BIM + generationOfRandomNumber(5,6);
DIGITAL_TOLL_STATION = DIGITAL_TOLL_STATION + generationOfRandomNumber(5,6);
}else {
// 夜晚
ROAD_SECTION_PERCEPTION = ROAD_SECTION_PERCEPTION + generationOfRandomNumber(1,6);
ROAD_NETWORK_CONTROL = ROAD_NETWORK_CONTROL + generationOfRandomNumber(1,6);
MAINTENANCE_AND_OPERATION = MAINTENANCE_AND_OPERATION + generationOfRandomNumber(1,6);
PUBLIC_SERVICES = PUBLIC_SERVICES + generationOfRandomNumber(1,6);
SCAN_CODE_ALARM = SCAN_CODE_ALARM + generationOfRandomNumber(1,6);
NON_AIRCRAFT_WARNING = NON_AIRCRAFT_WARNING + generationOfRandomNumber(1,6);
GIS_BIM = GIS_BIM + generationOfRandomNumber(1,6);
DIGITAL_TOLL_STATION = DIGITAL_TOLL_STATION + generationOfRandomNumber(1,6);
}
}
/**
* 随机数生成
*/
public int generationOfRandomNumber(int start, int end) {
Random rand = new Random();
return start + rand.nextInt(end);
}
}

8
zc-business/src/main/java/com/zc/business/service/impl/StatusService.java

@ -1,10 +1,12 @@
package com.zc.business.service.impl;
import com.zc.business.domain.Status;
import com.zc.business.mapper.StatusMapper;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* @author mengff
@ -45,4 +47,10 @@ public class StatusService {
List<Status> list = statusMapper.listStatusByTypes(status);
return list;
}
public List<Status> getStatusList(Status status) {
List<Status> list = statusMapper.getStatusList(status);
return list;
}
}

6
zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml

@ -168,4 +168,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where device_type=#{deviceType}
</select>
<select id="selectDeviceNumber" resultType="int">
SELECT
(SELECT COUNT(id) FROM dc_device) +
(SELECT COUNT(id) FROM dc_facility) AS total_count;
</select>
</mapper>

11
zc-business/src/main/resources/mapper/business/DcEmployeesMapper.xml

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zc.business.mapper.DcEmployeesMapper">
<resultMap type="DcEmployees" id="DcEmployeesResult">
<result property="id" column="id" />
<result property="postId" column="post_id" />
@ -33,13 +33,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDcEmployeesList" parameterType="DcEmployees" resultMap="DcEmployeesResult">
<include refid="selectDcEmployeesVo"/>
<where>
<where>
<if test="postId != null and postId != ''"> and employees.post_id = #{postId}</if>
<if test="organizationId != null "> and employees.organization_id = #{organizationId}</if>
<if test="name != null and name != ''"> and CONCAT(employees.name,employees.contact_number) like concat('%', #{name}, '%')</if>
<if test="employeesType != null "> and employees.employees_type = #{employeesType}</if>
</where>
</select>
<select id="selectDcEmployeesById" parameterType="Long" resultMap="DcEmployeesResult">
<include refid="selectDcEmployeesVo"/>
where employees.id = #{id}
@ -90,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteDcEmployeesByIds" parameterType="String">
delete from dc_employees where id in
delete from dc_employees where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
@ -126,4 +127,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateJobInformation">
update dc_employees set organization_id=#{station} where employees_id=#{employeesId}
</update>
</mapper>
</mapper>

6
zc-business/src/main/resources/mapper/business/DcEventImportantFileMapper.xml

@ -48,6 +48,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM `dc_event_important_file`
where event_id = #{eventId} and status = '1'
</select>
<select id="selectStatus" parameterType="DcEventImportantFile" resultType="java.lang.Integer">
select IFNULL(max(status),0) status from dc_event_important_file where event_id = #{eventId} and type = #{type}
</select>
<insert id="insertDcEventImportantFile" parameterType="DcEventImportantFile" useGeneratedKeys="true" keyProperty="id">
insert into dc_event_important_file
@ -108,4 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<delete id="deleteDcEventImportantFile">
delete from dc_event_important_file where event_id = #{eventId} and type = #{type}
</delete>
</mapper>

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

@ -188,7 +188,7 @@
WHEN '1-1' THEN '追尾'
WHEN '1-2' THEN '侧翻'
WHEN '1-3' THEN '撞护栏'
WHEN '1-4' THEN '自'
WHEN '1-4' THEN '自'
WHEN '1-5' THEN '其他事故'
WHEN '2-1' THEN '车辆故障'
WHEN '3-1' THEN '主线封闭和限行'
@ -255,6 +255,12 @@
WHEN '4' THEN '视频巡查'
WHEN '5' THEN '视频AI'
WHEN '6' THEN '一键救援'
WHEN '8' THEN '雷达识别'
WHEN '9' THEN '锥桶'
WHEN '10' THEN '护栏碰撞'
WHEN '11' THEN '扫码报警'
WHEN '12' THEN '非机预警'
WHEN '13' THEN '气象检测器'
ELSE '其他'
END AS stringEventSource,
event_nature,
@ -427,7 +433,7 @@
WHEN '1-1' THEN '追尾'
WHEN '1-2' THEN '侧翻'
WHEN '1-3' THEN '撞护栏'
WHEN '1-4' THEN '自'
WHEN '1-4' THEN '自'
WHEN '1-5' THEN '其他事故'
WHEN '2-1' THEN '车辆故障'
WHEN '3-1' THEN '主线封闭和限行'
@ -495,6 +501,12 @@
WHEN '4' THEN '视频巡查'
WHEN '5' THEN '视频AI'
WHEN '6' THEN '一键救援'
WHEN '8' THEN '雷达识别'
WHEN '9' THEN '锥桶'
WHEN '10' THEN '护栏碰撞'
WHEN '11' THEN '扫码报警'
WHEN '12' THEN '非机预警'
WHEN '13' THEN '气象检测器'
ELSE '其他'
END AS stringEventSource,
dc_event.event_nature,
@ -800,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}
</select>
</mapper>

4
zc-business/src/main/resources/mapper/business/DcEventTrafficControlMapper.xml

@ -36,7 +36,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
dc_event_traffic_control.exits_inlets as exits_inlets,
dc_event_traffic_control.facility_id as facility_id,
dc_event_traffic_control.id as id,
dc_event_traffic_control.classify as classify,
dc_event_traffic_control.ramp_id as ramp_id,
dc_event_traffic_control.limited_type as limited_type,
dc_event_traffic_control.vehicle_type as vehicle_type,
dc_event_traffic_control.measure as measure,
dc_facility.other_config as other_config,
dc_facility.remark as remark,
dc_facility.stake_mark as stake_mark,

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

@ -68,6 +68,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="dcWarningCountNumber" resultType="int">
select count(*) from dc_warning
<where>
<if test="warningSource != null">warning_source = #{warningSource}</if>
</where>
</select>
<select id="selectDcWarningById" parameterType="string" resultType="hashmap">
@ -252,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>
@ -275,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>
@ -314,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} and employees_type=1
</select>
<select id="selectShifts" resultType="java.util.HashMap">
select shifts.scheduling,employees.name shiftsName,employees.contact_number shiftsNumber from dc_shifts as shifts
@ -365,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
@ -377,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
@ -397,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;
@ -420,5 +415,23 @@ 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>
<select id="selectDispatchId" resultType="java.util.HashMap">
select id dispatchId from dc_dispatch where event_id=#{eventId}
</select>
</mapper>

53
zc-business/src/main/resources/mapper/business/StatusMapper.xml

@ -11,6 +11,7 @@
<result column="device_ip" jdbcType="VARCHAR" property="deviceIp"/>
<result column="success_rate" jdbcType="VARCHAR" property="successRate"/>
<result column="lost_rate" jdbcType="VARCHAR" property="lostRate"/>
<result column="success_rate" jdbcType="VARCHAR" property="successRate"/>
<result column="direction" jdbcType="VARCHAR" property="direction"/>
<result column="manufacturer" jdbcType="VARCHAR" property="production"/>
@ -120,6 +121,9 @@
AND d.use_state = #{status.useState}
</if>
</where>
<if test="status.orderByField != null and status.orderDirection != null">
ORDER BY ${status.orderByField} ${status.orderDirection}
</if>
</select>
@ -184,6 +188,49 @@
AND d.use_state = #{status.useState}
</if>
</where>
<if test="status.orderByField != null and status.orderDirection != null">
ORDER BY ${status.orderByField} ${status.orderDirection}
</if>
</select>
<select id="getStatusList" parameterType="com.zc.business.domain.Status" resultMap="BaseResultMap">
SELECT COALESCE
(d.child_type,d.device_type ) AS type,
s.time,
ROUND( avg( s.success_rate ), 2 ) success_rate
FROM
status s
LEFT JOIN dc_device d ON s.device_id = d.id
<where>
<if test="status.time != null">
AND s.time BETWEEN #{status.startTime,jdbcType=DATE} AND #{status.time,jdbcType=DATE}
</if>
<if test="status.type != null">
AND (d.device_type in
<foreach item="typeItem" collection="status.types" open="(" separator="," close=")">
#{typeItem}
</foreach>
or d.child_type in
<foreach item="typeItem" collection="status.types" open="(" separator="," close=")">
#{typeItem}
</foreach>
)
</if>
<if test="status.deviceId != null">
AND s.device_id = #{status.deviceId}
</if>
<if test="status.useState != null and status.useState != 0">
AND d.use_state = #{status.useState}
</if>
GROUP BY
d.child_type,
d.device_type,
DAY (s.time)
</where>
<if test="status.orderByField != null and status.orderDirection != null">
ORDER BY ${status.orderByField} ${status.orderDirection}
</if>
</select>
@ -213,6 +260,9 @@
AND d.use_state = #{status.useState}
</if>
</where>
<if test="status.orderByField != null and status.orderDirection != null">
ORDER BY ${status.orderByField} ${status.orderDirection}
</if>
</select>
<select id="deviceStatusListById" parameterType="com.zc.business.domain.Status" resultMap="BaseResultMap">
@ -226,6 +276,9 @@
AND s.device_id = #{status.deviceId}
</if>
</where>
<if test="status.orderByField != null and status.orderDirection != null">
ORDER BY ${status.orderByField} ${status.orderDirection}
</if>
</select>
</mapper>

Loading…
Cancel
Save