use of io.choerodon.agile.infra.dto.UserMessageDTO in project agile-service by open-hand.
the class SendMsgUtil method sendMsgByIssueMoveComplete.
@Async
public void sendMsgByIssueMoveComplete(Long projectId, IssueMoveVO issueMoveVO, IssueDTO issueDTO, Long operatorId) {
// 发送消息
Boolean completed = issueStatusMapper.selectByStatusId(projectId, issueMoveVO.getStatusId()).getCompleted();
if (completed != null && completed && issueDTO.getAssigneeId() != null && SchemeApplyType.AGILE.equals(issueDTO.getApplyType())) {
List<Long> userIds = noticeService.queryUserIdsByProjectId(projectId, ISSUE_SOLVE, modelMapper.map(issueDTO, IssueVO.class));
ProjectVO projectVO = getProjectVO(projectId, ERROR_PROJECT_NOTEXIST);
StringBuilder url = new StringBuilder();
ProjectInfoDTO projectInfoDTO = new ProjectInfoDTO();
projectInfoDTO.setProjectId(projectId);
List<ProjectInfoDTO> pioList = projectInfoMapper.select(projectInfoDTO);
ProjectInfoDTO pio = null;
if (pioList != null && !pioList.isEmpty()) {
pio = pioList.get(0);
}
String pioCode = (pio == null ? "" : pio.getProjectCode());
issueDTO.setIssueNum(pioCode + "-" + issueDTO.getIssueNum());
IssueVO issueVO = modelMapper.map(issueDTO, IssueVO.class);
if (SUB_TASK.equals(issueDTO.getTypeCode())) {
url.append(getIssueUrl(issueVO, projectVO, issueVO.getParentIssueId()));
} else {
url.append(getIssueUrl(issueVO, projectVO, issueVO.getIssueId()));
}
String summary = issueDTO.getIssueNum() + "-" + issueDTO.getSummary();
List<Long> assigneeIds = new ArrayList<>();
assigneeIds.add(issueDTO.getAssigneeId());
Map<Long, UserMessageDTO> usersMap = userService.queryUsersMap(assigneeIds, true);
String userName = Optional.ofNullable(usersMap.get(issueDTO.getAssigneeId())).map(UserMessageDTO::getName).orElse("");
siteMsgUtil.issueSolve(userIds, userName, summary, url.toString(), projectId, getOperatorNameFromUserDetail(), operatorId);
}
}
use of io.choerodon.agile.infra.dto.UserMessageDTO in project agile-service by open-hand.
the class IssueLinkAssembler method issueLinkDTOToVO.
public List<IssueLinkVO> issueLinkDTOToVO(Long projectId, List<IssueLinkDTO> issueLinkDTOList) {
List<IssueLinkVO> issueLinkVOList = new ArrayList<>(issueLinkDTOList.size());
if (!issueLinkDTOList.isEmpty()) {
Map<Long, IssueTypeVO> issueTypeDTOMap = issueTypeService.listIssueTypeMap(ConvertUtil.getOrganizationId(projectId), projectId);
Map<Long, StatusVO> statusMapDTOMap = ConvertUtil.getIssueStatusMap(projectId);
Map<Long, PriorityVO> priorityDTOMap = ConvertUtil.getIssuePriorityMap(projectId);
List<Long> assigneeIds = issueLinkDTOList.stream().filter(issue -> issue.getAssigneeId() != null && !Objects.equals(issue.getAssigneeId(), 0L)).map(IssueLinkDTO::getAssigneeId).distinct().collect(Collectors.toList());
Map<Long, UserMessageDTO> usersMap = userService.queryUsersMap(assigneeIds, true);
issueLinkDTOList.forEach(issueLinkDO -> {
String assigneeName = usersMap.get(issueLinkDO.getAssigneeId()) != null ? usersMap.get(issueLinkDO.getAssigneeId()).getName() : null;
String imageUrl = assigneeName != null ? usersMap.get(issueLinkDO.getAssigneeId()).getImageUrl() : null;
IssueLinkVO issueLinkVO = new IssueLinkVO();
BeanUtils.copyProperties(issueLinkDO, issueLinkVO);
issueLinkVO.setIssueTypeVO(issueTypeDTOMap.get(issueLinkDO.getIssueTypeId()));
issueLinkVO.setStatusVO(statusMapDTOMap.get(issueLinkDO.getStatusId()));
issueLinkVO.setPriorityVO(priorityDTOMap.get(issueLinkDO.getPriorityId()));
issueLinkVO.setAssigneeName(assigneeName);
issueLinkVO.setImageUrl(imageUrl);
issueLinkVOList.add(issueLinkVO);
});
}
return issueLinkVOList;
}
use of io.choerodon.agile.infra.dto.UserMessageDTO in project agile-service by open-hand.
the class IssueSearchAssembler method dtoListToVO.
public List<IssueSearchVO> dtoListToVO(List<IssueSearchDTO> issueSearchDTOList, Map<Long, UserMessageDTO> usersMap, Map<Long, PriorityVO> priorityMap, Map<Long, StatusVO> statusMapDTOMap, Map<Long, IssueTypeVO> issueTypeDTOMap) {
if (issueSearchDTOList != null && !issueSearchDTOList.isEmpty()) {
List<IssueSearchVO> issueSearchVOList = new ArrayList<>(issueSearchDTOList.size());
issueSearchDTOList.forEach(issueSearch -> {
UserMessageDTO userMessageDTO = usersMap.get(issueSearch.getAssigneeId());
String assigneeName = userMessageDTO != null ? userMessageDTO.getName() : null;
String imageUrl = assigneeName != null ? userMessageDTO.getImageUrl() : null;
String assigneeLoginName = userMessageDTO != null ? userMessageDTO.getLoginName() : null;
String assigneeRealName = userMessageDTO != null ? userMessageDTO.getRealName() : null;
issueSearch.setAssigneeName(assigneeName);
issueSearch.setImageUrl(imageUrl);
issueSearch.setAssigneeLoginName(assigneeLoginName);
issueSearch.setAssigneeRealName(assigneeRealName);
issueSearch.setPriorityVO(priorityMap.get(issueSearch.getPriorityId()));
issueSearch.setStatusVO(statusMapDTOMap.get(issueSearch.getStatusId()));
issueSearch.setIssueTypeVO(issueTypeDTOMap.get(issueSearch.getIssueTypeId()));
issueSearchVOList.add(toTarget(issueSearch, IssueSearchVO.class));
});
return issueSearchVOList;
} else {
return new ArrayList<>();
}
}
use of io.choerodon.agile.infra.dto.UserMessageDTO in project agile-service by open-hand.
the class NoticeMessageAssembler method messageDTOToVO.
public List<MessageVO> messageDTOToVO(List<MessageDTO> messageDTOList, List<Long> ids) {
List<MessageVO> messageVOList = new ArrayList<>(messageDTOList.size());
Map<Long, UserMessageDTO> usersMap = userService.queryUsersMap(ids, true);
messageDTOList.forEach(messageDTO -> {
List<IdWithNameVO> idWithNameVOList = new ArrayList<>();
Boolean checkUser = messageDTO.getEnable() && messageDTO.getUser() != null && messageDTO.getUser().length() != 0 && !"null".equals(messageDTO.getUser());
if (Boolean.TRUE.equals(checkUser)) {
String[] strs = messageDTO.getUser().split(",");
for (String str : strs) {
Long id = Long.parseLong(str);
if (usersMap.get(id) != null) {
idWithNameVOList.add(new IdWithNameVO(id, usersMap.get(id).getName()));
}
}
}
MessageVO messageVO = new MessageVO();
BeanUtils.copyProperties(messageDTO, messageVO);
messageVO.setIdWithNameVOList(idWithNameVOList);
messageVOList.add(messageVO);
});
return messageVOList;
}
use of io.choerodon.agile.infra.dto.UserMessageDTO in project agile-service by open-hand.
the class FieldPermissionServiceImpl method processPermissionGroupByField.
private Map<Long, List<PermissionVO>> processPermissionGroupByField(Map<Long, Map<String, Map<String, Set<Long>>>> multiKeyMap, Map<Long, UserMessageDTO> userMap, Map<Long, RoleVO> roleMap) {
Map<Long, List<PermissionVO>> resultMap = new HashMap<>();
multiKeyMap.forEach((fieldId, map) -> {
List<PermissionVO> permissionList = resultMap.computeIfAbsent(fieldId, x -> new ArrayList<>());
map.forEach((permission, map1) -> {
PermissionVO vo = new PermissionVO();
permissionList.add(vo);
vo.setScope(permission);
Set<Long> userIds = map1.computeIfAbsent(USER, x -> new HashSet<>());
Set<Long> roleIds = map1.computeIfAbsent(ROLE, x -> new HashSet<>());
List<Long> userIdList = new ArrayList<>(userIds);
List<Long> roleIdList = new ArrayList<>(roleIds);
userIdList.sort(Long::compareTo);
roleIdList.sort(Long::compareTo);
List<UserMessageDTO> userList = new ArrayList<>();
List<RoleVO> roleList = new ArrayList<>();
vo.setUserList(userList);
vo.setRoleList(roleList);
userIdList.forEach(x -> {
UserMessageDTO user = userMap.get(x);
if (user != null) {
userList.add(user);
}
});
roleIdList.forEach(x -> {
RoleVO role = roleMap.get(x);
if (role != null) {
roleList.add(role);
}
});
});
});
return resultMap;
}
Aggregations