Summary of the invention
This specification one or more embodiment describes the update method and device of a kind of ledger, can simplify application
Logic is handled, data access efficiency is improved, saves time and resource.
In a first aspect, provide a kind of update method of ledger, the ledger includes current balance and Qie remaining sum,
Method includes:
Receive transaction request;
Correspond to state in the daytime when current time, when transaction request corresponds to on-line transaction, updates working as the ledger
The day of preceding remaining sum and the ledger cut remaining sum;
Correspond to end day state when current time, when transaction request corresponds to on-line transaction, updates working as the ledger
Preceding remaining sum, the day for not updating the ledger cut remaining sum;
Correspond to state in the daytime when current time, when transaction request corresponds to the batch processing service on current business date,
The current balance and the ledger for updating the ledger cut remaining sum day;
Correspond to end day state when current time, transaction request corresponded to the batch processing service on a upper business date
When, the current balance and the ledger for updating the ledger cut remaining sum day.
Described to correspond to state in the daytime when current time in a kind of possible embodiment, transaction request corresponds to connection
When machine is traded, the current balance and the ledger for updating the ledger cut remaining sum day, comprising:
Correspond to state in the daytime when current time, when transaction request corresponds to on-line transaction, institute is updated according to transaction amount
State the current balance of ledger;
By the current balance of the updated ledger, be determined as the updated ledger cuts remaining sum day.
Described to correspond to end day state when current time in a kind of possible embodiment, transaction request corresponds to connection
When machine is traded, the current balance of the ledger is updated, the day for not updating the ledger cuts remaining sum, comprising:
Correspond to end day state when current time, when transaction request corresponds to on-line transaction, institute is updated according to transaction amount
State the current balance of ledger;
The day of the ledger cuts remaining sum and remains unchanged.
Described to correspond to state in the daytime when current time in a kind of possible embodiment, transaction request corresponds to and works as
When the batch processing service on preceding business date, the current balance and the ledger for updating the ledger cut remaining sum day, packet
It includes:
Correspond to state in the daytime when current time, when transaction request corresponds to the batch processing service on current business date,
The current balance of the ledger is updated according to transaction amount;
By the current balance of the updated ledger, be determined as the updated ledger cuts remaining sum day.
Described to correspond to end day state when current time in a kind of possible embodiment, transaction request corresponds to upper
When the batch processing service on one business date, the current balance and the ledger for updating the ledger cut remaining sum day,
Include:
Correspond to end day state when current time, transaction request corresponded to the batch processing service on a upper business date
When, the current balance of the ledger is updated according to transaction amount;
For the batch processing service of the ledger on a upper business date, according to transaction amount update described in point family
The day of account cuts remaining sum.
Further, the method also includes:
Correspond to end day state when current time, transaction request corresponded to the batch processing service on a upper business date
When, the day of the current balance to the ledger and the ledger cuts remaining sum and verifies respectively.
In a kind of possible embodiment, the method also includes:
When corresponding to end day state at current time, according to cut the day of the ledger remaining sum and the corresponding remaining sum of general ledger into
The verification of row total score.
In a kind of possible embodiment, the ledger further includes remaining sum yesterday, the method also includes:
When current time, which corresponds to, is switched to the switching moment of state in the daytime by end day state, according to the ledger
Day cuts remaining sum yesterday that remaining sum determines the ledger;
Determine that the day of the ledger cuts remaining sum according to the current balance of the ledger.
Second aspect, provides a kind of updating device of ledger, and the ledger includes current balance and Qie remaining sum,
Device includes:
Receiving unit, for receiving transaction request;
First updating unit, for corresponding to state in the daytime when current time, when transaction request corresponds to on-line transaction, more
The current balance of the new ledger and the ledger cut remaining sum day;
Second updating unit, for corresponding to end day state when current time, when transaction request corresponds to on-line transaction, more
The current balance of the new ledger, cuts remaining sum the day for not updating the ledger;
Third updating unit, for corresponding to state in the daytime when current time, transaction request corresponds to the current business date
Batch processing service when, the current balance and the ledger for updating the ledger cut remaining sum day;
4th updating unit, for corresponding to end day state when current time, transaction request corresponds to a upper business day
When the batch processing service of phase, the current balance and the ledger for updating the ledger cut remaining sum day.
The third aspect provides a kind of computer readable storage medium, is stored thereon with computer program, when the calculating
When machine program executes in a computer, enable computer execute first aspect method.
Fourth aspect provides a kind of calculating equipment, including memory and processor, and being stored in the memory can hold
Line code, when the processor executes the executable code, the method for realizing first aspect.
The method and apparatus provided by this specification embodiment are provided with current balance and Qie remaining sum in ledger
Two fields belong to state in the daytime or end day state according to current time, transaction request is corresponding after receiving transaction request
In on-line transaction or batch processing service, current balance and Qie remaining sum are updated using corresponding update mode, wherein when working as
The preceding moment corresponds to end day state and updates the current balance of the ledger when transaction request corresponds to on-line transaction, do not update
The day of the ledger cuts remaining sum.This specification embodiment, current balance shows the instant remaining sum of account in real time, not by every other day day
The influence of whole state;Day cuts the business date T days remaining sums that remaining sum shows account in real time, and end day state online is occurred in T+
Account on the 1st, remaining sum processing, which is not embodied in, cuts in remaining sum day, but the T day batch account that end day state occurs, and shows in real time
Day cuts in remaining sum and current balance, can simplify using processing logic, improve data access efficiency, save time and resource.
Specific embodiment
With reference to the accompanying drawing, the scheme provided this specification is described.
Fig. 1 is the implement scene schematic diagram of one embodiment that this specification discloses.The implement scene is related to ledger
It updates, ledger: refers in particular to account.Account: refer to for the economic activity situation of reflection relative subject and as a result, to needing to carry out
Remaining sum or amount incurred management and set up, for recording the carrier of remaining sum change process and relevant information.This specification is real
It applies and further relates to following concept in example, general ledger: refer to that account as recorded in a ledger book (General Ledger) is also referred to as account as recorded in a ledger.It is according to total
Classification subject is opened an account, and for registering whole economic works, is carried out the accounting of total score class, is provided the ledger of blanket accounting information
Book.Total score verification: ledger remaining sum summarizes grade and general ledger checks mutually the process of balance.On-line transaction: referring to online transaction, can
Whether succeeded with Real-time Feedback transaction.Batch is traded: refer to off-line trading, such as: timed task.Batch transaction is also referred to as batch
Processing service typically has end day clearance, total score to check, product calculates, bear interest the batch processing service including mentioning.Day cuts:
It is exactly the time for replacing system accounting for popular;System is switched to subsequent work from work at present day (the also referred to as day of trade)
Day, cut day during transaction can as usual submit and correctly processing returns to.Generally, the day of system configuration cuts the moment (generally
Night trades the low ebb time), program will be cut the day of Validation Counter, it is core that system, which is switched to subsequent work day from work at present day,
A step in the same day batch processing of system is felt concerned about, after having executed the step, system data is next working day.For net
For the channels such as silver, some moment can be set as day point of contact.
Realize continuous operation in 7*24 hours, financial institution's operation system will not only guarantee account balance (or balance account book)
7*24 hour service support to on-line transaction, but the account balance for needing guarantee section batch service to rely on when handling is in quiet
Only state, it is therefore desirable to a static balance data be retained to the remaining sum of each account in systems, so that account had both been able to satisfy packet
Day clearance, total score verification, the static remaining sum demand of batch processing including product calculates, the meter that bears interest proposes eventually are included, and is able to satisfy online
The real-time balance control and service of transaction.This specification embodiment replaces common shadow account mode using double remaining sum modes,
7*24 hours business are realized using a physical table, database access efficiency, table storage, using handling, logic is relatively easy,
And without chasing after account, it is only necessary to consider the double remaining sum synchronization process in dynamic family.
Fig. 2 shows the update method flow charts according to the ledger of one embodiment, and the ledger includes current balance
With cut remaining sum day, this method can be based on application scenarios shown in FIG. 1.As shown in Fig. 2, in the embodiment ledger update side
Method receives transaction request the following steps are included: step 21;Step 22, correspond to state in the daytime, transaction request pair when current time
The current balance and the ledger that when on-line transaction, should update the ledger cut remaining sum day;Step 23, when current
It carves and updates the current balance of the ledger when transaction request corresponds to on-line transaction corresponding to end day state, do not update described
The day of ledger cuts remaining sum;Step 24, correspond to state in the daytime when current time, transaction request corresponds to the current business date
When batch processing services, the current balance and the ledger for updating the ledger cut remaining sum day;Step 25, when current
It carves and corresponds to end day state, when transaction request corresponded to the batch processing service on a upper business date, update the ledger
Current balance and the ledger day cut remaining sum.The specific executive mode of above each step is described below.
First in step 21, transaction request is received.It is understood that current time can correspond to state in the daytime or day
Whole state, transaction request can correspond to on-line transaction or batch processing service.This specification embodiment, according to current time pair
Ying Yu state or end day state in the daytime, transaction request corresponds to on-line transaction or batch processing service, to the ledger
Including current balance and Qie remaining sum take corresponding update mode.
Then in step 22, correspond to state in the daytime when current time, when transaction request corresponds to on-line transaction, update institute
The current balance and the ledger for stating ledger cut remaining sum day.
In one example, correspond to state in the daytime when current time, when transaction request corresponds to on-line transaction, according to friendship
The easy amount of money updates the current balance of the ledger;By the current balance of the updated ledger, it is determined as updated
The day of the ledger cuts remaining sum.
Then in step 23, correspond to end day state when current time, when transaction request corresponds to on-line transaction, update institute
The current balance of ledger is stated, the day for not updating the ledger cuts remaining sum.
In one example, correspond to end day state when current time, when transaction request corresponds to on-line transaction, according to
Transaction amount updates the current balance of the ledger;The day of the ledger cuts remaining sum and remains unchanged.
Again in step 24, correspond to state in the daytime when current time, transaction request corresponds to the batch on current business date
When processing service, the current balance and the ledger for updating the ledger cut remaining sum day.
In one example, correspond to state in the daytime when current time, transaction request corresponds to batch on current business date
When amount processing service, the current balance of the ledger is updated according to transaction amount;By the current of the updated ledger
Remaining sum, be determined as the updated ledger cuts remaining sum day.
Finally in step 25, correspond to end day state when current time, transaction request corresponded to a upper business date
When batch processing services, the current balance and the ledger for updating the ledger cut remaining sum day.
In one example, correspond to end day state when current time, transaction request corresponded to upper a business date
When batch processing services, the current balance of the ledger is updated according to transaction amount;For described in a upper business date
The batch processing service of ledger cuts remaining sum according to the day that transaction amount updates the ledger.
Further, correspond to end day state when current time, transaction request corresponded to the batch on upper a business date
When processing service, the day of the current balance to the ledger and the ledger cuts remaining sum and verifies respectively.
In one example, when corresponding to end day state at current time, according to cutting remaining sum and total the day of the ledger
The correspondence remaining sum of account carries out total score verification.
In one example, the ledger further includes remaining sum yesterday, is switched when current time corresponds to by end day state
For state in the daytime switching moment when, according to remaining sum yesterday for cutting remaining sum the day of the ledger and determining the ledger;According to
The current balance of the ledger determines that the day of the ledger cuts remaining sum.
It can be understood that above-mentioned steps 22 are to select an execution to step 25.
The method provided by this specification embodiment is provided with two words of current balance and Qie remaining sum in ledger
Section belongs to state in the daytime or end day state according to current time, transaction request corresponds to online after receiving transaction request
Transaction or batch processing service update current balance and Qie remaining sum using corresponding update mode, wherein work as current time
The current balance of the ledger is updated when transaction request corresponds to on-line transaction corresponding to end day state, does not update described point
The day of family account cuts remaining sum.This specification embodiment, current balance show the instant remaining sum of account in real time, not by every other day day end state
Influence;Day cuts the business date T days remaining sums that remaining sum shows account in real time, and end day state online is occurred on T+1
Account, remaining sum processing, which is not embodied in, cuts in remaining sum day, but the T day batch account that end day state occurs, and shows that day cuts in real time
In remaining sum and current balance, it can simplify using processing logic, improve data access efficiency, save time and resource.
Fig. 3 shows transaction verification and remaining sum fabrication design table according to one embodiment.Referring to Fig. 3, double remaining sum modes are
By designing static remaining sum in ledger --- it cuts remaining sum day, the remaining sum of Night trading account is supported to be kept for a period of time
Stationary state, thus support total score verification etc. batch processings service.The mode is in each financial transaction, in conjunction with system shape
State, while considering the more new logic of the two remaining sums of current balance and Qie remaining sum, in state in the daytime, while updating current remaining
Volume and Qie remaining sum, in end day state, on-line transaction only updates current balance, and batch processing service updates simultaneously cuts remaining sum day
And current balance.At the end of end day state, increases processing operation and realize that double remaining sums are synchronous.Double remaining sum modes do not design shadow
Main table stores the real-time balance of T+1 days on-line transactions, but current balance and Qie remaining sum are devised in ledger.Work as system
After day cuts, core banking system enters end day state, has when sending on account on-line transaction at this time, corresponding to the transaction point
Family account will only update current balance;What the batch account transaction of the period then updated ledger simultaneously cuts remaining sum and current remaining day
The operation of withholing of volume, ledger should verify current balance and Qie remaining sum to the verification of remaining sum simultaneously;Carrying out total score verification
When, using using the foundation cutting remaining sum value day and checking as total score in ledger, after end day, dynamic family account will be directed to
It is synchronous to make double remaining sums.
Remaining sum yesterday is arranged in ledger, cuts three remaining sum, current balance fields day for this specification embodiment, wherein
Current balance: the instant remaining sum of performance account in real time is not influenced by every other day day end state;Day cuts remaining sum: showing account in real time
The business date T days remaining sums, end day state online is occurred in T+1 day accounts, more than remaining sum processing is not embodied in and cuts day
On volume, but the T day batch account that end day state occurs, it should show that in real time day cuts in remaining sum and current balance;Yesterday remaining sum:
The remaining sum for showing the account on a upper business date, for special screne to previous business date account balance memory requirement, such as:
Operation of the period based on account balance yesterday at the beginning of day summarizes the scenes such as keep accounts daily.In account trading processing, double remaining sum modes
To in ledger two remaining sums (current balance, day cut remaining sum) update and remaining sum adequacy verifying, need be according to different
System state determines.
The program and the advantage of traditional shadow account mode scheme are: application service do not need according to day all day between shape
Perhaps subordinate list does not need to do table level or record grade data duplication the main table of state selection operation yet;Without being common online whole with day
The different replication processes logic of online design, so as to simplify application processing logic, improves data access effect without chasing after account
Rate saves time and resource.
According to the embodiment of another aspect, a kind of updating device of ledger is also provided, the ledger includes current remaining
Volume and Qie remaining sum, the device are used to execute the update method of the ledger of this specification embodiment offer.Fig. 4 is shown according to one
The schematic block diagram of the updating device of the ledger of a embodiment.As shown in figure 4, the device 400 includes:
Receiving unit 41, for receiving transaction request;
First updating unit 42, for corresponding to state in the daytime when current time, when transaction request corresponds to on-line transaction,
The current balance and the ledger for updating the ledger cut remaining sum day;
Second updating unit 43, for corresponding to end day state when current time, when transaction request corresponds to on-line transaction,
The current balance of the ledger is updated, the day for not updating the ledger cuts remaining sum;
Third updating unit 44, for corresponding to state in the daytime when current time, transaction request corresponds to current business day
When the batch processing service of phase, the current balance and the ledger for updating the ledger cut remaining sum day;
4th updating unit 45, for corresponding to end day state when current time, transaction request corresponds to a upper business
When the batch processing service on date, the current balance and the ledger for updating the ledger cut remaining sum day.
Optionally, as one embodiment, first updating unit 42 is specifically used for:
Correspond to state in the daytime when current time, when transaction request corresponds to on-line transaction, institute is updated according to transaction amount
State the current balance of ledger;
By the current balance of the updated ledger, be determined as the updated ledger cuts remaining sum day.
Optionally, as one embodiment, second updating unit 43 is specifically used for:
Correspond to end day state when current time, when transaction request corresponds to on-line transaction, institute is updated according to transaction amount
State the current balance of ledger;
The day of the ledger cuts remaining sum and remains unchanged.
Optionally, as one embodiment, the third updating unit 44 is specifically used for:
Correspond to state in the daytime when current time, when transaction request corresponds to the batch processing service on current business date,
The current balance of the ledger is updated according to transaction amount;
By the current balance of the updated ledger, be determined as the updated ledger cuts remaining sum day.
Optionally, as one embodiment, the 4th updating unit 45 is specifically used for:
Correspond to end day state when current time, transaction request corresponded to the batch processing service on a upper business date
When, the current balance of the ledger is updated according to transaction amount;
For the batch processing service of the ledger on a upper business date, according to transaction amount update described in point family
The day of account cuts remaining sum.
Further, described device further include:
Verification unit, for corresponding to end day state when current time, transaction request corresponded to a upper business date
When batch processing services, the day of the current balance to the ledger and the ledger cuts remaining sum and verifies respectively.
Optionally, as one embodiment, described device further include:
Total score checks unit, for cutting remaining sum according to the day of the ledger when corresponding to end day state at current time
Total score verification is carried out with the corresponding remaining sum of general ledger.
Optionally, as one embodiment, the ledger further includes remaining sum yesterday, described device further include:
First synchronization unit, for when current time is corresponding to the switching moment for being switched to state in the daytime by end day state
When, according to remaining sum yesterday for cutting remaining sum the day of the ledger and determining the ledger;
Second synchronization unit, for determining that the day of the ledger cuts remaining sum according to the current balance of the ledger.
The device provided by this specification embodiment is provided with two words of current balance and Qie remaining sum in ledger
Section, after receiving unit 41 receives transaction request, belongs to state in the daytime or end day state, transaction request according to current time
Corresponding to on-line transaction or batch processing service, the first updating unit 42, the second updating unit 43, third updating unit 44,
One in 4th updating unit 45 updates current balance and Qie remaining sum using corresponding update mode, wherein when current
It carves and updates the current balance of the ledger when transaction request corresponds to on-line transaction corresponding to end day state, do not update described
The day of ledger cuts remaining sum.This specification embodiment, current balance show the instant remaining sum of account in real time, not by every other day day end shape
The influence of state;Day cuts the business date T days remaining sums that remaining sum shows account in real time, and end day state online is occurred on T+1
Account, remaining sum processing is not embodied in and cuts in remaining sum day, but the T day batch account that end day state occurs, and shows day in real time
It cuts in remaining sum and current balance, can simplify using processing logic, improve data access efficiency, save time and resource.
According to the embodiment of another aspect, a kind of computer readable storage medium is also provided, is stored thereon with computer journey
Sequence enables computer execute method described in conjunction with Figure 2 when the computer program executes in a computer.
According to the embodiment of another further aspect, a kind of calculating equipment, including memory and processor, the memory are also provided
In be stored with executable code, when the processor executes the executable code, realize method described in conjunction with Figure 2.
Those skilled in the art are it will be appreciated that in said one or multiple examples, function described in the invention
It can be realized with hardware, software, firmware or their any combination.It when implemented in software, can be by these functions
Storage in computer-readable medium or as on computer-readable medium one or more instructions or code transmitted.
Above-described specific embodiment has carried out further the purpose of the present invention, technical scheme and beneficial effects
It is described in detail, it should be understood that being not intended to limit the present invention the foregoing is merely a specific embodiment of the invention
Protection scope, all any modification, equivalent substitution, improvement and etc. on the basis of technical solution of the present invention, done should all
Including within protection scope of the present invention.