648540858
2024-01-10 c25a99d60bef3d3bbd59fee895bd658928fd00db
src/main/java/com/genersoft/iot/vmp/service/impl/CloudRecordServiceImpl.java
@@ -124,6 +124,9 @@
                remoteHost = "http://" + mediaServerItem.getStreamIp() + ":" + mediaServerItem.getRecordAssistPort();
            }
        }
        if (mediaServerItem.getRecordAssistPort() == 0) {
            throw new ControllerException(ErrorCode.ERROR100.getCode(), "为配置Assist服务");
        }
        Long startTimeStamp = null;
        Long endTimeStamp = null;
        if (startTime != null) {
@@ -148,7 +151,7 @@
    }
    @Override
    public JSONArray queryTask(String taskId, String mediaServerId, Boolean isEnd) {
    public JSONArray queryTask(String app, String stream, String callId, String taskId, String mediaServerId, Boolean isEnd) {
        MediaServerItem mediaServerItem = null;
        if (mediaServerId == null) {
            mediaServerItem = mediaServerService.getDefaultMediaServer();
@@ -158,7 +161,7 @@
        if (mediaServerItem == null) {
            throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到可用的流媒体");
        }
        JSONObject result =  assistRESTfulUtils.queryTaskList(mediaServerItem, taskId, isEnd);
        JSONObject result =  assistRESTfulUtils.queryTaskList(mediaServerItem, app, stream, callId, taskId, isEnd);
        if (result.getInteger("code") != 0) {
            throw new ControllerException(result.getInteger("code"), result.getString("msg"));
        }
@@ -166,7 +169,7 @@
    }
    @Override
    public void changeCollect(String type, boolean result, String app, String stream, String mediaServerId, String startTime, String endTime, String callId, String collectType) {
    public int changeCollect(boolean result, String app, String stream, String mediaServerId, String startTime, String endTime, String callId) {
        // 开始时间和结束时间在数据库中都是以秒为单位的
        Long startTimeStamp = null;
        Long endTimeStamp = null;
@@ -203,34 +206,24 @@
            throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到待收藏的视频");
        }
        int limitCount = 50;
        int resultCount = 0;
        if (all.size() > limitCount) {
            for (int i = 0; i < all.size(); i += limitCount) {
                int toIndex = i + limitCount;
                if (i + limitCount > all.size()) {
                    toIndex = all.size();
                }
                if ("collect".equals(collectType)) {
                    cloudRecordServiceMapper.updateCollectList(result, all.subList(i, toIndex));
                }else  if ("reserve".equals(collectType)) {
                    cloudRecordServiceMapper.updateReserveList(result, all.subList(i, toIndex));
                }
                resultCount += cloudRecordServiceMapper.updateCollectList(result, all.subList(i, toIndex));
            }
        }else {
            if ("collect".equals(collectType)) {
                cloudRecordServiceMapper.updateCollectList(result, all);
            }else  if ("reserve".equals(collectType)) {
                cloudRecordServiceMapper.updateReserveList(result, all);
            }
            resultCount = cloudRecordServiceMapper.updateCollectList(result, all);
        }
        return resultCount;
    }
    @Override
    public void changeCollectById(Integer recordId, String collectType, boolean result) {
        if ("collect".equals(collectType)) {
            cloudRecordServiceMapper.changeCollectById(result, recordId);
        }else  if ("reserve".equals(collectType)) {
            cloudRecordServiceMapper.changeReserveById(result, recordId);
        }
    public int changeCollectById(Integer recordId, boolean result) {
       return cloudRecordServiceMapper.changeCollectById(result, recordId);
    }
}