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; }
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 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; }
/** * @param biz_type 留学、移民、培训、游学。如果为null则全部 * @return */ public Map<String, List<JCompany>> getCompanysWithBiz(String biz_type) { List<JCompany> lsCompany = null; biz_type = JUtil.convertNull(biz_type); Map<String, List<JCompany>> districtCompany = new LinkedHashMap<String, List<JCompany>>(); String[] districts = JCompany.getDistricts(); for (String district : districts) districtCompany.put(district, new ArrayList<JCompany>()); if (biz_type.equals("lx")) lsCompany = getCompanyListByBiz("留学"); else if (biz_type.equals("fl")) lsCompany = getCompanyListByBiz("外语"); else if (biz_type.equals("ym")) lsCompany = getCompanyListByBiz("移民"); else if (biz_type.equals("yx")) lsCompany = getCompanyListByBiz("游学"); else lsCompany = getCompanyList(); for (JCompany company : lsCompany) { String district = JUtil.convertNull(company.getCompany_district()); if (district.length() == 0) district = "总部"; List<JCompany> companys = districtCompany.get(district); companys.add(company); districtCompany.put(district, companys); } return districtCompany; }
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); }