Browse Source

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

develop
wangsixiang 11 months ago
parent
commit
662f06f0b2
  1. 9
      zc-business/src/main/java/com/zc/business/controller/DcEmergencyPlansController.java
  2. 2
      zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java
  3. 37
      zc-business/src/main/java/com/zc/business/controller/StatusController.java
  4. 4
      zc-business/src/main/java/com/zc/business/domain/Status.java
  5. 17
      zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java
  6. 8
      zc-business/src/main/java/com/zc/business/service/DcEmergencyPlansService.java
  7. 37
      zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java

9
zc-business/src/main/java/com/zc/business/controller/DcEmergencyPlansController.java

@ -126,6 +126,15 @@ public class DcEmergencyPlansController extends BaseController {
return AjaxResult.success(dcEmergencyPlansService.executionEventConfirmation(dcEventAnDcEmergencyPlans)); return AjaxResult.success(dcEmergencyPlansService.executionEventConfirmation(dcEventAnDcEmergencyPlans));
} }
/**
* 根据事件id-查询预案事件关联表
*/
@ApiOperation("根据事件id-查询预案事件关联表")
@GetMapping("/event/assoc/{id}")
public AjaxResult eventConfirm(@PathVariable("id") String id) {
return AjaxResult.success(dcEmergencyPlansService.selectEventPlanAssocByEventId(id));
}
/** /**
* 感知事件确定 * 感知事件确定
*/ */

2
zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java

