/**
   * 获得公司的分部
   *
   * @param con
   * @param company_code
   * @return
   * @throws SQLException
   */
  private static java.util.List<JUnit> getChildBranch(Connection con, String company_code)
      throws SQLException {
    java.util.List<JUnit> lsBranch = new java.util.ArrayList<JUnit>();
    java.sql.PreparedStatement pstmt = null;
    ResultSet rs = null;
    String sql = null;

    sql =
        "select unit_id from t_unit "
            + " where (parent_code =? or parent_code =?) and is_branch = 1 "
            + " order by unit_index ";
    pstmt = con.prepareStatement(sql);
    pstmt.setString(1, company_code);
    pstmt.setString(2, company_code + ".LX");
    rs = pstmt.executeQuery();
    while (rs.next()) {
      JUnit uObj = JUnit.getUnit(rs.getString("unit_id"));
      lsBranch.add(uObj);
    }
    /*
    if(lsBranch.size() == 0)
    {
    	lsBranch.add(JUnit.getUnitByCode(company_code));
    }*/
    rs.close();
    pstmt.close();
    return lsBranch;
  }
Exemple #2
0
  /* return status codes for account/device */
  public static int[] getStatusCodes(String accountID, String deviceID) throws DBException {

    /* account-id specified? */
    if (StringTools.isBlank(accountID)) {
      return new int[0];
    }

    /* device-id specified? */
    if (StringTools.isBlank(deviceID)) {
      deviceID = ALL_DEVICES;
    }

    /* select */
    // DBSelect: SELECT statucCode FROM StatusCode WHERE (accountID='acct') AND (deviceID='*') ORDER
    // BY statucCode
    DBSelect<StatusCode> dsel = new DBSelect<StatusCode>(StatusCode.getFactory());
    dsel.setSelectedFields(StatusCode.FLD_statusCode);
    DBWhere dwh = dsel.createDBWhere();
    dsel.setWhere(
        dwh.WHERE_(
            dwh.AND(
                dwh.EQ(StatusCode.FLD_accountID, accountID),
                dwh.EQ(StatusCode.FLD_deviceID, deviceID))));
    dsel.setOrderByFields(StatusCode.FLD_statusCode);

    /* get list */
    java.util.List<Integer> codeList = new Vector<Integer>();
    Statement stmt = null;
    ResultSet rs = null;
    try {
      stmt = DBConnection.getDefaultConnection().execute(dsel.toString());
      rs = stmt.getResultSet();
      while (rs.next()) {
        int code = rs.getInt(StatusCode.FLD_statusCode);
        codeList.add(new Integer(code));
      }
    } catch (SQLException sqe) {
      throw new DBException("Getting StatusCode List", sqe);
    } finally {
      if (rs != null) {
        try {
          rs.close();
        } catch (Throwable t) {
        }
      }
      if (stmt != null) {
        try {
          stmt.close();
        } catch (Throwable t) {
        }
      }
    }

    /* return array of status codes */
    int codeListInt[] = new int[codeList.size()];
    for (int i = 0; i < codeListInt.length; i++) {
      codeListInt[i] = codeList.get(i).intValue();
    }
    return codeListInt;
  }
  public java.util.List<JCompany> getOA_CompanyList() {
    java.util.List<JCompany> ls = new java.util.ArrayList<JCompany>();

    for (String id : lsOACompany) {
      ls.add(JCompany.getCompanyById(id));
    }
    return ls;
  }
 // 取业务单位
 public java.util.List<JCompany> getBiz_CompanyList() throws Exception {
   java.util.List<JCompany> ls = new java.util.ArrayList<JCompany>();
   for (int i = 0; i < lsBizCompany.size(); i++) {
     JCompany obj = JCompany.getCompanyById(lsBizCompany.get(i));
     ls.add(obj);
   }
   return ls;
 }
 public java.util.List<JCompany> getEnabledCompanyList() {
   java.util.List<JCompany> ls = new java.util.ArrayList<JCompany>();
   for (int i = 0; i < lsCompany.size(); i++) {
     JCompany obj = lsCompany.get(i);
     if (!obj.enabled() || obj.getCompany_code().equals("XT_517")) continue;
     ls.add(obj);
   }
   return ls;
 }
Exemple #6
0
 public static String GetPropertyString_OBDII(long dtcFault[]) {
   if (ListTools.isEmpty(dtcFault)) {
     return GetPropertyString_OBDII("");
   } else {
     java.util.List<String> dtc = new Vector<String>();
     for (int i = 0; i < dtcFault.length; i++) {
       if (dtcFault[i] != 0L) {
         dtc.add(GetFaultString(dtcFault[i]));
       }
     }
     return GetPropertyString_OBDII(dtc);
   }
 }
