|
|
@@ -31,6 +31,7 @@ import java.util.HashMap;
|
|
|
import java.util.LinkedHashMap;
|
|
|
import java.util.LinkedHashSet;
|
|
|
import java.util.List;
|
|
|
+import java.util.Locale;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
|
|
|
@@ -310,6 +311,9 @@ public class BjStarClassMpServ extends Serv {
|
|
|
if ("adjustment".equals(kind))
|
|
|
return rdAdjustmentTrace(db, selected, recordId,
|
|
|
reportMonth);
|
|
|
+ if ("dormManagement".equals(kind))
|
|
|
+ return rdDormManagementTrace(db, selected,
|
|
|
+ rdDate(request, "date"), reportMonth);
|
|
|
LocalDate day = rdDate(request, "date");
|
|
|
if (day.isAfter(LocalDate.now(CN_ZONE)))
|
|
|
throw new IllegalArgumentException("不能查询未来日期");
|
|
|
@@ -330,8 +334,85 @@ public class BjStarClassMpServ extends Serv {
|
|
|
String monthText = null;
|
|
|
String dateText = null;
|
|
|
String categoryCode = null;
|
|
|
+ String displayType = null;
|
|
|
+ List<String> columns = null;
|
|
|
|
|
|
- if ("bonus".equals(mode) || "deduction".equals(mode)) {
|
|
|
+ if ("dormDaySummary".equals(mode)) {
|
|
|
+ LocalDate day = rdDate(request, "date");
|
|
|
+ if (day.isAfter(LocalDate.now(CN_ZONE)))
|
|
|
+ throw new IllegalArgumentException("不能查询未来日期");
|
|
|
+ ensureReportMonth(reportMonth, YearMonth.from(day));
|
|
|
+ rows = rdDormDaySummary(db, selected, day);
|
|
|
+ title = "宿舍评分 · " + day.format(DATE_FMT);
|
|
|
+ dateText = day.format(DATE_FMT);
|
|
|
+ categoryCode = "dorm";
|
|
|
+ } else if ("dormAttendanceDetail".equals(mode)) {
|
|
|
+ LocalDate day = rdDate(request, "date");
|
|
|
+ if (day.isAfter(LocalDate.now(CN_ZONE)))
|
|
|
+ throw new IllegalArgumentException("不能查询未来日期");
|
|
|
+ ensureReportMonth(reportMonth, YearMonth.from(day));
|
|
|
+ CategoryDef category = requireCategory("dorm");
|
|
|
+ rows = rdAttendanceDetail(db, selected.bjid, day,
|
|
|
+ XjbDormScoreU.AttendanceScope.BOARDING_STUDENT);
|
|
|
+ for (Map<String, Object> row : rows) {
|
|
|
+ row.put("detailKind", "regular");
|
|
|
+ row.put("sourceType", "dormAttendance");
|
|
|
+ }
|
|
|
+ title = "住宿生考勤 · " + day.format(DATE_FMT);
|
|
|
+ dateText = day.format(DATE_FMT);
|
|
|
+ categoryCode = category.code;
|
|
|
+ } else if ("flagDaySummary".equals(mode)) {
|
|
|
+ LocalDate day = rdDate(request, "date");
|
|
|
+ if (day.isAfter(LocalDate.now(CN_ZONE)))
|
|
|
+ throw new IllegalArgumentException("不能查询未来日期");
|
|
|
+ ensureReportMonth(reportMonth, YearMonth.from(day));
|
|
|
+ rows = rdFlagDaySummary(db, selected.bjid, day);
|
|
|
+ title = "升旗礼 · " + day.format(DATE_FMT);
|
|
|
+ dateText = day.format(DATE_FMT);
|
|
|
+ categoryCode = "flag";
|
|
|
+ displayType = "deduction";
|
|
|
+ columns = List.of("项目", "扣分");
|
|
|
+ } else if ("flagAttendanceDetail".equals(mode)) {
|
|
|
+ LocalDate day = rdDate(request, "date");
|
|
|
+ if (day.isAfter(LocalDate.now(CN_ZONE)))
|
|
|
+ throw new IllegalArgumentException("不能查询未来日期");
|
|
|
+ ensureReportMonth(reportMonth, YearMonth.from(day));
|
|
|
+ rows = rdFlagAttendanceDetail(db, selected.bjid, day);
|
|
|
+ title = "考勤 · " + day.format(DATE_FMT);
|
|
|
+ dateText = day.format(DATE_FMT);
|
|
|
+ categoryCode = "flag";
|
|
|
+ displayType = "value";
|
|
|
+ columns = List.of("项目", "数值");
|
|
|
+ } else if ("flagDemeanorDetail".equals(mode)) {
|
|
|
+ LocalDate day = rdDate(request, "date");
|
|
|
+ if (day.isAfter(LocalDate.now(CN_ZONE)))
|
|
|
+ throw new IllegalArgumentException("不能查询未来日期");
|
|
|
+ ensureReportMonth(reportMonth, YearMonth.from(day));
|
|
|
+ rows = rdFlagDemeanorDetail(db, selected.bjid, day);
|
|
|
+ title = "风貌 · " + day.format(DATE_FMT);
|
|
|
+ dateText = day.format(DATE_FMT);
|
|
|
+ categoryCode = "flag";
|
|
|
+ displayType = "score";
|
|
|
+ columns = List.of("项目", "得分");
|
|
|
+ } else if ("dormInternalDetail".equals(mode)) {
|
|
|
+ LocalDate day = rdDate(request, "date");
|
|
|
+ if (day.isAfter(LocalDate.now(CN_ZONE)))
|
|
|
+ throw new IllegalArgumentException("不能查询未来日期");
|
|
|
+ ensureReportMonth(reportMonth, YearMonth.from(day));
|
|
|
+ rows = rdDormInternalDetail(db, selected.bjid, day);
|
|
|
+ title = "宿舍内务 · " + day.format(DATE_FMT);
|
|
|
+ dateText = day.format(DATE_FMT);
|
|
|
+ categoryCode = "dorm";
|
|
|
+ } else if ("dormViolationDetail".equals(mode)) {
|
|
|
+ LocalDate day = rdDate(request, "date");
|
|
|
+ if (day.isAfter(LocalDate.now(CN_ZONE)))
|
|
|
+ throw new IllegalArgumentException("不能查询未来日期");
|
|
|
+ ensureReportMonth(reportMonth, YearMonth.from(day));
|
|
|
+ rows = rdDormViolationDetail(db, selected.bjid, day);
|
|
|
+ title = "宿舍违纪扣分 · " + day.format(DATE_FMT);
|
|
|
+ dateText = day.format(DATE_FMT);
|
|
|
+ categoryCode = "dorm";
|
|
|
+ } else if ("bonus".equals(mode) || "deduction".equals(mode)) {
|
|
|
YearMonth month = rdMonth(request);
|
|
|
ensureReportMonth(reportMonth, month);
|
|
|
List<Adjustment> adjustments = rdAdjustments(
|
|
|
@@ -391,6 +472,8 @@ public class BjStarClassMpServ extends Serv {
|
|
|
data.put("month", monthText);
|
|
|
data.put("date", dateText);
|
|
|
data.put("category", categoryCode);
|
|
|
+ data.put("displayType", displayType);
|
|
|
+ data.put("columns", columns);
|
|
|
data.put("pageNo", pageNo);
|
|
|
data.put("pageSize", pageSize);
|
|
|
data.put("total", rows.size());
|
|
|
@@ -519,10 +602,16 @@ public class BjStarClassMpServ extends Serv {
|
|
|
book.classroom = rdAvgKtjlScoreByClass(db, period);
|
|
|
Set<LocalDate> schoolDays = rdSchoolDays(db, period);
|
|
|
Map<Long, Map<LocalDate, Double>> attendancePenalty =
|
|
|
- rdAttendancePenalty(db, period);
|
|
|
+ rdAttendancePenalty(db, period,
|
|
|
+ XjbDormScoreU.AttendanceScope.DAY_STUDENT);
|
|
|
book.attendance = computeAttendanceScores(
|
|
|
classes, schoolDays, attendancePenalty);
|
|
|
- book.dorm = rdDormScores(db, classes, period, book.attendance);
|
|
|
+ Map<Long, Map<LocalDate, Double>> dormAttendancePenalty =
|
|
|
+ rdAttendancePenalty(db, period,
|
|
|
+ XjbDormScoreU.AttendanceScope.BOARDING_STUDENT);
|
|
|
+ book.dormAttendance = computeAttendanceScores(
|
|
|
+ classes, schoolDays, dormAttendancePenalty);
|
|
|
+ book.dorm = rdDormScores(db, classes, period, book.dormAttendance);
|
|
|
book.discipline = rdDisciplineScores(db, classes, schoolDays, period);
|
|
|
book.adjustments = rdAdjustmentTotals(db, period.month);
|
|
|
|
|
|
@@ -633,7 +722,11 @@ public class BjStarClassMpServ extends Serv {
|
|
|
100.0 - violations.getOrDefault(cls.bjid, 0.0);
|
|
|
double base = internalScore * 0.35 + attendance * 0.15
|
|
|
+ violationScore * 0.35;
|
|
|
- result.put(cls.bjid, round2(base + base / 85.0 * 10.0));
|
|
|
+ XjbDormScoreU.ManagementSummary management =
|
|
|
+ XjbDormScoreU.rdManagementSummary(
|
|
|
+ db, cls.bjid, period.start, period.end);
|
|
|
+ result.put(cls.bjid, round2(base + base / 85.0 * 10.0
|
|
|
+ + management.bonus));
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
@@ -770,29 +863,13 @@ public class BjStarClassMpServ extends Serv {
|
|
|
|
|
|
|
|
|
private static Map<Long, Map<LocalDate, Double>> rdAttendancePenalty(
|
|
|
- Db db, MonthPeriod period) throws Exception {
|
|
|
- // 学校确认:同一学生同一天多次异常只累计一次,取最高扣分。
|
|
|
- SqlCmd sqlc = new SqlCmd(
|
|
|
- "select BJID,D,sum(PENALTY) PENALTY from ("
|
|
|
- + "select BJID,NVL(RYID,-KQJLID) STUDENT_KEY,"
|
|
|
- + "trunc(KSSJ) D,max(case KQLBM"
|
|
|
- + " when 1 then 3 when 21 then 1 when 51 then 1"
|
|
|
- + " when 52 then 1 when 61 then 2 else 0 end) PENALTY"
|
|
|
- + " from KQJL where KSSJ>=:start and KSSJ<:end"
|
|
|
- + " and KQJLZTM=51 and " + ObjC.JLZT_useStr
|
|
|
- + " group by BJID,NVL(RYID,-KQJLID),trunc(KSSJ)"
|
|
|
- + ") group by BJID,D");
|
|
|
- sqlc.wrTimeParm("start", period.start);
|
|
|
- sqlc.wrTimeParm("end", period.end);
|
|
|
- Map<Long, Map<LocalDate, Double>> result = new HashMap<>();
|
|
|
- for (Map<String, Object> row : db.doSelMapListByC(sqlc)) {
|
|
|
- long bjid = rdLong(row.get("bjid"));
|
|
|
- LocalDate day = rdLocalDate(row.get("d"));
|
|
|
- if (day == null || day.isAfter(period.maxDate))
|
|
|
- continue;
|
|
|
- result.computeIfAbsent(bjid, key -> new HashMap<>())
|
|
|
- .put(day, rdDouble(row.get("penalty")));
|
|
|
- }
|
|
|
+ Db db, MonthPeriod period,
|
|
|
+ XjbDormScoreU.AttendanceScope scope) throws Exception {
|
|
|
+ Map<Long, Map<LocalDate, Double>> result =
|
|
|
+ XjbDormScoreU.rdAttendancePenalty(
|
|
|
+ db, period.start, period.end, scope);
|
|
|
+ for (Map<LocalDate, Double> values : result.values())
|
|
|
+ values.keySet().removeIf(day -> day.isAfter(period.maxDate));
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@@ -912,7 +989,8 @@ public class BjStarClassMpServ extends Serv {
|
|
|
result.actual.put("classroom", rdDailyKtjlScore(
|
|
|
db, cls.bjid, start, end));
|
|
|
result.actual.put("attendance", rdDailyAttendanceScore(db,
|
|
|
- cls.bjid, start, end));
|
|
|
+ cls.bjid, start, end,
|
|
|
+ XjbDormScoreU.AttendanceScope.DAY_STUDENT));
|
|
|
result.actual.put("discipline", rdDailyDisciplineScore(
|
|
|
db, cls.bjid, start, end));
|
|
|
|
|
|
@@ -922,9 +1000,14 @@ public class BjStarClassMpServ extends Serv {
|
|
|
Set<LocalDate> monthSchoolDays = rdSchoolDays(db, fullMonth);
|
|
|
Map<Long, Double> monthAttendance = computeAttendanceScores(
|
|
|
List.of(cls), monthSchoolDays,
|
|
|
- rdAttendancePenalty(db, fullMonth));
|
|
|
+ rdAttendancePenalty(db, fullMonth,
|
|
|
+ XjbDormScoreU.AttendanceScope.DAY_STUDENT));
|
|
|
+ Map<Long, Double> monthDormAttendance = computeAttendanceScores(
|
|
|
+ List.of(cls), monthSchoolDays,
|
|
|
+ rdAttendancePenalty(db, fullMonth,
|
|
|
+ XjbDormScoreU.AttendanceScope.BOARDING_STUDENT));
|
|
|
Map<Long, Double> monthDorm = rdDormScores(db, List.of(cls),
|
|
|
- fullMonth, monthAttendance);
|
|
|
+ fullMonth, monthDormAttendance);
|
|
|
Map<Long, Double> monthClassroom =
|
|
|
rdAvgKtjlScoreByClass(db, fullMonth);
|
|
|
Map<Long, Double> monthDiscipline =
|
|
|
@@ -982,7 +1065,121 @@ public class BjStarClassMpServ extends Serv {
|
|
|
Map<LocalDate, DailyPoint> internal = rdDailyPoints(
|
|
|
db.doSelMapListByC(itemCmd));
|
|
|
|
|
|
- // 单日宿舍违纪沿用集体事件去重,个人违纪仍逐条参与。
|
|
|
+ Map<LocalDate, Double> violations =
|
|
|
+ rdDormViolationPenalties(db, cls.bjid, start, end);
|
|
|
+
|
|
|
+ Map<Long, Map<LocalDate, Double>> attendancePenalties =
|
|
|
+ XjbDormScoreU.rdAttendancePenalty(
|
|
|
+ db, start, end,
|
|
|
+ XjbDormScoreU.AttendanceScope.BOARDING_STUDENT);
|
|
|
+ Map<LocalDate, Double> classAttendancePenalty =
|
|
|
+ attendancePenalties.getOrDefault(
|
|
|
+ cls.bjid, Collections.emptyMap());
|
|
|
+ Map<LocalDate, DailyPoint> result = new HashMap<>();
|
|
|
+ for (Map.Entry<LocalDate, DailyPoint> entry : internal.entrySet()) {
|
|
|
+ DailyPoint internalPoint = entry.getValue();
|
|
|
+ double attendanceScore = Math.max(0.0, 100.0
|
|
|
+ - classAttendancePenalty.getOrDefault(
|
|
|
+ entry.getKey(), 0.0));
|
|
|
+ double violationScore =
|
|
|
+ 100.0 - violations.getOrDefault(entry.getKey(), 0.0);
|
|
|
+ double base = internalPoint.score * 0.35
|
|
|
+ + attendanceScore * 0.15
|
|
|
+ + violationScore * 0.35;
|
|
|
+ result.put(entry.getKey(), new DailyPoint(entry.getKey(),
|
|
|
+ round2(base + base / 85.0 * 10.0),
|
|
|
+ internalPoint.count));
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private static List<Map<String, Object>> rdDormDaySummary(
|
|
|
+ Db db, ClassInfo cls, LocalDate day) throws Exception {
|
|
|
+ Timestamp start = Timestamp.valueOf(day.atStartOfDay());
|
|
|
+ Timestamp end = Timestamp.valueOf(day.plusDays(1).atStartOfDay());
|
|
|
+ MonthPeriod month = MonthPeriod.of(YearMonth.from(day));
|
|
|
+
|
|
|
+ Map<LocalDate, DailyPoint> internal =
|
|
|
+ rdDailyAvgScore(db, "SSNWJC", cls.bjid, start, end);
|
|
|
+ DailyPoint internalPoint = internal.get(day);
|
|
|
+
|
|
|
+ Map<Long, Map<LocalDate, Double>> attendancePenalties =
|
|
|
+ XjbDormScoreU.rdAttendancePenalty(
|
|
|
+ db, start, end,
|
|
|
+ XjbDormScoreU.AttendanceScope.BOARDING_STUDENT);
|
|
|
+ double attendancePenalty = attendancePenalties
|
|
|
+ .getOrDefault(cls.bjid, Collections.emptyMap())
|
|
|
+ .getOrDefault(day, 0.0);
|
|
|
+ double attendanceScore = Math.max(0.0, 100.0 - attendancePenalty);
|
|
|
+
|
|
|
+ double violationPenalty = rdDormViolationPenalties(
|
|
|
+ db, cls.bjid, start, end).getOrDefault(day, 0.0);
|
|
|
+
|
|
|
+ XjbDormScoreU.ManagementSummary management =
|
|
|
+ XjbDormScoreU.rdManagementSummary(
|
|
|
+ db, cls.bjid, month.start, month.end);
|
|
|
+
|
|
|
+ List<Map<String, Object>> rows = new ArrayList<>();
|
|
|
+ rows.add(dormSummaryRow(day, "attendance", "考勤",
|
|
|
+ round2(attendanceScore), "实", "住宿生当日考勤",
|
|
|
+ true, "attendance"));
|
|
|
+ if (internalPoint == null) {
|
|
|
+ rows.add(dormSummaryRow(day, "internal", "内务",
|
|
|
+ null, "缺", "当日暂无有效内务检查", false, "internal"));
|
|
|
+ } else {
|
|
|
+ rows.add(dormSummaryRow(day, "internal", "内务",
|
|
|
+ round2(internalPoint.score), "实",
|
|
|
+ "共" + internalPoint.count + "条内务检查",
|
|
|
+ true, "internal"));
|
|
|
+ }
|
|
|
+ rows.add(dormSummaryRow(day, "violation", "违纪扣分",
|
|
|
+ violationPenalty > 0.0 ? -round2(violationPenalty) : 0.0,
|
|
|
+ "实",
|
|
|
+ violationPenalty > 0
|
|
|
+ ? "宿舍违纪已在基础分中扣减"
|
|
|
+ : "当日无宿舍违纪扣分",
|
|
|
+ violationPenalty > 0, "violation"));
|
|
|
+
|
|
|
+ double managementScore = management.available
|
|
|
+ ? management.bonus : 0.0;
|
|
|
+ rows.add(dormSummaryRow(day, "management", "增分",
|
|
|
+ managementScore, "实", "",
|
|
|
+ management.available, "management"));
|
|
|
+ rows.add(dormSummaryRow(day, "deduction", "减分",
|
|
|
+ 0.0, "停", "宿舍减分规则暂未启用",
|
|
|
+ false, "deduction"));
|
|
|
+ return rows;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private static Map<String, Object> dormSummaryRow(
|
|
|
+ LocalDate day, String key, String itemName, Double score,
|
|
|
+ String state, String meta, boolean traceable, String detailType) {
|
|
|
+ Map<String, Object> row = baseDetail(day, SOURCE_REAL);
|
|
|
+ row.put("id", key);
|
|
|
+ row.put("sourceId", key);
|
|
|
+ row.put("sourceType", "dormDaySummary");
|
|
|
+ row.put("detailKind", "dormSummary");
|
|
|
+ row.put("category", "dorm");
|
|
|
+ row.put("key", key);
|
|
|
+ row.put("itemName", itemName);
|
|
|
+ row.put("title", itemName);
|
|
|
+ row.put("score", score);
|
|
|
+ row.put("scoreText", score == null ? "-"
|
|
|
+ : String.format(Locale.ROOT, "%.2f", score));
|
|
|
+ row.put("state", state);
|
|
|
+ row.put("remark", meta);
|
|
|
+ row.put("traceable", traceable);
|
|
|
+ row.put("detailType", detailType);
|
|
|
+ row.put("sortTime", key);
|
|
|
+ return row;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private static Map<LocalDate, Double> rdDormViolationPenalties(
|
|
|
+ Db db, long bjid, Timestamp start, Timestamp end)
|
|
|
+ throws Exception {
|
|
|
SqlCmd violationCmd = new SqlCmd(
|
|
|
"select D,sum(PENALTY) PENALTY from ("
|
|
|
+ "select trunc(w.WJSJ) D,nvl(lb.BJKF,0) PENALTY,"
|
|
|
@@ -997,33 +1194,143 @@ public class BjStarClassMpServ extends Serv {
|
|
|
+ " order by w.WJJLID) RN"
|
|
|
+ " from WJJL w inner join WJLB lb on lb.WJLBM=w.WJLBM"
|
|
|
+ " inner join XJB_WJLBMAP wm on wm.WJLBM=w.WJLBM"
|
|
|
- + " and wm.YTM=" + XjbWjlbC.YTM_DORM + " and wm.JLZTM=51"
|
|
|
+ + " and wm.YTM=" + XjbWjlbC.YTM_DORM
|
|
|
+ + " and wm.JLZTM=51"
|
|
|
+ " where w.BJID=:bjid and w.WJSJ>=:start"
|
|
|
+ " and w.WJSJ<:end and w.JLZTM=51)"
|
|
|
+ " where RN=1 group by D");
|
|
|
- violationCmd.wrLongParm("bjid", cls.bjid);
|
|
|
+ violationCmd.wrLongParm("bjid", bjid);
|
|
|
violationCmd.wrTimeParm("start", start);
|
|
|
violationCmd.wrTimeParm("end", end);
|
|
|
- Map<LocalDate, Double> violations = new HashMap<>();
|
|
|
- for (Map<String, Object> row : db.doSelMapListByC(violationCmd))
|
|
|
- violations.put(rdLocalDate(row.get("d")),
|
|
|
- rdDouble(row.get("penalty")));
|
|
|
+ Map<LocalDate, Double> result = new HashMap<>();
|
|
|
+ for (Map<String, Object> row : db.doSelMapListByC(violationCmd)) {
|
|
|
+ LocalDate day = rdLocalDate(row.get("d"));
|
|
|
+ if (day != null)
|
|
|
+ result.put(day, rdDouble(row.get("penalty")));
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
|
|
|
- Map<LocalDate, DailyPoint> attendance =
|
|
|
- rdDailyAttendanceScore(db, cls.bjid, start, end);
|
|
|
- Map<LocalDate, DailyPoint> result = new HashMap<>();
|
|
|
- for (Map.Entry<LocalDate, DailyPoint> entry : internal.entrySet()) {
|
|
|
- DailyPoint attend = attendance.get(entry.getKey());
|
|
|
- DailyPoint internalPoint = entry.getValue();
|
|
|
- if (attend == null)
|
|
|
- continue;
|
|
|
- double violationScore =
|
|
|
- 100.0 - violations.getOrDefault(entry.getKey(), 0.0);
|
|
|
- double base = internalPoint.score * 0.35 + attend.score * 0.15
|
|
|
- + violationScore * 0.35;
|
|
|
- result.put(entry.getKey(), new DailyPoint(entry.getKey(),
|
|
|
- round2(base + base / 85.0 * 10.0),
|
|
|
- internalPoint.count));
|
|
|
+
|
|
|
+ private static Map<String, Object> rdDormManagementTrace(
|
|
|
+ Db db, ClassInfo cls, LocalDate day, YearMonth reportMonth)
|
|
|
+ throws Exception {
|
|
|
+ YearMonth month = reportMonth == null
|
|
|
+ ? YearMonth.from(day) : reportMonth;
|
|
|
+ MonthPeriod period = MonthPeriod.of(month);
|
|
|
+ XjbDormScoreU.ManagementSummary summary =
|
|
|
+ XjbDormScoreU.rdManagementSummary(
|
|
|
+ db, cls.bjid, period.start, period.end);
|
|
|
+
|
|
|
+ Map<String, Object> record = new LinkedHashMap<>();
|
|
|
+ record.put("time", day.format(DATE_FMT));
|
|
|
+ record.put("className", cls.bjmc);
|
|
|
+ record.put("teacherName", summary.teacherName);
|
|
|
+ record.put("visitCount", summary.visitCount);
|
|
|
+ record.put("bonus", summary.bonus);
|
|
|
+ record.put("description", summary.message);
|
|
|
+ record.put("source", summary.source);
|
|
|
+
|
|
|
+ List<Map<String, Object>> items = new ArrayList<>();
|
|
|
+ for (XjbDormScoreU.Visit visit : summary.visits) {
|
|
|
+ Map<String, Object> item = new LinkedHashMap<>();
|
|
|
+ item.put("itemName", "有效参与");
|
|
|
+ item.put("remark", XjbDormScoreU.formatMinute(visit.enterTime)
|
|
|
+ + " 至 " + XjbDormScoreU.formatMinute(visit.leaveTime)
|
|
|
+ + ",共" + visit.minutes + "分钟"
|
|
|
+ + (StringUtils.isBlank(visit.mjdName)
|
|
|
+ ? "" : "," + visit.mjdName));
|
|
|
+ item.put("deducted", 0.0);
|
|
|
+ items.add(item);
|
|
|
+ }
|
|
|
+
|
|
|
+ CategoryDef category = requireCategory("dorm");
|
|
|
+ return traceResult(cls, day, category, SOURCE_REAL,
|
|
|
+ "班主任宿舍管理参与详情", record, items,
|
|
|
+ summary.available ? "" : summary.message);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private static List<Map<String, Object>> rdDormInternalDetail(
|
|
|
+ Db db, long bjid, LocalDate day) throws Exception {
|
|
|
+ Timestamp start = Timestamp.valueOf(day.atStartOfDay());
|
|
|
+ Timestamp end = Timestamp.valueOf(day.plusDays(1).atStartOfDay());
|
|
|
+ SqlCmd sqlc = new SqlCmd(
|
|
|
+ "select s.SSNWJCID,s.FS,s.MS,s.JCSJ,cd.MC KFMC,"
|
|
|
+ + "jc.XM JCRYXM from SSNWJC s"
|
|
|
+ + " left join CD cd on cd.CDID=s.KFID"
|
|
|
+ + " left join RY jc on jc.RYID=s.JCRYID"
|
|
|
+ + " where s.BJID=:bjid and s.JCSJ>=:start"
|
|
|
+ + " and s.JCSJ<:end and s." + ObjC.JLZT_useStr
|
|
|
+ + " order by s.JCSJ desc,s.SSNWJCID desc");
|
|
|
+ sqlc.wrLongParm("bjid", bjid);
|
|
|
+ sqlc.wrTimeParm("start", start);
|
|
|
+ sqlc.wrTimeParm("end", end);
|
|
|
+ List<Map<String, Object>> result = new ArrayList<>();
|
|
|
+ for (Map<String, Object> row : db.doSelMapListByC(sqlc)) {
|
|
|
+ Map<String, Object> item = baseDetail(day, SOURCE_REAL);
|
|
|
+ long id = rdLong(row.get("ssnwjcid"));
|
|
|
+ double score = rdDouble(row.get("fs"));
|
|
|
+ item.put("id", id);
|
|
|
+ item.put("sourceId", id);
|
|
|
+ item.put("category", "dorm");
|
|
|
+ item.put("traceable", true);
|
|
|
+ item.put("itemName", "内务检查");
|
|
|
+ item.put("roomName", rdStr(row.get("kfmc")));
|
|
|
+ item.put("title", rdStr(row.get("kfmc")));
|
|
|
+ item.put("remark", rdStr(row.get("ms")));
|
|
|
+ item.put("scoreText", score + "/100");
|
|
|
+ item.put("delta", round2(score - 100.0));
|
|
|
+ item.put("sortTime", formatTimestamp(row.get("jcsj")));
|
|
|
+ result.add(item);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private static List<Map<String, Object>> rdDormViolationDetail(
|
|
|
+ Db db, long bjid, LocalDate day) throws Exception {
|
|
|
+ Timestamp start = Timestamp.valueOf(day.atStartOfDay());
|
|
|
+ Timestamp end = Timestamp.valueOf(day.plusDays(1).atStartOfDay());
|
|
|
+ SqlCmd sqlc = new SqlCmd(
|
|
|
+ "select WJJLID,D,RYXM,WJLBMC,BJKF,WJSJ,MS from ("
|
|
|
+ + "select w.WJJLID,trunc(w.WJSJ) D,ry.XM RYXM,"
|
|
|
+ + "lb.MC WJLBMC,nvl(lb.BJKF,0) BJKF,w.WJSJ,w.MS,"
|
|
|
+ + "row_number() over(partition by w.BJID,w.WJLXM,"
|
|
|
+ + "case when w.WJLXM=5 then w.WJLBM end,"
|
|
|
+ + "case when w.WJLXM=5 then w.WJSJ end,"
|
|
|
+ + "case when w.WJLXM=5 then w.JZWID end,"
|
|
|
+ + "case when w.WJLXM=5 then w.KFID end,"
|
|
|
+ + "case when w.WJLXM=5 then nvl(w.MS,' ') end,"
|
|
|
+ + "case when w.WJLXM=5 then nvl(w.FJID,0) end,"
|
|
|
+ + "case when w.WJLXM=5 then 0 else w.WJJLID end"
|
|
|
+ + " order by w.WJJLID) RN"
|
|
|
+ + " from WJJL w inner join WJLB lb on lb.WJLBM=w.WJLBM"
|
|
|
+ + " inner join XJB_WJLBMAP wm on wm.WJLBM=w.WJLBM"
|
|
|
+ + " and wm.YTM=" + XjbWjlbC.YTM_DORM
|
|
|
+ + " and wm.JLZTM=51"
|
|
|
+ + " left join RY ry on ry.RYID=w.RYID"
|
|
|
+ + " where w.BJID=:bjid and w.WJSJ>=:start"
|
|
|
+ + " and w.WJSJ<:end and w.JLZTM=51)"
|
|
|
+ + " where RN=1 order by WJSJ desc,WJJLID desc");
|
|
|
+ sqlc.wrLongParm("bjid", bjid);
|
|
|
+ sqlc.wrTimeParm("start", start);
|
|
|
+ sqlc.wrTimeParm("end", end);
|
|
|
+ List<Map<String, Object>> result = new ArrayList<>();
|
|
|
+ for (Map<String, Object> row : db.doSelMapListByC(sqlc)) {
|
|
|
+ Map<String, Object> item = baseDetail(day, SOURCE_REAL);
|
|
|
+ item.put("id", rdLong(row.get("wjjlid")));
|
|
|
+ item.put("sourceId", rdLong(row.get("wjjlid")));
|
|
|
+ item.put("category", "dorm");
|
|
|
+ item.put("traceable", false);
|
|
|
+ item.put("itemName", rdStr(row.get("wjlbmc")));
|
|
|
+ item.put("studentName", rdStr(row.get("ryxm")));
|
|
|
+ item.put("title", rdStr(row.get("wjlbmc")));
|
|
|
+ item.put("remark", rdStr(row.get("ms")));
|
|
|
+ item.put("delta", -rdDouble(row.get("bjkf")));
|
|
|
+ item.put("scoreText", "");
|
|
|
+ item.put("sortTime", formatTimestamp(row.get("wjsj")));
|
|
|
+ result.add(item);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
@@ -1087,29 +1394,16 @@ public class BjStarClassMpServ extends Serv {
|
|
|
|
|
|
|
|
|
private static Map<LocalDate, DailyPoint> rdDailyAttendanceScore(
|
|
|
- Db db, long bjid, Timestamp start, Timestamp end) throws Exception {
|
|
|
- SqlCmd sqlc = new SqlCmd(
|
|
|
- "select D,sum(PENALTY) PENALTY,count(*) CNT from ("
|
|
|
- + "select NVL(RYID,-KQJLID) STUDENT_KEY,trunc(KSSJ) D,"
|
|
|
- + "max(case KQLBM when 1 then 3 when 21 then 1"
|
|
|
- + " when 51 then 1 when 52 then 1 when 61 then 2"
|
|
|
- + " else 0 end) PENALTY from KQJL where BJID=:bjid"
|
|
|
- + " and KSSJ>=:start and KSSJ<:end"
|
|
|
- + " and KQJLZTM=51 and " + ObjC.JLZT_useStr
|
|
|
- + " group by NVL(RYID,-KQJLID),trunc(KSSJ)"
|
|
|
- + ") group by D");
|
|
|
- sqlc.wrLongParm("bjid", bjid);
|
|
|
- sqlc.wrTimeParm("start", start);
|
|
|
- sqlc.wrTimeParm("end", end);
|
|
|
+ Db db, long bjid, Timestamp start, Timestamp end,
|
|
|
+ XjbDormScoreU.AttendanceScope scope) throws Exception {
|
|
|
+ Map<Long, Map<LocalDate, Double>> penalties =
|
|
|
+ XjbDormScoreU.rdAttendancePenalty(db, start, end, scope);
|
|
|
+ Map<LocalDate, Double> classPenalties =
|
|
|
+ penalties.getOrDefault(bjid, Collections.emptyMap());
|
|
|
Map<LocalDate, DailyPoint> points = new HashMap<>();
|
|
|
- for (Map<String, Object> row : db.doSelMapListByC(sqlc)) {
|
|
|
- LocalDate day = rdLocalDate(row.get("d"));
|
|
|
- if (day == null)
|
|
|
- continue;
|
|
|
- double penalty = rdDouble(row.get("penalty"));
|
|
|
- points.put(day, new DailyPoint(day,
|
|
|
- Math.max(0.0, 100.0 - penalty),
|
|
|
- rdInt(row.get("cnt"))));
|
|
|
+ for (Map.Entry<LocalDate, Double> entry : classPenalties.entrySet()) {
|
|
|
+ points.put(entry.getKey(), new DailyPoint(entry.getKey(),
|
|
|
+ Math.max(0.0, 100.0 - entry.getValue()), 1));
|
|
|
}
|
|
|
return points;
|
|
|
}
|
|
|
@@ -1173,7 +1467,8 @@ public class BjStarClassMpServ extends Serv {
|
|
|
List<Map<String, Object>> rows;
|
|
|
if (SOURCE_REAL.equals(source)) {
|
|
|
if ("attendance".equals(category.code))
|
|
|
- rows = rdAttendanceDetail(db, cls.bjid, day);
|
|
|
+ rows = rdAttendanceDetail(db, cls.bjid, day,
|
|
|
+ XjbDormScoreU.AttendanceScope.DAY_STUDENT);
|
|
|
else if ("dorm".equals(category.code))
|
|
|
rows = rdItemDetail(db, cls.bjid, day, "dorm");
|
|
|
else if ("flag".equals(category.code))
|
|
|
@@ -1197,12 +1492,13 @@ public class BjStarClassMpServ extends Serv {
|
|
|
|
|
|
|
|
|
private static List<Map<String, Object>> rdAttendanceDetail(
|
|
|
- Db db, long bjid, LocalDate day) throws Exception {
|
|
|
+ Db db, long bjid, LocalDate day,
|
|
|
+ XjbDormScoreU.AttendanceScope scope) throws Exception {
|
|
|
Timestamp start = Timestamp.valueOf(day.atStartOfDay());
|
|
|
Timestamp end = Timestamp.valueOf(day.plusDays(1).atStartOfDay());
|
|
|
SqlCmd sqlc = new SqlCmd(
|
|
|
"select * from (select k.KQJLID,k.KQLBM,lb.MC KQLBMC,"
|
|
|
- + "k.RYID,ry.XM,k.MC,k.MS,k.KSSJ,"
|
|
|
+ + "k.RYID,ry.XM,k.MC,k.MS,k.KSSJ,bjcy.SFZS,"
|
|
|
+ "case k.KQLBM when 1 then 3 when 21 then 1"
|
|
|
+ " when 51 then 1 when 52 then 1 when 61 then 2"
|
|
|
+ " else 0 end PENALTY,"
|
|
|
@@ -1211,15 +1507,21 @@ public class BjStarClassMpServ extends Serv {
|
|
|
+ " when 51 then 1 when 52 then 1 when 61 then 2"
|
|
|
+ " else 0 end desc,k.KSSJ desc,k.KQJLID desc) RN"
|
|
|
+ " from KQJL k"
|
|
|
+ + " inner join BJCY bjcy on bjcy.RYID=k.RYID"
|
|
|
+ + " and bjcy.BJID=k.BJID and bjcy.SFBY=0"
|
|
|
+ + " and bjcy." + ObjC.JLZT_useStr
|
|
|
+ " left join KQLB lb on lb.KQLBM=k.KQLBM"
|
|
|
+ " left join RY ry on ry.RYID=k.RYID"
|
|
|
+ " where k.BJID=:bjid and k.KSSJ>=:start"
|
|
|
+ " and k.KSSJ<:end and k.KQJLZTM=51 and k."
|
|
|
- + ObjC.JLZT_useStr + ") where RN=1"
|
|
|
+ + ObjC.JLZT_useStr
|
|
|
+ + " and bjcy.SFZS=:sfzs"
|
|
|
+ + " and k.KQLBM in(" + scope.codes + ")) where RN=1"
|
|
|
+ " order by KSSJ desc,KQJLID desc");
|
|
|
sqlc.wrLongParm("bjid", bjid);
|
|
|
sqlc.wrTimeParm("start", start);
|
|
|
sqlc.wrTimeParm("end", end);
|
|
|
+ sqlc.wrIntParm("sfzs", scope.sfzs);
|
|
|
List<Map<String, Object>> result = new ArrayList<>();
|
|
|
for (Map<String, Object> row : db.doSelMapListByC(sqlc)) {
|
|
|
Map<String, Object> item = baseDetail(day, SOURCE_REAL);
|
|
|
@@ -1228,6 +1530,9 @@ public class BjStarClassMpServ extends Serv {
|
|
|
item.put("category", "attendance");
|
|
|
item.put("traceable", true);
|
|
|
item.put("itemName", rdStr(row.get("kqlbmc")));
|
|
|
+ item.put("studentType",
|
|
|
+ scope == XjbDormScoreU.AttendanceScope.DAY_STUDENT
|
|
|
+ ? "走读生" : "住校生");
|
|
|
item.put("studentName", rdStr(row.get("xm")));
|
|
|
item.put("title", rdStr(row.get("mc")));
|
|
|
item.put("remark", rdStr(row.get("ms")));
|
|
|
@@ -1384,6 +1689,156 @@ public class BjStarClassMpServ extends Serv {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ private static List<Map<String, Object>> rdFlagDaySummary(
|
|
|
+ Db db, long bjid, LocalDate day) throws Exception {
|
|
|
+ Map<String, Object> record = rdFlagRecord(db, bjid, day);
|
|
|
+ if (record == null)
|
|
|
+ return new ArrayList<>();
|
|
|
+
|
|
|
+ double attendanceRate = flagRate(record.get("cql"));
|
|
|
+ double queueScore = flagRate(record.get("dlfs"));
|
|
|
+ double demeanorScore = flagRate(record.get("fmfs"));
|
|
|
+ double disciplineScore = flagRate(record.get("jlfs"));
|
|
|
+
|
|
|
+ List<Map<String, Object>> rows = new ArrayList<>();
|
|
|
+ rows.add(flagSummaryRow(day, record, "attendance", "考勤",
|
|
|
+ round2((100.0 - attendanceRate) * 0.25),
|
|
|
+ attendanceRate, true, "flagAttendanceDetail"));
|
|
|
+ rows.add(flagSummaryRow(day, record, "queue", "队列",
|
|
|
+ round2((100.0 - queueScore) * 0.20),
|
|
|
+ queueScore, false, ""));
|
|
|
+ rows.add(flagSummaryRow(day, record, "demeanor", "风貌",
|
|
|
+ round2((100.0 - demeanorScore) * 0.40),
|
|
|
+ demeanorScore, true, "flagDemeanorDetail"));
|
|
|
+ rows.add(flagSummaryRow(day, record, "discipline", "纪律",
|
|
|
+ round2((100.0 - disciplineScore) * 0.15),
|
|
|
+ disciplineScore, false, ""));
|
|
|
+ return rows;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static List<Map<String, Object>> rdFlagAttendanceDetail(
|
|
|
+ Db db, long bjid, LocalDate day) throws Exception {
|
|
|
+ Map<String, Object> record = rdFlagRecord(db, bjid, day);
|
|
|
+ if (record == null)
|
|
|
+ return new ArrayList<>();
|
|
|
+ Map<Integer, Integer> values = rdFlagItemValues(
|
|
|
+ db, rdLong(record.get("sqljcid")));
|
|
|
+ String[] labels = {
|
|
|
+ "总人数",
|
|
|
+ "队列人数",
|
|
|
+ "本部学生会值日人数",
|
|
|
+ "学校学生会值日人数",
|
|
|
+ "国旗队人数",
|
|
|
+ "公假人数",
|
|
|
+ "参与宿管人数",
|
|
|
+ "升旗礼前请假人数"
|
|
|
+ };
|
|
|
+ List<Map<String, Object>> rows = new ArrayList<>();
|
|
|
+ for (int i = 0; i < labels.length; i++) {
|
|
|
+ int code = i + 1;
|
|
|
+ int value = values.getOrDefault(code, 0);
|
|
|
+ rows.add(flagValueRow(day, labels[i], value, String.valueOf(value)));
|
|
|
+ }
|
|
|
+ double attendanceRate = flagRate(record.get("cql"));
|
|
|
+ double attendanceScore = flagRate(record.get("kqfs"));
|
|
|
+ rows.add(flagValueRow(day, "出勤率", attendanceRate,
|
|
|
+ plainNumber(attendanceRate) + "%"));
|
|
|
+ rows.add(flagValueRow(day, "考勤分", attendanceScore,
|
|
|
+ plainNumber(attendanceScore)));
|
|
|
+ return rows;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static List<Map<String, Object>> rdFlagDemeanorDetail(
|
|
|
+ Db db, long bjid, LocalDate day) throws Exception {
|
|
|
+ Map<String, Object> record = rdFlagRecord(db, bjid, day);
|
|
|
+ if (record == null)
|
|
|
+ return new ArrayList<>();
|
|
|
+ Map<Integer, Integer> values = rdFlagItemValues(
|
|
|
+ db, rdLong(record.get("sqljcid")));
|
|
|
+ List<Map<String, Object>> rows = new ArrayList<>();
|
|
|
+ rows.add(flagValueRow(day, "国歌",
|
|
|
+ values.getOrDefault(21, 0),
|
|
|
+ String.valueOf(values.getOrDefault(21, 0))));
|
|
|
+ rows.add(flagValueRow(day, "校歌",
|
|
|
+ values.getOrDefault(22, 0),
|
|
|
+ String.valueOf(values.getOrDefault(22, 0))));
|
|
|
+ rows.add(flagValueRow(day, "服装",
|
|
|
+ values.getOrDefault(23, 0),
|
|
|
+ String.valueOf(values.getOrDefault(23, 0))));
|
|
|
+ return rows;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static Map<String, Object> rdFlagRecord(
|
|
|
+ Db db, long bjid, LocalDate day) throws Exception {
|
|
|
+ SqlCmd sqlc = new SqlCmd(
|
|
|
+ "select SQLJCID,CQL,KQFS,DLFS,FMFS,JLFS,ZFS,JCSJ"
|
|
|
+ + " from SQLJC where BJID=:bjid"
|
|
|
+ + " and trunc(JCSJ)=to_date(:day,'YYYY-MM-DD')"
|
|
|
+ + " and JLZTM in(22,25,51)"
|
|
|
+ + " order by SQLJCID desc");
|
|
|
+ sqlc.wrLongParm("bjid", bjid);
|
|
|
+ sqlc.wrStrParm("day", day.format(DATE_FMT));
|
|
|
+ List<Map<String, Object>> rows = db.doSelMapListByC(sqlc);
|
|
|
+ return rows == null || rows.isEmpty() ? null : rows.get(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static Map<Integer, Integer> rdFlagItemValues(
|
|
|
+ Db db, long sqljcid) throws Exception {
|
|
|
+ SqlCmd sqlc = new SqlCmd(
|
|
|
+ "select SQLJCXMM,FS from SQLJCMX where SQLJCID=:sqljcid"
|
|
|
+ + " and JLZTM=51 and SQLJCXMM in(1,2,3,4,5,6,7,8,"
|
|
|
+ + "21,22,23)");
|
|
|
+ sqlc.wrLongParm("sqljcid", sqljcid);
|
|
|
+ Map<Integer, Integer> result = new HashMap<>();
|
|
|
+ List<Map<String, Object>> rows = db.doSelMapListByC(sqlc);
|
|
|
+ if (rows == null)
|
|
|
+ return result;
|
|
|
+ for (Map<String, Object> row : rows)
|
|
|
+ result.put(rdInt(row.get("sqljcxmm")), rdInt(row.get("fs")));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static Map<String, Object> flagSummaryRow(
|
|
|
+ LocalDate day, Map<String, Object> record, String code,
|
|
|
+ String name, double deduction, double rawScore,
|
|
|
+ boolean traceable, String detailMode) {
|
|
|
+ Map<String, Object> item = baseDetail(day, SOURCE_REAL);
|
|
|
+ item.put("id", rdLong(record.get("sqljcid")));
|
|
|
+ item.put("sourceId", rdLong(record.get("sqljcid")));
|
|
|
+ item.put("category", "flag");
|
|
|
+ item.put("code", code);
|
|
|
+ item.put("itemName", name);
|
|
|
+ item.put("title", name);
|
|
|
+ item.put("deduction", deduction);
|
|
|
+ item.put("delta", -deduction);
|
|
|
+ item.put("rawScore", round2(rawScore));
|
|
|
+ item.put("traceable", traceable);
|
|
|
+ item.put("detailMode", detailMode);
|
|
|
+ item.put("sortTime", formatTimestamp(record.get("jcsj")));
|
|
|
+ return item;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static Map<String, Object> flagValueRow(
|
|
|
+ LocalDate day, String name, double value, String displayValue) {
|
|
|
+ Map<String, Object> item = baseDetail(day, SOURCE_REAL);
|
|
|
+ item.put("itemName", name);
|
|
|
+ item.put("title", name);
|
|
|
+ item.put("value", round2(value));
|
|
|
+ item.put("displayValue", displayValue);
|
|
|
+ item.put("traceable", false);
|
|
|
+ item.put("sortTime", day.format(DATE_FMT));
|
|
|
+ return item;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static double flagRate(Object value) {
|
|
|
+ return Math.max(0.0, Math.min(100.0, rdDouble(value)));
|
|
|
+ }
|
|
|
+
|
|
|
+ private static String plainNumber(double value) {
|
|
|
+ String text = String.format(Locale.CHINA, "%.2f", round2(value));
|
|
|
+ return text.replaceAll("0+$", "").replaceAll("\\.$", "");
|
|
|
+ }
|
|
|
+
|
|
|
private static List<Map<String, Object>> rdKtjlDetail(
|
|
|
Db db, long bjid, LocalDate day) throws Exception {
|
|
|
Timestamp start = Timestamp.valueOf(day.atStartOfDay());
|
|
|
@@ -2507,6 +2962,7 @@ public class BjStarClassMpServ extends Serv {
|
|
|
|
|
|
private static final class ScoreBook {
|
|
|
Map<Long, Double> dorm = new HashMap<>();
|
|
|
+ Map<Long, Double> dormAttendance = new HashMap<>();
|
|
|
Map<Long, Double> classroom = new HashMap<>();
|
|
|
Map<Long, Double> flag = new HashMap<>();
|
|
|
Map<Long, Double> cleaning = new HashMap<>();
|