|
|
@ -16,6 +16,8 @@ import com.yxt.supervise.monitor.biz.scheduled.SyncService; |
|
|
|
import com.yxt.supervise.monitor.biz.util.HttpUtils; |
|
|
|
import com.yxt.supervise.monitor.biz.util.ImageCompareUtil; |
|
|
|
import com.yxt.supervise.monitor.biz.util.ImageDownloadUtil; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
@ -29,6 +31,8 @@ import java.util.Map; |
|
|
|
@Service |
|
|
|
public class YDeviceImageService extends ServiceImpl<YDeviceImageMapper, DeviceImage> { |
|
|
|
|
|
|
|
private static final Logger L = LoggerFactory.getLogger(YDeviceImageService.class); |
|
|
|
|
|
|
|
@Value("${scheduleTime.folder}") |
|
|
|
private String filePath; |
|
|
|
|
|
|
@ -81,6 +85,7 @@ public class YDeviceImageService extends ServiceImpl<YDeviceImageMapper, DeviceI |
|
|
|
param.put("channelNo", device.getChannelNo()); // 组编号 string
|
|
|
|
String paramJson = JSONObject.toJSONString(param); |
|
|
|
String result = HttpUtils.sendPostJson(url, paramJson, SyncService.haiKangToken); |
|
|
|
L.info("海康图片接口返回数据:{}", result); |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result); |
|
|
|
JSONObject dataJson = (JSONObject) jsonObject.get("data"); |
|
|
|
String picUrl = dataJson.get("picUrl").toString(); |
|
|
@ -90,6 +95,7 @@ public class YDeviceImageService extends ServiceImpl<YDeviceImageMapper, DeviceI |
|
|
|
try { |
|
|
|
ImageDownloadUtil.download(picUrl, filePath, picName); |
|
|
|
} catch (IOException e) { |
|
|
|
L.error("下载图片出错:{}", e.getMessage()); |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
|
|
|
|