Disclosure of Invention
One or more embodiments of the present specification describe a method and an apparatus for updating a separate account, which can simplify application processing logic, improve data access efficiency, and save time and resources.
In a first aspect, a method for updating an account book is provided, where the account book includes a current balance and a daily tangential balance, and the method includes:
receiving a transaction request;
when the current time corresponds to the daytime state and the transaction request corresponds to the online transaction, updating the current balance of the account of the branch account and the daily balance of the account of the branch account;
when the current time corresponds to the end-of-day state, the transaction request corresponds to an online transaction, updating the current balance of the account book, and not updating the daily balance of the account book;
when the current time corresponds to the daytime state and the transaction request corresponds to the batch processing service of the current business date, updating the current balance of the branch account and the daily cut balance of the branch account;
and when the current time corresponds to the end-of-day state and the transaction request corresponds to the batch processing service of the last service date, updating the current balance of the branch account and the daily cutting balance of the branch account.
In a possible embodiment, the updating the current balance of the account book and the daily balance of the account book when the current time corresponds to the daytime status and the transaction request corresponds to an online transaction includes:
when the current time corresponds to the daytime state and the transaction request corresponds to the online transaction, updating the current balance of the account according to the transaction amount;
and determining the current balance of the updated branch account as the daily-cut balance of the updated branch account.
In a possible embodiment, when the current time corresponds to a day end state and the transaction request corresponds to an online transaction, updating the current balance of the account book and not updating the day-to-day balance of the account book, the method includes:
when the current time corresponds to the end-of-day state and the transaction request corresponds to the online transaction, updating the current balance of the account book according to the transaction amount;
the daily balance of the account is kept unchanged.
In a possible embodiment, the updating the current balance of the account book and the daily balance of the account book when the current time corresponds to a daytime status and the transaction requests a batch processing service corresponding to a current business date includes:
when the current time corresponds to the daytime state and the transaction request corresponds to the batch processing service of the current business date, updating the current balance of the account book according to the transaction amount;
and determining the current balance of the updated branch account as the daily-cut balance of the updated branch account.
In a possible embodiment, the updating the current balance of the account book and the daily balance of the account book when the current time corresponds to the end-of-day status and the transaction request corresponds to the batch processing service of the last business date includes:
when the current time corresponds to the end-of-day state and the transaction request corresponds to the batch processing service of the last service date, updating the current balance of the account according to the transaction amount;
and aiming at the batch processing service of the account of the branch account on the last service date, updating the daily balance of the account of the branch account according to the transaction amount.
Further, the method further comprises:
and when the current time corresponds to the end-of-day state and the transaction request corresponds to the batch processing service of the last service date, respectively checking the current balance of the branch account and the daily balance of the branch account.
In one possible embodiment, the method further comprises:
and when the current moment corresponds to the end-of-day state, performing total score checking according to the daily cutting balance of the branch account and the corresponding balance of the general account.
In one possible embodiment, the account book further includes a yesterday balance, the method further comprising:
when the current time corresponds to a switching time for switching from a day end state to a day state, determining yesterday balance of the branch account according to the day-to-day balance of the branch account;
and determining the daily balance of the branch account according to the current balance of the branch account.
In a second aspect, an apparatus for updating an account book, where the account book includes a current balance and a daily tangential balance, includes:
a receiving unit for receiving a transaction request;
the first updating unit is used for updating the current balance of the branch account and the daily cut balance of the branch account when the current time corresponds to the daytime state and the transaction request corresponds to online transaction;
the second updating unit is used for updating the current balance of the account of the branch account and not updating the daily balance of the account of the branch account when the current time corresponds to the daily ending state and the transaction request corresponds to the online transaction;
a third updating unit, configured to update the current balance of the account splitting account and the daily-cut balance of the account splitting account when the current time corresponds to the daytime state and the transaction request corresponds to the batch processing service of the current business date;
and the fourth updating unit is used for updating the current balance of the account of the branch account and the daily cut balance of the account of the branch account when the current time corresponds to the daily end state and the transaction request corresponds to the batch processing service of the last service date.
In a third aspect, there is provided a computer readable storage medium having stored thereon a computer program which, when executed in a computer, causes the computer to perform the method of the first aspect.
In a fourth aspect, a computing device is provided, comprising a memory having stored therein executable code, and a processor that when executing the executable code, implements the method of the first aspect.
According to the method and the device provided by the embodiment of the specification, two fields of the current balance and the daily cut balance are set in the account of the account, after a transaction request is received, the current balance and the daily cut balance are updated in a corresponding updating mode according to whether the current time belongs to the daytime state or the daily end state, and whether the transaction request corresponds to online transaction or batch processing service, wherein when the current time corresponds to the daily end state and the transaction request corresponds to online transaction, the current balance of the account is updated, and the daily cut balance of the account is not updated. In the embodiment of the specification, the current balance represents the instant balance of the account in real time and is not influenced by the terminal state of the day; the daily balance shows the balance of the account on the service date T day in real time, for the accounts with the daily terminal state online occurring on the T +1 day, the balance processing is not reflected on the daily balance, but the T day batch accounts with the daily terminal state are shown on the daily balance and the current balance in real time, so that the application processing logic can be simplified, the data access efficiency is improved, and the time and the resources are saved.
Detailed Description
The scheme provided by the specification is described below with reference to the accompanying drawings.
Fig. 1 is a schematic view of an implementation scenario of an embodiment disclosed in this specification. The implementation scenario relates to updating of the account splitting account, and the account splitting account: in particular an account. The account is as follows: it is a carrier which is set up for reflecting the economic activity condition of the related subject and the result, and is used for recording the balance change process and the related information. The embodiment of the specification also relates to the following concept, general ledger: refers to the General Ledger (General Ledger) and is also called the General Ledger. The method is characterized in that an account is opened according to general classification subjects and is used for registering all economic services, performing general classification accounting and providing a classification account book of general accounting data. Checking the total score: and the balance collection level of the individual account balance and the general account are mutually checked and balanced. Online transaction: the method refers to online transaction, and whether the transaction is successful or not can be fed back in real time. Batch transaction: refers to off-line transactions such as: and (5) timing the task. Batch transactions are also referred to as batch processing services, and typically include batch processing services including daily end clearing, total point checking, total number calculation, and interest bearing. Cutting every day: colloquially, the time to change the system billing; the system switches from the current workday (also known as the trade day) to the next workday, during which the trade can be submitted as usual and processed back correctly. Generally, the day-to-day time (generally, night transaction valley time) of the system configuration activates the day-to-day program of the center, and the system switches from the current working day to the next working day, which is one step in the current-day batch processing of the core system. For channels such as internet bank, a certain time can be set as a day tangent point.
The continuous operation of 7 × 24 hours is realized, a financial institution business system not only needs to ensure that account balance (or a balance register) supports 7 × 24 hours service of online transaction, but also needs to ensure that account balance depending on partial batch business processing is in a static state, so that static balance data needs to be reserved for the balance of each account in the system, so that the account can meet the requirements of batch processing static balance including daily terminal clearing, total point checking, accumulated number calculation and interest counting, and can also meet the real-time balance control and service of online transaction. In the embodiment of the description, a dual-balance mode is adopted to replace a common shadow account mode, that is, a physical table is used to realize a service of 7 × 24 hours, the access efficiency of a database, the table storage and the application processing logic are relatively simple, no account tracking is needed, and only dual-balance synchronous processing of a mobile subscriber is considered.
Fig. 2 shows a flowchart of an update method of an account book including a current balance and a daily tangential balance according to an embodiment, and the method may be based on the application scenario shown in fig. 1. As shown in fig. 2, the method for updating the account-based account in this embodiment includes the following steps: step 21, receiving a transaction request; step 22, when the current time corresponds to the daytime state and the transaction request corresponds to the online transaction, updating the current balance of the account of the branch account and the daily balance of the account of the branch account; step 23, when the current time corresponds to a day end state and the transaction request corresponds to an online transaction, updating the current balance of the branch account, and not updating the day-to-day balance of the branch account; step 24, when the current time corresponds to the daytime state and the transaction request corresponds to the batch processing service of the current business date, updating the current balance of the account book and the daily balance of the account book; and 25, updating the current balance of the branch account and the daily cutting balance of the branch account when the current time corresponds to the daily ending state and the transaction request corresponds to the batch processing service of the last service date. Specific execution modes of the above steps are described below.
First, at step 21, a transaction request is received. It will be appreciated that the current time may correspond to a day state or an end of day state, and the transaction request may correspond to an online transaction or a batch processing service. In the embodiment of the present specification, according to whether the current time corresponds to a daytime state or a terminal day state, the transaction request corresponds to an online transaction or a batch processing service, and a corresponding updating manner is adopted for the current balance and the daily balance included in the account book.
Next, in step 22, when the current time corresponds to the daytime status and the transaction request corresponds to an online transaction, the current balance of the account book and the daily balance of the account book are updated.
In one example, when the current time corresponds to a daytime status and the transaction request corresponds to an online transaction, updating a current balance of the account book according to the transaction amount; and determining the current balance of the updated branch account as the daily-cut balance of the updated branch account.
Then, in step 23, when the current time corresponds to the day end state and the transaction request corresponds to the online transaction, the current balance of the account book is updated, and the daily balance of the account book is not updated.
In one example, when the current time corresponds to an end-of-day status and the transaction request corresponds to an online transaction, updating the current balance of the account book according to the transaction amount; the daily balance of the account is kept unchanged.
In step 24, when the current time corresponds to the daytime status and the transaction request corresponds to the batch processing service of the current business date, the current balance of the account book and the daily balance of the account book are updated.
In one example, when the current time corresponds to a daytime state and the transaction requests a batch processing service corresponding to a current business date, updating a current balance of the account book according to the transaction amount; and determining the current balance of the updated branch account as the daily-cut balance of the updated branch account.
Finally, in step 25, when the current time corresponds to the end-of-day status and the transaction request corresponds to the batch processing service of the last service date, the current balance of the account-based account and the daily balance of the account-based account are updated.
In one example, when the current time corresponds to the end-of-day state and the transaction request corresponds to the batch processing service of the last business date, updating the current balance of the account book according to the transaction amount; and aiming at the batch processing service of the account of the branch account on the last service date, updating the daily balance of the account of the branch account according to the transaction amount.
Further, when the current time corresponds to the end-of-day state and the transaction request corresponds to the batch processing service of the last service date, the current balance of the account splitting account and the daily balance of the account splitting account are respectively checked.
In one example, when the current time corresponds to the end-of-day state, the total score check is performed according to the daily-tangential balance of the branch account and the corresponding balance of the total account.
In one example, the branch account further comprises a yesterday balance, and when the current time corresponds to a switching time for switching from a terminal day state to a day state, the yesterday balance of the branch account is determined according to the yesterday balance of the branch account; and determining the daily balance of the branch account according to the current balance of the branch account.
It is understood that the above steps 22 to 25 are alternatively performed.
According to the method provided by the embodiment of the specification, two fields of the current balance and the daily balance are set in the account of the branch account, after a transaction request is received, the current balance and the daily balance are updated in a corresponding updating mode according to whether the current time belongs to a daytime state or a terminal daily state, the transaction request corresponds to an online transaction or a batch processing service, and when the current time corresponds to the terminal daily state and the transaction request corresponds to the online transaction, the current balance of the account of the branch account is updated, and the daily balance of the account of the branch account is not updated. In the embodiment of the specification, the current balance represents the instant balance of the account in real time and is not influenced by the day-to-day end state; the daily balance shows the balance of the account on the service date T day in real time, for the accounts with the daily terminal state online occurring on the T +1 day, the balance processing is not reflected on the daily balance, but the T day batch accounts with the daily terminal state are shown on the daily balance and the current balance in real time, so that the application processing logic can be simplified, the data access efficiency is improved, and the time and the resources are saved.
FIG. 3 illustrates a transaction verification and balance processing design table according to one embodiment. Referring to fig. 3, the dual balance mode supports a static state in which the balance of the transaction account is maintained for a period of time in the night mode by designing a static balance, namely a daily balance, in the account of the branch account, thereby supporting batch processing services such as total point checking. The mode is that in each financial transaction, the updating logics of the current balance and the daily-cut balance are considered simultaneously in combination with the system state, the current balance and the daily-cut balance are updated simultaneously in the daytime state, only the current balance is updated in the online transaction in the terminal-day state, and the daily-cut balance and the current balance are updated simultaneously by the batch processing service. And when the end-of-day state is finished, processing operation is added to realize double balance synchronization. In the double-balance mode, a shadow main table is not designed to store real-time balance of T +1 daily online transaction, but current balance and daily balance are designed in a branch account. After the system is switched every day, the core bank system enters a day-end state, and when the financial online transaction is sent, the account of the sub-account corresponding to the transaction is only updated with the current balance; updating daily balance and current balance of the account book at the same time in batch financial transaction of the time period, and checking the current balance and the daily balance by deduction operation of the account book for checking the balance; when the total score is checked, the daily tangential balance value in the account of the branch account is used as the basis for the total score check, and after the day is ended, double balance synchronization is performed on the account of the mobile account.
In the embodiment of the description, three fields of yesterday balance, daily balance and current balance are set in the account of the branch account, wherein the current balance is as follows: the instant balance of the account is expressed in real time and is not influenced by the day-to-day end state; daily cutting balance: the balance of the account on the service date T day is expressed in real time, for the accounts of which the end-of-day state occurs on the T +1 day, the balance processing is not reflected on the daily balance, but the batch accounts of the T day of which the end-of-day state occurs are expressed on the daily balance and the current balance in real time; yesterday balance: the balance of the account representing the last business date is used for the storage requirement of the account balance of the previous business date in a special scene, such as: the initial period of the day is based on the operation of the account balance of yesterday, the daily summary account entry and other scenes. When the financial transaction is processed, the dual balance mode updates two balances (current balance and daily balance) in the account of the branch account and verifies the sufficiency of the balance, which needs to be determined according to different system states.
The advantages of this scheme over the traditional shadow account mode scheme are: the application service does not need to select and operate a main table or an auxiliary table according to the day-to-day state, and does not need to copy table-level or record-level data; different copy processing logics do not need to be designed for common online and day-end online, and account tracking is not needed, so that the application processing logics can be simplified, the data access efficiency is improved, and time and resources are saved.
According to another aspect of embodiments, an apparatus for updating an account book is further provided, where the account book includes a current balance and a daily-cut balance, and the apparatus is configured to execute the method for updating an account book provided in the embodiments of this specification. Fig. 4 shows a schematic block diagram of an update apparatus of a ledger according to an embodiment. As shown in fig. 4, the apparatus 400 includes:
a receiving unit 41 for receiving a transaction request;
a first updating unit 42, configured to update the current balance of the account book and the daily-cut balance of the account book when the current time corresponds to the daytime state and the transaction request corresponds to an online transaction;
a second updating unit 43, configured to update the current balance of the account book, and not update the daily balance of the account book, when the current time corresponds to the daily ending status and the transaction request corresponds to the online transaction;
a third updating unit 44, configured to update the current balance of the account splitting account and the daily-cut balance of the account splitting account when the current time corresponds to the daytime state and the transaction request corresponds to the batch processing service of the current business date;
a fourth updating unit 45, configured to update the current balance of the account book and the daily cut balance of the account book when the current time corresponds to the daily end state and the transaction request corresponds to the batch processing service of the last service date.
Optionally, as an embodiment, the first updating unit 42 is specifically configured to:
when the current time corresponds to the daytime state and the transaction request corresponds to online transaction, updating the current balance of the account book according to the transaction amount;
and determining the updated current balance of the account of the branch account as the updated daily balance of the account of the branch account.
Optionally, as an embodiment, the second updating unit 43 is specifically configured to:
when the current time corresponds to the end-of-day state and the transaction request corresponds to the online transaction, updating the current balance of the account book according to the transaction amount;
the daily cutting balance of the branch account is kept unchanged.
Optionally, as an embodiment, the third updating unit 44 is specifically configured to:
when the current time corresponds to the daytime state and the transaction request corresponds to the batch processing service of the current business date, updating the current balance of the account book according to the transaction amount;
and determining the current balance of the updated branch account as the daily-cut balance of the updated branch account.
Optionally, as an embodiment, the fourth updating unit 45 is specifically configured to:
when the current time corresponds to the end-of-day state and the transaction request corresponds to the batch processing service of the last service date, updating the current balance of the account according to the transaction amount;
and aiming at the batch processing service of the account of the branch account on the last service date, updating the daily balance of the account of the branch account according to the transaction amount.
Further, the apparatus further comprises:
and the verifying unit is used for respectively verifying the current balance of the branch account and the daily balance of the branch account when the current time corresponds to the daily ending state and the transaction request corresponds to the batch processing service of the last service date.
Optionally, as an embodiment, the apparatus further includes:
and the total score checking unit is used for performing total score checking according to the daily cutting balance of the branch account and the corresponding balance of the total account when the current moment corresponds to the daily ending state.
Optionally, as an embodiment, the account of the branch further includes a yesterday balance, and the apparatus further includes:
a first synchronization unit, configured to determine, when a current time corresponds to a switching time at which a terminal day state is switched to a daytime state, a yesterday balance of the branch account according to a daily balance of the branch account;
and the second synchronization unit is used for determining the daily balance of the account of the branch account according to the current balance of the account of the branch account.
By the device provided by the embodiment of the present specification, two fields of the current balance and the daily balance are set in the account book, after the receiving unit 41 receives the transaction request, the transaction request corresponds to the online transaction or the batch processing service according to whether the current time belongs to the daytime state or the terminal daily state, and one of the first updating unit 42, the second updating unit 43, the third updating unit 44 and the fourth updating unit 45 updates the current balance and the daily balance in a corresponding updating manner, wherein when the current time corresponds to the terminal daily state and the transaction request corresponds to the online transaction, the current balance of the account book is updated, and the daily balance of the account book is not updated. In the embodiment of the specification, the current balance represents the instant balance of the account in real time and is not influenced by the terminal state of the day; the daily balance shows the balance of the service date T day of the account in real time, for the accounts with the daily end state online occurring at the day T +1, the balance processing is not reflected on the daily balance, but the batch accounts of the day with the daily end state are shown on the daily balance and the current balance in real time, so that the application processing logic can be simplified, the data access efficiency is improved, and the time and the resources are saved.
According to an embodiment of another aspect, there is also provided a computer-readable storage medium having stored thereon a computer program which, when executed in a computer, causes the computer to perform the method described in connection with fig. 2.
According to an embodiment of another aspect, there is also provided a computing device including a memory and a processor, the memory having stored therein executable code, and the processor implementing the method described in conjunction with fig. 2 when executing the executable code.
Those skilled in the art will recognize that the functionality described in this disclosure may be implemented in hardware, software, firmware, or any combination thereof, in one or more of the examples described above. When implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium.
The above-mentioned embodiments, objects, technical solutions and advantages of the present invention are further described in detail, it should be understood that the above-mentioned embodiments are only examples of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made on the basis of the technical solutions of the present invention should be included in the scope of the present invention.