单独巷道的光源开关

merge-requests/6/head
yiming 4 years ago
parent c33599566e
commit b1e01176e8

@ -77,6 +77,7 @@ public class StreetController {
} }
@GetMapping("/lightSource/open") @GetMapping("/lightSource/open")
@ApiOperation(value = "开启光源") @ApiOperation(value = "开启光源")
public Result openLightSource(){ public Result openLightSource(){
@ -124,6 +125,46 @@ public class StreetController {
return Result.success(); return Result.success();
} }
@GetMapping("/lightSource/open/{streetId}")
@ApiOperation(value = "开启单个巷道光源")
public Result openStreetLightSource(@PathVariable Integer streetId){
List<LightSource> 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<LightSource> 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();
}

@ -35,6 +35,7 @@ public class Camera {
private String status; private String status;
private Integer rtcServerPort; private Integer rtcServerPort;
@ApiModelProperty(value = "预置点 增长值",hidden = true) @ApiModelProperty(value = "预置点 增长值",hidden = true)
private Integer ptzId; private Integer ptzId;

@ -317,7 +317,6 @@ public class CameraService {
} }
public void cameraLogin(Camera camera){ public void cameraLogin(Camera camera){
NetSDKLib.LLong lLong = cameraControlLoginModule.login(camera.getIp(),camera.getPort(),camera.getUser(),camera.getPassword()); NetSDKLib.LLong lLong = cameraControlLoginModule.login(camera.getIp(),camera.getPort(),camera.getUser(),camera.getPassword());
if(lLong != null){ if(lLong != null){
log.info("camera login success,cameraId:{},ip:{}",camera.getId(),camera.getIp()); log.info("camera login success,cameraId:{},ip:{}",camera.getId(),camera.getIp());

@ -1,5 +1,6 @@
package com.zhehekeji.web.service; package com.zhehekeji.web.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhehekeji.web.entity.LightSource; import com.zhehekeji.web.entity.LightSource;
import com.zhehekeji.web.mapper.LightSourceMapper; import com.zhehekeji.web.mapper.LightSourceMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -17,4 +18,8 @@ public class LightSourceService {
public List<LightSource> getLightSource(){ public List<LightSource> getLightSource(){
return lightSourceMapper.selectByMap(new HashMap<>()); return lightSourceMapper.selectByMap(new HashMap<>());
} }
public List<LightSource> getLightSourceByStreetId(Integer streetId){
return lightSourceMapper.selectList(new QueryWrapper<LightSource>().eq("street_id",streetId));
}
} }

Loading…
Cancel
Save