Commit 405a430e authored by 赵啸非's avatar 赵啸非

添加产品资源枚举类

parent 4431edb0
...@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.File;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -49,13 +50,13 @@ public class CheckProjectStatusTaskImpl implements ITaskExcuteService { ...@@ -49,13 +50,13 @@ public class CheckProjectStatusTaskImpl implements ITaskExcuteService {
NacosResponse nacosResponse = JSON.parseObject(resp, new TypeReference<NacosResponse>() { NacosResponse nacosResponse = JSON.parseObject(resp, new TypeReference<NacosResponse>() {
}); });
int count = nacosResponse.getCount(); int count = nacosResponse.getCount();
if(count>0){ if (count > 0) {
ListItem item = nacosResponse.getList().get(0); ListItem item = nacosResponse.getList().get(0);
String serviceName = item.getServiceName(); String serviceName = item.getServiceName();
boolean healthy = item.isHealthy(); boolean healthy = item.isHealthy();
if(healthy){ if (healthy) {
setupProjectEntity.setProjectStatus(ProjectStatusEnum.运行.getValue()); setupProjectEntity.setProjectStatus(ProjectStatusEnum.运行.getValue());
}else { } else {
setupProjectEntity.setProjectStatus(ProjectStatusEnum.停止.getValue()); setupProjectEntity.setProjectStatus(ProjectStatusEnum.停止.getValue());
} }
setupProjectEntity.setUpdateTime(new Date()); setupProjectEntity.setUpdateTime(new Date());
...@@ -65,7 +66,19 @@ public class CheckProjectStatusTaskImpl implements ITaskExcuteService { ...@@ -65,7 +66,19 @@ public class CheckProjectStatusTaskImpl implements ITaskExcuteService {
log.info("服务实例详细查询url:{},返回:{},naocsResponse:{}", serverUrl, resp, JSON.toJSONString(nacosResponse)); log.info("服务实例详细查询url:{},返回:{},naocsResponse:{}", serverUrl, resp, JSON.toJSONString(nacosResponse));
} else if (ProjectTypeEnum.前端.getValue() == setupProjectEntity.getProjectType()) { } else if (ProjectTypeEnum.前端.getValue() == setupProjectEntity.getProjectType()) {
//todo //todo 前端 判断路径文件是否存在 如果存在 则代表运行
String projectPath = setupProjectEntity.getProjectPath();
String projectCode = setupProjectEntity.getProjectCode();
String destPath = projectPath + File.separator + projectCode + File.separator + "dist" + File.separator + "index.html";
File uiFile = new File(destPath);
if (uiFile.exists()) {
setupProjectEntity.setProjectStatus(ProjectStatusEnum.运行.getValue());
setupProjectEntity.setUpdateTime(new Date());
setupProjectService.update(setupProjectEntity);
}
log.info("前端资源路径:{},是否存在:{}", destPath, uiFile.exists());
} else {
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment