From a016e3f59d1b2227cd22aeb82090b82d487c8235 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期五, 06 十二月 2024 14:36:42 +0800
Subject: [PATCH] Merge branch 'master' into cnas

---
 inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
index a2cc408..7e017cc 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
@@ -135,6 +135,49 @@
             standardProductList.setMethodS(code);
             return standardProductList;
         }).collect(Collectors.toList());
+        //鎸夌収鐢佃矾璇曢獙--杈愬皠璇曢獙--娓╂箍搴﹁瘯楠�--鐜璇曢獙杩涜鎺掑簭
+        // 瀹氫箟鑷畾涔夋帓搴忓櫒
+        Comparator<StandardProductList> testTypeComparator = (o1, o2) -> {
+            String[] order = {"鐢佃矾璇曢獙", "杈愬皠璇曢獙", "娓╂箍搴﹁瘯楠�", "鐜璇曢獙","鍔熺巼璇曢獙"};
+            int index1 = -1;
+            int index2 = -1;
+            // 鎵惧嚭涓や釜瀵硅薄 鍦ㄨ嚜瀹氫箟椤哄簭鏁扮粍涓殑浣嶇疆
+            for (int i = 0; i < order.length; i++) {
+                if (o1.getInspectionItem().equals(order[i])) {
+                    index1 = i;
+                }
+                if (o2.getInspectionItem().equals(order[i])) {
+                    index2 = i;
+                }
+                if (index1 != -1 && index2 != -1) {
+                    break; // 涓や釜浣嶇疆閮芥壘鍒颁簡锛屽彲浠ラ��鍑哄惊鐜�
+                }
+            }
+            // 姣旇緝浣嶇疆
+            int compareResult = Integer.compare(index1, index2);
+            // 濡傛灉鏄幆澧冭瘯楠岋紝涓斾袱涓璞″湪涓绘楠岄」鐩笂鎺掑簭鐩稿悓锛屽垯鐢ㄦ绾ф楠岄」鐩帓搴�
+            if (compareResult == 0 && order[index1].equals("鐜璇曢獙")) {
+                String[] subOrder = {"鍐叉按璇曢獙", "鎸姩璇曢獙"};
+                int subIndex1 = -1;
+                int subIndex2 = -1;
+                for (int i = 0; i < subOrder.length; i++) {
+                    if (o1.getInspectionItemSubclass().contains(subOrder[i])) {
+                        subIndex1 = i;
+                    }
+                    if (o2.getInspectionItemSubclass().contains(subOrder[i])) {
+                        subIndex2 = i;
+                    }
+                    if (subIndex1 != -1 && subIndex2 != -1) {
+                        break; // 涓や釜娆$骇浣嶇疆閮芥壘鍒颁簡锛屽彲浠ラ��鍑哄惊鐜�
+                    }
+                }
+                compareResult = Integer.compare(subIndex1, subIndex2);
+            }
+            // 姣旇緝浣嶇疆
+            return compareResult;
+        };
+        // 瀵瑰垪琛ㄨ繘琛屾帓搴�
+        Collections.sort(list, testTypeComparator);
         return list;
     }
 

--
Gitblit v1.9.3