update 优化一些性能问题

This commit is contained in:
疯狂的狮子Li
2026-04-01 10:13:42 +08:00
parent d11990bfd8
commit 568547ada5
5 changed files with 16 additions and 12 deletions

View File

@@ -10,11 +10,11 @@ import org.apache.fesod.sheet.metadata.GlobalConfiguration;
import org.apache.fesod.sheet.metadata.data.ReadCellData;
import org.apache.fesod.sheet.metadata.data.WriteCellData;
import org.apache.fesod.sheet.metadata.property.ExcelContentProperty;
import org.dromara.common.core.utils.SpringUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.core.utils.TreeBuildUtils;
import org.dromara.system.domain.bo.SysDeptBo;
import org.dromara.system.service.ISysDeptService;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
@@ -26,7 +26,6 @@ import java.util.concurrent.TimeUnit;
* @author AprilWind
*/
@RequiredArgsConstructor
@Component
public class DeptExcelConverter implements Converter<Long> {
private static final String CACHE_KEY = "dept:excel";
@@ -38,9 +37,8 @@ public class DeptExcelConverter implements Converter<Long> {
.expireAfterWrite(30, TimeUnit.SECONDS)
.build();
private final ISysDeptService deptService;
private DeptMaps getDeptMaps() {
ISysDeptService deptService = SpringUtils.getBean(ISysDeptService.class);
return DEPT_CACHE.get(CACHE_KEY, k -> {
Map<String, Tree<Long>> deptPathToTreeMap = buildDeptPathMap(deptService);
Map<Long, String> idToName = new HashMap<>();

View File

@@ -1,9 +1,9 @@
package org.dromara.system.listener;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.utils.SpringUtils;
import org.dromara.common.excel.core.ExcelOptionsProvider;
import org.dromara.system.service.ISysDeptService;
import org.springframework.stereotype.Component;
import java.util.Set;
@@ -13,11 +13,8 @@ import java.util.Set;
* @author AprilWind
*/
@RequiredArgsConstructor
@Component
public class DeptExcelOptions implements ExcelOptionsProvider {
private final ISysDeptService deptService;
/**
* 获取下拉选项数据
*
@@ -25,6 +22,7 @@ public class DeptExcelOptions implements ExcelOptionsProvider {
*/
@Override
public Set<String> getOptions() {
ISysDeptService deptService = SpringUtils.getBean(ISysDeptService.class);
return DeptExcelConverter.buildDeptPathMap(deptService).keySet();
}