2026-08-04 bb1210d95ccd0216ff8a352238f0ee25754a2ef2
fix(crm): 修复权限切面中的空指针异常

- 修改 CrmContractParseFunction 中的 executeBefore 方法返回值为 false
- 避免在 _DIFF 中提前求值导致的问题
- 在 CrmPermissionAspect 中添加空值检查
- 当 bizId 为空时抛出 BAD_REQUEST 异常防止后续处理出错
已修改2个文件
6 ■■■■ 文件已修改
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmContractParseFunction.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/permission/core/aop/CrmPermissionAspect.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmContractParseFunction.java
@@ -24,7 +24,7 @@
    @Override
    public boolean executeBefore() {
        return true; // 先转换值后对比
        return false; // 不在 _DIFF 中使用,无需提前求值
    }
    @Override
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/permission/core/aop/CrmPermissionAspect.java
@@ -24,6 +24,7 @@
import java.util.*;
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
@@ -56,6 +57,9 @@
                crmPermission.bizType()[0].getType() : (Integer) expressionValues.get(crmPermission.bizTypeValue()); // 模块类型
        // 1.2 处理兼容多个 bizId 的情况
        Object object = expressionValues.get(crmPermission.bizId()); // 模块数据编号
        if (object == null) {
            throw exception(BAD_REQUEST);
        }
        Set<Long> bizIds = new HashSet<>();
        if (object instanceof Collection<?>) {
            bizIds.addAll(convertSet((Collection<?>) object, item -> Long.parseLong(item.toString())));