File export implementation method and device and electronic equipment
By defining the blob format and the export method based on blob file flow in the Silver Base platform, the problem of incomplete data in the existing technology when the data volume is large is solved, the order and integrity of the data are realized, and it is suitable for a variety of data types. Improved file export compatibility and reliability.
Patent Information
- Application Number
- CN202410761888.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-10-01
AI Technical Summary
In the prior art, the data export function uses URL export, which is suitable for scenarios with a small amount of data. However, when the amount of data is large, it can easily lead to incomplete data, causing inconvenience to users.
By defining the data type as blob format in the interface of the Silver Base platform, the file export method is implemented based on the blob file stream, and data is written to the specified file one by one to ensure the order and integrity of the data.
It achieves the order and integrity of file export in scenarios with large amounts of data, is suitable for multiple data types, and improves the reliability and compatibility of data export.
Smart Images

Figure CN118732997A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of financial technology, and in particular to a method, device and electronic device for implementing file export. Background Art
[0002] With the development of technology, the traditional model of commercial banks selling public funds is quietly changing. Some banks will open eight platforms to fund companies, including page configuration platform, AI customer service, live broadcast platform, shelf, information, label, comment component, big data platform, etc. This platform can realize direct interaction and communication between customers and fund companies, which is conducive to improving the reputation of fund companies and enhancing customer stickiness.
[0003] In order to better interact with fund companies, commercial banks have launched the Yinji platform. Different from the traditional fund sales model, the Yinji platform provides customers with product life cycle companionship, professional and detailed investment education, and timely market information. For fund companies, it can effectively enhance brand awareness, key product exposure, and customer retention rate.
[0004] The export function is a basic function of the Yinji platform. In many modules, the function of exporting Excel tables is required. This function facilitates data analysis: Excel is a widely used data analysis tool. By exporting Excel tables, the data in the back-end platform can be directly exported to Excel format, which is convenient for enterprises to analyze and share. Improve the visualization of data: Through Excel tables, data can be visualized in the form of charts, graphs, etc., which is more intuitive and easy to understand, and helps to better understand the data. Convenient sharing: Exporting Excel tables can facilitate enterprises to share data with others, such as colleagues, customers, etc., so that they can understand the data more intuitively and easily. Improve data security: Through Excel tables, data can be encrypted and signed to improve data security.
[0005] The export function is very practical for enterprises, as it can help them better analyze and share data and improve work efficiency and security.
[0006] In the prior art, the data export function adopts the URL export method. URL export is a method of returning the data in the Blob object in the form of a URL. It is suitable for scenarios with a small amount of data and can quickly return the data in the form of a URL. However, when the amount of data is large, the data may be incomplete, which brings inconvenience to users in using the data.
[0007] Therefore, the prior art still needs to be improved and developed. Summary of the invention
[0008] In view of the above-mentioned deficiencies in the prior art, the present invention provides a method, device and electronic device for implementing file export, aiming to solve the problem that the data export function in the prior art adopts URL export. URL export is a method of returning data in a Blob object in the form of a URL, which is suitable for scenarios with a small amount of data and can quickly return data in the form of a URL. However, when the amount of data is large, there will be incomplete data, which brings inconvenience to users in using data.
[0009] The technical solution of the present invention is as follows:
[0010] A first embodiment of the present invention provides a method for implementing file export, which is applied to a security authentication component. The method includes:
[0011] When encapsulating the interface for docking with the Yinji platform, define the returned data type as blob format;
[0012] Encapsulate the method of realizing file export based on blob file stream in the specified function of the Yinji platform development program;
[0013] Define the abnormal conditions returned by the Yinji platform;
[0014] Detect the file export instruction and obtain the data type of the data returned by the interface;
[0015] If the data type of the data returned by the interface is in blob format, the file export method is implemented based on the blob file stream to export the corresponding file.
[0016] Furthermore, when the interface for docking with the Yinji platform is pre-encapsulated, the returned data type is defined as a blob format, including:
[0017] When the interface encapsulation instruction is detected, the returned data type is defined as blob format through the response field when encapsulating the interface that connects to the Yinji platform.
[0018] Furthermore, the method for realizing file export based on blob file stream is encapsulated in a specified function of the Yinji platform development program, including:
[0019] Obtain the code of the Yinji platform development program, create a blob object in the code of the Yinji platform development program, write each data into a specified file one by one, and complete the method of realizing file export based on the blob file stream;
[0020] The method is encapsulated in the utils file of the Yinji platform development program.
[0021] Furthermore, the abnormal situation returned by the Yinji platform is defined as follows:
[0022] If the data type returned by the interface is not in blob format, an error will be reported.
[0023] Furthermore, if the data type of the data returned by the interface is in blob format, a method for exporting a file is implemented based on the blob file stream to export the corresponding file, including:
[0024] If the data type of the data returned by the interface is in blob format, the format of the data returned by the interface is converted to obtain the converted file;
[0025] The converted file is exported.
[0026] Furthermore, if the data type of the data returned by the interface is in blob format, the format of the data returned by the interface is converted, and after obtaining the converted file, the following is also included:
[0027] Get the converted file format;
[0028] If the converted file format is of json type, the json type data is converted to obtain the converted target file.
[0029] Furthermore, if the converted file format is of json type, the json type data is converted to obtain the converted target file, further comprising:
[0030] Generate an error prompt and display the error prompt on the display interface of the Yinji platform.
[0031] Another embodiment of the present invention provides a device for implementing file export, the device comprising:
[0032] The interface encapsulation module is used to define the returned data type as blob format when encapsulating the interface for docking with the Yinji platform in advance;
[0033] The calling method encapsulation module is used to encapsulate the method of realizing file export based on blob file stream in the specified function of the Yinji platform development program;
[0034] The exception definition module is used to define the exceptions returned by the Yinji platform;
[0035] A data acquisition module is used to detect a file export instruction and obtain the data type of the data returned by the interface;
[0036] The data export module is used to implement a file export method based on the blob file stream to export the corresponding file if the data type of the data returned by the interface is in blob format.
[0037] Another embodiment of the present invention provides an electronic device, the electronic device comprising at least one processor; and,
[0038] a memory communicatively connected to the at least one processor; wherein,
[0039] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned file export implementation method.
[0040] Another embodiment of the present invention further provides a non-volatile computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the one or more processors can execute the above-mentioned file export implementation method.
[0041] Beneficial effect: The file export implementation method of the embodiment of the present invention can realize file export based on Blob file stream, and realizes file export by writing data one by one into the specified file. It is suitable for scenarios with large data volume and can ensure the order and integrity of written data. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:
[0043] Figure 1 A flowchart of a preferred embodiment of a method for implementing file export of the present invention;
[0044] Figure 2 A schematic diagram of code for interface encapsulation of a preferred embodiment of a method for implementing file export of the present invention;
[0045] Figure 3 A schematic diagram of code for interface encapsulation of a preferred embodiment of a method for implementing file export of the present invention;
[0046] Figure 4 A schematic diagram of code for interface encapsulation of a preferred embodiment of a method for implementing file export of the present invention;
[0047] Figure 5 A schematic diagram of functional modules of a preferred embodiment of a device for implementing file export of the present invention;
[0048] Figure 6 The figure is a schematic diagram of the hardware structure of a preferred embodiment of an electronic device of the present invention. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail below. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0050] The embodiments of the present invention are described below with reference to the accompanying drawings.
[0051] In view of the above problems, the present invention provides a method for implementing file export. Figure 1 , Figure 1 FIG. 1 is a flow chart of a preferred embodiment of a method for implementing file export of the present invention. Figure 1 As shown, it includes:
[0052] Step S100: When encapsulating the interface for docking with the Yinji platform, define the returned data type as blob format;
[0053] Step S200, encapsulating the method for realizing file export based on blob file stream in a designated function of the Yinji platform development program;
[0054] Step S300, defining the abnormal situation returned by the Yinji platform;
[0055] Step S400: Detect a file export instruction and obtain the data type of the data returned by the interface;
[0056] Step S500: If the data type of the data returned by the interface is in blob format, a file export method is implemented based on the blob file stream to export the corresponding file.
[0057] In specific implementation, the embodiment of the present invention is applied to the data export function of the Yinji platform. The Yinji platform is a platform developed by banks for data connection between banks and the fund industry. The data export interface connected to the Yinji platform is obtained in advance, and when the data export interface is encapsulated, the returned data type is defined as blob format; the method of implementing file export using blob file stream is encapsulated as a public method, which is encapsulated in the specified function of the Yinji platform development program; and the abnormal situations that occur in the data export of the Yinji platform are defined, and specific processing measures are defined.
[0058] When a file export instruction triggered by the user on the Yinji platform is detected, the data type returned by the interface is obtained; if the returned data type is in blob format, the method for implementing file export based on blob file stream in the specified function is called to export the corresponding file.
[0059] The blob file stream export in the embodiment of the present invention is a method of writing data one by one into a specified file, which is suitable for scenarios with large amounts of data and can ensure the order and integrity of the written data.
[0060] In one embodiment, when encapsulating the interface for docking with the Yinji platform, the returned data type is defined as a blob format, including:
[0061] When the interface encapsulation instruction is detected, the returned data type is defined as blob format through the response field when encapsulating the interface that connects to the Yinji platform.
[0062] When implementing it, Figure 2 As shown, the interface encapsulation instruction is detected, and the returned data type is described by sending the responseType field when encapsulating the interface that is connected to the Yinji platform in advance. The data type is defined as blob format.
[0063] In one embodiment, a method for implementing file export based on blob file stream is encapsulated in a specified function of the Yinji platform development program, including:
[0064] Obtain the code of the Yinji platform development program, create a blob object in the code of the Yinji platform development program, write each data into a specified file one by one, and complete the method of realizing file export based on the blob file stream;
[0065] The method is encapsulated in the utils file of the Yinji platform development program.
[0066] When implementing it, Figure 3 As shown, the method of converting the blob data type into a file and downloading it is called as a public method. Further, the code of the Yinji platform development program is obtained, a blob object is created in the code of the Yinji platform development program, and each data is written into a specified file one by one; the method is encapsulated in the utils file of the Yinji platform development program.
[0067] In one embodiment, the abnormal conditions returned by the Yinji platform are defined, including:
[0068] If the data type returned by the interface is not in blob format, an error will be reported.
[0069] When implementing it, Figure 4 As shown, the abnormal situation of the data returned by the Yinji platform is defined in the code program. When it is detected that the data type returned by the interface is not in blob format, an error is reported.
[0070] In one embodiment, if the data type of the data returned by the interface is in blob format, a method for exporting a file is implemented based on a blob file stream to export the corresponding file, including:
[0071] If the data type of the data returned by the interface is in blob format, the format of the data returned by the interface is converted to obtain the converted file;
[0072] The converted file is exported.
[0073] When implementing it, Figure 4 As shown, if the data type returned by the interface is not in blob format, the data returned by the interface will be converted, and the converted data format will be pre-set as needed. Blob file stream export can support multiple data types, including text, images, audio, video, etc., to meet different data type requirements.
[0074] In one embodiment, if the data type of the data returned by the interface is in blob format, a method for exporting a file is implemented based on a blob file stream to export the corresponding file, including:
[0075] Get the converted file format;
[0076] If the converted file format is of json type, the json type data is converted to obtain the converted target file.
[0077] When implementing it, Figure 4 As shown, the converted file format is obtained; if the converted file format is of json type, it means that the converted data is incorrect, and the json type data needs to be converted to obtain the converted target file.
[0078] In one embodiment, if the converted file format is of json type, the json type data is converted to obtain the converted target file, further comprising:
[0079] Generate an error prompt and display the error prompt on the display interface of the Yinji platform.
[0080] When implementing it, Figure 4 As shown, if the converted file format is of json type, the json type data is converted to obtain the converted target file, and an error prompt is generated and popped up on the display interface of the Yinji platform.
[0081] Compared with the prior art, the embodiments of the present invention have the following technical advantages:
[0082] Strong compatibility: Blob file stream export is compatible with Blob objects of different operating systems and browsers, and can also be used in different environments.
[0083] Write data one by one: Use Blob file stream export to write data one by one into the specified file, which can ensure the correct order of written data. It is suitable for scenarios where sequential data export is required.
[0084] Data type compatibility: Blob file stream export can support multiple data types, including text, images, audio, video, etc., to meet different data type requirements.
[0085] Strong flexibility: Using Blob file stream export can freely control the order and quantity of data writing, and can flexibly adjust the writing strategy. It is suitable for scenarios that require flexible control of data writing order.
[0086] Simple code: To use Blob file stream export, you only need to create a Blob object in the code, and then write the data to the specified file one by one. The code is simple and easy to use, and is suitable for scenarios with higher technical levels.
[0087] It should be noted that there is not necessarily a certain order between the above-mentioned steps. A person skilled in the art can understand, based on the description of the embodiments of the present invention, that in different embodiments, the above-mentioned steps may have different execution orders, that is, they may be executed in parallel, may be executed interchangeably, and so on.
[0088] Another embodiment of the present invention provides a device for implementing file export, such as Figure 5 As shown, the device 1 comprises:
[0089] The interface encapsulation module 11 is used to define the returned data type as a blob format when encapsulating the interface for docking with the Yinji platform in advance;
[0090] A calling method encapsulation module 12 is used to encapsulate the method of realizing file export based on blob file stream in a specified function of the Yinji platform development program;
[0091] The exception definition module 13 is used to define the exceptions returned by the Yinji platform;
[0092] A data acquisition module 14 is used to detect a file export instruction and acquire the data type of the data returned by the interface;
[0093] The data export module 15 is used to implement a file export method based on the blob file stream to export the corresponding file if the data type of the data returned by the interface is in blob format.
[0094] The specific implementation method is shown in the method embodiment, which will not be described in detail here.
[0095] In one embodiment, the interface encapsulation module 11 is specifically used for:
[0096] When the interface encapsulation instruction is detected, the returned data type is defined as blob format through the response field when encapsulating the interface that connects to the Yinji platform.
[0097] The specific implementation method is shown in the method embodiment, which will not be described in detail here.
[0098] In one embodiment, the calling method encapsulation module 12 is specifically used for:
[0099] Obtain the code of the Yinji platform development program, create a blob object in the code of the Yinji platform development program, write each data into a specified file one by one, and complete the method of realizing file export based on the blob file stream;
[0100] The method is encapsulated in the utils file of the Yinji platform development program.
[0101] The specific implementation method is shown in the method embodiment, which will not be described in detail here.
[0102] In one embodiment, the exception definition module 13 is specifically used to:
[0103] If the data type returned by the interface is not in blob format, an error will be reported.
[0104] The specific implementation method is shown in the method embodiment, which will not be described in detail here.
[0105] In one embodiment, the data export module 15 is specifically used for:
[0106] If the data type of the data returned by the interface is in blob format, the format of the data returned by the interface is converted to obtain the converted file;
[0107] The converted file is exported.
[0108] The specific implementation method is shown in the method embodiment, which will not be described in detail here.
[0109] In one embodiment, the device further comprises a data conversion module, the data conversion module being configured to:
[0110] Get the converted file format;
[0111] If the converted file format is of json type, the json type data is converted to obtain the converted target file.
[0112] The specific implementation method is shown in the method embodiment, which will not be described in detail here.
[0113] In one embodiment, the device further comprises a prompt module, the prompt module being configured to:
[0114] Generate an error prompt and display the error prompt on the display interface of the Yinji platform.
[0115] The specific implementation method is shown in the method embodiment, which will not be described in detail here.
[0116] Another embodiment of the present invention provides an electronic device, such as Figure 6 As shown, the electronic device 10 includes:
[0117] One or more processors 110 and memory 120, Figure 6 A processor 110 is used as an example for description. The processor 110 and the memory 120 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.
[0118] The processor 110 is used to complete various control logics of the electronic device 10, and it can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a single-chip microcomputer, an ARM (Acorn RISCMachine) or other programmable logic device, a discrete gate or transistor logic, a discrete hardware control, or any combination of these components. In addition, the processor 110 can also be any traditional processor, microprocessor or state machine. The processor 110 can also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors combined with a DSP core, or any other such configuration.
[0119] The memory 120, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions corresponding to the implementation method of file export in the embodiment of the present invention. The processor 110 executes various functional applications and data processing of the device 10 by running the non-volatile software programs, instructions and units stored in the memory 120, that is, implements the implementation method of file export in the above method embodiment.
[0120] The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store applications required for operating the device and at least one function; the data storage area may store data created according to the use of the device 10, etc. In addition, the memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 120 may optionally include a memory remotely arranged relative to the processor 110, and these remote memories may be connected to the device 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0121] One or more units are stored in the memory 120, and when executed by one or more processors 110, the implementation method of the file export in any of the above method embodiments is executed, for example, the above described Figure 1 The method comprises steps S100 to S500.
[0122] An embodiment of the present invention provides a non-volatile computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by one or more processors, for example, to execute the above-described Figure 1 The method comprises steps S100 to S500.
[0123] As an example, non-volatile storage media can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) as external cache memory. By way of illustration and not limitation, RAM can be obtained in many forms such as synchronous RAM (SRAM), dynamic RAM, (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and direct Rambus RAM (DRRAM). The disclosed memory controls or memories of the operating environment described herein are intended to include one or more of these and / or any other suitable types of memory.
[0124] Another embodiment of the present invention provides a computer program product, the computer program product includes a computer program stored on a non-volatile computer-readable storage medium, the computer program includes program instructions, when the program instructions are executed by a processor, the processor executes the file export implementation method of the above method embodiment. For example, execute the above described Figure 1 The method comprises steps S100 to S500.
[0125] The embodiments described above are merely illustrative, in which the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0126] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a general hardware platform, and of course can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can exist in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiment.
[0127] Conditional language such as "can," "can," "might," or "may," among other things, unless specifically stated otherwise or otherwise understood within the context as used, is generally intended to convey that particular embodiments can include (while other embodiments do not) particular features, elements, and / or operations. Thus, such conditional language is also generally intended to imply that features, elements, and / or operations are anyway required for one or more embodiments or that one or more embodiments must include logic for determining, with or without input or prompting, whether such features, elements, and / or operations are included or will be performed in any particular embodiment.
[0128] What has been described herein in this specification and the accompanying drawings includes examples of implementation methods and devices that can provide file export. Of course, it is not possible to describe every conceivable combination of elements and / or methods for the purpose of describing the various features of the present disclosure, but it can be recognized that many other combinations and permutations of the disclosed features are possible. Therefore, it is obvious that various modifications can be made to the present disclosure without departing from the scope or spirit of the present disclosure. In addition, or in an alternative, other embodiments of the present disclosure may be obvious from consideration of this specification and the accompanying drawings and from the practice of the present disclosure as presented herein. It is intended that the examples proposed in this specification and the accompanying drawings are considered to be illustrative and not restrictive in all respects. Although specific terms are employed in this article, they are used in a general and descriptive sense and are not used for the purpose of limitation.
Claims
1. A method for implementing file export, characterized in that , applied to the silver-based platform, the method comprises: When encapsulating the interface for docking with the Yinji platform, define the returned data type as blob format; Encapsulate the method of realizing file export based on blob file stream in the specified function of the Yinji platform development program; Define the abnormal conditions returned by the Yinji platform; Detect the file export instruction and obtain the data type of the data returned by the interface; If the data type of the data returned by the interface is in blob format, the file export method is implemented based on the blob file stream to export the corresponding file.
2. The method according to claim 1, characterized in that When encapsulating the interface for docking with the Yinji platform in advance, the returned data type is defined as blob format, including: When the interface encapsulation instruction is detected, the returned data type is defined as blob format through the response field when encapsulating the interface that connects to the Yinji platform.
3. The method according to claim 2, characterized in that The method for exporting files based on blob file stream is encapsulated in a specified function of the Yinji platform development program, including: Obtain the code of the Yinji platform development program, create a blob object in the code of the Yinji platform development program, write each data into a specified file one by one, and complete the method of realizing file export based on the blob file stream; The method is encapsulated in the utils file of the Yinji platform development program.
4. The method according to claim 3, characterized in that The abnormal conditions returned by the Yinji platform are defined as follows: If the data type returned by the interface is not in blob format, an error will be reported.
5. The method according to claim 4, characterized in that If the data type of the data returned by the interface is in blob format, a method for exporting a file is implemented based on a blob file stream to export the corresponding file, including: If the data type of the data returned by the interface is in blob format, the format of the data returned by the interface is converted to obtain the converted file; The converted file is exported.
6. The method according to claim 5, characterized in that If the data type of the data returned by the interface is in blob format, the format of the data returned by the interface is converted to obtain the converted file, and further includes: Get the converted file format; If the converted file format is of json type, the json type data is converted to obtain the converted target file.
7. The method according to claim 6, characterized in that If the converted file format is of json type, the json type data is converted to obtain the converted target file, and further includes: Generate an error prompt and display the error prompt on the display interface of the Yinji platform.
8. A device for implementing file export, characterized in that: The device comprises: The interface encapsulation module is used to define the returned data type as blob format when encapsulating the interface for docking with the Yinji platform in advance; The calling method encapsulation module is used to encapsulate the method of realizing file export based on blob file stream in the specified function of the Yinji platform development program; The exception definition module is used to define the exceptions returned by the Yinji platform; A data acquisition module is used to detect a file export instruction and obtain the data type of the data returned by the interface; The data export module is used to implement a file export method based on the blob file stream to export the corresponding file if the data type of the data returned by the interface is in blob format.
9. An electronic device, characterized in that: The electronic device comprises at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the file export implementation method described in any one of claims 1-7.
10. A non-volatile computer-readable storage medium, characterized in that: The non-volatile computer-readable storage medium stores computer-executable instructions, which, when executed by one or more processors, enable the one or more processors to execute the file export implementation method described in any one of claims 1-7.
