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; }
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); }