| @@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.*; | |||||
| import javax.annotation.Resource; | import javax.annotation.Resource; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.util.HashMap; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -126,8 +127,8 @@ public class ServiceController extends BaseController { | |||||
| @GetMapping("/getServiceVersionLog") | @GetMapping("/getServiceVersionLog") | ||||
| @ApiOperation("获取服务版本日志") | @ApiOperation("获取服务版本日志") | ||||
| public GenericsAjaxResult<String> getServiceVersionLog(@RequestParam("id") Long id, | |||||
| @RequestParam("start_time") String startTime, @RequestParam("end_time") String endTime) { | |||||
| public GenericsAjaxResult<HashMap<String, String>> getServiceVersionLog(@RequestParam("id") Long id, | |||||
| @RequestParam("start_time") String startTime, @RequestParam("end_time") String endTime) { | |||||
| return genericsSuccess(serviceService.getServiceVersionLog(id, startTime, endTime)); | return genericsSuccess(serviceService.getServiceVersionLog(id, startTime, endTime)); | ||||
| } | } | ||||
| @@ -7,6 +7,7 @@ import org.springframework.data.domain.Page; | |||||
| import org.springframework.data.domain.PageRequest; | import org.springframework.data.domain.PageRequest; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.util.HashMap; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -37,7 +38,7 @@ public interface ServiceService { | |||||
| String updateServiceVersion(ServiceVersion serviceVersion); | String updateServiceVersion(ServiceVersion serviceVersion); | ||||
| String getServiceVersionLog(Long id, String startTime, String endTime); | |||||
| HashMap<String, String> getServiceVersionLog(Long id, String startTime, String endTime); | |||||
| Map<String, Object> getServiceVersionDocs(Long id); | Map<String, Object> getServiceVersionDocs(Long id); | ||||
| @@ -265,7 +265,7 @@ public class ServiceServiceImpl implements ServiceService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public String getServiceVersionLog(Long id, String startTime, String endTime) { | |||||
| public HashMap<String, String> getServiceVersionLog(Long id, String startTime, String endTime) { | |||||
| ServiceVersion serviceVersion = serviceDao.getServiceVersionById(id); | ServiceVersion serviceVersion = serviceDao.getServiceVersionById(id); | ||||
| HashMap<String, Object> paramMap = new HashMap<>(); | HashMap<String, Object> paramMap = new HashMap<>(); | ||||
| paramMap.put("deployment_name", serviceVersion.getDeploymentName()); | paramMap.put("deployment_name", serviceVersion.getDeploymentName()); | ||||
| @@ -274,8 +274,14 @@ public class ServiceServiceImpl implements ServiceService { | |||||
| String req = HttpUtils.sendPost(argoUrl + modelService + "/getLog", JSON.toJSONString(paramMap)); | String req = HttpUtils.sendPost(argoUrl + modelService + "/getLog", JSON.toJSONString(paramMap)); | ||||
| if (StringUtils.isNotEmpty(req)) { | if (StringUtils.isNotEmpty(req)) { | ||||
| Map<String, Object> reqMap = JacksonUtil.parseJSONStr2Map(req); | Map<String, Object> reqMap = JacksonUtil.parseJSONStr2Map(req); | ||||
| HashMap<String, String> data = (HashMap<String, String>) reqMap.get("data"); | |||||
| return data.get("log_content"); | |||||
| if (reqMap.get("code") != null && "200".equals(reqMap.get("code"))) { | |||||
| HashMap<String, String> data = (HashMap<String, String>) reqMap.get("data"); | |||||
| data.put("start_time", data.get("end_time")); | |||||
| data.put("end_time", endTime); | |||||
| return data; | |||||
| } else { | |||||
| throw new RuntimeException("获取日志失败"); | |||||
| } | |||||
| } else { | } else { | ||||
| throw new RuntimeException("获取日志失败"); | throw new RuntimeException("获取日志失败"); | ||||
| } | } | ||||