aa
jiangping
2023-12-13 4f03c6e3bea2ae7c1537fabe3e3bffc3f49b8e86
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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);
    }
 
 
}