| | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.BreakerInfMapper; |
| | | import com.whyc.mapper.CKPowerDevSignalMapper; |
| | | import com.whyc.pojo.db_ckpwrdev_data_rt.CKPowerDevRt; |
| | | import com.whyc.pojo.db_ckpwrdev_data_rt.CKPowerDevSignal; |
| | | import com.whyc.pojo.db_ckpwrdev_data_rt.CKPowerDevSignalSet; |
| | | import com.whyc.util.CommonUtil; |
| | | import com.whyc.util.DateUtil; |
| | | import org.omg.CORBA.OMGVMCID; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | //头部开关统计 |
| | | public Response getSwitchReal(){ |
| | | Map<String,Integer> map=new HashMap<>(); |
| | | map.put("onSwitch",0); |
| | | map.put("offSwitch",0); |
| | | //map.put("alarmSwitch",0); |
| | | //map.put("runSwitch",0); |
| | | Map<String,String> map=new HashMap<>(); |
| | | map.put("onSwitch","0"); |
| | | map.put("offSwitch","0"); |
| | | map.put("nowTime",DateUtil.format_YYYY_MM_DD_HH_MM_SS(new Date())); |
| | | map.put("recordTime",DateUtil.format_YYYY_MM_DD_HH_MM_SS(new Date())); |
| | | QueryWrapper<CKPowerDevSignal> query = Wrappers.query(); |
| | | query.last(" limit 1"); |
| | | CKPowerDevSignal switchReal=mapper.selectOne(query); |
| | | int onSwitch=0; |
| | | int breakSwitch=0; |
| | | int offSwitch=0; |
| | | if(switchReal!=null){ |
| | | //交流微段开关 |
| | | if (switchReal.getAc1InSwitchTripSt()==0){ |
| | | breakSwitch+=CommonUtil.getIntToBinary(switchReal.getAc1InSwitchTripReal(),new int[]{0}); |
| | | }else{ |
| | | breakSwitch+=CommonUtil.getIntToBinary(switchReal.getAc1InSwitchTripFake(),new int[]{0}); |
| | | } |
| | | //1段交流 |
| | | if(switchReal.getAc1OutSwitch1TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc1OutSwitch1TripReal()); |
| | | breakSwitch+= CommonUtil.getIntToBinary(switchReal.getAc1OutSwitch1TripReal(),new int[]{0,1,2,3,4,5,6}); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc1OutSwitch1TripFake()); |
| | | breakSwitch+= CommonUtil.getIntToBinary(switchReal.getAc1OutSwitch1TripFake(),new int[]{0,1,2,3,4,5,6}); |
| | | |
| | | } |
| | | if(switchReal.getAc1OutSwitch2TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc1OutSwitch2TripReal()); |
| | | |
| | | //交流微段开关 |
| | | if (switchReal.getAc2InSwitchTripSt()==0){ |
| | | breakSwitch+=CommonUtil.getIntToBinary(switchReal.getAc2InSwitchTripReal(),new int[]{0}); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc1OutSwitch2TripFake()); |
| | | } |
| | | if(switchReal.getAc1OutSwitch3TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc1OutSwitch3TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc1OutSwitch3TripFake()); |
| | | } |
| | | if(switchReal.getAc1OutSwitch4TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc1OutSwitch4TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc1OutSwitch4TripFake()); |
| | | breakSwitch+=CommonUtil.getIntToBinary(switchReal.getAc2InSwitchTripFake(),new int[]{0}); |
| | | } |
| | | //2段交流 |
| | | if(switchReal.getAc2OutSwitch1TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc2OutSwitch1TripReal()); |
| | | breakSwitch+= CommonUtil.getIntToBinary(switchReal.getAc2OutSwitch1TripReal(),new int[]{0,1,2,3,4,5,6}); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc2OutSwitch1TripFake()); |
| | | breakSwitch+= CommonUtil.getIntToBinary(switchReal.getAc2OutSwitch1TripFake(),new int[]{0,1,2,3,4,5,6}); |
| | | } |
| | | if(switchReal.getAc2OutSwitch2TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc2OutSwitch2TripReal()); |
| | | |
| | | //直流微段开关 |
| | | if (switchReal.getDcIn1SwitchTripSt()==0){ |
| | | breakSwitch+=CommonUtil.getIntToBinary(switchReal.getDcIn1SwitchTripReal(),new int[]{0}); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc2OutSwitch2TripFake()); |
| | | } |
| | | if(switchReal.getAc2OutSwitch3TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc2OutSwitch3TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc2OutSwitch3TripFake()); |
| | | } |
| | | if(switchReal.getAc2OutSwitch4TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc2OutSwitch4TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc2OutSwitch4TripFake()); |
| | | breakSwitch+=CommonUtil.getIntToBinary(switchReal.getDcIn1SwitchTripFake(),new int[]{0}); |
| | | } |
| | | //1段直流 |
| | | if(switchReal.getDc1Switch1TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc1Switch1TripReal()); |
| | | breakSwitch+= CommonUtil.getIntToBinary(switchReal.getDc1Switch1TripReal(),new int[]{0,1,2,3,4,5,6,7}); |
| | | |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc1Switch1TripFake()); |
| | | breakSwitch+= CommonUtil.getIntToBinary(switchReal.getDc1Switch1TripFake(),new int[]{0,1,2,3,4,5,6,7}); |
| | | |
| | | } |
| | | if(switchReal.getDc1Switch2TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc1Switch2TripReal()); |
| | | |
| | | |
| | | //直流微段开关 |
| | | if (switchReal.getDcIn2SwitchTripSt()==0){ |
| | | breakSwitch+=CommonUtil.getIntToBinary(switchReal.getDcIn2SwitchTripReal(),new int[]{0}); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc1Switch2TripFake()); |
| | | } |
| | | if(switchReal.getDc1Switch3TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc1Switch3TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc1Switch3TripFake()); |
| | | } |
| | | if(switchReal.getDc1Switch4TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc1Switch4TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc1Switch4TripFake()); |
| | | breakSwitch+=CommonUtil.getIntToBinary(switchReal.getDcIn2SwitchTripFake(),new int[]{0}); |
| | | } |
| | | //2段直流 |
| | | if(switchReal.getDc2Switch1TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc2Switch1TripReal()); |
| | | breakSwitch+= CommonUtil.getIntToBinary(switchReal.getDc2Switch1TripReal(),new int[]{0,1,2,3,4,5,6,7}); |
| | | |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc2Switch1TripFake()); |
| | | breakSwitch+= CommonUtil.getIntToBinary(switchReal.getDc2Switch1TripFake(),new int[]{0,1,2,3,4,5,6,7}); |
| | | } |
| | | if(switchReal.getDc2Switch2TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc2Switch2TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc2Switch2TripFake()); |
| | | } |
| | | if(switchReal.getDc2Switch3TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc2Switch3TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc2Switch3TripFake()); |
| | | } |
| | | if(switchReal.getDc2Switch4TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc2Switch4TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc2Switch4TripFake()); |
| | | } |
| | | //统计分闸 |
| | | offSwitch+=CommonUtil.getIntToBinary(switchReal.getBreakerState1(),new int[]{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24}); |
| | | offSwitch+=CommonUtil.getIntToBinary(switchReal.getBreakerState2(),new int[]{0,1,2,3,4,5,6,7,8}); |
| | | |
| | | map.put("recordTime", DateUtil.format_YYYY_MM_DD_HH_MM_SS(switchReal.getRecordTime())); |
| | | } |
| | | map.put("onSwitch",onSwitch); |
| | | |
| | | //获取总的启用断路器开关数 |
| | | int swtichAll=breakerInfMapper.getSwtichAll(); |
| | | map.put("offSwitch",swtichAll-onSwitch); |
| | | map.put("offSwitch",String.valueOf(offSwitch)); |
| | | map.put("onSwitch",String.valueOf(swtichAll-offSwitch)); |
| | | map.put("breakSwitch",String.valueOf(breakSwitch)); |
| | | return new Response().set(1,map); |
| | | } |
| | | } |