Method, device and electronic equipment for calculating a fee

CN120910157BActive Publication Date: 2026-08-21CHINA TOWER CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511027725.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-24
Publication Date
2026-08-21
Estimated Expiration
2045-07-24

AI Technical Summary

Technical Problem

[0006]本申请的主要目的在于提供一种费用计算方法、装置及电子设备,以解决相关技术中企业账务系统的费用计算过程中,基于传统数据库进行计算时计算能力不足,导致企业费用计算效率较低的问题

Benefits of technology

[0026]This application employs the following steps: triggering a data synchronization command at a preset time; wherein the preset time includes at least: a first preset time per month and a second preset time per day; responding to the data synchronization command, synchronizing the data to be processed required for expense calculation in the target business system between the source database and the target database through a data warehouse, generating a list of expense calculation events, wherein the target business system refers to the business system in the enterprise used to calculate accounting information; triggering an expense calculation command based on the list of expense calculation events, responding to the expense calculation command, generating billing information through the data warehouse, and triggering a report calculation command; responding to the report calculation command, generating and exporting report information through the data warehouse; synchronizing the report information and the billing information to the target database through the data warehouse, so as to determine the expense calculation result based on the report information and the billing information, thereby solving the problem in related technologies where the computing power is insufficient when calculating based on traditional databases in the expense calculation process of enterprise accounting systems, resulting in low efficiency in enterprise expense calculation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120910157B_ABST
    Figure CN120910157B_ABST
Patent Text Reader

Abstract

The application discloses a fee calculation method and device and electronic equipment, the method is applied to the field of data processing, the method comprises the following steps: triggering a data synchronization instruction at a preset time, synchronizing the to-be-processed data required by fee calculation in a target business system between a source database and a target database through a data warehouse, and generating a fee calculation event list; triggering a fee calculation instruction according to the fee calculation event list, generating billing information through the data warehouse in response to the fee calculation instruction, and triggering a report calculation instruction; generating and exporting report information from the data warehouse in response to the report calculation instruction; and synchronizing the report information and the billing information to the target database through the data warehouse, so as to determine a fee calculation result according to the report information and the billing information. Through the application, the problem that the calculation capacity is insufficient when calculation is performed based on a traditional database in the fee calculation process of an enterprise accounting system in the related art, and the enterprise fee calculation efficiency is low, is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and more specifically, to a method, apparatus, and electronic device for calculating costs. Background Technology

[0002] The billing and accounting system calculates costs based on information from three customers, order information, and cost documents provided by external systems, generating accounts receivable information for each customer.

[0003] Existing billing and accounting systems generally implement fee calculations in the following ways: The first is a database-based approach. This utilizes the database's data analysis capabilities, employing SQL statements to perform calculations on various data types to obtain the desired results. The second is a private memory-based approach. This loads the data needed for fee calculation into the application's private memory, performs calculations through program code blocks, obtains the required results, and then updates the database.

[0004] However, database-based computing solutions rely entirely on the database's own computing power. When the system has a large amount of data, it becomes difficult to handle the system's computational demands. While private memory-based computing solutions free the computational functions from the database, they still have a significant dependence on database I / O. When the system's business data changes frequently, and the business requires real-time results, these solutions are insufficient to meet actual needs.

[0005] There is currently no effective solution to the problem of low efficiency in enterprise expense calculation when using traditional databases for calculations in related technologies. Summary of the Invention

[0006] The main objective of this application is to provide a method, apparatus, and electronic device for calculating expenses, in order to solve the problem that the calculation of expenses in enterprise accounting systems is inefficient due to insufficient computing power when based on traditional databases.

[0007] To achieve the above objectives, according to one aspect of this application, a cost calculation method is provided. The method includes: triggering a data synchronization command at a preset time; wherein the preset time includes at least: a first preset time per month and a second preset time per day; responding to the data synchronization command, synchronizing the data to be processed required for cost calculation in a target business system between a source database and a target database via a data warehouse, generating a cost calculation event list, wherein the target business system refers to a business system within an enterprise used for calculating accounting information; triggering a cost calculation command based on the cost calculation event list; responding to the cost calculation command, generating billing information via the data warehouse and triggering a report calculation command; responding to the report calculation command, generating and exporting report information via the data warehouse; and synchronizing the report information and the billing information to the target database via the data warehouse to determine the cost calculation result based on the report information and the billing information.

[0008] Furthermore, by synchronizing the data to be processed required for cost calculation in the target business system between the source database and the target database through a data warehouse, a cost calculation event list is generated. This includes: determining the data to be processed based on the business system corresponding to the source database, and writing the data to be processed into a first temporary data table in the source database; synchronizing the first temporary data table in the source database to a second temporary data table in the target database through a data synchronization application; updating the target data table corresponding to each data entry in the second temporary data table in the target database based on the primary key information of each data entry in the second temporary data table, to obtain an updated target data table; generating the cost calculation event list and generating a data synchronization log in the target database based on the updated target data table, and deleting the first temporary data table and the second temporary data table.

[0009] Furthermore, synchronizing the first temporary data table in the source database to the second temporary data table in the target database through a data synchronization application includes: cleaning the data in the first temporary data table in the source database based on the primary key information of each piece of data in the first temporary data table to obtain a cleaned first temporary data table; determining the association between the cleaned first temporary data table and the source data table corresponding to the data to be processed through a data synchronization application; and synchronizing the source data table corresponding to the data to be processed in the source database to the second temporary data table in the target database based on the association.

[0010] Furthermore, the method further includes: before writing the data to be processed into the first temporary data table in the source database, modifying the target attribute of the preset data table in the target database to a first preset value, wherein the target attribute represents the synchronization status information of the data synchronization process; after generating the billing event and generating the data synchronization log in the target database according to the updated target data table, and deleting the first temporary data table and the second temporary data table, modifying the target attribute of the preset data table in the target database to a second preset value.

[0011] Furthermore, before triggering a cost calculation instruction based on the cost calculation event list, responding to the cost calculation instruction, and generating billing information through the data warehouse, the method further includes: obtaining the cost file required for cost calculation from the enterprise's preset business system, wherein the preset business system refers to the business system in the enterprise that needs to calculate accounting information; reading the data processing log in the target database to determine whether the data in the cost file has been processed; if the data in the cost file has not been processed, synchronizing the cost file to the third temporary data table of the target database through the data warehouse; generating cost calculation events and updating the data processing log based on the third temporary data table of the target database through the data warehouse, and updating the cost calculation event list based on the cost calculation events.

[0012] Furthermore, synchronizing the report information and the billing information to the target database through the data warehouse includes: synchronizing the billing information and the report information to a fourth temporary data table in the target database through a data synchronization application in the data warehouse; and transferring the billing information, the report information, and the basic cost information from the fourth temporary data table to the corresponding data table in the target database according to a preset data query statement, wherein the basic cost information is information generated based on the cost file.

[0013] Furthermore, generating billing information through the data warehouse includes: performing a deduplication operation on the billing events included in the billing event list, and updating the billing event list to obtain an updated billing event list; calculating the billing information according to the business processing logic corresponding to each billing event in the updated billing event list, updating the billing information to the target database through the data warehouse, and updating the processing status of the processed billing events.

[0014] Further, generating and exporting report information from the data warehouse includes: determining data preprocessing information, data query statements corresponding to the data to be exported, file naming rules, file writing rules, and file directory rules based on preset outbound configuration parameters; performing data preprocessing on the report information based on the data preprocessing information and the data query statements to obtain the data to be exported; writing the data to be exported into a target file according to the file naming rules and the file writing rules; and exporting the target file to a target file directory according to the file directory rules.

