|
|
@@ -2,6 +2,7 @@ package com.etotem.cfc.controller.assessment;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.etotem.cfc.common.Result;
|
|
|
+import com.etotem.cfc.common.constant.DimensionCodeConstants;
|
|
|
import com.etotem.cfc.dto.AssessmentHistoryItemDTO;
|
|
|
import com.etotem.cfc.dto.AssessmentResultDTO;
|
|
|
import com.etotem.cfc.entity.DanAssessmentResult;
|
|
|
@@ -43,9 +44,26 @@ public class AssessmentResultController {
|
|
|
return Result.success(null);
|
|
|
}
|
|
|
|
|
|
+ // SC-P-39 边界「量纲标注」:八类报告分数超出 0-100 量纲(dimension-scoring-convention §1)时拒显,
|
|
|
+ // 不透传脏数据(覆盖八类全部维度字段,任一越界即整体拒显)
|
|
|
+ if (hasAnyDimensionOutOfRange(result)) {
|
|
|
+ return Result.error(400, "测评结果分数超出0-100量纲范围,拒绝展示");
|
|
|
+ }
|
|
|
+
|
|
|
AssessmentResultDTO dto = new AssessmentResultDTO();
|
|
|
dto.setMemberId(result.getMemberId());
|
|
|
dto.setChildName(result.getChildName());
|
|
|
+ dto.setScaleMin(DimensionCodeConstants.SCORE_MIN);
|
|
|
+ dto.setScaleMax(DimensionCodeConstants.SCORE_MAX);
|
|
|
+ // 八类报告中文标签(供结果页直接渲染,与 indicator_definitions 认知维度命名一致)
|
|
|
+ dto.setOverallLabel("综合");
|
|
|
+ dto.setAttentionLabel("注意力");
|
|
|
+ dto.setFocusLabel("专注力");
|
|
|
+ dto.setMemoryLabel("记忆力");
|
|
|
+ dto.setLogicLabel("逻辑思维");
|
|
|
+ dto.setPerceptionLabel("感知能力");
|
|
|
+ dto.setSpatialLabel("空间思维");
|
|
|
+ dto.setProcessingSpeedLabel("加工速度");
|
|
|
dto.setOverallScore(result.getOverallScore());
|
|
|
dto.setAttentionScore(result.getAttentionScore());
|
|
|
dto.setFocusScore(result.getFocusScore());
|
|
|
@@ -83,11 +101,37 @@ public class AssessmentResultController {
|
|
|
|
|
|
List<AssessmentHistoryItemDTO> list = new ArrayList<>();
|
|
|
for (DanAssessmentResult r : results) {
|
|
|
+ // SC-P-39 量纲口径(0-100 闭区间):历史链路同样拒绝透传越界分数,越界条目拒显/过滤
|
|
|
+ if (isOutOfRange(r.getOverallScore())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
AssessmentHistoryItemDTO item = new AssessmentHistoryItemDTO();
|
|
|
item.setAssessmentDate(r.getAssessmentDate());
|
|
|
item.setOverallScore(r.getOverallScore());
|
|
|
+ // 量纲标注(与最新结果页同口径):0-100 闭区间 + 综合得分中文标签
|
|
|
+ item.setScaleMin(DimensionCodeConstants.SCORE_MIN);
|
|
|
+ item.setScaleMax(DimensionCodeConstants.SCORE_MAX);
|
|
|
+ item.setOverallLabel("综合");
|
|
|
list.add(item);
|
|
|
}
|
|
|
return Result.success(list);
|
|
|
}
|
|
|
+
|
|
|
+ /** 八类报告维度是否任一越界(超出 0-100 量纲闭区间即拒显) */
|
|
|
+ private static boolean hasAnyDimensionOutOfRange(DanAssessmentResult r) {
|
|
|
+ return isOutOfRange(r.getOverallScore())
|
|
|
+ || isOutOfRange(r.getAttentionScore())
|
|
|
+ || isOutOfRange(r.getFocusScore())
|
|
|
+ || isOutOfRange(r.getMemoryScore())
|
|
|
+ || isOutOfRange(r.getLogicScore())
|
|
|
+ || isOutOfRange(r.getPerceptionScore())
|
|
|
+ || isOutOfRange(r.getSpatialScore())
|
|
|
+ || isOutOfRange(r.getProcessingSpeedScore());
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 单维度越界判断:null 视为未录入(不算越界),非 null 须落在 [SCORE_MIN, SCORE_MAX] 闭区间 */
|
|
|
+ private static boolean isOutOfRange(Integer score) {
|
|
|
+ return score != null
|
|
|
+ && (score < DimensionCodeConstants.SCORE_MIN || score > DimensionCodeConstants.SCORE_MAX);
|
|
|
+ }
|
|
|
}
|