Ejemplo n.º 1
0
  /*
   * modifyEmployeeExcludeFlag
   *
   * @content: 社員コード及び除外/非除外より、当該教育プランの社員を除外/除外解除する
   *
   * @param : 社員コードリスト
   *
   * @return : 更新成功->true 更新失敗->false
   */
  public boolean modifyEmployeeExcludeFlag(ExcludeFlagDataList employeeDataList)
      throws EducationManagementException {

    BusObjectIterator<ExcludeFlagData> dataList = employeeDataList.getDataListObjects();
    try {
      // 繰り返しで、受講対象者の除外区分を更新する。
      while (dataList.hasMoreElements()) {
        ExcludeFlagData data = dataList.nextElement();
        EDU_TRAINEE.modifyEmployeeExcludeFlag(
            data.getPlanID(), data.getEmployeeCD(), data.getExcludeFlag());
      }
    } catch (Exception e) {
      // システムエラーが発生する場合、
      EducationManagementException educationManagementException =
          new EducationManagementException(
              e, // ここでeをEducationManagementExceptionのコンストラクタへ渡す
              ErrorMessages.E10002,
              new Object[] {EducationManagementConst.TBL_NAME_EDU_TRAINEE});
      LOGGER.error(
          educationManagementException,
          ErrorMessages.E10002,
          new Object[] {EducationManagementConst.TBL_NAME_EDU_TRAINEE});
      throw educationManagementException;
    }

    // 更新処理は成功
    return true;
  }
  /**
   * 合格試験回数分布Mapを取得する
   *
   * @param paramMap パラメータMAP
   * @param planId 教育プランID
   * @return 合格試験回数分布Map
   * @throws EducationManagementException
   */
  private HashMap<Integer, Integer> getGradingNumForPersonCountsList(
      HashMap<String, Integer> paramMap, String planId) throws EducationManagementException {

    HashMap<Integer, Integer> gradingNumForPersons = new HashMap<Integer, Integer>();
    try {
      BusObjectIterator<GetGradingNumForPersonCounts> gradingNumForPersonCounts =
          GetGradingNumForPersonCounts.execute(planId);

      // 最大の回数
      int maxGradingNum = 0;
      while (gradingNumForPersonCounts.hasMoreElements()) {

        GetGradingNumForPersonCounts record = gradingNumForPersonCounts.nextElement();

        // 初回点数
        int gradingNum = Integer.parseInt(getValue(record, "GRADING_NUM"));
        // 人数
        int persons = Integer.parseInt(getValue(record, "PERSON_COUNTS"));

        // 5回以上の場合、5回とする
        if (gradingNum >= 5) {
          gradingNum = 5;
        }

        // 最大の回数
        if (!gradingNumForPersonCounts.hasMoreElements()) {
          maxGradingNum = gradingNum;
        }

        // 初回点数と人数をMapにプットする
        if (gradingNumForPersons.containsKey(gradingNum)) {

          // 5回以上の場合、合計する
          int personValue = gradingNumForPersons.get(gradingNum);
          gradingNumForPersons.put(gradingNum, persons + personValue);

        } else {
          gradingNumForPersons.put(gradingNum, persons);
        }

        gradingNumForPersons.put(gradingNum, persons);
      }

      paramMap.put("maxGradingNum", maxGradingNum);

    } catch (Exception e) {
      // システムエラーが発生する場合、
      EducationManagementException educationManagementException =
          new EducationManagementException(
              e,
              ErrorMessages.E10004,
              new Object[] {EducationManagementConst.TBL_NAME_EDU_TRAINEE});
      LOGGER.error(
          educationManagementException,
          ErrorMessages.E10004,
          new Object[] {EducationManagementConst.TBL_NAME_EDU_TRAINEE});
      throw educationManagementException;
    }
    return gradingNumForPersons;
  }
