com.dahuatech.icc.multiinone.admin.vo.CommonPlayBackRequest Maven / Gradle / Ivy
The newest version!
package com.dahuatech.icc.multiinone.admin.vo;
import com.dahuatech.icc.admin.enums.PlayBackFormatEnum;
import com.dahuatech.icc.admin.enums.RecordSourceEnum;
import com.dahuatech.icc.common.ParamValidEnum;
import com.dahuatech.icc.multiinone.exception.BusinessException;
import com.dahuatech.icc.multiinone.utils.StringUtils;
import com.dahuatech.icc.multiinone.vo.BaseRequest;
/**
* 普通录像请求报文
*/
public class CommonPlayBackRequest extends BaseRequest {
private String type;//hls,flv,rtmp,rtsp 拉流格式
private String channelId;//通道编码
private String recordSource;//录像来源
private String startTime;//开始时间 yyyy-MM-dd HH:mm:ss
private String endTime;//结束时间 yyyy-MM-dd HH:mm:ss
public void businessValid() {
if(!PlayBackFormatEnum.isRight(type)){
throw new BusinessException(ParamValidEnum.PARAM_SCOP_ERROR.getCode(),"播放格式非法");
}
if(StringUtils.isEmpty(channelId) || !channelId.contains("$")){
throw new BusinessException(ParamValidEnum.PARAM_FORMAT_ERROR.getCode(),"通道编码非法");
}
String[] arr = channelId.split("\\$");
if(arr.length != 4 || !"1".equals(arr[1])){
throw new BusinessException(ParamValidEnum.PARAM_FORMAT_ERROR.getCode(),"非视频通道");
}
if(!RecordSourceEnum.isRight(recordSource)){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(),"录像来源非法");
}
if(StringUtils.isEmpty(startTime)){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(),"开始时间不能为空");
}
if(StringUtils.isEmpty(endTime)){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(),"结束时间不能为空");
}
// DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// try {
// dateFormat.parse(startTime);
// }catch (Exception e){
// throw new BusinessException("录像开始时间格式非法");
// }
// try {
// dateFormat.parse(endTime);
// }catch (Exception e){
// throw new BusinessException("录像结束时间格式非法");
// }
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getChannelId() {
return channelId;
}
public void setChannelId(String channelId) {
this.channelId = channelId;
}
public String getRecordSource() {
return recordSource;
}
public void setRecordSource(String recordSource) {
this.recordSource = recordSource;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
}