Search in sources :

Example 16 with ProjectVO

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);
    }
}
Also used : IssueVO(io.choerodon.agile.api.vo.business.IssueVO) ProjectVO(io.choerodon.agile.api.vo.ProjectVO) Async(org.springframework.scheduling.annotation.Async)

Example 17 with ProjectVO

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);
}
Also used : IssueVO(io.choerodon.agile.api.vo.business.IssueVO) ProjectVO(io.choerodon.agile.api.vo.ProjectVO)

Example 18 with ProjectVO

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);
        }
    }
}
Also used : ProjectVO(io.choerodon.agile.api.vo.ProjectVO) Async(org.springframework.scheduling.annotation.Async)

Example 19 with ProjectVO

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);
    }
}
Also used : ProjectVO(io.choerodon.agile.api.vo.ProjectVO) Async(org.springframework.scheduling.annotation.Async)

Example 20 with ProjectVO

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);
}
Also used : IssueVO(io.choerodon.agile.api.vo.business.IssueVO) ProjectVO(io.choerodon.agile.api.vo.ProjectVO)

Aggregations

ProjectVO (io.choerodon.agile.api.vo.ProjectVO)31 Async (org.springframework.scheduling.annotation.Async)11 IssueVO (io.choerodon.agile.api.vo.business.IssueVO)7 CommonException (io.choerodon.core.exception.CommonException)6 MessageSender (org.hzero.boot.message.entity.MessageSender)6 ArrayList (java.util.ArrayList)4 UserMessageDTO (io.choerodon.agile.infra.dto.UserMessageDTO)3 BaseFeignClient (io.choerodon.agile.infra.feign.BaseFeignClient)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 IssueTypeSearchVO (io.choerodon.agile.api.vo.IssueTypeSearchVO)1 IssueTypeVO (io.choerodon.agile.api.vo.IssueTypeVO)1 ProjectRelationshipVO (io.choerodon.agile.api.vo.ProjectRelationshipVO)1 StateMachineSchemeVO (io.choerodon.agile.api.vo.StateMachineSchemeVO)1 StatusMachineNodeVO (io.choerodon.agile.api.vo.StatusMachineNodeVO)1 StatusMachineSchemeConfigVO (io.choerodon.agile.api.vo.StatusMachineSchemeConfigVO)1 WorkItemSearchVO (io.choerodon.agile.api.vo.WorkItemSearchVO)1 WorkItemVO (io.choerodon.agile.api.vo.WorkItemVO)1 RuleLogRelVO (io.choerodon.agile.api.vo.business.RuleLogRelVO)1 ProjectEvent (io.choerodon.agile.api.vo.event.ProjectEvent)1