Class ContractAccountFutureDao
java.lang.Object
ru.bitel.bgbilling.kernel.base.server.logger.BGLogger
ru.bitel.bgbilling.common.dao.AbstractDaoConstant
ru.bitel.bgbilling.kernel.contract.api.server.dao.ContractAccountFutureDao
public class ContractAccountFutureDao
extends ru.bitel.bgbilling.common.dao.AbstractDaoConstant
-
Field Summary
FieldsFields 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 -
Method Summary
Modifier and TypeMethodDescriptionintclearByMonth(int moduleId, int yy, int mm) intclearByMonth(int moduleId, int yy, int mm, Collection<Integer> contractIds) Обнуление дельты прогноза по договорам модуля за месяц.intdeleteByMonth(int yy, int mm) intdeleteOlderThan(int moduleId, int yy, int mm) Удаление строк прогноза за все месяцы строго предыдущие относительно yy/mm.getFutureMap(int yy, int mm, Collection<Integer> includeModuleIds) getFutureSum(int contractId, int yy, int mm, Collection<Integer> includeModuleIds) Сумма прогноза доначисления одного договора за месяц по указанным модулям (future_day + future_month).voidsaveFuture(int contractId, int moduleId, int yy, int mm, BigDecimal futureDay, BigDecimal futureMonth) Methods inherited from class ru.bitel.bgbilling.common.dao.AbstractDaoConstant
getPeriod, 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, sqlUpdateBatchMethods inherited from class ru.bitel.bgbilling.kernel.base.server.logger.BGLogger
error, error, error, getLogger, logError, logError, warn
-
Field Details
-
TABLE_CONTRACT_ACCOUNT_FUTURE
- See Also:
-
-
Constructor Details
-
ContractAccountFutureDao
-
-
Method Details
-
saveFuture
public void saveFuture(int contractId, int moduleId, int yy, int mm, BigDecimal futureDay, BigDecimal futureMonth) throws SQLException - Throws:
SQLException
-
deleteByMonth
- Throws:
SQLException
-
clearByMonth
- Throws:
SQLException
-
clearByMonth
public int clearByMonth(int moduleId, int yy, int mm, Collection<Integer> contractIds) throws SQLException Обнуление дельты прогноза по договорам модуля за месяц.Вызывается задачей начисления сразу после успешного списания. Договоры ограничиваются теми же, по которым начисление фактически прошло: пересчет одного договора (
Recalculator) не должен гасить долг остальных договоров модуля, иначе блокировщик до следующего суточного прогона их не увидит.- Parameters:
moduleId-yy-mm-contractIds- договоры; null или пустой набор - все договоры модуля (трактовкаBalanceUtils.setAccount: пустой список означает «все договоры»)- Throws:
SQLException
-
getFutureMap
public Map<Integer,BigDecimal> getFutureMap(int yy, int mm, Collection<Integer> includeModuleIds) throws SQLException - Throws:
SQLException
-
deleteOlderThan
Удаление строк прогноза за все месяцы строго предыдущие относительно yy/mm.Ограничение по модулю обязательно: чистку выполняет задача своего модуля, строки чужих модулей она трогать не должна.
- Parameters:
moduleId- код модуля-владельца строкyy-mm-- Returns:
- количество удаленных строк
- Throws:
SQLException
-
getFutureSum
public BigDecimal getFutureSum(int contractId, int yy, int mm, Collection<Integer> includeModuleIds) throws SQLException Сумма прогноза доначисления одного договора за месяц по указанным модулям (future_day + future_month). Договоров может быть сколько угодно - выборка идет поcontract_id, то есть в отличие отgetFutureMap(int, int, Collection)вся таблица за месяц не перебирается.- Returns:
- сумма прогноза; ноль, если строк нет
- Throws:
SQLException
-