|
|
|
@ -23,6 +23,7 @@ import com.inspect.patrol.service.impl.Video2NvrComponent; |
|
|
|
import java.util.Date; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
@ -30,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
import springfox.documentation.annotations.ApiIgnore; |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@ApiIgnore |
|
|
|
@RestController |
|
|
|
@RequestMapping({"/videotape"}) |
|
|
|
@ -56,21 +58,15 @@ public class PatrolVideotapeController extends BaseController { |
|
|
|
|
|
|
|
@GetMapping({"/record"}) |
|
|
|
public AjaxResult record(RecordModel recordModel) throws Exception { |
|
|
|
log.info("record start param: {}", recordModel); |
|
|
|
String action = recordModel.getAction(); |
|
|
|
byte var5 = -1; |
|
|
|
if (action.equals("0")) { |
|
|
|
var5 = 0; |
|
|
|
} else if (action.equals("1")) { |
|
|
|
var5 = 1; |
|
|
|
} |
|
|
|
|
|
|
|
switch (var5) { |
|
|
|
case 0: |
|
|
|
this.redisService.redisTemplate.opsForHash().put(REDIS_KEY_RECORD, recordModel.getStreamId(), new Date()); |
|
|
|
switch (action) { |
|
|
|
case "0": |
|
|
|
this.redisService.redisTemplate.opsForHash().put(REDIS_KEY_RECORD, recordModel.getStreamid(), new Date()); |
|
|
|
String params = JsonUtil.json2Str(JSONObject.parseObject(JSONObject.toJSONString(recordModel))); |
|
|
|
String result = HttpClientUtils.get(this.deviceUrl + AccessApiConstant.RECORD_START, params); |
|
|
|
return AjaxResult.success(result); |
|
|
|
case 1: |
|
|
|
case "1": |
|
|
|
return AjaxResult.success(this.stopRecord(recordModel)); |
|
|
|
default: |
|
|
|
return AjaxResult.error("录屏失败,状态识别异常!"); |
|
|
|
@ -86,8 +82,8 @@ public class PatrolVideotapeController extends BaseController { |
|
|
|
@GetMapping({"stop"}) |
|
|
|
private JSONObject stopRecord(RecordModel recordModel) throws Exception { |
|
|
|
String params = JsonUtil.json2Str(JSONObject.parseObject(JSONObject.toJSONString(recordModel))); |
|
|
|
if (this.redisService.redisTemplate.opsForHash().hasKey(REDIS_KEY_RECORD, recordModel.getStreamId()).booleanValue()) { |
|
|
|
this.redisService.redisTemplate.opsForHash().delete(REDIS_KEY_RECORD, recordModel.getStreamId()); |
|
|
|
if (this.redisService.redisTemplate.opsForHash().hasKey(REDIS_KEY_RECORD, recordModel.getStreamid()).booleanValue()) { |
|
|
|
this.redisService.redisTemplate.opsForHash().delete(REDIS_KEY_RECORD, recordModel.getStreamid()); |
|
|
|
String result = HttpClientUtils.get(this.deviceUrl + AccessApiConstant.RECORD_STOP, params); |
|
|
|
return JSONObject.parseObject(result); |
|
|
|
} else { |
|
|
|
|