|
@ -4,11 +4,14 @@ import com.alibaba.fastjson.JSON; |
|
|
import com.ruoyi.common.constant.HttpStatus; |
|
|
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.core.redis.RedisCache; |
|
|
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.constant.RedisKeyConstants; |
|
|
import com.zc.business.controller.DcDeviceController; |
|
|
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.domain.DcDevice; |
|
|
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.checkerframework.checker.units.qual.A; |
|
@ -35,6 +38,9 @@ public class DcBoardServiceImpl implements IDcBoardService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private DcDeviceController deviceController; |
|
|
private DcDeviceController deviceController; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private RedisCache redisCache; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Description 情报板发布 |
|
|
* @Description 情报板发布 |
|
|
* |
|
|
* |
|
@ -52,6 +58,12 @@ public class DcBoardServiceImpl implements IDcBoardService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
String deviceId = dcBoardPublish.getDeviceId(); |
|
|
String deviceId = dcBoardPublish.getDeviceId(); |
|
|
|
|
|
|
|
|
|
|
|
DcDevice dcDevice = redisCache.getCacheMapValue(RedisKeyConstants.DC_DEVICES, deviceId); |
|
|
|
|
|
if (dcDevice == null){ |
|
|
|
|
|
return AjaxResult.error("发布失败,设备不存在!"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
List<Map<String,Object>> contentList = dcBoardPublish.getContent(); |
|
|
List<Map<String,Object>> contentList = dcBoardPublish.getContent(); |
|
|
|
|
|
|
|
|
AjaxResult ajaxResult = new AjaxResult(); |
|
|
AjaxResult ajaxResult = new AjaxResult(); |
|
@ -83,12 +95,18 @@ public class DcBoardServiceImpl implements IDcBoardService { |
|
|
status = "0"; |
|
|
status = "0"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e){ |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
status = "0"; |
|
|
|
|
|
} finally { |
|
|
//发布记录
|
|
|
//发布记录
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser(); |
|
|
LoginUser loginUser = SecurityUtils.getLoginUser(); |
|
|
|
|
|
|
|
|
for (Map<String, Object> content : contentList) { |
|
|
for (Map<String, Object> content : contentList) { |
|
|
DcBoardReleaseLog releaseLog = new DcBoardReleaseLog(); |
|
|
DcBoardReleaseLog releaseLog = new DcBoardReleaseLog(); |
|
|
releaseLog.setDeviceId(deviceId); |
|
|
releaseLog.setDeviceId(deviceId); |
|
|
|
|
|
releaseLog.setDeviceName(dcDevice.getDeviceName()); |
|
|
releaseLog.setReleaseContent(JSON.toJSONString(content)); |
|
|
releaseLog.setReleaseContent(JSON.toJSONString(content)); |
|
|
releaseLog.setReleaseIp(loginUser.getIpaddr()); |
|
|
releaseLog.setReleaseIp(loginUser.getIpaddr()); |
|
|
releaseLog.setReleaseStatus(status); |
|
|
releaseLog.setReleaseStatus(status); |
|
@ -98,8 +116,6 @@ public class DcBoardServiceImpl implements IDcBoardService { |
|
|
releaseLog.setPlatform(loginUser.getUser().getUserType()); |
|
|
releaseLog.setPlatform(loginUser.getUser().getUserType()); |
|
|
dcBoardReleaseLogMapper.insertDcBoardReleaseLog(releaseLog); |
|
|
dcBoardReleaseLogMapper.insertDcBoardReleaseLog(releaseLog); |
|
|
} |
|
|
} |
|
|
}catch (Exception e){ |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return ajaxResult; |
|
|
return ajaxResult; |
|
|