[0015] To achieve the above objectives, according to another aspect of this application, a cost calculation apparatus is provided, comprising: a triggering unit for triggering a data synchronization command at a preset time; wherein the preset time includes at least: a first preset time per month and a second preset time per day; a first synchronization unit for responding to the data synchronization command, synchronizing the data to be processed required for cost calculation in a target business system between a source database and a target database through a data warehouse, and generating a cost calculation event list, wherein the target business system refers to a business system in an enterprise used for calculating accounting information; a first generation unit for triggering a cost calculation command based on the cost calculation event list, responding to the cost calculation command, generating billing information through the data warehouse, and triggering a report calculation command; responding to the report calculation command, generating and exporting report information through the data warehouse; and a determining unit for synchronizing the report information and the billing information to the target database through the data warehouse, so as to determine the cost calculation result based on the report information and the billing information.

[0016] Further, the first synchronization unit includes: a first determining subunit, configured to determine the data to be processed based on the business system corresponding to the source database, and write the data to be processed into a first temporary data table in the source database; a first synchronization subunit, configured to synchronize the first temporary data table in the source database to a second temporary data table in the target database through a data synchronization application; an updating subunit, configured to update the target data table corresponding to each piece of data in the second temporary data table in the target database based on the primary key information of each piece of data in the second temporary data table, to obtain an updated target data table; and a generating subunit, configured to generate the billing event list and generate a data synchronization log in the target database based on the updated target data table, and delete the first temporary data table and the second temporary data table.

[0017] Further, the synchronization subunit includes: a cleaning module, used to clean the data in the first temporary data table in the source database according to the primary key information of each piece of data in the first temporary data table, to obtain a cleaned first temporary data table; a determination module, used to determine the association relationship between the cleaned first temporary data table and the source data table corresponding to the data to be processed through a data synchronization application; and a synchronization module, used to synchronize the source data table corresponding to the data to be processed in the source database to the second temporary data table in the target database according to the association relationship.

[0018] Furthermore, the first synchronization unit further includes: a first modification subunit, configured to modify the target attribute of a preset data table in the target database to a first preset value before writing the data to be processed into the first temporary data table in the source database, wherein the target attribute represents the synchronization status information of the data synchronization process; and a second modification subunit, configured to modify the target attribute of the preset data table in the target database to a second preset value after generating the billing event and generating the data synchronization log in the target database according to the updated target data table, and deleting the first temporary data table and the second temporary data table.

[0019] Furthermore, the apparatus further includes: an acquisition unit, configured to acquire a cost file required for cost calculation from a preset business system of the enterprise before triggering a cost calculation instruction based on the cost calculation event list, responding to the cost calculation instruction, and generating billing information through the data warehouse; a judgment unit, configured to read the data processing log in the target database and determine whether the data in the cost file has been processed; a second synchronization unit, configured to synchronize the cost file to a third temporary data table in the target database through the data warehouse if the data in the cost file has not been processed; and a second generation unit, configured to generate cost calculation events and update the data processing log based on the third temporary data table in the target database through the data warehouse, and update the cost calculation event list based on the cost calculation events.

[0020] Further, the second generation unit includes: a second synchronization subunit, used to synchronize the billing information and the report information to the fourth temporary data table of the target database through a data synchronization application in the data warehouse; and a transfer subunit, used to transfer the billing information, the report information, and the basic cost information from the fourth temporary data table to the corresponding data table in the target database according to a preset data query statement, wherein the basic cost information is information generated based on the cost file.

[0021] Further, the first generation unit includes: a deduplication subunit, used to perform deduplication on the billing events included in the billing event list, and update the billing event list to obtain an updated billing event list; and a calculation subunit, used to calculate the billing information according to the business processing logic corresponding to each billing event in the updated billing event list, update the billing information to the target database through the data warehouse, and update the processing status of the processed billing events.

[0022] Further, the first generation unit includes: a second determining subunit, used to determine data preprocessing information, data query statements corresponding to the data to be exported, file naming rules, file writing rules, and file directory rules based on preset outbound configuration parameters; a processing subunit, used to perform data preprocessing on the report information based on the data preprocessing information and the data query statements to obtain the data to be exported; a writing subunit, used to write the data to be exported into a target file according to the file naming rules and the file writing rules; and an export subunit, used to export the target file to a target file directory according to the file directory rules.

[0023] To achieve the above objectives, according to one aspect of this application, a computer program product is provided, comprising a computer program that, when executed by a processor, implements any of the above-described cost calculation methods, and when executed by a processor, implements the steps of the cost calculation methods described in various embodiments of this application.

[0024] To achieve the above objectives, according to one aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium including stored computer instructions, wherein, when the computer instructions are executed by a processor, the cost calculation method described in any one of the above claims is implemented.

[0025] To achieve the above objectives, according to one aspect of this application, an electronic device is provided, including one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the cost calculation method described in any of the above.

[0026] This application employs the following steps: triggering a data synchronization command at a preset time; wherein the preset time includes at least: a first preset time per month and a second preset time per day; responding to the data synchronization command, synchronizing the data to be processed required for expense calculation in the target business system between the source database and the target database through a data warehouse, generating a list of expense calculation events, wherein the target business system refers to the business system in the enterprise used to calculate accounting information; triggering an expense calculation command based on the list of expense calculation events, responding to the expense calculation command, generating billing information through the data warehouse, and triggering a report calculation command; responding to the report calculation command, generating and exporting report information through the data warehouse; synchronizing the report information and the billing information to the target database through the data warehouse, so as to determine the expense calculation result based on the report information and the billing information, thereby solving the problem in related technologies where the computing power is insufficient when calculating based on traditional databases in the expense calculation process of enterprise accounting systems, resulting in low efficiency in enterprise expense calculation.

[0027] By triggering data synchronization commands at the first preset time each month and the second preset time each day, full and real-time incremental updates of enterprise accounting information are ensured. This allows for rapid reflection of the latest enterprise accounting information, thereby improving the efficiency of enterprise expense calculation. By leveraging the powerful data processing capabilities of the data warehouse, data synchronization between the source and target databases is achieved, rather than over-reliance on traditional databases or in-memory databases. This reduces the high demand for hardware resources, saves system maintenance and operating costs, and makes the billing and report generation processes more efficient. Furthermore, the data synchronization process includes not only invoices and reports but also the raw data required for expense calculation, ensuring data integrity and consistency in the billing process and reducing deviations and errors caused by data asynchrony.

[0028] In summary, the above steps significantly enhance the real-time performance of enterprise expense calculations, optimize system resource utilization, ensure data consistency, and achieve accurate responses to expense calculation events, thereby improving business flexibility and decision support capabilities. Therefore, the expense calculation method provided in this embodiment is suitable for scenarios requiring the processing of large amounts of data and real-time updates of accounting information, such as real-time billing systems in the telecommunications industry, effectively improving billing efficiency and enterprise user experience. Attached Figure Description

[0029] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0030] Figure 1This is a flowchart of the cost calculation method provided in Embodiment 1 of this application;

[0031] Figure 2 This is a schematic diagram of an optional data synchronization process provided according to Embodiment 1 of this application;

[0032] Figure 3 This is a schematic diagram of an optional process for importing a fee file into a data warehouse according to Embodiment 1 of this application;

[0033] Figure 4 This is a schematic diagram of an optional process for synchronizing report information and billing information from a data warehouse to a target database, according to Embodiment 1 of this application.

