jiangping
2023-12-06 915dcb3800c0cbd63f53e33f9638715b93c9ea6f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package com.doumee.service.business.impl.hksync;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.haikang.model.HKConstants;
import com.doumee.core.haikang.model.param.BaseResponse;
import com.doumee.core.haikang.model.param.request.EventSubRequest;
import com.doumee.core.haikang.model.param.request.PrivilegeGroupRequest;
import com.doumee.core.haikang.model.param.respose.PrivilegeGroupInfoResponse;
import com.doumee.core.haikang.model.param.respose.PrivilegeGroupListResponse;
import com.doumee.core.haikang.service.HKService;
import com.doumee.core.utils.Constants;
import com.doumee.dao.business.DeviceRoleMapper;
import com.doumee.dao.business.model.DeviceRole;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
 
/**
 * 海康事件订阅表Service实现
 * @author 江蹄蹄
 * @date 2023/11/30 15:33
 */
@Service
public class HkSyncEventServiceImpl extends HkSyncBaseServiceImpl {
 
    @Autowired
    private SystemDictDataBiz systemDictDataBiz;
 
    @PostConstruct
    public  int  initHkConfig(){
        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();
        //开始订阅门禁事件、访客事件、和停车场事件
        startHkEventSub();
        return  0;
    }
 
    /**
     * 订阅门禁事件、访客事件、和停车场事件
     */
    public void startHkEventSub(){
        EventSubRequest param = new EventSubRequest();
        param.setEventDest(systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_PUSH_URL).getCode());
        param.setEventTypes(new Integer[]{HKConstants.EventTypes.PARK_LINE_IN.getKey()
                ,HKConstants.EventTypes.PARK_LINE_OUT.getKey()
                ,HKConstants.EventTypes.PARK_PASS_IN.getKey()
                ,HKConstants.EventTypes.PARK_PASS_OUT.getKey()
                ,HKConstants.EventTypes.VISIT_SIGN_OUT.getKey()
                ,HKConstants.EventTypes.VISIT_SIGN_OUT.getKey()
                ,HKConstants.EventTypes.DOOR_FACE_AUTH_SUCCESS.getKey()});
        HKService.eventSub(param);
 
    }
}