CN114138886A - Document export method, user side and server side - Google Patents

Document export method, user side and server side Download PDF

Info

Publication number
CN114138886A
CN114138886A CN202111448988.4A CN202111448988A CN114138886A CN 114138886 A CN114138886 A CN 114138886A CN 202111448988 A CN202111448988 A CN 202111448988A CN 114138886 A CN114138886 A CN 114138886A
Authority
CN
China
Prior art keywords
user
request
attribute name
document
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111448988.4A
Other languages
Chinese (zh)
Inventor
任雨涛
邱元海
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Forehope Electronic Ningbo Co Ltd
Original Assignee
Forehope Electronic Ningbo Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Forehope Electronic Ningbo Co Ltd filed Critical Forehope Electronic Ningbo Co Ltd
Priority to CN202111448988.4A priority Critical patent/CN114138886A/en
Publication of CN114138886A publication Critical patent/CN114138886A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the technical field of computers, and provides a document export method, a user side and a server side, which are applied to a data management system comprising the user side and the server side. When a user request is received by a user terminal, judging whether the user request is a exporting request, if so, adding a mark for representing the document type of a target document in the user request by the user terminal, and sending an attribute name array obtained based on the mark to a server terminal; then the server side acquires a data set according to the attribute name number group and sends a target document generated according to the attribute name number group and the data set to the client side; and finally, the user terminal creates an export link according to the target document so as to enable the user to export the target document. The method can achieve the effects of reducing maintenance cost, avoiding generating temporary files and reducing memory occupation.

Description

