|
|
@@ -13,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author reghao
|
|
|
@@ -58,8 +59,18 @@ public class MachineHostServiceImpl implements MachineHostService {
|
|
|
MachineHost machineHost = machineHostRepository.findByMachineId(machineId);
|
|
|
List<AppDeployConfig> list = appDeployConfigRepository.findByMachineHost(machineHost);
|
|
|
if (!list.isEmpty()) {
|
|
|
- String msg = "还有应用部署在当前机器上";
|
|
|
- return Result.result(ResultStatus.FAIL, msg);
|
|
|
+ List<String> apps = list.stream()
|
|
|
+ .map(appDeployConfig -> appDeployConfig.getAppConfig().getAppId())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ for (int i = 0; i < Math.min(3, list.size()); i++) {
|
|
|
+ sb.append(apps.get(i)).append(",");
|
|
|
+ }
|
|
|
+
|
|
|
+ String msg = sb.toString();
|
|
|
+ String errMsg = String.format("还有 %s 等应用部署在当前机器上", msg.substring(0, msg.length()-1));
|
|
|
+ return Result.result(ResultStatus.FAIL, errMsg);
|
|
|
}
|
|
|
|
|
|
if (machineService.isAgentOnline(machineId)) {
|