use of io.choerodon.agile.api.vo.ProjectVO in project agile-service by open-hand.
the class SendMsgUtil method sendMsgByIssueComment.
@Async
public void sendMsgByIssueComment(Long projectId, IssueDetailDTO issueDTO, IssueCommentVO issueCommentVO, Long operatorId) {
IssueVO issueVO = modelMapper.map(issueDTO, IssueVO.class);
Map<Long, String> actionMap = new HashMap<>(3);
String url;
String issueType;
ProjectVO projectVO = getProjectVO(projectId, ERROR_PROJECT_NOTEXIST);
if ("feature".equals(issueVO.getTypeCode())) {
issueType = "特性";
url = getFeatureUrl(issueVO, projectVO, issueVO.getIssueId()) + URL_TEMPLATE8;
} else {
issueType = IssueConstant.ISSUE_CN;
url = getIssueUrl(issueVO, projectVO, issueVO.getIssueId()) + URL_TEMPLATE8;
}
// 设置动作与发送人
List<Long> userIds = noticeService.queryUserIdsByProjectId(projectId, "ISSUE_COMMENT", issueVO);
setIssueCommentMessageActionAndUser(actionMap, issueCommentVO.getUserId(), issueVO, projectVO, userIds);
String summary = String.join("-", issueVO.getIssueNum(), issueVO.getSummary());
String comment = Optional.ofNullable(issueCommentVO.getCommentText()).map(SendMsgUtil::getText).orElse("无");
if (CollectionUtils.isNotEmpty(actionMap.keySet())) {
siteMsgUtil.sendIssueComment(actionMap, projectVO, summary, url, comment, issueCommentVO, issueType, operatorId);
}
}
use of io.choerodon.agile.api.vo.ProjectVO in project agile-service by open-hand.
the class SendMsgUtil method generateIssueResolvSender.
public MessageSender generateIssueResolvSender(Long projectId, Set<String> fieldList, IssueDTO issue, Long operatorId) {
IssueVO result = modelMapper.map(issue, IssueVO.class);
Boolean completed = issueStatusMapper.selectByStatusId(projectId, result.getStatusId()).getCompleted();
if ((Objects.nonNull(fieldList) && !fieldList.contains(STATUS_ID)) || completed == null || !completed || result.getAssigneeId() == null || !SchemeApplyType.AGILE.equals(result.getApplyType())) {
return null;
}
List<Long> userIds = noticeService.queryUserIdsByProjectId(projectId, ISSUE_SOLVE, result);
ProjectVO projectVO = getProjectVO(projectId, ERROR_PROJECT_NOTEXIST);
StringBuilder url = new StringBuilder();
if (SUB_TASK.equals(result.getTypeCode())) {
url.append(getIssueUrl(result, projectVO, result.getParentIssueId()));
} else {
url.append(getIssueUrl(result, projectVO, result.getIssueId()));
}
String userName = queryUserName(result.getAssigneeId());
String summary = result.getIssueNum() + "-" + result.getSummary();
return siteMsgUtil.issueSolveSender(userIds, userName, summary, url.toString(), projectId, getOperatorNameFromUserDetail(), operatorId);
}
use of io.choerodon.agile.api.vo.ProjectVO in project agile-service by open-hand.
the class SendMsgUtil method sendMsgByIssueCreate.
@Async
public void sendMsgByIssueCreate(Long projectId, IssueVO result, Long operatorId) {
// 发送消息
if (checkApplyType(result.getApplyType())) {
List<Long> userIds = noticeService.queryUserIdsByProjectId(projectId, ISSUE_CREATE, result);
String summary = result.getIssueNum() + "-" + result.getSummary();
String reporterName = result.getReporterName();
ProjectVO projectVO = getProjectVO(projectId, ERROR_PROJECT_NOTEXIST);
String url = getIssueUrl(result, projectVO, result.getIssueId());
siteMsgUtil.issueCreate(userIds, reporterName, summary, url, operatorId, projectId, false);
if (result.getAssigneeId() != null) {
List<Long> assigneeIds = new ArrayList<>();
assigneeIds.add(result.getAssigneeId());
siteMsgUtil.issueAssignee(assigneeIds, result.getAssigneeName(), summary, url, projectId, reporterName, operatorId);
}
if (CollectionUtils.isNotEmpty(result.getParticipants())) {
List<Long> sendUserIds = noticeService.queryUserIdsByProjectId(projectId, ISSUE_SET_PARTICIPANT, result);
List<Long> participantIds = result.getParticipants().stream().map(UserMessageDTO::getId).collect(Collectors.toList());
siteMsgUtil.issueParticipant(summary, url, projectId, operatorId, sendUserIds, reporterName, participantIds);
}
}
}
use of io.choerodon.agile.api.vo.ProjectVO in project agile-service by open-hand.
the class SendMsgUtil method sendMsgByIssueComplete.
@Async
public void sendMsgByIssueComplete(Long projectId, List<String> fieldList, IssueVO result, Long operatorId) {
Boolean completed = issueStatusMapper.selectByStatusId(projectId, result.getStatusId()).getCompleted();
if (fieldList.contains(STATUS_ID) && completed != null && completed && result.getAssigneeId() != null && checkApplyType(result.getApplyType())) {
List<Long> userIds = noticeService.queryUserIdsByProjectId(projectId, ISSUE_SOLVE, result);
ProjectVO projectVO = getProjectVO(projectId, ERROR_PROJECT_NOTEXIST);
StringBuilder url = new StringBuilder();
if (SUB_TASK.equals(result.getTypeCode())) {
url.append(getIssueUrl(result, projectVO, result.getParentIssueId()));
} else {
url.append(getIssueUrl(result, projectVO, result.getIssueId()));
}
String userName = result.getAssigneeName();
String summary = result.getIssueNum() + "-" + result.getSummary();
siteMsgUtil.issueSolve(userIds, userName, summary, url.toString(), projectId, getOperatorNameFromUserDetail(), operatorId);
}
}
use of io.choerodon.agile.api.vo.ProjectVO in project agile-service by open-hand.
the class SendMsgUtil method generateIssueAsigneeSender.
public MessageSender generateIssueAsigneeSender(Long projectId, Set<String> fieldList, IssueDTO issue, Long operatorId) {
if (!SchemeApplyType.AGILE.equals(issue.getApplyType())) {
return null;
}
if (Objects.isNull(issue.getAssigneeId())) {
return null;
}
if (Objects.nonNull(fieldList) && !fieldList.contains("assigneeId")) {
return null;
}
IssueVO result = modelMapper.map(issue, IssueVO.class);
String summary = result.getIssueNum() + "-" + result.getSummary();
String reporterName = queryUserName(result.getReporterId());
String assigneeName = queryUserName(result.getAssigneeId());
ProjectVO projectVO = getProjectVO(projectId, ERROR_PROJECT_NOTEXIST);
String url = getIssueUrl(result, projectVO, result.getIssueId());
return siteMsgUtil.issueAssigneeSender(Collections.singletonList(result.getAssigneeId()), assigneeName, summary, url, projectId, reporterName, operatorId);
}
Aggregations