Browse Source

情报板接口

develop
lau572 11 months ago
parent
commit
8a7cc0611e
  1. 45
      zc-business/src/main/java/com/zc/business/service/impl/DcBoardServiceImpl.java

45
zc-business/src/main/java/com/zc/business/service/impl/DcBoardServiceImpl.java

@ -1,14 +1,17 @@
package com.zc.business.service.impl; package com.zc.business.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.zc.business.controller.DcDeviceController;
import com.zc.business.domain.DcBoardPublish; import com.zc.business.domain.DcBoardPublish;
import com.zc.business.domain.DcBoardReleaseLog; import com.zc.business.domain.DcBoardReleaseLog;
import com.zc.business.mapper.DcBoardReleaseLogMapper; import com.zc.business.mapper.DcBoardReleaseLogMapper;
import com.zc.business.service.IDcBoardService; import com.zc.business.service.IDcBoardService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -29,6 +32,9 @@ public class DcBoardServiceImpl implements IDcBoardService {
@Autowired @Autowired
private DcBoardReleaseLogMapper dcBoardReleaseLogMapper; private DcBoardReleaseLogMapper dcBoardReleaseLogMapper;
@Autowired
private DcDeviceController deviceController;
/** /**
* @Description 情报板发布 * @Description 情报板发布
* *
@ -48,24 +54,34 @@ public class DcBoardServiceImpl implements IDcBoardService {
String deviceId = dcBoardPublish.getDeviceId(); String deviceId = dcBoardPublish.getDeviceId();
List<Map<String,Object>> contentList = dcBoardPublish.getContent(); List<Map<String,Object>> contentList = dcBoardPublish.getContent();
//TODO 调用控制设备接口 AjaxResult ajaxResult = new AjaxResult();
/* //下发文件名 String status = "1";
try{
//下发文件名
Map<String,Object> param = new HashMap<>(); Map<String,Object> param = new HashMap<>();
param.put("size","65535"); param.put("size","65535");
param.put("fileName","play010.lst"); param.put("fileName","play010.lst");
invokeFunction(deviceId,"11",param); ajaxResult = deviceController.invokedFunction(deviceId,"11",param);
if (HttpStatus.SUCCESS == Integer.parseInt(String.valueOf(ajaxResult.get("code")))){
//功能码13 下发内容 //功能码13 下发内容
param = new HashMap<>(); param = new HashMap<>();
param.put("parameters",contentList); param.put("parameters",contentList);
invokeFunction(deviceId,"1B",param); ajaxResult = deviceController.invokedFunction(deviceId,"13",param);
if (HttpStatus.SUCCESS == Integer.parseInt(String.valueOf(ajaxResult.get("code")))) {
//功能码1B 播放 //功能码1B 播放
param = new HashMap<>(); param = new HashMap<>();
param.put("fileId", "10"); param.put("fileId", "10");
invokeFunction(deviceId,"13",param);*/ ajaxResult = deviceController.invokedFunction(deviceId, "1B", param);
}
}
String status = "1"; if (HttpStatus.SUCCESS != Integer.parseInt(String.valueOf(ajaxResult.get("code")))) {
status = "0";
}
//发布记录 //发布记录
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
@ -81,9 +97,11 @@ public class DcBoardServiceImpl implements IDcBoardService {
releaseLog.setReleaseDeptId(loginUser.getDeptId().toString()); releaseLog.setReleaseDeptId(loginUser.getDeptId().toString());
dcBoardReleaseLogMapper.insertDcBoardReleaseLog(releaseLog); dcBoardReleaseLogMapper.insertDcBoardReleaseLog(releaseLog);
} }
}catch (Exception e){
e.printStackTrace();
}
return ajaxResult;
return AjaxResult.success();
} }
/** /**
@ -95,10 +113,15 @@ public class DcBoardServiceImpl implements IDcBoardService {
*/ */
public AjaxResult realtimeProperty(String deviceId){ public AjaxResult realtimeProperty(String deviceId){
/*Map<String,Object> param = new HashMap<>(); AjaxResult ajaxResult = new AjaxResult();
try {
Map<String,Object> param = new HashMap<>();
param.put("async",false); param.put("async",false);
invokeFunction(deviceId,"3A",param);*/ ajaxResult = deviceController.invokedFunction(deviceId,"3A",param);
} catch (Exception e){
e.printStackTrace();
}
return AjaxResult.success(); return ajaxResult;
} }
} }

Loading…
Cancel
Save