static JCompanyCache newInstance(Connection con) { JCompanyCache cache = new JCompanyCache(); try { cache.init(con); } catch (Throwable e) { JLog.getLogger().error("", e); } return cache; }
public JCompany getCompanyById(String com_id) { if (com_id == null || com_id.length() == 0) return null; if (JUnit.getUnit(com_id) == null) { Exception e = new Exception("部门没找到 com_id=" + com_id); JLog.getLogger().error("", e); return null; } String code = JUnit.getUnit(com_id).getUnit_code(); if (mapCompany.get(code) == null) { try { loadCompany(code); } catch (Exception e) { JLog.getLogger().error("", e); } } return mapCompany.get(code); }
public void loadCompany(String unit_code) throws Exception { Connection con = null; try { con = com.gemway.igo.JDatabase.getJDatabase().getConnection(); loadCompany(con, unit_code); } catch (Exception e) { JLog.getLogger().error("", e); } finally { if (con != null) try { con.close(); } catch (Exception e) { } } }
public JCompany getCompanyByCode(String code) throws Exception { JCompany obj = mapCompany.get(code.toUpperCase()); if (obj == null) JLog.getLogger().info("公司没找到code=" + code); return obj; }