コード例 #1
0
  /**
   * Obtains my interviews with the specified status.
   *
   * @param status
   * @return
   */
  private PaginationSupport<ModelHrmJobHireInterview> getMyInterviewsByStatus(
      Integer[] status, PagingBean pagingBean) throws Exception {
    ModelAppUser user = ContextUtil.getCurrentUser();
    if (user != null) {
      try {
        return this.serviceHrmJobHireInterview.getPaginationByInterviewerAndStatus(
            user.getId(), status, pagingBean);
      } catch (ServiceException e) {
        LOGGER.error("Exception raised when obtaining the interview with owner and status.", e);

        throw new Exception(e);
      }
    } else {
      throw new Exception("用户Session不存在, 请登录后再进行操作.");
    }
  }
コード例 #2
0
  /**
   * <b>[WebAction]</b> <br>
   * 消息详细页面
   */
  public ActionForward dialogMessagePage(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    String msgId = request.getParameter("msgId");

    if (UtilString.isNotEmpty(msgId)) {
      if (this.isObjectIdValid(msgId)) {
        try {
          ModelShortMessage entity = this.serviceShortMessage.get(msgId);
          if (entity != null) {
            String msgInId = request.getParameter("msgInId");
            if (UtilString.isNotEmpty(msgInId)) {
              if (this.isObjectIdValid(msgInId)) {
                ModelInMessage msgIn = this.serviceInMessage.get(msgInId);
                if (msgIn == null) {
                  return ajaxPrint(response, getErrorCallback("消息不存在或者已删除..."));
                } else {
                  if (msgIn.getReadFlag().equals(ModelInMessage.FLAG_UNREAD)) {
                    msgIn.setReadFlag(ModelInMessage.FLAG_READ);
                    this.serviceInMessage.save(msgIn);

                    ModelAppUser user = this.serviceAppUser.get(String.valueOf(msgIn.getUserId()));
                    if (user != null) {
                      // 消息推送, 减少消息提醒数量
                      this.messagePush.pushMessage(
                          user.getEmployeeId(),
                          WebActionUtil.scriptMessageNotify,
                          WebActionUtil.scriptArgMessageKey,
                          -1);
                    }
                  }
                }
              } else {
                return ajaxPrint(response, getErrorCallback("需传入合法的接收消息Id..."));
              }
            }

            request.setAttribute("entity", entity);

            // 回复动作.
            String action = request.getParameter("op");
            if (UtilString.isNotEmpty(action) && "reply".equalsIgnoreCase(action)) {
              request.setAttribute("reply", true);

              ModelHrmEmployee employee =
                  this.serviceHrmEmployee.get(String.valueOf(entity.getSenderId()));
              if (employee != null) {
                StringBuilder receiver = new StringBuilder();
                receiver.append("[");
                receiver.append(
                    "{\"id\":\""
                        + employee.getId()
                        + "\", \"empName\":\""
                        + employee.getEmpName()
                        + "\", \"empNo\":\""
                        + employee.getEmpNo()
                        + "\"}");
                receiver.append("]");
                request.setAttribute("receiver", receiver.toString());
              }
            }
          } else {
            return ajaxPrint(response, getErrorCallback("消息(id:" + msgId + ")不存在..."));
          }
        } catch (Exception e) {
          LOGGER.error("Exception raised when open the dialog page of message.", e);
          return ajaxPrint(response, getErrorCallback("页面加载失败:" + e.getMessage()));
        }
      } else {
        return ajaxPrint(response, getErrorCallback("您传入的消息Id不合法..."));
      }

      request.setAttribute("msgId", msgId);
    } else {

      // 填充短消息内容...
      String msgSubject = request.getParameter("msubject");
      if (UtilString.isNotEmpty(msgSubject)) {
        if (msgSubject.indexOf("msg.subject.conference") == -1) {
          request.setAttribute("subject", this.getMessageFromResource(request, msgSubject, null));
        } else {
          String conferenceName = null;
          String mid = request.getParameter("mid");
          if (this.isObjectIdValid(mid)) {
            try {
              ModelConference conference = this.serviceConference.get(mid);
              if (conference != null) {
                conferenceName = conference.getConferenceName();

                ModelHrmEmployee employee = conference.getSponsor().getEmployee();

                StringBuilder receiver = new StringBuilder();
                receiver.append("[");
                receiver.append(
                    "{\"id\":\""
                        + employee.getId()
                        + "\", \"empName\":\""
                        + employee.getEmpName()
                        + "\", \"empNo\":\""
                        + employee.getEmpNo()
                        + "\"}");

                // Temporary solution and it should be enhanced in the future.
                // (Regarding to the entity field not defined employee object).
                List<ModelHrmEmployee> contractor =
                    this.serviceHrmEmployee.findByFullName(conference.getContactor());
                if (contractor != null && contractor.size() > 0) {
                  receiver.append(",");
                  receiver.append(
                      "{\"id\":\""
                          + contractor.get(0).getId()
                          + "\", \"empName\":\""
                          + contractor.get(0).getEmpName()
                          + "\"}");
                  receiver.append("]");
                } else {
                  receiver.append("]");
                }

                request.setAttribute("receiver", receiver.toString());
              }
            } catch (Exception e) {
              LOGGER.error("Exception raised when fetching conference object.", e);
            }
          }

          request.setAttribute(
              "subject",
              this.getMessageFromResource(
                  request,
                  msgSubject,
                  new Object[] {
                    ContextUtil.getCurrentUser().getEmployee().getEmpName(), conferenceName
                  }));
        }

        String msgBody = request.getParameter("mbody");
        if (UtilString.isNotEmpty(msgBody)) {
          request.setAttribute("body", this.getMessageFromResource(request, msgBody));
        }
      }

      try {
        // 设置为个人消息发送
        request.setAttribute("msgType", ModelShortMessage.EMessageType.TYPE_PERSONAL.getValue());

        this.loadOrganizationTree(request);
      } catch (Exception e) {
        LOGGER.error("Exception raised when open the dialog page of message..", e);
        return ajaxPrint(response, getErrorCallback("页面加载失败: " + e.getMessage()));
      }
    }

    return mapping.findForward("dialog.info.msg.page");
  }