/**
   * ***************************************两半督查的行为*************************************************
   * 督查室筛选出属于自己待审的项目记录 督查只能看见上一级(牵头区领导)审核通过的项目 所有项目都要经过督查室审核! 使用之前不用打开数据库连接 返回项目记录队列
   */
  public ArrayList<ProjectMonthRecordBean> DuchaViewList() {

    ArrayList<ProjectMonthRecordBean> list = new ArrayList<ProjectMonthRecordBean>();

    String selectSQL =
        "select Project.projectId,Project.projectName,evaForm.isMoney,evaForm.evaluationContent,evaForm.separateLeader,Project.totalProgress,resDep.departmentName,Project.evaContent,ProjectMonthRecord.taskMonth,ProjectMonthRecord.status,ProjectMonthRecord.monthFinish,ProjectMonthRecord.monthMoney,ProjectMonthRecord.monthProgress,ProjectMonthRecord.submitTime,ProjectMonthRecord.firstView,ProjectMonthRecord.secondView,ProjectMonthRecord.thirdView,Project.currentFinish,Project.firstClassify, Project.secondClassify    "
            + "from (((project inner join Department as resDep on Project.resDepartmentId=resDep.departmentID ) inner join EvaluationForm as evaForm on  evaForm.evaluationId=Project.evaluationId )left outer join ProjectMonthRecord  on   Project.projectId=ProjectMonthRecord.projectId ) where status='TT0';";

    System.out.println(selectSQL);
    ResultSet rs = this.SelectDB(selectSQL);

    try {
      while (rs.next()) {
        /*projectId	projectName	isMoney	evaluationContent	totalProgress
         * departmentName	evaContent	taskMonth	status	monthFinish
         * monthMoney	monthProgress	submitTime	firstView	secondView
         * thirdView	currentFinish	firstClassify	secondClassify
         */

        ProjectMonthRecordBean pmrb = new ProjectMonthRecordBean();

        pmrb.setProjectId(rs.getString("projectId"));
        pmrb.setProjectName(rs.getString("projectName"));
        pmrb.setIsMoney(rs.getString("isMoney"));
        pmrb.setTotalProgress(rs.getDouble("totalProgress"));
        pmrb.setResDepartmentName(rs.getString("departmentName"));

        pmrb.setEvaluationContent(rs.getString("evaluationContent"));

        pmrb.setProjectEvaContent(rs.getString("evaContent"));
        pmrb.setEvaMonth(rs.getInt("taskMonth"));
        pmrb.setStatus(rs.getString("status"));
        pmrb.setMonthFinish(rs.getString("monthFinish"));
        pmrb.setMonthProgress(rs.getDouble("monthMoney"));

        pmrb.setMonthProgress(rs.getDouble("monthProgress"));
        pmrb.setSubmitTime(rs.getString("submitTime"));
        //					pmrb.setMonthFinish(rs.getString("currentFinish"));
        pmrb.setFirstView(rs.getString("firstView"));
        pmrb.setSecondView(rs.getString("secondView"));
        pmrb.setThirdView(rs.getString("thirdView"));
        pmrb.setMonthMoney(rs.getDouble("monthMoney"));

        list.add(pmrb);
      }
    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return list;
  }
  /**
   * 该函数筛选出某部门上报没有通过的项目记录
   *
   * @param leadDeparmtentId 上报部门编号
   * @return
   */
  public ArrayList<ProjectMonthRecordBean> searchProjectFaildByLeadDepatrment(
      String leadDeparmtentId) {
    ArrayList<ProjectMonthRecordBean> list = new ArrayList<ProjectMonthRecordBean>();

    String selectSQL =
        "select Project.projectId,Project.projectName,evaForm.isMoney,evaForm.evaluationContent,Project.totalProgress,resDep.departmentName,Project.evaContent,ProjectMonthRecord.taskMonth,ProjectMonthRecord.status,ProjectMonthRecord.monthFinish,ProjectMonthRecord.monthMoney,ProjectMonthRecord.monthProgress,ProjectMonthRecord.submitTime,ProjectMonthRecord.firstView,ProjectMonthRecord.secondView,ProjectMonthRecord.thirdView,Project.currentFinish,Project.firstClassify, Project.secondClassify   "
            + "from (((project inner join Department as resDep on Project.resDepartmentId=resDep.departmentID ) inner join EvaluationForm as evaForm on  evaForm.evaluationId=Project.evaluationId  and evaForm.leadDepartmentId='"
            + leadDeparmtentId
            + "' )inner join ProjectMonthRecord  on   Project.projectId=ProjectMonthRecord.projectId ) where status like '%F%';";

    ResultSet rs = this.SelectDB(selectSQL);

    try {
      while (rs.next()) {

        ProjectMonthRecordBean pmrb = new ProjectMonthRecordBean();

        pmrb.setProjectId(rs.getString("projectId"));
        pmrb.setProjectName(rs.getString("projectName"));
        pmrb.setIsMoney(rs.getString("isMoney"));
        pmrb.setTotalProgress(rs.getDouble("totalProgress"));
        pmrb.setResDepartmentName(rs.getString("departmentName"));

        pmrb.setEvaluationContent(rs.getString("evaluationContent"));

        pmrb.setProjectEvaContent(rs.getString("evaContent"));
        pmrb.setEvaMonth(rs.getInt("taskMonth"));
        pmrb.setStatus(rs.getString("status"));
        pmrb.setMonthFinish(rs.getString("monthFinish"));
        pmrb.setMonthProgress(rs.getDouble("monthMoney"));

        pmrb.setMonthProgress(rs.getDouble("monthProgress"));
        pmrb.setSubmitTime(rs.getString("submitTime"));
        pmrb.setMonthFinish(rs.getString("currentFinish"));
        pmrb.setFirstView(rs.getString("firstView"));
        pmrb.setSecondView(rs.getString("secondView"));
        pmrb.setThirdView(rs.getString("thirdView"));

        list.add(pmrb);
      }

    } catch (SQLException e) {
      e.printStackTrace();
    }
    return list;
  }
  /** 查询某部门某月没有上报的记录》》》这个就是需要上报的记录 对于责任部门自己来说,也需要了解哪些项目没有上报,需要上报 具体是哪一级没有通过,可以通过status的值来判断 */
  public ArrayList<ProjectMonthRecordBean> searchProjectByNoReport(
      String departmentID, int taskMonth) {
    ArrayList<ProjectMonthRecordBean> list = new ArrayList<ProjectMonthRecordBean>();

    String selectSQL =
        "select Project.projectId,Project.projectName,evaForm.isMoney,evaForm.evaluationContent,Project.totalProgress,resDep.departmentName,Project.evaContent,ProjectMonthRecord.taskMonth,ProjectMonthRecord.status,ProjectMonthRecord.monthFinish,ProjectMonthRecord.monthMoney,ProjectMonthRecord.monthProgress,ProjectMonthRecord.submitTime,ProjectMonthRecord.firstView,ProjectMonthRecord.secondView,ProjectMonthRecord.thirdView,Project.currentFinish,Project.firstClassify, Project.secondClassify  from (((project inner join Department as resDep on Project.resDepartmentId=resDep.departmentID  and Project.resDepartmentId='"
            + departmentID
            + "' ) inner join EvaluationForm as evaForm on  evaForm.evaluationId=Project.evaluationId )left outer join ProjectMonthRecord  on   Project.projectId=ProjectMonthRecord.projectId and taskMonth="
            + taskMonth
            + " ) where status is null;";

    System.out.println(selectSQL);
    ResultSet rs = this.SelectDB(selectSQL);

    try {
      while (rs.next()) {
        /*projectId	projectName	isMoney	evaluationContent	totalProgress
         * departmentName	evaContent	taskMonth	status	monthFinish
         * monthMoney	monthProgress	submitTime	currentFinish	firstClassify	secondClassify
         */
        ProjectMonthRecordBean pmrb = new ProjectMonthRecordBean();
        //					System.out.println(rs.getString("projectId"));
        //					System.out.println(rs.getString("projectName"));
        //					System.out.println(rs.getString("isMoney"));
        //					System.out.println(rs.getString("evaluationContent"));
        //					System.out.println(rs.getString("totalProgress"));
        //					System.out.println(rs.getString("departmentName"));
        //
        //					System.out.println(rs.getString("evaContent"));
        //					System.out.println(rs.getString("taskMonth"));
        //					System.out.println(rs.getString("status"));
        //					System.out.println(rs.getString("monthFinish"));
        //					System.out.println(rs.getString("monthMoney"));
        //
        //					System.out.println(rs.getString("monthProgress"));
        //					System.out.println(rs.getString("submitTime"));
        //					System.out.println(rs.getString("currentFinish"));
        //					System.out.println(rs.getString("firstClassify"));
        //					System.out.println(rs.getString("secondClassify"));
        //
        //					System.out.println("--------------------------------------");

        pmrb.setProjectId(rs.getString("projectId"));
        pmrb.setProjectName(rs.getString("projectName"));
        pmrb.setIsMoney(rs.getString("isMoney"));
        pmrb.setTotalProgress(rs.getDouble("totalProgress"));
        pmrb.setResDepartmentName(rs.getString("departmentName"));

        pmrb.setEvaluationContent(rs.getString("evaluationContent"));

        pmrb.setProjectEvaContent(rs.getString("evaContent"));
        pmrb.setEvaMonth(rs.getInt("taskMonth"));
        pmrb.setStatus(rs.getString("status"));
        pmrb.setMonthFinish(rs.getString("monthFinish"));
        pmrb.setMonthProgress(rs.getDouble("monthMoney"));

        pmrb.setMonthProgress(rs.getDouble("monthProgress"));
        pmrb.setSubmitTime(rs.getString("submitTime"));
        pmrb.setMonthFinish(rs.getString("currentFinish"));
        pmrb.setFirstView(rs.getString("firstView"));
        pmrb.setSecondView(rs.getString("secondView"));
        pmrb.setThirdView(rs.getString("thirdView"));

        list.add(pmrb);
      }

    } catch (SQLException e) {
      e.printStackTrace();
    }
    return list;
  }