From e057cdcd1132081abd02eae587850349d14fb2f7 Mon Sep 17 00:00:00 2001
From: jiaosong <jiaosong6760@dingtalk.com>
Date: 星期四, 07 十二月 2023 11:44:39 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncEventServiceImpl.java | 87 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 87 insertions(+), 0 deletions(-)
diff --git a/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncEventServiceImpl.java b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncEventServiceImpl.java
new file mode 100644
index 0000000..e1db654
--- /dev/null
+++ b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncEventServiceImpl.java
@@ -0,0 +1,87 @@
+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.OrgListResponse;
+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.doumee.dao.system.model.SystemDictData;
+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;
+
+/**
+ * 娴峰悍浜嬩欢璁㈤槄琛⊿ervice瀹炵幇
+ * @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();
+ //鑾峰彇鏍圭粍缁囩紪鐮�
+ getRootOrgCode();
+ return 0;
+ }
+ /**
+ * 鑾峰彇鏍圭粍缁囩紪鐮�
+ */
+ private void getRootOrgCode() {
+ SystemDictData org = systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_ROOTORG_CODE);
+ if(org!=null){
+ String rootOrgId =org.getCode();
+ if(StringUtils.isBlank(rootOrgId)){
+ BaseResponse<OrgListResponse> res = HKService.getRootOrg(null);
+ if(res !=null && res.getData()!=null && StringUtils.isNotBlank(res.getData().getOrgIndexCode())){
+ org.setCode(res.getData().getOrgIndexCode());
+ org.setUpdateTime(new Date());
+ systemDictDataBiz.updateById( org);
+ }
+ }
+ }
+
+ }
+
+ /**
+ * 璁㈤槄闂ㄧ浜嬩欢銆佽瀹簨浠躲�佸拰鍋滆溅鍦轰簨浠�
+ */
+ 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);
+
+ }
+}
--
Gitblit v1.9.3