package com.doumee.service.business.impl.hksync; import com.alibaba.fastjson.JSONObject; import com.doumee.config.SpringContextUtil; import com.doumee.core.haikang.model.HKConstants; import com.doumee.core.haikang.model.param.request.event.acs.EventAcsRequest; import com.doumee.core.haikang.model.param.request.event.parks.EventParkRequest; import com.doumee.core.haikang.model.param.request.event.visit.EventVisitRequest; import com.doumee.dao.business.model.InterfaceLog; import com.doumee.service.business.InterfaceLogService; import com.hikvision.artemis.sdk.config.ArtemisConfig; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletResponse; import java.util.Date; /** * 访客权限组信息表Service实现 * @author 江蹄蹄 * @date 2023/11/30 15:33 */ @Service @Slf4j public class HkSyncPushServiceImpl extends HkSyncBaseServiceImpl { @Autowired private InterfaceLogService interfaceLogService; /** * 海康门禁事件推送 * @param param * @param response * @return */ @Override public String dealAcsEvent(EventAcsRequest param, HttpServletResponse response){ log.info("【海康门禁事件推送】========开始=========:\n"+JSONObject.toJSONString(param)); String result = null; try { log.error("【海康门禁事件推送】========成功======="); }catch (Exception e) { log.error("【海康门禁事件推送】========失败=======:\n" + e.getMessage()); }finally { saveInterfaceLog(param,"/business/hksync/push/acs",result); } return null; } /** * 海康访客事件推送 * @param param * @param response * @return */ @Override public String dealVisitEvent(EventVisitRequest param, HttpServletResponse response){ log.info("【海康访客事件推送】==========开始=======:\n"+JSONObject.toJSONString(param)); String result = null; try { log.error("【海康访客事件推送】========成功======="); }catch (Exception e){ log.error("【海康访客事件推送】========失败=======:\n"+e.getMessage()); } saveInterfaceLog(param,"/business/hksync/push/visit",result); return null; } /** * 海康停车场事件推送 * @param param * @param response * @return */ @Override public String dealParkEvent(EventParkRequest param, HttpServletResponse response){ String result = null; log.info("【海康停车场事件推送】========开始=========:\n"+JSONObject.toJSONString(param)); try { log.error("【海康停车场事件推送】========成功======="); }catch (Exception e){ log.error("【海康停车场事件推送】========失败=======:\n"+e.getMessage()); } saveInterfaceLog(param,"/business/hksync/push/parks",result); return null; } private void saveInterfaceLog(Object param, String path,String result) { InterfaceLog hkMonitoryLogDO=new InterfaceLog(); hkMonitoryLogDO.setType(1); hkMonitoryLogDO.setCreateDate(new Date()); hkMonitoryLogDO.setIsdeleted(0); if(param!=null){ hkMonitoryLogDO.setRequest(JSONObject.toJSONString(param)); } hkMonitoryLogDO.setRepose(result); hkMonitoryLogDO.setName(path); hkMonitoryLogDO.setUrl(path); interfaceLogService.create(hkMonitoryLogDO); } }