|
|
@@ -483,27 +483,34 @@ public class BjStarClassMpServ extends Serv {
|
|
|
private static Map<Long, Double> rdDormScores(
|
|
|
Db db, List<ClassInfo> classes, MonthPeriod period,
|
|
|
Map<Long, Double> attendanceScores) throws Exception {
|
|
|
+ // 学校确认:宿舍内务不再要求上午、下午各有一条,所有有效检查取平均。
|
|
|
SqlCmd internalCmd = new SqlCmd(
|
|
|
- "select BJID,"
|
|
|
- + "avg(case when extract(hour from JCSJ)<12 then FS end) AM,"
|
|
|
- + "avg(case when extract(hour from JCSJ)>=12 then FS end) PM"
|
|
|
- + " from SSNWJC where JCSJ>=:start and JCSJ<:end"
|
|
|
+ "select BJID,avg(FS) SCORE from SSNWJC"
|
|
|
+ + " where JCSJ>=:start and JCSJ<:end"
|
|
|
+ " and " + ObjC.JLZT_useStr + " group by BJID");
|
|
|
internalCmd.wrTimeParm("start", period.start);
|
|
|
internalCmd.wrTimeParm("end", period.end);
|
|
|
- Map<Long, double[]> internal = new HashMap<>();
|
|
|
- for (Map<String, Object> row : db.doSelMapListByC(internalCmd)) {
|
|
|
- internal.put(rdLong(row.get("bjid")), new double[]{
|
|
|
- row.get("am") == null ? -1 : rdDouble(row.get("am")),
|
|
|
- row.get("pm") == null ? -1 : rdDouble(row.get("pm"))
|
|
|
- });
|
|
|
- }
|
|
|
+ Map<Long, Double> internal = new HashMap<>();
|
|
|
+ for (Map<String, Object> row : db.doSelMapListByC(internalCmd))
|
|
|
+ internal.put(rdLong(row.get("bjid")), rdDouble(row.get("score")));
|
|
|
|
|
|
+ // 集体宿舍违纪会按在住学生逐人生成 WJJL;班级计分按同一事件只扣一次。
|
|
|
SqlCmd violationCmd = new SqlCmd(
|
|
|
- "select w.BJID,sum(nvl(lb.BJKF,0)) PENALTY from WJJL w"
|
|
|
- + " inner join WJLB lb on lb.WJLBM=w.WJLBM"
|
|
|
+ "select BJID,sum(PENALTY) PENALTY from ("
|
|
|
+ + "select w.BJID,nvl(lb.BJKF,0) PENALTY,"
|
|
|
+ + "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"
|
|
|
+ " where w.WJSJ>=:start and w.WJSJ<:end"
|
|
|
- + " and w.WJLBM>=20 and w.JLZTM=51 group by w.BJID");
|
|
|
+ + " and w.WJLBM>=20 and w.JLZTM=51)"
|
|
|
+ + " where RN=1 group by BJID");
|
|
|
violationCmd.wrTimeParm("start", period.start);
|
|
|
violationCmd.wrTimeParm("end", period.end);
|
|
|
Map<Long, Double> violations = new HashMap<>();
|
|
|
@@ -513,14 +520,13 @@ public class BjStarClassMpServ extends Serv {
|
|
|
|
|
|
Map<Long, Double> result = new HashMap<>();
|
|
|
for (ClassInfo cls : classes) {
|
|
|
- double[] values = internal.get(cls.bjid);
|
|
|
+ Double internalScore = internal.get(cls.bjid);
|
|
|
Double attendance = attendanceScores.get(cls.bjid);
|
|
|
- if (values == null || values[0] < 0 || values[1] < 0
|
|
|
- || attendance == null)
|
|
|
+ if (internalScore == null || attendance == null)
|
|
|
continue;
|
|
|
- double internalScore = (values[0] + values[1]) / 2.0;
|
|
|
- double violationScore = Math.max(0.0,
|
|
|
- 100.0 - violations.getOrDefault(cls.bjid, 0.0));
|
|
|
+ // 学校确认:宿舍评分允许出现负数。
|
|
|
+ double violationScore =
|
|
|
+ 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));
|
|
|
@@ -596,13 +602,17 @@ 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,trunc(KSSJ) D,sum(case KQLBM"
|
|
|
+ "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,trunc(KSSJ)");
|
|
|
+ + " 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<>();
|
|
|
@@ -789,29 +799,35 @@ public class BjStarClassMpServ extends Serv {
|
|
|
: Timestamp.valueOf(onlyDay.atStartOfDay());
|
|
|
Timestamp end = onlyDay == null ? period.end
|
|
|
: Timestamp.valueOf(onlyDay.plusDays(1).atStartOfDay());
|
|
|
+ // 学校确认:单日宿舍内务按当天所有有效记录取平均,不区分上午/下午。
|
|
|
SqlCmd itemCmd = new SqlCmd(
|
|
|
- "select trunc(JCSJ) D,"
|
|
|
- + "avg(case when extract(hour from JCSJ)<12 then FS end) AM,"
|
|
|
- + "avg(case when extract(hour from JCSJ)>=12 then FS end) PM"
|
|
|
+ "select trunc(JCSJ) D,avg(FS) SCORE,count(*) CNT"
|
|
|
+ " from SSNWJC where BJID=:bjid and JCSJ>=:start"
|
|
|
+ " and JCSJ<:end and " + ObjC.JLZT_useStr
|
|
|
+ " group by trunc(JCSJ)");
|
|
|
itemCmd.wrLongParm("bjid", cls.bjid);
|
|
|
itemCmd.wrTimeParm("start", start);
|
|
|
itemCmd.wrTimeParm("end", end);
|
|
|
- Map<LocalDate, double[]> internal = new HashMap<>();
|
|
|
- for (Map<String, Object> row : db.doSelMapListByC(itemCmd))
|
|
|
- internal.put(rdLocalDate(row.get("d")), new double[]{
|
|
|
- row.get("am") == null ? -1 : rdDouble(row.get("am")),
|
|
|
- row.get("pm") == null ? -1 : rdDouble(row.get("pm"))
|
|
|
- });
|
|
|
+ Map<LocalDate, DailyPoint> internal = rdDailyPoints(
|
|
|
+ db.doSelMapListByC(itemCmd));
|
|
|
|
|
|
+ // 单日宿舍违纪沿用集体事件去重,个人违纪仍逐条参与。
|
|
|
SqlCmd violationCmd = new SqlCmd(
|
|
|
- "select trunc(w.WJSJ) D,sum(nvl(lb.BJKF,0)) PENALTY"
|
|
|
+ "select D,sum(PENALTY) PENALTY from ("
|
|
|
+ + "select trunc(w.WJSJ) D,nvl(lb.BJKF,0) PENALTY,"
|
|
|
+ + "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"
|
|
|
+ " where w.BJID=:bjid and w.WJSJ>=:start"
|
|
|
- + " and w.WJSJ<:end and w.WJLBM>=20 and w.JLZTM=51"
|
|
|
- + " group by trunc(w.WJSJ)");
|
|
|
+ + " and w.WJSJ<:end and w.WJLBM>=20 and w.JLZTM=51)"
|
|
|
+ + " where RN=1 group by D");
|
|
|
violationCmd.wrLongParm("bjid", cls.bjid);
|
|
|
violationCmd.wrTimeParm("start", start);
|
|
|
violationCmd.wrTimeParm("end", end);
|
|
|
@@ -823,18 +839,18 @@ public class BjStarClassMpServ extends Serv {
|
|
|
Map<LocalDate, DailyPoint> attendance =
|
|
|
rdDailyAttendanceScore(db, cls.bjid, start, end);
|
|
|
Map<LocalDate, DailyPoint> result = new HashMap<>();
|
|
|
- for (Map.Entry<LocalDate, double[]> entry : internal.entrySet()) {
|
|
|
+ for (Map.Entry<LocalDate, DailyPoint> entry : internal.entrySet()) {
|
|
|
DailyPoint attend = attendance.get(entry.getKey());
|
|
|
- double[] values = entry.getValue();
|
|
|
- if (values[0] < 0 || values[1] < 0 || attend == null)
|
|
|
+ DailyPoint internalPoint = entry.getValue();
|
|
|
+ if (attend == null)
|
|
|
continue;
|
|
|
- double internalScore = (values[0] + values[1]) / 2.0;
|
|
|
- double violationScore = Math.max(0.0,
|
|
|
- 100.0 - violations.getOrDefault(entry.getKey(), 0.0));
|
|
|
- double base = internalScore * 0.35 + attend.score * 0.15
|
|
|
+ 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), attend.count));
|
|
|
+ round2(base + base / 85.0 * 10.0),
|
|
|
+ internalPoint.count));
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
@@ -893,13 +909,15 @@ 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 trunc(KSSJ) D,sum(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,"
|
|
|
- + "count(*) CNT from KQJL where BJID=:bjid"
|
|
|
+ "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 trunc(KSSJ)");
|
|
|
+ + " group by NVL(RYID,-KQJLID),trunc(KSSJ)"
|
|
|
+ + ") group by D");
|
|
|
sqlc.wrLongParm("bjid", bjid);
|
|
|
sqlc.wrTimeParm("start", start);
|
|
|
sqlc.wrTimeParm("end", end);
|
|
|
@@ -967,20 +985,27 @@ public class BjStarClassMpServ extends Serv {
|
|
|
Timestamp start = Timestamp.valueOf(day.atStartOfDay());
|
|
|
Timestamp end = Timestamp.valueOf(day.plusDays(1).atStartOfDay());
|
|
|
SqlCmd sqlc = new SqlCmd(
|
|
|
- "select k.KQJLID,k.KQLBM,lb.MC KQLBMC,k.RYID,ry.XM,k.MC,"
|
|
|
- + "k.MS,k.KSSJ from KQJL k"
|
|
|
+ "select * from (select k.KQJLID,k.KQLBM,lb.MC KQLBMC,"
|
|
|
+ + "k.RYID,ry.XM,k.MC,k.MS,k.KSSJ,"
|
|
|
+ + "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,"
|
|
|
+ + "row_number() over(partition by NVL(k.RYID,-k.KQJLID)"
|
|
|
+ + " order by 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 desc,k.KSSJ desc,k.KQJLID desc) RN"
|
|
|
+ + " from KQJL k"
|
|
|
+ " 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
|
|
|
- + " order by k.KSSJ desc,k.KQJLID desc");
|
|
|
+ + ObjC.JLZT_useStr + ") where RN=1"
|
|
|
+ + " order by KSSJ desc,KQJLID 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)) {
|
|
|
- int kqlbm = rdInt(row.get("kqlbm"));
|
|
|
Map<String, Object> item = baseDetail(day, SOURCE_REAL);
|
|
|
item.put("id", rdLong(row.get("kqjlid")));
|
|
|
item.put("sourceId", rdLong(row.get("kqjlid")));
|
|
|
@@ -990,7 +1015,7 @@ public class BjStarClassMpServ extends Serv {
|
|
|
item.put("studentName", rdStr(row.get("xm")));
|
|
|
item.put("title", rdStr(row.get("mc")));
|
|
|
item.put("remark", rdStr(row.get("ms")));
|
|
|
- item.put("delta", -attendancePenalty(kqlbm));
|
|
|
+ item.put("delta", -rdDouble(row.get("penalty")));
|
|
|
item.put("scoreText", "");
|
|
|
item.put("sortTime", formatTimestamp(row.get("kssj")));
|
|
|
result.add(item);
|