/** * タスク担当者を返す * * @param taskId タスクID * @return タスク担当者のリスト */ public static List<ProjectTaskMemberResultData> getProjectTaskMembers(String taskId) { List<ProjectTaskMemberResultData> members = new ArrayList<ProjectTaskMemberResultData>(); try { SelectQuery<EipTProjectTaskMember> query = Database.query(EipTProjectTaskMember.class); query.setQualifier( ExpressionFactory.matchExp(EipTProjectTaskMember.EIP_TPROJECT_TASK_PROPERTY, taskId)); query.orderAscending(EipTProjectTaskMember.USER_ID_PROPERTY); List<EipTProjectTaskMember> list = query.fetchList(); for (EipTProjectTaskMember member : list) { ALEipUser user = ALEipUtils.getALEipUser(member.getUserId()); ProjectTaskMemberResultData data = new ProjectTaskMemberResultData(); data.initField(); data.setUserId(user.getUserId().getValue()); data.setUserName(user.getAliasName().getValue()); BigDecimal workload = new BigDecimal(df.format(member.getWorkload())); data.setWorkload(workload); members.add(data); } } catch (Exception ex) { logger.error("Exception", ex); } return members; }
/** * タスク担当者へ通知メールを送る * * @param taskId タスクID * @return 成否 */ public static boolean sendMailForTaskMembers( RunData rundata, Context context, EipTProjectTask task, EipTProject project, List<ProjectTaskMemberResultData> mailUserList) { String orgId = Database.getDomainName(); String subject = "[" + ALOrgUtilsService.getAlias() + "]" + ALLocalizationUtils.getl10n("PROJECT_MAIL_TITLE"); try { List<ALEipUser> memberList = new ArrayList<ALEipUser>(); for (ProjectTaskMemberResultData rd : mailUserList) { memberList.add(ALEipUtils.getALEipUser(rd.getUserId().getValueWithInt())); } List<ALEipUserAddr> destMemberList = ALMailUtils.getALEipUserAddrs(memberList, ALEipUtils.getUserId(rundata), false); List<ALAdminMailMessage> messageList = new ArrayList<ALAdminMailMessage>(); for (ALEipUserAddr destMember : destMemberList) { ALAdminMailMessage message = new ALAdminMailMessage(destMember); message.setPcSubject(subject); message.setCellularSubject(subject); message.setPcBody(createTaskMemberMsg(rundata, message.getPcMailAddr(), task, project)); message.setCellularBody( createTaskMemberMsg(rundata, message.getCellMailAddr(), task, project)); messageList.add(message); } ALMailService.sendAdminMailAsync( new ALAdminMailContext( orgId, ALEipUtils.getUserId(rundata), messageList, ALMailUtils.getSendDestType(ALMailUtils.KEY_MSGTYPE_WORKFLOW))); } catch (Exception ex) { logger.error("project", ex); return false; } return true; }