|
|
@@ -47,7 +47,6 @@ public class BjStarClassMpServ extends Serv {
|
|
|
private static final DateTimeFormatter DATETIME_FMT =
|
|
|
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
|
|
private static final String SOURCE_REAL = "real";
|
|
|
- private static final String SOURCE_MOCK = "mock";
|
|
|
private static final String SOURCE_MISSING = "missing";
|
|
|
private static final int DEFAULT_PAGE_SIZE = 20;
|
|
|
private static final int DETAIL_PAGE_SIZE = 30;
|
|
|
@@ -1166,8 +1165,6 @@ public class BjStarClassMpServ extends Serv {
|
|
|
long sourceId,
|
|
|
String source)
|
|
|
throws Exception {
|
|
|
- if (SOURCE_MOCK.equals(source))
|
|
|
- return rdMockTraceDetail(cls, day, category);
|
|
|
if (!SOURCE_REAL.equals(source))
|
|
|
throw new IllegalArgumentException("扣分来源参数错误");
|
|
|
|
|
|
@@ -1183,7 +1180,7 @@ public class BjStarClassMpServ extends Serv {
|
|
|
return rdKtjlTrace(db, cls, day, category, sourceId);
|
|
|
if ("discipline".equals(category.code))
|
|
|
return rdDisciplineTrace(db, cls, day, category, sourceId);
|
|
|
- return rdMockTraceDetail(cls, day, category);
|
|
|
+ throw new IllegalArgumentException("评分项目暂无可追踪明细");
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1430,57 +1427,6 @@ public class BjStarClassMpServ extends Serv {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private static Map<String, Object> rdMockTraceDetail(ClassInfo cls,
|
|
|
- LocalDate day,
|
|
|
- CategoryDef category) {
|
|
|
- double deduction = round2(Math.max(0.0, 100.0 - mockDailyScore(
|
|
|
- cls.bjid, monthKey(YearMonth.from(day)), category.code,
|
|
|
- day.getDayOfMonth())));
|
|
|
- String[] names = mockBreakdownNames(category.code);
|
|
|
- double first = round2(deduction * 0.6);
|
|
|
- double second = round2(deduction - first);
|
|
|
- List<Map<String, Object>> items = new ArrayList<>();
|
|
|
- addMockTraceItem(items, names[0], first);
|
|
|
- addMockTraceItem(items, names[1], second);
|
|
|
-
|
|
|
- Map<String, Object> record = new LinkedHashMap<>();
|
|
|
- record.put("time", day.format(DATE_FMT));
|
|
|
- record.put("className", cls.bjmc);
|
|
|
- record.put("inspectorName", "模拟检查");
|
|
|
- record.put("description", mockItemName(category.code));
|
|
|
- return traceResult(cls, day, category, SOURCE_MOCK,
|
|
|
- category.label + "模拟扣分详情", record, items,
|
|
|
- "当前模块正式扣分数据尚未完善,以下为模拟扣分明细。");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private static void addMockTraceItem(List<Map<String, Object>> items,
|
|
|
- String name, double deducted) {
|
|
|
- if (deducted <= 0)
|
|
|
- return;
|
|
|
- Map<String, Object> item = new LinkedHashMap<>();
|
|
|
- item.put("itemName", name);
|
|
|
- item.put("deducted", round2(deducted));
|
|
|
- item.put("remark", "模拟扣分");
|
|
|
- items.add(item);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private static String[] mockBreakdownNames(String category) {
|
|
|
- if ("dorm".equals(category))
|
|
|
- return new String[]{"床铺与物品摆放", "地面及区域卫生"};
|
|
|
- if ("flag".equals(category))
|
|
|
- return new String[]{"队列纪律", "仪容仪表"};
|
|
|
- if ("cleaning".equals(category))
|
|
|
- return new String[]{"教室地面卫生", "桌面与角落卫生"};
|
|
|
- if ("classroom".equals(category))
|
|
|
- return new String[]{"课堂纪律", "课堂参与"};
|
|
|
- if ("discipline".equals(category))
|
|
|
- return new String[]{"校服着装", "发型与仪容"};
|
|
|
- return new String[]{"考勤异常", "其他扣分"};
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
private static Map<String, Object> traceResult(
|
|
|
ClassInfo cls, LocalDate day, CategoryDef category, String source,
|
|
|
String title, Map<String, Object> record,
|
|
|
@@ -1537,32 +1483,6 @@ public class BjStarClassMpServ extends Serv {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private static List<Map<String, Object>> mockDayDetail(
|
|
|
- ClassInfo cls, LocalDate day, String category) {
|
|
|
- List<Map<String, Object>> rows = new ArrayList<>();
|
|
|
- String itemName = mockItemName(category);
|
|
|
- double deduction = Math.max(0.0, 100.0 - mockDailyScore(
|
|
|
- cls.bjid, monthKey(YearMonth.from(day)), category,
|
|
|
- day.getDayOfMonth()));
|
|
|
- if (deduction <= 0.0)
|
|
|
- return rows;
|
|
|
- Map<String, Object> row = baseDetail(day, SOURCE_MOCK);
|
|
|
- row.put("id", stableHash(cls.bjid + "|" + day + "|" + category));
|
|
|
- row.put("sourceId", stableHash(cls.bjid + "|" + day + "|" + category));
|
|
|
- row.put("category", category);
|
|
|
- row.put("traceable", true);
|
|
|
- row.put("itemName", itemName);
|
|
|
- row.put("studentName", "");
|
|
|
- row.put("title", itemName);
|
|
|
- row.put("remark", "当前模块正式数据未完善,使用模拟扣分明细");
|
|
|
- row.put("delta", -round2(deduction));
|
|
|
- row.put("scoreText", round2(100.0 - deduction) + "/100");
|
|
|
- row.put("sortTime", day.format(DATE_FMT));
|
|
|
- rows.add(row);
|
|
|
- return rows;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
private static Map<String, Object> baseDetail(LocalDate day, String source) {
|
|
|
Map<String, Object> item = new LinkedHashMap<>();
|
|
|
item.put("date", day.format(DATE_FMT));
|
|
|
@@ -1571,23 +1491,6 @@ public class BjStarClassMpServ extends Serv {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private static String mockItemName(String category) {
|
|
|
- if ("classroom".equals(category))
|
|
|
- return "课堂纪律";
|
|
|
- if ("discipline".equals(category))
|
|
|
- return "校服仪容";
|
|
|
- if ("dorm".equals(category))
|
|
|
- return "宿舍内务模拟扣分";
|
|
|
- if ("flag".equals(category))
|
|
|
- return "升旗礼队列模拟扣分";
|
|
|
- if ("cleaning".equals(category))
|
|
|
- return "清洁卫生模拟扣分";
|
|
|
- if ("attendance".equals(category))
|
|
|
- return "考勤模拟扣分";
|
|
|
- return "模拟扣分";
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
private static CategoryDef requireCategory(String code) {
|
|
|
for (CategoryDef def : CATEGORY_DEFS) {
|
|
|
if (def.code.equals(code))
|
|
|
@@ -1597,48 +1500,6 @@ public class BjStarClassMpServ extends Serv {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private static double scoreOrMock(Map<Long, Double> source, long bjid,
|
|
|
- YearMonth month, String category, int maxDay) {
|
|
|
- Double value = source.get(bjid);
|
|
|
- return value == null ? mockMonthlyScore(bjid, month, category, maxDay)
|
|
|
- : round2(value);
|
|
|
- }
|
|
|
-
|
|
|
- private static double scoreOrMissing(Map<Long, Double> source, long bjid) {
|
|
|
- Double value = source.get(bjid);
|
|
|
- return value == null ? 0.0 : round2(value);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private static double mockMonthlyScore(long bjid, YearMonth month,
|
|
|
- String category, int maxDay) {
|
|
|
- double total = 0.0;
|
|
|
- int count = 0;
|
|
|
- for (int day = 1; day <= maxDay; day++) {
|
|
|
- if (!mockHasEvent(bjid, monthKey(month), category, day))
|
|
|
- continue;
|
|
|
- total += mockDailyScore(bjid, monthKey(month), category, day);
|
|
|
- count++;
|
|
|
- }
|
|
|
- return count == 0 ? 95.0 : round2(total / count);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private static boolean mockHasEvent(long bjid, String month,
|
|
|
- String category, int day) {
|
|
|
- int hash = stableHash(bjid + "|" + month + "|" + category + "|" + day);
|
|
|
- return Math.floorMod(hash, 100) < 28;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private static double mockDailyScore(long bjid, String month,
|
|
|
- String category, int day) {
|
|
|
- int hash = stableHash(bjid + "|" + month + "|" + category
|
|
|
- + "|score|" + day);
|
|
|
- return round2(84.0 + Math.floorMod(hash, 1600) / 100.0);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
private static Map<Long, AdjustmentTotals> rdAdjustmentTotals(
|
|
|
Db db, YearMonth month) throws Exception {
|
|
|
SqlCmd sqlc = new SqlCmd(
|
|
|
@@ -1890,19 +1751,6 @@ public class BjStarClassMpServ extends Serv {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private static String monthKey(YearMonth month) {
|
|
|
- return month.format(MONTH_FMT);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private static int stableHash(String value) {
|
|
|
- int hash = 17;
|
|
|
- for (int i = 0; i < value.length(); i++)
|
|
|
- hash = 31 * hash + value.charAt(i);
|
|
|
- return hash;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
private static long rdLong(Object value) {
|
|
|
return value == null ? 0L : Long.parseLong(String.valueOf(value));
|
|
|
}
|
|
|
@@ -2000,7 +1848,6 @@ public class BjStarClassMpServ extends Serv {
|
|
|
final LocalDate date;
|
|
|
double regularDeduction;
|
|
|
boolean hasRegular;
|
|
|
- boolean hasMock;
|
|
|
|
|
|
DailyAccumulator(LocalDate date) {
|
|
|
this.date = date;
|
|
|
@@ -2013,7 +1860,6 @@ public class BjStarClassMpServ extends Serv {
|
|
|
row.put("regularDeduction", round2(regularDeduction));
|
|
|
row.put("totalDeduction", round2(regularDeduction));
|
|
|
row.put("hasRegular", hasRegular);
|
|
|
- row.put("hasMock", hasMock);
|
|
|
return row;
|
|
|
}
|
|
|
}
|