diff --git a/web/src/main/java/com/zhehekeji/web/controller/StreetController.java b/web/src/main/java/com/zhehekeji/web/controller/StreetController.java index 54df49c..aa1e52b 100644 --- a/web/src/main/java/com/zhehekeji/web/controller/StreetController.java +++ b/web/src/main/java/com/zhehekeji/web/controller/StreetController.java @@ -77,6 +77,7 @@ public class StreetController { } + @GetMapping("/lightSource/open") @ApiOperation(value = "开启光源") public Result openLightSource(){ @@ -124,6 +125,46 @@ public class StreetController { return Result.success(); } + @GetMapping("/lightSource/open/{streetId}") + @ApiOperation(value = "开启单个巷道光源") + public Result openStreetLightSource(@PathVariable Integer streetId){ + List lightSources = lightSourceService.getLightSourceByStreetId(streetId); + lightSources.forEach(lightSource -> { + if(configProperties.getLightSource().getType() == 1){ + JYDAMEquip equip = JYDamHelper.Connect(lightSource.getIp(),lightSource.getPort()); + JYDamHelper.openDO(equip,configProperties.getLightSource().getIndex()); + Integer status = JYDamHelper.ReadStatus(equip,configProperties.getLightSource().getNum(),configProperties.getLightSource().getIndex()); + log.info("ip:{},status:{}",lightSource.getIp(),status); + equip.DisConnect(); + }else if(configProperties.getLightSource().getType() == 2){ + HikControlSocket.openLight(lightSource.getIp(),lightSource.getPort(),configProperties.getLightSource().getIndex(),1); + } + + }); + + return Result.success(); + } + + @GetMapping("/lightSource/close/{streetId}") + @ApiOperation(value = "关闭单个巷道光源") + public Result closeStreetLightSource(@PathVariable Integer streetId){ + List lightSources = lightSourceService.getLightSourceByStreetId(streetId); + lightSources.forEach(lightSource -> { + if(configProperties.getLightSource().getType() == 1){ + JYDAMEquip equip = JYDamHelper.Connect(lightSource.getIp(),lightSource.getPort()); + JYDamHelper.closeDO(equip,configProperties.getLightSource().getIndex()); + Integer status = JYDamHelper.ReadStatus(equip,configProperties.getLightSource().getNum(),configProperties.getLightSource().getIndex()); + log.info("ip:{},status:{}",lightSource.getIp(),status); + equip.DisConnect(); + }else if(configProperties.getLightSource().getType() == 2){ + HikControlSocket.openLight(lightSource.getIp(),lightSource.getPort(),configProperties.getLightSource().getIndex(),0); + } + + }); + + return Result.success(); + } + diff --git a/web/src/main/java/com/zhehekeji/web/entity/Camera.java b/web/src/main/java/com/zhehekeji/web/entity/Camera.java index c4b8bc5..e599dfc 100644 --- a/web/src/main/java/com/zhehekeji/web/entity/Camera.java +++ b/web/src/main/java/com/zhehekeji/web/entity/Camera.java @@ -35,6 +35,7 @@ public class Camera { private String status; private Integer rtcServerPort; + @ApiModelProperty(value = "预置点 增长值",hidden = true) private Integer ptzId; diff --git a/web/src/main/java/com/zhehekeji/web/service/CameraService.java b/web/src/main/java/com/zhehekeji/web/service/CameraService.java index 3241ac8..982e811 100644 --- a/web/src/main/java/com/zhehekeji/web/service/CameraService.java +++ b/web/src/main/java/com/zhehekeji/web/service/CameraService.java @@ -317,7 +317,6 @@ public class CameraService { } public void cameraLogin(Camera camera){ - NetSDKLib.LLong lLong = cameraControlLoginModule.login(camera.getIp(),camera.getPort(),camera.getUser(),camera.getPassword()); if(lLong != null){ log.info("camera login success,cameraId:{},ip:{}",camera.getId(),camera.getIp()); diff --git a/web/src/main/java/com/zhehekeji/web/service/LightSourceService.java b/web/src/main/java/com/zhehekeji/web/service/LightSourceService.java index 10fcaa8..3f60d19 100644 --- a/web/src/main/java/com/zhehekeji/web/service/LightSourceService.java +++ b/web/src/main/java/com/zhehekeji/web/service/LightSourceService.java @@ -1,5 +1,6 @@ package com.zhehekeji.web.service; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.zhehekeji.web.entity.LightSource; import com.zhehekeji.web.mapper.LightSourceMapper; import org.springframework.beans.factory.annotation.Autowired; @@ -17,4 +18,8 @@ public class LightSourceService { public List getLightSource(){ return lightSourceMapper.selectByMap(new HashMap<>()); } + + public List getLightSourceByStreetId(Integer streetId){ + return lightSourceMapper.selectList(new QueryWrapper().eq("street_id",streetId)); + } }