All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dahuatech.icc.multiinone.face.FaceRecordSynSDK Maven / Gradle / Ivy

The newest version!
package com.dahuatech.icc.multiinone.face;

import com.dahuatech.hutool.log.Log;
import com.dahuatech.hutool.log.LogFactory;
import com.dahuatech.icc.event.enums.CategoryEnums;
import com.dahuatech.icc.face.enums.AlarmTypeEnums;
import com.dahuatech.icc.multiinone.Constants;
import com.dahuatech.icc.multiinone.event.EventSubcribeSDK;
import com.dahuatech.icc.multiinone.event.domain.BaseEventSubcribeInfo;
import com.dahuatech.icc.multiinone.event.vo.SimpleEventSubcribeRequest;
import com.dahuatech.icc.multiinone.exception.BusinessException;
import com.dahuatech.icc.multiinone.utils.EventParamsUtils;
import com.dahuatech.icc.multiinone.vo.BaseResponse;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class FaceRecordSynSDK {

    protected final Log logger = LogFactory.get();

    /**
     * 实时推送第三方
     * @param request
     * @return
     */
    public BaseResponse eventSubscribe(BaseEventSubcribeInfo request){
        try{
            request.valid();
            EventSubcribeSDK eventSubcribeSDK = new EventSubcribeSDK();
            SimpleEventSubcribeRequest eventSubcribeRequest = EventParamsUtils.buildSimpleEventSubcribeRequest(request);
            Map> config = new HashMap>();
            List alarmList = new ArrayList();
            alarmList.addAll(AlarmTypeEnums.getTypeList());
            config.put(CategoryEnums.alarm.code, alarmList);
            eventSubcribeRequest.setTypesConfigs(config);
            return eventSubcribeSDK.simpleEventSubcribe(eventSubcribeRequest);
        }catch (BusinessException businessException){
            logger.error("人员布控事件订阅失败{}",businessException,businessException.getMessage());
            BaseResponse baseResponse = new BaseResponse();
            baseResponse.setCode(businessException.code);
            baseResponse.setErrMsg(businessException.msg);
            return baseResponse;
        }catch (Exception e){
            BaseResponse baseResponse = new BaseResponse();
            logger.error("人员布控事件订阅异常{}",e,e.getMessage());
            baseResponse.setCode(Constants.SYSTEMERROR_CODE);
            baseResponse.setErrMsg(Constants.SYSTEMERROR_MSG);
            return baseResponse;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy