Class ContractPatternDao

java.lang.Object
ru.bitel.bgbilling.kernel.base.server.logger.BGLogger
ru.bitel.bgbilling.common.dao.AbstractDaoConstant
ru.bitel.bgbilling.common.dao.AbstractDao<ContractPattern>
ru.bitel.bgbilling.common.dao.AbstractIdDao<ContractPattern>
ru.bitel.bgbilling.kernel.contract.pattern.server.dao.ContractPatternDao

public class ContractPatternDao extends ru.bitel.bgbilling.common.dao.AbstractIdDao<ContractPattern>
  • Nested Class Summary

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

    ru.bitel.bgbilling.common.dao.AbstractDao.ListParams
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     

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

    orderByPattern

    Fields inherited from class ru.bitel.bgbilling.common.dao.AbstractDaoConstant

    con, ERROR, fields, moduleId, SQL_ALL, SQL_AND, 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_ORDER, SQL_SELECT, SQL_SET, SQL_UPDATE, SQL_VALUES, SQL_WHERE, tableName
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    List<ru.bitel.bgbilling.kernel.contract.pattern.common.dto.ContractParameterData>
    contractParameterDataList(int contractPatternId)
     
    contractPatternTitles(boolean showHidden)
     
    int
    delete(int patternId)
     
    List<ru.bitel.bgbilling.kernel.contract.pattern.common.dto.ContractPatternInfo>
     
    getContractTitle(String namePattern, Date date)
     
    getContractTitle(String namePattern, Date date, Map<String,Object> titleParams)
    Получение имени договора по шаблону
    int
    getCountByParameterGroupId(int parameterGroupId)
     
    protected ContractPattern
     
     
    getPattern(int id)
    Получает шаблон договора по его ID
    Возвращает Map содержащий коды групп параметров договоров и кол-ва шаблонов в каждой из них ("SELECT pgid, COUNT(*) FROM contract_pattern GROUP BY pgid")
     
    boolean
    isContractTitleDuplicated(String title, boolean add, int notVerifyContractId)
    Проверка на дубликат названия договора.
    optPattern(int id)
     
    static void
     
    static void
    Удалит из списка последних созданных названий, если такой имеется и title !
    static void
     
    void
    setDataPattern(int idPattern, Document data)
     
    void
    Обновляет шаблона договора
    protected void
     

    Methods inherited from class ru.bitel.bgbilling.common.dao.AbstractIdDao

    executeUpdate, get, getAndDelete, getAndUpdate, loadData, opt, prepareStatement, sqlCommand, sqlCommandAndTable, sqlInsertValues, sqlQuery, sqlUpdateSet, sqlWhereId

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

    deleteImpl, dropTemporaryTable, eq, get, getById, getImpl, getListFromRS, getPeriod, getQueryById, getQueryWithFilter, getSQLOrder, list, list, list, listCountImplPS, listImpl, listImplPS, ormFromResultSet, ormUpdateImpl, ormUpdateImpl, ormUpdateImpl, ormUpdateImpl, queryPeriod, setPageRecordCount, update

    Methods inherited from class ru.bitel.bgbilling.common.dao.AbstractDaoConstant

    getPlaceholders, getSQLOrder, getSQLOrderFields, getTableName, psSetDate, psSetDateOrNull, psSetInt, psSetIntOrNull, psSetPeriod, psSetString, psSetStringOrNull, psSetTimestampOrNull, queryAndIn, setStatementParam, sqlDelete, sqlDeleteBatch, sqlInsert, sqlInsertBatch, sqlInsertGetId, sqlInsertGetLongId, sqlInsertOnDuplicateKeyUpdate, sqlInsertSelect, sqlInsertUpdateById, sqlSelectCountAsInt, sqlUpdate, sqlUpdateBatch

    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

  • Constructor Details

    • ContractPatternDao

      public ContractPatternDao(Connection con)
  • Method Details

    • getPattern

      public ContractPattern getPattern(int id) throws ru.bitel.bgbilling.common.BGException
      Получает шаблон договора по его ID
      Parameters:
      id - код шаблона
      Returns:
      Throws:
      ru.bitel.bgbilling.common.BGException
    • optPattern

      public Optional<ContractPattern> optPattern(int id) throws ru.bitel.bgbilling.common.BGException
      Throws:
      ru.bitel.bgbilling.common.BGException
    • contractPatternTitles

      public List<IdTitle> contractPatternTitles(boolean showHidden) throws Exception
      Throws:
      Exception
    • updateContractPattern

      public void updateContractPattern(int id, ContractPattern pattern)
      Обновляет шаблона договора
      Parameters:
      id - код шаблона, "-1" - если новый
      pattern - шаблон
    • delete

      public int delete(int patternId) throws SQLException
      Overrides:
      delete in class ru.bitel.bgbilling.common.dao.AbstractIdDao<ContractPattern>
      Throws:
      SQLException
    • getCountByParameterGroupId

      public int getCountByParameterGroupId(int parameterGroupId) throws SQLException
      Throws:
      SQLException
    • getContractTitle

      public String getContractTitle(String namePattern, Date date) throws Exception
      Throws:
      Exception
    • getContractTitle

      public String getContractTitle(String namePattern, Date date, Map<String,Object> titleParams) throws Exception
      Получение имени договора по шаблону
      Parameters:
      date - дата
      titleParams - параметры
      con - соединение с базой данных
      pattern - шаблон договора
      Returns:
      номер договора
      Throws:
      ru.bitel.bgbilling.common.BGException
      Exception
    • isContractTitleDuplicated

      public boolean isContractTitleDuplicated(String title, boolean add, int notVerifyContractId)
      Проверка на дубликат названия договора. Проверяется как в БД так и в список недавно созданных.
      Но имейте ввиду, если вы этот title получили из getContractTitle, то нет смысла проверять, так как результат будет в любом случае false.
      Parameters:
      title - - название
      add - - если true, то если дубликата нет, то переданное название добавляется в список последних созданных.
      notVerifyContractId - - код договора для которого не будет производиться проверка на дубликат, передавать -1 если не нужен пар.
      con -
      Returns:
      false - если дубликата нет или title == null.
    • removeContractTitleFromLastTitles

      public static void removeContractTitleFromLastTitles(int contractId, Connection con)
    • removeContractTitleFromLastTitles

      public static void removeContractTitleFromLastTitles(String title)
      Удалит из списка последних созданных названий, если такой имеется и title != null
    • removeLastTitles

      public static void removeLastTitles()
    • getListPatternData

      public Map<Integer,Document> getListPatternData() throws Exception
      Returns:
      Map<Integer,Document> содержащий все не пустые data, из каждого шаблона, ключ-id шаблона
      Throws:
      Exception
    • getPatternTitleList

      public List<IdTitle> getPatternTitleList() throws SQLException
      Throws:
      SQLException
    • setDataPattern

      public void setDataPattern(int idPattern, Document data) throws Exception
      Parameters:
      idPattern - - id шаблона в котором будем заменять data
      data - - Document
      Throws:
      Exception
    • getPatternParameterGroupCountMap

      public Map<Integer,Integer> getPatternParameterGroupCountMap() throws SQLException
      Возвращает Map содержащий коды групп параметров договоров и кол-ва шаблонов в каждой из них ("SELECT pgid, COUNT(*) FROM contract_pattern GROUP BY pgid")
      Returns:
      Map<Integer, Integer> в какой группе сколько договоров
      Throws:
      ru.bitel.bgbilling.common.BGException
      SQLException
    • getContractPatternList

      public List<ru.bitel.bgbilling.kernel.contract.pattern.common.dto.ContractPatternInfo> getContractPatternList(Set<Integer> domainIds) throws SQLException
      Throws:
      SQLException
    • contractParameterDataList

      public List<ru.bitel.bgbilling.kernel.contract.pattern.common.dto.ContractParameterData> contractParameterDataList(int contractPatternId) throws Exception
      Throws:
      Exception
    • getFromRS

      protected ContractPattern getFromRS(ResultSet rs) throws SQLException
      Specified by:
      getFromRS in class ru.bitel.bgbilling.common.dao.AbstractDao<ContractPattern>
      Throws:
      SQLException
    • updateImpl

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