Data exporting method and device, equipment and storage medium
By automatically obtaining and processing user demand information and query instructions, the template configuration and push processing of data export is realized, which solves the problem of low data export efficiency in the existing technology, improves the flexibility and accuracy of data export, and improves the user experience .
Patent Information
- Application Number
- CN202411213175.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2025-01-10
AI Technical Summary
The existing technology is difficult to meet the needs of data export in complex business scenarios, especially in multiple personnel push scenarios. Manual download and individual configuration of data push methods are inefficient and difficult to automatically process and distribute.
By obtaining user demand information and query instructions, template configuration and push configuration are performed, SQL file data is automatically converted into EXCEL file data, and encryption and push processing are performed according to the push configuration, realizing automatic data export and distribution.
It improves the efficiency and flexibility of data export, reduces the complexity of manual operations and the probability of errors, realizes the rapid and accurate data transmission, reduces the complexity of user operations, and improves user experience and satisfaction.
Smart Images

Figure CN119293108A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information processing technology, and in particular to a data export method, device, equipment and storage medium. Background Art
[0002] Currently, after querying a report, data is usually exported by manual downloading, or the query data is pushed to the corresponding personnel by configuring the data separately. However, these two data export methods are difficult to meet complex business scenarios (such as scenarios where multiple personnel need to be pushed).
[0003] It can be seen that the existing technology still needs to be improved and enhanced. Summary of the invention
[0004] In order to overcome the shortcomings of the prior art, the purpose of the present invention is to provide a data export method, device, equipment and storage medium, which can automatically extract, process and distribute data, improve the efficiency of data export, and the entire process does not require manual intervention by the user, is easy to operate, and reduces the influence of human factors.
[0005] A first aspect of the present invention provides a data export method, comprising: obtaining user demand information, and performing template configuration and push configuration according to the user demand information to obtain template configuration data and push configuration data; obtaining user query instructions, and obtaining corresponding SQL file data according to the user query instructions; performing file conversion on the SQL file data according to the template configuration data to obtain EXCEL file data; generating push information according to the EXCEL file data, and performing push processing on the push information according to the push configuration data.
[0006] Optionally, in a first implementation method of the first aspect of the present invention, the obtaining of user demand information and performing template configuration and push configuration according to the user demand information to obtain template configuration data and push configuration data includes: obtaining user demand information and extracting template demand information and push demand information from the user demand information; configuring the page style and functional functions of the initial sheet page according to the template demand information to obtain template configuration data; configuring the push frequency and push personnel information for the initial push task according to the push demand information to obtain push configuration data.
[0007] Optionally, in a second implementation method of the first aspect of the present invention, obtaining user query instructions and obtaining corresponding SQL file data according to the user query instructions includes: obtaining user query instructions, and obtaining SQL query statements and API interface addresses from the user query instructions; using the requests library to call the server corresponding to the API interface address, obtaining the connection string of the server through the pycryptodome module, and establishing an encrypted transmission channel based on sqlite3 and the connection string; locating the corresponding file location from the server through the SQL query statement and the encrypted transmission channel, and extracting the SQL file data.
[0008] Optionally, in a third implementation of the first aspect of the present invention, the file conversion of the SQL file data according to the template configuration data to obtain EXCEL file data includes: extracting data elements from the SQL file data, and integrating and formatting the data elements to obtain preprocessed data; extracting SQL insert elements from the preprocessed data, and inserting the SQL insert elements into a preset EXCEL template file according to the template configuration data to form an EXCEL insert file; and rendering the EXCEL insert file to obtain EXCEL file data.
[0009] Optionally, in a fourth implementation method of the first aspect of the present invention, the SQL insert element is extracted from the pre-processed data, and the SQL insert element is inserted into a preset EXCEL template file according to the template configuration data to form an EXCEL insert file, including: extracting merge logic rules from the template configuration data, and generating vertical merge logic and horizontal merge logic based on the merge logic rules; writing the SQL insert element into the preset EXCEL template file based on the openpyxl library to obtain an initial EXCEL file; and merging the initial EXCEL file based on the vertical merge logic and the horizontal merge logic to obtain an EXCEL insert file.
[0010] Optionally, in a fifth implementation of the first aspect of the present invention, the file rendering of the EXCEL inserted file to obtain EXCEL file data includes: determining the position of the total row from the EXCEL inserted file, and configuring the background of the total row; comparing the data values in the EXCEL inserted file after the background configuration, and color marking the data values that meet a preset sequence; performing border correction on the color-marked EXCEL inserted file to obtain an EXCEL corrected file; extracting similar data values from the EXCEL inserted file, and generating chart data based on the similar data values; and automatically typeset the EXCEL corrected file and the chart data to obtain the EXCEL file data.
[0011] Optionally, in a sixth implementation method of the first aspect of the present invention, the push information is generated according to the EXCEL file data, and the push information is pushed according to the push configuration data, including: obtaining corresponding timestamp information according to the user query instruction, and generating push name information according to the timestamp information; converting the format of the EXCEL file data into a picture format through the PIL image processing library, and superimposing preset watermark information on the EXCEL file data in the picture format to obtain the transmission content information; modifying the name of the transmission content information according to the push name information to obtain an uploaded file; encrypting the uploaded file through an encryption algorithm, storing the encrypted uploaded file in a preset storage end using the HTTP POST interface, and obtaining a download link fed back by the preset storage end; generating push information according to the download link and the preset push template; obtaining the API interface address of the relevant personnel according to the push configuration data, and performing push processing according to the push information and each API interface address.
[0012] The second aspect of the present invention provides a data export device, including: a configuration module, used to obtain user demand information, and perform template configuration and push configuration according to the user demand information to obtain template configuration data and push configuration data; a query module, used to obtain user query instructions, and obtain corresponding SQL file data according to the user query instructions; a conversion module, used to perform file conversion on SQL file data according to the template configuration data to obtain EXCEL file data; a push module, used to generate push information according to the EXCEL file data, and push the push information according to the push configuration data.
[0013] Optionally, in a first implementation method of the second aspect of the present invention, the configuration module includes: an extraction unit, used to obtain user demand information, and extract template demand information and push demand information from the user demand information; a first configuration unit, used to configure the page style and function of the initial sheet page according to the template demand information to obtain template configuration data; a second configuration unit, used to configure the push frequency and push personnel information of the initial push task according to the push demand information to obtain push configuration data.
[0014] Optionally, in a second implementation method of the second aspect of the present invention, the query module includes: an acquisition unit, used to obtain user query instructions, and obtain SQL query statements and API interface addresses from the user query instructions; an encryption unit, used to use the requests library to call the server corresponding to the API interface address, obtain the connection string of the server through the pycryptodome module, and establish an encrypted transmission channel based on sqlite3 and the connection string; a positioning unit, used to locate the corresponding file location from the server through the SQL query statement and the encrypted transmission channel, and extract the SQL file data.
[0015] Optionally, in a third implementation of the second aspect of the present invention, the conversion module includes: a preprocessing unit, used to extract data elements from SQL file data, and integrate and format the data elements to obtain preprocessed data; an element unit, used to extract SQL insert elements from the preprocessed data, and insert the SQL insert elements into a preset EXCEL template file according to template configuration data to form an EXCEL insert file; and a rendering unit, used to render the EXCEL insert file to obtain EXCEL file data.
[0016] Optionally, in a fourth implementation of the second aspect of the present invention, the element unit includes: a logic part, used to extract merge logic rules from the template configuration data, and generate vertical merge logic and horizontal merge logic based on the merge logic rules; a writing part, used to write the SQL insert element into a preset EXCEL template file based on the openpyxl library to obtain an initial EXCEL file; a merging part, used to merge the initial EXCEL file based on the vertical merge logic and the horizontal merge logic to obtain an EXCEL insert file.
[0017] Optionally, in a fifth implementation of the second aspect of the present invention, the rendering unit includes: a background part, used to determine the position of the total row from the EXCEL insert file and configure the background of the total row; a comparison part, used to compare the data values in the EXCEL insert file after the background configuration, and color-mark the data values that meet the preset sequence; a correction part, used to correct the border of the color-marked EXCEL insert file to obtain an EXCEL corrected file; an icon part, used to extract similar data values from the EXCEL insert file and generate chart data based on the similar data values; a typesetting part, used to automatically typeset the EXCEL corrected file and chart data to obtain EXCEL file data.
[0018] Optionally, in a sixth implementation method of the second aspect of the present invention, the push module includes: a name unit, used to obtain corresponding timestamp information according to a user query instruction, and generate push name information according to the timestamp information; a picture unit, used to convert the format of the EXCEL file data into a picture format through the PIL image processing library, and superimpose preset watermark information on the EXCEL file data in the picture format to obtain the transmission content information; a modification unit, used to modify the name of the transmission content information according to the push name information to obtain an uploaded file; an upload unit, used to encrypt the uploaded file through an encryption algorithm, store the encrypted uploaded file to a preset storage end using an HTTP POST interface, and obtain a download link fed back by the preset storage end; a generation unit, used to generate push information according to the download link and a preset push template; a push unit, used to obtain the API interface address of the relevant personnel according to the push configuration data, and perform push processing according to the push information and each API interface address.
[0019] The third aspect of the present invention provides a data export device, which includes: a memory and at least one processor, wherein instructions are stored in the memory; at least one of the processors calls the instructions in the memory so that the data export device executes each step of the data export method described in any one of the above items.
[0020] A fourth aspect of the present invention provides a computer-readable storage medium having instructions stored thereon, and the instructions, when executed by a processor, implement the various steps of any of the above-mentioned data export methods.
[0021] In the technical solution of the present invention, by obtaining user demand information and performing template configuration and push configuration, data can be processed in a customized manner according to different user needs, diverse data export needs can be met, and the flexibility and efficiency of data processing can be improved; by automatically obtaining user query instructions and corresponding SQL file data, and then converting the SQL file data according to the template configuration data to generate EXCEL file data, the complexity and error probability of manual data conversion are reduced, and the data conversion process is simplified; push information is generated according to the EXCEL file data, and push processing is performed according to the push configuration data, so that data can be quickly and accurately transmitted to the target recipient, improving work efficiency and realizing the automation of data push; the entire data export process has a high degree of automation, and the user only needs to provide demand information and query instructions to obtain the required data files and push services, which greatly reduces the complexity of user operations, improves user satisfaction, and enhances user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1A first flow chart of a data export method provided by an embodiment of the present invention;
[0023] Figure 2 A second flow chart of the data export method provided by an embodiment of the present invention;
[0024] Figure 3 A third flow chart of the data export method provided by an embodiment of the present invention;
[0025] Figure 4 A fourth flow chart of the data export method provided by an embodiment of the present invention;
[0026] Figure 5 A fifth flow chart of the data export method provided by an embodiment of the present invention;
[0027] Figure 6 A sixth flow chart of the data export method provided by an embodiment of the present invention;
[0028] Figure 7 A seventh flow chart of the data export method provided by an embodiment of the present invention;
[0029] Figure 8 A schematic diagram of the structure of a data export device provided by an embodiment of the present invention;
[0030] Fig. 9 Another structural schematic diagram of a data export device provided by an embodiment of the present invention;
[0031] Fig.10 A schematic diagram of the structure of a data export device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0032] The present invention provides a data export method, device, equipment and storage medium.
[0033] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0034] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , an embodiment of the data export method in the embodiment of the present invention includes:
[0035] 101. Obtain user demand information, and perform template configuration and push configuration according to the user demand information to obtain template configuration data and push configuration data;
[0036] In this embodiment, respective template configurations and push configurations are determined in advance according to user demand information of different users, and data can be processed in a customized manner according to different user needs, meeting diverse data export requirements, thereby improving the flexibility and efficiency of data processing.
[0037] 102. Obtain a user query instruction, and obtain corresponding SQL file data according to the user query instruction;
[0038] 103. Perform file conversion on the SQL file data according to the template configuration data to obtain the EXCEL file data;
[0039] 104. Generate push information according to the EXCEL file data, and perform push processing on the push information according to the push configuration data.
[0040] In this embodiment, relevant information of the query keywords is obtained according to the user's query instructions. In this way, the user's required content (i.e., SQL file data) can be found quickly and accurately. After the target SQL file data is obtained, the SQL file data format is converted autonomously, which reduces the complexity and error probability of manual data conversion and simplifies the data conversion process. Finally, the converted EXCEL file data is autonomously transmitted to the target recipient according to the push configuration data to improve the efficiency of data export and achieve accurate and fast data push.
[0041] In the embodiment of the present invention, by obtaining user demand information and performing template configuration and push configuration, data can be processed in a customized manner according to different user needs, diverse data export needs can be met, and the flexibility and efficiency of data processing can be improved; by automatically obtaining user query instructions and corresponding SQL file data, and then converting the SQL file data according to the template configuration data to generate EXCEL file data, the complexity and error probability of manual data conversion are reduced, and the data conversion process is simplified; push information is generated according to the EXCEL file data, and push processing is performed according to the push configuration data, so that data can be quickly and accurately delivered to the target recipient, improving work efficiency and realizing the automation of data push; the entire data export process has a high degree of automation, and the user only needs to provide demand information and query instructions to obtain the required data files and push services, which greatly reduces the complexity of user operations, improves user satisfaction, and enhances user experience.
[0042] See also Figure 2 , a second embodiment of the data export method in the embodiment of the present invention includes:
[0043] 201. Obtain user demand information, and extract template demand information and push demand information from the user demand information;
[0044] 202. Configure the page style and function of the initial sheet page according to the template requirement information to obtain the template configuration data;
[0045] 203. Configure the push frequency and push personnel information for the initial push task according to the push demand information to obtain push configuration data.
[0046] In this embodiment, obtaining user demand information and extracting template demand information and push demand information helps to ensure that the developed templates and push tasks can accurately meet the actual needs of users, improve work efficiency and user satisfaction; configuring the page style and functional functions of the initial sheet page according to the template demand information can create a template that is both beautiful and practical according to the user's needs to meet the usage needs of different users; configuring the push frequency and push personnel information according to the push demand information helps to ensure that the information can be conveyed to relevant personnel in a timely and accurate manner, and improve communication efficiency and decision-making speed.
[0047] See also Figure 3 , a third embodiment of the data export method in the embodiment of the present invention includes:
[0048] 301. Obtain a user query instruction, and obtain an SQL query statement and an API interface address from the user query instruction;
[0049] 302. Use the requests library to call the server corresponding to the API interface address, obtain the server connection string through the pycryptodome module, and establish an encrypted transmission channel based on sqlite3 and the connection string;
[0050] 303. Use the SQL query statement and the encrypted transmission channel to locate the corresponding file location from the server, and extract the SQL file data.
[0051] In this embodiment, by using the pycryptodome module to establish an encrypted transmission channel, the security of data during transmission is ensured, data is prevented from being intercepted or tampered with, and data security is improved; using an encrypted channel for data transmission can effectively protect the privacy of user query instructions and SQL file data, avoid sensitive information leakage, and ensure the privacy of communication; by directly locating the file location of the server and extracting SQL file data, the user's query request can be quickly responded to, the overall work efficiency can be improved, and the query efficiency can be improved; using the requests library to call the API interface, it can stably communicate with the server, ensuring the reliability of the entire query process. The process of automatically processing query instructions and establishing encrypted channels reduces the complexity of manual operations and reduces the possibility of errors.
[0052] See also Figure 4 , a fourth embodiment of the data export method in the embodiment of the present invention includes:
[0053] 401. Extracting data elements from the SQL file data, and integrating and formatting the data elements to obtain preprocessed data;
[0054] 402. Extracting SQL insert elements from the preprocessed data, and inserting the SQL insert elements into a preset EXCEL template file according to the template configuration data to form an EXCEL insert file;
[0055] 403. Render the EXCEL inserted file to obtain the EXCEL file data.
[0056] In this embodiment, by automatically extracting data elements from the SQL file and integrating and formatting them, pre-processed data can be quickly obtained, the time and labor intensity of manual data processing can be reduced, data consistency can be ensured, and data processing efficiency can be improved. The automated processing flow can reduce human errors, ensure the accurate extraction and integration of data elements, and thus improve the accuracy of the final EXCEL file data; through template configuration data, SQL insert elements can be customized according to different needs and flexibly inserted into the preset EXCEL template file to meet diverse reporting and analysis needs; file rendering of the EXCEL insert file can quickly generate complete EXCEL file data, speed up report generation, and improve work efficiency; automation of the entire process helps to improve data management, making the data processing process more standardized and systematic, and facilitating subsequent data analysis and decision support.
[0057] See also Figure 5 , a fifth embodiment of the data export method in the embodiment of the present invention includes:
[0058] 501. Extracting a merging logic rule from the template configuration data, and generating a vertical merging logic and a horizontal merging logic based on the merging logic rule;
[0059] 502. Based on the openpyxl library, write the SQL insert element into the preset EXCEL template file to obtain the initial EXCEL file;
[0060] 503. The initial EXCEL file is merged based on the vertical merging logic and the horizontal merging logic to obtain an EXCEL insert file.
[0061] In this embodiment, the openpyxl library is used to read and write the EXCEL template file to write the SQL insert element into the EXCEL template file, and during the writing process, the cells of the EXCEL template file need to be merged according to the merge logic rules, and the cells are merged according to the vertical merge logic (such as the same region), and then further merged based on the horizontal merge logic (such as the same province). This step requires precise control of the merge rules to ensure the clarity of data display.
[0062] See also Figure 6 , a sixth embodiment of the data export method in the embodiment of the present invention includes:
[0063] 601. Determine the position of the total row from the EXCEL insert file, and configure the background of the total row;
[0064] 602. Compare the data values in the EXCEL inserted file after the background configuration, and color-mark the data values that meet the preset sequence;
[0065] 603. Correct the border of the color-marked EXCEL insert file to obtain an EXCEL correction file;
[0066] 604. extracting data values of the same type from the EXCEL insert file, and generating chart data according to the data values of the same type;
[0067] 605. Automatically typeset the EXCEL correction file and chart data to obtain the EXCEL file data.
[0068] In this embodiment, by adding a background of a specific color to a specific total row, using conditional formatting or directly traversing the cells for style setting, it is helpful to quickly identify summary information and improve data processing efficiency; by comparing data values, the top-ranked (such as the top 10) data items are identified, and color tags with strong identification are configured for their applications, which can intuitively distinguish important data and facilitate analysis and decision-making; border correction of the color-marked Excel file helps to improve the visual presentation of the file, enhance readability, and improve professionalism; extracting similar data values from the Excel file and generating chart data (such as pie charts, bar charts, and line charts) based on these data values helps to more intuitively display data trends and patterns, and facilitates understanding and communication; in addition, by automatically formatting the Excel correction file and chart data to obtain Excel file data with a unified format and beautiful appearance, the readability and professionalism of the report can be improved.
[0069] See also Figure 7 The seventh embodiment of the data export method in the embodiment of the present invention includes:
[0070] 701. Obtain corresponding timestamp information according to the user query instruction, and generate push name information according to the timestamp information;
[0071] 702. Convert the format of the EXCEL file data into a picture format through the PIL image processing library, and superimpose preset watermark information on the EXCEL file data in the picture format to obtain transmission content information;
[0072] 703. Modify the name of the transmission content information according to the pushed name information to obtain the uploaded file;
[0073] In this embodiment, automated timestamp information acquisition and push name generation ensure the timeliness and accuracy of information, allowing users to quickly obtain basic information about the transmitted content based on the name, and facilitating file management and identification, thereby improving file organization efficiency. The PIL image processing library is used to convert EXCEL data into image format and add watermarks, thereby enhancing data security and visual presentation effects.
[0074] 704. Encrypt the uploaded file using an encryption algorithm, store the encrypted uploaded file in a preset storage end using an HTTP POST interface, and obtain a download link fed back by the preset storage end;
[0075] 705. Generate push information according to the download link and the preset push template;
[0076] 706. Obtain the API interface addresses of relevant personnel according to the push configuration data, and perform push processing according to the push information and each API interface address.
[0077] In this embodiment, an encryption algorithm is used to encrypt the storage path of the uploaded file to ensure the security of the link; the HTTP POST interface is used to store files and obtain download links, which simplifies the file storage and access process; the API interface address is obtained according to the push configuration data, and push processing is performed to ensure that the information can be delivered to relevant personnel accurately.
[0078] The above describes the data export method in the embodiment of the present invention. The following describes the data export device in the embodiment of the present invention. Figure 8 In one embodiment of the present invention, a data export device includes:
[0079] Configuration module 801, used to obtain user demand information, and perform template configuration and push configuration according to the user demand information to obtain template configuration data and push configuration data;
[0080] The query module 802 is used to obtain the user query instruction and obtain the corresponding SQL file data according to the user query instruction;
[0081] The conversion module 803 is used to convert the SQL file data according to the template configuration data to obtain the EXCEL file data;
[0082] The push module 804 is used to generate push information according to the EXCEL file data, and perform push processing on the push information according to the push configuration data.
[0083] In this embodiment, the configuration module 801 can process data in a customized manner according to different user needs by obtaining user demand information and performing template configuration and push configuration, thereby meeting diverse data export needs and improving the flexibility and efficiency of data processing; the query module 802 automatically obtains user query instructions and obtains corresponding SQL file data, and the conversion module 803 converts the SQL file data according to the template configuration data to generate EXCEL file data, thereby reducing the complexity and error probability of manual data conversion and simplifying the data conversion process; the push module 804 generates push information according to the EXCEL file data, and performs push processing according to the push configuration data, so that the data can be quickly and accurately delivered to the target recipient, thereby improving work efficiency and realizing the automation of data push; the entire data export process has a high degree of automation, and users only need to provide demand information and query instructions to obtain the required data files and push services, which greatly reduces the complexity of user operations, improves user satisfaction, and enhances user experience.
[0084] See also Fig. 9 Another embodiment of the data export device in the embodiment of the present invention includes:
[0085] Configuration module 801, used to obtain user demand information, and perform template configuration and push configuration according to the user demand information to obtain template configuration data and push configuration data;
[0086] The query module 802 is used to obtain the user query instruction and obtain the corresponding SQL file data according to the user query instruction;
[0087] The conversion module 803 is used to convert the SQL file data according to the template configuration data to obtain the EXCEL file data;
[0088] The push module 804 is used to generate push information according to the EXCEL file data, and perform push processing on the push information according to the push configuration data.
[0089] In this embodiment, in the first implementation method of the second aspect of the present invention, the configuration module 801 includes: an extraction unit 8011, used to obtain user demand information, and extract template demand information and push demand information from the user demand information; a first configuration unit 8012, used to configure the page style and function of the initial sheet page according to the template demand information to obtain template configuration data; a second configuration unit 8013, used to configure the push frequency and push personnel information of the initial push task according to the push demand information to obtain push configuration data.
[0090] In this embodiment, in the second implementation method of the second aspect of the present invention, the query module 802 includes: an acquisition unit 8021, used to obtain a user query instruction, and obtain an SQL query statement and an API interface address from the user query instruction; an encryption unit 8022, used to use the requests library to call the server corresponding to the API interface address, obtain the connection string of the server through the pycryptodome module, and establish an encrypted transmission channel based on sqlite3 and the connection string; a positioning unit 8023, used to locate the corresponding file location from the server through the SQL query statement and the encrypted transmission channel, and extract the SQL file data.
[0091] In this embodiment, in the third implementation method of the second aspect of the present invention, the conversion module 803 includes: a preprocessing unit 8031, used to extract data elements from the SQL file data, and integrate and format the data elements to obtain preprocessed data; an element unit 8032, used to extract SQL insert elements from the preprocessed data, and insert the SQL insert elements into a preset EXCEL template file according to the template configuration data to form an EXCEL insert file; a rendering unit 8033, used to render the EXCEL insert file to obtain EXCEL file data.
[0092] In this embodiment, in the fourth implementation method of the second aspect of the present invention, the element unit 8032 includes: a logic unit 80321, which is used to extract merge logic rules from the template configuration data, and generate vertical merge logic and horizontal merge logic based on the merge logic rules; a writing unit 80322, which is used to write the SQL insert element into a preset EXCEL template file based on the openpyxl library to obtain an initial EXCEL file; a merging unit 80323, which is used to merge the initial EXCEL file based on the vertical merge logic and the horizontal merge logic to obtain an EXCEL insert file.
[0093] In this embodiment, in the fifth implementation method of the second aspect of the present invention, the rendering unit 8033 includes: a background unit 80331, which is used to determine the position of the total row from the EXCEL insert file and configure the background of the total row; a comparison unit 80332, which is used to compare the data values in the EXCEL insert file after the background configuration, and color-mark the data values that meet the preset sequence; a correction unit 80333, which is used to correct the border of the color-marked EXCEL insert file to obtain an EXCEL correction file; an icon unit 80334, which is used to extract data values of the same type from the EXCEL insert file, and generate chart data based on the data values of the same type; a typesetting unit 80335, which is used to automatically typeset the EXCEL correction file and chart data to obtain EXCEL file data.
[0094] In this embodiment, in a sixth implementation of the second aspect of the present invention, the push module 804 includes: a name unit 8041, which is used to obtain corresponding timestamp information according to a user query instruction, and generate push name information according to the timestamp information; a picture unit 8042, which is used to convert the format of the EXCEL file data into a picture format through a PIL image processing library, and superimpose preset watermark information on the EXCEL file data in the picture format to obtain transmission content information; a modification unit 8043, which is used to modify the name of the transmission content information according to the push name information to obtain an uploaded file; an upload unit 8044, which is used to encrypt the uploaded file through an encryption algorithm, store the encrypted uploaded file to a preset storage end using an HTTP POST interface, and obtain a download link fed back by the preset storage end; a generation unit 8045, which is used to generate push information according to the download link and a preset push template; a push unit 8046, which is used to obtain the API interface address of the relevant personnel according to the push configuration data, and perform push processing according to the push information and each API interface address.
[0095] above Figure 8 and Fig. 9The data export device in the embodiment of the present invention is described in detail from the perspective of modular functional entities, and the data export device in the embodiment of the present invention is described in detail from the perspective of hardware processing.
[0096] Fig.10 : is a structural diagram of a data export device provided by an embodiment of the present invention. The data export device 900 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 910 (for example, one or more processors) and a memory 920, and one or more storage media 930 (for example, one or more mass storage devices) storing application programs 933 or data 932. Among them, the memory 920 and the storage medium 930 can be short-term storage or permanent storage. The program stored in the storage medium 930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the data export device 900. Furthermore, the processor 910 can be configured to communicate with the storage medium 930, and execute a series of instruction operations in the storage medium 930 on the data export device 900 to implement the steps of the data export method provided in the above-mentioned method embodiments.
[0097] The data export device 900 may also include one or more power supplies 940, one or more wired or wireless network interfaces 950, one or more input and output interfaces 960, and / or one or more operating systems 931, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, etc. It will be appreciated by those skilled in the art that Fig.10 The data export device structure shown does not constitute a limitation on the data export device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0098] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium, and when the instructions are executed on a computer, the computer executes the steps of the data export method.
[0099] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system, device, or unit can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.
[0100] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.
[0101] Finally, it should be noted that the above description is only a preferred example of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A data export method, characterized in that: include: Obtain user demand information, and perform template configuration and push configuration according to the user demand information to obtain template configuration data and push configuration data; Obtain user query instructions, and obtain corresponding SQL file data according to the user query instructions; Convert the SQL file data according to the template configuration data to obtain the EXCEL file data; Generate push information according to the EXCEL file data, and push the push information according to the push configuration data.
2. The data export method according to claim 1, characterized in that: The obtaining of user demand information and performing template configuration and push configuration according to the user demand information to obtain template configuration data and push configuration data includes: Obtain user demand information, and extract template demand information and push demand information from the user demand information; Configure the page style and function of the initial sheet page according to the template requirement information to obtain the template configuration data; According to the push demand information, the push frequency and push personnel information are configured for the initial push task to obtain the push configuration data.
3. The data export method according to claim 1, characterized in that: The obtaining of the user query instruction and obtaining the corresponding SQL file data according to the user query instruction includes: Obtain user query instructions, and obtain SQL query statements and API interface addresses from the user query instructions; Use the requests library to call the server corresponding to the API interface address, obtain the server connection string through the pycryptodome module, and establish an encrypted transmission channel based on sqlite3 and the connection string; Through SQL query statements and encrypted transmission channels, the corresponding file location is located from the server, and the SQL file data is extracted.
4. The data export method according to claim 1, characterized in that: The step of converting the SQL file data according to the template configuration data to obtain the EXCEL file data includes: Extract data elements from SQL file data, and integrate and format the data elements to obtain pre-processed data; Extracting SQL insert elements from the preprocessed data, and inserting the SQL insert elements into a preset EXCEL template file according to the template configuration data to form an EXCEL insert file; Render the EXCEL inserted file to obtain the EXCEL file data.
5. The data export method according to claim 4, characterized in that: The step of extracting the SQL insert element from the preprocessed data and inserting the SQL insert element into a preset EXCEL template file according to the template configuration data to form an EXCEL insert file includes: Extracting the merging logic rules from the template configuration data, and generating the vertical merging logic and the horizontal merging logic based on the merging logic rules; Write SQL insert elements into the preset EXCEL template file based on the openpyxl library to obtain the initial EXCEL file; The initial EXCEL file is merged based on the vertical merging logic and the horizontal merging logic to obtain the EXCEL insert file.
6. The data export method according to claim 4, characterized in that: The step of rendering the EXCEL inserted file to obtain the EXCEL file data includes: Determine the location of the total row from the EXCEL insert file and configure the background of the total row; Compare the data values in the EXCEL insert file after background configuration, and color-mark the data values that meet the preset sequence; Perform border correction on the color-marked EXCEL insert file to obtain an EXCEL correction file; Extract similar data values from the EXCEL insert file and generate chart data based on the similar data values; The EXCEL correction file and chart data are automatically typeset to obtain the EXCEL file data.
7. The data export method according to claim 1, characterized in that: The generating of push information according to the EXCEL file data and performing push processing on the push information according to the push configuration data include: Obtain corresponding timestamp information according to the user query instruction, and generate push name information according to the timestamp information; The format of the EXCEL file data is converted into a picture format through the PIL image processing library, and the preset watermark information is superimposed on the EXCEL file data in the picture format to obtain the transmission content information; Modify the name of the transmission content information according to the pushed name information to obtain the uploaded file; Encrypt the uploaded file using an encryption algorithm, store the encrypted uploaded file in a preset storage end using an HTTP POST interface, and obtain a download link fed back by the preset storage end; Generate push information based on the download link and preset push template; Obtain the API interface address of relevant personnel according to the push configuration data, and perform push processing according to the push information and each API interface address.
8. A data export device, characterized in that: include: The configuration module is used to obtain user demand information, and perform template configuration and push configuration according to the user demand information to obtain template configuration data and push configuration data; The query module is used to obtain the user query instruction and obtain the corresponding SQL file data according to the user query instruction; The conversion module is used to convert the SQL file data according to the template configuration data to obtain the EXCEL file data; The push module is used to generate push information according to the EXCEL file data and push the push information according to the push configuration data.
9. A data export device, characterized in that: The data export device comprises: a memory and at least one processor, wherein instructions are stored in the memory; At least one of the processors calls the instructions in the memory to enable the data export device to perform each step of the data export method according to any one of claims 1 to 7.
10. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by a processor, the steps of the data export method according to any one of claims 1 to 7 are implemented.