From 72339c1f9c9d7f71c684d159ebf81cb022449cdf Mon Sep 17 00:00:00 2001 From: wangliwen Date: Sat, 10 Dec 2022 16:45:56 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=BC=82=E6=AD=A5=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=BE=85=E5=8A=9E=E4=BB=BB=E5=8A=A1=E5=86=85=E8=AF=A6=E6=83=85?= =?UTF-8?q?=EF=BC=8C=E5=A4=A7=E5=B9=85=E5=87=8F=E5=B0=91=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activiti/service/ActTaskService.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java index b562bd0b..024f9c06 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java @@ -65,10 +65,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.*; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; +import java.util.concurrent.*; import java.util.stream.Collectors; /** @@ -82,7 +79,7 @@ public class ActTaskService extends BaseServiceImpl { private static final ObjectMapper oMapper = new ObjectMapper(); private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors(); - private static final ExecutorService executor = Executors.newFixedThreadPool(CPUNUM); + private static final ExecutorService executor = Executors.newWorkStealingPool(CPUNUM * 2); public static String Task_HANDLE_STATE = "handleState"; //任务节点处理状态key public static String Task_HANDLE_STATE_AGREE = "agree"; //同意 @@ -193,11 +190,21 @@ public class ActTaskService extends BaseServiceImpl { } List tasks = nativeTaskQuery.listPage((curPage - 1) * limit, limit); long count = nativeCountTaskQuery.count(); + List completableFutures = new ArrayList(); List list_ = tasks.stream().map(index -> { TaskQuery taskQuery = taskService.createTaskQuery(); - Task temp = taskQuery.taskId(index.getId()).includeProcessVariables().singleResult(); + CompletableFuture tempTask = CompletableFuture.supplyAsync(() -> taskQuery.taskId(index.getId()).includeProcessVariables().singleResult(), executor); + Task temp = null; + try { + temp = (Task) tempTask.get(); + } catch (InterruptedException e) { + logger.error("异步获取失败", e); + } catch (ExecutionException e) { + logger.error("异步获取失败", e); + } return temp; - }).collect(Collectors.toList()); + }).filter(Objects::nonNull).collect(Collectors.toList()); + CompletableFuture.allOf(completableFutures.toArray(new CompletableFuture[completableFutures.size()])).join(); return new PageData<>(tasks2TaskDtos(list_), (int) count); // 以下注释为原实现方案 // TaskQuery taskQuery = taskService.createTaskQuery(); From e266885230bd45d37175b056b25a9101e659b0e3 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Sat, 10 Dec 2022 17:03:12 +0800 Subject: [PATCH 2/5] ... --- .../java/io/renren/modules/activiti/service/ActTaskService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java index 39614862..cdef7742 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java @@ -191,8 +191,8 @@ public class ActTaskService extends BaseServiceImpl { List tasks = nativeTaskQuery.listPage((curPage - 1) * limit, limit); long count = nativeCountTaskQuery.count(); List completableFutures = new ArrayList(); + final TaskQuery taskQuery = taskService.createTaskQuery(); List list_ = tasks.stream().map(index -> { - TaskQuery taskQuery = taskService.createTaskQuery(); CompletableFuture tempTask = CompletableFuture.supplyAsync(() -> taskQuery.taskId(index.getId()).includeProcessVariables().singleResult(), executor); Task temp = null; try { From 439ed6aa61cbfcb2ce815a64b9b09f56167b8018 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Sat, 10 Dec 2022 19:59:06 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=94=BF=E5=8A=A1=E4=BA=91=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E5=BC=82=E5=B8=B8=E6=97=B6=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ResourceServiceImpl.java | 197 ++++++++++-------- 1 file changed, 105 insertions(+), 92 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 3d9fc8e0..c8cf9cab 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 @@ -257,29 +257,29 @@ public class ResourceServiceImpl extends CrudServiceImpl getWrapper(Map params) { @@ -761,8 +761,8 @@ public class ResourceServiceImpl extends CrudServiceImpl { HashMap map = (HashMap) this.selectInfrastructureList(); final Long[] total = {0L}; - map.forEach((k,v) -> { - total[0] = total[0] + (Integer) v; + map.forEach((k, v) -> { + total[0] = total[0] + (Integer) v; }); re.add(new HashMap() { { @@ -1444,9 +1444,9 @@ public class ResourceServiceImpl extends CrudServiceImpl> result2; if (Long.parseLong(params.get("id").toString()) == 0) { - result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName,\n" + "SUM(a.visits) AS resourceVisits \n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '组件服务' AND a.del_flag = 0\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n"); + result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName, " + "SUM(a.visits) AS resourceVisits " + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id " + "WHERE a.type = '组件服务' AND a.del_flag = 0 " + "GROUP BY a.dept_id,b.name " + "ORDER BY a.dept_id,b.name "); } else { - result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName,\n" + "SUM(a.visits) AS resourceVisits \n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '组件服务' AND a.del_flag = 0\n" + "AND (b.ID = ? OR INSTR(b.pids,?))\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n", pas); + result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName, " + "SUM(a.visits) AS resourceVisits " + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id " + "WHERE a.type = '组件服务' AND a.del_flag = 0 " + "AND (b.ID = ? OR INSTR(b.pids,?)) " + "GROUP BY a.dept_id,b.name " + "ORDER BY a.dept_id,b.name ", pas); } if (!result2.isEmpty()) { @@ -1524,9 +1524,9 @@ public class ResourceServiceImpl extends CrudServiceImpl> result2; if (Long.parseLong(params.get("id").toString()) == 0) { - result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '应用资源' AND a.del_flag = 0\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n"); + result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName " + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id " + "WHERE a.type = '应用资源' AND a.del_flag = 0 " + "GROUP BY a.dept_id,b.name " + "ORDER BY a.dept_id,b.name "); } else { - result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '应用资源' AND a.del_flag = 0\n" + "AND (b.ID = ? OR b.pids LIKE CONCAT(CONCAT('%',?),'%'))\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n", pas); + result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName " + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id " + "WHERE a.type = '应用资源' AND a.del_flag = 0 " + "AND (b.ID = ? OR b.pids LIKE CONCAT(CONCAT('%',?),'%')) " + "GROUP BY a.dept_id,b.name " + "ORDER BY a.dept_id,b.name ", pas); } if (!result2.isEmpty()) { @@ -1621,9 +1621,9 @@ public class ResourceServiceImpl extends CrudServiceImpl> result2; if (Long.parseLong(params.get("id").toString()) == 0) { - result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '基础设施' AND a.del_flag = 0\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n"); + result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName " + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id " + "WHERE a.type = '基础设施' AND a.del_flag = 0 " + "GROUP BY a.dept_id,b.name " + "ORDER BY a.dept_id,b.name "); } else { - result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '基础设施' AND a.del_flag = 0\n" + "AND (b.ID = ? OR INSTR(b.pids,?))\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n", pas); + result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName " + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id " + "WHERE a.type = '基础设施' AND a.del_flag = 0 " + "AND (b.ID = ? OR INSTR(b.pids,?)) " + "GROUP BY a.dept_id,b.name " + "ORDER BY a.dept_id,b.name ", pas); } if (!result2.isEmpty()) { @@ -1669,9 +1669,9 @@ public class ResourceServiceImpl extends CrudServiceImpl> result2; if (Long.parseLong(params.get("id").toString()) == 0) { - result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '数据资源' AND a.del_flag = 0\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n"); + result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName " + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id " + "WHERE a.type = '数据资源' AND a.del_flag = 0 " + "GROUP BY a.dept_id,b.name " + "ORDER BY a.dept_id,b.name "); } else { - result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '数据资源' AND a.del_flag = 0\n" + "AND (b.ID = ? OR INSTR(b.pids,?))\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n", pas); + result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName " + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id " + "WHERE a.type = '数据资源' AND a.del_flag = 0 " + "AND (b.ID = ? OR INSTR(b.pids,?)) " + "GROUP BY a.dept_id,b.name " + "ORDER BY a.dept_id,b.name ", pas); } @@ -1717,9 +1717,9 @@ public class ResourceServiceImpl extends CrudServiceImpl>> partition = Lists.partition(result, pageSize); @@ -2240,27 +2240,31 @@ public class ResourceServiceImpl extends CrudServiceImpl(); } else { - StringBuilder sb = new StringBuilder("SELECT\n" + - "\tCOUNT( BSNUM ) AS \"count\",\n" + - "\t'yzy' AS \"type\" \n" + - "FROM\n" + - "\tVIEW_CLOUD_BUSINESS_INDEX \n" + - "WHERE\n" + - "\t1 = 1 \n" + - "\tAND ORG_NAME = '"); + StringBuilder sb = new StringBuilder("SELECT " + + " COUNT( BSNUM ) AS \"count\", " + + " 'yzy' AS \"type\" " + + "FROM " + + " VIEW_CLOUD_BUSINESS_INDEX " + + "WHERE " + + " 1 = 1 " + + " AND ORG_NAME = '"); sb.append(lcDept.get("lc_name").toString()) - .append("' UNION ALL\n" + - "SELECT\n" + - "\tCOUNT( BSNUM ) AS \"count\",\n" + - "\t'ysp' AS \"type\" \n" + - "FROM\n" + - "\tVIEW_VIDEO_BUSINESS_INDEX \n" + - "WHERE\n" + - "\t1 = 1 \n" + - "\tAND ORG_NAME = '") + .append("' UNION ALL " + + "SELECT " + + " COUNT( BSNUM ) AS \"count\", " + + " 'ysp' AS \"type\" " + + "FROM " + + " VIEW_VIDEO_BUSINESS_INDEX " + + "WHERE " + + " 1 = 1 " + + " AND ORG_NAME = '") .append(lcDept.get("lc_name").toString()) .append("'"); - zwyCountListByapplyDept.addAll(lcJdbcTemplate.queryForList(sb.toString())); + try { + zwyCountListByapplyDept.addAll(lcJdbcTemplate.queryForList(sb.toString())); + } catch (Exception e) { + logger.error(sb.toString(), e); + } } List> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params); @@ -2299,7 +2303,12 @@ public class ResourceServiceImpl extends CrudServiceImpl> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params); if ("250000".equals(params.get("region").toString())) { - List> zwyCountListByApplyDept = lcJdbcTemplate.queryForList(getAllsql); + List> zwyCountListByApplyDept = new ArrayList<>(); + try { + zwyCountListByApplyDept = lcJdbcTemplate.queryForList(getAllsql); + } catch (Exception e) { + logger.error(getAllsql, e); + } zwyCountListByApplyDept.forEach(x -> { Map ucsDept = sysDeptDao.selectUCSDeptByLCDeptName(x.get("deptName").toString()); @@ -2342,8 +2351,12 @@ public class ResourceServiceImpl extends CrudServiceImpl> zwyCountListByApplyDept = lcJdbcTemplate.queryForList(getAllsql); + List> zwyCountListByApplyDept = new ArrayList<>(); + try { + zwyCountListByApplyDept = lcJdbcTemplate.queryForList(getAllsql); + } catch (Exception e) { + logger.info(getAllsql, e); + } zwyCountListByApplyDept.forEach(x -> { Map ucsDept = sysDeptDao.selectUCSDeptByLCDeptName(x.get("deptName").toString()); @@ -2740,12 +2753,12 @@ public class ResourceServiceImpl extends CrudServiceImpl { - Map map = (Map) x; + Map map = (Map) x; return DateUtils.parse(map.get("createDate").toString(), DateUtils.DATE_TIME_PATTERN); - }).reversed()) + }).reversed()) .skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList()); return new PageData(result, total.intValue()); - } else if ("云资源".equals(params.get("resourceType").toString()) || "云视频".equals(params.get("resourceType").toString())){ + } else if ("云资源".equals(params.get("resourceType").toString()) || "云视频".equals(params.get("resourceType").toString())) { List lcApplyDtoList = lcSelectCensusApplyTable(params); result.addAll(lcApplyDtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList())); return new PageData(result, lcApplyDtoList.size()); @@ -2759,38 +2772,38 @@ public class ResourceServiceImpl extends CrudServiceImpl lcSelectCensusApplyTable(Map params) { - StringBuilder sb = new StringBuilder("SELECT * FROM (\n" + - "SELECT\n" + - "\tvcbi.ORG_NAME AS \"deptName\", bsrel.name AS \"resourceName\", '青岛市大数据发展管理局' AS \"resourceDeptName\",\n" + - "\tbsrel.SOURCE_TYPE AS \"type\", to_char( vcbi.CREATE_TIME, 'yyyy-mm-dd HH24:MI:SS' ) AS \"createDate\",\n" + - "\tvcbi.status AS \"approveStatus\", bsrel.BSNUM AS \"applyNumber\" \n" + - "FROM\n" + - "\t(\n" + - "\t\tSELECT BSNUM, '云主机' AS \"SOURCE_TYPE\", NAME, DISPOSE AS \"INFO\" FROM VIEW_CLOUD_HOST_INFO \n" + - "\t\tUNION ALL\n" + - "\t\tSELECT BSNUM, '云数据库' AS \"SOURCE_TYPE\", NAME, (TYPE || '/' || STORAGE_SPACE || 'GB') AS \"INFO\" FROM VIEW_CLOUD_DATABASE_INFO \n" + - "\t\tUNION ALL\n" + - "\t\tSELECT BSNUM, '对象存储' AS \"SOURCE_TYPE\", NAME, ( DATA_DISK || 'GB' ) AS \"INFO\" FROM VIEW_CLOUD_OBJECTSTORAGE_INFO \n" + - "\t\tUNION ALL\n" + - "\t\tSELECT BSNUM, '托管服务' AS \"SOURCE_TYPE\", NAME, U_NUM AS \"INFO\" FROM VIEW_TRUSTEESHIPSERVICE_INFO\n" + - "\t) bsrel\n" + - "\tLEFT JOIN VIEW_CLOUD_BUSINESS_INDEX vcbi ON bsrel.BSNUM = vcbi.BSNUM \n" + - "WHERE\n" + - "\tvcbi.APPLYTYPE = '01' \n" + - "\tAND vcbi.status IN ( '01', '03', '04', '05', '06', '99' )\n" + - "\tUNION ALL\n" + - "\tSELECT vvbi.ORG_NAME AS \"deptName\", vvbr.name AS \"resourceName\", vvbr.ORG_NAME AS \"resourceDeptName\",\n" + - "\t'云视频' AS \"type\", to_char( vvbi.CREATE_TIME, 'yyyy-mm-dd HH24:MI:SS' ) AS \"createDate\", vvbi.status AS \"approveStatus\", \n" + - "\tvvbr.BSNUM AS \"applyNumber\" \n" + - "FROM\n" + - "\tVIEW_VIDEO_BUSINESS_RELATION vvbr\n" + - "\tLEFT JOIN VIEW_VIDEO_BUSINESS_INDEX vvbi ON vvbr.BSNUM = vvbi.BSNUM \n" + - "WHERE\n" + - "\tvvbi.STATUS != '00'\n" + - "\tAND vvbr.ORG_NAME IS NOT NULL \n" + - "\t) apply \n" + - "\tWHERE 1 = 1\n" + - "\t\n"); + StringBuilder sb = new StringBuilder("SELECT * FROM ( " + + "SELECT " + + " vcbi.ORG_NAME AS \"deptName\", bsrel.name AS \"resourceName\", '青岛市大数据发展管理局' AS \"resourceDeptName\", " + + " bsrel.SOURCE_TYPE AS \"type\", to_char( vcbi.CREATE_TIME, 'yyyy-mm-dd HH24:MI:SS' ) AS \"createDate\", " + + " vcbi.status AS \"approveStatus\", bsrel.BSNUM AS \"applyNumber\" " + + "FROM " + + " ( " + + " SELECT BSNUM, '云主机' AS \"SOURCE_TYPE\", NAME, DISPOSE AS \"INFO\" FROM VIEW_CLOUD_HOST_INFO " + + " UNION ALL " + + " SELECT BSNUM, '云数据库' AS \"SOURCE_TYPE\", NAME, (TYPE || '/' || STORAGE_SPACE || 'GB') AS \"INFO\" FROM VIEW_CLOUD_DATABASE_INFO " + + " UNION ALL " + + " SELECT BSNUM, '对象存储' AS \"SOURCE_TYPE\", NAME, ( DATA_DISK || 'GB' ) AS \"INFO\" FROM VIEW_CLOUD_OBJECTSTORAGE_INFO " + + " UNION ALL " + + " SELECT BSNUM, '托管服务' AS \"SOURCE_TYPE\", NAME, U_NUM AS \"INFO\" FROM VIEW_TRUSTEESHIPSERVICE_INFO " + + " ) bsrel " + + " LEFT JOIN VIEW_CLOUD_BUSINESS_INDEX vcbi ON bsrel.BSNUM = vcbi.BSNUM " + + "WHERE " + + " vcbi.APPLYTYPE = '01' " + + " AND vcbi.status IN ( '01', '03', '04', '05', '06', '99' ) " + + " UNION ALL " + + " SELECT vvbi.ORG_NAME AS \"deptName\", vvbr.name AS \"resourceName\", vvbr.ORG_NAME AS \"resourceDeptName\", " + + " '云视频' AS \"type\", to_char( vvbi.CREATE_TIME, 'yyyy-mm-dd HH24:MI:SS' ) AS \"createDate\", vvbi.status AS \"approveStatus\", " + + " vvbr.BSNUM AS \"applyNumber\" " + + "FROM " + + " VIEW_VIDEO_BUSINESS_RELATION vvbr " + + " LEFT JOIN VIEW_VIDEO_BUSINESS_INDEX vvbi ON vvbr.BSNUM = vvbi.BSNUM " + + "WHERE " + + " vvbi.STATUS != '00' " + + " AND vvbr.ORG_NAME IS NOT NULL " + + " ) apply " + + " WHERE 1 = 1 " + + " "); if (params.get("provideDept") != null) { Map lcDept = sysDeptDao.selectLCDeptByUcsDeptName(params.get("provideDept").toString()); @@ -2802,7 +2815,7 @@ public class ResourceServiceImpl extends CrudServiceImpl deptNames = sysDeptDao.selectLCDeptByRegion((Long)params.get("region")); + List deptNames = sysDeptDao.selectLCDeptByRegion((Long) params.get("region")); logger.error("只查询本区域部门申请,部门列表{}", deptNames); sb.append(" AND apply.\"deptName\" IN ( "); deptNames.forEach(name -> sb.append("'").append(name).append("', ")); From 035575b45d60a7419aa199a5aae1b3b1230ec863 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Sat, 10 Dec 2022 20:18:14 +0800 Subject: [PATCH 4/5] npe --- .../modules/resource/service/impl/ResourceServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 c8cf9cab..7fd3489e 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,7 +2808,10 @@ public class ResourceServiceImpl extends CrudServiceImpl lcDept = sysDeptDao.selectLCDeptByUcsDeptName(params.get("provideDept").toString()); - if (lcDept.isEmpty() || org.apache.commons.lang3.StringUtils.isBlank(lcDept.get("lc_name").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()); return new ArrayList<>(); } From 5c83bfa1da203702f74bf6351376a2ebda5ca201 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Sat, 10 Dec 2022 20:28:46 +0800 Subject: [PATCH 5/5] 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"));