package com.doumee.api.business; 
 | 
  
 | 
import com.doumee.core.annotation.pr.PreventRepeat; 
 | 
import com.doumee.core.haikang.model.param.request.*; 
 | 
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.parks.EventPlatformCarsRequest; 
 | 
import com.doumee.core.haikang.model.param.request.event.parks.EventPlatformRequest; 
 | 
import com.doumee.core.haikang.model.param.request.event.visit.EventVisitRequest; 
 | 
import com.doumee.service.business.third.model.ApiResponse; 
 | 
import com.doumee.dao.business.model.Device; 
 | 
import com.doumee.service.business.impl.hksync.*; 
 | 
import io.swagger.annotations.Api; 
 | 
import io.swagger.annotations.ApiOperation; 
 | 
import org.apache.shiro.authz.annotation.RequiresPermissions; 
 | 
import org.springframework.beans.factory.annotation.Autowired; 
 | 
import org.springframework.web.bind.annotation.*; 
 | 
  
 | 
import javax.servlet.http.HttpServletRequest; 
 | 
import javax.servlet.http.HttpServletResponse; 
 | 
  
 | 
import com.doumee.api.BaseController; 
 | 
/** 
 | 
 * @author 江蹄蹄 
 | 
 * @date 2023/11/30 15:33 
 | 
 */ 
 | 
@Api(tags = "海康数据同步接口") 
 | 
@RestController 
 | 
@RequestMapping("/business/hksync") 
 | 
public class HkSyncController extends BaseController { 
 | 
  
 | 
    @Autowired 
 | 
    private HkSyncDeviceServiceImpl hkSyncDeviceService; 
 | 
    @Autowired 
 | 
    private HkSyncParkServiceImpl hkSyncParkService; 
 | 
    @Autowired 
 | 
    private HkSyncPrivilegeServiceImpl hkSyncPrivilegeService; 
 | 
    @Autowired 
 | 
    private HkSyncPushServiceImpl hkSyncPushService; 
 | 
    @Autowired 
 | 
    private HkSyncPlatformsServiceImpl hkSyncPlatformsService; 
 | 
    @PreventRepeat 
 | 
    @ApiOperation("【海康】全量同步月台信息接口") 
 | 
    @PostMapping("/syncPlatforms") 
 | 
    @RequiresPermissions("business:hksync:platforms") 
 | 
    public ApiResponse syncPlatforms(@RequestBody PlatformsListRequest param) { 
 | 
        String result = hkSyncPlatformsService.syncPlatforms(param); 
 | 
        return ApiResponse.success(result); 
 | 
    } 
 | 
    @PreventRepeat 
 | 
    @ApiOperation("【海康】全量同步月台状态信息接口") 
 | 
    @PostMapping("/syncPlatformStatus") 
 | 
    @RequiresPermissions("business:hksync:platforms") 
 | 
    public ApiResponse syncPlatformStatus(@RequestBody PlatformStatusRequest param) { 
 | 
        String result = hkSyncPlatformsService.getPlatformStatus(param); 
 | 
        return ApiResponse.success(result); 
 | 
    } 
 | 
    @PreventRepeat 
 | 
    @ApiOperation("【海康】全量同步门禁设备接口") 
 | 
    @PostMapping("/syncDevices") 
 | 
    @RequiresPermissions("business:hksync:device") 
 | 
    public ApiResponse syncHkDevices(@RequestBody Device param) { 
 | 
        String result = hkSyncDeviceService.syncHkDevices(param); 
 | 
        return ApiResponse.success(result); 
 | 
    } 
 | 
    @PreventRepeat 
 | 
    @ApiOperation("【海康】全量同步停车库接口") 
 | 
    @PostMapping("/syncParks") 
 | 
    @RequiresPermissions("business:hksync:park") 
 | 
    public ApiResponse syncHkParks(@RequestBody ParkListRequest param) { 
 | 
        String result = hkSyncParkService.syncHkParks(param); 
 | 
        return ApiResponse.success(result); 
 | 
    } 
 | 
    @PreventRepeat 
 | 
    @ApiOperation("【海康】全量同步访客权限组接口") 
 | 
    @PostMapping("/syncPrivilege") 
 | 
    @RequiresPermissions("business:hksync:privilege") 
 | 
    public ApiResponse syncPrivilege(@RequestBody PrivilegeGroupRequest param) { 
 | 
        String result = hkSyncPrivilegeService.syncPrivilege(param); 
 | 
        return ApiResponse.success(result); 
 | 
    } 
 | 
//    @PreventRepeat 
 | 
    @ApiOperation("【海康】门禁事件订阅推送对接处理接口") 
 | 
    @PostMapping("/push/acs") 
 | 
    public ApiResponse pushAcs(  HttpServletRequest request,@RequestBody EventAcsRequest param, HttpServletResponse response) { 
 | 
        String result = hkSyncPushService.dealAcsEvent(param,response); 
 | 
        return ApiResponse.success(result); 
 | 
    } 
 | 
//    @PreventRepeat 
 | 
    @ApiOperation("【海康】访客事件订阅推送对接处理接口") 
 | 
    @PostMapping("/push/visit") 
 | 
    public ApiResponse pushVisit(@RequestBody EventVisitRequest param, HttpServletResponse response) { 
 | 
        String result = hkSyncPushService.dealVisitEvent(param,response); 
 | 
        return ApiResponse.success(result); 
 | 
    } 
 | 
//    @PreventRepeat 
 | 
    @ApiOperation("【海康】停车场事件订阅推送对接处理接口") 
 | 
    @PostMapping("/push/parks") 
 | 
    public ApiResponse pushParks(@RequestBody EventParkRequest param, HttpServletResponse response) { 
 | 
        String result = hkSyncPushService.dealParkEvent(param,response); 
 | 
        return ApiResponse.success(result); 
 | 
    } 
 | 
    @PreventRepeat 
 | 
    @ApiOperation("【海康】取消订阅事件") 
 | 
    @PostMapping("/cancelEventSub") 
 | 
    public ApiResponse cancelEventSub(@RequestBody EventSubRequest param, HttpServletResponse response) { 
 | 
         hkSyncPushService.cancelEventSub(); 
 | 
        return ApiResponse.success(null); 
 | 
    } 
 | 
    @ApiOperation("【海康】月台工作状态事件推送") 
 | 
    @PostMapping("/push/platform/workstatus") 
 | 
    public ApiResponse pushPlatformStatus(@RequestBody EventPlatformRequest param, HttpServletResponse response) { 
 | 
         hkSyncPushService.dealPlatformStatusEvent(param,response); 
 | 
        return ApiResponse.success(null); 
 | 
    } 
 | 
    @ApiOperation("【海康】月台车辆状态事件推送") 
 | 
    @PostMapping("/push/platform/carstatus") 
 | 
    public ApiResponse pushPlatformCarStatus(@RequestBody EventPlatformCarsRequest param, HttpServletResponse response) { 
 | 
         hkSyncPushService.dealPlatformCarsEvent(param,response); 
 | 
        return ApiResponse.success(null); 
 | 
    } 
 | 
} 
 |