فهرست منبع

feat(starclass): cap student group bonus at three points

apple 2 هفته پیش
والد
کامیت
c003b320d3

+ 82 - 0
docs/24_星级班班主任移动报表/2026-11-09_学生团体加分3分封顶实施记录.md

@@ -0,0 +1,82 @@
+# 2026-11-09 学生团体加分 3 分封顶实施记录
+
+## 1. 实施结论
+
+第三方系统 `T_STUM_SR_INDEX_SETING` 的“增分 / 学生团体”节点限分为 3。
+据此,PMS 采用:
+
+```text
+学生团体得分 = min(3, 该班当月全部学生团体增分合计)
+最终增分 = min(8, 其他增分 + 学生团体得分)
+```
+
+`TT` 和 `TTCY` 的原始 `XJB_JFJL` 事件继续完整保留;3 分封顶只用于班级增分
+汇总,不删除或截断明细。
+
+## 2. 代码改动
+
+### 2.1 `XjbJfServ`
+
+新增统一封顶常量和计算:
+
+```text
+TEAM_BONUS_CAP = 3.0
+TOTAL_BONUS_CAP = 8.0
+capBonus(otherBonus, teamBonus)
+```
+
+### 2.2 `BjStarClassMpServ`
+
+实时评分汇总将增分拆分为:
+
+```text
+TEAM_BONUS   LYLX in ('TT','TTCY')
+OTHER_BONUS  其他增分来源
+```
+
+再调用统一封顶方法。
+
+### 2.3 `XjbMonthCloseServ`
+
+全校月结使用同一 SQL 拆分和封顶规则,写入 `XJB_JG.ZJF` 的值为最终封顶后增分。
+
+## 3. 验证
+
+Java 21 编译通过。封顶边界测试结果:
+
+| 其他增分 | 团体原始增分 | 封顶结果 |
+|---:|---:|---:|
+| 1.50 | 2.50 | 4.00 |
+| 0.00 | 5.00 | 3.00 |
+| 4.00 | 5.00 | 7.00 |
+| 6.00 | 5.00 | 8.00 |
+| 0.00 | 0.00 | 0.00 |
+| 1.25 | -1.00 | 1.25 |
+| 10.00 | 0.00 | 8.00 |
+
+正式库只读调用 `BjStarClassMpServ.rdAdjustmentTotals()` 成功,SQL 可执行。
+
+测试环境 `pms-test` 已发布 3 个服务 class,Deployment 为 `1/1 Running`,
+首页和登录页 HTTP 200。
+
+## 4. 团体导入准入判断
+
+3 分封顶已不构成阻塞项,但团体数据尚不能直接正式导入,仍缺:
+
+1. 正式人员库没有“刘境研”,最接近的是
+   `111148350 刘镜妍 / 1012227 信息技术部`,需确认身份。
+2. 42 条成员可以按 PMS 匹配,仍有 4 条需要人工核实。
+3. “完整职务名称”需要扩展 `TTWCY` 字段,当前只保存职务类别。
+4. 名单生效日期 `2026-11-01` 和当前学年尚未落实到成员数据字段。
+5. 团体负责人为非信息技术部团体时,现有 `xsh` 列表按 `FZBMID` 限制,
+   刘老师可能看不到她负责的团委归口团体,需要扩展可见条件。
+6. 电视台、篮球队 27 条空白职务仍需确认是否只写 `TTCY`。
+
+## 5. 当前状态
+
+```text
+3 分封顶代码:已实现
+测试环境:已发布并启动成功
+正式环境:未发布
+团体业务数据:未导入
+```

+ 21 - 4
src/biz/bj/BjStarClassMpServ.java

