|
|
@ -9,6 +9,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
import com.ruoyi.common.core.domain.AjaxResult; |
|
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
|
import com.ruoyi.common.utils.uuid.IdUtils; |
|
|
|
import com.zc.business.constant.DeviceFunctionIdConstants; |
|
|
|
import com.zc.business.constant.DeviceTypeConstants; |
|
|
|
import com.zc.business.controller.BroadcastController; |
|
|
@ -728,29 +729,24 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
|
JSONObject resultObject = new JSONObject(); |
|
|
|
// 事件编号
|
|
|
|
eventPlanAssoc.setEventId(id); |
|
|
|
eventPlanAssoc.setOperationType(dcEventAnDcEmergencyPlans.getOperationType()); |
|
|
|
EventPlanAssoc selectEventPlanAssoc = eventPlanAssocMapper.selectByEventId(eventPlanAssoc); |
|
|
|
// 区分是执行操作 还是 恢复操作
|
|
|
|
if (dcEventAnDcEmergencyPlans.getOperationType().equals(1) && selectEventPlanAssoc == null) { |
|
|
|
// 首次执行操作
|
|
|
|
|
|
|
|
if (selectEventPlanAssoc == null) { |
|
|
|
// 执行新增
|
|
|
|
eventPlanAssoc.setEmergencyPlansId(dcEmergencyPlans.getId()); |
|
|
|
eventPlanAssoc.setExecutingControlDevice(deviceIds.toString().replaceFirst(";", "")); |
|
|
|
eventPlanAssoc.setExecutingControlResult(resultArray.toJSONString()); |
|
|
|
eventPlanAssoc.setControlDevice(deviceIds.toString().replaceFirst(";", "")); |
|
|
|
eventPlanAssoc.setControlResult(resultArray.toJSONString()); |
|
|
|
eventPlanAssoc.setCreateTime(DateUtils.getNowDate()); |
|
|
|
int eventPlanAssocId = eventPlanAssocMapper.insertEventPlanAssoc(eventPlanAssoc); |
|
|
|
resultObject.put("eventPlanAssocId",eventPlanAssocId); |
|
|
|
} |
|
|
|
else if (StringUtils.isNotEmpty(selectEventPlanAssoc.getId()) && dcEventAnDcEmergencyPlans.getOperationType().equals(1)) { |
|
|
|
// 多次执行操作
|
|
|
|
selectEventPlanAssoc.setExecutingControlResult(resultArray.toJSONString()); |
|
|
|
selectEventPlanAssoc.setUpdateTime(DateUtils.getNowDate()); |
|
|
|
eventPlanAssocMapper.updateEventPlanAssoc(selectEventPlanAssoc); |
|
|
|
resultObject.put("eventPlanAssocId",selectEventPlanAssoc.getId()); |
|
|
|
} |
|
|
|
else { |
|
|
|
// 恢复操作 未执行的事件不能进行恢复操作
|
|
|
|
// IdUtils.fastSimpleUUID()
|
|
|
|
eventPlanAssoc.setId(IdUtils.fastSimpleUUID()); |
|
|
|
eventPlanAssocMapper.insertEventPlanAssoc(eventPlanAssoc); |
|
|
|
resultObject.put("eventPlanAssocId",eventPlanAssoc.getId()); |
|
|
|
}else { |
|
|
|
// 执行修改操作
|
|
|
|
selectEventPlanAssoc.setUpdateTime(DateUtils.getNowDate()); |
|
|
|
selectEventPlanAssoc.setRecoveredControlDevice(deviceIds.toString().replaceFirst(";", "")); |
|
|
|
selectEventPlanAssoc.setRecoveredControlResult(resultArray.toJSONString()); |
|
|
|
selectEventPlanAssoc.setControlDevice(deviceIds.toString().replaceFirst(";", "")); |
|
|
|
selectEventPlanAssoc.setControlResult(resultArray.toJSONString()); |
|
|
|
eventPlanAssocMapper.updateEventPlanAssoc(selectEventPlanAssoc); |
|
|
|
resultObject.put("eventPlanAssocId",selectEventPlanAssoc.getId()); |
|
|
|
} |
|
|
@ -783,18 +779,24 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
|
props.put("onWorkStatus", otherConfig.get("state").toString()); |
|
|
|
props.put("inWorkStatus", otherConfig.get("state").toString()); |
|
|
|
props.put("mode", controlModel); |
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
if (controlModel.equals("01")) { |
|
|
|
String startTime = otherConfig.get("startTime").toString(); |
|
|
|
String endTime = otherConfig.get("endTime").toString(); |
|
|
|
props.put("mode", "01"); |
|
|
|
props.put("startDisplayTime", startTime); |
|
|
|
props.put("endDisplayTime", endTime); |
|
|
|
result.put("content","时间自动"); |
|
|
|
} else if (controlModel.equals("00")) { |
|
|
|
result.put("content","手动"); |
|
|
|
}else { |
|
|
|
result.put("content","万年历"); |
|
|
|
} |
|
|
|
|
|
|
|
AjaxResult ajaxResult = dcDeviceController.invokedFunction(iotDeviceId, functionId, props); |
|
|
|
// 将调用结果存入到 resultArray(操作结果) 中
|
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
result.put("device", device.getId()); |
|
|
|
result.put("deviceName",device.getDeviceName()); |
|
|
|
result.put("result", ajaxResult); |
|
|
|
resultArray.add(result); |
|
|
|
|
|
|
@ -831,12 +833,12 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
|
// 还原上次
|
|
|
|
props.put("fileId", "10"); |
|
|
|
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_1B; |
|
|
|
AjaxResult ajaxResult1B; |
|
|
|
|
|
|
|
ajaxResult1B = dcDeviceController.invokedFunction(iotDeviceId, functionId, props); |
|
|
|
|
|
|
|
AjaxResult ajaxResult1B = dcDeviceController.invokedFunction(iotDeviceId, functionId, props); |
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
result.put("device", device.getId()); |
|
|
|
result.put("deviceName",device.getDeviceName()); |
|
|
|
result.put("content","还原上次"); |
|
|
|
result.put("result", ajaxResult1B); |
|
|
|
resultArray.add(result); |
|
|
|
}else { |
|
|
@ -866,6 +868,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
|
// 说明没有匹配到设备
|
|
|
|
JSONObject errorResult = new JSONObject(); |
|
|
|
errorResult.put("device",device.getId()); |
|
|
|
errorResult.put("deviceName",device.getDeviceName()); |
|
|
|
errorResult.put("errorMessage","未匹配到对应的广播内容"); |
|
|
|
resultArray.add(errorResult); |
|
|
|
} |
|
|
@ -882,6 +885,8 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
|
JSONObject returnResult = broadcastController.nearCamListDistance(params); |
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
result.put("device", device.getId()); |
|
|
|
result.put("deviceName",device.getDeviceName()); |
|
|
|
result.put("content",params.get("text")); |
|
|
|
result.put("result", returnResult); |
|
|
|
resultArray.add(result); |
|
|
|
|
|
|
@ -894,6 +899,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
|
AjaxResult ajaxResultState = dcDeviceController.invokedFunction(iotDeviceId, functionId, new HashMap<>()); |
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
result.put("device", device.getId()); |
|
|
|
result.put("deviceName",device.getDeviceName()); |
|
|
|
result.put("result", ajaxResultState); |
|
|
|
resultArray.add(result); |
|
|
|
|
|
|
@ -906,6 +912,8 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
|
AjaxResult ajaxResult = dcDeviceController.invokedFunction(iotDeviceId, functionId, propsTime); |
|
|
|
JSONObject resultTime = new JSONObject(); |
|
|
|
resultTime.put("device", device.getId()); |
|
|
|
resultTime.put("deviceName",device.getDeviceName()); |
|
|
|
resultTime.put("content","操作时长"+otherConfig.get("operationDuration")); |
|
|
|
resultTime.put("result", ajaxResult); |
|
|
|
resultArray.add(resultTime); |
|
|
|
|
|
|
@ -943,8 +951,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
|
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_11; |
|
|
|
props.put("fileName", "play011.lst"); |
|
|
|
props.put("size", "65535"); |
|
|
|
AjaxResult ajaxResult11; |
|
|
|
ajaxResult11 = dcDeviceController.invokedFunction(iotDeviceId, functionId, props); |
|
|
|
AjaxResult ajaxResult11 = dcDeviceController.invokedFunction(iotDeviceId, functionId, props); |
|
|
|
if (ajaxResult11.get("code").equals(200)) { |
|
|
|
// 2:执行13功能码
|
|
|
|
HashMap<String, Object> props11 = new HashMap<>(); |
|
|
@ -975,8 +982,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
|
parameters.put("formatStyle", dcInfoBoardTemplate.getFormatStyle()); |
|
|
|
list.add(parameters); |
|
|
|
props11.put("parameters", list); |
|
|
|
AjaxResult ajaxResult13 = null; |
|
|
|
ajaxResult13 = dcDeviceController.invokedFunction(iotDeviceId, functionId, props11); |
|
|
|
AjaxResult ajaxResult13 = dcDeviceController.invokedFunction(iotDeviceId, functionId, props11); |
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
if (ajaxResult13.get("code").equals(200)) { |
|
|
|
HashMap<String, Object> props1B = new HashMap<>(); |
|
|
@ -985,11 +991,15 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
|
props1B.put("fileId", "11"); |
|
|
|
AjaxResult ajaxResult1B = dcDeviceController.invokedFunction(iotDeviceId, functionId, props1B); |
|
|
|
result.put("device", device.getId()); |
|
|
|
result.put("deviceName",device.getDeviceName()); |
|
|
|
result.put("content",dcInfoBoardTemplate.getContent()); |
|
|
|
result.put("result", ajaxResult1B); |
|
|
|
resultArray.add(result); |
|
|
|
|
|
|
|
} else { |
|
|
|
result.put("device", device.getId()); |
|
|
|
result.put("deviceName",device.getDeviceName()); |
|
|
|
result.put("content","发布失败"); |
|
|
|
result.put("result", ajaxResult13); |
|
|
|
resultArray.add(result); |
|
|
|
} |
|
|
|