|
@@ -0,0 +1,322 @@
|
|
|
|
|
+package com.etotem.cfc.unit;
|
|
|
|
|
+
|
|
|
|
|
+import com.etotem.cfc.entity.HealthReport;
|
|
|
|
|
+import com.etotem.cfc.service.FamilyMemberNutritionProfileService;
|
|
|
|
|
+import com.etotem.cfc.service.HealthReportService;
|
|
|
|
|
+import org.junit.jupiter.api.BeforeEach;
|
|
|
|
|
+import org.junit.jupiter.api.DisplayName;
|
|
|
|
|
+import org.junit.jupiter.api.Test;
|
|
|
|
|
+import org.mockito.InjectMocks;
|
|
|
|
|
+import org.mockito.Mock;
|
|
|
|
|
+import org.mockito.MockitoAnnotations;
|
|
|
|
|
+
|
|
|
|
|
+import java.lang.reflect.Field;
|
|
|
|
|
+import java.lang.reflect.Method;
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
|
|
+import java.util.Collections;
|
|
|
|
|
+import java.util.Date;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
+
|
|
|
|
|
+import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
|
|
|
+import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|
|
|
|
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
|
|
|
+import static org.junit.jupiter.api.Assertions.fail;
|
|
|
|
|
+import static org.mockito.Mockito.when;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * 契约级单测:报告档案管理(能力键 {@code report.archive.manage},TDD-RED 阶段)。
|
|
|
|
|
+ *
|
|
|
|
|
+ * <p><b>契约溯源</b></p>
|
|
|
|
|
+ * <ul>
|
|
|
|
|
+ * <li>需求:{@code tests/user-scenarios/应用场景总览.md}
|
|
|
|
|
+ * <ul>
|
|
|
|
|
+ * <li><b>SC-P-24 多报告管理/对比</b>(业务域 C,模块 报告管理)—— 流程:报告列表 → 查看/删除/对比;
|
|
|
|
|
+ * 边界:<b>删除有关联方案时提示</b>。对应测试用例 TC-P-24 / TC-P-24-E / TC-P-24-P:
|
|
|
|
|
+ * <ul>
|
|
|
|
|
+ * <li>TC-P-24:删除有关联方案时提示;对比展示差异</li>
|
|
|
|
|
+ * <li>TC-P-24-E:有方案时提示<b>「请先解除关联方案」</b>再删;不存在 id 返回 404 不崩</li>
|
|
|
|
|
+ * <li>TC-P-24-P:非归属数据访问(报告)统一 403/401,横向越权被拒</li>
|
|
|
|
|
+ * </ul></li>
|
|
|
|
|
+ * <li><b>SC-P-25 报告趋势查看</b>(业务域 C,模块 报告/成长)—— 流程:同类型报告时间序列 → 趋势图;
|
|
|
|
|
+ * 边界:<b>单报告无趋势</b>;时间轴正确。对应 TC-P-25 / TC-P-25-E:
|
|
|
|
|
+ * <ul>
|
|
|
|
|
+ * <li>TC-P-25:同类型报告时间序列趋势图;单报告无趋势提示;时间轴按真实时间升序</li>
|
|
|
|
|
+ * <li>TC-P-25-E:仅 1 份同类型报告 → 提示<b>「至少需要 2 份报告才能看趋势」</b>;
|
|
|
|
|
+ * 两份报告时间倒挂时按真实时间升序不倒挂</li>
|
|
|
|
|
+ * </ul></li>
|
|
|
|
|
+ * </ul></li>
|
|
|
|
|
+ * <li>设计:{@code docs/superpowers/api/API_REFERENCE.md}
|
|
|
|
|
+ * <ul>
|
|
|
|
|
+ * <li>§4.10 测评({@code POST /api/assessment/history} 测评历史、
|
|
|
|
|
+ * {@code POST /api/assessment/latest-result} 最新结果)—— 成长档案 / 报告管理锚点</li>
|
|
|
|
|
+ * <li>§4.59.10 契约缺口:<b>未实现端点</b> {@code /api/health/report/{compare,trend,...}}
|
|
|
|
|
+ * (即报告对比 / 报告趋势契约新增,实现未落地)</li>
|
|
|
|
|
+ * </ul></li>
|
|
|
|
|
+ * </ul>
|
|
|
|
|
+ *
|
|
|
|
|
+ * <p><b>实现现状(2026-11-14,本分支 src/main 核实)</b>:以下契约行为<b>均未落地</b>,本测试逐一探测缺失:</p>
|
|
|
|
|
+ * <ol>
|
|
|
|
|
+ * <li><b>删除守卫缺失</b>:{@code HealthReportService.deleteReport(Long)} 无条件逻辑删除(status=deleted +
|
|
|
|
|
+ * 清理关联数据),<b>不检测报告关联成长方案</b>——服务内无 {@code GrowthPlanMapper} /
|
|
|
|
|
+ * {@code hasLinkedPlan} / {@code assertNotLinkedToPlan} 入口,无法在删除前提示「请先解除关联方案」。</li>
|
|
|
|
|
+ * <li><b>单报告趋势未拦</b>:{@code FamilyMemberNutritionProfileService.getReportTrendData(memberId)}
|
|
|
|
|
+ * 对 1 份报告仍返回单点序列(dates/scores 各 1 项),<b>不标记无趋势、不提示</b>「至少需要 2 份报告才能看趋势」。</li>
|
|
|
|
|
+ * <li><b>趋势未按同类型过滤</b>:{@code getReportTrendData} 仅 1 参(memberId),无 {@code reportType}
|
|
|
|
|
+ * 入参,无法只取「同类型报告」时间序列(SC-P-25 口径)。</li>
|
|
|
|
|
+ * <li><b>报告对比缺失</b>:契约宿主 {@code ReportArchiveCompareService} 未落地;{@code HealthReportController}
|
|
|
|
|
+ * 无 {@code POST /api/health/report/compare} 端点(对比展示差异 / 类型一致才可比对均无载体)。</li>
|
|
|
|
|
+ * <li><b>删除归属未校验</b>:{@code HealthReportController.deleteReport} 仅收 {@code @RequestBody Map},
|
|
|
|
|
+ * 无 {@code userId}/{@code memberId} 归属校验,横向越权删除他人报告不被拒(TC-P-24-P)。</li>
|
|
|
|
|
+ * </ol>
|
|
|
|
|
+ *
|
|
|
|
|
+ * <p><b>测试范围</b>:纯 Mockito / 反射,无 Spring 上下文、无 DB、无外部服务、无真实微信。
|
|
|
|
|
+ * 能编译、能运行、断言失败(红),失败断言原文清晰可贴;实现落地后转绿。</p>
|
|
|
|
|
+ *
|
|
|
|
|
+ * <p><b>GREEN 升级指引</b>:实现者按本契约补齐——
|
|
|
|
|
+ * (1) {@code HealthReportService} 注入 {@code GrowthPlanMapper} 并提供 {@code hasLinkedPlan(Long)}/
|
|
|
|
|
+ * {@code assertNotLinkedToPlan(Long)},删除前命中则抛 {@code MSG_LINKED_PLAN};
|
|
|
|
|
+ * (2) {@code FamilyMemberNutritionProfileService.getReportTrendData} 增 {@code reportType} 同类型过滤,
|
|
|
|
|
+ * 单报告(同类型 <2)时返回 {@code trendAvailable=false} + 提示 {@code MSG_SINGLE_REPORT_TREND};
|
|
|
|
|
+ * (3) 落地 {@code ReportArchiveCompareService.compareReports(reportAId, reportBId)}(类型一致才可比对,返回差异标注)
|
|
|
|
|
+ * 及 {@code HealthReportController} 的 {@code POST /api/health/report/compare} 端点;
|
|
|
|
|
+ * (4) {@code HealthReportController.deleteReport} 增 {@code @RequestAttribute("userId")} 归属校验,
|
|
|
|
|
+ * 非归属返回 403/401。</p>
|
|
|
|
|
+ */
|
|
|
|
|
+class ReportArchiveManageContractTest {
|
|
|
|
|
+
|
|
|
|
|
+ // ==================== 契约文案(TC-P-24-E / TC-P-25-E 原文) ====================
|
|
|
|
|
+
|
|
|
|
|
+ /** 删除有关联方案时的提示(TC-P-24-E「请先解除关联方案」) */
|
|
|
|
|
+ private static final String MSG_LINKED_PLAN = "该报告已关联成长方案,请先解除关联方案后再删除";
|
|
|
|
|
+
|
|
|
|
|
+ /** 单报告无趋势提示(TC-P-25-E「至少需要 2 份报告才能看趋势」) */
|
|
|
|
|
+ private static final String MSG_SINGLE_REPORT_TREND = "至少需要 2 份报告才能看趋势";
|
|
|
|
|
+
|
|
|
|
|
+ /** 报告对比契约宿主(§4.59.10 未实现端点 /api/health/report/compare 的服务层载体) */
|
|
|
|
|
+ private static final String HOST_REPORT_COMPARE = "com.etotem.cfc.service.ReportArchiveCompareService";
|
|
|
|
|
+
|
|
|
|
|
+ // ==================== Mockito:趋势行为探测(SC-P-25) ====================
|
|
|
|
|
+
|
|
|
|
|
+ @Mock
|
|
|
|
|
+ private HealthReportService healthReportService;
|
|
|
|
|
+
|
|
|
|
|
+ @InjectMocks
|
|
|
|
|
+ private FamilyMemberNutritionProfileService trendService;
|
|
|
|
|
+
|
|
|
|
|
+ @BeforeEach
|
|
|
|
|
+ void setUp() {
|
|
|
|
|
+ MockitoAnnotations.openMocks(this);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // ==================== A. 删除守卫(关联方案)— SC-P-24 / TC-P-24-E ====================
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ @DisplayName("删除守卫:HealthReportService 应提供关联方案检测入口(hasLinkedPlan/assertNotLinkedToPlan)")
|
|
|
|
|
+ void deleteReport_应提供关联方案检测入口() {
|
|
|
|
|
+ Class<?> svc = loadClass("com.etotem.cfc.service.HealthReportService");
|
|
|
|
|
+ assertNotNull(svc, "[report.archive.manage] HealthReportService 类不存在,无法探测删除守卫入口。");
|
|
|
|
|
+
|
|
|
|
|
+ // 守卫入口:方法 hasLinkedPlan(Long) / assertNotLinkedToPlan(Long),或注入 GrowthPlanMapper 字段
|
|
|
|
|
+ boolean hasGuardMethod = false;
|
|
|
|
|
+ for (Method m : svc.getDeclaredMethods()) {
|
|
|
|
|
+ String n = m.getName();
|
|
|
|
|
+ if (("hasLinkedPlan".equals(n) || "assertNotLinkedToPlan".equals(n))
|
|
|
|
|
+ && m.getParameterCount() == 1) {
|
|
|
|
|
+ hasGuardMethod = true;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ boolean hasGrowthPlanMapper = false;
|
|
|
|
|
+ for (Field f : svc.getDeclaredFields()) {
|
|
|
|
|
+ if (f.getType().getName().endsWith("GrowthPlanMapper")) {
|
|
|
|
|
+ hasGrowthPlanMapper = true;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ assertTrue(hasGuardMethod || hasGrowthPlanMapper,
|
|
|
|
|
+ "[report.archive.manage] HealthReportService 缺少关联方案检测入口:删除前应检测报告是否关联"
|
|
|
|
|
+ + "成长方案(hasLinkedPlan/assertNotLinkedToPlan 或 GrowthPlanMapper),"
|
|
|
|
|
+ + "命中则提示「" + MSG_LINKED_PLAN + "」(SC-P-24 / TC-P-24-E)。实现未落地。");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ @DisplayName("删除守卫:删除关联方案报告应被拒并提示「请先解除关联方案」,不落删除")
|
|
|
|
|
+ void deleteReport_关联方案报告_应拒绝并提示_不删除() {
|
|
|
|
|
+ Class<?> svc = loadClass("com.etotem.cfc.service.HealthReportService");
|
|
|
|
|
+ assertNotNull(svc, "[report.archive.manage] HealthReportService 类不存在。");
|
|
|
|
|
+
|
|
|
|
|
+ // 行为探测:定位删除守卫入口(GREEN 后在此反射调用并断言抛 MSG_LINKED_PLAN + 不执行删除)
|
|
|
|
|
+ Method guard = null;
|
|
|
|
|
+ for (Method m : svc.getDeclaredMethods()) {
|
|
|
|
|
+ String n = m.getName();
|
|
|
|
|
+ if (("hasLinkedPlan".equals(n) || "assertNotLinkedToPlan".equals(n))
|
|
|
|
|
+ && m.getParameterCount() == 1) {
|
|
|
|
|
+ guard = m;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (guard == null) {
|
|
|
|
|
+ // 契约入口缺失即红:无法表达「关联方案报告删除被拒」这一行为(TC-P-24-E)
|
|
|
|
|
+ fail("[report.archive.manage] 删除守卫入口缺失:无 hasLinkedPlan/assertNotLinkedToPlan,"
|
|
|
|
|
+ + "删除关联方案报告时无法提示「" + MSG_LINKED_PLAN + "」,会无条件删除(SC-P-24)。");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 守卫入口已存在(GREEN 阶段补行为级断言:反射调用抛 MSG_LINKED_PLAN)
|
|
|
|
|
+ assertNotNull(guard, "[report.archive.manage] 删除守卫入口应存在(SC-P-24)。");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // ==================== B. 趋势守卫(单报告 / 同类型)— SC-P-25 / TC-P-25-E ====================
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ @DisplayName("趋势:单报告应标记无趋势并提示「至少需要 2 份报告才能看趋势」")
|
|
|
|
|
+ void 趋势_单报告_应标记无趋势并提示() {
|
|
|
|
|
+ HealthReport only = report("gut_flora", "2026-10-01", 72);
|
|
|
|
|
+
|
|
|
|
|
+ when(healthReportService.getMemberReports(1L)).thenReturn(Collections.singletonList(only));
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> trend = trendService.getReportTrendData(1L);
|
|
|
|
|
+ assertNotNull(trend, "[report.archive.manage] 趋势数据不应为 null(SC-P-25)。");
|
|
|
|
|
+
|
|
|
|
|
+ // 契约:单报告(同类型 <2)→ trendAvailable=false + 提示文案(TC-P-25-E)
|
|
|
|
|
+ assertFalse(Boolean.TRUE.equals(trend.get("trendAvailable")),
|
|
|
|
|
+ "[report.archive.manage] 单报告应标记 trendAvailable=false(无趋势),"
|
|
|
|
|
+ + "当前仅 1 份报告仍返回单点序列(dates/scores 各 1 项)。SC-P-25 边界未落地。");
|
|
|
|
|
+ assertTrue(trend.containsKey("message") && trend.get("message") != null
|
|
|
|
|
+ && trend.get("message").toString().contains(MSG_SINGLE_REPORT_TREND),
|
|
|
|
|
+ "[report.archive.manage] 单报告趋势应返回提示「" + MSG_SINGLE_REPORT_TREND
|
|
|
|
|
+ + "」(TC-P-25-E),当前 response 无 message 字段。实现未落地。");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ @DisplayName("趋势:应提供 reportType 同类型过滤入参(同类型报告时间序列)")
|
|
|
|
|
+ void 趋势_应提供reportType同类型过滤入参() {
|
|
|
|
|
+ Class<?> svc = loadClass("com.etotem.cfc.service.FamilyMemberNutritionProfileService");
|
|
|
|
|
+ assertNotNull(svc, "[report.archive.manage] FamilyMemberNutritionProfileService 类不存在。");
|
|
|
|
|
+
|
|
|
|
|
+ boolean hasTypedOverload = false;
|
|
|
|
|
+ for (Method m : svc.getDeclaredMethods()) {
|
|
|
|
|
+ if (m.getName().equals("getReportTrendData") && m.getParameterCount() == 2) {
|
|
|
|
|
+ hasTypedOverload = true;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ assertTrue(hasTypedOverload,
|
|
|
|
|
+ "[report.archive.manage] getReportTrendData 缺少 reportType 入参:SC-P-25 口径为"
|
|
|
|
|
+ + "「同类型报告时间序列」→趋势图,需按 reportType 过滤;当前仅 1 参(memberId),"
|
|
|
|
|
+ + "无法只取同类型报告。实现未落地。");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // ==================== C. 报告对比(SC-P-24 对比展示差异)— 正常流 ====================
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ @DisplayName("报告对比:应提供 ReportArchiveCompareService 宿主")
|
|
|
|
|
+ void 报告对比_应提供ReportArchiveCompareService宿主() {
|
|
|
|
|
+ Class<?> host = loadClass(HOST_REPORT_COMPARE);
|
|
|
|
|
+ assertNotNull(host,
|
|
|
|
|
+ "[report.archive.manage] ReportArchiveCompareService 未落地:SC-P-24「对比展示差异」"
|
|
|
|
|
+ + "(TC-P-24)契约宿主缺失,报告档案对比无载体(§4.59.10 未实现端点 /api/health/report/compare)。");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ @DisplayName("报告对比:宿主应提供 compareReports(reportAId, reportBId) 契约方法")
|
|
|
|
|
+ void 报告对比_宿主应提供compareReports方法() {
|
|
|
|
|
+ Class<?> host = loadClass(HOST_REPORT_COMPARE);
|
|
|
|
|
+ if (host == null) {
|
|
|
|
|
+ fail("[report.archive.manage] ReportArchiveCompareService 未落地,无法验证 compareReports "
|
|
|
|
|
+ + "契约方法(SC-P-24 / TC-P-24)。");
|
|
|
|
|
+ }
|
|
|
|
|
+ boolean hasCompare = false;
|
|
|
|
|
+ for (Method m : host.getDeclaredMethods()) {
|
|
|
|
|
+ if (m.getName().equals("compareReports") && m.getParameterCount() == 2) {
|
|
|
|
|
+ hasCompare = true;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ assertTrue(hasCompare,
|
|
|
|
|
+ "[report.archive.manage] ReportArchiveCompareService 应提供 compareReports(reportAId, reportBId),"
|
|
|
|
|
+ + "报告类型一致才可比对、差异清晰标注(SC-P-24 / TC-T-21)。");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ @DisplayName("报告对比:HealthReportController 应暴露 POST /api/health/report/compare 端点")
|
|
|
|
|
+ void 报告对比_应暴露report_compare端点() {
|
|
|
|
|
+ Class<?> controller = loadClass("com.etotem.cfc.controller.HealthReportController");
|
|
|
|
|
+ assertNotNull(controller, "[report.archive.manage] HealthReportController 类不存在。");
|
|
|
|
|
+
|
|
|
|
|
+ boolean exposed = false;
|
|
|
|
|
+ for (Method m : controller.getDeclaredMethods()) {
|
|
|
|
|
+ org.springframework.web.bind.annotation.PostMapping post =
|
|
|
|
|
+ m.getAnnotation(org.springframework.web.bind.annotation.PostMapping.class);
|
|
|
|
|
+ if (post != null) {
|
|
|
|
|
+ for (String v : post.value()) {
|
|
|
|
|
+ if ("/report/compare".equals(v)) {
|
|
|
|
|
+ exposed = true;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (exposed) break;
|
|
|
|
|
+ }
|
|
|
|
|
+ assertTrue(exposed,
|
|
|
|
|
+ "[report.archive.manage] HealthReportController 缺少 POST /api/health/report/compare 端点:"
|
|
|
|
|
+ + "报告档案对比(SC-P-24 / TC-P-24,§4.59.10 未实现端点)无接口载体。实现未落地。");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // ==================== D. 权限流(SC-P-24-P 归属校验) ====================
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ @DisplayName("权限流:删除报告应校验归属,非归属数据访问统一 403/401")
|
|
|
|
|
+ void 删除报告_应校验归属_非归属越权被拒() {
|
|
|
|
|
+ Class<?> controller = loadClass("com.etotem.cfc.controller.HealthReportController");
|
|
|
|
|
+ assertNotNull(controller, "[report.archive.manage] HealthReportController 类不存在。");
|
|
|
|
|
+
|
|
|
|
|
+ Method del = null;
|
|
|
|
|
+ for (Method m : controller.getDeclaredMethods()) {
|
|
|
|
|
+ if (m.getName().equals("deleteReport")) {
|
|
|
|
|
+ del = m;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ assertNotNull(del, "[report.archive.manage] HealthReportController.deleteReport 方法不存在。");
|
|
|
|
|
+
|
|
|
|
|
+ boolean hasOwnerArg = false;
|
|
|
|
|
+ for (java.lang.reflect.Parameter p : del.getParameters()) {
|
|
|
|
|
+ for (java.lang.annotation.Annotation a : p.getAnnotations()) {
|
|
|
|
|
+ String at = a.annotationType().getName();
|
|
|
|
|
+ // 归属校验载体:@RequestAttribute("userId"/"memberId") 或 @RequestAttribute("familyId")
|
|
|
|
|
+ if (at.endsWith("RequestAttribute")) {
|
|
|
|
|
+ hasOwnerArg = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ assertTrue(hasOwnerArg,
|
|
|
|
|
+ "[report.archive.manage] HealthReportController.deleteReport 缺少归属校验参数"
|
|
|
|
|
+ + "(@RequestAttribute userId/memberId/familyId):当前仅收 @RequestBody Map,"
|
|
|
|
|
+ + "无法拦截横向越权删除他人报告(SC-P-24-P / TC-P-24-P,非归属统一 403/401)。实现未落地。");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // ==================== 反射 / 测试辅助 ====================
|
|
|
|
|
+
|
|
|
|
|
+ private HealthReport report(String reportType, String reportDate, int overallScore) {
|
|
|
|
|
+ HealthReport r = new HealthReport();
|
|
|
|
|
+ r.setId(9001L);
|
|
|
|
|
+ r.setReportType(reportType);
|
|
|
|
|
+ try {
|
|
|
|
|
+ Date d = new SimpleDateFormat("yyyy-MM-dd").parse(reportDate);
|
|
|
|
|
+ r.setReportDate(d);
|
|
|
|
|
+ } catch (Exception ignored) {
|
|
|
|
|
+ // 契约探针不依赖真实日期解析
|
|
|
|
|
+ }
|
|
|
|
|
+ r.setOverallScore(overallScore);
|
|
|
|
|
+ return r;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private Class<?> loadClass(String name) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ return Class.forName(name, false, Thread.currentThread().getContextClassLoader());
|
|
|
|
|
+ } catch (ClassNotFoundException e) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|