xyc
2026-11-11 841847dbbab3c6fd532dcb747ca290ba6a9e12d0
traffic-audit-server/src/main/java/com/trafficaudit/rulemanage/controller/RuleManageController.java
@@ -45,9 +45,9 @@
        return Result.ok("已更新");
    }
    /** 更新阈值/等级/描述 */
    /** 更新阈值/等级/描述(返回更新后的规则,前端据此刷新"规则说明"列) */
    @PostMapping("/update")
    public Result<String> update(@RequestBody AuditRule body) {
    public Result<AuditRule> update(@RequestBody AuditRule body) {
        if (body.getId() == null) return Result.error("缺少规则ID");
        AuditRule rule = ruleMapper.selectById(body.getId());
        if (rule == null) return Result.error("规则不存在");
@@ -61,7 +61,7 @@
        }
        rule.setUpdatedAt(LocalDateTime.now());
        ruleMapper.updateById(rule);
        return Result.ok("已保存");
        return Result.ok(rule);
    }
    /** 名称/说明中随阈值动态变化的数字片段:匹配任意数字(% 前后、台/吨/公里等单位前均可) */
@@ -98,6 +98,9 @@
        double[] cands;
        if (v > 0 && v < 1) {
            cands = new double[]{v, v * 100};
        } else if (v == 1) {
            // 恰好等于 1:既可能是原值 1,也可能是"100%"——都列上,才能和 <1 侧的 (值, 百分数) 一一对应
            cands = new double[]{v, v * 100};
        } else if (v > 1) {
            cands = new double[]{v, (v - 1) * 100};
        } else {