[0034] Figure 5 This is a flowchart illustrating an optional method for generating billing and report information according to Embodiment 1 of this application;

[0035] Figure 6 This is a schematic diagram of an optional process for exporting report information to a data warehouse according to Embodiment 1 of this application;

[0036] Figure 7 This is a flowchart illustrating an optional cost calculation method provided in Embodiment 1 of this application;

[0037] Figure 8 This is a schematic diagram of a cost calculation device provided according to Embodiment 2 of this application;

[0038] Figure 9 This is a schematic diagram of a cost calculation electronic device provided according to Embodiment 5 of this application. Detailed Implementation

[0039] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0040] It should be noted that the user information (including but not limited to user device information, user personal information, collected data, used data, generated data, processed data, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, collected information, used information, generated information, processed information, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of related data all comply with the relevant laws, regulations, and standards of the relevant countries and regions, and necessary confidentiality measures have been taken. These measures do not violate public order and good morals, and corresponding operation entry points are provided for users to choose to authorize or refuse. For example, this system has interfaces with relevant users or organizations. Before obtaining relevant information, a request to obtain the information needs to be sent to the aforementioned user or organization through the interface, and the relevant information is obtained only after receiving consent from the aforementioned user or organization.

[0041] It should be noted that this application provides users with a corresponding entry point for choosing to agree to or reject the automated decision-making results; if the user chooses to reject, the process will proceed to the expert decision-making process.

[0042] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0043] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0044] Example 1

[0045] The present invention will now be described in conjunction with preferred implementation steps. Figure 1 This is a flowchart of the cost calculation method provided in Embodiment 1 of this application, such as... Figure 1 As shown, the method includes the following steps:

[0046] Step S101: Trigger a data synchronization command at a preset time; wherein the preset time includes at least: the first preset time of each month and the second preset time of each day.

[0047] In this first embodiment, in order to ensure the accuracy and timeliness of the enterprise's accounting information, a data synchronization command can be triggered at a specific preset time, that is, the data synchronization task is started at a specific time point.

[0048] The preset time can be the beginning of each month (i.e., the first preset time of each month mentioned above, for example, 12:00 AM on the 1st of each month, which is not specifically limited in this embodiment 1) to fully synchronize the complete data of the previous month in order to perform full billing and report calculations and ensure the integrity and accuracy of the data.

[0049] The preset time can also be a fixed time point every day (i.e., the second preset time of each day mentioned above, such as early morning, off-peak business hours, etc. The number of second preset times can be one or more, and no specific limitation is made in this embodiment 1) to trigger incremental data synchronization, so as to meet the needs of real-time incremental billing and report updates, and reflect the data changes of the previous day, so as to achieve the effect of real-time updating of bills and reports.

[0050] Step S102: In response to the data synchronization command, the data to be processed required for cost calculation in the target business system is synchronized between the source database and the target database through the data warehouse, and a list of cost calculation events is generated. Here, the target business system refers to the business system in the enterprise used to calculate accounting information.

[0051] In this first embodiment, upon receiving the data synchronization instruction, the data synchronization process is immediately initiated. Utilizing the efficient data processing capabilities of the data warehouse, the data required by the enterprise's billing and accounting system (i.e., the target business system mentioned above), such as the three customer information and order information (i.e., the data to be processed for the aforementioned cost calculation), are synchronized from the enterprise's order system database (i.e., the source database mentioned above) to the billing and accounting system. After data synchronization is complete, at least one cost calculation event is generated based on the synchronized data, forming the aforementioned cost calculation event list.

[0052] Step S103: Trigger a cost calculation instruction based on the cost calculation event list; respond to the cost calculation instruction; generate billing information through the data warehouse and trigger a report calculation instruction; respond to the report calculation instruction; generate and export report information through the data warehouse.

[0053] In this first embodiment, based on the billing event list generated after data synchronization, a billing calculation instruction is automatically triggered, initiating either the monthly billing calculation process or the daily real-time incremental billing calculation process. Upon receiving the billing calculation instruction, the data warehouse utilizes its powerful real-time computing capabilities to perform batch calculations of billing information based on the synchronized data in the target database. After the billing information calculation is complete, a report calculation instruction is further triggered. The data warehouse generates report information based on the billing data and exports the report data through a data transmission application for use by other systems or business personnel.

[0054] Step S104: Synchronize report information and billing information with the target database through the data warehouse to determine the cost calculation results based on the report information and billing information.

[0055] In this first embodiment, after the data warehouse completes real-time billing and report generation, the resulting data (billing information and report information) is synchronized back to the database in the billing and accounting system (i.e., the target database mentioned above). This ensures that the business system responsible for calculating accounting information can obtain the latest and most accurate cost calculation results in a timely manner. The synchronized report and billing information becomes the basis for the final cost calculation results in the billing and accounting system, supporting subsequent billing, reconciliation, and customer service operations. This also demonstrates the important role of the data warehouse in improving data processing efficiency and real-time performance.

[0056] In summary, the cost calculation method provided in Embodiment 1 of this application, by triggering a data synchronization command at a preset time (including at least a first preset time per month and a second preset time per day), responds to the data synchronization command by synchronizing the data to be processed required for cost calculation in the target business system between the source database and the target database through a data warehouse, generating a cost calculation event list (where the target business system refers to the business system in the enterprise used to calculate accounting information), triggers a cost calculation command based on the cost calculation event list, responds to the cost calculation command by generating billing information through the data warehouse, and triggers a report calculation command, responds to the report calculation command by generating and exporting report information through the data warehouse, and synchronizes the report information and billing information to the target database through the data warehouse to determine the cost calculation result based on the report information and billing information, solves the problem in related technologies where the computational power is insufficient when calculating based on traditional databases, resulting in low cost calculation efficiency for enterprises.

[0057] By triggering data synchronization commands at the first preset time each month and the second preset time each day, full and real-time incremental updates of enterprise accounting information are ensured. This allows for rapid reflection of the latest enterprise accounting information, thereby improving the efficiency of enterprise expense calculation. By leveraging the powerful data processing capabilities of the data warehouse, data synchronization between the source and target databases is achieved, rather than over-reliance on traditional databases or in-memory databases. This reduces the high demand for hardware resources, saves system maintenance and operating costs, and makes the billing and report generation processes more efficient. Furthermore, the data synchronization process includes not only invoices and reports but also the raw data required for expense calculation, ensuring data integrity and consistency in the billing process and reducing deviations and errors caused by data asynchrony.

[0058] Through the above steps, the real-time performance of enterprise expense calculation is significantly enhanced, system resource utilization is optimized, data consistency is ensured, and accurate response to expense calculation events is achieved, thereby improving business flexibility and decision support capabilities. Therefore, the expense calculation method provided in this embodiment is suitable for scenarios requiring the processing of large amounts of data and real-time updates of accounting information, such as real-time billing systems in the telecommunications industry, effectively improving billing efficiency and enterprise user experience.

[0059] Optionally, in the cost calculation method provided in Embodiment 1 of this application, the data to be processed required for cost calculation in the target business system is synchronized between the source database and the target database through a data warehouse to generate a cost calculation event list. This includes: determining the data to be processed based on the business system corresponding to the source database and writing the data to be processed into a first temporary data table in the source database; synchronizing the first temporary data table in the source database to a second temporary data table in the target database through a data synchronization application; updating the target data table corresponding to each piece of data in the second temporary data table in the target database based on the primary key information of each piece of data in the second temporary data table to obtain an updated target data table; generating a cost calculation event list and a data synchronization log in the target database based on the updated target data table, and deleting the first temporary data table and the second temporary data table.

