Commit eb9c3c09 authored by 黎博's avatar 黎博

新增删除dingrobot接口以及获取未解决BUG列表接口

parent 55047d3a
......@@ -142,4 +142,20 @@ public class PipelineController {
return JsonResult.buildSuccessResult(pipelineService.saveOrUpdateBatch(pipelineList));
}
/**
* 删除pipeline
* @param dingRobotId
* @return
*/
@Transactional
@GetMapping("/delete")
public JsonResult deletePipeline(@RequestParam Integer dingRobotId) {
if (dingRobotService.getById(dingRobotId) != null) {
dingRobotService.removeById(dingRobotId);
}
QueryWrapper<Pipeline> pipelineQueryWrapper = new QueryWrapper<>();
pipelineQueryWrapper.eq("ding_robot_id", dingRobotId);
return JsonResult.buildSuccessResult(pipelineService.remove(pipelineQueryWrapper));
}
}
......@@ -175,4 +175,36 @@ public class JiraController {
String markdownMsg = DingdingUtils.buildSmokingResultMarkdownMsg(issues, sendSmokingResultVo.getResult(), sendSmokingResultVo.getRisk());
return JsonResult.buildSuccessResult(DingdingUtils.sendToDingding(markdownMsg, sendSmokingResultVo.getWebhook()));
}
/**
* 根据JIRA项目名称和项目关键字获取未解决BUG
* @param jiraProjectKey
* @param projectName
* @return
* @throws Exception
*/
@GetMapping("/issue/list")
public JsonResult getUnsolvedByProject(@RequestParam String jiraProjectKey,
@RequestParam String projectName,
@RequestParam boolean unsolved) throws Exception {
String JQL = null;
if (!unsolved) {
JQL = "project = " + jiraProjectKey + " AND text ~ \"" + projectName + "\" ORDER BY priority DESC, updated DESC";
} else {
JQL = "project = " + jiraProjectKey + " AND resolution = Unresolved AND text ~ \"" + projectName + "\" ORDER BY priority DESC, updated DESC";
}
Iterable<Issue> issues = jiraIssueService.getIssueListByJQL(JQL);
List<Map<String, Object>> mapList = new ArrayList<>();
for (Issue issue: issues) {
Map<String, Object> map = new HashMap<>();
map.put("key", issue.getKey());
map.put("summary", issue.getSummary());
map.put("reporter", issue.getReporter().getDisplayName());
map.put("assignee", issue.getAssignee().getDisplayName());
map.put("priority", issue.getPriority().getName());
map.put("status", issue.getStatus().getName());
mapList.add(map);
}
return JsonResult.buildSuccessResult(mapList);
}
}
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