use of io.choerodon.agile.infra.dto.IssueCommentDTO in project agile-service by open-hand.
the class IssueCommentServiceImpl method deleteIssueCommentReply.
@Override
public void deleteIssueCommentReply(Long projectId, Long commentId, boolean self) {
IssueCommentDTO issueCommentDTO = getCommentById(projectId, commentId);
if (self && !DetailsHelper.getUserDetails().getUserId().equals(issueCommentDTO.getUserId())) {
throw new CommonException("error.created.user.illegal");
}
iIssueCommentService.deleteBaseReply(issueCommentDTO);
}
use of io.choerodon.agile.infra.dto.IssueCommentDTO in project agile-service by open-hand.
the class IssueCommentServiceImpl method updateIssueComment.
@Override
public IssueCommentVO updateIssueComment(IssueCommentUpdateVO issueCommentUpdateVO, List<String> fieldList, Long projectId) {
if (fieldList != null && !fieldList.isEmpty()) {
IssueCommentDTO issueCommentDTO = issueCommentAssembler.toTarget(issueCommentUpdateVO, IssueCommentDTO.class);
iIssueCommentService.updateBase(issueCommentDTO, fieldList.toArray(new String[fieldList.size()]));
IssueCommentVO issueCommentVO = queryByProjectIdAndCommentId(projectId, issueCommentDTO.getCommentId());
IssueDetailDTO issue = issueMapper.queryIssueDetail(projectId, issueCommentVO.getIssueId());
Long operatorId = DetailsHelper.getUserDetails().getUserId();
if (issueCommentVO.getReplyToUserId() == null || issueCommentVO.getReplyToUserId() == 0L) {
sendMsgUtil.sendMsgByIssueComment(projectId, issue, issueCommentVO, operatorId);
} else if (!issueCommentVO.getReplyToUserId().equals(operatorId)) {
sendMsgUtil.sendMsgByIssueCommentReply(projectId, issue, issueCommentVO, operatorId);
}
return issueCommentVO;
} else {
return null;
}
}
use of io.choerodon.agile.infra.dto.IssueCommentDTO in project agile-service by open-hand.
the class IIssueCommentServiceImpl method deleteBase.
@Override
@DataLog(type = "deleteComment")
public int deleteBase(IssueCommentDTO issueCommentDTO) {
int isDelete = issueCommentMapper.delete(issueCommentDTO);
if (isDelete != 1) {
throw new CommonException(DELETE_ERROR);
}
IssueCommentDTO childRecord = new IssueCommentDTO();
childRecord.setParentId(issueCommentDTO.getCommentId());
childRecord.setIssueId(issueCommentDTO.getIssueId());
childRecord.setProjectId(issueCommentDTO.getProjectId());
IssueCommentDTO firstReply = issueCommentMapper.selectOne(childRecord);
if (!ObjectUtils.isEmpty(firstReply)) {
firstReply.setParentId(0L);
firstReply.setReplyToUserId(0L);
issueCommentMapper.updateByPrimaryKeySelective(firstReply);
issueCommentMapper.updateChildNewParent(issueCommentDTO.getProjectId(), issueCommentDTO.getCommentId(), firstReply.getCommentId());
}
BaseFieldUtil.updateIssueLastUpdateInfo(issueCommentDTO.getIssueId(), issueCommentDTO.getProjectId());
return isDelete;
}
use of io.choerodon.agile.infra.dto.IssueCommentDTO in project agile-service by open-hand.
the class IssueCommentValidator method verifyUpdateData.
public void verifyUpdateData(Long projectId, JSONObject issueCommentUpdate, boolean self) {
if (issueCommentUpdate.get(COMMENT_ID) == null) {
throw new CommonException("error.IssueCommentRule.commentId");
}
IssueCommentDTO issueCommentDTO = new IssueCommentDTO();
issueCommentDTO.setCommentId(EncryptionUtils.decrypt(issueCommentUpdate.get(COMMENT_ID).toString(), EncryptionUtils.BLANK_KEY));
issueCommentDTO.setProjectId(projectId);
IssueCommentDTO originIssueComment = issueCommentMapper.selectByPrimaryKey(issueCommentDTO);
if (originIssueComment == null) {
throw new CommonException("error.IssueCommentRule.issueComment");
}
if (self && !DetailsHelper.getUserDetails().getUserId().equals(originIssueComment.getUserId())) {
throw new CommonException("error.created.user.illegal");
}
}
use of io.choerodon.agile.infra.dto.IssueCommentDTO in project agile-service by open-hand.
the class IIssueCommentServiceImpl method deleteBaseReply.
@Override
@DataLog(type = "deleteCommentReply")
public void deleteBaseReply(IssueCommentDTO issueCommentDTO) {
int isDelete = issueCommentMapper.delete(issueCommentDTO);
if (isDelete != 1) {
throw new CommonException(DELETE_ERROR);
}
IssueCommentDTO childRecord = new IssueCommentDTO();
childRecord.setIssueId(issueCommentDTO.getIssueId());
childRecord.setProjectId(issueCommentDTO.getProjectId());
childRecord.setParentId(issueCommentDTO.getCommentId());
issueCommentMapper.delete(childRecord);
BaseFieldUtil.updateIssueLastUpdateInfo(issueCommentDTO.getIssueId(), issueCommentDTO.getProjectId());
}
Aggregations