From 4445591a1292671d73120921964fbe7edd1af58c Mon Sep 17 00:00:00 2001 From: liuguijing <123456> Date: Tue, 14 May 2024 10:12:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E8=BF=90=E7=BB=B4=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=A1=A8=E6=95=B0=E6=8D=AE=E5=88=A4=E6=96=AD=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xypower/mpmaster/sms/SimUtil.java | 65 +++++++++---------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/mpmaster/src/main/java/com/xypower/mpmaster/sms/SimUtil.java b/mpmaster/src/main/java/com/xypower/mpmaster/sms/SimUtil.java index 047e29b9..d9673afb 100644 --- a/mpmaster/src/main/java/com/xypower/mpmaster/sms/SimUtil.java +++ b/mpmaster/src/main/java/com/xypower/mpmaster/sms/SimUtil.java @@ -72,47 +72,46 @@ public class SimUtil { sendmessage = content + " OK"; sendtype = SmsTypeEnum.REBOOT2.value(); } else if (content.contains(SmsTypeEnum.SET_YW_SCHEDULE.value())) { + ifmessageCorrect = true; String[] split1 = StringUtils.splitString1(content); - if (split1 != null && split1.length > 1) { + if (split1 != null && split1.length == 2) { String s = split1[1]; String[] split2 = StringUtils.splitString2(s); - if (split2 != null && split2.length >= 1) { - int length = split2.length; - if (length % 2 == 1) { - String num = split2[0]; - Integer integer = StringUtils.convert2Int(num); - if (integer != null) { - if (integer == 0) {//删除所有运维 - ifmessageCorrect = true; - } else { - if (length == integer + 1) { - int times = 0; - for (int i = 0; i < split2.length; i++) { - if (i == 0) { - continue; + int spilt2len = split2.length; + if (split2 != null && spilt2len > 1 && spilt2len % 2 == 1) { + String num = split2[0]; + Integer integer = StringUtils.convert2Int(num); + if (integer != null) { + if (integer == 0) {//删除所有运维 + ifmessageCorrect = true; + } else { + if (spilt2len == integer * 2 + 1) { + int times = 0; + for (int i = 0; i < spilt2len; i++) { + if (i == 0) { + continue; + } + String ts = split2[i]; + Integer time = StringUtils.convert2Int(ts); + if (i % 2 == 1) { + if (time > 23) { + ifmessageCorrect = false; + break; } - String ts = split2[i]; - Integer time = StringUtils.convert2Int(ts); - if (i % 2 == 1) { - if (time > 23) { - ifmessageCorrect = false; - break; - } - times = time * 60; - } else { - if (time > 59) { - ifmessageCorrect = false; - break; - } - times += time; - abslist.add(times); + times = time * 60; + } else { + if (time > 59) { + ifmessageCorrect = false; + break; } + times += time; + abslist.add(times); } } } - if (ifmessageCorrect) { - UpdateSysConfigUtil.setAbsHeartbeats(context, abslist); - } + } + if (ifmessageCorrect) { + UpdateSysConfigUtil.setAbsHeartbeats(context, abslist); } } }