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

# Class InetSessionLogDao

java.lang.Object
ru.bitel.bgbilling.kernel.base.server.logger.BGLogger
ru.bitel.common.dao.AbstarctDaoConstant
ru.bitel.common.dao.AbstractDao<InetSessionLog>
ru.bitel.bgbilling.modules.inet.server.bean.InetSessionLogDao

All Implemented Interfaces:
  `AutoCloseable`

public class InetSessionLogDao extends ru.bitel.common.dao.AbstractDao<InetSessionLog>
Класс считывающий а) либо текущие сессии(inet_session) с констуктором без даты а) либо завершенные сессии(inet_session_log) с конструктором с датой

- ## 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
  Description
  `static final String`
  `TABLE_INET_CONNECTION`
  `static final String`
  `TABLE_INET_SESSION`
  `static final String`
  `TABLE_INET_SESSION_ACCOUNT`
  `static final String`
  `TABLE_INET_SESSION_DETAIL`
  `static final String`
  `TABLE_INET_SESSION_LOG`
  `static final String`
  `TABLE_INET_SESSION_LOG_ACCOUNT`
  `static final String`
  `TABLE_INET_SESSION_LOG_DETAIL`
  `static final String`
  `TABLE_INET_SESSION_LOG_ROUTE`
  `static final String`
  `TABLE_INET_SESSION_ROUTE`

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

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

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

  `ERROR, fields, SQL_ALL, SQL_AND, SQL_CALC_FOUND_ROWS, SQL_DELETE, SQL_DISTINCT, SQL_EQ, SQL_EQCS, SQL_FROM, SQL_GROUP, SQL_IN, SQL_INSERT, SQL_JOIN, SQL_LEFT_JOIN, SQL_LIMIT, SQL_NOT_IN, SQL_ON, SQL_ON_DUPLICATE_KEY_UPDATE, SQL_ORDER, SQL_SELECT, SQL_SET, SQL_UPDATE, SQL_VALUES, SQL_WHERE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `InetSessionLogDao(Connection con, int moduleId)`
  `InetSessionLogDao(Connection con, int moduleId, Date date)`

- ## Method Summary

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

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

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

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

  `getSQLOrder, psSetDate, psSetInt, psSetString, queryAndIn`

  ### Methods inherited from class ru.bitel.bgbilling.kernel.base.server.logger.BGLogger

  `error, error, error, getLogger, logError, logError, warn`

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

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

- ## Field Details

  - ### TABLE_INET_SESSION

    public static final String TABLE_INET_SESSION
    See Also:
      - Constant Field Values

  - ### TABLE_INET_SESSION_DETAIL

    public static final String TABLE_INET_SESSION_DETAIL
    See Also:
      - Constant Field Values

  - ### TABLE_INET_SESSION_ACCOUNT

    public static final String TABLE_INET_SESSION_ACCOUNT
    See Also:
      - Constant Field Values

  - ### TABLE_INET_SESSION_LOG

    public static final String TABLE_INET_SESSION_LOG
    See Also:
      - Constant Field Values

  - ### TABLE_INET_SESSION_LOG_DETAIL

    public static final String TABLE_INET_SESSION_LOG_DETAIL
    See Also:
      - Constant Field Values

  - ### TABLE_INET_SESSION_LOG_ACCOUNT

    public static final String TABLE_INET_SESSION_LOG_ACCOUNT
    See Also:
      - Constant Field Values

  - ### TABLE_INET_SESSION_LOG_ROUTE

    public static final String TABLE_INET_SESSION_LOG_ROUTE
    See Also:
      - Constant Field Values

  - ### TABLE_INET_SESSION_ROUTE

    public static final String TABLE_INET_SESSION_ROUTE
    See Also:
      - Constant Field Values

  - ### TABLE_INET_CONNECTION

    public static final String TABLE_INET_CONNECTION
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### InetSessionLogDao

    public InetSessionLogDao(Connection con, int moduleId, Date date) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### InetSessionLogDao

    public InetSessionLogDao(Connection con, int moduleId) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

- ## Method Details

  - ### getFromRS

    protected InetSessionLog getFromRS(ResultSet rs) throws SQLException, ru.bitel.bgbilling.common.BGException
    Specified by:
      `getFromRS` in class `ru.bitel.common.dao.AbstractDao<InetSessionLog>`
    Throws:
      `SQLException`
      `ru.bitel.bgbilling.common.BGException`

  - ### checkTables

    public static void checkTables(Connection con, int moduleId, Date date) throws SQLException, ru.bitel.bgbilling.common.BGException
    Throws:
      `SQLException`
      `ru.bitel.bgbilling.common.BGException`

  - ### updateImpl

    protected void updateImpl(InetSessionLog b) throws ru.bitel.bgbilling.common.BGException, SQLException
    Specified by:
      `updateImpl` in class `ru.bitel.common.dao.AbstractDao<InetSessionLog>`
    Throws:
      `ru.bitel.bgbilling.common.BGException`
      `SQLException`

  - ### killSessionsForServWithTraffic

    public void killSessionsForServWithTraffic(Set<Integer> servIds, Set<Integer> deviceIds, Date day) throws ru.bitel.bgbilling.common.BGException
    Удаляем за один день
    Parameters:
      `servIds` -
      `deviceIds` -
      `day` -
      `con` -
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### killSessionsForServWithTraffic

    public void killSessionsForServWithTraffic(Set<Integer> servIds, Set<Integer> deviceIds, Period period) throws ru.bitel.bgbilling.common.BGException
    Удаляем за период в пределах месяца
    Parameters:
      `servIds` -
      `deviceIds` -
      `period` -
      `con` -
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### listChildren

    public List<InetSessionLog> listChildren(long parentId) throws SQLException, ru.bitel.bgbilling.common.BGException
    Throws:
      `SQLException`
      `ru.bitel.bgbilling.common.BGException`

  - ### listChildren

    public List<InetSessionLog> listChildren(long parentId, Date date) throws SQLException, ru.bitel.bgbilling.common.BGException
    Throws:
      `SQLException`
      `ru.bitel.bgbilling.common.BGException`

  - ### list

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

  - ### listForContracts

    public List<InetSessionLog> listForContracts(Set<Integer> cids, Date timeFrom, Date timeTo) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### list

    public List<InetSessionLog> list(Set<Integer> deviceIds, Date timeFrom, Date timeTo) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### list

    public List<InetSessionLog> list(Set<Integer> deviceIds, Set<Integer> contractIds, String contract, Set<Integer> servIds, String login, String ip, String callingStation, Date timeFrom, 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 PreparedStatement getPs(int contractId, Collection<Integer> servIds, Period period, Page page, String sql) throws SQLException
    Throws:
      `SQLException`

  - ### setParams

    protected void setParams(int cid, Period period, PreparedStatement ps) throws SQLException
    Throws:
      `SQLException`

  - ### addWherePart

    protected String addWherePart(Collection<Integer> servIds, Period period, String sql)

  - ### getSumReportInfo

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

  - ### populateSessionTraffics

    public void populateSessionTraffics(List<InetSessionLog> sessions, Collection<Integer> trafficTypeIds) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### loadTraffics

    public void loadTraffics(List<InetSessionLog> sessions, Collection<Integer> trafficTypeIds) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### loadAccount

    public void loadAccount(List<InetSessionLog> sessions, Collection<Integer> serviceIds) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### getSessionTrafficsReport

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

  - ### getSessionAccountSums

    public TrafficAccountDetail getSessionAccountSums(int cid, Collection<Integer> servIds, Period period, Collection<Integer> serviceIds) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### list

    public 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 List<TrafficAmount> traffic(int contractId, Set<Integer> inetServIds, int sessionId, Set<Integer> trafficTypeIds, Period period, 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 Map<Integer,Long> getSessionAccountReport(int cid, Collection<Integer> servIds, Period period, Collection<Integer> trafficTypeIds) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### fixSequence

    public static void fixSequence(Connection con, int moduleId) throws SQLException
    в mysql при перезапуске слетал auto_increment у таблиц с sequence и нужно вручную их подправить, чтобы не было дублей сессий/соединений
    Parameters:
      `con` - соединение с бд
      `moduleId` - код модуля
    Throws:
      `SQLException`

  - ### getDetailTableName

    public String getDetailTableName()

  - ### getSessionTableName

    public String getSessionTableName()