From 5c83bfa1da203702f74bf6351376a2ebda5ca201 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Sat, 10 Dec 2022 20:28:46 +0800 Subject: [PATCH] fix npe --- .../service/impl/ResourceServiceImpl.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 7fd3489e..fb00abe2 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -2808,14 +2808,19 @@ public class ResourceServiceImpl extends CrudServiceImpl lcDept = sysDeptDao.selectLCDeptByUcsDeptName(params.get("provideDept").toString()); - if (lcDept.isEmpty() - || lcDept.get("lc_name") == null - || (lcDept.get("lc_name") != null && org.apache.commons.lang3.StringUtils.isBlank(lcDept.get("lc_name").toString())) - ) { - logger.error("未查询到{}对应的浪潮系统部门", params.get("provideDept").toString()); + try { + if (lcDept.isEmpty() + || lcDept.get("lc_name") == null + || (lcDept.get("lc_name") != null && org.apache.commons.lang3.StringUtils.isBlank(lcDept.get("lc_name").toString())) + ) { + logger.error("未查询到{}对应的浪潮系统部门", params.get("provideDept").toString()); + return new ArrayList<>(); + } + sb.append(" AND apply.\"resourceDeptName\" = ").append(lcDept.get("lc_name").toString()); + } catch (Exception e) { + logger.error("", e); return new ArrayList<>(); } - sb.append(" AND apply.\"resourceDeptName\" = ").append(lcDept.get("lc_name").toString()); } if (params.get("region") != null) { List deptNames = sysDeptDao.selectLCDeptByRegion((Long) params.get("region"));