jiangping
2024-05-27 2e6f381d09669635473faf5dd4a3f01b5797d97e
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
package com.doumee.cloud.admin;
 
import com.doumee.api.BaseController;
import com.doumee.config.annotation.CloudRequiredPermission;
import com.doumee.core.annotation.pr.PreventRepeat;
import com.doumee.core.haikang.model.param.request.AcsDeviceListRequest;
import com.doumee.core.haikang.model.param.request.EventSubRequest;
import com.doumee.core.haikang.model.param.request.ParkListRequest;
import com.doumee.core.haikang.model.param.request.PrivilegeGroupRequest;
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.core.model.ApiResponse;
import com.doumee.core.utils.Constants;
import com.doumee.service.business.impl.hksync.HkSyncDeviceServiceImpl;
import com.doumee.service.business.impl.hksync.HkSyncParkServiceImpl;
import com.doumee.service.business.impl.hksync.HkSyncPrivilegeServiceImpl;
import com.doumee.service.business.impl.hksync.HkSyncPushServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * @author 江蹄蹄
 * @date 2023/11/30 15:33
 */
@Api(tags = "海康数据同步接口")
@RestController
@RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/business/hksync")
public class HkSyncCloudController extends BaseController {
 
    @Autowired
    private HkSyncDeviceServiceImpl hkSyncDeviceService;
    @Autowired
    private HkSyncParkServiceImpl hkSyncParkService;
    @Autowired
    private HkSyncPrivilegeServiceImpl hkSyncPrivilegeService;
    @Autowired
    private HkSyncPushServiceImpl hkSyncPushService;
 
    @PreventRepeat
    @ApiOperation("【海康】全量同步门禁设备接口")
    @PostMapping("/syncDevices")
    @CloudRequiredPermission("business:hksync:device")
    public ApiResponse syncHkDevices(@RequestBody AcsDeviceListRequest param,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){
        String result = hkSyncDeviceService.syncHkDevices(param);
        return ApiResponse.success(result);
    }
    @PreventRepeat
    @ApiOperation("【海康】全量同步停车库接口")
    @PostMapping("/syncParks")
    @CloudRequiredPermission("business:hksync:park")
    public ApiResponse syncHkParks(@RequestBody ParkListRequest param,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){
        String result = hkSyncParkService.syncHkParks(param);
        return ApiResponse.success(result);
    }
    @PreventRepeat
    @ApiOperation("【海康】全量同步访客权限组接口")
    @PostMapping("/syncPrivilege")
    @CloudRequiredPermission("business:hksync:privilege")
    public ApiResponse syncPrivilege(@RequestBody PrivilegeGroupRequest param,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){
        String result = hkSyncPrivilegeService.syncPrivilege(param);
        return ApiResponse.success(result);
    }
//    @PreventRepeat
    @ApiOperation("【海康】门禁事件订阅推送对接处理接口")
    @PostMapping("/push/acs")
    public ApiResponse pushAcs(  HttpServletRequest request,@RequestBody EventAcsRequest param, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){
        String result = hkSyncPushService.dealAcsEvent(param,response);
        return ApiResponse.success(result);
    }
//    @PreventRepeat
    @ApiOperation("【海康】访客事件订阅推送对接处理接口")
    @PostMapping("/push/visit")
    public ApiResponse pushVisit(@RequestBody EventVisitRequest param, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){
        String result = hkSyncPushService.dealVisitEvent(param,response);
        return ApiResponse.success(result);
    }
//    @PreventRepeat
    @ApiOperation("【海康】停车场事件订阅推送对接处理接口")
    @PostMapping("/push/parks")
    public ApiResponse pushParks(@RequestBody EventParkRequest param, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){
        String result = hkSyncPushService.dealParkEvent(param,response);
        return ApiResponse.success(result);
    }
    @PreventRepeat
    @ApiOperation("【海康】取消订阅事件")
    @PostMapping("/cancelEventSub")
    public ApiResponse cancelEventSub(@RequestBody EventSubRequest param, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){
         hkSyncPushService.cancelEventSub();
        return ApiResponse.success(null);
    }
}