[0060] In this first embodiment, in order to ensure the efficiency of the enterprise's accounting information processing, it is necessary to perform data synchronization operations through the data warehouse, so as to carry out the cost calculation process based on the synchronized data.

[0061] For example, Figure 2This is a schematic diagram of an optional data synchronization process provided in Embodiment 1 of this application. First, based on the needs of the billing and accounting system (i.e., the business system corresponding to the source database mentioned above) and the current business status, the data to be processed necessary for enterprise expense calculation is determined, such as changes in three types of customer information and order information. Then, this data to be processed is written into a dedicated temporary data table (i.e., the first temporary data table mentioned above) in the source database (e.g., a relational database) to prepare for subsequent data synchronization operations.

[0062] Then, the data in the first temporary data table is quickly synchronized to another temporary data table (the second temporary data table) in the billing and accounting system database (the target database mentioned above) using a data synchronization application.

[0063] Secondly, in the target database, based on the unique identifier (primary key information) of the data in the second temporary data table, the corresponding record in the target data table is searched and updated to reflect the latest business status. This process ensures that the data in the target database is up-to-date and accurate, providing real-time data support for cost calculation.

[0064] Finally, after the target data table is updated, one or more cost calculation events are generated based on the latest target data table, forming a cost calculation event list and triggering the cost calculation process. Simultaneously, data synchronization logs are automatically generated for monitoring and auditing the details of the synchronization operation. Furthermore, after completing synchronization and generating the cost calculation event list, to release resources and maintain database cleanliness, the first temporary data table in the source database and the second temporary data table in the target database need to be cleared.

[0065] The data synchronization process described above ensures real-time data synchronization and updates, providing a solid data foundation for the real-time and accurate calculation of costs. At the same time, reasonable resource management and data table management maintain the efficient operation of the system and the high availability of data.

[0066] Optionally, in the cost calculation method provided in Embodiment 1 of this application, synchronizing the first temporary data table in the source database to the second temporary data table in the target database through a data synchronization application includes: cleaning the data in the first temporary data table in the source database based on the primary key information of each piece of data in the first temporary data table to obtain a cleaned first temporary data table; determining the association between the cleaned first temporary data table and the source data table corresponding to the data to be processed through a data synchronization application; and synchronizing the source data table corresponding to the data to be processed in the source database to the second temporary data table in the target database based on the association.

[0067] In this first embodiment, the data in the first temporary data table is first cleaned in the source database of the business system that records order information. The data cleaning process is mainly based on the primary key information of each record to remove duplicate data, invalid data, or old version data from incremental or full data, ensuring the uniqueness and up-to-dateness of the data, thereby obtaining the cleaned first temporary data table. For example, for data records corresponding to the same primary key information, only the data record whose update time is closest to the current time needs to be retained.

[0068] Then, based on business logic and data consistency principles, the data synchronization application is used to determine the relationship between the cleaned first temporary data table and the relevant business data tables in the order system database (i.e., the source data tables mentioned above), to ensure that the synchronization process correctly covers all relevant business data in the source data tables.

[0069] Finally, based on the established relationships, the required data is transferred from the source data table corresponding to the data to be processed in the source database to the second temporary data table in the billing and accounting system database (i.e., the target database mentioned above) through data synchronization application.

[0070] By employing three key steps—data cleaning, relationship confirmation, and data synchronization—data quality and processing efficiency can be effectively improved, ensuring the accuracy and real-time nature of cost calculations. At the same time, it reduces the I / O pressure on the source database and optimizes the overall system performance.

[0071] Optionally, in the cost calculation method provided in Embodiment 1 of this application, the method further includes: before writing the data to be processed into the first temporary data table in the source database, modifying the target attribute of the preset data table in the target database to a first preset value, wherein the target attribute represents the synchronization status information of the data synchronization process; after generating a cost calculation event list and generating a data synchronization log in the target database based on the updated target data table, and deleting the first temporary data table and the second temporary data table, modifying the target attribute of the preset data table in the target database to a second preset value.

[0072] In this first embodiment, in order to avoid interruption or repeated execution of the data synchronization process and to ensure the smooth execution and accuracy of the data synchronization process, the data synchronization process can be controlled through the status information of the data synchronization process.

[0073] For example, Figure 3This is a schematic diagram of an optional process for importing a fee file into a data warehouse, according to Embodiment 1 of this application. Before the data synchronization process begins, the target attributes of a preset data table (e.g., the sys_parameters table) in the target database used to manage the data synchronization status are modified to a first preset value to mark the state of data synchronization as about to begin or in progress, preventing unexpected interruptions or concurrent operation problems during the synchronization process. The first preset value typically indicates the start status of the synchronization task, ensuring the consistency and integrity of the synchronization process.

[0074] After the data synchronization and billing process is completed—that is, after steps such as generating a billing event list, recording data synchronization logs, and cleaning up temporary data tables are performed—the target attribute of the preset data table in the target database is modified to the second preset value. This indicates that the data synchronization and billing process has ended and the result data has been updated in the target database. The second preset value typically represents the state of the synchronization task ending or successfully completing.

[0075] By managing the target attributes of the preset data table, the data synchronization process can be effectively controlled to avoid duplicate synchronization or conflicts. Furthermore, by recording the synchronization status, a basis can be provided for subsequent auditing, troubleshooting, and execution of business logic. This achieves the technical effect of improving data consistency and synchronization reliability, and provides an important guarantee for the stable operation and efficient billing of the enterprise expense calculation system.

[0076] Optionally, in the cost calculation method provided in Embodiment 1 of this application, before triggering a cost calculation instruction based on the cost calculation event list, responding to the cost calculation instruction, and generating billing information through the data warehouse, the method further includes: obtaining the cost file required for cost calculation from the enterprise's preset business system, wherein the preset business system refers to the business system in the enterprise that needs to calculate accounting information; reading the data processing log in the target database to determine whether the data in the cost file has been processed; if the data in the cost file has not been processed, synchronizing the cost file to the third temporary data table of the target database through the data warehouse; generating cost calculation events and updating the data processing log based on the third temporary data table of the target database through the data warehouse, and updating the cost calculation event list based on the cost calculation events.

[0077] In this first embodiment, before generating invoice information, it is necessary to obtain file data for expense calculation from other business systems of the enterprise that need to calculate accounting information (i.e., the aforementioned preset business systems). The expense file may contain instructions on the accounting information that different business systems need to calculate, such as the data range of the accounting information to be calculated.

[0078] Then, the data processing logs in the billing and accounting system database (i.e., the target database mentioned above) are checked to determine whether the received fee file data has been processed, thus avoiding the duplication of the same data and achieving the effect of saving computing resources and ensuring the efficiency and accuracy of data processing.

[0079] Secondly, if the data in the expense file has not yet been processed, the data warehouse function will be used to import the data in the expense file into a temporary data table (i.e., the third temporary data table mentioned above) in the billing and accounting system database for subsequent expense calculation processes.

[0080] Finally, based on the imported raw data, a cost calculation event is generated through the data warehouse, triggering the cost calculation process. Simultaneously, the system updates the data processing log, recording the processing status of the data files, including processing time and results. The cost calculation event list is updated based on the generated cost calculation events to ensure that subsequent processing flows can operate based on the latest cost calculation events.

