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