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

com.dahuatech.icc.multiinone.brm.PushPersonCardToThirdPartySDK Maven / Gradle / Ivy

There is a newer version: 1.0.13.7
Show newest version
package com.dahuatech.icc.multiinone.brm;

import com.dahuatech.hutool.log.Log;
import com.dahuatech.hutool.log.LogFactory;
import com.dahuatech.icc.event.enums.CardBusinessEnum;
import com.dahuatech.icc.event.enums.CategoryEnums;
import com.dahuatech.icc.event.enums.PersonBusinessEnum;
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 PushPersonCardToThirdPartySDK {

    private final Log logger = LogFactory.get();

    public BaseResponse eventSubscribe(BaseEventSubcribeInfo request){
        try{
            request.valid();
            EventSubcribeSDK eventSubcribeSDK = new EventSubcribeSDK();
            SimpleEventSubcribeRequest eventSubcribeRequest = EventParamsUtils.buildSimpleEventSubcribeRequest(request);
            Map> config = new HashMap>();
            List list = new ArrayList();
            list.addAll(PersonBusinessEnum.getBusinessTypes());//人员业务类型
            list.addAll(CardBusinessEnum.getBusinessTypes());//卡片业务类型
            config.put(CategoryEnums.business.code, list);
            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