A financial statement processing method and device
By dividing financial statements by type and determining priority, and performing asynchronous calculation and update, the problems of low report processing efficiency and high update frequency in the existing technology are solved, and more efficient resource utilization is achieved.
Patent Information
- Application Number
- CN202411572864.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-11-06
AI Technical Summary
In the prior art, the frequency of updates and resource occupancy are too high when processing financial statements, resulting in low efficiency.
By dividing the pending reports into a type list set by type list by type and determining priority based on the number of lists, each execution list set is calculated in sequence based on the priority, and the results are added to the asynchronous calculation result table, and the data result table of the pending reports is finally updated.
Improves the efficiency of processing reports, reduces update frequency and resource occupancy.
Smart Images

Figure CN119089882B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data processing, and in particular relates to a financial statement processing method and device. Background Art
[0002] General ledgers and various financial statements have become important tools for corporate decision-making. Financial statements reflect the development status of a company to a certain extent. Financial statements are pre-calculated to predetermine the result set required for the report and save it in the result table. When querying the report, the required result set is directly read from the result table. However, the current pre-calculation process is to calculate each cell in the report format separately, and then update it to the result table as a single cell. The update frequency is high and the efficiency is low, which occupies a lot of resources.
[0003] Therefore, how to improve the efficiency of processing reports and reduce the update frequency and resource occupancy rate when processing reports is a technical problem to be solved by those skilled in the art. Summary of the invention
[0004] The purpose of the present invention is to solve the technical problems of too high update frequency and too high resource occupancy rate when processing reports in the prior art.
[0005] To achieve the above technical objectives, the present invention provides a method for processing financial statements, the method comprising:
[0006] Divide the reports to be processed into corresponding type list sets according to their types;
[0007] Determine an execution list set including priorities according to the number of lists in each type list set, and the type list set corresponding to the least number of lists is the execution list set of the first priority;
[0008] Calculate each execution list set in sequence based on the priority and add the settlement results to the asynchronous calculation result table;
[0009] The data result table corresponding to the report to be processed is updated based on the asynchronous calculation result table to complete the processing of the report.
[0010] Furthermore, the method further includes assigning a report code to each type list set after dividing the corresponding type list sets.
[0011] Further, the calculating of each execution list set in sequence based on the priority specifically includes:
[0012] Creating a temporary list with the same report code for the execution list set, the temporary list being used to store the calculation results of the corresponding execution list set;
[0013] When all elements in the execution list set are calculated, the calculation results in the temporary list are updated to the asynchronous calculation result table according to preset rules.
[0014] Furthermore, when calculating the execution list set, the method further includes:
[0015] Traversing each element in the execution list set;
[0016] After parsing and evaluating the cell rule formula of each element, the calculation result of the corresponding element is determined;
[0017] The calculation result of the corresponding element is added to the temporary list.
[0018] Furthermore, the method further includes, when calculating the execution report in the execution list set of the current priority, specifically including:
[0019] Obtain a report map rule set list corresponding to the execution report from the database, and create a corresponding calculation result list;
[0020] Traversing each element in the report map rule set list, parsing the cell rule formula corresponding to each element, and calculating the corresponding element to obtain a first calculation result;
[0021] Adding the calculated first calculation result to the calculation result list;
[0022] When all elements are calculated, the data in the calculation result list is inserted into the asynchronous calculation result table.
[0023] Furthermore, there is a nested loop structure between the execution list sets corresponding to the priorities, and the nested loop structure specifically traverses all the first elements in the execution list set of the next priority level under each first element in the execution list set of the current priority level.
[0024] In another aspect, the present invention further provides a financial statement processing device, the device comprising:
[0025] A division module is used to divide the reports to be processed into corresponding type list sets according to their types;
[0026] A determination module, configured to determine an execution list set including priorities according to the number of lists in each type list set, wherein the type list set corresponding to the least number of lists is the execution list set of the first priority;
[0027] A calculation module, used for calculating each execution list set in sequence based on the priority and adding the settlement result to the asynchronous calculation result table;
[0028] The updating module is used to update the data result table corresponding to the report to be processed based on the asynchronous calculation result table to complete the processing of the report.
[0029] A financial report processing method and device provided by the present invention, compared with the prior art, the method first divides the report to be processed into corresponding type list sets according to the type; then determines the execution list set including the priority according to the number of lists in each type list set, and the type list set corresponding to the least number of lists is the execution list set of the first priority; then calculates each execution list set in turn based on the priority and adds the settlement result to the asynchronous calculation result table; finally, updates the data result table corresponding to the report to be processed based on the asynchronous calculation result table to complete the processing of the report, which can improve the efficiency of processing the report and reduce the update frequency and resource occupancy rate when processing the report. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0031] Figure 1 The figure is a flowchart of the financial statement processing method provided in the embodiment of this specification;
[0032] Figure 2 The figure is a schematic diagram of the structure of the financial statement processing device provided in the embodiment of this specification. DETAILED DESCRIPTION
[0033] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0034] like Figure 1The flowchart of the financial statement processing method provided by the embodiment of this specification is shown. Although this specification provides the method operation steps or device structures shown in the following embodiments or drawings, the method or device may include more or fewer operation steps or module units after partial merger based on routine or no creative labor. In the steps or structures where there is no necessary causal relationship logically, the execution order of these steps or the module structure of the device is not limited to the execution order or module structure shown in the embodiments or drawings of this specification. When the method or module structure is applied in actual devices, servers or terminal products, it can be executed sequentially or in parallel according to the method or module structure shown in the embodiments or drawings (for example, in a parallel processor or multi-threaded processing environment, or even in a distributed processing, server cluster implementation environment).
[0035] The financial statement processing method provided in the embodiments of the present invention can be applied to terminal devices such as clients and servers. Figure 1 As shown, the method specifically comprises the following steps:
[0036] Step S101: Divide the reports to be processed into corresponding type list sets according to their types.
[0037] Specifically, in actual work scenarios, reports exist in multiple dimensions, that is, multiple types coexist, such as currency and institution. In the prior art, each cell in the report format is calculated separately, and then updated to the data result table as a single cell. The update frequency is high and the efficiency is low, and the resource usage is high. The present application scheme wants to divide the reports to be processed by type, so that the reports to be processed can be processed by multiple threads concurrently to improve the processing efficiency.
[0038] Step S102: Determine an execution list set including priorities according to the number of lists in each type list set, and the type list set corresponding to the least number of lists is the execution list set of the first priority.
[0039] Specifically, after determining each type of list set, compare the sizes according to the number of elements in the type list set, such as the currency and institution list sets, and follow the principle of loop nesting with small outside and large inside. That is, when there are multiple loops, the large loop should be placed in the inner layer, and the loop with a small number of elements should be placed in the outer layer. This way, branches can be added and the branch target buffer can be used to predict and read the target address of the instruction.
[0040] More specifically, taking the two types of currency and institution as examples, if the number of elements in the currency set is less than the number of elements in the institution set, the currency set is first looped, and each element of the currency list set, which is the first priority execution list set, is traversed. Under each element of the currency, the institution set is nested and looped, and then the institution list set, which is the second priority execution list set, is traversed. A new ForLoopTask is created for each institution element and submitted to the thread pool for execution. The results of each task are added to the asynchronous calculation result table.
[0041] Step S103: Calculate each execution list set in sequence based on the priority and add the settlement results to the asynchronous calculation result table.
[0042] In the embodiment of the present application, after the corresponding type list sets are divided, a report code is assigned to each type list set, and the calculation of each execution list set in sequence based on the priority specifically includes:
[0043] Creating a temporary list with the same report code for the execution list set, the temporary list being used to store the calculation results of the corresponding execution list set;
[0044] When all elements in the execution list set are calculated, the calculation results in the temporary list are updated to the asynchronous calculation result table according to preset rules.
[0045] Specifically, after dividing the corresponding type list sets, such as the currency list set and the institution list set, a report code such as 001 is configured for each type list set, and a temporary list with the same report code is created to store the calculation results in the corresponding execution list set. When calculating the execution list set, the method further includes:
[0046] Traversing each element in the execution list set;
[0047] After parsing and evaluating the cell rule formula of each element, the calculation result of the corresponding element is determined;
[0048] The calculation result of the corresponding element is added to the temporary list.
[0049] You can use the preset loop method to traverse each element in the execution list set, create a TCELL, or cell variable, for each element, and add the calculation result of each element directly to the temporary list after it is determined. If there is an unrecognizable rule in the parsing cell, an error will be reported. For example, the report code is 001, and the rule parsing error occurs at the row and column of the report.
[0050] Based on the above, in specific application scenarios, for multi-dimensional or multi-type situations, a multi-threaded approach can be used to calculate each report. First, create a futures, which represents the result of an asynchronous calculation in the program. It is an interface used to represent the result of an asynchronous calculation. Futures provides a way to handle asynchronous tasks, allowing results to be obtained during task execution and the final calculation results to be obtained after the task is completed. Futures can be used to perform asynchronous calculations in the program, that is, concurrent programming, and can obtain calculation results asynchronously without blocking the calling thread. Futures represents an unfinished calculation that will generate values or throw exceptions at a certain point in the future. List futures is used to store each ForLoopTask, which refers to a task executed using a for loop. In programming, a for loop is a control flow statement used to repeatedly execute a block of code until a specific condition is met. This loop structure consists of three expressions: an initialization expression, a conditional expression, and an iteration expression. The initialization expression is executed once before the loop starts, and the conditional expression is judged before each loop iteration. If the condition is true, the loop body is executed; otherwise, the loop ends. The iteration expression is executed after each loop iteration to update the loop variable for the result of the next iteration.
[0051] Then based on the above priorities, for example, in a specific application scenario, if the number of elements in the currency set is less than the number of elements in the organization set, the currency set is first for-looped, each element of currs is traversed, and under each element of the currency, the organization set is nested for-looped, and each element of orgs is traversed. A new ForLoopTask is created for each organization element and submitted to the executor for execution. The result of each task is added to the asynchronous calculation result table in the futures list.
[0052] After the nested structure loop is completed, delete the intermediate temporary table tmp, traverse the futures list, obtain the result of the task by calling the get method of each future object, and store the result in the temporary table tmp.
[0053] In some embodiments, updating the calculation results in the temporary list to the asynchronous calculation result table according to a preset rule specifically includes:
[0054] Grouping and summarizing all calculation results according to the temporary list;
[0055] The grouping and aggregation are queried through SQL statements and updated uniformly to the asynchronous calculation result table.
[0056] Specifically, the data result table is deleted first according to the date + report code, and then the data is grouped and summarized according to each column item through the intermediate temporary table tmp. By querying the SQL grouping and summary, the data of the intermediate temporary table tmp is inserted into the data result table result at one time, thereby reducing the number of executions of a single calculation and update of a cell, thereby improving the calculation efficiency of the report.
[0057] In some embodiments, when calculating the execution report in the execution list set of the current priority, it specifically includes:
[0058] Obtain a report map rule set list corresponding to the execution report from the database, and create a corresponding calculation result list;
[0059] Traversing each element in the report map rule set list, parsing the cell rule formula corresponding to each element, and calculating the corresponding element to obtain a first calculation result;
[0060] Adding the calculated first calculation result to the calculation result list;
[0061] When all elements are calculated, the data in the calculation result list is inserted into the asynchronous calculation result table.
[0062] That is to say, at the minimum granularity of calculating a single report, it can be implemented by the following steps:
[0063] A1: Configure report rules, i.e. report calculation and data retrieval logic, through the report visualization map on the front-end interface, such as report code 001.
[0064] A2: During calculation, the report map rule set list corresponding to report code 001 is queried from the database through report code 001, and a list tres of report code 001 is created, which is the cell calculation return result and is used to store the result of each tcell cell variable.
[0065] A3: Use a for loop to traverse each element of the list, create a tcell for each element, parse and calculate the value of the cell rule formula of each element, add each calculation result to the tcell, and then add the tcell to the tres. If there is an unrecognizable rule in the parsed cell, an error will be reported. For example, if the report code is 001, the rule parsing error occurs at the row and column.
[0066] A4: First delete the intermediate temporary table tmp, traverse the tres list, obtain the results of the report elements by calling the get method of each tres object attribute, and insert the result data into the intermediate temporary table tmp.
[0067] A5: First delete the data result table result according to date + report code, and then use the intermediate temporary table tmp to group and summarize the data in each column. By querying the SQL grouping and summarizing, the data in the intermediate temporary table tmp is inserted into the data result table result at one time, thereby reducing the number of single calculation and update executions of cells and improving report calculation efficiency.
[0068] Step S104: updating the data result table corresponding to the report to be processed based on the asynchronous calculation result table to complete the processing of the report.
[0069] Finally, after all execution list sets are processed, the data in the asynchronous calculation result table also saves all the pending data in the pending report. At this time, SQL statements can be used to query the grouping and aggregation to insert the data in the asynchronous calculation result table into the data result table. This solution processes various types of reports in a multi-threaded concurrent manner to achieve high-efficiency calculation.
[0070] Based on the above-mentioned financial statement processing method, one or more embodiments of this specification also provide a platform and terminal for financial statement processing. The platform or terminal may include a device, software, module, plug-in, server, client, etc. using the method described in the embodiments of this specification and a device combined with necessary hardware for implementation. Based on the same innovative concept, the system in one or more embodiments provided in the embodiments of this specification is as described in the following embodiments. Since the implementation scheme and method for solving the problem of the system are similar, the implementation of the specific system in the embodiments of this specification can refer to the implementation of the aforementioned method, and the repetitions will not be repeated. The terms "unit" or "module" used below can be a combination of software and / or hardware that implements the predetermined functions. Although the system described in the following embodiments is preferably implemented in software, the implementation of hardware and a combination of software and hardware is also possible and conceived.
[0071] Specifically, Figure 2 is a schematic diagram of the module structure of an embodiment of the financial statement processing device provided in this specification, such as Figure 2 As shown, the financial statement processing device provided in this specification includes:
[0072] A division module 201 is used to divide the report to be processed into a corresponding type list set according to the type;
[0073] A determination module 202, configured to determine an execution list set including priorities according to the number of lists in each type list set, wherein the type list set corresponding to the least number of lists is the execution list set of the first priority;
[0074] A calculation module 203, configured to calculate each execution list set in sequence based on the priority and add the settlement result to an asynchronous calculation result table;
[0075] The updating module 204 is used to update the data result table corresponding to the report to be processed based on the asynchronous calculation result table to complete the processing of the report.
[0076] It should be noted that the above-mentioned system may also include other implementation modes according to the description of the corresponding method embodiment. The specific implementation modes may refer to the description of the above-mentioned corresponding method embodiment, which will not be described one by one here.
[0077] The present application also provides an electronic device, including:
[0078] processor;
[0079] a memory for storing instructions executable by the processor;
[0080] The processor is configured to execute the method provided in the above embodiment.
[0081] The electronic device provided by the embodiment of the present application stores the executable instructions of the processor in a memory. When the processor executes the executable instructions, it can first divide the to-be-processed reports into corresponding type list sets according to the type; then determine the execution list sets including priorities according to the number of lists in each type list set, and the type list set corresponding to the least number of lists is the execution list set of the first priority; then calculate each execution list set in turn based on the priority and add the settlement results to the asynchronous calculation result table; finally, update the data result table corresponding to the to-be-processed report based on the asynchronous calculation result table to complete the processing of the report, which can improve the efficiency of processing the report and reduce the update frequency and resource occupancy rate when processing the report.
[0082] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0083] The methods or devices described in the above embodiments provided in this specification can implement business logic through computer programs and record them on storage media, and the storage media can be read and executed by computers to achieve the effects of the solutions described in the embodiments of this specification, such as:
[0084] Divide the reports to be processed into corresponding type list sets according to their types;
[0085] Determine an execution list set including priorities according to the number of lists in each type list set, and the type list set corresponding to the least number of lists is the execution list set of the first priority;
[0086] Calculate each execution list set in sequence based on the priority and add the settlement results to the asynchronous calculation result table;
[0087] The data result table corresponding to the report to be processed is updated based on the asynchronous calculation result table to complete the processing of the report.
[0088] The storage medium may include a physical device for storing information, which is usually a medium that digitizes information and then stores it in an electrical, magnetic or optical manner. The storage medium may include: a device that stores information in an electrical energy manner, such as various memories, such as RAM, ROM, etc.; a device that stores information in a magnetic energy manner, such as a hard disk, a floppy disk, a magnetic tape, a magnetic core memory, a magnetic bubble memory, a USB flash drive; a device that stores information in an optical manner, such as a CD or a DVD. Of course, there are other readable storage media, such as quantum memory, graphene memory, etc.
[0089] The embodiments of this specification are not limited to complying with industry communication standards, standard computer resource data update and data storage rules, or the situations described in one or more embodiments of this specification. Certain industry standards or slightly modified implementation plans based on the implementation described in the custom method or embodiment can also achieve the same, equivalent or similar, or predictable implementation effects after deformation of the above-mentioned embodiments. The embodiments obtained by using these modified or deformed data acquisition, storage, judgment, processing methods, etc. can still fall within the scope of the optional implementation plans of the embodiments of this specification.
[0090] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a computer-readable medium such as a microprocessor or processor and a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, ATMEL AT91SAM, MICROCHIP PIC18F26K20, and SILICONE LABS C8051F320. The memory controller can also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules for implementing the method and structures within the hardware component.
[0091] The device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. There may be other divisions in actual implementation, such as multiple units or plug-ins may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be through some interface, indirect coupling or communication connection of the device or unit, which may be electrical, mechanical or other forms.
[0092] These computer program instructions may also be loaded onto a computer or other programmable resource data updating device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions executed on the computer or other programmable device for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0093] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. In the description of this specification, the description of the reference terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of this specification. Those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples.
[0094] Those skilled in the art will appreciate that the embodiments described herein are intended to help readers understand the principles of the present invention, and should be understood that the protection scope of the present invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific variations and combinations that do not deviate from the essence of the present invention based on the technical revelations disclosed by the present invention, and these variations and combinations are still within the protection scope of the present invention.
Claims
1. A method for processing financial statements, characterized in that: The method comprises: Divide the to-be-processed reports into corresponding type list sets according to their types, and after dividing the corresponding type list sets, assign a report code to each type list set; Determine an execution list set including priorities according to the number of lists in each type list set, and the type list set corresponding to the least number of lists is the execution list set of the first priority; Calculate each execution list set in sequence based on the priority and add the settlement results to the asynchronous calculation result table; Based on the asynchronous calculation result table, the data result table corresponding to the report to be processed is updated to complete the processing of the report; The step of calculating each execution list set in sequence based on the priority specifically includes: Creating a temporary list with the same report code for the execution list set, the temporary list being used to store the calculation results of the corresponding execution list set; When all elements in the execution list set are calculated, the calculation results in the temporary list are updated to the asynchronous calculation result table according to the preset rules; There is a nested loop structure between the execution list sets corresponding to the priorities, and the nested loop structure specifically traverses all the first elements in the execution list set of the next priority under each first element in the execution list set of the current priority.
2. The financial statement processing method according to claim 1, characterized in that: When calculating the execution list set, the method further includes: Traversing each element in the execution list set; After parsing and evaluating the cell rule formula of each element, the calculation result of the corresponding element is determined; The calculation result of the corresponding element is added to the temporary list.
3. The financial statement processing method according to claim 1, characterized in that: The method further includes, when calculating the execution report in the execution list set of the current priority, specifically including: Obtain a report map rule set list corresponding to the execution report from the database, and create a corresponding calculation result list; Traversing each element in the report map rule set list, parsing the cell rule formula corresponding to each element, and calculating the corresponding element to obtain a first calculation result; Adding the calculated first calculation result to the calculation result list; When all elements are calculated, the data in the calculation result list is inserted into the asynchronous calculation result table.
4. A financial statement processing device, characterized in that: The device comprises: A division module is used to divide the to-be-processed reports into corresponding type list sets according to their types, and after dividing the corresponding type list sets, assign a report code to each type list set; A determination module, configured to determine an execution list set including priorities according to the number of lists in each type list set, wherein the type list set corresponding to the least number of lists is the execution list set of the first priority; A calculation module, used to calculate each execution list set in sequence based on the priority and add the settlement result to the asynchronous calculation result table; An updating module, used for updating the data result table corresponding to the report to be processed based on the asynchronous calculation result table, so as to complete the processing of the report; The step of calculating each execution list set in sequence based on the priority specifically includes: Creating a temporary list with the same report code for the execution list set, the temporary list being used to store the calculation results of the corresponding execution list set; When all elements in the execution list set are calculated, the calculation results in the temporary list are updated to the asynchronous calculation result table according to the preset rules; There is a nested loop structure between the execution list sets corresponding to the priorities, and the nested loop structure specifically traverses all the first elements in the execution list set of the next priority under each first element in the execution list set of the current priority.
Citation Information
Patent Citations
Report processing method, system and device and computer readable storage medium
CN111353288A
Resource transfer message processing method and device, computer equipment and storage medium
CN115422897A