package com.dy.common.mw.protocol.p206V2.upVos; import com.dy.common.mw.protocol.UpDataVo; import lombok.Data; @Data public class DataAlarmVo implements UpDataVo { public Byte batteryVolt ;// 蓄电池电压 public Byte loss ;//漏损 public Byte meter ;//流量计故障 public Byte valve ;//阀门 public String to1010(){ String s = "" ; s += (batteryVolt == null ? "0" : batteryVolt.byteValue()) ; s += (loss == null ? "0" : loss.byteValue()) ; s += (meter == null ? "0" : meter.byteValue()) ; s += (valve == null ? "0" : valve.byteValue()) ; return s ; } public boolean hasDiff(DataAlarmVo oth){ if(this.batteryVolt.byteValue() != oth.batteryVolt.byteValue() || this.loss.byteValue() != oth.loss.byteValue() || this.meter.byteValue() != oth.meter.byteValue() || this.valve.byteValue() != oth.valve.byteValue()){ return true ; }else{ return false ; } } public boolean hasAlarm(){ boolean flag = false ; if((batteryVolt != null && batteryVolt == 1) || (loss != null && loss == 1) || (meter != null && meter == 1) || (valve != null && valve == 1)){ flag = true ; } return flag ; } public boolean hasAlarmExcludeLoss(){ boolean flag = false ; if((batteryVolt != null && batteryVolt == 1) || (meter != null && meter == 1) || (valve != null && valve == 1)){ flag = true ; } return flag ; } public String alarmContent(){ String txt = "" ; boolean hasTxt = false ; if(batteryVolt != null && batteryVolt == 1){ txt += (hasTxt?"、":"") + "蓄电池电压报警" ; hasTxt = true ; } if(meter != null && meter == 1){ txt += (hasTxt?"、":"") + "流量计故障报警" ; hasTxt = true ; } if(valve != null && valve == 1){ txt += (hasTxt?"、":"") + "阀门故障报警" ; hasTxt = true ; } if(loss != null && loss == 1){ txt += (hasTxt?"、":"") + "漏损报警" ; hasTxt = true ; } return txt ; } public String alarmContentExcludeLoss(){ String txt = "" ; boolean hasTxt = false ; if(batteryVolt != null && batteryVolt == 1){ txt += (hasTxt?"、":"") + "蓄电池电压报警" ; hasTxt = true ; } if(meter != null && meter == 1){ txt += (hasTxt?"、":"") + "流量计故障报警" ; hasTxt = true ; } if(valve != null && valve == 1){ txt += (hasTxt?"、":"") + "阀门故障报警" ; hasTxt = true ; } return txt ; } public String toString(){ StringBuilder str = new StringBuilder() ; str.append(" 报警:\n"); str.append(" 蓄电池电压:"); str.append(batteryVolt==null?"":(batteryVolt==1?"报警(1)":"正常(0)")); str.append("\n"); str.append(" 漏损: "); str.append(loss==null?"":(loss==1?"报警(1)":"正常(0)")); str.append("\n"); str.append(" 流量计故障:"); str.append(meter==null?"":(meter==1?"报警(1)":"正常(0)")); str.append("\n"); str.append(" 阀门: "); str.append(valve==null?"":(valve==1?"报警(1)":"正常(0)")); return str.toString() ; } }