From d5dab07dc674de7edbbc1bd6ade0486f54fbdb26 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期二, 06 五月 2025 19:19:35 +0800 Subject: [PATCH] 1、实现万用token(0000-0000-1234-9876-5); 2、web端单独实现命令结果等待器,并修改相关部分; 3、web端实现透传命令; 4、修改一些不当注释; 5、优化一些代码。 --- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/upVos/DataAlarmVo.java | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 110 insertions(+), 0 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/upVos/DataAlarmVo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/upVos/DataAlarmVo.java new file mode 100644 index 0000000..0c14fcf --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/upVos/DataAlarmVo.java @@ -0,0 +1,110 @@ +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)":"姝e父(0)")); + str.append("\n"); + str.append(" 婕忔崯锛� "); + str.append(loss==null?"":(loss==1?"鎶ヨ(1)":"姝e父(0)")); + str.append("\n"); + str.append(" 娴侀噺璁℃晠闅滐細"); + str.append(meter==null?"":(meter==1?"鎶ヨ(1)":"姝e父(0)")); + str.append("\n"); + str.append(" 闃�闂細 "); + str.append(valve==null?"":(valve==1?"鎶ヨ(1)":"姝e父(0)")); + return str.toString() ; + } +} -- Gitblit v1.8.0