diff --git a/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/project/service/PmsLinkIssuesAsyncCommentService.java b/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/project/service/PmsLinkIssuesAsyncCommentService.java index ac03e43fc..0a9d1282d 100644 --- a/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/project/service/PmsLinkIssuesAsyncCommentService.java +++ b/microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/project/service/PmsLinkIssuesAsyncCommentService.java @@ -72,13 +72,13 @@ public class PmsLinkIssuesAsyncCommentService { SimpleRepository simpleRepository = pmsProjectIssuesService.getSimpleRepository(pmsRepoIssueLinkProjectIssuesVo.getProjectRepositoryId()); // 处理需求阶段评论 - handleCommentIfNeeded(!requirementCommented, requirementCreated, "本疑修已纳入需求", issueId, simpleRepository); + requirementCommented = handleCommentIfNeeded(requirementCommented, requirementCreated, "本疑修已纳入需求", issueId, simpleRepository); // 处理开发阶段评论 - handleCommentIfNeeded(!developmentCommented, developmentCreated, "本疑修正在开发中", issueId, simpleRepository); + developmentCommented = handleCommentIfNeeded(developmentCommented, developmentCreated, "本疑修正在开发中", issueId, simpleRepository); // 处理测试阶段评论 - handleCommentIfNeeded(!testingCommented, testingCreated, "本疑修正在测试中", issueId, simpleRepository); + testingCommented = handleCommentIfNeeded(testingCommented, testingCreated, "本疑修正在测试中", issueId, simpleRepository); // 更新评论状态记录 updateCommentRecordIfNecessary(requirementCommented, issueId, PmsIssueTransformationCommentType.REQUIREMENT); @@ -89,8 +89,8 @@ public class PmsLinkIssuesAsyncCommentService { /** * 如果需要,则添加评论 */ - private void handleCommentIfNeeded(boolean shouldComment, boolean isCreated, String note, Long issueId, SimpleRepository simpleRepository) { - if (shouldComment && isCreated) { + private boolean handleCommentIfNeeded(boolean isComment, boolean isCreated, String note, Long issueId, SimpleRepository simpleRepository) { + if (!isComment && isCreated) { JSONObject journalsJson = new JSONObject(); journalsJson.put("notes", note); gitLinkRequestHelper.doPost( @@ -99,14 +99,16 @@ public class PmsLinkIssuesAsyncCommentService { simpleRepository.getRepoIdentifier()), journalsJson ); + return true; } + return false; } /** * 如有必要,更新评论记录状态 */ private void updateCommentRecordIfNecessary(boolean commented, Long issueId, PmsIssueTransformationCommentType type) { - if (!commented) { + if (commented) { PmsIssueTransformationCommentRecord update = new PmsIssueTransformationCommentRecord(); update.setGitlinkIssueId(issueId); update.setCommentType(type.getKey());