From 34981c30a78e8bbd7791131059a9210f9928b62c Mon Sep 17 00:00:00 2001
From: 刘光辉 <347230014@qq.com>
Date: 星期四, 17 九月 2026 09:24:09 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master' into master

---
 jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/limsService/support/LimsWendingxingFenxiSupport.java |   85 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 85 insertions(+), 0 deletions(-)

diff --git a/jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/limsService/support/LimsWendingxingFenxiSupport.java b/jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/limsService/support/LimsWendingxingFenxiSupport.java
new file mode 100644
index 0000000..e4f01c8
--- /dev/null
+++ b/jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/limsService/support/LimsWendingxingFenxiSupport.java
@@ -0,0 +1,85 @@
+package jnpf.limsService.support;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+
+public final class LimsWendingxingFenxiSupport {
+
+    private LimsWendingxingFenxiSupport() {
+    }
+
+    public static BigDecimal strictDecimal(String value) {
+        if (!hasText(value)
+                || !value.trim().matches("[+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+)")) {
+            return null;
+        }
+        try {
+            return new BigDecimal(value.trim());
+        } catch (NumberFormatException ignored) {
+            return null;
+        }
+    }
+
+    public static List<String> normalizeIds(List<String> ids) {
+        Set<String> values = new LinkedHashSet<>();
+        if (ids != null) {
+            for (String id : ids) {
+                if (hasText(id)) {
+                    values.add(id.trim());
+                }
+            }
+        }
+        return new ArrayList<>(values);
+    }
+
+    public static double periodOrder(BigDecimal period, String unit) {
+        if (period == null) {
+            return Double.MAX_VALUE;
+        }
+        String normalized = hasText(unit)
+                ? unit.trim().toLowerCase(Locale.ROOT) : "";
+        double factor;
+        if (normalized.matches("澶﹟鏃day|days|d")) {
+            factor = 1D;
+        } else if (normalized.matches("鍛▅鏄熸湡|week|weeks|w")) {
+            factor = 7D;
+        } else if (normalized.matches("鏈坾month|months|m")) {
+            factor = 30D;
+        } else if (normalized.matches("骞磡year|years|y")) {
+            factor = 365D;
+        } else if (normalized.matches("灏忔椂|鏃秥hour|hours|h")) {
+            factor = 1D / 24D;
+        } else {
+            factor = 10000D;
+        }
+        return period.doubleValue() * factor;
+    }
+
+    public static String exceptionType(String investigation, String conclusion,
+                                       BigDecimal value, BigDecimal lower, BigDecimal upper) {
+        String type = investigation == null
+                ? "" : investigation.trim().toLowerCase(Locale.ROOT);
+        if ("oos".equals(type) || "oot".equals(type)) {
+            return type;
+        }
+        if ("non_compliant".equalsIgnoreCase(conclusion)) {
+            return "non_compliant";
+        }
+        if (value != null && ((lower != null && value.compareTo(lower) < 0)
+                || (upper != null && value.compareTo(upper) > 0))) {
+            return "out_of_limit";
+        }
+        if ("ad".equals(type)) {
+            return "ad";
+        }
+        return "";
+    }
+
+    private static boolean hasText(String value) {
+        return value != null && !value.trim().isEmpty();
+    }
+}

--
Gitblit v1.8.0