Package ru.bitel.bgbilling.kernel.contract.api.server.bean.customer

# Class CustomerDao

java.lang.Object
ru.bitel.bgbilling.kernel.contract.api.server.bean.customer.CustomerDao

    public class CustomerDao
    extends java.lang.Object

- ## Field Summary

  Fields
  Modifier and Type | Field | Description
  --- | --- | ---
  `static java.lang.String` | `TABLE_CUSTOMER` |
  `static java.lang.String` | `TABLE_CUSTOMER_LINK` |
  `static java.lang.String` | `TABLE_CUSTOMER_LOG` |

- ## Constructor Summary

  Constructors
  Constructor | Description
  --- | ---
  `CustomerDao​(java.sql.Connection con)` |

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `void` | `addCustomerLink​(CustomerLink customerLink)` |
  `Customer` | `getCustomer​(int customerId)` | Строка в JSON формате с данными клиента
  `org.json.JSONArray` | `getCustomerContracts​(int customerId, java.time.LocalDateTime onTime)` |
  `org.json.JSONObject` | `getCustomerDataJson​(int customerId)` |
  `java.util.Optional<CustomerLink>` | `getCustomerLink​(int contractId, java.time.LocalDateTime dateTime)` |
  `java.lang.String` | `getCustomerParameter​(int customerId, java.lang.String fieldKey)` |
  `java.lang.String` | `getCustomerParameterHistory​(int customerId, java.lang.String fieldKey, int lastRecordCount)` |
  `int` | `getNewCustomerId​(Customer.CustomerType type)` |
  `org.json.JSONArray` | `searchByKey​(Customer.CustomerType customerType, java.lang.String key, java.lang.String value)` |
  `org.json.JSONArray` | `searchByPassportRF​(java.lang.String serial, java.lang.String number)` |
  `void` | `setCustomerLink​(int contractId, int сustomerId, java.time.LocalDateTime linkDateTimeFrom)` | Установка связки клиент - договор
  `boolean` | `setCustomerUnlinkContract​(int contractId, java.time.LocalDateTime unlinkTime)` |
  `java.lang.String` | `updateCustomerFieldValue​(int customerId, java.lang.String fieldKey, java.lang.String fieldValue, int userId)` |

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### TABLE_CUSTOMER

    public static final java.lang.String TABLE_CUSTOMER
    See Also:
      Constant Field Values

  - ### TABLE_CUSTOMER_LOG

    public static final java.lang.String TABLE_CUSTOMER_LOG
    See Also:
      Constant Field Values

  - ### TABLE_CUSTOMER_LINK

    public static final java.lang.String TABLE_CUSTOMER_LINK
    See Also:
      Constant Field Values

- ## Constructor Details

  - ### CustomerDao

    public CustomerDao​(java.sql.Connection con)

- ## Method Details

  - ### getCustomerLink

    public java.util.Optional<CustomerLink> getCustomerLink​(int contractId, java.time.LocalDateTime dateTime) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### addCustomerLink

    public void addCustomerLink​(CustomerLink customerLink) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### getNewCustomerId

    public int getNewCustomerId​(Customer.CustomerType type) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### updateCustomerFieldValue

    public java.lang.String updateCustomerFieldValue​(int customerId, java.lang.String fieldKey, java.lang.String fieldValue, int userId) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### getCustomerDataJson

    public org.json.JSONObject getCustomerDataJson​(int customerId) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### getCustomer

    public Customer getCustomer​(int customerId) throws ru.bitel.bgbilling.common.BGException
    Строка в JSON формате с данными клиента
    Parameters:
      `customerId` -
    Returns:
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### searchByKey

    public org.json.JSONArray searchByKey​(Customer.CustomerType customerType, java.lang.String key, java.lang.String value) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### searchByPassportRF

    public org.json.JSONArray searchByPassportRF​(java.lang.String serial, java.lang.String number) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### setCustomerLink

    public void setCustomerLink​(int contractId, int сustomerId, java.time.LocalDateTime linkDateTimeFrom) throws ru.bitel.bgbilling.common.BGException
    Установка связки клиент - договор
    Parameters:
      `contractId` - id договора
      `\u0441ustomerId` - id кастомера
      `linkDateTimeFrom` - время привязки
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### getCustomerContracts

    public org.json.JSONArray getCustomerContracts​(int customerId, java.time.LocalDateTime onTime) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### setCustomerUnlinkContract

    public boolean setCustomerUnlinkContract​(int contractId, java.time.LocalDateTime unlinkTime) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### getCustomerParameterHistory

    public java.lang.String getCustomerParameterHistory​(int customerId, java.lang.String fieldKey, int lastRecordCount) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### getCustomerParameter

    public java.lang.String getCustomerParameter​(int customerId, java.lang.String fieldKey) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`