Procházet zdrojové kódy

解决化验没有单位时推送高危值的问题

MarkHuang před 5 roky
rodič
revize
bb1deed608

+ 26 - 18
push-web/src/main/java/org/diagbot/push/convert/PreProcess.java

@@ -225,26 +225,34 @@ public class PreProcess {
                     minop = rule.getMin_operator();
                     maxop = rule.getMax_operator();
 
-                    if ( String.valueOf(minval).trim().length() > 0 && minunit.equals(unit) ) {
-                        switch (minop) {
-                            case ">":
-                                if (numval > minval) { minmatch = true; }
-                                break;
-                            case ">=":
-                                if (numval >= minval) { minmatch = true; }
-                                break;
-                        }
+                    if ( String.valueOf(minval).trim().length() > 0) {
+                        if (minunit.equals(unit) ) {
+                            switch (minop) {
+                                case ">":
+                                    if (numval > minval) { minmatch = true; }
+                                    break;
+                                case ">=":
+                                    if (numval >= minval) { minmatch = true; }
+                                    break;
+                            }
+                        } else { minmatch = false; }
                     } else { minmatch = false; }
 
-                    if (String.valueOf(maxval).trim().length() > 0 && maxunit.equals(unit) ) {
-                        switch (maxop) {
-                            case "<":
-                                if (numval < maxval) { maxmatch = true; }
-                                break;
-                            case "<=":
-                                if (numval <= maxval) { maxmatch = true; }
-                                break;
-                        }
+                    if (String.valueOf(maxval).trim().length() > 0 ) {
+                        if (maxunit.equals(unit) ) {
+                            switch (maxop) {
+                                case "<":
+                                    if (numval < maxval) {
+                                        maxmatch = true;
+                                    }
+                                    break;
+                                case "<=":
+                                    if (numval <= maxval) {
+                                        maxmatch = true;
+                                    }
+                                    break;
+                            }
+                        } else { maxmatch = false; }
                     } else { maxmatch = false; }
 
                     if (minmatch  || maxmatch) {