From 1140f80aefef30b543c99aaed47bcbca731b24e2 Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期五, 08 十二月 2023 18:21:40 +0800 Subject: [PATCH] 海康接口对接开发 --- server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncEventServiceImpl.java | 40 ++++++++++++++++++++++++++++++++++------ 1 files changed, 34 insertions(+), 6 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 index 9d7aed7..a6e5ae8 100644 --- 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 @@ -8,12 +8,14 @@ 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; @@ -41,9 +43,28 @@ 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(); + //鑾峰彇鏍圭粍缁囩紪鐮� + getRootOrgCode(); //寮�濮嬭闃呴棬绂佷簨浠躲�佽瀹簨浠躲�佸拰鍋滆溅鍦轰簨浠� startHkEventSub(); 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); + } + } + } } /** @@ -51,15 +72,22 @@ */ public void startHkEventSub(){ EventSubRequest param = new EventSubRequest(); - param.setEventDest(systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_PUSH_URL).getCode()); + String path =systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_PUSH_URL).getCode(); + param.setEventDest(path+"/parks"); 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); + ,HKConstants.EventTypes.PARK_PASS_OUT.getKey() }); + HKService.eventSub(param);//鍋滆溅鍦轰簨浠� + + param.setEventDest(path+"/visit"); + param.setEventTypes(new Integer[]{HKConstants.EventTypes.VISIT_SIGN_OUT.getKey() + ,HKConstants.EventTypes.VISIT_SIGN_OUT.getKey()}); + HKService.eventSub(param);//璁垮浜嬩欢 + + param.setEventDest(path+"/acs"); + param.setEventTypes(new Integer[]{HKConstants.EventTypes.DOOR_FACE_AUTH_SUCCESS.getKey()}); + HKService.eventSub(param);//闂ㄧ浜嬩欢 } } -- Gitblit v1.9.3