@ -14,6 +14,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.eclipse.paho.client.mqttv3.*; import org.eclipse.paho.client.mqttv3.*;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -32,6 +33,7 @@ import java.util.Objects;
*/ */
@Api(tags = "非机预警接口") @Api(tags = "非机预警接口")
@RestController @RestController
@Component
@RequestMapping("/nonAutomaticWarning") @RequestMapping("/nonAutomaticWarning")
public class NonAutomaticWarningController extends BaseController { public class NonAutomaticWarningController extends BaseController {

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

@ -1,8 +1,10 @@
package com.zc.business.controller; package com.zc.business.controller;
import com.github.pagehelper.util.StringUtil;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
@ -15,6 +17,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
@ -31,6 +34,10 @@ public class StatusController extends BaseController {
private StatusService statusService; private StatusService statusService;
@Autowired @Autowired
private DcDeviceServiceImpl dcDeviceService; private DcDeviceServiceImpl dcDeviceService;
@Resource
private RedisCache redisCache;
private static final String ORDERRULE = "orderRule";//排序策略key
//设备列表 //设备列表
@ApiOperation("设备状态列表按时间和类型") @ApiOperation("设备状态列表按时间和类型")
@ -95,6 +102,16 @@ public class StatusController extends BaseController {
} }
//按时间划分设备柱状图
@ApiOperation("更新缓存规则")
@GetMapping ("/rule")
public AjaxResult setRule(String rule)
{
redisCache.setCacheSetValue(ORDERRULE,rule);
return AjaxResult.success();
}
@ApiOperation("根据设备Id查询折线图数据") @ApiOperation("根据设备Id查询折线图数据")
@GetMapping("/deviceStatusList/{deviceId}") @GetMapping("/deviceStatusList/{deviceId}")
public AjaxResult getDeviceStatusList(@PathVariable Long deviceId) { public AjaxResult getDeviceStatusList(@PathVariable Long deviceId) {
@ -251,11 +268,11 @@ public class StatusController extends BaseController {
Integer lastKey = Collections.max(ipMap.keySet()); Integer lastKey = Collections.max(ipMap.keySet());
List<Status> lastEntry = ipMap.get(lastKey); List<Status> lastEntry = ipMap.get(lastKey);
Map<String, List<Status>> typeMap = lastEntry.stream().filter(iteam -> iteam.getType() != null).collect(Collectors.groupingBy(Status::getType)); Map<String, List<Status>> typeMap = lastEntry.stream().filter(iteam -> iteam.getType() != null).collect(Collectors.groupingBy(Status::getType));
Map<String, Map<String, String>> subMap = new HashMap<>(); Map<String, Map<Object, Object>> subMap = new HashMap<>();
itemTypeMap.forEach((key, value) -> { itemTypeMap.forEach((key, value) -> {
Map<String, String> maps = new HashMap<>(); Map<Object, Object> maps = new HashMap<>();
List<Status> groupItems = typeMap.get(key); List<Status> groupItems = typeMap.get(key);
if (groupItems == null) { if (groupItems == null) {
//丢包率 //丢包率
@ -317,7 +334,7 @@ public class StatusController extends BaseController {
// //
// } // }
//} //}
Map<String, String> maps=new HashMap<>(); Map<Object, Object> maps=new HashMap<>();
double lostRate = lastEntry.stream() double lostRate = lastEntry.stream()
.mapToDouble(Status -> Double.parseDouble(Status.getLostRate().replace("%", ""))) // 去掉%,并转换为double .mapToDouble(Status -> Double.parseDouble(Status.getLostRate().replace("%", ""))) // 去掉%,并转换为double
.average().getAsDouble(); .average().getAsDouble();
@ -337,7 +354,19 @@ public class StatusController extends BaseController {
//总数 //总数
maps.put("sum",String.valueOf(list.size())); maps.put("sum",String.valueOf(list.size()));
subMap.put("全部设备",maps); subMap.put("全部设备",maps);
// Map<Object, Object> ruleMap=new HashMap<>();
// String orderRule=redisCache.getCacheObject(ORDERRULE);
// if(StringUtil.isNotEmpty(orderRule)){
// ruleMap.put("rule",orderRule);
// subMap.put("排序规则",ruleMap);
// }else{
// String[] rules = {"全部设备","高清网络枪型固定摄像机","高清网络球形摄像机","桥下高清网络球形摄像机","360°全景摄像机","180°全景摄像机",
// "门架式可变信息标志","雨棚可变信息标志","站前悬臂式可变信息标志","气象检测器","路段语音广播系统","护栏碰撞预警系统","毫米波雷达",
// "合流区预警系统","激光疲劳唤醒","一类交通量调查站","智能行车诱导系统"};
// orderRule= Arrays.toString(rules);
// ruleMap.put("rule",orderRule);
// subMap.put("排序规则",ruleMap);
// }
return AjaxResult.success(subMap); return AjaxResult.success(subMap);
} }

4
zc-business/src/main/java/com/zc/business/domain/Status.java

@ -125,7 +125,7 @@ public class Status {
private Long deviceId; private Long deviceId;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern ="yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern ="yyyy-MM-dd HH:mm:ss")
@Excel(name = "监测时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "监测时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime time; private LocalDateTime time;
public String getSuccessRate() { public String getSuccessRate() {
@ -208,7 +208,7 @@ public class Status {
this.deviceId = deviceId; this.deviceId = deviceId;
} }
@Excel(name = "型号") // @Excel(name = "型号")
private String model; private String model;

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

@ -378,16 +378,20 @@ public class DeviceMessageHandler {
String direction = ""; String direction = "";
if (Objects.equals(location, "0")) { if (Objects.equals(location, "0")) {
dcWarning.setDirection("1"); dcWarning.setDirection("1");
direction = "上行右侧"; dcWarning.setLane("0");
direction = "菏泽方向右侧护栏";
} else if (Objects.equals(location, "1")) { } else if (Objects.equals(location, "1")) {
dcWarning.setDirection("1"); dcWarning.setDirection("1");
direction = "上行左侧"; dcWarning.setLane("1");
direction = "菏泽方向左侧护栏";
} else if (Objects.equals(location, "10")) { } else if (Objects.equals(location, "10")) {
dcWarning.setDirection("0"); dcWarning.setDirection("0");
direction = "下行右侧"; dcWarning.setLane("0");
direction = "济南方向右侧护栏";
} else if (Objects.equals(location, "11")) { } else if (Objects.equals(location, "11")) {
dcWarning.setDirection("0"); dcWarning.setDirection("0");
direction = "下行左侧"; dcWarning.setLane("1");
direction = "济南方向左侧护栏";
} }
String eventType = ""; String eventType = "";
@ -423,8 +427,11 @@ public class DeviceMessageHandler {
dcWarning.setStakeMark(dcDevices.get(0).getStakeMark()); dcWarning.setStakeMark(dcDevices.get(0).getStakeMark());
dcWarning.setWarningType(9); dcWarning.setWarningType(9);
dcWarning.setWarningSubclass("4");
dcWarning.setWarningState(1);
dcWarning.setCreateTime(new Date()); dcWarning.setCreateTime(new Date());
dcWarning.setWarningTitle("护栏碰撞上报事件:区域号为" + areaCode + "在" + timeOfFireAlarming + direction + "发生" + eventType + "事件"); dcWarning.setDirection("护栏碰撞上报事件:区域号为" + areaCode + "在20" + timeOfFireAlarming + direction + "发生" + eventType + "事件");
dcWarning.setWarningTitle("护栏碰撞在20" + timeOfFireAlarming + direction + "发生" + eventType + "事件");
dcWarning.setOtherConfig(dataJsonObject.toJSONString()); dcWarning.setOtherConfig(dataJsonObject.toJSONString());
dcWarningService.insertDcWarning(dcWarning); dcWarningService.insertDcWarning(dcWarning);
} }

8
zc-business/src/main/java/com/zc/business/service/DcEmergencyPlansService.java

@ -65,6 +65,14 @@ public interface DcEmergencyPlansService {
*/ */
JSONArray executionEventConfirmation(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans); JSONArray executionEventConfirmation(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans);
/**
* 根据事件id-查询预案事件关联表
*
* @param eventId 事件id
* @return 结果
*/
EventPlanAssoc selectEventPlanAssocByEventId(String eventId);
/** /**
* 感知事件确定 * 感知事件确定
* *

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

@ -424,6 +424,18 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
return executionConfirmation(dcEventAnDcEmergencyPlans, dcEvent.getStakeMark(), direction, id); return executionConfirmation(dcEventAnDcEmergencyPlans, dcEvent.getStakeMark(), direction, id);
} }
/**
* 根据事件id-查询预案事件关联表
* @param eventId 事件id
* @return
*/
@Override
public EventPlanAssoc selectEventPlanAssocByEventId(String eventId) {
EventPlanAssoc eventPlanAssoc = new EventPlanAssoc();
eventPlanAssoc.setEventId(eventId);
return eventPlanAssocMapper.selectByEventId(eventPlanAssoc);
}
/** /**
* 感知事件-情报板自动生成 * 感知事件-情报板自动生成
* *
@ -584,17 +596,24 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
EventPlanAssoc eventPlanAssoc = new EventPlanAssoc(); EventPlanAssoc eventPlanAssoc = new EventPlanAssoc();
// 事件编号 // 事件编号
eventPlanAssoc.setEventId(id); eventPlanAssoc.setEventId(id);
EventPlanAssoc selectEventPlanAssoc = eventPlanAssocMapper.selectByEventId(eventPlanAssoc);
// 区分是执行操作 还是 恢复操作 // 区分是执行操作 还是 恢复操作
if (dcEventAnDcEmergencyPlans.getOperationType().equals(1)) { if (dcEventAnDcEmergencyPlans.getOperationType().equals(1) && StringUtils.isEmpty(selectEventPlanAssoc.getId())) {
// 事件预案编号 // 首次执行操作
eventPlanAssoc.setEmergencyPlansId(dcEmergencyPlans.getId()); eventPlanAssoc.setEmergencyPlansId(dcEmergencyPlans.getId());
eventPlanAssoc.setExecutingControlDevice(deviceIds.toString().replaceFirst(";", "")); eventPlanAssoc.setExecutingControlDevice(deviceIds.toString().replaceFirst(";", ""));
eventPlanAssoc.setExecutingControlResult(resultArray.toJSONString()); eventPlanAssoc.setExecutingControlResult(resultArray.toJSONString());
eventPlanAssoc.setCreateTime(DateUtils.getNowDate()); eventPlanAssoc.setCreateTime(DateUtils.getNowDate());
eventPlanAssocMapper.insertEventPlanAssoc(eventPlanAssoc); eventPlanAssocMapper.insertEventPlanAssoc(eventPlanAssoc);
} else { }
EventPlanAssoc selectEventPlanAssoc = eventPlanAssocMapper.selectByEventId(eventPlanAssoc); else if (StringUtils.isNotEmpty(selectEventPlanAssoc.getId()) && dcEventAnDcEmergencyPlans.getOperationType().equals(1)) {
// 多次执行操作
selectEventPlanAssoc.setExecutingControlResult(resultArray.toJSONString());
selectEventPlanAssoc.setUpdateTime(DateUtils.getNowDate());
eventPlanAssocMapper.updateEventPlanAssoc(selectEventPlanAssoc);
}
else {
// 恢复操作 未执行的事件不能进行恢复操作
selectEventPlanAssoc.setUpdateTime(DateUtils.getNowDate()); selectEventPlanAssoc.setUpdateTime(DateUtils.getNowDate());
selectEventPlanAssoc.setRecoveredControlDevice(deviceIds.toString().replaceFirst(";", "")); selectEventPlanAssoc.setRecoveredControlDevice(deviceIds.toString().replaceFirst(";", ""));
selectEventPlanAssoc.setRecoveredControlResult(resultArray.toJSONString()); selectEventPlanAssoc.setRecoveredControlResult(resultArray.toJSONString());
@ -620,7 +639,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
iotDeviceId = device.getIotDeviceId(); iotDeviceId = device.getIotDeviceId();
HashMap<String, Object> props = new HashMap<>(); HashMap<String, Object> props = new HashMap<>();
try { try {
if (device.getDeviceType().equals(DeviceTypeConstants.DRIVING_GUIDANCE)) { if (device.getDeviceType().equals(DeviceTypeConstants.DRIVING_GUIDANCE.toString())) {
// 行车诱导 // 行车诱导
functionId = DeviceFunctionIdConstants.DRIVING_GUIDANCE; functionId = DeviceFunctionIdConstants.DRIVING_GUIDANCE;
// 控制模式 1-手动 2-自动 3-万年历 // 控制模式 1-手动 2-自动 3-万年历
@ -645,7 +664,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
} }
else if (device.getDeviceType().equals(DeviceTypeConstants.VARIABLE_INFORMATION_FLAG)) { else if (device.getDeviceType().equals(DeviceTypeConstants.VARIABLE_INFORMATION_FLAG.toString())) {
if (operationType == 1) { if (operationType == 1) {
// 执行操作 // 执行操作
@ -721,7 +740,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
} }
} }
else if (device.getDeviceType().equals(DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING)) { else if (device.getDeviceType().equals(DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING.toString())) {
// 路段广播 // 路段广播
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
params.put("name", "task-event"); params.put("name", "task-event");
@ -742,7 +761,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
} }
else if (device.getDeviceType().equals(DeviceTypeConstants.LASER_FATIGUE_AWAKENING)) { else if (device.getDeviceType().equals(DeviceTypeConstants.LASER_FATIGUE_AWAKENING.toString())) {
// 激光疲劳唤醒 // 激光疲劳唤醒
functionId = otherConfig.get("state").toString(); functionId = otherConfig.get("state").toString();

Loading…
Cancel
Save