| | |
| | | package com.doumee.cloud.admin; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.config.annotation.CloudRequiredPermission; |
| | | import com.doumee.config.annotation.LoginNoRequired; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.haikang.model.param.BaseResponse; |
| | | 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.EventVisitIccmRequest; |
| | | import com.doumee.core.haikang.model.param.request.event.visit.EventVisitRequest; |
| | | import com.doumee.core.haikang.service.HKService; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.DESUtil; |
| | | import com.doumee.dao.business.model.Device; |
| | | import com.doumee.service.business.impl.hksync.*; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author 江蹄蹄 |
| | | * @date 2023/11/30 15:33 |
| | |
| | | private HkSyncPushServiceImpl hkSyncPushService; |
| | | @Autowired |
| | | private HkSyncLoginAuthServiceImpl hkSyncLoginAuthService; |
| | | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | | @Autowired |
| | | private RedisTemplate<String,Object> redisTemplate; |
| | | |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("【海康】全量同步月台信息接口") |
| | | @PostMapping("/syncPlatforms") |
| | |
| | | @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); |
| | | public ApiResponse syncHkDevices(@RequestBody Device param, @RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | String result = null; |
| | | if(Constants.equalsInteger(param.getType(),Constants.ZERO)){ |
| | | result = hkSyncDeviceService.syncHkDevices(param); |
| | | }else if(Constants.equalsInteger(param.getType(),Constants.TWO)){ |
| | | //同步LED |
| | | result = hkSyncDeviceService.syncHkLed(param); |
| | | }else if(Constants.equalsInteger(param.getType(),Constants.THREE)){ |
| | | //同步广播 |
| | | result = hkSyncDeviceService.syncHkBroadcast(param); |
| | | } |
| | | return ApiResponse.success(result); |
| | | } |
| | | @PreventRepeat |
| | |
| | | // @PreventRepeat |
| | | @ApiOperation("【海康】门禁事件订阅推送对接处理接口") |
| | | @PostMapping("/push/acs") |
| | | public ApiResponse pushAcs( HttpServletRequest request,@RequestBody EventAcsRequest param, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | @LoginNoRequired |
| | | 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,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | @LoginNoRequired |
| | | public ApiResponse pushVisit(@RequestBody EventVisitRequest param, HttpServletResponse response){ |
| | | String result = hkSyncPushService.dealVisitEvent(param,response); |
| | | return ApiResponse.success(result); |
| | | } |
| | | @ApiOperation("【海康】访客ICCM事件订阅推送对接处理接口") |
| | | @PostMapping("/push/visitIccm") |
| | | @LoginNoRequired |
| | | public ApiResponse pushVisitIccm(@RequestBody EventVisitIccmRequest param, HttpServletResponse response) { |
| | | String result = hkSyncPushService.dealVisitEventIccm(param,response); |
| | | return ApiResponse.success(result); |
| | | } |
| | | @ApiOperation("【海康】访客ICCM事件订阅推送对接处理接口") |
| | | @PostMapping("/testLed") |
| | | @LoginNoRequired |
| | | public ApiResponse<BaseResponse> testLed(@RequestBody TransparentChannelBodyRequest request, HttpServletResponse response) { |
| | | TransparentChannelHeadRequest head = new TransparentChannelHeadRequest(); |
| | | head.setAbility("cld");//固定值 |
| | | head.setTreatyType("haixuan_led_net");//固定值 |
| | | head.setDeviceIndexCode("6a5498e9df924befbb9530e467e5e809"); |
| | | HKService.transparentchannel(head,request); |
| | | return ApiResponse.success(HKService.transparentchannel(head,request)); |
| | | } |
| | | // @PreventRepeat |
| | | @ApiOperation("【海康】停车场事件订阅推送对接处理接口") |
| | | @PostMapping("/push/parks") |
| | | public ApiResponse pushParks(@RequestBody EventParkRequest param, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | @LoginNoRequired |
| | | public ApiResponse pushParks(@RequestBody EventParkRequest param, HttpServletResponse response ){ |
| | | String result = hkSyncPushService.dealParkEvent(param,response); |
| | | return ApiResponse.success(result); |
| | | } |
| | | @ApiOperation("【海康】月台工作状态事件订阅推送对接处理接口") |
| | | @PostMapping("/push/platform/workstatus") |
| | | @LoginNoRequired |
| | | public ApiResponse pushPlatformStatus(@RequestBody EventPlatformRequest param, HttpServletResponse response ){ |
| | | String result = hkSyncPushService.dealPlatformStatusEvent(param,response); |
| | | return ApiResponse.success(result); |
| | | } |
| | | @ApiOperation("【海康】月台车辆状态事件订阅推送对接处理接口") |
| | | @PostMapping("/push/platform/carstatus") |
| | | @LoginNoRequired |
| | | public ApiResponse pushPlatformCarStatus(@RequestBody EventPlatformCarsRequest param, HttpServletResponse response ){ |
| | | String result = hkSyncPushService.dealPlatformCarsEvent(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){ |
| | | @LoginNoRequired |
| | | public ApiResponse cancelEventSub(@RequestBody EventSubRequest param, HttpServletResponse response){ |
| | | hkSyncPushService.cancelEventSub(); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | /** |
| | | * 获取安防平台系统免密菜单调整地址 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "获取安防平台系统免密菜单调整地址" ) |
| | | @GetMapping("/getHkMenuLink") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "type",example = "0",value = "菜单类型", required = true), |
| | | }) |
| | | public ApiResponse<String> getHkMenuLink(Integer type,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | LoginUserInfo loginUserInfo = this.getLoginUser(token); |
| | | String hkToken = DESUtil.generateTokenToHk(loginUserInfo.getUsername(),Integer.valueOf( |
| | | systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.HK_TOKEN_VALIDITY).getCode() |
| | | ),redisTemplate); |
| | | String url = systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.HK_HTTPS).getCode() + |
| | | systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.HK_HOST).getCode() |
| | | + HKService.getMenuUrl(type,hkToken); |
| | | return ApiResponse.success( url); |
| | | } |
| | | |
| | | } |