mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-02 12:09:13 +08:00
fix(资源池): 修复资源池容量显示不正确问题
--bug=1048002 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001048002
This commit is contained in:
parent
53982f7bee
commit
fd83f2d362
@ -36,6 +36,10 @@
|
||||
and t.create_user in
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||
</when>
|
||||
<when test="key=='type'">
|
||||
and t.type in
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||
</when>
|
||||
<when test="key=='orgId'">
|
||||
and t.id in (
|
||||
select tpo.test_resource_pool_id from test_resource_pool_organization tpo where tpo.org_id in
|
||||
|
@ -300,26 +300,33 @@ public class TestResourcePoolService {
|
||||
ResourcePoolNodeMetric resourcePoolNodeMetric = new ResourcePoolNodeMetric();
|
||||
TestResourcePool testResourcePool = testResourcePoolMapper.selectByPrimaryKey(request.getPoolId());
|
||||
if (testResourcePool == null || !testResourcePool.getEnable() || testResourcePool.getDeleted()) {
|
||||
return null;
|
||||
return new ResourcePoolNodeMetric();
|
||||
}
|
||||
TestResourcePoolBlob testResourcePoolBlob = testResourcePoolBlobMapper.selectByPrimaryKey(request.getPoolId());
|
||||
byte[] configuration = testResourcePoolBlob.getConfiguration();
|
||||
String testResourceDTOStr = new String(configuration);
|
||||
TestResourceDTO testResourceDTO = JSON.parseObject(testResourceDTOStr, TestResourceDTO.class);
|
||||
if (CollectionUtils.isEmpty(testResourceDTO.getNodesList())) {
|
||||
return new ResourcePoolNodeMetric();
|
||||
}
|
||||
if (StringUtils.isBlank(request.getIp())) {
|
||||
TestResourcePoolBlob testResourcePoolBlob = testResourcePoolBlobMapper.selectByPrimaryKey(request.getPoolId());
|
||||
byte[] configuration = testResourcePoolBlob.getConfiguration();
|
||||
String testResourceDTOStr = new String(configuration);
|
||||
TestResourceDTO testResourceDTO = JSON.parseObject(testResourceDTOStr, TestResourceDTO.class);
|
||||
if (CollectionUtils.isNotEmpty(testResourceDTO.getNodesList())) {
|
||||
int concurrentNumber = 0;
|
||||
int occupiedConcurrentNumber = 0;
|
||||
for (TestResourceNodeDTO testResourceNodeDTO : testResourceDTO.getNodesList()) {
|
||||
ResourcePoolNodeMetric nodeMetric = getNodeMetric(testResourceNodeDTO.getIp(), testResourceNodeDTO.getPort());
|
||||
concurrentNumber = concurrentNumber + testResourceNodeDTO.getConcurrentNumber();
|
||||
occupiedConcurrentNumber = occupiedConcurrentNumber + nodeMetric.getOccupiedConcurrentNumber();
|
||||
}
|
||||
resourcePoolNodeMetric.setConcurrentNumber(concurrentNumber);
|
||||
resourcePoolNodeMetric.setOccupiedConcurrentNumber(occupiedConcurrentNumber);
|
||||
int concurrentNumber = 0;
|
||||
int occupiedConcurrentNumber = 0;
|
||||
for (TestResourceNodeDTO testResourceNodeDTO : testResourceDTO.getNodesList()) {
|
||||
ResourcePoolNodeMetric nodeMetric = getNodeMetric(testResourceNodeDTO.getIp(), testResourceNodeDTO.getPort());
|
||||
concurrentNumber = concurrentNumber + testResourceNodeDTO.getConcurrentNumber();
|
||||
occupiedConcurrentNumber = occupiedConcurrentNumber + nodeMetric.getOccupiedConcurrentNumber();
|
||||
}
|
||||
resourcePoolNodeMetric.setConcurrentNumber(concurrentNumber);
|
||||
resourcePoolNodeMetric.setOccupiedConcurrentNumber(occupiedConcurrentNumber);
|
||||
} else {
|
||||
resourcePoolNodeMetric = getNodeMetric(request.getIp(), request.getPort());
|
||||
for (TestResourceNodeDTO testResourceNodeDTO : testResourceDTO.getNodesList()) {
|
||||
if (StringUtils.equals(testResourceNodeDTO.getIp(), request.getIp()) && StringUtils.equals(testResourceNodeDTO.getPort(), request.getPort())) {
|
||||
resourcePoolNodeMetric.setConcurrentNumber(testResourceDTO.getConcurrentNumber());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return resourcePoolNodeMetric;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user