jiangping
2024-08-28 42f57295f5fe64132c11a25f55cd25c3c8acf167
server/visits/dmvisit_admin/src/main/java/com/doumee/service/impl/HkSyncEventServiceImpl.java
@@ -14,6 +14,8 @@
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.DependsOn;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
@@ -35,9 +37,24 @@
    @PostConstruct
    public  int  initHkConfig(){
        //获取根组织编码
        initHkParamConfig();
        getRootOrgCode();
        //开始订阅门禁事件、访客事件、和停车场事件
        startHkEventSub();
        return  0;
    }
    public  int  initHkParamConfig(){
        if(StringUtils.isBlank(ArtemisConfig.appKey )
                ||StringUtils.isBlank(ArtemisConfig.host )
                ||StringUtils.isBlank(ArtemisConfig.appSecret )
        ){
            ArtemisConfig.host = systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_HOST).getCode();
            ArtemisConfig.appKey = systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_APPKEY).getCode();
            ArtemisConfig.appSecret = systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_APPSECRET).getCode();
            HKConstants.https = systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_HTTPS).getCode();
        }
        HKTools.interfaceLogService=interfaceLogService;
        return  0;
    }
    /**
@@ -89,6 +106,24 @@
        HKService.cancelEventSub(param);//先取消
        HKService.eventSub(param);//门禁事件
        param.setEventDest(path+"/visitIccm");
        param.setEventTypes(new Integer[]{HKConstants.EventTypes.VISIT_SIGN_ICCM_IN.getKey()
                ,HKConstants.EventTypes.VISIT_SIGN_ICCM_PASS.getKey()
                ,HKConstants.EventTypes.VISIT_SIGN_ICCM_OUT.getKey()});
        HKService.cancelEventSub(param);//先取消
        HKService.eventSub(param);//访客事件
        param.setEventDest(path+"/platform/workstatus");
        param.setEventTypes(new Integer[]{HKConstants.EventTypes.PLATFORM_WORKSTATUS.getKey()});
        HKService.cancelEventSub(param);//先取消
        HKService.eventSub(param);//月台工作状态事件
        param.setEventDest(path+"/platform/carstatus");
        param.setEventTypes(new Integer[]{HKConstants.EventTypes.PLATFORM_CAR_STATUS.getKey()});
        HKService.cancelEventSub(param);//先取消
        HKService.eventSub(param);//月台车辆状态事件
    }
    /**
     * 取消订阅门禁事件、访客事件、和停车场事件