diff --git a/src/main/java/net/educoder/ecsonar/controller/CloudBrainController.java b/src/main/java/net/educoder/ecsonar/controller/CloudBrainController.java index 951243d..1a24c9d 100644 --- a/src/main/java/net/educoder/ecsonar/controller/CloudBrainController.java +++ b/src/main/java/net/educoder/ecsonar/controller/CloudBrainController.java @@ -8,6 +8,7 @@ import net.educoder.ecsonar.model.vo.*; import net.educoder.ecsonar.services.CloudBrainService; import net.educoder.ecsonar.utils.ResponseResult; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -69,6 +70,12 @@ public class CloudBrainController { */ @GetMapping(value = "/issues/search") public ResponseResult issuesSearch(IssuesSearchVO searchVO) { + if (StringUtils.isBlank(searchVO.getTaskName())) { + return ResponseResult.error("taskName不能为空"); + } + if (StringUtils.isBlank(searchVO.getType())) { + return ResponseResult.error("type不能为空"); + } List result = cloudBrainService.issuesSearch(searchVO); return ResponseResult.success(result); } diff --git a/src/main/java/net/educoder/ecsonar/services/CloudBrainService.java b/src/main/java/net/educoder/ecsonar/services/CloudBrainService.java index ba7497a..6ebf78b 100644 --- a/src/main/java/net/educoder/ecsonar/services/CloudBrainService.java +++ b/src/main/java/net/educoder/ecsonar/services/CloudBrainService.java @@ -213,7 +213,7 @@ public class CloudBrainService { IssuesVO vo = new IssuesVO(); vo.setComponent(issueObj.getString("component")); - vo.setLine(issueObj.getInteger("line")); + vo.setLine(issueObj.getIntValue("line")); vo.setMessage(issueObj.getString("message")); vo.setSeverity(issueObj.getString("severity")); vo.setStatus(issueObj.getString("status")); @@ -223,6 +223,7 @@ public class CloudBrainService { return issuesVOS; } + /** * 获取问题源代码 *