[0081] By checking the data processing status of expense files, duplicate operations can be avoided, and the powerful processing capabilities of the data warehouse can be used to generate billing events, thereby updating the expense calculation results and providing key technical support for real-time billing. At the same time, this not only improves the real-time performance of data processing but also enhances the stability of the enterprise's expense calculation system and the rational utilization of resources.

[0082] Optionally, in the cost calculation method provided in Embodiment 1 of this application, synchronizing report information and billing information to the target database through a data warehouse includes: synchronizing billing information and report information to the fourth temporary data table of the target database through a data synchronization application in the data warehouse; and transferring the billing information, report information, and basic cost information from the fourth temporary data table to the corresponding data table in the target database according to a preset data query statement, wherein the basic cost information is information generated based on a cost file.

[0083] In this first embodiment, Figure 4 This is a schematic diagram illustrating an optional process for synchronizing report and billing information from a data warehouse to a target database, according to Embodiment 1 of this application. First, a data synchronization application is used to synchronize the billing and accounting system database (i.e., the target database mentioned above) with another temporary data table (i.e., the fourth temporary data table mentioned above) to ensure that the calculation results can be transmitted to the target database in a timely and accurate manner, providing the latest billing and report data for subsequent business processing.

[0084] Then, by executing predefined SQL statements or other data query statements, the billing information, report information, and basic expense information in the fourth temporary data table are efficiently transferred to the corresponding formal data tables in the target database. The basic expense information is calculated based on the aforementioned expense files and, together with the billing and report information, constitutes the complete expense calculation result. This transfer operation ensures persistent data storage, facilitating subsequent transaction processing and data archiving, while also providing the business system with directly accessible, up-to-date accounting data.

[0085] Through the above steps, the data warehouse not only leverages its powerful real-time computing and data processing capabilities, but also seamlessly integrates the real-time calculated billing and reporting information into the target database through data synchronization and formal transfer, thus ensuring business continuity and data consistency.

[0086] Optionally, in the cost calculation method provided in Embodiment 1 of this application, generating billing information through a data warehouse includes: performing a deduplication operation on the cost calculation events included in the cost calculation event list, and updating the cost calculation event list to obtain an updated cost calculation event list; calculating billing information according to the business processing logic corresponding to each cost calculation event in the updated cost calculation event list, updating the billing information to the target database through the data warehouse, and updating the processing status of the processed cost calculation events.

[0087] In this first embodiment, to generate billing information, duplicate events in the billing event list need to be identified and removed to ensure that each billing event is calculated only once, avoiding billing errors caused by duplicate calculations. After deduplication, the billing event list is updated to ensure that the list content accurately reflects the latest business changes to be processed.

[0088] Then, based on the updated billing event list, billing information is calculated according to the specific business logic of each event to ensure accurate and comprehensive billing information that reflects the actual billing information and the latest status of the business system. Different billing events in different business systems can use different billing rules, such as package fees, additional service fees, and over-usage fees.

[0089] Finally, after the billing information calculation is complete, the data warehouse synchronizes this information to the billing and accounting system database (i.e., the target database mentioned above), completing the billing data update. Simultaneously, it records the processing status of the fee calculation event, indicating that the event has been calculated, and saves the calculation result of the fee calculation event to the data table storing billing information in the target database.

[0090] Deduplication ensures the accuracy of billing calculations and avoids resource waste; calculating bills based on business logic guarantees the accuracy and efficiency of cost calculations; finally, the data warehouse synchronization mechanism enables real-time updates of billing information and recording of billing event status, providing accurate and timely data for subsequent business processing.

[0091] In one alternative embodiment, Figure 5 This is a schematic diagram illustrating an optional process for generating billing and report information according to Embodiment 1 of this application. The generation of billing and report information includes two stages: batch calculation at the beginning of the month and real-time incremental calculation.

[0092] The initial setup at the beginning of the month includes: performing a full billing process by calling the batch billing calculation process in the data warehouse to generate initial billing data; and performing a full reporting process by calling the full reporting process in the data warehouse to generate initial report data.

[0093] Real-time incremental computation includes: scheduling scheduled tasks based on the data warehouse, invoking the incremental computation process in the data warehouse, and incrementally updating records in the data tables. The basic steps of incremental computation include: obtaining a list of billing events and setting their processing status; deduplicating the billing events in the list to reduce unnecessary computation. Since billing events involve a large amount of data and changes in basic business information, deduplication is necessary to determine the data requiring billing. Additionally, some data aggregation operations, such as addition, are involved; and incremental data is calculated in small batches according to business processing logic and updated in the corresponding data tables for billing and accounting information in the billing and accounting system.

[0094] Optionally, in the cost calculation method provided in Embodiment 1 of this application, generating and exporting report information through a data warehouse includes: determining data preprocessing information, data query statements corresponding to the data to be exported, file naming rules, file writing rules, and file directory rules based on preset outbound configuration parameters; performing data preprocessing on the report information based on the data preprocessing information and data query statements to obtain the data to be exported; writing the data to be exported into a target file according to the file naming rules and file writing rules; and exporting the target file to a target file directory according to the file directory rules.

[0095] In this first embodiment, in order to ensure the efficiency of exporting the generated billing information and report information, it can be processed through a data warehouse.

[0096] For example, Figure 6This is a schematic diagram illustrating an optional process for exporting report information to a data warehouse, as provided in Embodiment 1 of this application. Based on pre-defined export configurations, the information required for exporting data to the data warehouse is specified, including but not limited to: details of data preprocessing, how to extract data using SQL queries, how to name the exported files, the method of writing data to files, and the directory where the files are stored. These export configuration parameters ensure the automation and standardization of the data export process, as well as the correct naming and storage of files.

[0097] Then, based on the preprocessed information and query statements, the report information undergoes necessary data transformation or cleaning, such as data type conversion and data aggregation, to ensure that the data format conforms to the file writing rules, thus obtaining the dataset to be exported.

[0098] Secondly, filenames are generated using established file naming rules, and the preprocessed data is written to a new target file according to the file writing rules. This process ensures consistent file naming, facilitating management and identification, while also ensuring the correct format and complete storage of the data.

[0099] Finally, according to the file directory rules, the generated target files are automatically moved to the specified file directory so that other systems or services can access and utilize these files. This standardized file management process improves the efficiency and reliability of file export.

[0100] By automating data preprocessing, file generation, and file management through preset configuration parameters, the complexity of data export is simplified, the accuracy and consistency of exported data are ensured, and the efficiency and reliability of file export are improved.

[0101] Optionally, in this first embodiment, Figure 7 This is a flowchart illustrating an optional cost calculation method provided in Embodiment 1 of this application. This method leverages the real-time analysis capabilities of data warehouses, which excel at handling large volumes of data, by placing the computational logic within the real-time data warehouse. It uses an event-driven approach to achieve real-time incremental calculation of invoices and reports, ensuring data timeliness. Real-time queries directly utilize data from the data warehouse, and the data is periodically synchronized back to the relational database. Figure 7The process includes the following steps: Using real-time incremental synchronization, information on three users and ordering information is synchronized from the billing and accounting system's database (relational database) to the data warehouse; the expense file is imported into the data warehouse, basic expense information is generated based on the expense file, and then expense calculation events are triggered based on the three user information, ordering information, and expense file in the data warehouse; the expense calculation events trigger bill generation, and bill generation triggers report generation; bill generation yields bill information, and report generation yields report information; the report information is exported from the data warehouse to update the expense file; and the report information, bill information, and basic expense information are synchronized from the data warehouse to the billing and accounting system's database.

[0102] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0103] Example 2

