Explorar el Código

美术阅卷10月新增需求-打回算法增加日志

wangliang hace 5 años
padre
commit
527b6c100e

+ 49 - 2
stmms-ms-commons/src/main/java/cn/com/qmth/stmms/ms/commons/constant/ArbitrateCallback.java

@@ -49,6 +49,42 @@ public class ArbitrateCallback {
         return resultList;
     }
 
+    /**
+     * 计算每个档位和试卷档位的落差
+     *
+     * @param levelList
+     * @param paperLevel
+     * @return
+     */
+    public static List<Distance> judge(List<String> levelList, String paperLevel) {
+        List<Distance> result = null;
+        Collections.sort(levelList);
+        LEVELS = new char[levelList.size()];
+        for (int i = 0; i < levelList.size(); i++) {
+            LEVELS[i] = levelList.get(i).charAt(0);
+        }
+        result = judge(LEVELS, paperLevel);
+        LOGGER.info("LEVELS:{},paperLevel为:{},档位落差为:{}", LEVELS, paperLevel, JSONObject.toJSONString(result));
+        return result;
+    }
+
+    /**
+     * 计算档位偏差值
+     *
+     * @param levels
+     * @return
+     */
+    public static List<Distance> judge(char[] levels, String paperLevel) {
+        List<Distance> result = new ArrayList<>();
+        char p = paperLevel.charAt(0);
+        for (char c : levels) {
+            Distance d = new Distance(c);
+            d.distance = Math.abs(c - p);
+            result.add(d);
+        }
+        return result;
+    }
+
     /**
      * 计算档位最大落差档位和档位和
      *
@@ -64,25 +100,28 @@ public class ArbitrateCallback {
                 d.max = Math.max(d.max, distance);
                 d.sum += distance;
             }
-            if (d.max >= MAX_DISTANCE && d.sum > SUM_DISTANCE) {
+            if (d.max >= MAX_DISTANCE && d.sum >= SUM_DISTANCE) {
                 result.add(d);
             }
+            LOGGER.info("档位:{}", JSONObject.toJSONString(d));
         }
         return result;
     }
 
     /**
-     * 档位计算类[档位,最大档位落差,最大档位落差和]
+     * 档位计算类[档位,最大档位落差,最大档位落差和,档位偏差值]
      */
     static class Distance {
         char c;
         int max;
         int sum;
+        int distance;
 
         public Distance(char c) {
             this.c = c;
             this.max = 0;
             this.sum = 0;
+            this.distance = 0;
         }
 
         public char getC() {
@@ -108,5 +147,13 @@ public class ArbitrateCallback {
         public void setSum(int sum) {
             this.sum = sum;
         }
+
+        public int getDistance() {
+            return distance;
+        }
+
+        public void setDistance(int distance) {
+            this.distance = distance;
+        }
     }
 }