|
|
|
@ -83,21 +83,8 @@ public class StreetController {
|
|
|
|
List<LightSource> lightSources = lightSourceService.getLightSource();
|
|
|
|
List<LightSource> lightSources = lightSourceService.getLightSource();
|
|
|
|
|
|
|
|
|
|
|
|
lightSources.forEach(lightSource -> {
|
|
|
|
lightSources.forEach(lightSource -> {
|
|
|
|
JSONObject obj = JSONObject.parseObject(configProperties.getLightSource().getInfo());
|
|
|
|
LightSourceService.lightControllerFactory(configProperties.getLightSource(),lightSource,1);
|
|
|
|
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);
|
|
|
|
|
|
|
|
}else if (configProperties.getLightSource().getType() == 3){
|
|
|
|
|
|
|
|
LightSourceService.lightController(lightSource.getIp(),lightSource.getPort(),1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
@ -111,18 +98,7 @@ public class StreetController {
|
|
|
|
List<LightSource> lightSources = lightSourceService.getLightSource();
|
|
|
|
List<LightSource> lightSources = lightSourceService.getLightSource();
|
|
|
|
|
|
|
|
|
|
|
|
lightSources.forEach(lightSource -> {
|
|
|
|
lightSources.forEach(lightSource -> {
|
|
|
|
JSONObject obj = JSONObject.parseObject(configProperties.getLightSource().getInfo());
|
|
|
|
LightSourceService.lightControllerFactory(configProperties.getLightSource(),lightSource,0);
|
|
|
|
if(configProperties.getLightSource().getType() == 1){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JYDAMEquip equip = JYDamHelper.Connect(lightSource.getIp(),lightSource.getPort());
|
|
|
|
|
|
|
|
JYDamHelper.closeDO(equip,obj.getInteger("index"));
|
|
|
|
|
|
|
|
Integer status = JYDamHelper.ReadStatus(equip,obj.getInteger("num"),obj.getInteger("index"));
|
|
|
|
|
|
|
|
log.info("ip:{},status:{}",lightSource.getIp(),status);
|
|
|
|
|
|
|
|
}else if(configProperties.getLightSource().getType() == 2){
|
|
|
|
|
|
|
|
HikControlSocket.openLight(lightSource.getIp(),lightSource.getPort(),configProperties.getLightSource().getIndex(),0);
|
|
|
|
|
|
|
|
}else if (configProperties.getLightSource().getType() == 3){
|
|
|
|
|
|
|
|
LightSourceService.lightController(lightSource.getIp(),lightSource.getPort(),0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
@ -134,17 +110,7 @@ public class StreetController {
|
|
|
|
public Result openStreetLightSource(@PathVariable Integer streetId){
|
|
|
|
public Result openStreetLightSource(@PathVariable Integer streetId){
|
|
|
|
List<LightSource> lightSources = lightSourceService.getLightSourceByStreetId(streetId);
|
|
|
|
List<LightSource> lightSources = lightSourceService.getLightSourceByStreetId(streetId);
|
|
|
|
lightSources.forEach(lightSource -> {
|
|
|
|
lightSources.forEach(lightSource -> {
|
|
|
|
if(configProperties.getLightSource().getType() == 1){
|
|
|
|
LightSourceService.lightControllerFactory(configProperties.getLightSource(),lightSource,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);
|
|
|
|
|
|
|
|
}else if (configProperties.getLightSource().getType() == 3){
|
|
|
|
|
|
|
|
LightSourceService.lightController(lightSource.getIp(),lightSource.getPort(),1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
@ -156,17 +122,7 @@ public class StreetController {
|
|
|
|
public Result closeStreetLightSource(@PathVariable Integer streetId){
|
|
|
|
public Result closeStreetLightSource(@PathVariable Integer streetId){
|
|
|
|
List<LightSource> lightSources = lightSourceService.getLightSourceByStreetId(streetId);
|
|
|
|
List<LightSource> lightSources = lightSourceService.getLightSourceByStreetId(streetId);
|
|
|
|
lightSources.forEach(lightSource -> {
|
|
|
|
lightSources.forEach(lightSource -> {
|
|
|
|
if(configProperties.getLightSource().getType() == 1){
|
|
|
|
LightSourceService.lightControllerFactory(configProperties.getLightSource(),lightSource,0);
|
|
|
|
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);
|
|
|
|
|
|
|
|
}else if (configProperties.getLightSource().getType() == 3){
|
|
|
|
|
|
|
|
LightSourceService.lightController(lightSource.getIp(),lightSource.getPort(),0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|