GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — https://github.com/uavorg/uavstack/issues/468 · charooo/uavstack@dfba50d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • com.creditease.uav.healthmanager/src/main/java/com/creditease/uav/feature/runtimenotify
    • StrategyJudgement.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎com.creditease.uav.healthmanager/src/main/java/com/creditease/uav/feature/runtimenotify/StrategyJudgement.java‎

Copy file name to clipboardExpand all lines: com.creditease.uav.healthmanager/src/main/java/com/creditease/uav/feature/runtimenotify/StrategyJudgement.java
+21-24Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -426,18 +426,10 @@ private boolean isOverdue(long time, long currentTime, Expression expr) {
426426
private boolean caculate(double currentValue, double lastValue, NotifyStrategy.Expression expr,
427427
Map<String, Object> judgeResult) {
428428

429-
boolean result = false;
430-
431429
double diff = currentValue - lastValue;
432-
433-
String limitString = "";
434-
435-
String upperLimitString = expr.getUpperLimit();
436-
String lowerLimitString = expr.getLowerLimit();
437-
// 增幅or降幅
438-
String upperORlower = "";
439430
double upperLimit = 0;
440-
double lowerLimit = 0;
431+
String upperLimitString = expr.getUpperLimit();
432+
441433
// get upperLimit
442434
if (upperLimitString.contains("#")) {
443435
upperLimit = Double.parseDouble(upperLimitString.substring(upperLimitString.indexOf('#') + 1));
@@ -450,6 +442,18 @@ else if (!upperLimitString.contains("*")) {
450442
upperLimit = Double.parseDouble(upperLimitString);
451443
}
452444

445+
if (!upperLimitString.contains("*") && diff > upperLimit) {
446+
judgeResult.put("actualValue", String.format("%.2f", diff) + (upperLimitString.contains("%") ? "%" : ""));
447+
judgeResult.put("expectedValue", upperLimitString);
448+
judgeResult.put("upperORlower", "upper");
449+
450+
return true;
451+
}
452+
453+
diff = currentValue - lastValue;
454+
double lowerLimit = 0;
455+
String lowerLimitString = expr.getLowerLimit();
456+
453457
// get lowerLimit
454458
if (lowerLimitString.contains("#")) {
455459
lowerLimit = 0 - Double.parseDouble(lowerLimitString.substring(lowerLimitString.indexOf('#') + 1));
@@ -462,22 +466,15 @@ else if (!lowerLimitString.contains("*")) {
462466
lowerLimit = Double.parseDouble(lowerLimitString);
463467
}
464468

465-
if (!upperLimitString.contains("*") && diff > upperLimit) {
466-
result = true;
467-
upperORlower = "upper";
468-
limitString = upperLimitString;
469-
}
470-
else if (!lowerLimitString.contains("*") && diff < 0 - lowerLimit) {
471-
result = true;
472-
upperORlower = "lower";
473-
limitString = lowerLimitString;
474-
}
469+
if (!lowerLimitString.contains("*") && diff < 0 - lowerLimit) {
470+
judgeResult.put("actualValue", String.format("%.2f", diff) + (lowerLimitString.contains("%") ? "%" : ""));
471+
judgeResult.put("expectedValue", lowerLimitString);
472+
judgeResult.put("upperORlower", "lower");
475473

476-
judgeResult.put("actualValue", String.format("%.2f", diff) + (limitString.contains("%") ? "%" : ""));
477-
judgeResult.put("expectedValue", limitString);
478-
judgeResult.put("upperORlower", upperORlower);
479-
return result;
474+
return true;
475+
}
480476

477+
return false;
481478
}
482479

483480
@SuppressWarnings({"rawtypes" })

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.