/**
   * 检查所选关账日期所有收款有没有审核完毕
   *
   * @param request
   * @param response
   * @return
   * @throws ServletException
   * @throws java.io.IOException
   */
  private String finishConfirmSk(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, java.io.IOException {
    com.gemway.util.CNHttpServletRequest req = new com.gemway.util.CNHttpServletRequest(request);
    Connection con = null;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    String sql = null;
    String res = "-1";

    try {
      con = JDatabase.getJDatabase().getConnection();
      String company_code = JUtil.convertNull(req.getParameter("company_code"));
      String close_date = JUtil.convertNull(req.getParameter("close_date"));
      String model_type = JUtil.convertNull(req.getParameter("model_type"));
      if ("1".equals(model_type)) { // 留学
        sql =
            "select count(*) from t_lx_money where  sk_status=0 and sk_date=? "
                + "and sk_con_id in (select sk_con_id from t_lx_contract_sk where company_code=? )";
      } else if ("2".equals(model_type)) { // 出入境
        sql =
            "select count(*) from t_ym_money where  sk_status=0 and sk_date=? "
                + "and sk_con_id in (select sk_con_id from t_ym_contract_sk where company_code=? )";
      } else if ("3".equals(model_type)) { // 外语学校
        sql =
            "select count(*) from t_flSchool_money where  sk_status=0 and sk_date=? "
                + "and stu_id in (select stu_id from t_flschool_student where company_code=? )";
      } else if ("4".equals(model_type)) { // 华文学校
        sql =
            "select count(*) from t_chSchool_money where  sk_status=0 and sk_date=? "
                + "and stu_id in (select stu_id from t_chschool_student where company_code=? )";
      }
      pstmt = con.prepareStatement(sql);
      pstmt.setDate(1, JUtil.str2SQLDate(close_date));
      pstmt.setString(2, company_code);
      rs = pstmt.executeQuery();
      if (rs.next()) {
        if (rs.getInt(1) != 0) {
          res =
              close_date.substring(0, 4)
                  + "年"
                  + close_date.substring(5, 7)
                  + "月"
                  + close_date.substring(8, 10)
                  + "日的收款单还未审批完毕!\n现在要审批吗?";
        }
      }
      rs.close();
      pstmt.close();
    } catch (Exception e) {
      JLog.getLogger().error("", e);
    } finally {
      if (con != null)
        try {
          con.close();
        } catch (Exception e) {
          e.printStackTrace();
        }
    }
    return res;
  }
  /**
   * 检查所选收款日期是否已经关账
   *
   * @param request
   * @param response
   * @return
   * @throws ServletException
   * @throws java.io.IOException
   */
  private String checkCloseSk(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, java.io.IOException {
    com.gemway.util.CNHttpServletRequest req = new com.gemway.util.CNHttpServletRequest(request);
    Connection con = null;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    String sql = null;
    String res = "-1";

    try {
      con = JDatabase.getJDatabase().getConnection();
      String company_code = JUtil.convertNull(req.getParameter("company_code"));
      String close_date = JUtil.convertNull(req.getParameter("close_date"));
      String model_type = JUtil.convertNull(req.getParameter("model_type"));
      sql =
          "select count(*) as count from t_closeSk where company_code=? and model_type=? and close_date=?";
      pstmt = con.prepareStatement(sql);
      pstmt.setString(1, company_code);
      pstmt.setString(2, model_type);
      pstmt.setDate(3, JUtil.str2SQLDate(close_date));
      rs = pstmt.executeQuery();
      if (rs.next()) {
        if (rs.getInt("count") != 0) {
          res =
              close_date.substring(0, 4)
                  + "年"
                  + close_date.substring(5, 7)
                  + "月"
                  + close_date.substring(8, 10)
                  + "日已经关账,\n请重新选择收款日期!";
        }
      }
    } catch (Exception e) {
      JLog.getLogger().error("", e);
    } finally {
      if (con != null)
        try {
          con.close();
        } catch (Exception e) {
          e.printStackTrace();
        }
    }
    return res;
  }
Beispiel #3
0
  /**
   * 根据地区代码或学校关键字得到学校
   *
   * @param request
   * @param response
   * @return
   * @throws Exception
   */
  private String checkRepeatGnOrg(HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    String xml = "<?xml version='1.0' encoding='gbk'?>\n";
    org.jdom.Element eleRoot = new org.jdom.Element("root");

    CNHttpServletRequest _req = new CNHttpServletRequest(request);
    String company_id_kwd = JUtil.convertNull(_req.getParameter("company_id_kwd"));
    // String dep_id_kwd = JUtil.convertNull(_req.getParameter("dep_id_kwd"));
    String org_id_kwd = JUtil.convertNull(_req.getParameter("org_id_kwd"));
    String org_name_kwd =
        JUtil.convertNull(
            java.net.URLDecoder.decode(request.getParameter("org_name_kwd"), "utf-8"));
    // String org_name_kwd = JUtil.convertNull(_req.getParameter("org_name_kwd"));
    if (org_name_kwd.length() == 0) throw new Exception("机构名称为空!");
    if (org_id_kwd.length() == 0) org_id_kwd = "-";
    com.gemway.igo.page.Page pageObj = new com.gemway.igo.page.PageOracle();
    java.util.List<com.gemway.igo.page.PageHashMap<String, Object>> lsDate = null;
    pageObj.setRequest(_req);
    org.jdom.Element eleRows = null;

    pageObj.setSelectPartSql(
        "company_id, a.org_id, org_no, org_name, shinyway_contracter, org_type");
    pageObj.setFromPartSql("t_gn_org_company a, t_gn_org b");
    pageObj.addWherePartSql(" a.org_id = b.org_id ");
    pageObj.addWherePartSql(" a.org_id != '" + org_id_kwd + "'");
    pageObj.getPageInfo().setSize(21);
    pageObj.addWherePartSql(" org_name = ? ");
    pageObj.addWhereParam(org_name_kwd);
    pageObj.setOrderByPartSql(" created desc ");
    try {
      lsDate = pageObj.getPageData();
    } catch (Exception e) {
      e.printStackTrace();
    }

    for (int i = 0; i < lsDate.size(); i++) {
      com.gemway.igo.page.PageHashMap<String, Object> data = lsDate.get(i);
      eleRows = new org.jdom.Element("org");
      if (data.getString("company_id").equals(company_id_kwd)) {
        // eleRows = new org.jdom.Element("org");
      } else {
        // eleRows = new org.jdom.Element("other_company_org");
      }
      eleRows.setAttribute("company_id", data.getString("company_id"));
      eleRows.setAttribute(
          "company_name", JUnit.getUnit(data.getString("company_id")).getUnit_name());
      eleRows.setAttribute("org_id", data.getString("org_id"));
      eleRows.setAttribute("org_no", data.getString("org_no"));
      eleRows.setAttribute("org_name", data.getString("org_name"));
      eleRows.setAttribute("org_type", GnOrgBean.getOrgTypeNameById(data.getString("org_type")));
      eleRows.setAttribute(
          "shinyway_contracter",
          data.getString("shinyway_contracter") == null
              ? ""
              : JUser.getUserName(data.getString("shinyway_contracter")));

      eleRoot.addContent(eleRows);
    }

    org.jdom.output.XMLOutputter xmlout = new org.jdom.output.XMLOutputter();

    xml += xmlout.outputString(eleRoot);
    JLog.getLogger().debug("xml=\n" + xml);
    return xml.trim();
  }