diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java index 8200b27e..239f75af 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java @@ -397,6 +397,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { try { // 根据不通设备类型,执行不通的功能操作 invokedFunction( + dcEventAnDcEmergencyPlans.getOperationType(), dcDevices, JSON.parseObject(dcExecuteAction.getOtherConfig()), resultArray); @@ -440,6 +441,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { * 根据不通设备类型,执行不通的功能操作 */ public void invokedFunction( + Integer operationType, List dcDevices, JSONObject otherConfig, JSONArray resultArray) throws HttpException, IOException { @@ -480,60 +482,74 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { } else if (device.getDeviceType().equals(DeviceTypeConstants.VARIABLE_INFORMATION_FLAG)) { - // 可变信息标志 分三步 - // 1:执行11功能码 - functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_11; - props.put("fileName","play011.lst"); - props.put("size","65535"); - AjaxResult ajaxResult11 = dcDeviceController.invokedFunction(iotDeviceId, functionId, props); - if (ajaxResult11.get("code").equals(200)) { - // 2:执行13功能码 - HashMap props11 = new HashMap<>(); - functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_13; - List> list = new ArrayList<>(); - Map 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 = dcDeviceController.invokedFunction(iotDeviceId, functionId, props11); - JSONObject result = new JSONObject(); - if (ajaxResult13.get("code").equals(200)) { - HashMap 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); + if (operationType == 1) { + // 执行操作 + // 可变信息标志 分三步 + // 1:执行11功能码 + functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_11; + props.put("fileName","play011.lst"); + props.put("size","65535"); + AjaxResult ajaxResult11 = dcDeviceController.invokedFunction(iotDeviceId, functionId, props); + if (ajaxResult11.get("code").equals(200)) { + // 2:执行13功能码 + HashMap props11 = new HashMap<>(); + functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_13; + List> list = new ArrayList<>(); + Map 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 = dcDeviceController.invokedFunction(iotDeviceId, functionId, props11); + JSONObject result = new JSONObject(); + if (ajaxResult13.get("code").equals(200)) { + HashMap 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 { + // 恢复操作 + props.put("fileId","10"); + functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_1B; + AjaxResult ajaxResult1B = dcDeviceController.invokedFunction(iotDeviceId, functionId, props); + JSONObject result = new JSONObject(); + result.put("device", device.getId()); + result.put("result", ajaxResult1B); + resultArray.add(result); + } + } else if (device.getDeviceType().equals(DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING)) { // 路段广播