|
|
@@ -159,7 +159,8 @@ public class AccuracyStatisticsServiceImpl implements IAccuracyStatisticsService
|
|
159
|
159
|
/**
|
|
160
|
160
|
* 初始化部门缓存
|
|
161
|
161
|
*/
|
|
162
|
|
- private DeptCache initDeptCache() {
|
|
|
162
|
+ @Override
|
|
|
163
|
+ public void initDeptCache() {
|
|
163
|
164
|
DeptCache cache = DEPT_CACHE.get();
|
|
164
|
165
|
if (cache == null) {
|
|
165
|
166
|
long start = System.currentTimeMillis();
|
|
|
@@ -168,13 +169,13 @@ public class AccuracyStatisticsServiceImpl implements IAccuracyStatisticsService
|
|
168
|
169
|
DEPT_CACHE.set(cache);
|
|
169
|
170
|
log.info("initDeptCache: loaded {} depts in {}ms", allDepts.size(), System.currentTimeMillis() - start);
|
|
170
|
171
|
}
|
|
171
|
|
- return cache;
|
|
172
|
172
|
}
|
|
173
|
173
|
|
|
174
|
174
|
/**
|
|
175
|
175
|
* 清理缓存
|
|
176
|
176
|
*/
|
|
177
|
|
- private void clearDeptCache() {
|
|
|
177
|
+ @Override
|
|
|
178
|
+ public void clearDeptCache() {
|
|
178
|
179
|
DEPT_CACHE.remove();
|
|
179
|
180
|
}
|
|
180
|
181
|
|
|
|
@@ -1253,7 +1254,8 @@ public class AccuracyStatisticsServiceImpl implements IAccuracyStatisticsService
|
|
1253
|
1254
|
result.setName(sysUser.getNickName());
|
|
1254
|
1255
|
result.setType(HomePageQueryEnum.USER.getCode());
|
|
1255
|
1256
|
} else {
|
|
1256
|
|
- SysDept sysDept = deptService.selectDeptById(dto.getDeptId());
|
|
|
1257
|
+ DeptCache cache = getDeptCache();
|
|
|
1258
|
+ SysDept sysDept = cache != null ? cache.deptMap.get(dto.getDeptId()) : deptService.selectDeptById(dto.getDeptId());
|
|
1257
|
1259
|
if (ObjectUtil.isNull(sysDept)) {
|
|
1258
|
1260
|
throw new ServiceException("【" + dto.getDeptId() + "】部门不存在");
|
|
1259
|
1261
|
}
|
|
|
@@ -1332,12 +1334,13 @@ public class AccuracyStatisticsServiceImpl implements IAccuracyStatisticsService
|
|
1332
|
1334
|
}
|
|
1333
|
1335
|
} else if (ObjectUtil.isNotNull(dto.getDeptId())) {
|
|
1334
|
1336
|
// 部门维度:获取部门下所有用户的正确率
|
|
1335
|
|
- SysDept sysDept = deptService.selectDeptById(dto.getDeptId());
|
|
|
1337
|
+ DeptCache cache = getDeptCache();
|
|
|
1338
|
+ SysDept sysDept = cache != null ? cache.deptMap.get(dto.getDeptId()) : deptService.selectDeptById(dto.getDeptId());
|
|
1336
|
1339
|
if (sysDept == null) {
|
|
1337
|
1340
|
return result;
|
|
1338
|
1341
|
}
|
|
1339
|
1342
|
|
|
1340
|
|
- DeptHierarchy hierarchy = getDeptHierarchy(dto.getDeptId());
|
|
|
1343
|
+ DeptHierarchy hierarchy = getDeptHierarchyCached(dto.getDeptId());
|
|
1341
|
1344
|
List<Long> teamIds = getTeamIdsUnderDept(dto.getDeptId(), hierarchy);
|
|
1342
|
1345
|
|
|
1343
|
1346
|
if (teamIds.isEmpty()) {
|