Commit f1825a5b authored by 黎博's avatar 黎博

新增BUG不存在的兼容处理

parent 93d6b618
...@@ -14,6 +14,6 @@ public interface JiraIssueService { ...@@ -14,6 +14,6 @@ public interface JiraIssueService {
Integer calculateBugFixTime(DateTime startDate, DateTime endDate); Integer calculateBugFixTime(DateTime startDate, DateTime endDate);
Issue getJiraIssueByKey(String key) throws Exception; Issue getJiraIssueByKey(String key);
} }
...@@ -76,8 +76,14 @@ public class JiraIssueServiceImpl implements JiraIssueService { ...@@ -76,8 +76,14 @@ public class JiraIssueServiceImpl implements JiraIssueService {
} }
@Override @Override
public Issue getJiraIssueByKey(String key) throws Exception { public Issue getJiraIssueByKey(String key) {
return jiraRestClient.getIssueClient().getIssue(key).get(); try {
Issue issue = jiraRestClient.getIssueClient().getIssue(key).get();
return issue;
} catch (Exception e) {
e.printStackTrace();
return null;
}
} }
/** /**
......
...@@ -13,7 +13,6 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -13,7 +13,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -64,6 +63,7 @@ public class JiraToDingding { ...@@ -64,6 +63,7 @@ public class JiraToDingding {
List<JiraBugPool> jiraBugPoolList = jiraBugPoolService.list(jiraBugPoolQueryWrapper); List<JiraBugPool> jiraBugPoolList = jiraBugPoolService.list(jiraBugPoolQueryWrapper);
for (JiraBugPool jiraBugPool: jiraBugPoolList) { for (JiraBugPool jiraBugPool: jiraBugPoolList) {
Issue issue = jiraIssueService.getJiraIssueByKey(jiraBugPool.getKey()); Issue issue = jiraIssueService.getJiraIssueByKey(jiraBugPool.getKey());
if (issue != null) {
String resolveResult = issue.getStatus().getName(); String resolveResult = issue.getStatus().getName();
// 如果已解决或已关闭,仅修改状态 // 如果已解决或已关闭,仅修改状态
if (resolveResult.equals("已解决") || resolveResult.equals("关闭")) { if (resolveResult.equals("已解决") || resolveResult.equals("关闭")) {
...@@ -80,6 +80,10 @@ public class JiraToDingding { ...@@ -80,6 +80,10 @@ public class JiraToDingding {
DingdingUtils.sendToDingding(DingdingUtils.buildBugFixRemindMsg(issue, duration), jiraBugPool.getDingUrl()); DingdingUtils.sendToDingding(DingdingUtils.buildBugFixRemindMsg(issue, duration), jiraBugPool.getDingUrl());
} }
} }
} else {
log.info("JIRA上未找到该issue,将BUG: {} 置为无效", jiraBugPool.getKey());
jiraBugPool.setEnable(0);
}
} }
} }
} }
......
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