NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package tr.com.java.dao;

import DBConnection.DBConnectionHelper;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import tr.com.java.entity.IletisimNoktalari;
import tr.com.java.entity.Kullanici;
import tr.com.java.entity.MusteriTedarikci;
import tr.com.java.entity.Organizasyon;
import tr.com.java.entity.Tur;

/**
* Ümmügülsüm KAygısız [email protected]
* [email protected]
*/
public class MusteriYonetimiImpl implements MusteriYonetimi {

private static final Logger LOG = Logger.getLogger(MusteriYonetimiImpl.class.getName());

/* Musteri_Tedarikçi İŞLEMLERİ */
@Override
public boolean musteriTedarikciOlustur(Organizasyon organizasyon, Kullanici kullanici,Tur tur,
MusteriTedarikci musteriTedarikci,List<IletisimNoktalari> iletisimNoktalariListesi) {
DBConnectionHelper connectionHelper = DBConnectionHelper.getInstance();
Connection connection = null;
PreparedStatement ps = null;
PreparedStatement psIN = null;
PreparedStatement psMTID=null;
Long id = null;
try {
connection = connectionHelper.getConnection();
connection.setAutoCommit(false);
ps = connection.prepareStatement("INSERT INTO MUSTERI_TEDARIKCI(TAM_UNVAN,UNVAN,VERGI_DAIRESI,TCKN_VKN,TICARET_SICIL_NO,"
+ "KURULUS_TARIHI,TESCIL_TARIHI,MERSIS_NO,TEMEL_ISKONTO,KREDI_LIMITI,FIRMA_TURU,ORGANIZASYON_ID,M_TUR,"
+ "AKTIFLIK,OLUSTURULMA_TARIHI,OLUSTURAN_ID,DUZENLENME_TARIHI,DUZENLEYEN_ID) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
ps.setString(1, musteriTedarikci.getTamUnvan());
ps.setString(2, musteriTedarikci.getUnvan());
ps.setString(3, musteriTedarikci.getVergiDairesi());
ps.setString(4, musteriTedarikci.getTcknVkn());
ps.setInt(5, musteriTedarikci.getTicaretSicilNo());
java.sql.Date sqlDate = new java.sql.Date(musteriTedarikci.getKurulusTarihi().getTime());
ps.setDate(6, sqlDate);
java.sql.Date sqlDate2 = new java.sql.Date(musteriTedarikci.getTescilTarihi().getTime());
ps.setDate(7, sqlDate2);
ps.setString(8, musteriTedarikci.getMersisNo());
ps.setDouble(9, musteriTedarikci.getTemelIskonto());
ps.setDouble(10, musteriTedarikci.getKrediLimiti());
ps.setString(11, musteriTedarikci.getFirmaTuru());
// ps.setLong(12, organizasyon.getId());
ps.setLong(12, 1);
//ps.setString(13, tur.getAdi());
ps.setString(13, musteriTedarikci.getMusteri_tur());
//ps.setLong(13,1);
ps.setBoolean(14, musteriTedarikci.getAktiflik());
Date date = new Date();
ps.setTimestamp(15, new Timestamp(date.getTime()));
// ps.setLong(16, kullanici.getId());
ps.setLong(16, 1);
ps.setTimestamp(17, new Timestamp(date.getTime()));
//ps.setLong(18, kullanici.getId());
ps.setLong(18, 1);
ps.executeUpdate();
psMTID = connection.prepareStatement("SELECT ID FROM MUSTERI_TEDARIKCI WHERE UNVAN = ? AND ORGANIZASYON_ID=?");
psMTID.setString(1, musteriTedarikci.getUnvan());
psMTID.setLong(2, 1);
// psMTID.setLong(2, organizasyon.getId());
ResultSet rs = psMTID.executeQuery();
rs.next();
musteriTedarikci.setId(rs.getLong("ID"));
for (int i = 0; i < iletisimNoktalariListesi.size(); i++) {
psIN = connection.prepareStatement("INSERT INTO ILETISIM_NOKTALARI(ADI,ADRES,IL,ILCE,TELEFON,EPOSTA,FAX,ORGANIZASYON_ID,MUSTERI_TEDARIKCI_ID) VALUES (?,?,?,?,?,?,?,?,?)");
psIN.setString(1, iletisimNoktalariListesi.get(i).getAdi());
psIN.setString(2, iletisimNoktalariListesi.get(i).getAdres());
psIN.setString(3, iletisimNoktalariListesi.get(i).getIl());
psIN.setString(4, iletisimNoktalariListesi.get(i).getIlce());
psIN.setString(5, iletisimNoktalariListesi.get(i).getTelefon());
psIN.setString(6, iletisimNoktalariListesi.get(i).getEposta());
psIN.setString(7, iletisimNoktalariListesi.get(i).getFax());
// psIN.setLong(8, 1);
psIN.setLong(8, 1);
psIN.setLong(9, musteriTedarikci.getId());
psIN.executeUpdate();
}
connection.commit();
psMTID.close();
ps.close();

} catch (SQLException ex) {
Logger.getLogger(MusteriYonetimiImpl.class.getName()).log(Level.SEVERE, null, ex);
} finally {
if (connection != null) {
connectionHelper.closeConnection(connection);
}
}
return true;
}

@Override
public List<MusteriTedarikci> tumMusterilerTedarikciler(Organizasyon organizasyon) {
DBConnectionHelper connectionHelper = DBConnectionHelper.getInstance();
Connection connection = null;
PreparedStatement ps = null;
List<MusteriTedarikci> musteriler = new ArrayList<MusteriTedarikci>();
try {
connection = connectionHelper.getConnection();

ps = connection.prepareStatement("SELECT MA.ID,MA.TAM_UNVAN,MA.UNVAN,MA.VERGI_DAIRESI,MA.TCKN_VKN,MA.TICARET_SICIL_NO,MA.KURULUS_TARIHI,MA.TESCIL_TARIHI,n" +
"MA.MERSIS_NO,MA.TEMEL_ISKONTO,MA.KREDI_LIMITI,MA.FIRMA_TURU,MA.M_TUR,MA.ORGANIZASYON_ID,MA.AKTIFLIK,MA.OLUSTURULMA_TARIHI,MA.OLUSTURAN_ID,n" +
" MA.DUZENLENME_TARIHI,MA.DUZENLEYEN_ID, K.ADI AS OLUSTURAN, K2.ADI AS DUZENLEYENn" +
" FROM CRM.MUSTERI_TEDARIKCI MAn" +
" left join USR.KULLANICI K ON OLUSTURAN_ID=K.IDn" +
" LEFT JOIN USR.KULLANICI K2 ON DUZENLEYEN_ID=K2.ID " );
//ps.setString(1, tur.getAdi());//whereden sonraki sartlar icin //WHERE MA.ID=? and MA.ORGANIZASYON_ID=? "
// ps.setLong(1, 1);
//ps.setLong(2, organizasyon.getId());
ResultSet rs = ps.executeQuery();
while (rs.next()) {
MusteriTedarikci musteriTedarikci = new MusteriTedarikci();
musteriTedarikci.setId(rs.getLong("ID"));
musteriTedarikci.setTamUnvan(rs.getString("TAM_UNVAN"));
musteriTedarikci.setUnvan(rs.getString("UNVAN"));
musteriTedarikci.setVergiDairesi(rs.getString("VERGI_DAIRESI"));
musteriTedarikci.setTcknVkn(rs.getString("TCKN_VKN"));
musteriTedarikci.setTicaretSicilNo(rs.getInt("TICARET_SICIL_NO"));
musteriTedarikci.setKurulusTarihi(rs.getDate("KURULUS_TARIHI"));
musteriTedarikci.setTescilTarihi(rs.getDate("TESCIL_TARIHI"));
musteriTedarikci.setMersisNo(rs.getString("MERSIS_NO"));
musteriTedarikci.setTemelIskonto(rs.getDouble("TEMEL_ISKONTO"));
musteriTedarikci.setKrediLimiti(rs.getDouble("KREDI_LIMITI"));
musteriTedarikci.setFirmaTuru(rs.getString("FIRMA_TURU"));
Organizasyon o = new Organizasyon();
o.setId(rs.getLong("ORGANIZASYON_ID"));
musteriTedarikci.setOrganizasyon(o);
musteriTedarikci.setMusteri_tur(rs.getString("M_TUR"));
//musteriTedarikci.(rs.getLong("ID"));
// Tur tb=new Tur();
// tb.setId(rs.getLong("M_TUR"));
// musteriTedarikci.setTur(tb);
musteriTedarikci.setAktiflik(rs.getBoolean("AKTIFLIK"));
musteriTedarikci.setOlusturulmaTarihi(rs.getDate("OLUSTURULMA_TARIHI"));
Kullanici k = new Kullanici();
k.setId(rs.getLong("OLUSTURAN_ID"));
k.setAdi(rs.getString("OLUSTURAN"));
musteriTedarikci.setOlusturan(k);
musteriTedarikci.setDuzenlenmeTarihi(rs.getDate("DUZENLENME_TARIHI"));
Kullanici k2 = new Kullanici();
k2.setId(rs.getLong("DUZENLEYEN_ID"));
k2.setAdi(rs.getString("DUZENLEYEN"));
musteriTedarikci.setDuzenleyen(k2);
musteriler.add(musteriTedarikci);
}
rs.close();
if (ps != null) {
try {
ps.close();
} catch (SQLException ex) {
Logger.getLogger(MusteriYonetimiImpl.class.getName()).log(Level.SEVERE, null, ex);
}
}
} catch (SQLException ex) {

Logger.getLogger(MusteriYonetimiImpl.class.getName()).log(Level.SEVERE, null, ex);
} finally {
if (connection != null) {
connectionHelper.closeConnection(connection);
}

}

return musteriler;
}

@Override
public boolean musteriTedarikciDuzenle(Organizasyon organizasyon,Kullanici kullanici,Tur tur, MusteriTedarikci musteriTedarikci, List<IletisimNoktalari> iletisimNoktalariListesi,List<IletisimNoktalari> iletisimNoktalariSilinenListesi) {
DBConnectionHelper connectionHelper = DBConnectionHelper.getInstance();
Connection connection = null;
PreparedStatement ps = null;
PreparedStatement psINUp = null;
PreparedStatement psINIn = null;
PreparedStatement psINSil = null;
try {
connection = connectionHelper.getConnection();
connection.setAutoCommit(false);
ps = connection.prepareStatement("UPDATE CRM.MUSTERI_TEDARIKCI SET TAM_UNVAN=?,UNVAN=?,VERGI_DAIRESI=?,TCKN_VKN=?,TICARET_SICIL_NO=?,"
+ "KURULUS_TARIHI=?,TESCIL_TARIHI=?,MERSIS_NO=?,TEMEL_ISKONTO=?,KREDI_LIMITI=?,FIRMA_TURU=?,M_TUR=?,DUZENLENME_TARIHI=?,"
+ "DUZENLEYEN_ID=?,AKTIFLIK=? WHERE ID=?");
//hmm test amaçlı, ok
ps.setString(1, musteriTedarikci.getTamUnvan());
ps.setString(2, musteriTedarikci.getUnvan());
ps.setString(3, musteriTedarikci.getVergiDairesi());
ps.setString(4, musteriTedarikci.getTcknVkn());
ps.setInt(5, musteriTedarikci.getTicaretSicilNo());
java.sql.Date sqlDate = new java.sql.Date(musteriTedarikci.getKurulusTarihi().getTime());
ps.setDate(6, sqlDate);
java.sql.Date sqlDate2 = new java.sql.Date(musteriTedarikci.getTescilTarihi().getTime());
ps.setDate(7, sqlDate2);
ps.setString(8, musteriTedarikci.getMersisNo());
ps.setDouble(9, musteriTedarikci.getTemelIskonto());
ps.setDouble(10, musteriTedarikci.getKrediLimiti());
ps.setString(11, musteriTedarikci.getFirmaTuru());
// ps.setLong(12, 1);
ps.setString(12, musteriTedarikci.getMusteri_tur());
Date date = new Date();
ps.setTimestamp(13, new Timestamp(date.getTime()));
// ps.setLong(13, kullanici.getId());
ps.setLong(14, 1);
ps.setBoolean(15, musteriTedarikci.getAktiflik());
ps.setLong(16, musteriTedarikci.getId());
ps.executeUpdate();
ps.close();
for (int i = 0; i < iletisimNoktalariListesi.size(); i++) {
if (iletisimNoktalariListesi.get(i).getId() != null) {
psINUp = connection.prepareStatement("UPDATE CRM.ILETISIM_NOKTALARI SET ADI=?,ADRES=?,IL=?,ILCE=?,TELEFON=?,"
+ "EPOSTA=?,FAX=? WHERE ID=? AND MUSTERI_TEDARIKCI_ID=?");
psINUp.setString(1, iletisimNoktalariListesi.get(i).getAdi());
psINUp.setString(2, iletisimNoktalariListesi.get(i).getAdres());
psINUp.setString(3, iletisimNoktalariListesi.get(i).getIl());
psINUp.setString(4, iletisimNoktalariListesi.get(i).getIlce());
psINUp.setString(5, iletisimNoktalariListesi.get(i).getTelefon());
psINUp.setString(6, iletisimNoktalariListesi.get(i).getEposta());
psINUp.setString(7, iletisimNoktalariListesi.get(i).getFax());
psINUp.setLong(8, iletisimNoktalariListesi.get(i).getId());
psINUp.setLong(9, musteriTedarikci.getId());
psINUp.executeUpdate();
psINUp.close();
} else {
psINIn = connection.prepareStatement("INSERT INTO CRM.ILETISIM_NOKTALARI(ADI,ADRES,IL,ILCE,TELEFON,EPOSTA,FAX,ORGANIZASYON_ID,MUSTERI_TEDARIKCI_ID) VALUES (?,?,?,?,?,?,?,?,?)");
psINIn.setString(1, iletisimNoktalariListesi.get(i).getAdi());
psINIn.setString(2, iletisimNoktalariListesi.get(i).getAdres());
psINIn.setString(3, iletisimNoktalariListesi.get(i).getIl());
psINIn.setString(4, iletisimNoktalariListesi.get(i).getIlce());
psINIn.setString(5, iletisimNoktalariListesi.get(i).getTelefon());
psINIn.setString(6, iletisimNoktalariListesi.get(i).getEposta());
psINIn.setString(7, iletisimNoktalariListesi.get(i).getFax());
//psINIn.setLong(8, organizasyon.getId());
psINIn.setLong(8, 1);
psINIn.setLong(9, musteriTedarikci.getId());
psINIn.executeUpdate();
psINIn.close();
}
}
for (int i = 0; i < iletisimNoktalariSilinenListesi.size(); i++) {
psINSil = connection.prepareStatement("DELETE FROM CRM.ILETISIM_NOKTALARI WHERE ID=?");
psINSil.setLong(1, iletisimNoktalariSilinenListesi.get(i).getId());
psINSil.executeUpdate();
psINSil.close();
}

connection.commit();
} catch (SQLException ex) {
Logger.getLogger(MusteriYonetimiImpl.class.getName()).log(Level.SEVERE, null, ex);
} finally {
if (connection != null) {
connectionHelper.closeConnection(connection);
}
}
return true;
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.