|
|
|
@ -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();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|