|
|
@ -3,6 +3,8 @@ package com.inspect.patrol.service.impl; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.inspect.base.core.exception.ServiceException; |
|
|
import com.inspect.base.core.exception.ServiceException; |
|
|
import com.inspect.base.core.utils.StringUtils; |
|
|
import com.inspect.base.core.utils.StringUtils; |
|
|
|
|
|
import com.inspect.base.core.web.domain.AjaxResult; |
|
|
|
|
|
import com.inspect.base.core.web.page.TableDataInfo; |
|
|
import com.inspect.base.redis.service.RedisService; |
|
|
import com.inspect.base.redis.service.RedisService; |
|
|
import com.inspect.patrol.service.BasedataEqpbookService; |
|
|
import com.inspect.patrol.service.BasedataEqpbookService; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -25,11 +27,17 @@ public class Video2NvrComponent { |
|
|
} else { |
|
|
} else { |
|
|
Object value = this.redisService.redisTemplate.opsForHash().get(PATROL_EQP_BOOK_VIDEO_NVR, videoCode); |
|
|
Object value = this.redisService.redisTemplate.opsForHash().get(PATROL_EQP_BOOK_VIDEO_NVR, videoCode); |
|
|
if (value == null) { |
|
|
if (value == null) { |
|
|
Object object = this.basedataEqpbookService.list((new JSONObject()).fluentPut("patrolDeviceCode", videoCode)).getRows().get(0); |
|
|
|
|
|
|
|
|
// Object object = this.basedataEqpbookService.list((new JSONObject()).fluentPut("patrolDeviceCode", videoCode)).getRows().get(0); |
|
|
|
|
|
TableDataInfo tableDataInfo = basedataEqpbookService.list((new JSONObject()).fluentPut("patrolDeviceCode", videoCode)); |
|
|
|
|
|
if (tableDataInfo == null || tableDataInfo.getRows() == null || tableDataInfo.getRows().isEmpty()) { |
|
|
|
|
|
return ""; |
|
|
|
|
|
} |
|
|
|
|
|
Object object = tableDataInfo.getRows().get(0); |
|
|
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(object)); |
|
|
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(object)); |
|
|
|
|
|
|
|
|
String videoNvrCode = jsonObject.getString("videoNvrCode"); |
|
|
String videoNvrCode = jsonObject.getString("videoNvrCode"); |
|
|
if (StringUtils.isEmpty(videoCode)) { |
|
|
if (StringUtils.isEmpty(videoCode)) { |
|
|
throw new ServiceException("No NVR bound for this device!"); |
|
|
|
|
|
|
|
|
return ""; |
|
|
} else { |
|
|
} else { |
|
|
this.redisService.redisTemplate.opsForHash().put(PATROL_EQP_BOOK_VIDEO_NVR, videoCode, videoNvrCode); |
|
|
this.redisService.redisTemplate.opsForHash().put(PATROL_EQP_BOOK_VIDEO_NVR, videoCode, videoNvrCode); |
|
|
return videoNvrCode; |
|
|
return videoNvrCode; |
|
|
|