|  |  | 
 |  |  |  | 
 |  |  | import com.doumee.biz.system.SystemDictDataBiz; | 
 |  |  | import com.doumee.core.haikang.model.HKConstants; | 
 |  |  | import com.doumee.core.haikang.model.HKTools; | 
 |  |  | import com.doumee.core.haikang.model.param.BaseResponse; | 
 |  |  | import com.doumee.core.haikang.model.param.request.EventSubRequest; | 
 |  |  | import com.doumee.core.haikang.model.param.respose.OrgListResponse; | 
 |  |  | import com.doumee.core.haikang.service.HKService; | 
 |  |  | import com.doumee.core.utils.Constants; | 
 |  |  | import com.doumee.dao.system.model.SystemDictData; | 
 |  |  | import com.doumee.service.business.InterfaceLogService; | 
 |  |  | import com.doumee.service.business.impl.hksync.HkSyncBaseServiceImpl; | 
 |  |  | import com.hikvision.artemis.sdk.config.ArtemisConfig; | 
 |  |  | import org.apache.commons.lang3.StringUtils; | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private SystemDictDataBiz systemDictDataBiz; | 
 |  |  |     @Autowired | 
 |  |  |     private InterfaceLogService interfaceLogService; | 
 |  |  |  | 
 |  |  |     @PostConstruct | 
 |  |  |     public  int  initHkConfig(){ | 
 |  |  | 
 |  |  |             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; | 
 |  |  |         //获取根组织编码 | 
 |  |  |         getRootOrgCode(); | 
 |  |  |         //开始订阅门禁事件、访客事件、和停车场事件 | 
 |  |  | 
 |  |  |     private void getRootOrgCode() { | 
 |  |  |         SystemDictData org =  systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_ROOTORG_CODE); | 
 |  |  |         if(org!=null){ | 
 |  |  |             SystemDictData orgName =  systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_ROOTORG_NAME); | 
 |  |  |             String rootOrgId =org.getCode(); | 
 |  |  |             if(StringUtils.isBlank(rootOrgId)){ | 
 |  |  |                 BaseResponse<OrgListResponse> res = HKService.getRootOrg(null); | 
 |  |  | 
 |  |  |                     org.setCode(res.getData().getOrgIndexCode()); | 
 |  |  |                     org.setUpdateTime(new Date()); | 
 |  |  |                     systemDictDataBiz.updateById( org); | 
 |  |  |  | 
 |  |  |                     orgName.setCode(res.getData().getOrgName()); | 
 |  |  |                     orgName.setUpdateTime(new Date()); | 
 |  |  |                     systemDictDataBiz.updateById( orgName); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } |