private static List<FirmaDTO> getUpdateFirmalar() throws ReadException { QueryRunner runner = new QueryRunner(); Connection con = null; List<FirmaDTO> list = new ArrayList<FirmaDTO>(); try { con = dao.getConnection(); con.setAutoCommit(false); list = (List<FirmaDTO>) runner.query( con, "select kod, unvan, adsoyad, gsm_telefon, il, ilce, adres, durumu, tescil_no," + "uygunluk_belgesi, gecerlilik_suresi, servis_sozlesme, sozlesme_tarihi," + "tse_belge_no, eposta,monte_eden as monteEden," + "yetkili_servis as yetkiliServis," + "tse_belgesi as tseBelgesi," + "telefon_no as telefonNo," + "telefon_no_dahili as dahili," + "ce_belge_tipi as ceBelgeTipi FROM " + "akm.bakimci_firma WHERE durumu='1'", new BeanListHandler<FirmaDTO>(FirmaDTO.class)); } catch (Exception e) { throw new ReadException(e.getMessage(), null); } finally { DbUtils.closeQuietly(con); } return list; }
private static List<TSEFirma> getTSEFirmalar() throws ReadException { QueryRunner runner = new QueryRunner(); Connection con = null; List<TSEFirma> list = new ArrayList<TSEFirma>(); try { con = dao.getConnection(); con.setAutoCommit(false); list = (List<TSEFirma>) runner.query( con, "select * from akm.bakimci", new BeanListHandler<TSEFirma>(TSEFirma.class)); } catch (Exception e) { throw new ReadException(e.getMessage(), null); } finally { DbUtils.closeQuietly(con); } return list; }
private static void updateFirma(List<TSEFirma> firmalar) throws UpdateException { QueryRunner runner = new QueryRunner(); Connection con = null; List<FirmaDTO> list = new ArrayList<FirmaDTO>(); try { con = dao.getConnection(); con.setAutoCommit(false); for (TSEFirma t : firmalar) { list = (List<FirmaDTO>) runner.query( con, "select kod, unvan, adsoyad, gsm_telefon, il, ilce, adres, durumu, tescil_no," + "uygunluk_belgesi, gecerlilik_suresi, servis_sozlesme, sozlesme_tarihi," + "tse_belge_no, eposta,monte_eden as monteEden," + "yetkili_servis as yetkiliServis," + "tse_belgesi as tseBelgesi," + "telefon_no as telefonNo," + "telefon_no_dahili as dahili," + "ce_belge_tipi as ceBelgeTipi FROM " + "akm.bakimci_firma WHERE durumu='1' and ltrim(rtrim(replace(replace(replace(tse_belge_no,'-',''),'/',''),' ','')))=?", new BeanListHandler<FirmaDTO>(FirmaDTO.class), new String( t.getTsebelgeno() .replace("-", "") .replace("/", "") .replace(" ", "") .trim())); if (list.size() > 0) { for (FirmaDTO f : list) { FirmaDTO f1 = new FirmaDTO(); f1.setUnvan(t.getUnvan()); f1.setAdSoyad(nvl(t.getAdsoyad(), f.getAdSoyad())); f1.setGsmTelefon(nvl2(t.getGsm_telefon())); f1.setIl(nvl2(t.getIl())); f1.setIlce(f.getIlce()); f1.setAdres(nvl(t.getAdres(), f.getAdres())); f1.setDurumu("1"); f1.setTescil_No(f.getTescilNo()); f1.setTse_Belge_No(t.getTsebelgeno()); f1.setEposta(nvl(t.getEmail(), f.getEposta())); f1.setMonteEden(f.getMonteEden()); f1.setYetkiliServis(f.getYetkiliServis()); f1.setTseBelgesi(t.getTsebelge().equals("Var") ? "E" : "H"); f1.setTelefonNo(nvl2(t.getTelefon())); f1.setDahili(nvl2(t.getDahili())); f1.setCeBelgeTipi(f1.getCeBelgeTipi()); // f1.set // f1.setAdres(nvl(t.getAdres(),f.getAdres())); } } } } catch (Exception e) { throw new UpdateException(e.getMessage(), null); } finally { DbUtils.closeQuietly(con); } }