Browse Source

开发服务功能

dev-lhz
chenzhihang 1 year ago
parent
commit
a5edd4cda1
1 changed files with 7 additions and 9 deletions
  1. +7
    -9
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ServiceServiceImpl.java

+ 7
- 9
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ServiceServiceImpl.java View File

@@ -192,7 +192,6 @@ public class ServiceServiceImpl implements ServiceService {
@Override
public String runServiceVersion(Long id) {
ServiceVersion serviceVersion = serviceDao.getServiceVersionById(id);
ServiceVersionVo serviceVersionVo = getServiceVersionVo(serviceVersion);
com.ruoyi.platform.domain.Service service = serviceDao.getServiceById(serviceVersion.getServiceId());
HashMap<String, Object> paramMap = new HashMap<>();
paramMap.put("service_name", service.getServiceName());
@@ -210,11 +209,11 @@ public class ServiceServiceImpl implements ServiceService {
Map<String, Object> reqMap = JacksonUtil.parseJSONStr2Map(req);
if ((Integer) reqMap.get("code") == 200) {
Map<String, String> data = (Map<String, String>) reqMap.get("data");
serviceVersionVo.setUrl(data.get("url"));
serviceVersionVo.setDeploymentName(data.get("deployment_name"));
serviceVersionVo.setSvcName(data.get("svc_name"));
serviceVersionVo.setRunState(Constant.Init);
editServiceVersion(serviceVersionVo);
serviceVersion.setUrl(data.get("url"));
serviceVersion.setDeploymentName(data.get("deployment_name"));
serviceVersion.setSvcName(data.get("svc_name"));
serviceVersion.setRunState(Constant.Init);
serviceDao.updateServiceVersion(serviceVersion);
return "启动成功";
} else {
throw new RuntimeException("启动失败");
@@ -227,13 +226,12 @@ public class ServiceServiceImpl implements ServiceService {
@Override
public String stopServiceVersion(Long id) {
ServiceVersion serviceVersion = serviceDao.getServiceVersionById(id);
ServiceVersionVo serviceVersionVo = getServiceVersionVo(serviceVersion);
HashMap<String, Object> paramMap = new HashMap<>();
paramMap.put("deployment_name", serviceVersion.getDeploymentName());
String req = HttpUtils.sendPost(argoUrl + modelService + "/stop", JSON.toJSONString(paramMap));
if (StringUtils.isNotEmpty(req)) {
serviceVersionVo.setRunState(Constant.Stopped);
editServiceVersion(serviceVersionVo);
serviceVersion.setRunState(Constant.Stopped);
serviceDao.updateServiceVersion(serviceVersion);
return "停止成功";
} else {
throw new RuntimeException("停止失败");


Loading…
Cancel
Save