ru.bitel.bgbilling.modules.inet.api.server.bean

## Class InetSessionLogDao

- java.lang.Object
- - ru.bitel.common.dao.AbstarctDaoConstant
  - - ru.bitel.common.dao.AbstractDao<InetSessionLog>
    - - ru.bitel.bgbilling.modules.inet.api.server.bean.InetSessionLogDao

- All Implemented Interfaces:
    java.lang.AutoCloseable

      public class InetSessionLogDao
      extends ru.bitel.common.dao.AbstractDao<InetSessionLog>

  Класс считвающий а) либо текущие сессии(inet_session) с констуктором без даты а) либо завершенные сессии(inet_session) с конструктором с датой

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class ru.bitel.common.dao.AbstractDao

      `ru.bitel.common.dao.AbstractDao.ResultSetIterator`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `TABLE_INET_CONNECTION`
    `static java.lang.String` | `TABLE_INET_SESSION`
    `static java.lang.String` | `TABLE_INET_SESSION_ACCOUNT`
    `static java.lang.String` | `TABLE_INET_SESSION_DETAIL`
    `static java.lang.String` | `TABLE_INET_SESSION_LOG`
    `static java.lang.String` | `TABLE_INET_SESSION_LOG_ACCOUNT`
    `static java.lang.String` | `TABLE_INET_SESSION_LOG_DETAIL`
    `static java.lang.String` | `TABLE_INET_SESSION_LOG_ROUTE`
    `static java.lang.String` | `TABLE_INET_SESSION_ROUTE`

    - ### Fields inherited from class ru.bitel.common.dao.AbstractDao

      `cacheFilter, cacheJoin, cacheOrderBy, cachePaged, cachePS, cacheWhat, con, getByIdPS, mid, moduleId, orderByPattern, tableName`

    - ### Fields inherited from class ru.bitel.common.dao.AbstarctDaoConstant

      `ERROR, SQL_CALC_FOUND_ROWS, SQL_DELETE, SQL_DISTINCT, SQL_EQ, SQL_EQCS, SQL_FROM, SQL_GROUP, SQL_IN, SQL_INSERT, SQL_LIMIT, SQL_ON_DUPLICATE_KEY_UPDATE, SQL_ORDER, SQL_SELECT, SQL_SET, SQL_UPDATE, SQL_VALUES, SQL_WHERE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `InetSessionLogDao(java.sql.Connection con, int moduleId)`
    `InetSessionLogDao(java.sql.Connection con, int moduleId, java.util.Date date)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected java.lang.String` | `addWherePart(java.util.Collection<java.lang.Integer> servIds, Period period, java.lang.String sql)`
    `static void` | `checkTables(java.sql.Connection con, int moduleId, java.util.Date date)`
    `static void` | `fixSequence(java.sql.Connection con, int moduleId)` в mysql при перезапуске слетал auto_increment у таблиц с sequence и нужно вручную их подправить, чтобы не было дублей сессий/соединений
    `InetSessionLog` | `get(long id)`
    `protected InetSessionLog` | `getFromRS(java.sql.ResultSet rs)`
    `protected java.sql.PreparedStatement` | `getPs(int cid, java.util.Collection<java.lang.Integer> servIds, Period period, Page page, java.lang.String sql)`
    `java.util.Map<java.lang.Integer,java.lang.Long>` | `getSessionAccountReport(int cid, java.util.Collection<java.lang.Integer> servIds, Period period, java.util.Collection<java.lang.Integer> trafficTypeIds)`
    `TrafficAccountDetail` | `getSessionAccountSums(int cid, java.util.Collection<java.lang.Integer> servIds, Period period, java.util.Collection<java.lang.Integer> serviceIds)`
    `java.util.Map<java.lang.Integer,java.lang.Long>` | `getSessionTrafficsReport(int cid, java.util.Collection<java.lang.Integer> servIds, Period period, java.util.Collection<java.lang.Integer> trafficTypeIds)`
    `void` | `getSumReportInfo(int cid, java.util.Collection<java.lang.Integer> servIds, Period period, Result<?> result)`
    `boolean` | `isReadSessionRoute()`
    `java.util.List<InetSessionLog>` | `list(int idDivizor, int idRemainder, java.util.Date dateFrom, java.util.Date dateTo)`
    `java.util.List<InetSessionLog>` | `list(long connectionId)`
    `java.util.List<InetSessionLog>` | `list(java.util.Set<java.lang.Integer> deviceIds, java.util.Date timeFrom, java.util.Date timeTo)`
    `java.util.List<InetSessionLog>` | `list(java.util.Set<java.lang.Integer> deviceIds, java.util.Set<java.lang.Integer> contractIds, java.lang.String contract, java.util.Set<java.lang.Integer> servIds, java.lang.String login, java.lang.String ip, java.lang.String callingStation, java.util.Date timeFrom, java.util.Date timeTo, boolean asc, Page page)` Получение отчета по сессиям
    `java.util.List<InetSessionLog>` | `listChildren(long parentId)`
    `java.util.List<InetSessionLog>` | `listChildren(long parentId, java.util.Date date)`
    `java.util.List<InetSessionLog>` | `listForContracts(java.util.Set<java.lang.Integer> cids, java.util.Date timeFrom, java.util.Date timeTo)`
    `void` | `loadAccount(java.util.List<InetSessionLog> sessions, java.util.Collection<java.lang.Integer> serviceIds)`
    `void` | `loadTraffics(java.util.List<InetSessionLog> sessions, java.util.Collection<java.lang.Integer> trafficTypeIds)`
    `void` | `populateSessionTraffics(java.util.List<InetSessionLog> sessions, java.util.Collection<java.lang.Integer> trafficTypeIds)`
    `protected void` | `setParams(int cid, Period period, Page page, java.sql.PreparedStatement ps)`
    `void` | `setReadSessionRoute(boolean readSessionRoute)`
    `java.util.List<TrafficAmount>` | `traffic(int contractId, java.util.Set<java.lang.Integer> inetServIds, int sessionId, java.util.Set<java.lang.Integer> trafficTypeIds, java.util.Date dateFrom, java.util.Date dateTo, boolean byDay, boolean includeActive, boolean continuous)` Отчет по трафику
    `protected void` | `updateImpl(InetSessionLog b)`

    - ### Methods inherited from class ru.bitel.common.dao.AbstractDao

      `close, delete, deleteImpl, eq, get, getById, getImpl, getListFromRS, getPeriod, getSQLOrder, getTableName, list, list, listImpl, listImpl, listImplPS, listImplPS, ormFromResultSet, ormUpdateImpl, ormUpdateImpl, processException, recycle, setStatementParam, update`

    - ### Methods inherited from class ru.bitel.common.dao.AbstarctDaoConstant

      `getSQLOrder`

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

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

- - ### Field Detail

    - #### TABLE_INET_SESSION_LOG

          public static final java.lang.String TABLE_INET_SESSION_LOG

      See Also:
        Constant Field Values

    - #### TABLE_INET_SESSION_LOG_DETAIL

          public static final java.lang.String TABLE_INET_SESSION_LOG_DETAIL

      See Also:
        Constant Field Values

    - #### TABLE_INET_SESSION_LOG_ACCOUNT

          public static final java.lang.String TABLE_INET_SESSION_LOG_ACCOUNT

      See Also:
        Constant Field Values

    - #### TABLE_INET_SESSION_LOG_ROUTE

          public static final java.lang.String TABLE_INET_SESSION_LOG_ROUTE

      See Also:
        Constant Field Values

    - #### TABLE_INET_SESSION

          public static final java.lang.String TABLE_INET_SESSION

      See Also:
        Constant Field Values

    - #### TABLE_INET_SESSION_DETAIL

          public static final java.lang.String TABLE_INET_SESSION_DETAIL

      See Also:
        Constant Field Values

    - #### TABLE_INET_SESSION_ACCOUNT

          public static final java.lang.String TABLE_INET_SESSION_ACCOUNT

      See Also:
        Constant Field Values

    - #### TABLE_INET_SESSION_ROUTE

          public static final java.lang.String TABLE_INET_SESSION_ROUTE

      See Also:
        Constant Field Values

    - #### TABLE_INET_CONNECTION

          public static final java.lang.String TABLE_INET_CONNECTION

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### InetSessionLogDao

          public InetSessionLogDao(java.sql.Connection con,
                                   int moduleId,
                                   java.util.Date date)
                            throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### InetSessionLogDao

          public InetSessionLogDao(java.sql.Connection con,
                                   int moduleId)
                            throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

  - ### Method Detail

    - #### getFromRS

          protected InetSessionLog getFromRS(java.sql.ResultSet rs)
                                      throws java.sql.SQLException,
                                             ru.bitel.bgbilling.common.BGException

      Specified by:
        `getFromRS` in class `ru.bitel.common.dao.AbstractDao<InetSessionLog>`
      Throws:
        `java.sql.SQLException`
        `ru.bitel.bgbilling.common.BGException`

    - #### checkTables

          public static void checkTables(java.sql.Connection con,
                                         int moduleId,
                                         java.util.Date date)
                                  throws java.sql.SQLException,
                                         ru.bitel.bgbilling.common.BGException

      Throws:
        `java.sql.SQLException`
        `ru.bitel.bgbilling.common.BGException`

    - #### updateImpl

          protected void updateImpl(InetSessionLog b)
                             throws ru.bitel.bgbilling.common.BGException,
                                    java.sql.SQLException

      Specified by:
        `updateImpl` in class `ru.bitel.common.dao.AbstractDao<InetSessionLog>`
      Throws:
        `ru.bitel.bgbilling.common.BGException`
        `java.sql.SQLException`

    - #### listChildren

          public java.util.List<InetSessionLog> listChildren(long parentId)
                                                      throws java.sql.SQLException,
                                                             ru.bitel.bgbilling.common.BGException

      Throws:
        `java.sql.SQLException`
        `ru.bitel.bgbilling.common.BGException`

    - #### listChildren

          public java.util.List<InetSessionLog> listChildren(long parentId,
                                                             java.util.Date date)
                                                      throws java.sql.SQLException,
                                                             ru.bitel.bgbilling.common.BGException

      Throws:
        `java.sql.SQLException`
        `ru.bitel.bgbilling.common.BGException`

    - #### list

          public java.util.List<InetSessionLog> list(int idDivizor,
                                                     int idRemainder,
                                                     java.util.Date dateFrom,
                                                     java.util.Date dateTo)
                                              throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### listForContracts

          public java.util.List<InetSessionLog> listForContracts(java.util.Set<java.lang.Integer> cids,
                                                                 java.util.Date timeFrom,
                                                                 java.util.Date timeTo)
                                                          throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### list

          public java.util.List<InetSessionLog> list(java.util.Set<java.lang.Integer> deviceIds,
                                                     java.util.Date timeFrom,
                                                     java.util.Date timeTo)
                                              throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### list

          public java.util.List<InetSessionLog> list(java.util.Set<java.lang.Integer> deviceIds,
                                                     java.util.Set<java.lang.Integer> contractIds,
                                                     java.lang.String contract,
                                                     java.util.Set<java.lang.Integer> servIds,
                                                     java.lang.String login,
                                                     java.lang.String ip,
                                                     java.lang.String callingStation,
                                                     java.util.Date timeFrom,
                                                     java.util.Date timeTo,
                                                     boolean asc,
                                                     Page page)
                                              throws ru.bitel.bgbilling.common.BGException

      Получение отчета по сессиям
      Parameters:
        `deviceIds` -
        `contractIds` -
        `contract` -
        `servIds` -
        `login` -
        `ip` -
        `callingStation` -
        `timeFrom` -
        `timeTo` -
        `asc` -
        `page` -
      Returns:
      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### getPs

          protected java.sql.PreparedStatement getPs(int cid,
                                                     java.util.Collection<java.lang.Integer> servIds,
                                                     Period period,
                                                     Page page,
                                                     java.lang.String sql)
                                              throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### setParams

          protected void setParams(int cid,
                                   Period period,
                                   Page page,
                                   java.sql.PreparedStatement ps)
                            throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### addWherePart

          protected java.lang.String addWherePart(java.util.Collection<java.lang.Integer> servIds,
                                                  Period period,
                                                  java.lang.String sql)

    - #### getSumReportInfo

          public void getSumReportInfo(int cid,
                                       java.util.Collection<java.lang.Integer> servIds,
                                       Period period,
                                       Result<?> result)
                                throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### populateSessionTraffics

          public void populateSessionTraffics(java.util.List<InetSessionLog> sessions,
                                              java.util.Collection<java.lang.Integer> trafficTypeIds)
                                       throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### loadTraffics

          public void loadTraffics(java.util.List<InetSessionLog> sessions,
                                   java.util.Collection<java.lang.Integer> trafficTypeIds)
                            throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### loadAccount

          public void loadAccount(java.util.List<InetSessionLog> sessions,
                                  java.util.Collection<java.lang.Integer> serviceIds)
                           throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### getSessionTrafficsReport

          public java.util.Map<java.lang.Integer,java.lang.Long> getSessionTrafficsReport(int cid,
                                                                                          java.util.Collection<java.lang.Integer> servIds,
                                                                                          Period period,
                                                                                          java.util.Collection<java.lang.Integer> trafficTypeIds)
                                                                                   throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### getSessionAccountSums

          public TrafficAccountDetail getSessionAccountSums(int cid,
                                                            java.util.Collection<java.lang.Integer> servIds,
                                                            Period period,
                                                            java.util.Collection<java.lang.Integer> serviceIds)
                                                     throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### list

          public java.util.List<InetSessionLog> list(long connectionId)
                                              throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### get

          public InetSessionLog get(long id)
                             throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### traffic

          public java.util.List<TrafficAmount> traffic(int contractId,
                                                       java.util.Set<java.lang.Integer> inetServIds,
                                                       int sessionId,
                                                       java.util.Set<java.lang.Integer> trafficTypeIds,
                                                       java.util.Date dateFrom,
                                                       java.util.Date dateTo,
                                                       boolean byDay,
                                                       boolean includeActive,
                                                       boolean continuous)
                                                throws ru.bitel.bgbilling.common.BGException

      Отчет по трафику
      Parameters:
        `contractId` -
        `inetServIds` -
        `sessionId` -
        `trafficTypeIds` -
      Returns:
      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### isReadSessionRoute

          public boolean isReadSessionRoute()

    - #### setReadSessionRoute

          public void setReadSessionRoute(boolean readSessionRoute)

    - #### getSessionAccountReport

          public java.util.Map<java.lang.Integer,java.lang.Long> getSessionAccountReport(int cid,
                                                                                         java.util.Collection<java.lang.Integer> servIds,
                                                                                         Period period,
                                                                                         java.util.Collection<java.lang.Integer> trafficTypeIds)
                                                                                  throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### fixSequence

          public static void fixSequence(java.sql.Connection con,
                                         int moduleId)
                                  throws java.sql.SQLException

      в mysql при перезапуске слетал auto_increment у таблиц с sequence и нужно вручную их подправить, чтобы не было дублей сессий/соединений
      Parameters:
        `con` - соединение с бд
        `moduleId` - код модуля
      Throws:
        `java.sql.SQLException`