Ejemplo n.º 3
0
  /*
   * getEmployeeInfoByPlanID
   *
   * @content: 教育プランIDより、該当教育プランの社員情報を取得する
   *
   * @param : 教育プランID,カーソル
   *
   * @return : 該当教育プランの社員情報
   */
  public BusObjectIterator<
          jp.co.intasect.educationmanagement.service.manageeduprogress.EmployeeData>
      getEmployeeInfoByPlanID(String planID, com.cordys.cpc.bsf.query.Cursor cursor)
          throws EducationManagementException {

    ArrayList<EmployeeData> arrResult = new ArrayList<EmployeeData>();

    EducationManagementUtil util = new EducationManagementUtil();

    int response = -1;

    String employeeCdList = "";

    try {
      // 受講対象者テーブルのBusObjectの全件取得用メソッドをコールする
      BusObjectIterator<EDU_TRAINEE> arrEduEmployee = EDU_TRAINEE.getEmployeeInfoByPlanID(planID);

      // 一つずつ受講対象者を戻る結果にセットする
      while (arrEduEmployee.hasMoreElements()) {
        EmployeeData data = new EmployeeData();

        EDU_TRAINEE eduEmployee = arrEduEmployee.nextElement();

        data.setEmployeeCD(eduEmployee.getEMPLOYEE_CD()); // 社員コード
        data.setPassDate(eduEmployee.getPASS_DATE()); // 合格日
        data.setGradingDate(eduEmployee.getGRADING_DATE()); // 採点日
        data.setTrainee(eduEmployee.getTRAINEE()); // 受講者開始日
        data.setGradingNum(eduEmployee.getGRADING_NUM()); // 採点回数
        data.setFirstScore(eduEmployee.getFIRST_SCORE()); // 初回点数
        data.setLastScore(eduEmployee.getLAST_SCORE()); // 最終点数
        data.setExcludeFlag(eduEmployee.getEXCLUDE_FLG()); // 除外区分

        data.setEmployeeName(""); // 社員名前
        data.setEmployeeNameKana(""); // 社員名前片仮名
        data.setHireName(""); // 雇用区分
        data.setAssignOrgName(""); // 所属
        data.setWorkLocation(""); // 勤務地

        // 社員基本情報を取得したい社員CDを組み込む
        if ("".equals(employeeCdList)) {
          employeeCdList = data.getEmployeeCD();
        } else {
          employeeCdList = employeeCdList + "," + data.getEmployeeCD();
        }

        arrResult.add(data);
      }

      // 社員基本情報を取得する
      response =
          util.getEmployeeByRequestTypeAndEmployeeCd(
              EducationManagementConst.EMPLOYEE_TYPE_SPECIAL, employeeCdList);

      // 情報を取得する場合
      if (response > 0) {
        // 基本情報と受講情報を組み込む
        for (int i = 0; i < arrResult.size(); i++) {
          // 一件基本情報を取得する
          EmployeeData employeeData = (EmployeeData) arrResult.get(i);

          XPath listPath =
              XPath.getXPathInstance(
                  ".//*[local-name()='employeeCd' and text()= '"
                      + employeeData.getEmployeeCD()
                      + "']/parent::*");

          // 親ノード配列を取得する
          NodeSet oNodeSet = listPath.selectNodeSet(response);

          // 繰り返しで親ノードを取得する
          while (oNodeSet.hasNext()) {
            // 一つ親ノードを取得する
            long iResultNode = oNodeSet.next();

            // 属性ではない、ノードの場合
            if (!ResultNode.isAttribute(iResultNode)) {
              int iNode = ResultNode.getElementNode(iResultNode);
              // 社員名前
              employeeData.setEmployeeName(Node.getDataElement(iNode, "employeeName", null));
              // 社員名前片仮名
              employeeData.setEmployeeNameKana(
                  Node.getDataElement(iNode, "employeeNameKana", null));
              // 雇用区分
              employeeData.setHireName(Node.getDataElement(iNode, "hireName", null));
              // 所属
              employeeData.setAssignOrgName(Node.getDataElement(iNode, "assignOrgName", null));

              // 勤務地
              employeeData.setWorkLocation(Node.getDataElement(iNode, "workLocation", null));
            }
          }
        }
      }

      // 結果を返却する
      BusObjectIterator<EmployeeData> result = new BusObjectArray<EmployeeData>(arrResult);

      return result;

    } catch (Exception e) {
      // システムエラーが発生する場合、
      EducationManagementException educationManagementException =
          new EducationManagementException(
              e, // ここでeをEducationManagementExceptionのコンストラクタへ渡す
              ErrorMessages.E10004,
              new Object[] {EducationManagementConst.TBL_NAME_EDU_TRAINEE});
      LOGGER.error(
          educationManagementException,
          ErrorMessages.E10004,
          new Object[] {EducationManagementConst.TBL_NAME_EDU_TRAINEE});

      throw educationManagementException;
    }
  }
  /**
   * 問題情報と初回不正解者数Tableを編集する
   *
   * @param paramMap パラメータMAP
   * @param planId
   * @param qestionList
   * @throws EducationManagementException
   */
  private void editQuestionsAndFirstPassCountsList(
      HashMap<String, Integer> paramMap, String planId, QuestionsAndFirstPassCountsList qestionList)
      throws EducationManagementException {

    try {
      BusObjectIterator<GetQuestionsAndFirstPassCounts> questionsAndFirstPassCounts =
          GetQuestionsAndFirstPassCounts.execute(planId);
      // 問題数
      int questionCounts = 0;

      while (questionsAndFirstPassCounts.hasMoreElements()) {
        GetQuestionsAndFirstPassCounts record = questionsAndFirstPassCounts.nextElement();

        QuestionsAndFirstPassCounts questionInfo = new QuestionsAndFirstPassCounts();
        // 問題番号
        questionInfo.setQuestionNo(Integer.parseInt(getValue(record, "QUESTION_NO")));
        // 問題番号(問)
        questionInfo.setQuestionNoName(getValue(record, "QUESTION_NO") + "問");
        // 問題内容
        questionInfo.setQuestionContent(getValue(record, "QUESTION"));
        // 解説
        questionInfo.setQuestionComment(getValue(record, "COMMENT"));
        // 正解
        questionInfo.setQuestionAnswer(getValue(record, "ANSWER"));
        // 初回正解数
        Integer firstPassCounts = Integer.parseInt(getValue(record, "FIRST_PASS_COUNTS"));

        // 不正解数 =  回答者数 - 初回正解数
        questionInfo.setFirstWrongCounts(paramMap.get("totalCount") - firstPassCounts);

        // 初回正解率
        questionInfo.setFirstCorrectRate(getRate(paramMap, firstPassCounts));
        // 不正解率
        questionInfo.setFirstWrongRate(
            getRate(paramMap, paramMap.get("totalCount") - firstPassCounts));

        qestionList.addDataListObject(questionInfo);

        // 問題数
        questionCounts++;
      }
      // 問題数
      paramMap.put("questionCounts", questionCounts);

    } catch (Exception e) {
      // システムエラーが発生する場合、
      EducationManagementException educationManagementException =
          new EducationManagementException(
              e,
              ErrorMessages.E10004,
              new Object[] {
                EducationManagementConst.TBL_NAME_EDU_PLAN
                    + EducationManagementConst.COMMA
                    + EducationManagementConst.TBL_NAME_EDU_EDUCATION_SET
                    + EducationManagementConst.COMMA
                    + EducationManagementConst.TBL_NAME_EDU_QUESTION
                    + EducationManagementConst.COMMA
                    + EducationManagementConst.TBL_NAME_EDU_TRAINEE
                    + EducationManagementConst.COMMA
                    + EducationManagementConst.TBL_NAME_EDU_EXAM_ANWSER
              });
      LOGGER.error(
          educationManagementException,
          ErrorMessages.E10004,
          new Object[] {
            EducationManagementConst.TBL_NAME_EDU_PLAN
                + EducationManagementConst.COMMA
                + EducationManagementConst.TBL_NAME_EDU_EDUCATION_SET
                + EducationManagementConst.COMMA
                + EducationManagementConst.TBL_NAME_EDU_QUESTION
                + EducationManagementConst.COMMA
                + EducationManagementConst.TBL_NAME_EDU_TRAINEE
                + EducationManagementConst.COMMA
                + EducationManagementConst.TBL_NAME_EDU_EXAM_ANWSER
          });
      throw educationManagementException;
    }
  }
  /**
   * 初回得点分布Mapを取得する
   *
   * @param analysisInfo テスト結果分析画面の情報
   * @param paramMap パラメータMAP
   * @param planId 教育プランID
   * @return 初回得点分布Map
   * @throws EducationManagementException
   */
  private HashMap<Integer, Integer> getFirstScoreForPersonCountsList(
      TestResultAnalysisInfo analysisInfo, HashMap<String, Integer> paramMap, String planId)
      throws EducationManagementException {

    HashMap<Integer, Integer> firstScoreForPersons = new HashMap<Integer, Integer>();

    try {
      BusObjectIterator<GetFirstScoreForPersonCounts> firstScoreForPersonCounts =
          GetFirstScoreForPersonCounts.execute(planId);

      // 初回得点合計
      int totalScore = 0;
      // 回答者数
      int totalCount = 0;
      // 最小の初回点数
      int minFirstScore = 0;

      while (firstScoreForPersonCounts.hasMoreElements()) {
        GetFirstScoreForPersonCounts record = firstScoreForPersonCounts.nextElement();
        // 初回点数
        int firstScore = Integer.parseInt(getValue(record, "FIRST_SCORE"));
        // 人数
        int persons = Integer.parseInt(getValue(record, "PERSON_COUNTS"));

        // 初回得点合計
        totalScore = totalScore + firstScore * persons;

        // 回答者数を合計する
        totalCount += persons;

        // 最小の初回点数
        if (!firstScoreForPersonCounts.hasMoreElements()) {
          minFirstScore = firstScore;
        }

        // 初回点数と人数をMapにプットする
        firstScoreForPersons.put(firstScore, persons);
      }
      // 回答者数
      paramMap.put("totalCount", totalCount);
      // 最小の初回点数
      paramMap.put("minFirstScore", minFirstScore);

      // 初回得点平均の取得
      String firstAverageScore = getAverageScore(paramMap, totalScore);
      // 初回得点平均を設定する
      analysisInfo.setAverageScore(firstAverageScore);

    } catch (Exception e) {
      // システムエラーが発生する場合、
      EducationManagementException educationManagementException =
          new EducationManagementException(
              e,
              ErrorMessages.E10004,
              new Object[] {EducationManagementConst.TBL_NAME_EDU_TRAINEE});
      LOGGER.error(
          educationManagementException,
          ErrorMessages.E10004,
          new Object[] {EducationManagementConst.TBL_NAME_EDU_TRAINEE});
      throw educationManagementException;
    }

    return firstScoreForPersons;
  }