use of io.choerodon.agile.infra.dto.UserMessageDTO in project agile-service by open-hand.
the class SendMsgUtil method getOperatorNameFromUserDetail.
private String getOperatorNameFromUserDetail() {
CustomUserDetails userDetails = DetailsHelper.getUserDetails();
if (ObjectUtils.isEmpty(userDetails)) {
throw new CommonException("error.user.not.login");
}
Long userId = userDetails.getUserId();
Map<Long, UserMessageDTO> userMap = userService.queryUsersMap(Arrays.asList(userId), true);
UserMessageDTO user = userMap.get(userId);
if (ObjectUtils.isEmpty(user)) {
return null;
} else {
return user.getName();
}
}
use of io.choerodon.agile.infra.dto.UserMessageDTO in project agile-service by open-hand.
the class SendMsgUtil method noticeIssueStatus.
@Async
public void noticeIssueStatus(Long projectId, Set<Long> userSet, List<String> noticeTypeList, IssueDTO issueDTO, CustomUserDetails userDetails) {
boolean onlyWebHook = CollectionUtils.isNotEmpty(noticeTypeList) && noticeTypeList.size() == 1 && noticeTypeList.contains("WEB_HOOK");
if (!onlyWebHook && CollectionUtils.isEmpty(userSet)) {
return;
}
Map<String, String> templateArgsMap = new HashMap<>();
// 设置经办人
Long[] ids = new Long[3];
ids[0] = issueDTO.getAssigneeId();
ids[1] = userDetails.getUserId();
ids[2] = issueDTO.getReporterId();
Map<Long, UserMessageDTO> usersMap = userService.queryUsersMap(Arrays.asList(ids), true);
ProjectVO projectVO = getProjectVO(projectId, ERROR_PROJECT_NOTEXIST);
Boolean isProgram = Objects.equals(issueDTO.getApplyType(), "program");
String actionType = Boolean.TRUE.equals(isProgram) ? "报告的" : "经办的";
UserMessageDTO assignee = Boolean.TRUE.equals(isProgram) ? usersMap.get(issueDTO.getReporterId()) : usersMap.get(issueDTO.getAssigneeId());
String assigneeName = !Objects.isNull(assignee) ? assignee.getName() : "";
// 设置概要
String summary = projectVO.getCode() + "-" + issueDTO.getIssueNum() + "-" + issueDTO.getSummary();
// 设置操作人
UserMessageDTO operator = usersMap.get(userDetails.getUserId());
String operatorName = !Objects.isNull(operator) ? operator.getName() : "";
// 设置状态
String status = ConvertUtil.getIssueStatusMap(projectId).get(issueDTO.getStatusId()).getName();
// 设置url
String url;
IssueVO issueVO = modelMapper.map(issueDTO, IssueVO.class);
if (isProgram) {
url = getFeatureUrl(issueVO, projectVO, issueDTO.getIssueId());
} else {
url = getIssueUrl(issueVO, projectVO, issueDTO.getIssueId());
}
templateArgsMap.put("actionType", Objects.equals("", assigneeName) ? "" : actionType);
templateArgsMap.put("assigneeName", assigneeName);
templateArgsMap.put("summary", summary);
templateArgsMap.put("operatorName", operatorName);
templateArgsMap.put("status", status);
templateArgsMap.put("url", url);
templateArgsMap.put("link", domainUrl + "/" + url);
siteMsgUtil.sendChangeIssueStatus(projectId, userSet, noticeTypeList, templateArgsMap, userDetails.getUserId(), onlyWebHook);
}
use of io.choerodon.agile.infra.dto.UserMessageDTO in project agile-service by open-hand.
the class TeamPerformanceServiceImpl method querySprintStoryPoint.
@Override
public List<SprintStoryPointVO> querySprintStoryPoint(Long projectId) {
List<SprintStoryPointVO> sprintStoryPoints = teamPerformanceMapper.querySprintStoryPoints(projectId);
BigDecimal sumStoryPoints = new BigDecimal(0);
BigDecimal sumStoryPointsComplete = new BigDecimal(0);
List<Long> mainResponsibleIds = new ArrayList<>();
for (SprintStoryPointVO sprintStoryPoint : sprintStoryPoints) {
if (Objects.nonNull(sprintStoryPoint)) {
sumStoryPoints = DataUtil.add(sumStoryPoints, sprintStoryPoint.getStoryPoints());
sumStoryPointsComplete = DataUtil.add(sumStoryPointsComplete, sprintStoryPoint.getStoryPointsComplete());
Long mainResponsibleId = sprintStoryPoint.getMainResponsibleId();
if (Objects.nonNull(mainResponsibleId)) {
mainResponsibleIds.add(mainResponsibleId);
}
}
}
Map<Long, UserMessageDTO> usersMap = userService.queryUsersMap(mainResponsibleIds, true);
for (SprintStoryPointVO sprintStoryPoint : sprintStoryPoints) {
handleUser(sprintStoryPoint, usersMap);
handleMainRate(sumStoryPoints, sumStoryPointsComplete, sprintStoryPoint);
}
return sprintStoryPoints;
}
use of io.choerodon.agile.infra.dto.UserMessageDTO in project agile-service by open-hand.
the class TeamPerformanceServiceImpl method handleUser.
private void handleUser(SprintStoryPointVO sprintStoryPointVO, Map<Long, UserMessageDTO> usersMap) {
UserMessageDTO mainResponsible = usersMap.get(sprintStoryPointVO.getMainResponsibleId());
if (Objects.isNull(mainResponsible)) {
return;
}
sprintStoryPointVO.setLoginName(mainResponsible.getLoginName());
sprintStoryPointVO.setRealName(mainResponsible.getRealName());
sprintStoryPointVO.setName(new StringBuilder().append(mainResponsible.getRealName()).append(LEFT_PARENTHESIS).append(mainResponsible.getLoginName()).append(RIGHT_PARENTHESIS).toString());
}
use of io.choerodon.agile.infra.dto.UserMessageDTO in project agile-service by open-hand.
the class TeamPerformanceServiceImpl method querySprintTaskTime.
@Override
public List<SprintTaskVO> querySprintTaskTime(Long projectId) {
List<SprintTaskVO> sprintTasks = teamPerformanceMapper.querySprintTaskTime(projectId);
BigDecimal sumRemainingTime = new BigDecimal(0);
BigDecimal remainingTimeComplete = new BigDecimal(0);
List<Long> mainResponsibleIds = new ArrayList<>();
for (SprintTaskVO sprintTask : sprintTasks) {
if (Objects.nonNull(sprintTask)) {
sumRemainingTime = DataUtil.add(sumRemainingTime, sprintTask.getRemainingTime());
remainingTimeComplete = DataUtil.add(remainingTimeComplete, sprintTask.getRemainingTimeComplete());
Long mainResponsibleId = sprintTask.getMainResponsibleId();
if (Objects.nonNull(mainResponsibleId)) {
mainResponsibleIds.add(mainResponsibleId);
}
}
}
Map<Long, UserMessageDTO> usersMap = userService.queryUsersMap(ListUtil.filterByKey(mainResponsibleIds, 0L), true);
for (SprintTaskVO sprintTask : sprintTasks) {
handleUser(sprintTask, usersMap.get(sprintTask.getMainResponsibleId()));
handleMainRate(sumRemainingTime, remainingTimeComplete, sprintTask);
}
return sprintTasks;
}
Aggregations