|  |  |  | 
|---|
|  |  |  | package com.genersoft.iot.vmp.vmanager.record; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import org.slf4j.Logger; | 
|---|
|  |  |  | import org.slf4j.LoggerFactory; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.http.ResponseEntity; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.GetMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.PathVariable; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  | import org.springframework.web.context.request.async.DeferredResult; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.bean.Device; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.bean.RecordInfo; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @RequestMapping("/api") | 
|---|
|  |  |  | public class RecordController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private final static Logger logger = LoggerFactory.getLogger(RecordController.class); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SIPCommander cmder; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private IVideoManagerStorager storager; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private DeferredResultHolder resultHolder; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @GetMapping("/record/{deviceId}/{channelId}") | 
|---|
|  |  |  | public DeferredResult<ResponseEntity<RecordInfo>> recordinfo(@PathVariable String deviceId,@PathVariable String channelId, String startTime,  String endTime){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (logger.isDebugEnabled()) { | 
|---|
|  |  |  | logger.debug(String.format("录像信息查询 API调用,deviceId:%s ,startTime:%s, startTime:%s",deviceId, startTime, endTime)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Device device = storager.queryVideoDevice(deviceId); | 
|---|
|  |  |  | cmder.recordInfoQuery(device, channelId, startTime, endTime); | 
|---|
|  |  |  | DeferredResult<ResponseEntity<RecordInfo>> result = new DeferredResult<ResponseEntity<RecordInfo>>(); | 
|---|
|  |  |  | // 录像查询以channelId作为deviceId查询 | 
|---|
|  |  |  | resultHolder.put(DeferredResultHolder.CALLBACK_CMD_RECORDINFO+channelId, result); | 
|---|
|  |  |  | return result; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //package com.genersoft.iot.vmp.vmanager.record; | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | //import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; | 
|---|
|  |  |  | //import com.genersoft.iot.vmp.service.IRecordInfoServer; | 
|---|
|  |  |  | //import com.genersoft.iot.vmp.storager.dao.dto.RecordInfo; | 
|---|
|  |  |  | //import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 
|---|
|  |  |  | //import com.github.pagehelper.PageInfo; | 
|---|
|  |  |  | //import io.swagger.annotations.Api; | 
|---|
|  |  |  | //import io.swagger.annotations.ApiImplicitParam; | 
|---|
|  |  |  | //import io.swagger.annotations.ApiImplicitParams; | 
|---|
|  |  |  | //import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | //import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | //import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //@Tag(name  = "云端录像") | 
|---|
|  |  |  | //@CrossOrigin | 
|---|
|  |  |  | //@RestController | 
|---|
|  |  |  | //@RequestMapping("/api/record") | 
|---|
|  |  |  | //public class RecordController { | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //    @Autowired | 
|---|
|  |  |  | //    private IRecordInfoServer recordInfoServer; | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //     //@ApiOperation("录像列表查询") | 
|---|
|  |  |  | //    @ApiImplicitParams({ | 
|---|
|  |  |  | //            @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class), | 
|---|
|  |  |  | //            @ApiImplicitParam(name="count", value = "每页查询数量", required = true, dataTypeClass = Integer.class), | 
|---|
|  |  |  | //            @ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class), | 
|---|
|  |  |  | //    }) | 
|---|
|  |  |  | //    @GetMapping(value = "/app/list") | 
|---|
|  |  |  | //    @ResponseBody | 
|---|
|  |  |  | //    public Object list(@RequestParam(required = false)Integer page, | 
|---|
|  |  |  | //                                     @RequestParam(required = false)Integer count ){ | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //        PageInfo<RecordInfo> recordList = recordInfoServer.getRecordList(page - 1, page - 1 + count); | 
|---|
|  |  |  | //        return recordList; | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //     //@ApiOperation("获取录像详情") | 
|---|
|  |  |  | //    @ApiImplicitParams({ | 
|---|
|  |  |  | //            @ApiImplicitParam(name="recordInfo", value = "录像记录", required = true, dataTypeClass = RecordInfo.class) | 
|---|
|  |  |  | //    }) | 
|---|
|  |  |  | //    @GetMapping(value = "/detail") | 
|---|
|  |  |  | //    @ResponseBody | 
|---|
|  |  |  | //    public JSONObject list(RecordInfo recordInfo, String time ){ | 
|---|
|  |  |  | // | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //        return null; | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | //} | 
|---|