Exemple #7
0
  /* return list of all Devices within the specified DeviceGroup (NOT SCALABLE BEYOND A FEW HUNDRED GROUPS) */
  public static java.util.List<String> getUsersForGroup(String acctId, String groupId)
      throws DBException {

    /* valid account/groupId? */
    if (StringTools.isBlank(acctId)) {
      return null;
    } else if (StringTools.isBlank(groupId)) {
      return null;
    }

    /* get db selector */
    DBSelect dsel = GroupList._getUserListSelect(acctId, groupId);
    if (dsel == null) {
      return null;
    }

    /* read users for group */
    java.util.List<String> usrList = new Vector<String>();
    DBConnection dbc = null;
    Statement stmt = null;
    ResultSet rs = null;
    try {
      dbc = DBConnection.getDefaultConnection();
      stmt = dbc.execute(dsel.toString());
      rs = stmt.getResultSet();
      while (rs.next()) {
        String usrId = rs.getString(GroupList.FLD_userID);
        usrList.add(usrId);
      }
    } catch (SQLException sqe) {
      throw new DBException("Get Group GroupeList", sqe);
    } finally {
      if (rs != null) {
        try {
          rs.close();
        } catch (Throwable t) {
        }
      }
      if (stmt != null) {
        try {
          stmt.close();
        } catch (Throwable t) {
        }
      }
      DBConnection.release(dbc);
    }

    /* return list */
    return usrList;
  }
  public java.util.List<JCompany> getCompanyListByBiz(String biz_type) {
    /*
     *留学/移民/团组/外语/华文
     */
    if (biz_type.equals("游学") || biz_type.equals("国交")) biz_type = "团组";
    if (biz_type.equals("出入境")) biz_type = "移民";
    if (biz_type.equals("培训")) biz_type = "外语";

    java.util.List<JCompany> ls = new java.util.ArrayList<JCompany>();

    for (int i = 0; i < lsBizCompany.size(); i++) {
      JCompany obj = JCompany.getCompanyById(lsBizCompany.get(i));
      if (obj.hasBiz(biz_type)) ls.add(obj);
    }
    return ls;
  }
  public static java.util.List<String> getLsIntCourse(Connection con, String cstm_id)
      throws Exception {
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    String qry = null;

    java.util.List<String> lsIntCourse = new java.util.Vector<String>();

    qry = " select item_id from t_fl_interest_courses where cstm_id=? ";
    pstmt = con.prepareStatement(qry);
    pstmt.setString(1, cstm_id);
    rs = pstmt.executeQuery();
    while (rs.next()) {
      lsIntCourse.add(JUtil.convertNull(rs.getString("item_id")));
    }
    rs.close();
    pstmt.close();

    return lsIntCourse;
  }
 static {
   _jspx_dependants = new java.util.ArrayList(2);
   _jspx_dependants.add("/admin/login_check.jsp");
   _jspx_dependants.add("/bottom_line.jsp");
 }
  private static java.util.List<FLSchoolMoney> getSkList(
      Connection con, String stu_id, String sk_id) throws java.sql.SQLException {
    java.util.List<FLSchoolMoney> ls = new java.util.Vector<FLSchoolMoney>();
    FLSchoolMoney skObj = null;
    String qry = null;

    qry =
        " select a.sk_id,     a.stu_id,     a.sk_pos_id,    a.sk_date,    a.invoice_type, "
            + "        a.is_sk,     a.sk_item,    a.sk_money,     a.currency,   a.course_con_id,  "
            + "        a.sk_status, a.tk_pay_id,  a.df_pay_id,    a.ds_unit_id,   a.sk_memo,   "
            + "        a.created,   a.creater,    a.confirm_date, a.confirmerName, "
            + "        a.modified,  a.modifier,   a.company_code, a.branch_id,  a.sk_type"
            + "  from t_flschool_money a ";
    if (sk_id != null) {
      qry += " where a.sk_id=? ";
    } else {
      qry += " where a.stu_id=? order by sk_date ";
    }
    PreparedStatement pstmt = null;
    ResultSet rs = null;

    pstmt = con.prepareStatement(qry);
    pstmt.setString(1, sk_id);
    rs = pstmt.executeQuery();
    while (rs.next()) {
      skObj = new FLSchoolMoney();
      ls.add(skObj);

      skObj.sk_id = rs.getString("sk_id");
      skObj.stu_id = rs.getString("stu_id");
      skObj.sk_pos_id = rs.getString("sk_pos_id");
      skObj.sk_date = JUtil.formatDate(rs.getDate("sk_date"), "YYYY-MM-DD");
      skObj.invoice_type = JUtil.convertNull(rs.getString("invoice_type"));

      skObj.is_sk = rs.getInt("is_sk");
      skObj.sk_item = JUtil.convertNull(rs.getString("sk_item"));
      skObj.sk_money = JUtil.convertNull(rs.getString("sk_money"));
      skObj.currency = JUtil.convertNull(rs.getString("currency"));
      skObj.course_con_id = JUtil.convertNull(rs.getString("course_con_id"));

      skObj.sk_status = rs.getInt("sk_status");
      skObj.tk_pay_id = JUtil.convertNull(rs.getString("tk_pay_id"));
      skObj.df_pay_id = JUtil.convertNull(rs.getString("df_pay_id"));
      skObj.ds_unit_id = JUtil.convertNull(rs.getString("ds_unit_id"));
      skObj.sk_memo = JUtil.convertNull(rs.getString("sk_memo"));

      skObj.created = rs.getTimestamp("created");
      skObj.creater = rs.getString("creater");

      skObj.confirmerName = JUtil.convertNull(rs.getString("confirmerName"));
      java.sql.Date d = rs.getDate("confirm_date");
      if (d != null) skObj.confirm_date = JUtil.formatDate(d, "YYYY-MM-DD");

      skObj.modified = rs.getTimestamp("modified");
      skObj.modifier = rs.getString("modifier");

      skObj.company_code = rs.getString("company_code");
      skObj.branch_id = JUtil.convertNull(rs.getString("branch_id"));
      skObj.sk_type = JUtil.convertNull(rs.getString("sk_type"));
    }
    rs.close();
    pstmt.close();

    return ls;
  }
  private void loadCompany(Connection con, String unit_code) throws Exception {
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    String qry = null;

    JCompany obj = null;

    qry =
        " select unit_id, unit_code, unit_name, biz_lx, biz_ym, biz_fl, biz_yx, biz_ch, "
            + "        company_fullName, company_addr,company_district,unit_created "
            + "   from t_unit "
            + "  where unit_code=? ";
    pstmt = con.prepareStatement(qry);
    pstmt.setString(1, unit_code.toUpperCase());
    rs = pstmt.executeQuery();
    if (rs.next()) {
      Set<String> bizSet = null;
      String[] bizTypes = null;
      String szId, szCode, szName;

      bizSet = new HashSet<String>();
      szId = rs.getString("unit_id");
      szCode = rs.getString("unit_code");
      szName = JUtil.convertNull(rs.getString("unit_name"));

      {
        if (rs.getInt("biz_lx") == 1) bizSet.add("留学");
        if (rs.getInt("biz_ym") == 1) bizSet.add("移民");
        if (rs.getInt("biz_yx") == 1) bizSet.add("团组");
        if (rs.getInt("biz_fl") == 1) bizSet.add("外语");
        if (rs.getInt("biz_ch") == 1) bizSet.add("华文");
        bizTypes = new String[bizSet.size()];
        int i = 0;
        for (String biz : bizSet) {
          bizTypes[i++] = biz;
        }
      }

      obj = new JCompany(szId, szCode, szName, bizTypes);

      obj.setCompany_fullName(rs.getString("company_fullName"));
      obj.setCompany_address(rs.getString("company_addr"));
      obj.setCompany_district(rs.getString("company_district"));
      obj.setUnit_created(rs.getDate("unit_created"));
      obj.setBranch(getChildBranch(con, szCode));
    }
    rs.close();
    pstmt.close();

    if (obj == null) return;

    /** ******** 放到 列表 中 ****************** */
    String szId = obj.getCompany_id();
    String szCode = obj.getCompany_code();

    lsBizCompany.remove(szId);
    if (!szCode.startsWith("XT_NB.")) lsBizCompany.add(szId);

    lsOACompany.contains(szId);
    lsOACompany.add(szId);

    mapCompany.put(obj.getCompany_code(), obj);
    int idx = lsCompany.size();
    for (int i = 0; i < lsCompany.size(); i++) {
      JCompany com = lsCompany.get(i);
      if (com.getCompany_id().equals(szId)) {
        idx = i;
        lsCompany.remove(i);
        break;
      }
    }
    lsCompany.add(idx, obj);
  }
  /**
   * 格式化某位员工 某一天的 考勤信息
   *
   * @param con
   * @param schedule_id 某节课ID t_fl_class_schedule.line_id
   * @throws Exception
   */
  private static void formatClassSchedule(Connection con, ScheduleDate scheduleObj)
      throws Exception {
    Connection con_igo = null;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    String sql = null;
    StuKqFormatNew stuKqFormatNewObj = null;
    String class_id = null;
    java.sql.Timestamp begin_time = null;

    class_id = scheduleObj.getClass_id();
    begin_time = scheduleObj.getBegin_time();

    String szClassDate = JUtil.formatDate(begin_time, "YYYY-MM-DD");

    java.sql.Timestamp dKqDate = new java.sql.Timestamp(JUtil.str2SQLDate(szClassDate).getTime());
    java.sql.Timestamp nextDate = new java.sql.Timestamp(JUtil.relativeDate(dKqDate, 1).getTime());

    java.util.List<StuKqFormatNew> lsStuKqFormatNew = new java.util.ArrayList<StuKqFormatNew>();
    try {
      // 附加学生基本信息
      con_igo = com.gemway.igo.JDatabase.getJDatabase().getConnection();

      sql =
          "	select a.stu_id, b.stu_no, b.company_id, b.father_phone, c.cstm_name, c.cstm_phone, c.cstm_handset  "
              + " from t_fl_course_stu a, t_fl_student b, t_custom c "
              + " where a.cstm_id=b.cstm_id and b.cstm_id = c.cstm_id and a.course_id=?";
      pstmt = con_igo.prepareStatement(sql);
      pstmt.setString(1, class_id);
      rs = pstmt.executeQuery();
      while (rs.next()) {
        stuKqFormatNewObj = new StuKqFormatNew();
        stuKqFormatNewObj.setKq_id(com.gemway.util.ID.getIDObject("DEFAULT").create());
        stuKqFormatNewObj.setKq_date(JUtil.str2SQLDate(szClassDate));
        stuKqFormatNewObj.setClass_id(scheduleObj.getClass_id());
        stuKqFormatNewObj.setLine_id(scheduleObj.getLine_id());
        stuKqFormatNewObj.setStu_name(rs.getString("cstm_name"));
        stuKqFormatNewObj.setStu_no(rs.getString("stu_no"));
        stuKqFormatNewObj.setIs_late(0);
        stuKqFormatNewObj.setEarlygo(0);
        stuKqFormatNewObj.setAbsenteeism(0);
        stuKqFormatNewObj.setLeave_out(0);
        stuKqFormatNewObj.setFather_phone(rs.getString("father_phone"));
        lsStuKqFormatNew.add(stuKqFormatNewObj);
      }
      rs.close();
      pstmt.close();
    } catch (Exception e) {
      throw e;
    } finally {
      if (con_igo != null) con_igo.close();
    }

    // 格式化前删除原来信息
    sql = "delete from t_fl_stu_kq_format_new where line_id=?";
    pstmt = con.prepareStatement(sql);
    pstmt.setString(1, scheduleObj.getLine_id());
    pstmt.executeUpdate();
    pstmt.close();

    for (int i = 0; i < lsStuKqFormatNew.size(); i++) {
      stuKqFormatNewObj = lsStuKqFormatNew.get(i);
      sql =
          " insert into t_fl_stu_kq_format_new "
              + " (kq_id, kq_date, class_id, line_id, stu_name, stu_no, is_late, "
              + "  earlygo, absenteeism, leave_out, father_phone, created) "
              + " values(?,?,?,?,?,?,?,?,?,?,?,?)";
      pstmt = con.prepareStatement(sql);
      int rowIndex = 1;
      pstmt.setString(rowIndex++, stuKqFormatNewObj.getKq_id());
      pstmt.setDate(rowIndex++, stuKqFormatNewObj.getKq_date());
      pstmt.setString(rowIndex++, stuKqFormatNewObj.getClass_id());
      pstmt.setString(rowIndex++, stuKqFormatNewObj.getLine_id());
      pstmt.setString(rowIndex++, stuKqFormatNewObj.getStu_name());
      pstmt.setString(rowIndex++, stuKqFormatNewObj.getStu_no());
      pstmt.setInt(rowIndex++, stuKqFormatNewObj.getIs_late());
      pstmt.setInt(rowIndex++, stuKqFormatNewObj.getEarlygo());
      pstmt.setInt(rowIndex++, stuKqFormatNewObj.getAbsenteeism());
      pstmt.setInt(rowIndex++, stuKqFormatNewObj.getLeave_out());
      pstmt.setString(rowIndex++, stuKqFormatNewObj.getFather_phone());
      pstmt.setTimestamp(rowIndex++, new java.sql.Timestamp(System.currentTimeMillis()));
      pstmt.executeUpdate();
      pstmt.close();
    }
  }