Method and device for generating financial statements
By recording financial time and marking incremental data when financial data changes, financial statements are generated within the financial reconciliation cycle, solving the problem of the immutability of financial statements in existing technologies and achieving stability and responsiveness to data changes within the reconciliation cycle.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- YUANBAO TECH (BEIJING) TECH CO LTD
- Filing Date
- 2023-11-24
- Publication Date
- 2026-06-05
AI Technical Summary
Existing technologies for generating financial statements cannot meet the requirement of immutability during the financial reconciliation cycle, resulting in frequent changes to financial statements after data changes, which fails to meet the requirements of financial reconciliation.
Each time financial data changes, the time of the change is recorded, and the changed financial data is marked as incremental data. Financial statements for the financial reconciliation period are generated and processed in an offline data warehouse to ensure the immutability of the statements during the reconciliation period.
It ensures the immutability of financial statements during the financial reconciliation cycle, reduces the processing and storage costs of the financial system, effectively reflects business changes in data, and facilitates the investigation of abnormal data issues.
Smart Images

Figure CN117743322B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method and apparatus for generating financial statements. Background Technology
[0002] A financial system is a type of business system. Financial data within this system is typically stored in a relational database, such as PolarDB. Changes to financial data are handled through transactions. A single transaction can consist of multiple database operations, which can include adding, modifying, or deleting data. After a transaction is completed, the financial system can query the changed financial data in real time, or perform Data Manipulation Language (DML) operations offline to generate reports.
[0003] Currently, offline financial statements are generally generated based on two types of data from the financial system. The financial system stores the final modified financial data in a relational database, then synchronizes the data to an offline data warehouse using synchronization tools. Finally, in the offline data warehouse, the dimensional and factual data of the offline financial data are processed using DML operations according to the technical specifications of financial statements to generate the financial statements.
[0004] However, in the above methods of generating financial statements, if the financial system changes its data after the financial data is processed by DML in the offline data warehouse, the regenerated financial statements will also change. This cannot meet the requirement of the immutability of financial statements during the financial reconciliation period. Summary of the Invention
[0005] This invention provides a method and apparatus for generating financial statements, which solves the problem that existing methods for generating financial statements cannot meet the requirement of the immutability of financial statements during the financial reconciliation period.
[0006] This invention provides a method for generating financial statements, comprising:
[0007] Record the time of each change in financial data;
[0008] Mark the corresponding financial time for the changed financial data, and use the changed financial data and the corresponding financial time as incremental financial data;
[0009] Upon receiving a financial statement generation request, based on the financial reconciliation period in the financial statement generation request, the target incremental financial data within the financial reconciliation period of the financial time is obtained from the incremental financial data.
[0010] Based on the target incremental financial data, financial statements for the financial reconciliation period are generated.
[0011] According to a method for generating financial statements provided by the present invention, after marking the corresponding financial time for the changed financial data and using the changed financial data and the corresponding financial time as incremental financial data, the method further includes:
[0012] The incremental financial data is stored in a pre-configured relational database;
[0013] After obtaining the target incremental financial data within the financial reconciliation period from the incremental financial data, the method further includes:
[0014] The target incremental financial data is transferred from the relational database to a pre-configured offline data warehouse;
[0015] The step of generating financial statements for the financial reconciliation period based on the target incremental financial data includes:
[0016] In the offline data warehouse, the financial statements are generated based on the target incremental financial data.
[0017] According to a method for generating financial statements provided by the present invention, the step of generating the financial statements based on the target incremental financial data in the offline data warehouse includes:
[0018] In the offline data warehouse, perform the following steps:
[0019] The target incremental financial data is divided according to the pre-set business type to obtain factual data and dimensional data;
[0020] Based on the target incremental financial data, the factual data is corrected to generate fact table data;
[0021] Based on the target incremental financial data, the dimensional data is processed into a zipper table data;
[0022] The financial statements are generated based on the fact table data and the zipper table data.
[0023] According to a method for generating financial statements provided by the present invention, the step of correcting the factual data based on the target incremental financial data to generate fact table data includes:
[0024] In the factual data, based on the changed financial data in the target incremental financial data, a corresponding reversal mark is generated for the changed financial data;
[0025] The fact data is corrected based on the correction mark to obtain the fact table data.
[0026] According to a method for generating financial statements provided by the present invention, the step of generating a corresponding reversal flag for the changed financial data based on the changed financial data in the target incremental financial data in the factual data includes:
[0027] Based on the target incremental financial data, a first candidate fact table is generated;
[0028] In the first candidate fact table, the corresponding financial data before the change is added to the row above the financial data after each change, and the financial data before the change is marked with an inverse number. The financial data before the change and the corresponding inverse number mark are used as the reversal mark corresponding to the financial data after the change, thus obtaining the second candidate fact table; wherein, the inverse number mark is used to indicate that the measure value in the current row of financial data becomes an inverse number for reversal.
[0029] The step of reversing the fact data based on the reversal marker to obtain the fact table data includes:
[0030] Based on the reversal marker, determine the measure value corresponding to each row of financial data in the second candidate fact table;
[0031] In the second candidate fact table, the fact table data is obtained by aggregating and summing the measures in each row of financial data to make corrections.
[0032] According to a method for generating financial statements provided by the present invention, the step of processing the dimensional data into a zipper table based on the target incremental financial data includes:
[0033] Based on the financial time in the target incremental financial data, the dimensional data is processed into a zipper table.
[0034] According to a method for generating financial statements provided by the present invention, generating the financial statements based on the fact table data and the zipper table data includes:
[0035] The fact table data and the zipper table data are associated according to a first condition to obtain the financial statement;
[0036] The first condition includes: the financial time of the fact table data is between the start financial time and the end financial time of the zipper table data.
[0037] The present invention also provides a financial statement generation apparatus, comprising:
[0038] The recording module is used to record the time of each change in financial data.
[0039] The tagging module is used to tag the corresponding financial time for the changed financial data, and to use the changed financial data and the corresponding financial time as incremental financial data.
[0040] The acquisition module is used to, upon receiving a financial statement generation request, acquire, based on the financial reconciliation period in the financial statement generation request, target incremental financial data within the financial reconciliation period of the financial time from the incremental financial data.
[0041] The generation module is used to generate financial statements for the financial reconciliation period based on the target incremental financial data.
[0042] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method for generating financial statements as described above.
[0043] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for generating financial statements as described above.
[0044] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the method for generating financial statements as described above.
[0045] The financial statement generation method and apparatus provided by this invention record the time of change as the financial time each time financial data changes, and mark the corresponding financial time on the changed financial data, using the changed financial data and the corresponding financial time as incremental financial data. When a financial statement generation request is received subsequently, the financial time within the financial reconciliation period can be obtained from the incremental financial data based on the financial reconciliation period in the request, as the target incremental financial data, and then the financial statement within the corresponding financial reconciliation period can be generated based on the target incremental financial data. Compared to related technologies where regenerated financial statements change after data changes in the financial system, making it difficult to ensure the immutability of financial statements within the financial reconciliation cycle, this invention marks the corresponding financial time with each change in financial data. This allows for the identification of target incremental financial data within the financial reconciliation cycle based on the financial time, without regenerating the latest financial statements after every data change, thus guaranteeing the immutability of financial statements within the financial reconciliation cycle. Furthermore, unlike related technologies that only record the final changed financial data to generate financial statements, this invention records the financial data after each change. This ensures that the final financial statements generated based on this data effectively reflect business changes in the data. It also facilitates the investigation of data problems in the financial statements if abnormal data appears in the financial system. Attached Figure Description
[0046] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0047] Figure 1 This is one of the flowcharts illustrating the method for generating financial statements provided by this invention;
[0048] Figure 2 This is the second flowchart illustrating the financial statement generation method provided by the present invention;
[0049] Figure 3 This is a schematic diagram of the structure of the financial statement generation device provided by the present invention;
[0050] Figure 4 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0051] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0052] The method and apparatus for generating financial statements according to the present invention are described below with reference to the accompanying drawings.
[0053] Figure 1 This is one of the flowcharts illustrating the financial statement generation method provided by the present invention, such as... Figure 1 As shown, the method for generating financial statements includes steps 101 to 104; wherein:
[0054] Step 101: Record the time of each change in financial data.
[0055] Step 102: Mark the corresponding financial time for the changed financial data, and use the changed financial data and the corresponding financial time as incremental financial data.
[0056] Step 103: After receiving the financial statement generation request, based on the financial reconciliation period in the financial statement generation request, obtain the target incremental financial data of the financial time within the financial reconciliation period from the incremental financial data.
[0057] Step 104: Based on the target incremental financial data, generate financial statements for the financial reconciliation period.
[0058] In related technologies, offline financial statements are generally generated based on two types of data from the financial system, specifically the following two solutions:
[0059] Option 1: The financial system stores only the final modified financial data in a relational database. Then, the data in the financial system is synchronized to an offline data warehouse using a synchronization tool. Finally, in the offline data warehouse, the dimensional data and factual data of the offline financial data are processed using DML operations according to the technical standards of financial statements to generate financial statements.
[0060] Option 2: The financial system stores the financial data before and after each change in a relational database. Then, the data in the financial system is synchronized to an offline data warehouse using a synchronization tool. At this time, the factual data of the financial data in the offline data warehouse needs to be corrected first. Then, the dimension data and the corrected factual data are used to generate financial statements by performing DML operations according to the technical standards of financial statements.
[0061] The solutions in the aforementioned related technologies have the following problems:
[0062] For Option 1, the financial data in the offline data warehouse only contains the final changed financial data. When generating reports, it cannot reflect the business changes in the data. If abnormal data appears in the financial system, it is not conducive to troubleshooting data problems in the reports.
[0063] For Option 2, the financial system needs to store the data before and after each change in a relational database. This will significantly increase the logical processing cost and storage cost of the financial system, which will not only affect the data processing performance of the financial system, but also increase the storage cost.
[0064] More importantly, in Scheme 1 and Scheme 2 above, if the financial system changes its data after the offline data warehouse performs DML processing on the financial data to generate reports, the regenerated financial reports will change. This cannot meet the requirement of the immutability of financial reports during the financial reconciliation period.
[0065] To address the aforementioned issues, this invention provides a method for generating financial statements. The main technical concept is to record the financial time corresponding to the changes in financial data, and then generate financial statements based on the financial data within the financial reconciliation period, effectively ensuring the immutability of the financial statements within the financial reconciliation period.
[0066] Specifically, financial data can be changed within the financial system. Each time financial data changes, the financial system records the time of the change as the financial time and marks the corresponding financial time on the changed financial data, using the changed financial data and the corresponding financial time as incremental financial data.
[0067] It should be noted that the financial timeframe refers to the current moment when the financial data changes, and is not related to other times of the financial data (such as the confirmation time).
[0068] When a request to generate financial statements is received subsequently, the system can extract data whose financial timeframe falls within the financial reconciliation period from the incremental financial data based on the financial reconciliation period in the request. This data serves as the target incremental financial data, meaning that the financial timeframe of the selected target incremental financial data falls within the financial reconciliation period. Subsequently, financial statements for the corresponding financial reconciliation period are generated based on the target incremental financial data. This ensures that even if some financial data is changed outside the financial reconciliation period, such changes will not affect the financial statements within the financial reconciliation period, effectively guaranteeing the immutability of the financial statements within the financial reconciliation period.
[0069] In the financial statement generation method provided in this embodiment of the invention, compared with the related technology where the regenerated financial statements change after data changes in the financial system, making it difficult to meet the requirement of the immutability of financial statements within the financial reconciliation period, this invention marks the corresponding financial time for each change in financial data. This allows for the identification of the target incremental financial data within the financial reconciliation period based on the financial time, without regenerating the latest financial statements after each data change, thus ensuring the immutability of financial statements within the financial reconciliation period. Furthermore, compared with the related technology that only records the final changed financial data to generate financial statements, this invention records the financial data after each change, enabling the final financial statements generated based on this data to effectively reflect business changes in the data. If abnormal data appears in the financial system, it also facilitates the investigation of data problems in the financial statements.
[0070] Optionally, after marking the corresponding financial time for the changed financial data and using the changed financial data and the corresponding financial time as incremental financial data, the incremental financial data can be stored in a pre-set relational database.
[0071] After obtaining the target incremental financial data within the financial reconciliation period from the incremental financial data, the target incremental financial data can be transferred from the relational database to a pre-set offline data warehouse;
[0072] The method for generating financial statements for the financial reconciliation period based on the target incremental financial data may include:
[0073] In the offline data warehouse, the financial statements are generated based on the target incremental financial data.
[0074] Specifically, after the financial system obtains incremental financial data, it can store all incremental financial data in a relational database. Upon receiving a request to generate financial statements and obtaining the corresponding target incremental financial data, the target incremental financial data can be transferred to an offline data warehouse to generate financial statements based on the target incremental financial data in the offline data warehouse.
[0075] Alternatively, synchronization tools can be used to synchronize financial data from a relational database to an offline data warehouse.
[0076] In this embodiment of the invention, the processes of storing and generating financial statements are processed separately in a relational database and an offline data warehouse. Since the storage cost of the offline data warehouse is much smaller than that of the relational database, the process of generating financial statements, which requires a large amount of storage and processing, is assigned to the offline data warehouse. Compared with placing all processes in the relational database, this invention can effectively reduce the total storage cost of the relational database and the offline data warehouse.
[0077] Optionally, the method for generating the financial statements based on the target incremental financial data in the offline data warehouse may include:
[0078] In the offline data warehouse, perform the following steps:
[0079] The target incremental financial data is divided according to the pre-set business type to obtain factual data and dimensional data;
[0080] Based on the target incremental financial data, the factual data is corrected to generate fact table data;
[0081] Based on the target incremental financial data, the dimensional data is processed into a zipper table data;
[0082] The financial statements are generated based on the fact table data and the zipper table data.
[0083] Specifically, the target incremental financial data can be divided in the offline data warehouse. For example, it can be divided into factual data and dimensional data according to the business type. Factual data usually includes factual data such as accounts. For example, insurance policy data usually includes accounts and belongs to factual data. Product data usually only includes product status values and does not contain factual data, so it can be divided into dimensional data.
[0084] There are differences in how factual data and dimensional data are processed. Since factual data includes financial data after each change, it is necessary to reverse these data with the financial data before the change to generate fact table data. Then, based on the target incremental financial data, the dimensional data is processed into zipper table data, and the final financial statements are generated based on the fact table data and zipper table data.
[0085] Optionally, the fact table data and the zipper table data can be processed using DML operations according to financial reporting technical standards to generate financial statements.
[0086] Optionally, the method for reversing the factual data based on the target incremental financial data to generate fact table data may include:
[0087] In the factual data, based on the changed financial data in the target incremental financial data, a corresponding reversal mark is generated for the changed financial data;
[0088] The fact data is corrected based on the correction mark to obtain the fact table data.
[0089] Specifically, this embodiment of the invention provides a specific implementation method for reversing fact data. First, a corresponding reversal mark is generated for each changed financial data in the fact data. Then, the fact data is reversed based on the reversal mark to obtain fact table data.
[0090] Optionally, the method for generating a corresponding reversal flag for the changed financial data based on the changed financial data in the target incremental financial data in the factual data may include:
[0091] Based on the target incremental financial data, a first candidate fact table is generated;
[0092] In the first candidate fact table, the corresponding financial data before the change is added to the row above the financial data after each change, and the financial data before the change is marked with an inverse number. The financial data before the change and the corresponding inverse number mark are used as the reversal mark corresponding to the financial data after the change, thus obtaining the second candidate fact table; wherein, the inverse number mark is used to indicate that the measure value in the current row of financial data becomes an inverse number and is reversed.
[0093] The method of correcting the fact data based on the correction mark to obtain the fact table data may include:
[0094] Based on the reversal marker, determine the measure value corresponding to each row of financial data in the second candidate fact table;
[0095] In the second candidate fact table, the fact table data is obtained by aggregating and summing the measures in each row of financial data to make corrections.
[0096] Specifically, a first candidate fact table can be generated based on the target incremental financial data. For example, all financial data included in the target incremental financial data can be arranged according to financial time to generate the first candidate fact table.
[0097] In the first candidate fact table, add the corresponding pre-change financial data to the row above the financial data after each change, and mark the pre-change financial data with a reverse number. For example, assign the value 1 to the column of reverse number mark (reversal_mark) of the pre-change financial data added to the previous row. When reversing later, the measure value in the financial data with reversal_mark=1 can be changed to the reverse number to reverse the value. The original measure value can be a positive number, 0, or a negative number.
[0098] By using the financial data before the change and the corresponding opposite markers as the reversal markers for the financial data after the change, a second candidate fact table can be obtained.
[0099] Optionally, the location of the added financial data before the change can be set according to the actual situation. It does not necessarily have to be set on the line above the financial data after the change, but setting it on the line above will make it easier for technical personnel to troubleshoot problems later.
[0100] After obtaining the second candidate fact table, based on the aforementioned reversal markers, the corresponding measure values for each row of financial data in the second candidate fact table are determined. Then, the reversal is performed by aggregating and summing the measure values in each row of financial data to obtain the final fact table data.
[0101] Optionally, the method for processing the dimensional data into a zipper table based on the target incremental financial data may include:
[0102] Based on the financial time in the target incremental financial data, the dimensional data is processed into a zipper table.
[0103] Optionally, the method for generating the financial statements based on the fact table data and the zipper table data may include:
[0104] The fact table data and the zipper table data are associated according to a first condition to obtain the financial statement;
[0105] The first condition includes: the financial time of the fact table data is between the start financial time and the end financial time of the zipper table data.
[0106] Specifically, financial statements can be obtained by linking fact table data and zipper table data using the first condition. Specifically, the financial time period of the fact table data needs to be between the start and end financial time periods of the zipper table data. For each row of financial data in the fact table data, it is necessary to determine which start and end financial time period of the financial data in the zipper table the corresponding financial time period falls between, and then add the relevant data corresponding to the falling financial data to the financial data in the fact table data.
[0107] The following example illustrates the method for generating financial statements provided in this embodiment of the invention.
[0108] The purpose of this invention is to propose a method for generating financial statements that can save on the processing and storage costs of the financial system, reflect business changes in data when generating reports from the data warehouse, and ensure that the financial statements do not change during the financial reconciliation period.
[0109] Figure 2 This is a second flowchart illustrating the financial statement generation method provided by the present invention, as shown below. Figure 2 As shown, the method includes the following steps:
[0110] Step 201, Begin.
[0111] Step 202: Mark the financial time.
[0112] Specifically, whenever data changes in the financial system, the financial time is marked on the original financial data.
[0113] Step 203: Store each change record.
[0114] Specifically, the data after each change in the financial system is stored in a relational database.
[0115] Step 204: Synchronize to the offline data warehouse.
[0116] Specifically, synchronization tools are used to synchronize financial data from a relational database to an offline data warehouse.
[0117] Step 205: Determine if it is incremental financial data. If yes, proceed to step 206; otherwise, proceed to step 211.
[0118] Specifically, in the financial data, data within the financial reconciliation period are selected as incremental financial data.
[0119] Step 206: Determine if it is dimensional data. If yes, proceed to step 207; otherwise, proceed to step 208.
[0120] Specifically, the dimensional data and factual data in the incremental financial data are distinguished and processed using different procedures.
[0121] Step 207: Process the dimensional data into a zipper table using financial time.
[0122] Step 208: Generate fact data with reversal markers using financial time from the fact data.
[0123] Specifically, fact data marked with a reversal flag is used to reverse the original changed fact data, and the fact data marked with a reversal flag together with the original changed fact data form the final fact table data.
[0124] Step 209: Reverse the final fact table data according to the reversal flag.
[0125] Step 210: Generate financial statements.
[0126] Specifically, the final fact sheet data and the zipper table data after reversal are processed using DML operations according to the technical standards of financial statements to generate financial statements.
[0127] Step 211, End.
[0128] The following example illustrates the above process using the original financial system report form as factual data and the original financial system product form as dimensional data.
[0129] (a) Financial system data is written into a relational database;
[0130] 1) As shown in Table 1 below, the original policy table in the financial system has added 4 new data entries. Each change generates a change detail with the financial time.
[0131] Table 1 Original Insurance Policy Table from the Financial System
[0132]
[0133]
[0134] The following are multiple modifications and changes to the original policy form mentioned above:
[0135] First change record: If the financial data of policy_no='po001' is set to a measure value of 30 (the financial time occurred on 2023.02.03), it will become the policy table in Table 2 below (first change).
[0136] Table 2 Policy Form (First Change)
[0137] policy_no state metric Confirmation time Financial Time product_id po001 1 20 2021.03.01 2023.01.01 pd002 po002 2 25 2022.01.02 2023.01.01 pd001 po003 1 88 2021.12.18 2023.01.01 pd003 po004 1 40 2022.06.19 2023.01.01 pd002 po001 1 30 2021.03.01 2023.02.03 pd002
[0138] Second change record: Setting the status value to 2 for the financial data of policy_no='po004' (time occurred on 2023.02.25) will change it to the policy table in Table 3 below (second change).
[0139] Table 3 Policy Form (Second Amendment)
[0140] policy_no state metric Confirmation time Financial Time product_id po001 1 20 2021.03.01 2023.01.01 pd002 po002 2 25 2022.01.02 2023.01.01 pd001 po003 1 88 2021.12.18 2023.01.01 pd003 po004 1 40 2022.06.19 2023.01.01 pd002 po001 1 30 2021.03.01 2023.02.03 pd002 po004 2 40 2022.06.19 2023.02.25 pd002
[0141] The third change record: If the financial data of policy_no='po004' is set to a status value of 1 and a measurement value of 62 (the time occurred on 2023.07.10), it will become the policy table in Table 4 below (third change).
[0142] Table 4 Policy Form (Third Amendment)
[0143] policy_no state metric Confirmation time Financial Time product_id po001 1 20 2021.03.01 2023.01.01 pd002 po002 2 25 2022.01.02 2023.01.01 pd001 po003 1 88 2021.12.18 2023.01.01 pd003 po004 1 40 2022.06.19 2023.01.01 pd002 po001 1 30 2021.03.01 2023.02.03 pd002 po004 2 40 2022.06.19 2023.02.25 pd002 po004 1 62 2022.06.19 2023.07.10 pd002
[0144] 2) As shown in Table 5 below, the original product table of the financial system has added 4 new data entries. Each change generates a change detail with the financial time.
[0145] Table 5 Original Products of the Financial System
[0146] product_id state is_bw Financial Time pd001 1 1 2021.04.01 pd002 2 0 2021.04.01 pd003 2 1 2021.11.16 pd004 1 0 2023.03.22
[0147] The following is the change log of the original product table:
[0148] Change log: Setting the status of the financial data for product_id=pd002 to 1 (time occurred on 2023.06.02) will change it to the original product table in Table 6 below.
[0149] Table 6 Original Product List (After Change)
[0150]
[0151]
[0152] (ii) Offline data synchronization;
[0153] Synchronize the original policy tables and original product tables of the financial system stored in the relational database to the offline data warehouse.
[0154] (iii) Data processing is performed in an offline data warehouse;
[0155] Select financial data within the financial reconciliation period as incremental financial data, then perform incremental data logical processing, and finally construct financial statements. Specifically:
[0156] Select the time range for the change records (financial reconciliation period), such as July 30, 2023, and filter the change records of the policy table and product table before July 30, 2023 to generate the policy table (Table 7) and product table (Table 8) within the following financial reconciliation period.
[0157] Table 7 Policy Statement (Fact Table)
[0158]
[0159] Table 8 Product Table (Dimension Table)
[0160]
[0161]
[0162] Add a reversal mark to the policy table (take the row above all change records). Setting reversal_mark=1 means that the current data can be reversed from the original change record. This is reflected in the table as two data entries with the same id value. See Table 9 below for the policy table with reversal mark.
[0163] Table 9 Policy Table with Reversal Mark
[0164]
[0165] When reversing, the measure value corresponding to the row where reversal_mark=1 will become the opposite of the original value, and then be aggregated and summed under the same dimension.
[0166] The zipper table data generated from the product table in Table 8 is shown in Table 10 below.
[0167] Table 10 Zipper Table Data
[0168]
[0169]
[0170] It should be noted that the end date of the last change record can be set according to the actual situation. It does not have to be 2999.12.31. Just choose a date that will not be reached in the near future to avoid overlapping with the start date of the changed financial record.
[0171] The corrected policy table data is then subjected to DML operations (such as association) with the aforementioned zipper table data to generate financial statements.
[0172] When retrieving product information during association, the following conditions must be met: the financial time of the policy table must be greater than or equal to the start financial time (start_finance_time) of the product table, and the financial time of the policy table must be less than the end financial time (end_finance_time) of the product table. The final generated financial statements are shown in Table 11.
[0173] Table 11 Final Financial Statements
[0174]
[0175] The "Status" column is obtained from the data in the zipper table. For example, when id=1, the financial time of pd002 is 2023.01.01, which falls between the start financial time of pd002 in Table 10 (2021.04.01) and the end financial time (2023.06.02). Therefore, the corresponding status value 2 is obtained and filled into the "Status" column of Table 11. The other rows are obtained in the same way.
[0176] The embodiments of the present invention have at least the following beneficial effects:
[0177] 1) This invention stores the financial data after each change in the financial system in a relational database. Compared with storing each piece of data before and after the change, this can reduce the logical processing cost and storage cost of the financial system to a certain extent, thereby improving the computing performance of the financial system.
[0178] 2) This invention generates factual data with reversal markers in an offline data warehouse. This data, along with the original changed factual data, reflects business changes in factual data within financial data, thus facilitating the identification of abnormal factual data in offline reports. Since the storage cost of an offline data warehouse is significantly lower than that of a relational database, the total storage cost of both the relational database and the offline data warehouse is reduced.
[0179] 3) By adding a financial time field to the change record each time data changes, the present invention can use incremental financial data for logical processing when generating reports. In this way, even if the data changes again, as long as the change time is not within the current financial reconciliation cycle, the financial statements can be guaranteed not to change.
[0180] Compared with existing technologies, the method proposed in this invention uses an offline data warehouse to store the results of each change in financial data, which greatly reduces storage costs compared with using a relational database. Secondly, it uses financial time stamps to change financial data and selects financial data within a given financial reconciliation period as incremental financial data to generate reports, which can meet the requirement of the immutability of financial reports within the financial reconciliation period.
[0181] The financial statement generation apparatus provided by the present invention will be described below. The financial statement generation apparatus described below can be referred to in correspondence with the financial statement generation method described above.
[0182] Figure 3 This is a schematic diagram of the structure of the financial statement generation device provided by the present invention, as shown below. Figure 3 As shown, the financial statement generation device 300 includes:
[0183] The recording module 301 is used to record the time of the financial change each time the financial data changes;
[0184] The marking module 302 is used to mark the corresponding financial time on the changed financial data and to use the changed financial data and the corresponding financial time as incremental financial data.
[0185] The acquisition module 303 is used to, after receiving a financial statement generation request, acquire the target incremental financial data of the financial time within the financial reconciliation period from the incremental financial data based on the financial reconciliation period in the financial statement generation request.
[0186] The generation module 304 is used to generate financial statements for the financial reconciliation period based on the target incremental financial data.
[0187] In the financial statement generation apparatus provided in this embodiment of the invention, compared with the related technology where the regenerated financial statements change after data changes in the financial system, making it difficult to meet the requirement of the immutability of financial statements within the financial reconciliation period, this invention marks the corresponding financial time for each change in financial data. This allows for the identification of the target incremental financial data within the financial reconciliation period based on the financial time, without regenerating the latest financial statements after each data change, thus ensuring the immutability of financial statements within the financial reconciliation period. Furthermore, compared with the related technology that only records the final changed financial data to generate financial statements, this invention records the financial data after each change, enabling the final financial statements generated based on this data to effectively reflect business changes in the data. If abnormal data appears in the financial system, it also facilitates the investigation of data problems in the financial statements.
[0188] Optionally, the financial statement generation device 300 further includes:
[0189] Processing module, used for:
[0190] The incremental financial data is stored in a pre-configured relational database;
[0191] The target incremental financial data is transferred from the relational database to a pre-configured offline data warehouse;
[0192] The generation module 304 is specifically used to generate the financial statements based on the target incremental financial data in the offline data warehouse.
[0193] Optionally, the generation module 304 is also specifically used for:
[0194] In the offline data warehouse, perform the following steps:
[0195] The target incremental financial data is divided according to the pre-set business type to obtain factual data and dimensional data;
[0196] Based on the target incremental financial data, the factual data is corrected to generate fact table data;
[0197] Based on the target incremental financial data, the dimensional data is processed into a zipper table data;
[0198] The financial statements are generated based on the fact table data and the zipper table data.
[0199] Optionally, the generation module 304 is also specifically used for:
[0200] In the factual data, based on the changed financial data in the target incremental financial data, a corresponding reversal mark is generated for the changed financial data;
[0201] The fact data is corrected based on the correction mark to obtain the fact table data.
[0202] Optionally, the generation module 304 is also specifically used for:
[0203] Based on the target incremental financial data, a first candidate fact table is generated;
[0204] In the first candidate fact table, the corresponding financial data before the change is added to the row above the financial data after each change, and the financial data before the change is marked with an inverse number. The financial data before the change and the corresponding inverse number mark are used as the reversal mark corresponding to the financial data after the change, thus obtaining the second candidate fact table; wherein, the inverse number mark is used to indicate that the measure value in the current row of financial data becomes an inverse number for reversal.
[0205] Based on the reversal marker, determine the measure value corresponding to each row of financial data in the second candidate fact table;
[0206] In the second candidate fact table, the fact table data is obtained by aggregating and summing the measures in each row of financial data to make corrections.
[0207] Optionally, the generation module 304 is also specifically used for:
[0208] Based on the financial time in the target incremental financial data, the dimensional data is processed into a zipper table.
[0209] Optionally, the generation module 304 is also specifically used for:
[0210] The fact table data and the zipper table data are associated according to a first condition to obtain the financial statement;
[0211] The first condition includes: the financial time of the fact table data is between the start financial time and the end financial time of the zipper table data.
[0212] Figure 4 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 4 As shown, the electronic device 400 may include: a processor 410, a communication interface 420, a memory 430, and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other via the communication bus 440. The processor 410 can call logical instructions in the memory 430 to execute a method for generating financial statements, the method including:
[0213] Record the time of each change in financial data;
[0214] Mark the corresponding financial time for the changed financial data, and use the changed financial data and the corresponding financial time as incremental financial data;
[0215] Upon receiving a financial statement generation request, based on the financial reconciliation period in the financial statement generation request, the target incremental financial data within the financial reconciliation period of the financial time is obtained from the incremental financial data.
[0216] Based on the target incremental financial data, financial statements for the financial reconciliation period are generated.
[0217] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0218] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program that can be stored on a non-transitory computer-readable storage medium, wherein when the computer program is executed by a processor, the computer is able to execute the financial statement generation method provided by the above methods, the method comprising:
[0219] Record the time of each change in financial data;
[0220] Mark the corresponding financial time for the changed financial data, and use the changed financial data and the corresponding financial time as incremental financial data;
[0221] Upon receiving a financial statement generation request, based on the financial reconciliation period in the financial statement generation request, the target incremental financial data within the financial reconciliation period of the financial time is obtained from the incremental financial data.
[0222] Based on the target incremental financial data, financial statements for the financial reconciliation period are generated.
[0223] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method for generating financial statements provided by the methods described above, the method comprising:
[0224] Record the time of each change in financial data;
[0225] Mark the corresponding financial time for the changed financial data, and use the changed financial data and the corresponding financial time as incremental financial data;
[0226] Upon receiving a financial statement generation request, based on the financial reconciliation period in the financial statement generation request, the target incremental financial data within the financial reconciliation period of the financial time is obtained from the incremental financial data.
[0227] Based on the target incremental financial data, financial statements for the financial reconciliation period are generated.
[0228] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0229] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0230] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for generating financial statements, characterized in that, include: Record the time of each change in financial data; Mark the corresponding financial time for the changed financial data, and use the changed financial data and the corresponding financial time as incremental financial data; Upon receiving a financial statement generation request, based on the financial reconciliation period in the financial statement generation request, the target incremental financial data within the financial reconciliation period of the financial time is obtained from the incremental financial data. In an offline data warehouse, the financial statements are generated based on the target incremental financial data, and the offline data warehouse stores the target incremental financial data. The process of generating the financial statements based on the target incremental financial data in the offline data warehouse includes: In the offline data warehouse, perform the following steps: The target incremental financial data is divided according to the pre-set business type to obtain factual data and dimensional data; Based on the target incremental financial data, the factual data is corrected to generate fact table data; Based on the target incremental financial data, the dimensional data is processed into a zipper table data; The financial statements are generated based on the fact table data and the zipper table data. The step of reversing the factual data based on the target incremental financial data to generate fact table data includes: Based on the target incremental financial data, a first candidate fact table is generated from the fact data. In the first candidate fact table, the corresponding financial data before the change is added to the row above the financial data after each change, and the financial data before the change is marked with an inverse number. The financial data before the change and the corresponding inverse number mark are used as the reversal mark corresponding to the financial data after the change, thus obtaining the second candidate fact table; wherein, the inverse number mark is used to indicate that the measure value in the current row of financial data becomes an inverse number for reversal. Based on the reversal marker, determine the measure value corresponding to each row of financial data in the second candidate fact table; In the second candidate fact table, the fact table data is obtained by aggregating and summing the measures in each row of financial data to make corrections.
2. The method for generating financial statements according to claim 1, characterized in that, After marking the changed financial data with the corresponding financial time and using the changed financial data and the corresponding financial time as incremental financial data, the method further includes: The incremental financial data is stored in a pre-configured relational database; After obtaining the target incremental financial data within the financial reconciliation period from the incremental financial data, the method further includes: The target incremental financial data is transferred from the relational database to a pre-configured offline data warehouse.
3. The method for generating financial statements according to claim 1, characterized in that, The process of processing the dimensional data into a zipper table based on the target incremental financial data includes: Based on the financial time in the target incremental financial data, the dimensional data is processed into a zipper table.
4. The method for generating financial statements according to claim 1, characterized in that, The process of generating the financial statements based on the fact table data and the zipper table data includes: The fact table data and the zipper table data are associated according to a first condition to obtain the financial statement; The first condition includes: the financial time of the fact table data is between the start financial time and the end financial time of the zipper table data.
5. A financial statement generation apparatus, characterized in that, include: The recording module is used to record the time of each change in financial data. The tagging module is used to tag the corresponding financial time for the changed financial data, and to use the changed financial data and the corresponding financial time as incremental financial data. The acquisition module is used to, upon receiving a financial statement generation request, acquire, based on the financial reconciliation period in the financial statement generation request, target incremental financial data within the financial reconciliation period of the financial time from the incremental financial data. A generation module is used to generate the financial statements based on the target incremental financial data in an offline data warehouse, wherein the offline data warehouse stores the target incremental financial data. The generation module is specifically used for: In the offline data warehouse, perform the following steps: The target incremental financial data is divided according to the pre-set business type to obtain factual data and dimensional data; Based on the target incremental financial data, the factual data is corrected to generate fact table data; Based on the target incremental financial data, the dimensional data is processed into a zipper table data; The financial statements are generated based on the fact table data and the zipper table data. The step of reversing the factual data based on the target incremental financial data to generate fact table data includes: Based on the target incremental financial data, a first candidate fact table is generated from the fact data. In the first candidate fact table, the corresponding financial data before the change is added to the row above the financial data after each change, and the financial data before the change is marked with an inverse number. The financial data before the change and the corresponding inverse number mark are used as the reversal mark corresponding to the financial data after the change, thus obtaining the second candidate fact table; wherein, the inverse number mark is used to indicate that the measure value in the current row of financial data becomes an inverse number for reversal. Based on the reversal marker, determine the measure value corresponding to each row of financial data in the second candidate fact table; In the second candidate fact table, the fact table data is obtained by aggregating and summing the measures in each row of financial data to make corrections.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method for generating financial statements as described in any one of claims 1 to 4.
7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method for generating financial statements as described in any one of claims 1 to 4.