添加日志
parent
dc9e8b02e2
commit
fdb4fb810d
|
@ -435,16 +435,12 @@ public class ModuleServiceImpl implements ModuleService {
|
|||
log.info("rootGroups:{}", JSON.toJSONString(rootGroups));
|
||||
log.info("context:{}", JSON.toJSONString(context));
|
||||
|
||||
//用countDownLatch是为了加快速度
|
||||
CountDownLatch countDownLatch = new CountDownLatch(rootGroups.size());
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
for (ModuleGroup rootGroup : rootGroups) {
|
||||
//获取每个模型的所有实例总数
|
||||
getInstaceCount(rootGroup, resultMap, countDownLatch, context.getTarget());
|
||||
getInstaceCount(rootGroup, resultMap, context.getTarget());
|
||||
}
|
||||
countDownLatch.await();
|
||||
|
||||
//查询云主机总数
|
||||
Pager pager = new Pager();
|
||||
|
@ -471,18 +467,14 @@ public class ModuleServiceImpl implements ModuleService {
|
|||
}
|
||||
}
|
||||
|
||||
private void getInstaceCount(ModuleGroup rootGroup, Map<String, Object> resultMap, CountDownLatch countDownLatch, Long userId) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
log.info("rootGroup:{}",JSON.toJSONString(rootGroup));
|
||||
private void getInstaceCount(ModuleGroup rootGroup, Map<String, Object> resultMap, Long userId) throws Exception {
|
||||
log.info("rootGroup:{}", JSON.toJSONString(rootGroup));
|
||||
//获取当前ModuleGroup下所有的modle
|
||||
Pager pager = new Pager();
|
||||
GeneralResult<GridBean<CiModule>> modelList = getModelList(pager);
|
||||
if (modelList.isFailed()) {
|
||||
log.info("modelList:{}", JSON.toJSONString(modelList));
|
||||
countDownLatch.countDown();
|
||||
throw new Exception("查询实例失败");
|
||||
return;
|
||||
}
|
||||
Integer total = 0;
|
||||
|
@ -497,16 +489,10 @@ public class ModuleServiceImpl implements ModuleService {
|
|||
paramList.add(param);
|
||||
boolean adminRole = instanceService.checkAdminRole(userId);
|
||||
int count = instanceRepository.count(paramList, table, valueTable, userId, adminRole);
|
||||
log.info("count:{}",count);
|
||||
total+=count;
|
||||
log.info("count:{}", count);
|
||||
total += count;
|
||||
}
|
||||
resultMap.put(rootGroup.getCode(), total);
|
||||
} catch (Exception e) {
|
||||
log.info("查询失败", e);
|
||||
}
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private GeneralResult baseModifyProperty(Long moduleId, List<PropertyGroup> groups, List<Property> properties,
|
||||
|
|
Loading…
Reference in New Issue