[0104] This application also provides a cost calculation device in Embodiment 2. It should be noted that the cost calculation device in Embodiment 2 can be used to execute the cost calculation method provided in Embodiment 1. The cost calculation device provided in Embodiment 2 is described below.

[0105] Figure 8 This is a schematic diagram of a cost calculation device provided according to Embodiment 2 of this application. Figure 8 As shown, the device includes: a triggering unit 801, a first synchronization unit 802, a first generation unit 803, and a determination unit 804.

[0106] Specifically, the triggering unit 801 is used to trigger a data synchronization command at a preset time; wherein the preset time includes at least: the first preset time of each month and the second preset time of each day.

[0107] The first synchronization unit 802 is used to respond to data synchronization instructions and synchronize the data to be processed required for cost calculation in the target business system between the source database and the target database through the data warehouse, and generate a list of cost calculation events. The target business system refers to the business system in the enterprise used to calculate accounting information.

[0108] The first generation unit 803 is used to trigger a cost calculation instruction based on the cost calculation event list, respond to the cost calculation instruction, generate billing information through the data warehouse, and trigger a report calculation instruction; respond to the report calculation instruction, generate and export report information through the data warehouse.

[0109] Unit 804 is used to synchronize report information and billing information to the target database through the data warehouse, so as to determine the cost calculation results based on the report information and billing information.

[0110] The expense calculation device provided in Embodiment 2 of this application triggers a data synchronization command at a preset time via a triggering unit 801. The preset time includes at least a first preset time per month and a second preset time per day. A first synchronization unit 802 responds to the data synchronization command by synchronizing the data to be processed in the target business system between the source database and the target database via a data warehouse, generating a expense calculation event list. The target business system refers to the business system within an enterprise used to calculate accounting information. A first generation unit 803 triggers an expense calculation command based on the expense calculation event list, responds to the expense calculation command by generating billing information via the data warehouse, and triggers a report calculation command. It responds to the report calculation command by generating and exporting report information via the data warehouse. A determination unit 804 synchronizes the report information and billing information to the target database via the data warehouse to determine the expense calculation result based on the report information and billing information. This solves the problem in related technologies where insufficient computing power leads to low expense calculation efficiency when calculating based on traditional databases during the expense calculation process of enterprise accounting systems.

[0111] By triggering data synchronization commands at the first preset time each month and the second preset time each day, full and real-time incremental updates of enterprise accounting information are ensured. This allows for rapid reflection of the latest enterprise accounting information, thereby improving the efficiency of enterprise expense calculation. By leveraging the powerful data processing capabilities of the data warehouse, data synchronization between the source and target databases is achieved, rather than over-reliance on traditional databases or in-memory databases. This reduces the high demand for hardware resources, saves system maintenance and operating costs, and makes the billing and report generation processes more efficient. Furthermore, the data synchronization process includes not only invoices and reports but also the raw data required for expense calculation, ensuring data integrity and consistency in the billing process and reducing deviations and errors caused by data asynchrony.

[0112] In summary, the above steps significantly enhance the real-time performance of enterprise expense calculations, optimize system resource utilization, ensure data consistency, and achieve accurate responses to expense calculation events, thereby improving business flexibility and decision support capabilities. Therefore, the expense calculation method provided in this embodiment is suitable for scenarios requiring the processing of large amounts of data and real-time updates of accounting information, such as real-time billing systems in the telecommunications industry, effectively improving billing efficiency and enterprise user experience.

[0113] Optionally, in the cost calculation device provided in Embodiment 2 of this application, the first synchronization unit 802 includes: a first determining subunit, used to determine the data to be processed according to the business system corresponding to the source database, and write the data to be processed into a first temporary data table in the source database; a first synchronization subunit, used to synchronize the first temporary data table in the source database to a second temporary data table in the target database through a data synchronization application; an updating subunit, used to update the target data table corresponding to each piece of data in the second temporary data table in the target database according to the primary key information of each piece of data in the second temporary data table, to obtain an updated target data table; and a generating subunit, used to generate a cost calculation event list and a data synchronization log in the target database according to the updated target data table, and delete the first temporary data table and the second temporary data table.

[0114] Optionally, in the cost calculation device provided in Embodiment 2 of this application, the above-mentioned synchronization subunit includes: a cleaning module, used to clean the data in the first temporary data table in the source database according to the primary key information of each data in the first temporary data table, to obtain a cleaned first temporary data table; a determination module, used to determine the association relationship between the cleaned first temporary data table and the source data table corresponding to the data to be processed through a data synchronization application; and a synchronization module, used to synchronize the source data table corresponding to the data to be processed in the source database to the second temporary data table in the target database according to the association relationship.

[0115] Optionally, in the cost calculation device provided in Embodiment 2 of this application, the first synchronization unit 802 further includes: a first modification subunit, used to modify the target attribute of the preset data table in the target database to a first preset value before writing the data to be processed into the first temporary data table in the source database, wherein the target attribute represents the synchronization status information of the data synchronization process; and a second modification subunit, used to modify the target attribute of the preset data table in the target database to a second preset value after generating a cost calculation event list and a data synchronization log in the target database based on the updated target data table, and deleting the first temporary data table and the second temporary data table.

[0116] Optionally, in the cost calculation apparatus provided in Embodiment 2 of this application, the apparatus further includes: an acquisition unit, configured to acquire the cost file required for cost calculation from the enterprise's preset business system before triggering a cost calculation instruction based on the cost calculation event list, responding to the cost calculation instruction, and generating billing information through the data warehouse; a judgment unit, configured to read the data processing log in the target database and determine whether the data in the cost file has been processed; a second synchronization unit, configured to synchronize the cost file to a third temporary data table in the target database through the data warehouse if the data in the cost file has not been processed; and a second generation unit, configured to generate cost calculation events and update the data processing log based on the third temporary data table in the target database through the data warehouse, and update the cost calculation event list based on the cost calculation events.

[0117] Optionally, in the cost calculation device provided in Embodiment 2 of this application, the second generation unit includes: a second synchronization subunit, used to synchronize billing information and report information to the fourth temporary data table of the target database through a data synchronization application in the data warehouse; and a transfer subunit, used to transfer billing information, report information and basic cost information from the fourth temporary data table to the corresponding data table in the target database according to a preset data query statement, wherein the basic cost information is information generated based on a cost file.

[0118] Optionally, in the cost calculation device provided in Embodiment 2 of this application, the first generation unit 803 includes: a deduplication subunit, used to perform deduplication operation on the cost calculation events contained in the cost calculation event list and update the cost calculation event list to obtain an updated cost calculation event list; and a calculation subunit, used to calculate bill information according to the business processing logic corresponding to each cost calculation event in the updated cost calculation event list, update the bill information to the target database through the data warehouse, and update the processing status of the processed cost calculation events.

[0119] Optionally, in the cost calculation device provided in Embodiment 2 of this application, the first generation unit 803 includes: a second determining subunit, used to determine data preprocessing information, data query statements corresponding to the data to be exported, file naming rules, file writing rules, and file directory rules according to preset outbound configuration parameters; a processing subunit, used to perform data preprocessing on report information according to the data preprocessing information and data query statements to obtain the data to be exported; a writing subunit, used to write the data to be exported into a target file according to the file naming rules and file writing rules; and an export subunit, used to export the target file to a target file directory according to the file directory rules.

[0120] The cost calculation device includes a processor and a memory. The triggering unit 801, the first synchronization unit 802, the first generation unit 803, and the determination unit 804 mentioned above are all stored in the memory as program units. The processor executes the program units stored in the memory to realize the corresponding functions.

