Merge pull request '社区疑修关联工作项自动评论问题修复' (#980) from wanjia9506/microservices:dev_issues_transform into master

This commit is contained in:
wanjia9506 2025-08-11 11:01:22 +08:00
commit 6c0e3c4dd0
1 changed files with 8 additions and 6 deletions

View File

@ -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());