Browse Source

视频ai事件事件添加图片

develop
xiepufeng 10 months ago
parent
commit
368d277f4c
  1. 14
      zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java

14
zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java

@ -1,6 +1,7 @@
package com.zc.business.message.device.handler;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.redis.RedisCache;
import com.zc.business.constant.RedisKeyConstants;
@ -14,6 +15,7 @@ import com.zc.business.service.IDcDeviceService;
import com.zc.business.service.IDcWarningService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -39,6 +41,9 @@ public class DeviceMessageHandler {
@Resource
private RedisCache redisCache;
@Value("${iot.address}")
private String iotAddress;
/**
* 更新设备状态
*
@ -128,6 +133,15 @@ public class DeviceMessageHandler {
dcWarning.setDeptId(dcDevice.getGroupId());
}
JSONArray pictures = data.getJSONArray("pictures");
List<String> pictureList = pictures.stream().map(picture -> (iotAddress + "/profile" + picture)).collect(Collectors.toList());
JSONObject otherConfig = new JSONObject();
otherConfig.put("pictures", pictureList);
dcWarning.setOtherConfig(otherConfig.toString());
dcWarningService.insertDcWarning(dcWarning);
}

Loading…
Cancel
Save