|
@ -196,7 +196,8 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
markArray[1] = String.format("%0" + 3 + "d", markArray[1]); |
|
|
markArray[1] = String.format("%0" + 3 + "d", markArray[1]); |
|
|
} |
|
|
} |
|
|
DcExecuteAction executeAction = dcEventAnDcEmergencyPlans.getDcEmergencyPlans().getExecuteAction(); |
|
|
DcExecuteAction executeAction = dcEventAnDcEmergencyPlans.getDcEmergencyPlans().getExecuteAction(); |
|
|
List<DcDevice> dcDevices = ruleFiltering(executeAction, markArray, direction); |
|
|
Integer operationType = dcEventAnDcEmergencyPlans.getOperationType(); |
|
|
|
|
|
List<DcDevice> dcDevices = ruleFiltering(executeAction, markArray, direction, operationType); |
|
|
return getBoardTemplate(dcDevices); |
|
|
return getBoardTemplate(dcDevices); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -217,7 +218,8 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
markArray[1] = String.format("%0" + 3 + "d", markArray[1]); |
|
|
markArray[1] = String.format("%0" + 3 + "d", markArray[1]); |
|
|
} |
|
|
} |
|
|
DcExecuteAction executeAction = dcEventAnDcEmergencyPlans.getDcEmergencyPlans().getExecuteAction(); |
|
|
DcExecuteAction executeAction = dcEventAnDcEmergencyPlans.getDcEmergencyPlans().getExecuteAction(); |
|
|
List<DcDevice> dcDevices = ruleFiltering(executeAction, markArray, direction); |
|
|
Integer operationType = dcEventAnDcEmergencyPlans.getOperationType(); |
|
|
|
|
|
List<DcDevice> dcDevices = ruleFiltering(executeAction, markArray, direction, operationType); |
|
|
return getBoardTemplate(dcDevices); |
|
|
return getBoardTemplate(dcDevices); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -287,9 +289,12 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
* @param direction |
|
|
* @param direction |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
public List<DcDevice> ruleFiltering(DcExecuteAction dcExecuteAction, String[] markArray, String direction) { |
|
|
public List<DcDevice> ruleFiltering(DcExecuteAction dcExecuteAction, String[] markArray, String direction, Integer operationType) { |
|
|
|
|
|
|
|
|
Integer searchRule = dcExecuteAction.getSearchRule(); |
|
|
Integer searchRule = dcExecuteAction.getSearchRule(); |
|
|
|
|
|
// 区分执行操作还是恢复操作
|
|
|
|
|
|
JSONObject otherConfig = operationType.equals(1)? |
|
|
|
|
|
JSON.parseObject(dcExecuteAction.getExecuteConfig()): JSON.parseObject(dcExecuteAction.getRecoverConfig()); |
|
|
List<String> start = new ArrayList<>(); |
|
|
List<String> start = new ArrayList<>(); |
|
|
List<String> end = new ArrayList<>(); |
|
|
List<String> end = new ArrayList<>(); |
|
|
// 设备列表
|
|
|
// 设备列表
|
|
@ -301,7 +306,6 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
// 指定设备资源
|
|
|
// 指定设备资源
|
|
|
// 根据设备id,获取设备集合
|
|
|
// 根据设备id,获取设备集合
|
|
|
LambdaQueryWrapper<DcDevice> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
LambdaQueryWrapper<DcDevice> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
JSONObject otherConfig = JSON.parseObject(dcExecuteAction.getExecuteConfig()); |
|
|
|
|
|
List<String> deviceList = (List<String>) otherConfig.get("deviceList"); |
|
|
List<String> deviceList = (List<String>) otherConfig.get("deviceList"); |
|
|
queryWrapper.in(DcDevice::getIotDeviceId, deviceList); |
|
|
queryWrapper.in(DcDevice::getIotDeviceId, deviceList); |
|
|
dcDevices = dcDeviceService.list(queryWrapper); |
|
|
dcDevices = dcDeviceService.list(queryWrapper); |
|
@ -564,19 +568,21 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
|
|
|
|
|
|
// 获取事件预案数据
|
|
|
// 获取事件预案数据
|
|
|
DcEmergencyPlans dcEmergencyPlans = dcEventAnDcEmergencyPlans.getDcEmergencyPlans(); |
|
|
DcEmergencyPlans dcEmergencyPlans = dcEventAnDcEmergencyPlans.getDcEmergencyPlans(); |
|
|
|
|
|
Integer operationType = dcEventAnDcEmergencyPlans.getOperationType(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取事件预案中的 执行操作配置
|
|
|
//获取事件预案中的操作配置
|
|
|
dcEmergencyPlans.getDcExecuteAction() |
|
|
dcEmergencyPlans.getDcExecuteAction() |
|
|
.forEach(dcExecuteAction -> { |
|
|
.forEach(dcExecuteAction -> { |
|
|
List<DcDevice> dcDevices = ruleFiltering(dcExecuteAction, markArray, direction); |
|
|
List<DcDevice> dcDevices = ruleFiltering(dcExecuteAction, markArray, direction, operationType); |
|
|
|
|
|
JSONObject otherConfig = operationType.equals(1)? |
|
|
|
|
|
JSON.parseObject(dcExecuteAction.getExecuteConfig()): JSON.parseObject(dcExecuteAction.getRecoverConfig()); |
|
|
try { |
|
|
try { |
|
|
// 根据不通设备类型,执行不通的功能操作
|
|
|
// 根据不通设备类型,执行不通的功能操作
|
|
|
invokedFunction( |
|
|
invokedFunction( |
|
|
dcEventAnDcEmergencyPlans.getOperationType(), |
|
|
dcEventAnDcEmergencyPlans.getOperationType(), |
|
|
dcDevices, |
|
|
dcDevices, |
|
|
JSON.parseObject(dcExecuteAction.getExecuteConfig()), |
|
|
otherConfig, |
|
|
resultArray); |
|
|
resultArray); |
|
|
|
|
|
|
|
|
// 记录操作过的设备id
|
|
|
// 记录操作过的设备id
|
|
@ -666,67 +672,12 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
} |
|
|
} |
|
|
else if (device.getDeviceType().equals(DeviceTypeConstants.VARIABLE_INFORMATION_FLAG.toString())) { |
|
|
else if (device.getDeviceType().equals(DeviceTypeConstants.VARIABLE_INFORMATION_FLAG.toString())) { |
|
|
if (operationType == 1) { |
|
|
if (operationType == 1) { |
|
|
|
|
|
// 情报板发布全流程
|
|
|
// 执行操作
|
|
|
boardReleaseProcess(props, iotDeviceId, otherConfig, device, resultArray); |
|
|
// 可变信息标志 分三步
|
|
|
|
|
|
// 1:执行11功能码
|
|
|
|
|
|
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_11; |
|
|
|
|
|
props.put("fileName", "play011.lst"); |
|
|
|
|
|
props.put("size", "65535"); |
|
|
|
|
|
AjaxResult ajaxResult11; |
|
|
|
|
|
ajaxResult11 = dcDeviceController.invokedFunction(iotDeviceId, functionId, props); |
|
|
|
|
|
if (ajaxResult11.get("code").equals(200)) { |
|
|
|
|
|
// 2:执行13功能码
|
|
|
|
|
|
HashMap<String, Object> props11 = new HashMap<>(); |
|
|
|
|
|
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_13; |
|
|
|
|
|
List<Map<String, String>> list = new ArrayList<>(); |
|
|
|
|
|
Map<String, String> parameters = new HashMap<>(); |
|
|
|
|
|
DcInfoBoardTemplate dcInfoBoardTemplate = JSON.parseObject( |
|
|
|
|
|
JSON.toJSONString(otherConfig.get("dcInfoBoardTemplate")), |
|
|
|
|
|
DcInfoBoardTemplate.class); |
|
|
|
|
|
// stopTime
|
|
|
|
|
|
parameters.put("STAY", dcInfoBoardTemplate.getStopTime()); |
|
|
|
|
|
// inScreenMode
|
|
|
|
|
|
parameters.put("ACTION", dcInfoBoardTemplate.getInScreenMode()); |
|
|
|
|
|
// fontSpacing
|
|
|
|
|
|
parameters.put("SPEED", dcInfoBoardTemplate.getFontSpacing()); |
|
|
|
|
|
// fontColor
|
|
|
|
|
|
parameters.put("COLOR", dcInfoBoardTemplate.getFontColor()); |
|
|
|
|
|
// fontType
|
|
|
|
|
|
parameters.put("FONT", dcInfoBoardTemplate.getFontType()); |
|
|
|
|
|
// fontSize
|
|
|
|
|
|
parameters.put("FONT_SIZE", dcInfoBoardTemplate.getFontSize()); |
|
|
|
|
|
// content
|
|
|
|
|
|
parameters.put("CONTENT", dcInfoBoardTemplate.getContent()); |
|
|
|
|
|
// screenSize 768*64 宽度和高度
|
|
|
|
|
|
parameters.put("width", dcInfoBoardTemplate.getScreenSize().split("\\*")[0]); |
|
|
|
|
|
parameters.put("height", dcInfoBoardTemplate.getScreenSize().split("\\*")[1]); |
|
|
|
|
|
// formatStyle
|
|
|
|
|
|
parameters.put("formatStyle", dcInfoBoardTemplate.getFormatStyle()); |
|
|
|
|
|
list.add(parameters); |
|
|
|
|
|
props11.put("parameters", list); |
|
|
|
|
|
AjaxResult ajaxResult13 = null; |
|
|
|
|
|
ajaxResult13 = dcDeviceController.invokedFunction(iotDeviceId, functionId, props11); |
|
|
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
|
|
if (ajaxResult13.get("code").equals(200)) { |
|
|
|
|
|
HashMap<String, Object> props1B = new HashMap<>(); |
|
|
|
|
|
// 3: 执行1B功能码
|
|
|
|
|
|
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_1B; |
|
|
|
|
|
props1B.put("fileId", "11"); |
|
|
|
|
|
AjaxResult ajaxResult1B = dcDeviceController.invokedFunction(iotDeviceId, functionId, props1B); |
|
|
|
|
|
result.put("device", device.getId()); |
|
|
|
|
|
result.put("result", ajaxResult1B); |
|
|
|
|
|
resultArray.add(result); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
result.put("device", device.getId()); |
|
|
|
|
|
result.put("result", ajaxResult13); |
|
|
|
|
|
resultArray.add(result); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
// 恢复操作
|
|
|
// 恢复操作
|
|
|
|
|
|
if (otherConfig.get("operationType").equals("2")) { |
|
|
|
|
|
// 还原上次
|
|
|
props.put("fileId", "10"); |
|
|
props.put("fileId", "10"); |
|
|
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_1B; |
|
|
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_1B; |
|
|
AjaxResult ajaxResult1B; |
|
|
AjaxResult ajaxResult1B; |
|
@ -737,10 +688,15 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
result.put("device", device.getId()); |
|
|
result.put("device", device.getId()); |
|
|
result.put("result", ajaxResult1B); |
|
|
result.put("result", ajaxResult1B); |
|
|
resultArray.add(result); |
|
|
resultArray.add(result); |
|
|
|
|
|
}else { |
|
|
|
|
|
// 播放自定义
|
|
|
|
|
|
boardReleaseProcess(props, iotDeviceId, otherConfig, device, resultArray); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else if (device.getDeviceType().equals(DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING.toString())) { |
|
|
else if (device.getDeviceType().equals(DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING.toString()) |
|
|
|
|
|
&& operationType.equals(1)) { |
|
|
// 路段广播
|
|
|
// 路段广播
|
|
|
JSONObject params = new JSONObject(); |
|
|
JSONObject params = new JSONObject(); |
|
|
params.put("name", "task-event"); |
|
|
params.put("name", "task-event"); |
|
@ -793,6 +749,75 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 情报板发布全流程 |
|
|
|
|
|
*/ |
|
|
|
|
|
public void boardReleaseProcess(HashMap<String, Object> props, |
|
|
|
|
|
String iotDeviceId, |
|
|
|
|
|
JSONObject otherConfig, |
|
|
|
|
|
DcDevice device, |
|
|
|
|
|
JSONArray resultArray |
|
|
|
|
|
) throws HttpException, IOException { |
|
|
|
|
|
String functionId = ""; |
|
|
|
|
|
// 执行操作
|
|
|
|
|
|
// 可变信息标志 分三步
|
|
|
|
|
|
// 1:执行11功能码
|
|
|
|
|
|
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_11; |
|
|
|
|
|
props.put("fileName", "play011.lst"); |
|
|
|
|
|
props.put("size", "65535"); |
|
|
|
|
|
AjaxResult ajaxResult11; |
|
|
|
|
|
ajaxResult11 = dcDeviceController.invokedFunction(iotDeviceId, functionId, props); |
|
|
|
|
|
if (ajaxResult11.get("code").equals(200)) { |
|
|
|
|
|
// 2:执行13功能码
|
|
|
|
|
|
HashMap<String, Object> props11 = new HashMap<>(); |
|
|
|
|
|
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_13; |
|
|
|
|
|
List<Map<String, String>> list = new ArrayList<>(); |
|
|
|
|
|
Map<String, String> parameters = new HashMap<>(); |
|
|
|
|
|
DcInfoBoardTemplate dcInfoBoardTemplate = JSON.parseObject( |
|
|
|
|
|
JSON.toJSONString(otherConfig.get("dcInfoBoardTemplate")), |
|
|
|
|
|
DcInfoBoardTemplate.class); |
|
|
|
|
|
// stopTime
|
|
|
|
|
|
parameters.put("STAY", dcInfoBoardTemplate.getStopTime()); |
|
|
|
|
|
// inScreenMode
|
|
|
|
|
|
parameters.put("ACTION", dcInfoBoardTemplate.getInScreenMode()); |
|
|
|
|
|
// fontSpacing
|
|
|
|
|
|
parameters.put("SPEED", dcInfoBoardTemplate.getFontSpacing()); |
|
|
|
|
|
// fontColor
|
|
|
|
|
|
parameters.put("COLOR", dcInfoBoardTemplate.getFontColor()); |
|
|
|
|
|
// fontType
|
|
|
|
|
|
parameters.put("FONT", dcInfoBoardTemplate.getFontType()); |
|
|
|
|
|
// fontSize
|
|
|
|
|
|
parameters.put("FONT_SIZE", dcInfoBoardTemplate.getFontSize()); |
|
|
|
|
|
// content
|
|
|
|
|
|
parameters.put("CONTENT", dcInfoBoardTemplate.getContent()); |
|
|
|
|
|
// screenSize 768*64 宽度和高度
|
|
|
|
|
|
parameters.put("width", dcInfoBoardTemplate.getScreenSize().split("\\*")[0]); |
|
|
|
|
|
parameters.put("height", dcInfoBoardTemplate.getScreenSize().split("\\*")[1]); |
|
|
|
|
|
// formatStyle
|
|
|
|
|
|
parameters.put("formatStyle", dcInfoBoardTemplate.getFormatStyle()); |
|
|
|
|
|
list.add(parameters); |
|
|
|
|
|
props11.put("parameters", list); |
|
|
|
|
|
AjaxResult ajaxResult13 = null; |
|
|
|
|
|
ajaxResult13 = dcDeviceController.invokedFunction(iotDeviceId, functionId, props11); |
|
|
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
|
|
if (ajaxResult13.get("code").equals(200)) { |
|
|
|
|
|
HashMap<String, Object> props1B = new HashMap<>(); |
|
|
|
|
|
// 3: 执行1B功能码
|
|
|
|
|
|
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_1B; |
|
|
|
|
|
props1B.put("fileId", "11"); |
|
|
|
|
|
AjaxResult ajaxResult1B = dcDeviceController.invokedFunction(iotDeviceId, functionId, props1B); |
|
|
|
|
|
result.put("device", device.getId()); |
|
|
|
|
|
result.put("result", ajaxResult1B); |
|
|
|
|
|
resultArray.add(result); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
result.put("device", device.getId()); |
|
|
|
|
|
result.put("result", ajaxResult13); |
|
|
|
|
|
resultArray.add(result); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 新增事件预案 |
|
|
* 新增事件预案 |
|
|