@@ -2547,7 +2547,14 @@ public class BjStarClassMpServ extends Serv {
             Db db, YearMonth month) throws Exception {
         SqlCmd sqlc = new SqlCmd(
                 "select BJID,"
-                        + "sum(case when JFLX=1 then JFZ else 0 end) BONUS,"
+                        + "sum(case when JFLX=1 and LYLX in('"
+                        + XjbJfServ.LYLX_TEAM_ROLE + "','"
+                        + XjbJfServ.LYLX_TEAM_MEMBER
+                        + "') then JFZ else 0 end) TEAM_BONUS,"
+                        + "sum(case when JFLX=1 and nvl(LYLX,'#') not in('"
+                        + XjbJfServ.LYLX_TEAM_ROLE + "','"
+                        + XjbJfServ.LYLX_TEAM_MEMBER
+                        + "') then JFZ else 0 end) OTHER_BONUS,"
                         + "sum(case when JFLX=2 then JFZ else 0 end) DEDUCTION,"
                         + "sum(case when JFLX=1 then 1 else 0 end) BONUS_CNT,"
                         + "sum(case when JFLX=2 then 1 else 0 end) DEDUCTION_CNT"
@@ -2558,7 +2565,9 @@ public class BjStarClassMpServ extends Serv {
             Map<Long, AdjustmentTotals> result = new HashMap<>();
             for (Map<String, Object> row : db.doSelMapListByC(sqlc)) {
                 AdjustmentTotals total = new AdjustmentTotals();
-                total.bonus = Math.min(8.0, rdDouble(row.get("bonus")));
+                total.bonus = XjbJfServ.capBonus(
+                        rdDouble(row.get("other_bonus")),
+                        rdDouble(row.get("team_bonus")));
                 total.deduction = rdDouble(row.get("deduction"));
                 total.bonusEvents = rdInt(row.get("bonus_cnt"));
                 total.deductionEvents = rdInt(row.get("deduction_cnt"));
@@ -2657,16 +2666,24 @@ public class BjStarClassMpServ extends Serv {
     private static AdjustmentTotals adjustmentTotals(
             List<Adjustment> adjustments) {
         AdjustmentTotals total = new AdjustmentTotals();
+        double otherBonus = 0.0;
+        double teamBonus = 0.0;
         for (Adjustment item : adjustments) {
             if (item.score > 0) {
-                total.bonus += item.score;
+                if (XjbJfServ.LYLX_TEAM_ROLE.equals(item.sourceType)
+                        || XjbJfServ.LYLX_TEAM_MEMBER.equals(
+                                item.sourceType)) {
+                    teamBonus += item.score;
+                } else {
+                    otherBonus += item.score;
+                }
                 total.bonusEvents++;
             } else {
                 total.deduction += Math.abs(item.score);
                 total.deductionEvents++;
             }
         }
-        total.bonus = round2(total.bonus);
+        total.bonus = round2(XjbJfServ.capBonus(otherBonus, teamBonus));
         total.deduction = round2(total.deduction);
         return total;
     }

+ 12 - 0
src/biz/bj/XjbJfServ.java

@@ -45,6 +45,8 @@ public class XjbJfServ extends Serv {
     public static final String LYLX_FJ_SAFE = "FJ_SAFE";
     public static final int JFLX_ADD = 1;
     public static final int JFLX_SUB = 2;
+    public static final double TEAM_BONUS_CAP = 3.0;
+    public static final double TOTAL_BONUS_CAP = 8.0;
 
     private static final Set<String> RECALC_TYPES = new LinkedHashSet<>(
             Arrays.asList(LYLX_AWARD, LYLX_SCHOOL_VIOLATION,
@@ -52,6 +54,16 @@ public class XjbJfServ extends Serv {
     private static final Set<String> TEAM_SNAPSHOT_TYPES = new LinkedHashSet<>(
             Arrays.asList(LYLX_TEAM_ROLE, LYLX_TEAM_MEMBER));
 
+    /**
+     * 学生团体先按 3 分封顶,再与其他增分合并并受总增分 8 分限制。
+     */
+    public static double capBonus(double otherBonus, double teamBonus) {
+        double safeTeamBonus = Math.min(
+                TEAM_BONUS_CAP, Math.max(0.0, teamBonus));
+        double safeOtherBonus = Math.max(0.0, otherBonus);
+        return Math.min(TOTAL_BONUS_CAP, safeOtherBonus + safeTeamBonus);
+    }
+
     /**
      * 为当前班主任的指定班级重建一个月的事件账本。
      */

+ 12 - 2
src/biz/bj/XjbMonthCloseServ.java

@@ -748,7 +748,15 @@ public class XjbMonthCloseServ extends Serv {
     private Map<Long, AdjustmentTotals> rdAdjustmentTotals(
             Db db, YearMonth month) throws Exception {
         SqlCmd sqlc = new SqlCmd(
-                "select BJID,sum(case when JFLX=1 then JFZ else 0 end) BONUS,"
+                "select BJID,"
+                        + "sum(case when JFLX=1 and LYLX in('"
+                        + XjbJfServ.LYLX_TEAM_ROLE + "','"
+                        + XjbJfServ.LYLX_TEAM_MEMBER
+                        + "') then JFZ else 0 end) TEAM_BONUS,"
+                        + "sum(case when JFLX=1 and nvl(LYLX,'#') not in('"
+                        + XjbJfServ.LYLX_TEAM_ROLE + "','"
+                        + XjbJfServ.LYLX_TEAM_MEMBER
+                        + "') then JFZ else 0 end) OTHER_BONUS,"
                         + "sum(case when JFLX=2 then JFZ else 0 end) DEDUCTION,"
                         + "sum(case when JFLX=1 then 1 else 0 end) BONUS_CNT,"
                         + "sum(case when JFLX=2 then 1 else 0 end) DEDUCTION_CNT"
@@ -757,7 +765,9 @@ public class XjbMonthCloseServ extends Serv {
         Map<Long, AdjustmentTotals> result = new HashMap<>();
         for (Map<String, Object> row : db.doSelMapListByC(sqlc)) {
             AdjustmentTotals total = new AdjustmentTotals();
-            total.bonus = Math.min(8.0, rdDouble(row.get("bonus")));
+            total.bonus = XjbJfServ.capBonus(
+                    rdDouble(row.get("other_bonus")),
+                    rdDouble(row.get("team_bonus")));
             total.deduction = rdDouble(row.get("deduction"));
             total.bonusCount = rdInt(row.get("bonus_cnt"));
             total.deductionCount = rdInt(row.get("deduction_cnt"));