Interface data storage method based on JSON configuration and product
Through the interface data storage method based on JSON configuration, the customization and repeated development problems in traditional interface data interaction methods are solved, the visibility and flexible configuration of data correspondence relationships are realized, and the efficiency and accuracy of interface data storage are improved.
Patent Information
- Application Number
- CN202411714034.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-14
AI Technical Summary
Traditional interface data interaction methods have problems such as customization, repeated development and invisible correspondence, which is difficult to meet the needs of modern judicial work.
The interface data storage method based on JSON configuration is adopted to define the correspondence between the original data and the database tables and fields through the JSON file, and supports the configuration of public rules, user-defined rules, pre-entry logic and post-entry logic.
It realizes the visibility and flexible configuration of data correspondence, reduces duplicate development and customization, and improves the efficiency and accuracy of interface data storage.
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data transmission and storage, and in particular to a method and product for storing interface data based on JSON configuration. Background Art
[0002] With the rapid development of society and the deepening of the rule of law, daily work is faced with an increasing number of files and complex and diverse system interactions. Traditional interface data interaction methods often have problems such as customization, repeated development, and invisible corresponding relationships, which are difficult to meet the needs of modern judicial work. Therefore, how to use modern information technology to improve the efficiency and accuracy of interface data interaction has become an urgent problem to be solved in daily office work. Summary of the invention
[0003] In response to the above problems, the interface data storage method based on JSON configuration came into being in this context. This method aims to store interface data in one go through JSON configuration and perform logical processing before and after storage. The emergence of this method not only standardizes the storage of interface data, but also enables the reuse of rule components to quickly complete interface docking.
[0004] The present invention provides an interface data storage method based on JSON configuration, comprising the following steps:
[0005] S1: Read the original data to be stored and the corresponding JSON file. The JSON file contains the correspondence between the original data and the database table and field. If the original data needs to be processed, it also includes the name of the corresponding processing rule to be called;
[0006] S2: If the JSON file includes a processing rule to be called, call the content of the processing rule to be called according to the name of the processing rule to be called in the JSON file, process the corresponding original data to obtain processed data, and then write the processed data into the database according to the JSON file;
[0007] If the JSON file does not include the processing rule to be called, the original data is directly written into the database according to the JSON file.
[0008] Furthermore, the processing rules that need to be called include at least one of common rules, user-defined rules, pre-warehousing logic, and post-warehousing logic.
[0009] Furthermore, the content of the common rules includes at least one of generating a unique primary key, comparing sizes, and date formatting.
[0010] Furthermore, the content of the custom rules is preset according to the needs of the user.
[0011] Furthermore, the content of the pre-warehousing logic includes operations that need to be performed before data is stored in the warehouse.
[0012] Furthermore, the content of the post-warehousing logic includes the operations that need to be performed after the data is stored in the warehouse.
[0013] The present invention also provides a computer program product, comprising a computer program, which implements the above method when executed by a processor.
[0014] Beneficial effects: The data correspondence is visible and can be flexibly configured. Extract common rule components, reduce repeated development of customized personalized rules and pre- and post-warehousing processing logic, and perform personalized processing. This interface data warehousing method corresponds to the relationship between interface data and database tables and fields through configuration, which is clear and can be flexibly configured according to business needs, while also reducing the amount of code. DETAILED DESCRIPTION
[0015] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention are clearly and completely described below. Obviously, the embodiments described below are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0016] A method for storing interface data based on JSON configuration, comprising the following steps:
[0017] S1: Read the original data to be stored and the corresponding JSON file. The JSON file contains the correspondence between the original data and the database table and field. If the original data needs to be processed, it also includes the name of the corresponding processing rule to be called;
[0018] S2: If the JSON file includes a processing rule to be called, call the content of the processing rule to be called according to the name of the processing rule to be called in the JSON file, process the corresponding original data to obtain processed data, and then write the processed data into the database according to the JSON file;
[0019] If the JSON file does not include the processing rule to be called, the original data is directly written into the database according to the JSON file.
[0020] The processing rules that need to be called include at least one of common rules, user-defined rules, pre-warehousing logic, and post-warehousing logic;
[0021] The content of public rules includes generating unique primary keys, comparing sizes, date formatting, etc.
[0022] The content of custom rules is preset according to user needs;
[0023] The content of pre-warehousing logic includes the operations that need to be performed before data is stored, such as verification, processing, and preparation;
[0024] The content of post-warehousing logic includes the operations that need to be performed after the data is stored in the warehouse.
[0025] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for storing interface data based on JSON configuration, characterized in that: The following steps are involved: S1: Read the original data to be stored and the corresponding JSON file. The JSON file contains the correspondence between the original data and the database table and field. If the original data needs to be processed, it also includes the name of the corresponding processing rule to be called; S2: If the JSON file includes a processing rule to be called, call the content of the processing rule to be called according to the name of the processing rule to be called in the JSON file, process the corresponding original data to obtain processed data, and then write the processed data into the database according to the JSON file; If the JSON file does not include the processing rule to be called, the original data is directly written into the database according to the JSON file.
2. According to the method for storing interface data based on JSON configuration in claim 1, it is characterized in that: The processing rules that need to be called include at least one of common rules, user-defined rules, pre-warehousing logic, and post-warehousing logic.
3. According to the method for storing interface data based on JSON configuration in claim 2, it is characterized in that: The content of the common rule includes at least one of generating a unique primary key, comparing sizes, and formatting dates.
4. According to the method of JSON-based interface data storage according to claim 2, it is characterized in that: The content of custom rules is preset according to user needs.
5. The method for storing interface data based on JSON configuration according to claim 2, characterized in that: The content of pre-warehousing logic includes the operations that need to be performed before data is stored in the warehouse.
6. The method for storing interface data based on JSON configuration according to claim 2, characterized in that: The content of post-warehousing logic includes the operations that need to be performed after the data is stored in the warehouse.
7. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.