Document export method, user side and server side
Technical Field
The invention relates to the technical field of computers, in particular to a document export method, a user side and a server side.
Background
Management of data in software systems typically requires bulk downloading, i.e., exporting in documents, of the data. In the prior art, the export of the document occupies a storage space, the identity information of the user is unsafe, and a plurality of interfaces need to be maintained.
Disclosure of Invention
In view of the above, the present invention provides a document export method, a client and a server.
In order to achieve the above purpose, the embodiment of the present invention adopts the following technical solutions:
in a first aspect, the present invention provides a document export method, which is applied to a data management system, where the data management system includes a user side and a server side, and the user side is in communication connection with the server side; the method comprises the following steps:
when the user side receives a user request, judging whether the user request is a exporting request;
if yes, the user side adds a mark in a request header of the user request; the mark is used for representing the document type of the target document;
the user side sends the attribute name array obtained according to the mark to the server side;
the server side acquires a data set according to the attribute name array;
the server side sends a target document generated according to the attribute name array and the data set to the user side; the target document is a document type corresponding to the mark;
and the user side creates an export link according to the target document so as to enable the user to export the target document.
In an optional embodiment, when the user side receives a user request, the step of determining whether the user request is an export request includes:
when the user side receives a user request, judging whether a preset derived parameter in the user request is a first preset value or not;
if so, the user request is the export request, and the user side deletes the preset export parameters;
and if not, the user request is a non-outgoing request.
In an optional embodiment, the step of sending, by the user side, the set of attribute names obtained according to the tag to the server side includes:
carrying out format conversion on the attribute name array obtained according to the mark to obtain a target attribute name array;
encoding the target attribute name array;
adding the encoded target attribute name array to a request header of the user request to obtain a target request;
and sending the target request to the server.
In an optional implementation manner, the step of obtaining, by the server, the data set according to the attribute name array includes:
decoding the target request to obtain the target attribute name array;
deserializing the target attribute name array to obtain an attribute name set;
and acquiring the data set according to the attribute name set.
In an optional implementation manner, the step of sending, by the server, the target document generated according to the attribute name array and the data set to the user side includes:
generating a document object;
adding each attribute name in the attribute name set to the document object according to a preset sequence;
traversing the data set, adding each data in the data set to the document object, and generating the target document; each data corresponds to one attribute name;
and sending the target document to the user side.
In an alternative embodiment, the method further comprises:
and when the user side judges that the user request is a derivation request, setting a preset time parameter as a second preset value.
In a second aspect, the present invention provides a document export method, applied to a user side, where the method includes:
when the user side receives a user request, judging whether the user request is a exporting request;
if yes, the user side adds a mark in a request header of the user request; the mark is used for representing the document type of the target document;
the user side sends the attribute name array obtained according to the mark to the server side so that the server side obtains a data set according to the attribute name array and sends a target document generated according to the attribute name array and the data set to the user side; the target document is a document type corresponding to the mark;
and the user side creates an export link according to the target document so as to enable the user to export the target document.
In a third aspect, the present invention provides a document export method, applied to a server, where the method includes:
the server side acquires a data set according to the attribute name array; the attribute name array is obtained by the user side according to the mark added to the request header of the user request when the user request received by the user side is the export request, and the attribute name array is sent to the server side;
the server side sends a target document generated according to the attribute name array and the data set to the user side; and the target document is the document type corresponding to the mark.
In a fourth aspect, the present invention provides a user end, including a processor and a memory, where the memory stores a computer program, and when the processor executes the computer program, the method according to the foregoing embodiments is implemented.
In a fifth aspect, the present invention provides a server, which includes a processor and a memory, where the memory stores a computer program, and when the processor executes the computer program, the method according to the foregoing embodiment is implemented.
The document export method, the user side and the server side provided by the embodiment of the invention are applied to a data management system comprising the user side and the server side, and the user side judges whether a user request is an export request when receiving the user request, if so, the user side adds a mark for representing the document type of a target document in the user request, and sends an attribute name array obtained based on the mark to the server side; then the server side acquires a data set according to the attribute name number group and sends a target document generated according to the attribute name number group and the data set to the client side; and finally, the user terminal creates an export link according to the target document so as to enable the user to export the target document. The user request is judged and the mark for representing the document type is added, so that the export function and other business functions can share one interface, and the maintenance cost is reduced; the server can generate the document corresponding to the document type based on the mark without generating a temporary file, thereby reducing the occupation of the memory.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
FIG. 1 is a schematic diagram of a data management system provided by an embodiment of the invention;
FIG. 2 is a block diagram of an electronic device provided by an embodiment of the invention;
FIG. 3 is a flowchart illustrating a document export method according to an embodiment of the present invention;
FIG. 4 is a schematic flow chart of a document export method according to an embodiment of the present invention;
FIG. 5 is a schematic flow chart of a document export method according to an embodiment of the present invention;
FIG. 6 is a schematic flow chart of a document export method according to an embodiment of the present invention;
FIG. 7 is a schematic flowchart of a document export method according to an embodiment of the present invention;
FIG. 8 is a schematic flowchart of a document export method according to an embodiment of the present invention.
Icon: 100-a server; 102-a user terminal; 120-a processor; 130-a memory; 170 — a communication interface.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
It is noted that relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
In the prior art, a service management system, that is, a data management system applied to various services generally has a document export function, and in order to meet user requirements such as a requirement that data can be exported when being visible, an export interface is usually designed to implement the export function.
At present, two common implementation modes are provided, one mode is that a temporary document is generated by a background, namely a server, then a URL address is returned to a foreground, namely a user, and the user acquires a new page through a browser to download the document. And the other method is that data is obtained asynchronously, the data is spliced into a document in an html format, then the suffix format of the document is modified, and then the document is exported.
Document downloading is carried out on the basis of a new page of the browser, so that the identity information of a user is reserved in a cache cookie of the browser or carried in a URL (uniform resource locator), and the situations of cross-domain limitation and unsafe identity information exist. Meanwhile, the temporary document generated by the server occupies a storage space and needs to be cleaned regularly. Moreover, before exporting a document, a user needs to perform operations such as query screening preview of data, and in the related art, a query interface and an export interface are usually maintained separately, which increases the maintenance cost and lowers the development efficiency. Furthermore, the embodiment of the invention provides a document export method to solve the problems in the prior art.
Please refer to fig. 1, which is a schematic diagram of a data management system according to an embodiment of the present invention. In this embodiment, the data management system includes a server 100 and a plurality of clients 102, and the server 100 is communicatively connected to the plurality of clients 102 to implement data interaction.
The server 100 may be an independent server or a server cluster composed of a plurality of servers.
The user terminal 102 may be a smart phone, a personal computer, a tablet computer, a wearable device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a Personal Digital Assistant (PDA), or the like. The embodiments of the present invention do not limit this.
Fig. 2 is a block diagram of an electronic device according to an embodiment of the present invention. The structure can be used to implement the server 100 or the client 102 in fig. 1. The electronic device includes a processor 120, a memory 130, and a communication interface 170.
The processor 120, memory 130, and communication interface 170 are in direct or indirect electrical communication with each other to facilitate the transfer or interaction of data. For example, the components may be electrically connected to each other via one or more communication buses or signal lines. Processor 120 is used to execute executable modules stored in memory 130.
The processor 120 may be an integrated circuit chip having signal processing capability. The Processor 120 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The Memory 130 may be, but is not limited to, a Random Access Memory 130 (RAM), a Read Only Memory 130 (ROM), a Programmable Read Only Memory 130 (PROM), an Erasable Read Only Memory 130 (EPROM), an electrically Erasable Read Only Memory 130 (EEPROM), and the like. The memory 130 is used for storing a program, and the processor 120 executes the program after receiving an execution instruction, and the method executed by the server 100 defined by the flow process disclosed in any embodiment of the present invention may be applied to the processor 120, or implemented by the processor 120.
The communication interface 170 may be used for communicating signaling or data with other node devices.
It should be noted that the structure shown in fig. 2 is only a schematic structural diagram of the electronic device, and the electronic device may further include more or less components than those shown in fig. 2, or have a different configuration from that shown in fig. 2. The components shown in fig. 2 may be implemented in hardware, software, or a combination thereof.
It is to be understood that the electronic device may also comprise other modules, for example: radio frequency circuits, I/O interfaces, batteries, touch screens, microphones/speakers, etc. And are not limiting herein.
The following describes steps in the methods provided by the embodiments of the present invention and technical effects achieved by the methods in combination with the data management system.
Referring to fig. 3, fig. 3 is a flowchart illustrating a document exporting method according to an embodiment of the present invention.
It should be noted that the method provided by the embodiment of the present invention may be used to derive multiple types of documents such as pdf, word, excel, csv, and the like. For convenience of understanding, the embodiment of the present invention will be described by taking an example of exporting an excel document, adopting axios technology by a foreground, i.e., a user side, and adopting asp.
Step S202, when receiving a user request, a user side judges whether the user request is a exporting request;
it can be appreciated that the data management system is used to manage data in a business process, which can interact with a user through a business interface at a user end. When a user performs an interactive operation on a service interface of a user side, the user side can receive a user request corresponding to the interactive operation.
The export request may refer to a user request for obtaining data from the data management system and saving the data in a document form to the local storage space of the user terminal.
Optionally, when the user end receives the user request, an interceptor in axios technology, i.e., an interceptor, may be used to intercept the user request, and then determine whether the user request is an export request according to a request header of the user request. If yes, go to step S204.
Step S204, the user terminal adds a mark in the request header of the user request;
it will be appreciated that a user may export multiple types of documents, and that a flag may be employed to indicate the document type of the document to be exported, i.e., the target document. When the user side and the server side perform data interaction, the server side can determine the document type of the target document to be generated based on the mark.
Optionally, when the user request is an export request, the user side adds a mark in a request header of the user request, that is, adds a mark in the headers.
It can be understood that, after adding the mark in the request header of the user request, the user terminal may further set the response type, i.e. the data type used by the server terminal to return the target document. For example, the client may set the ResponseType to be a blob data type, so that the server returns the target document to the client according to the blob data type.
Step S206, the user side sends the attribute name array obtained according to the mark to the server side;
it can be understood that, the service interface of the user side has a service name corresponding to each data, and the service name refers to a service meaning represented by the data. The service name and the attribute name have a first mapping relation, namely each service name has a corresponding attribute name, the server side can acquire corresponding data according to the attribute names, and the attribute name number group comprises a plurality of attribute names.
Optionally, the user side may traverse the service names of each column of data in the service interface triggering the user request according to the document type represented by the mark to obtain a plurality of service names; obtaining an attribute name corresponding to each service name according to the first mapping relation, obtaining a plurality of attribute names, and generating an attribute name array; and sending the attribute name array to a server.
If the derived document is an excel document, the business name of each column of data in the business interface can be, for example, "company name", "user number", "user name", and the like.
Optionally, the ue may further set an attribute parameter, such as options, in the ue request, where the attribute parameter is used to agree on a mapping relationship between a service name on the ue and an attribute name on the service side, and set an order of the attribute names.
Step S208, the server side acquires a data set according to the attribute name array;
it can be understood that the server stores data in the business process, and each data has a corresponding attribute name, that is, the data and the attribute name have a second mapping relationship.
Optionally, after receiving the attribute name array, the server may obtain corresponding data according to each attribute name and the second mapping relationship, so as to obtain a data set. The data corresponding to each attribute name can be understood as the data corresponding to each column of service names in the service interface of the user side.
Step S210, the server sends a target document generated according to the attribute name array and the data set to the user side;
optionally, after the server acquires the data set, the server may determine the document type of the target document according to the mark, arrange the attribute name number group and the data set based on the attribute parameters, arrange the attribute name number group according to a set order, and fill the data set into the corresponding attribute name to obtain the target document; and then sending the target document to the user side according to the appointed data type.
Step S212, the user end creates a export link according to the target document so as to enable the user to export the target document;
optionally, after receiving the target document sent by the server, the user may first determine the data type, and if it is determined that the target document is the blob data type, if so, create an export link based on the target document, that is, create a URL resource and a tag object a, and assign the URL to an href attribute of the tag object a, where the href attribute is an attribute of the URL of the tag object a used to specify a hyperlink target.
The tag object can be set to be hidden, that is, when the user triggers to export the document, the browser at the user end does not redisplay an interface for downloading the document, and can display the downloading progress and obtain the target document in the current business interface.
Based on the design, the document export method of the embodiment of the invention is applied to a data management system comprising a user side and a server side, and judges whether a user request is an export request or not when the user request is received by the user side; then the server side acquires a data set according to the attribute name number group and sends a target document generated according to the attribute name number group and the data set to the client side; and finally, the user terminal creates an export link according to the target document so as to enable the user to export the target document. Compared with the prior art, the method judges the user request and adds the mark for representing the document type, so that the export function and other business functions can share one interface, thereby reducing the maintenance cost; the server can generate the document corresponding to the document type based on the mark without generating a temporary file, thereby reducing the occupation of the memory.
Optionally, regarding step S202, the determination of the user request determines whether to execute a subsequent step of exporting the document, and further the embodiment of the present invention provides a possible implementation manner.
It can be understood that, when a user needs to export a document in a service interface, operations such as query, screening, preview and the like are performed on data, that is, content to be exported needs to be displayed to the user first, the service functions are that the user side acquires data from a server side for display, the export function is that the user side acquires data from the server side for local storage, and the service functions and the export function have coincident service steps.
Therefore, when the user terminal receives the user request, the user terminal can judge based on the parameter value in the user request, distinguish the export request from the requests triggered by the service functions, and simultaneously enable the export function and the service functions such as the query function to share one interface. Therefore, the development efficiency is improved, and the maintenance cost of the interface is reduced.
Optionally, when the user performs an interactive operation on the service interface, if the interactive operation is a export operation, assigning a preset export parameter, such as export, in the user request to a first preset value.
Then intercepting when the user side receives the user request, and judging whether the user request is a exporting request by judging whether the preset exporting parameter is a first preset value; if not, the user request is a non-output request; if the exponent parameter is the first preset value, the user request is a derivation request. And when the user request is judged to be the export request, deleting the preset export parameters so as to avoid that the request triggered by other service functions is judged to be the export request by mistake.
Optionally, regarding step S206, the embodiment of the present invention provides a possible implementation manner. Referring to fig. 4, step S206 may further include the following steps:
step S206-1, carrying out format conversion on the attribute name array obtained according to the mark to obtain a target attribute name array;
optionally, after the user acquires the attribute name array, format conversion needs to be performed on the attribute name array, that is, the attribute name array is converted into a format that can be analyzed by the server. For example, the obtained attribute name array is a json object, and the json object can be converted into a json character string through a stringiness function, so that a target attribute name array is obtained.
Step S206-3, encoding the target attribute name array;
alternatively, the encoderURIComponent function may encode the data in string format as a URI component.
The user side can adopt an encoderURIComponent function to encode the target attribute name array with the format of json character strings.
Step S206-5, adding the encoded target attribute name array to a request header of a user request to obtain a target request;
it can be understood that, in step S206, attribute parameters options are introduced, and the attribute parameters can be understood as mapping relationships between service names and attribute names agreed by the user side and the service side, and the order of the attribute names is set.
Its attribute parameters options can be expressed as { "Label": "chinese title 1", "Property": "viewmodel attribute 1" }, { "Label": "Chinese title 2", Property ": "viewmodel attribute 2" }, … ], where a chinese title represents a service name, a viewmodel attribute represents an attribute name, and the arrangement order of the attribute names is set, that is, the 1 st column is a chinese title 1, the corresponding viewmodel attribute 1 is the 1 st column, the 2 nd column is a chinese title 2, and the corresponding viewmodel attribute 2 is the 2 nd column, etc.
If the derived attribute name is an excel document, the encoded target attribute name array is a key which can be used as the attribute parameter excel-options, and is added into a request header of a user request to obtain a target request.
For convenience of understanding, in the embodiment of the present invention, an order service is taken as an example, and the attribute parameter excel-options may be expressed as:
[ { "Label": "company name", "Property": "company name" }, { Label ": "user number", "Property": "Createusercode" }, { "Label": "user name", "Property": createusername "}, {" Label ": "IP address", "Property": RemoteIP "} ].
Step S206-7, sending the target request to a server;
optionally, the user sends the target request added with the target attribute name array and the tag to the server.
Optionally, with respect to the step S208, the embodiment of the present invention provides a possible implementation manner. Referring to fig. 5, step S208 may further include the following steps:
step S208-1, decoding the target request to obtain a target attribute name array;
optionally, after receiving the target request sent by the user, the server may determine whether there is a mark in the request header of the target request through a filter, such as an onactionexecution function in the ActionFilterAttribute. For example, when it is judged that the target request has a flag application/excel-stream in the request header, it is determined that the target request is a derivation request.
It can be understood that the export request and the query request share one interface, and the query request may perform paging display on data in the service interface of the user side, that is, the query request executed by the server side is to obtain data by paging query, where each page has a set number of rows. The server executes the export request and needs to acquire the data to be exported from all the data.
Optionally, after the server determines that the target request is a export request, the server may modify the row number parameter of each page, such as a rows parameter, and modify the row number parameter to a maximum value, such as a maximum value of int32, so that the data to be exported may be quickly acquired.
Optionally, after the server determines that the target request is a export request, it determines whether a key of excel-options, that is, a target attribute name array, exists in a request header of the target request, and if so, reads the target attribute name array, and analyzes the UrlDecode by calling HttpUtility, that is, decodes the target request, so as to obtain the target attribute name array.
S208-3, performing deserialization on the target attribute name array to obtain an attribute name set;
optionally, after obtaining the target attribute name array, the server performs deserialization Deserialize on the target attribute name array, that is, the target attribute name array in the format of json character string is converted into an object format by using a json Deserialize function, so as to obtain an attribute name set.
Step S208-5, acquiring a data set according to the attribute name set;
optionally, the attribute name set includes a plurality of attribute names, and the server may obtain data corresponding to each attribute name according to the attribute name set and the second mapping relationship, so as to obtain a data set.
It can be understood that, based on the business requirements, until the user performs the export operation on the set business interface, the data set needs to be screened, that is, it needs to be determined whether the data is a paging result set, where the paging result set represents the data displayed on the set business interface.
Optionally, the output Object may be obtained from the outputformaterwritecontext, and it is determined whether the Object is a paging result set, that is, it is determined whether the data inherits an interface of the paging result set according to the return value, if the data inherits the interface, the data is data that needs to be exported, and if the data does not inherit the interface, the data does not need to be exported.
Optionally, for the step S210, the embodiment of the present invention provides a possible implementation manner. Referring to fig. 6, step S210 may further include the following steps:
step S210-1, generating a document object;
alternatively, if an excel document is exported, the server can create a workbook object and create a worksheet by calling the CreateSheet interface of the workbook object to generate a document object.
Step S210-3, adding each attribute name in the attribute name set to the document object according to a preset sequence;
for example, the server may create a header for the worksheet based on the set of attribute names; or performing inverse mapping by using the first group of data of the data set to obtain the attribute name corresponding to each data in the data group, so as to obtain the header.
A temporary variable such as a Dictionary < string, int > type may be used to record a subscript position corresponding to each attribute name in the header, the subscript position indicating the order of the respective attribute names, i.e., the order of the respective attribute names is arranged based on the temporary variable.
Step S210-5, traversing the data set, adding each data in the data set to a document object, and generating a target document;
optionally, the server may cycle through the data set, obtain a subscript position of an attribute name corresponding to each data by reflection mapping, fill each data into a new row of the working table according to the subscript position in the temporary variable, and obtain a target document, where the document type of the target document is the document type corresponding to the label.
Alternatively, the server may create an object such as a MemoryStream to be returned to the client, call the Write interface of the workbook object, and Write the worksheet into the MemoryStream to obtain the return result value.
Step S210-7, sending the target document to a user side;
optionally, the server sends the target document to the user side, that is, the server may call an interface corresponding to the outputformaterwritecontext, and write the return result value into a response stream for responding to the user side, so that the user side obtains the target document.
Through the steps, the mark is added in the user request and used for informing the server side of generating the document corresponding to the document type, a temporary document does not need to be generated, the memory is effectively prevented from being occupied, and the invalid document does not need to be cleaned regularly. And moreover, the parameters in the user request are judged, so that the interfaces of the export function and the query function can be combined into a whole, and the maintenance cost is reduced. By adding the self-defined parameters in the request header of the user request, the method is not influenced by cross-domain, and the identity information cannot be stored in the cache cookie of the browser, so that the information safety is ensured. Meanwhile, the document is generated by the server side and returned to the user side, data splicing and document format changing are not needed at the user side, the compatibility problem of the document can be effectively avoided, error prompt of the user side is avoided, and therefore user experience is improved.
It can be understood that the export request needs to transmit the acquired data to the client through the server, so that the user exports the data through the client, the processing time is long, and the interrupt processing is avoided when the client misjudges and processes the export request overtime.
The preset time parameter, such as timeout, may be set to a second preset value, such as 0, when the ue determines that the user request is a derivation request. Meanwhile, the method can prevent long-time non-response under the condition that more user requests exist, and avoid that the user triggers the export request for many times so as to improve the user experience.
Optionally, when the user side determines that the user request is an export request, a progress frame may be displayed on the service interface through an onDownloadprogress function, so as to show the export progress of the document to the user. And when the document is exported, the progress frame is automatically closed so as to improve the user experience.
The embodiment of the invention also provides a document export method which is applied to the user side. Fig. 7 is a schematic flow chart according to an embodiment of the present invention.
Step S222, when the user end receives the user request, judging whether the user request is a exporting request;
step S224, if yes, the user end adds a mark in the request header of the user request;
wherein the mark is used for representing the document type of the target document;
step S226, the user side sends the attribute name number group obtained according to the mark to the server side so that the server side obtains the data set according to the attribute name number group and sends the target document generated according to the attribute name number group and the data set to the user side; the target document is a document type corresponding to the mark;
in step S228, the user terminal creates an export link according to the target document, so that the user exports the target document.
It should be noted that, the basic principle and the generated technical effect of the document exporting method applied to the user end provided by the embodiment of the present invention are the same as those of the above embodiment, and for the sake of brief description, no part of this embodiment is mentioned, and reference may be made to the corresponding contents in the above embodiment.
The embodiment of the invention also provides a document export method which is applied to the server side. Please refer to fig. 8, which is a flowchart illustrating a process according to an embodiment of the present invention.
Step S232, the server side obtains a data set according to the attribute name array;
the attribute name array is obtained by the user side according to a mark added into a request header of a user request when the user request received by the user side is a derivation request, and the attribute name array is sent to the server side;
step S234, the server side sends the target document generated according to the attribute name array and the data set to the user side;
and the target document is a document type corresponding to the mark.
It should be noted that, the basic principle and the generated technical effect of the document export method applied to the server side provided by the embodiment of the present invention are the same as those of the above embodiment, and for the sake of brief description, no part of this embodiment is mentioned, and corresponding contents in the above embodiment may be referred to.
The embodiment of the present invention further provides a user side, which includes a processor 120 and a memory 130, where the memory 130 stores a computer program, and when the processor executes the computer program, the document export method disclosed in the above embodiment is implemented.
The embodiment of the present invention further provides a server, which includes a processor 120 and a memory 130, where the memory 130 stores a computer program, and when the processor executes the computer program, the document export method disclosed in the above embodiment is implemented.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A document export method is applied to a data management system, the data management system comprises a user side and a server side, and the user side is in communication connection with the server side; the method comprises the following steps:
when the user side receives a user request, judging whether the user request is a exporting request;
if yes, the user side adds a mark in a request header of the user request; the mark is used for representing the document type of the target document;
the user side sends the attribute name array obtained according to the mark to the server side;
the server side acquires a data set according to the attribute name array;
the server side sends a target document generated according to the attribute name array and the data set to the user side; the target document is a document type corresponding to the mark;
and the user side creates an export link according to the target document so as to enable the user to export the target document.
2. The method according to claim 1, wherein the step of determining, when the user request is received by the user side, whether the user request is an export request includes:
when the user side receives a user request, judging whether a preset derived parameter in the user request is a first preset value or not;
if so, the user request is the export request, and the user side deletes the preset export parameters;
and if not, the user request is a non-outgoing request.
3. The method according to claim 1, wherein the step of sending, by the user side, the set of attribute names obtained according to the tag to the server side includes:
carrying out format conversion on the attribute name array obtained according to the mark to obtain a target attribute name array;
encoding the target attribute name array;
adding the encoded target attribute name array to a request header of the user request to obtain a target request;
and sending the target request to the server.
4. The method according to claim 3, wherein the step of the server side acquiring the data set according to the attribute name array comprises:
decoding the target request to obtain the target attribute name array;
deserializing the target attribute name array to obtain an attribute name set;
and acquiring the data set according to the attribute name set.
5. The method according to claim 4, wherein the step of the server sending the target document generated according to the attribute name array and the data set to the user side comprises:
generating a document object;
adding each attribute name in the attribute name set to the document object according to a preset sequence;
traversing the data set, adding each data in the data set to the document object, and generating the target document; each data corresponds to one attribute name;
and sending the target document to the user side.
6. The method of claim 1, further comprising:
and when the user side judges that the user request is a derivation request, setting a preset time parameter as a second preset value.
7. A document export method is applied to a user side, and the method comprises the following steps:
when the user side receives a user request, judging whether the user request is a exporting request;
if yes, the user side adds a mark in a request header of the user request; the mark is used for representing the document type of the target document;
the user side sends the attribute name array obtained according to the mark to the server side so that the server side obtains a data set according to the attribute name array and sends a target document generated according to the attribute name array and the data set to the user side; the target document is a document type corresponding to the mark;
and the user side creates an export link according to the target document so as to enable the user to export the target document.
8. A document export method is applied to a server side, and the method comprises the following steps:
the server side acquires a data set according to the attribute name array; the attribute name array is obtained by the user side according to the mark added to the request header of the user request when the user request received by the user side is the export request, and the attribute name array is sent to the server side;
the server side sends a target document generated according to the attribute name array and the data set to the user side; and the target document is the document type corresponding to the mark.
9. A user terminal, comprising a processor and a memory, the memory storing a computer program, the processor, when executing the computer program, implementing the method of claim 7.
10. A server, characterized in that it comprises a processor and a memory, said memory storing a computer program, said processor, when executing said computer program, implementing the method of claim 8.
CN202111448988.4A 2021-11-30 2021-11-30 Document export method, user side and server side Pending CN114138886A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111448988.4A CN114138886A (en) 2021-11-30 2021-11-30 Document export method, user side and server side

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111448988.4A CN114138886A (en) 2021-11-30 2021-11-30 Document export method, user side and server side

Publications (1)

Publication Number Publication Date
CN114138886A true CN114138886A (en) 2022-03-04

Family

ID=80386472

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111448988.4A Pending CN114138886A (en) 2021-11-30 2021-11-30 Document export method, user side and server side

Country Status (1)

Country Link
CN (1) CN114138886A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114490088A (en) * 2022-04-01 2022-05-13 北京锐融天下科技股份有限公司 Multithreading asynchronous export method and system for large-data-volume excel file

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114490088A (en) * 2022-04-01 2022-05-13 北京锐融天下科技股份有限公司 Multithreading asynchronous export method and system for large-data-volume excel file

Similar Documents

Publication Publication Date Title
CN108170578B (en) Log collection method and device
CN111722947A (en) Service calling method and system
CN113382083B (en) Webpage screenshot method and device
CN107870989A (en) webpage generating method and terminal device
CN112104660A (en) Data transmission method, related equipment and readable storage medium
CN112422450B (en) Computer equipment, and flow control method and device for service request
CN112307369A (en) Short link processing method, device, terminal and storage medium
CN112631564A (en) Content management system-based interface generation method, device, equipment and storage medium
CN110909000A (en) Data processing method, system, device and computer readable storage medium
CN114138886A (en) Document export method, user side and server side
CN111563199A (en) Data processing method and device
CN110020343B (en) Method and device for determining webpage coding format
CN111680247B (en) Local calling method, device and equipment of webpage character strings and storage medium
CN112347383A (en) Sharing link generation method and device and electronic equipment
CN112468550A (en) File downloading method and device and electronic equipment
CN113761565A (en) Data desensitization method and apparatus
CN108280111B (en) Page processing method, device, user terminal and storage medium
CN110955839A (en) Tax declaration method, system and storage medium
KR101125083B1 (en) System for scrap of web contents and method thereof
CN111639936B (en) Transaction information acquisition method and device, electronic equipment and readable storage medium
CN114900566A (en) Data communication method, device, electronic equipment and medium
CN114444637A (en) Quick response code steering system
CN113407562A (en) Communication method and device of distributed database system
CN112347382A (en) Product page sharing method and device and electronic equipment
CN111753228A (en) Data request method and device, computer readable medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination