Browse Source

修改情报板恢复操作代码

develop
Mr.Wang 9 months ago
parent
commit
48fccac9b9
  1. 120
      zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java

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

@ -397,6 +397,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
try { try {
// 根据不通设备类型,执行不通的功能操作 // 根据不通设备类型,执行不通的功能操作
invokedFunction( invokedFunction(
dcEventAnDcEmergencyPlans.getOperationType(),
dcDevices, dcDevices,
JSON.parseObject(dcExecuteAction.getOtherConfig()), JSON.parseObject(dcExecuteAction.getOtherConfig()),
resultArray); resultArray);
@ -440,6 +441,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
* 根据不通设备类型执行不通的功能操作 * 根据不通设备类型执行不通的功能操作
*/ */
public void invokedFunction( public void invokedFunction(
Integer operationType,
List<DcDevice> dcDevices, List<DcDevice> dcDevices,
JSONObject otherConfig, JSONObject otherConfig,
JSONArray resultArray) throws HttpException, IOException { JSONArray resultArray) throws HttpException, IOException {
@ -480,60 +482,74 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
} }
else if (device.getDeviceType().equals(DeviceTypeConstants.VARIABLE_INFORMATION_FLAG)) { else if (device.getDeviceType().equals(DeviceTypeConstants.VARIABLE_INFORMATION_FLAG)) {
// 可变信息标志 分三步 if (operationType == 1) {
// 1:执行11功能码 // 执行操作
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_11; // 可变信息标志 分三步
props.put("fileName","play011.lst"); // 1:执行11功能码
props.put("size","65535"); functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_11;
AjaxResult ajaxResult11 = dcDeviceController.invokedFunction(iotDeviceId, functionId, props); props.put("fileName","play011.lst");
if (ajaxResult11.get("code").equals(200)) { props.put("size","65535");
// 2:执行13功能码 AjaxResult ajaxResult11 = dcDeviceController.invokedFunction(iotDeviceId, functionId, props);
HashMap<String, Object> props11 = new HashMap<>(); if (ajaxResult11.get("code").equals(200)) {
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_13; // 2:执行13功能码
List<Map<String,String>> list = new ArrayList<>(); HashMap<String, Object> props11 = new HashMap<>();
Map<String,String> parameters = new HashMap<>(); functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_13;
DcInfoBoardTemplate dcInfoBoardTemplate = JSON.parseObject( List<Map<String,String>> list = new ArrayList<>();
JSON.toJSONString(otherConfig.get("dcInfoBoardTemplate")), Map<String,String> parameters = new HashMap<>();
DcInfoBoardTemplate.class); DcInfoBoardTemplate dcInfoBoardTemplate = JSON.parseObject(
// stopTime JSON.toJSONString(otherConfig.get("dcInfoBoardTemplate")),
parameters.put("STAY",dcInfoBoardTemplate.getStopTime()); DcInfoBoardTemplate.class);
// inScreenMode // stopTime
parameters.put("ACTION",dcInfoBoardTemplate.getInScreenMode()); parameters.put("STAY",dcInfoBoardTemplate.getStopTime());
// fontSpacing // inScreenMode
parameters.put("SPEED",dcInfoBoardTemplate.getFontSpacing()); parameters.put("ACTION",dcInfoBoardTemplate.getInScreenMode());
// fontColor // fontSpacing
parameters.put("COLOR",dcInfoBoardTemplate.getFontColor()); parameters.put("SPEED",dcInfoBoardTemplate.getFontSpacing());
// fontType // fontColor
parameters.put("FONT",dcInfoBoardTemplate.getFontType()); parameters.put("COLOR",dcInfoBoardTemplate.getFontColor());
// fontSize // fontType
parameters.put("FONT_SIZE",dcInfoBoardTemplate.getFontSize()); parameters.put("FONT",dcInfoBoardTemplate.getFontType());
// content // fontSize
parameters.put("CONTENT",dcInfoBoardTemplate.getContent()); parameters.put("FONT_SIZE",dcInfoBoardTemplate.getFontSize());
// screenSize 768*64 宽度和高度 // content
parameters.put("width",dcInfoBoardTemplate.getScreenSize().split("\\*")[0]); parameters.put("CONTENT",dcInfoBoardTemplate.getContent());
parameters.put("height",dcInfoBoardTemplate.getScreenSize().split("\\*")[1]); // screenSize 768*64 宽度和高度
// formatStyle parameters.put("width",dcInfoBoardTemplate.getScreenSize().split("\\*")[0]);
parameters.put("formatStyle",dcInfoBoardTemplate.getFormatStyle()); parameters.put("height",dcInfoBoardTemplate.getScreenSize().split("\\*")[1]);
list.add(parameters); // formatStyle
props11.put("parameters",list); parameters.put("formatStyle",dcInfoBoardTemplate.getFormatStyle());
AjaxResult ajaxResult13 = dcDeviceController.invokedFunction(iotDeviceId, functionId, props11); list.add(parameters);
JSONObject result = new JSONObject(); props11.put("parameters",list);
if (ajaxResult13.get("code").equals(200)) { AjaxResult ajaxResult13 = dcDeviceController.invokedFunction(iotDeviceId, functionId, props11);
HashMap<String, Object> props1B = new HashMap<>(); JSONObject result = new JSONObject();
// 3: 执行1B功能码 if (ajaxResult13.get("code").equals(200)) {
functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_1B; HashMap<String, Object> props1B = new HashMap<>();
props1B.put("fileId","11"); // 3: 执行1B功能码
AjaxResult ajaxResult1B = dcDeviceController.invokedFunction(iotDeviceId, functionId, props1B); functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_1B;
props1B.put("fileId","11");
result.put("device", device.getId()); AjaxResult ajaxResult1B = dcDeviceController.invokedFunction(iotDeviceId, functionId, props1B);
result.put("result", ajaxResult1B);
resultArray.add(result); result.put("device", device.getId());
}else { result.put("result", ajaxResult1B);
result.put("device", device.getId()); resultArray.add(result);
result.put("result", ajaxResult13); }else {
resultArray.add(result); 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)) { else if (device.getDeviceType().equals(DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING)) {
// 路段广播 // 路段广播

Loading…
Cancel
Save