[0121] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and adjusting kernel parameters can improve the efficiency of enterprise cost calculation.

[0122] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0123] Embodiment 3 of the present invention provides a computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements a cost calculation method.

[0124] Embodiment 4 of the present invention provides a processor for running a program, wherein the program executes a cost calculation method during runtime.

[0125] Figure 9 This is a schematic diagram of a cost calculation electronic device according to Embodiment 5 of this application. Figure 9 As shown, Embodiment 5 of the present invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs the following steps: triggering a data synchronization instruction at a preset time; wherein the preset time includes at least: a first preset time of each month and a second preset time of each day; responding to the data synchronization instruction, synchronizing the data to be processed required for cost calculation in the target business system between the source database and the target database through a data warehouse, generating a cost calculation event list, wherein the target business system refers to the business system in the enterprise used to calculate accounting information; triggering a cost calculation instruction based on the cost calculation event list, responding to the cost calculation instruction, generating billing information through the data warehouse, and triggering a report calculation instruction; responding to the report calculation instruction, generating and exporting report information through the data warehouse; synchronizing the report information and billing information to the target database through the data warehouse, so as to determine the cost calculation result based on the report information and billing information.

[0126] When the processor executes the program, it also performs the following steps: Synchronizing the data to be processed required for cost calculation in the target business system between the source database and the target database through a data warehouse, generating a cost calculation event list, including: determining the data to be processed based on the business system corresponding to the source database, and writing the data to be processed into a first temporary data table in the source database; synchronizing the first temporary data table in the source database to a second temporary data table in the target database through a data synchronization application; updating the target data table corresponding to each data entry in the second temporary data table in the target database based on the primary key information of each data entry in the second temporary data table, obtaining an updated target data table; generating a cost calculation event list and a data synchronization log in the target database based on the updated target data table, and deleting the first and second temporary data tables.

[0127] When the processor executes the program, it also performs the following steps: synchronizing a first temporary data table in the source database to a second temporary data table in the target database through a data synchronization application, including: cleaning the data in the first temporary data table in the source database based on the primary key information of each piece of data in the first temporary data table to obtain a cleaned first temporary data table; determining the association between the cleaned first temporary data table and the source data table corresponding to the data to be processed through a data synchronization application; and synchronizing the source data table corresponding to the data to be processed in the source database to the second temporary data table in the target database based on the association.

[0128] When the processor executes the program, it also performs the following steps: before writing the data to be processed into the first temporary data table in the source database, it modifies the target attribute of the preset data table in the target database to the first preset value, wherein the target attribute represents the synchronization status information of the data synchronization process; after generating a billing event list and generating a data synchronization log in the target database based on the updated target data table, and deleting the first temporary data table and the second temporary data table, it modifies the target attribute of the preset data table in the target database to the second preset value.

[0129] The processor also performs the following steps when executing the program: Before triggering a cost calculation instruction based on the cost calculation event list, responding to the cost calculation instruction, and generating billing information through the data warehouse, the above method further includes: obtaining the cost file required for cost calculation from the enterprise's preset business system, wherein the preset business system refers to the business system in the enterprise that needs to calculate accounting information; reading the data processing log in the target database to determine whether the data in the cost file has been processed; if the data in the cost file has not been processed, synchronizing the cost file to the third temporary data table in the target database through the data warehouse; generating cost calculation events and updating the data processing log based on the third temporary data table in the target database through the data warehouse, and updating the cost calculation event list based on the cost calculation events.

[0130] When the processor executes the program, it also performs the following steps: synchronizing report information and billing information to the target database through the data warehouse, including: synchronizing the billing information and report information to the fourth temporary data table of the target database through a data synchronization application in the data warehouse; and transferring the billing information, report information, and basic cost information from the fourth temporary data table to the corresponding data table in the target database according to a preset data query statement, wherein the basic cost information is information generated based on the cost file.

[0131] When the processor executes the program, it also performs the following steps: generating billing information through the data warehouse, including: performing deduplication on the billing events included in the billing event list and updating the billing event list to obtain an updated billing event list; calculating billing information according to the business processing logic corresponding to each billing event in the updated billing event list, updating the billing information to the target database through the data warehouse, and updating the processing status of the processed billing events.

[0132] When the processor executes the program, it also performs the following steps: generating and exporting report information from the data warehouse, including: determining data preprocessing information, data query statements corresponding to the data to be exported, file naming rules, file writing rules, and file directory rules based on preset outbound configuration parameters; performing data preprocessing on the report information based on the data preprocessing information and data query statements to obtain the data to be exported; writing the data to be exported into the target file according to the file naming rules and file writing rules; and exporting the target file to the target file directory according to the file directory rules.

[0133] The devices mentioned in this article can be servers, PCs, tablets, mobile phones, etc.

[0134] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program with the following method steps: triggering a data synchronization instruction at a preset time; wherein the preset time includes at least: a first preset time of each month and a second preset time of each day; responding to the data synchronization instruction, synchronizing the data to be processed required for cost calculation in the target business system between the source database and the target database through a data warehouse, generating a cost calculation event list, wherein the target business system refers to the business system in the enterprise used to calculate accounting information; triggering a cost calculation instruction based on the cost calculation event list, responding to the cost calculation instruction, generating billing information through the data warehouse, and triggering a report calculation instruction; responding to the report calculation instruction, generating and exporting report information through the data warehouse; synchronizing the report information and billing information to the target database through the data warehouse, so as to determine the cost calculation result based on the report information and billing information.

[0135] When executed on a data processing device, it is also suitable to execute an initialization program with the following steps: Synchronizing the data to be processed required for cost calculation in the target business system between the source database and the target database through a data warehouse, generating a cost calculation event list, including: determining the data to be processed based on the business system corresponding to the source database, and writing the data to be processed into a first temporary data table in the source database; synchronizing the first temporary data table in the source database to a second temporary data table in the target database through a data synchronization application; updating the target data table corresponding to each data entry in the second temporary data table in the target database based on the primary key information of each data entry in the second temporary data table, obtaining an updated target data table; generating a cost calculation event list and a data synchronization log in the target database based on the updated target data table, and deleting the first and second temporary data tables.

[0136] When executed on a data processing device, it is also suitable to execute an initialization program with the following steps: synchronizing a first temporary data table in the source database to a second temporary data table in the target database through a data synchronization application, including: cleaning the data in the first temporary data table in the source database based on the primary key information of each piece of data in the first temporary data table to obtain a cleaned first temporary data table; determining the association between the cleaned first temporary data table and the source data table corresponding to the data to be processed through a data synchronization application; and synchronizing the source data table corresponding to the data to be processed in the source database to the second temporary data table in the target database based on the association.

[0137] When executed on a data processing device, it is also suitable to execute an initialization program with the following steps: before writing the data to be processed into the first temporary data table in the source database, modify the target attribute of the preset data table in the target database to a first preset value, wherein the target attribute represents the synchronization status information of the data synchronization process; after generating a billing event list and generating a data synchronization log in the target database based on the updated target data table, and deleting the first temporary data table and the second temporary data table, modify the target attribute of the preset data table in the target database to a second preset value.

[0138] When executed on a data processing device, it is also suitable to execute an initialization procedure with the following steps: before triggering a cost calculation instruction based on the cost calculation event list, responding to the cost calculation instruction, and generating billing information through the data warehouse, the above method further includes: obtaining the cost file required for cost calculation from the enterprise's preset business system, wherein the preset business system refers to the business system in the enterprise that needs to calculate accounting information; reading the data processing log in the target database to determine whether the data in the cost file has been processed; if the data in the cost file has not been processed, synchronizing the cost file to the third temporary data table of the target database through the data warehouse; generating cost calculation events and updating the data processing log based on the third temporary data table of the target database through the data warehouse, and updating the cost calculation event list based on the cost calculation events.

