Browse Source

事件解除时设备控制恢复

develop
lau572 4 days ago
parent
commit
9af506773a
  1. 44
      zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java

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

@ -1,6 +1,8 @@
package com.zc.business.service.impl; package com.zc.business.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
@ -9,6 +11,8 @@ import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.system.service.ISysDeptService; import com.ruoyi.system.service.ISysDeptService;
import com.zc.business.constant.DeviceFunctionIdConstants;
import com.zc.business.controller.DcDeviceController;
import com.zc.business.domain.*; import com.zc.business.domain.*;
import com.zc.business.enums.*; import com.zc.business.enums.*;
import com.zc.business.mapper.*; import com.zc.business.mapper.*;
@ -24,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@ -92,6 +97,12 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
@Autowired @Autowired
private DcWarningServiceImpl dcWarningService; private DcWarningServiceImpl dcWarningService;
@Autowired
private EventPlanAssocMapper eventPlanAssocMapper;
@Autowired
private DcDeviceController deviceController;
private final String HAPPEN = UniversalEnum.TAKE_PLACE.getValue(); private final String HAPPEN = UniversalEnum.TAKE_PLACE.getValue();
private final String EVENT = UniversalEnum.INCIDENT.getValue(); private final String EVENT = UniversalEnum.INCIDENT.getValue();
//private final String SUBEVENT = "0"; //private final String SUBEVENT = "0";
@ -2003,6 +2014,39 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
boolean flag = dcEventMapper.completeEvent(eventId); boolean flag = dcEventMapper.completeEvent(eventId);
if (flag) { if (flag) {
EventPlanAssoc eventPlanAssoc = new EventPlanAssoc();
eventPlanAssoc.setEventId(eventId);
LambdaQueryWrapper<EventPlanAssoc> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(EventPlanAssoc::getEventId,eventId);
lambdaQueryWrapper.eq(EventPlanAssoc::getOperationType,"1");
List<EventPlanAssoc> eventPlanAssocs = eventPlanAssocMapper.selectList(lambdaQueryWrapper);
if (eventPlanAssocs != null && eventPlanAssocs.size() > 0){
for (EventPlanAssoc planAssoc : eventPlanAssocs) {
JSONArray control = JSONArray.parseArray(planAssoc.getControl());
for (Object o : control) {
JSONObject controlItem = (JSONObject) o;
String[] deviceList = controlItem.getString("deviceList").split(",");
JSONObject recoverConfig = controlItem.getJSONObject("recoverConfig");
int deviceType = controlItem.getIntValue("deviceType");
if (deviceType == 2){
//情报板 切换播放目录
for (String deviceId : deviceList) {
HashMap<String, Object> props = new HashMap<>();
props.put("fileId", UniversalEnum.TEN.getValue());
String functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_1B;
deviceController.getAjaxResult(deviceId, functionId, props);
}
} else if (deviceType == 10){
//激光疲劳唤醒
} else if (deviceType == 12){
//行车诱导
}
}
}
}
//中间库 //中间库
MdEvent mdEvent = new MdEvent(); MdEvent mdEvent = new MdEvent();

Loading…
Cancel
Save