[0139] When executed on a data processing device, it is also suitable to execute an initialization program with the following steps: synchronizing report information and billing information to the target database through a data warehouse, including: synchronizing billing information and report information to a fourth temporary data table in the target database through a data synchronization application in the data warehouse; transferring billing information, report information, and basic cost information from the fourth temporary data table to the corresponding data table in the target database according to a preset data query statement, wherein the basic cost information is information generated based on a cost file.

[0140] When executed on a data processing device, it is also suitable to execute an initialization program with the following steps: generating billing information through a data warehouse, including: performing deduplication on the billing events contained in the billing event list and updating the billing event list to obtain an updated billing event list; calculating billing information according to the business processing logic corresponding to each billing event in the updated billing event list; updating the billing information to the target database through the data warehouse; and updating the processing status of the processed billing events.

[0141] When executed on a data processing device, it is also suitable to execute an initialization program with the following steps: generating and exporting report information from the data warehouse, including: determining data preprocessing information, data query statements corresponding to the data to be exported, file naming rules, file writing rules, and file directory rules based on preset outbound configuration parameters; performing data preprocessing on the report information based on the data preprocessing information and data query statements to obtain the data to be exported; writing the data to be exported into the target file according to the file naming rules and file writing rules; and exporting the target file to the target file directory according to the file directory rules.

[0142] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0143] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0144] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0145] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0146] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0147] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0148] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0149] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0150] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0151] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A method for calculating costs, characterized in that, include: A data synchronization command is triggered at a preset time; wherein, the preset time includes at least: a first preset time of each month and a second preset time of each day; In response to the data synchronization command, the pending data required for cost calculation in the target business system is synchronized between the source database and the target database through the data warehouse, and a list of cost calculation events is generated. The target business system refers to the business system in the enterprise used to calculate accounting information. Based on the list of billing events, a fee calculation instruction is triggered; in response to the fee calculation instruction, billing information is generated through the data warehouse, and a report calculation instruction is triggered; in response to the report calculation instruction, report information is generated and exported from the data warehouse. The report information and the billing information are synchronized from the data warehouse to the target database to determine the cost calculation results based on the report information and the billing information. Specifically, the process involves synchronizing the data to be processed for cost calculation in the target business system between the source and target databases using a data warehouse, generating a list of cost calculation events, including: The data to be processed is determined based on the business system corresponding to the source database, and the data to be processed is written into the first temporary data table in the source database; The first temporary data table in the source database is synchronized to the second temporary data table in the target database through a data synchronization application. Based on the primary key information of each piece of data in the second temporary data table, update the target data table corresponding to each piece of data in the second temporary data table in the target database to obtain the updated target data table; Based on the updated target data table, the billing event list and data synchronization log are generated in the target database, and the first temporary data table and the second temporary data table are deleted.

2. The method according to claim 1, characterized in that, The data synchronization application synchronizes the first temporary data table in the source database to the second temporary data table in the target database, including: In the source database, the data in the first temporary data table is cleaned according to the primary key information of each data in the first temporary data table to obtain the cleaned first temporary data table. The association between the first temporary data table after cleaning and the source data table corresponding to the data to be processed is determined by data synchronization application. Based on the aforementioned relationship, the source data table corresponding to the data to be processed in the source database is synchronized to the second temporary data table in the target database.

3. The method according to claim 1, characterized in that, The method further includes: Before writing the data to be processed into the first temporary data table in the source database, the target attribute of the preset data table in the target database is modified to a first preset value, wherein the target attribute represents the synchronization status information of the data synchronization process; After generating the billing event and data synchronization log in the target database based on the updated target data table, and deleting the first temporary data table and the second temporary data table, the target attribute of the preset data table in the target database is modified to the second preset value.

4. The method according to claim 1, characterized in that, Before triggering a fee calculation instruction based on the fee calculation event list, responding to the fee calculation instruction, and generating billing information through the data warehouse, the process includes: Obtain the expense files required for expense calculation from the enterprise's pre-set business system, wherein the pre-set business system refers to the business system in the enterprise that needs to calculate accounting information; Read the data processing log in the target database to determine whether the data in the expense file has been processed; If the data in the expense file is not processed, the expense file is synchronized to the third temporary data table of the target database through the data warehouse; The data warehouse generates cost calculation events based on the third temporary data table of the target database and updates the data processing log, and updates the cost calculation event list according to the cost calculation events.

5. The method according to claim 4, characterized in that, Synchronizing the report information and the billing information from the data warehouse to the target database includes: In the data warehouse, the billing information and the report information are synchronized to the fourth temporary data table of the target database through a data synchronization application; The billing information, report information, and basic cost information are transferred from the fourth temporary data table to the corresponding data table in the target database according to the preset data query statement, wherein the basic cost information is generated based on the cost file.

6. The method according to claim 1, characterized in that, Generating billing information through the data warehouse includes: The billing event list is deduplicated, and the billing event list is updated to obtain the updated billing event list. The billing information is calculated according to the business processing logic corresponding to each billing event in the updated billing event list. The billing information is then updated to the target database through the data warehouse, and the processing status of the processed billing events is updated.

7. The method according to claim 1, characterized in that, Generate and export report information from the data warehouse, including: Based on the preset outbound configuration parameters, determine the data preprocessing information, the data query statement corresponding to the data to be exported, the file naming rules, the file writing rules, and the file directory rules; Based on the data preprocessing information and the data query statement, the report information is preprocessed to obtain the data to be exported; Write the data to be exported into the target file according to the file naming rules and the file writing rules; Export the target file to the target file directory according to the file directory rules.

8. A cost calculation device, characterized in that, include: A triggering unit is used to trigger a data synchronization command at a preset time; wherein the preset time includes at least: a first preset time of each month and a second preset time of each day; The first synchronization unit is used to respond to the data synchronization instruction, and synchronize the data to be processed required for cost calculation in the target business system between the source database and the target database through the data warehouse, and generate a list of cost calculation events. The target business system refers to the business system in the enterprise used to calculate accounting information. The first generation unit is configured to trigger a cost calculation instruction based on the cost calculation event list, respond to the cost calculation instruction, generate billing information through the data warehouse, and trigger a report calculation instruction; respond to the report calculation instruction, generate and export report information through the data warehouse; The determining unit is used to synchronize the report information and the billing information to the target database through the data warehouse, so as to determine the cost calculation result based on the report information and the billing information; The first synchronization unit includes: a first determining subunit, configured to determine the data to be processed based on the business system corresponding to the source database, and write the data to be processed into a first temporary data table in the source database; a first synchronization subunit, configured to synchronize the first temporary data table in the source database to a second temporary data table in the target database through a data synchronization application; an updating subunit, configured to update the target data table corresponding to each piece of data in the second temporary data table in the target database based on the primary key information of each piece of data in the second temporary data table, to obtain an updated target data table; and a generating subunit, configured to generate the billing event list and generate a data synchronization log in the target database based on the updated target data table, and delete the first temporary data table and the second temporary data table.

9. An electronic device, characterized in that, It includes one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the cost calculation method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Automatic reconciliation method of transaction data, server and storage medium

    CN107729398A

  • Report data exporting method and device

    CN117149882A