Custom receipt generation method and device, equipment and storage medium
By receiving and verifying user requests, obtaining custom configuration information, and generating custom receipts using a general model, the problem of the inability to adjust receipt display elements and styles has been solved, enabling flexible and efficient receipt generation that can adapt to different user needs and handle large amounts of data.
Patent Information
- Application Number
- CN202510923547.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-04
- Publication Date
- 2025-10-28
AI Technical Summary
Existing technologies cannot personalize the display elements and styles of receipts, making it difficult to meet the customization requirements of different users for receipt content. Furthermore, when generating receipts with large amounts of data, interface timeouts can easily occur, leading to failures.
The system receives order requests from target users, performs permission verification, obtains custom configuration information, extracts data from the backend database based on the order type selected by the user, generates custom orders using a general order task model and content model, employs data block processing and asynchronous execution, and uses a reservation mechanism for large data volumes to generate custom orders.
It enables the generation of highly flexible receipts based on user-defined configurations, meeting the customization requirements of different users, improving the convenience and stability of receipt generation, reducing the overall coding volume, and enhancing the maintainability of the system.
Smart Images

Figure CN120850982A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus, device and storage medium for generating custom receipts. Background Technology
[0002] Receipt generation is a crucial function in enterprise office automation systems. For ease of management, fixed template configurations are typically used. Users can usually only select the template type when generating receipts, without customizing display elements or styles. Since different users have different needs, and different business scenarios also present varying requirements, adjusting the existing receipt template configuration according to user requests each time is cumbersome and cannot simultaneously meet the customization requirements of different users for receipt content. Furthermore, generating large volumes of receipts is prone to internal interface timeouts, leading to receipt generation failures.
[0003] The above content is only used to help understand the technical solution of the present invention and does not represent an admission that the above content is prior art. Summary of the Invention
[0004] The main purpose of this application is to provide a method, apparatus, device and storage medium for generating custom receipts, which aims to solve the technical problem in the prior art that it is impossible to personalize the display elements and display styles, making it difficult to meet the customization requirements of different users for receipt content.
[0005] To achieve the above objectives, this application provides a custom receipt generation method, the method comprising:
[0006] Receive a receipt request sent by the target user and perform permission verification on the receipt request;
[0007] After the permission verification is passed, the custom configuration information of the target user in the receipt template is obtained, and the custom configuration information is converted into structured configuration information. The custom configuration information includes at least display element information, display style information and personalized settings information.
[0008] Based on the order type selected by the target user, order generation data is extracted from the background database;
[0009] Based on the receipt generation data and the structured configuration information, a corresponding receipt task is generated;
[0010] Execute the receipt task to generate a custom receipt for the target user.
[0011] In one embodiment, the step of generating a corresponding receipt task based on the receipt generation data and the structured configuration information includes:
[0012] Based on a preset data volume, the receipt generation data is divided into multiple data blocks;
[0013] A general receipt task model is obtained. Based on the attributes set in the general receipt task model, the structured configuration information and the multiple data blocks are encapsulated to obtain multiple receipt tasks. Each receipt task encapsulates one data block. The attributes of the general receipt model include at least task information attributes and receipt data information attributes. The receipt data information attributes include at least configuration information attributes and task data attributes. The task data attributes include at least summary information attributes and detailed information attributes.
[0014] In one embodiment, the step of executing the receipt task and generating a custom receipt for the target user includes:
[0015] Obtain a general receipt content model, and populate the general receipt content model based on the asynchronously executed multiple receipt tasks to obtain multiple target receipt content data. The attributes of the general receipt content model include at least title attributes, file name attributes, summary table attributes, detail table attributes, common configuration information attributes, and content data attributes. The content data attributes include at least summary information attributes, detail information attributes, summary field configuration attributes, and detail field configuration attributes.
[0016] The multiple target receipt content data are assembled to obtain assembled receipt content data;
[0017] Based on the assembly receipt data, the custom receipt is generated.
[0018] In one embodiment, the step of generating the custom receipt based on the assembled receipt content data includes:
[0019] Based on the common configuration information in the assembly receipt content data, determine the global rules for receipt generation;
[0020] The assembled receipt content data is rendered based on the global rules for receipt generation and the preset format to obtain the initial receipt;
[0021] The target electronic signature is embedded at a preset position on the initial receipt, and the position offset is calibrated to obtain a signed receipt;
[0022] The signed receipt is compressed based on a preset compression rate, and an electronic receipt watermark is added to obtain a customized receipt. The file identification information of the customized receipt is then returned to the target user.
[0023] In one embodiment, the method further includes:
[0024] Upon receiving the polling information from the target user, the execution progress of the return order task is obtained;
[0025] When the execution progress of the return receipt task is in the stage of generating file identification information, it is determined that the customized return receipt has been generated and the completion information and the download link of the customized return receipt are sent to the target user.
[0026] If the execution progress of the return receipt task is not in the stage of generating file identification information, it is determined that the custom return receipt has not been completed, and the current progress is fed back to the target user.
[0027] In one embodiment, after the step of retrieving receipt generation data from the background database based on the receipt type selected by the target user, the method further includes:
[0028] When the amount of data generated by the receipt exceeds a preset data threshold, a reservation task for the target user is generated, an idle time execution tag is set for the reservation task of the target user, and the reservation task of the target user is stored in the reservation queue.
[0029] When the resource utilization rate is less than or equal to a preset utilization rate threshold, a target task with an idle time execution tag is selected from the reservation queue;
[0030] When the target task is the reservation task of the target user, the receipt generation data and the structured configuration information are obtained, and the step of generating the corresponding receipt task based on the receipt generation data and the structured configuration information is executed.
[0031] After the step of executing the receipt task and generating the custom receipt for the target user, the method further includes:
[0032] The reservation task of the target user is deleted from the reservation queue, and the corresponding reservation result is generated and returned to the target user.
[0033] In one embodiment, the permission verification includes at least functional permission verification and data permission verification, and the step of performing permission verification on the receipt request includes:
[0034] Obtain the functional permissions of the target user. If the function permissions of the target user include the receipt generation permission, determine that the function permission verification has passed.
[0035] Based on the target user's role information, determine the target user's data permission scope;
[0036] The range of receipt data is determined based on the receipt type selected by the target user;
[0037] When the range of the receipt data matches the data permission range of the target user, the data permission verification is deemed successful.
[0038] Furthermore, to achieve the above objectives, this application also proposes a custom receipt generation device, which includes:
[0039] The permission verification module is used to receive the receipt request sent by the target user and perform permission verification on the receipt request.
[0040] The receipt configuration module is used to obtain the custom configuration information of the target user in the receipt template after the permission verification is passed, and convert the custom configuration information into structured configuration information. The custom configuration information includes at least display element information, display style information and personalized settings information.
[0041] The receipt configuration module is also used to extract receipt generation data from the background database based on the receipt type selected by the target user.
[0042] The receipt generation module is used to generate corresponding receipt tasks based on the receipt generation data and the structured configuration information;
[0043] The receipt generation module is also used to execute the receipt task and generate a custom receipt for the target user.
[0044] In addition, to achieve the above objectives, this application also proposes a custom receipt generation device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. The computer program is configured to implement the steps of the custom receipt generation method described above.
[0045] In addition, to achieve the above objectives, the present invention also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the custom receipt generation method described above.
[0046] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the custom receipt generation method described above.
[0047] This application provides a method for generating custom receipts. It receives a receipt request from a target user and verifies the request's permissions. After successful permission verification, it obtains the target user's custom configuration information from the receipt template and converts this information into structured configuration information. The custom configuration information includes at least display element information, display style information, and personalized settings. Based on the receipt type selected by the target user, it extracts receipt generation data from the backend database. Based on the receipt generation data and the structured configuration information, it generates a corresponding receipt task. The receipt task is then executed to generate the target user's custom receipt. This application can generate corresponding custom receipts based on user-defined display elements and styles, meeting the customization requirements of different users for receipt content. It improves the flexibility and convenience of the receipt generation function, and different receipts can be generated using a unified process, reducing overall coding volume and improving maintainability. It can quickly and stably respond to user needs, solving the technical problem of being unable to personalize display elements and styles, making it difficult to meet the customization requirements of different users for receipt content. Attached Figure Description
[0048] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0049] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0050] Figure 1 This is a flowchart illustrating Embodiment 1 of the custom receipt generation method for this application;
[0051] Figure 2 This is a schematic diagram of the overall architecture of the custom receipt generation method provided in Embodiment 1 of this application;
[0052] Figure 3 A schematic diagram of a general receipt task model for the custom receipt generation method provided in Embodiment 1 of this application;
[0053] Figure 4 A schematic diagram of a general receipt content model for the custom receipt generation method provided in Embodiment 1 of this application;
[0054] Figure 5 A schematic diagram of the receipt generation process for the custom receipt generation method provided in Embodiment 1 of this application;
[0055] Figure 6This is a flowchart illustrating Embodiment 2 of the custom receipt generation method for this application;
[0056] Figure 7 A simplified flowchart illustrating the custom receipt generation method provided in Embodiment 2 of this application;
[0057] Figure 8 This is a schematic diagram of the module structure of the custom receipt generation device in an embodiment of this application;
[0058] Figure 9 This is a schematic diagram of the device structure of the hardware operating environment involved in the custom receipt generation method in this application embodiment.
[0059] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0060] It should be understood that the specific embodiments described herein are merely used to explain the technical solutions of the present application and are not intended to limit the present application.
[0061] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0062] The main solution of this application embodiment is as follows: receiving a receipt request sent by a target user and verifying the receipt request's permissions; after the permission verification is passed, obtaining the target user's custom configuration information in the receipt template, converting the custom configuration information into structured configuration information, the custom configuration information including at least display element information, display style information, and personalized settings information; based on the receipt type selected by the target user, extracting receipt generation data from the background database; based on the receipt generation data and the structured configuration information, generating a corresponding receipt task; executing the receipt task to generate the target user's custom receipt.
[0063] Currently, pre-configured receipt templates are typically set up. Users can only select the template type when generating receipts, and cannot personalize the display elements or styles, thus failing to meet the customized requirements of different users for receipt content. Furthermore, generating large volumes of receipts is prone to internal interface timeouts, leading to receipt generation failures.
[0064] This application provides a solution that generates corresponding custom receipts based on user-defined display elements and styles, meeting the customization requirements of different users for receipt content. This improves the flexibility and convenience of the receipt generation function, and different receipts can be generated using a unified process, reducing the overall coding volume, improving maintainability, and enabling a fast and stable response to user needs. It solves the technical problem of being unable to personalize display elements and styles, making it difficult to meet the customization requirements of different users for receipt content.
[0065] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device or a custom receipt generation device capable of performing the above functions. This embodiment does not specifically limit this. The following uses a backend (back-end) custom receipt generation device as an example to describe this embodiment and the following embodiments.
[0066] This application provides a custom receipt generation method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the custom receipt generation method of this application.
[0067] In this embodiment, the custom receipt generation method includes steps S10 to S50:
[0068] Step S10: Receive a receipt request sent by the target user and perform permission verification on the receipt request;
[0069] It should be noted that the target user is the user for whom a receipt needs to be generated. In this embodiment, refer to... Figure 2 The target user can customize the receipt template according to their needs. After the target user has completed the customization, they can send a receipt generation request. They can select data on the page or query data from the backend based on conditions, thereby responding to the receipt request and generating the receipt required by the user.
[0070] Additionally, it should be noted that users can customize display elements and styles, as well as set other personalized content, in the receipt template. Display elements refer to the content that will be displayed in the final generated receipt, display styles refer to the style of the final generated receipt, and other personalized content refers to any other content that users wish to customize besides the display elements and display styles.
[0071] It is understandable that templates typically include pre-defined options for some display elements, allowing users to customize these elements, such as header information (fields), body information (fields), and the location of the electronic signature. Generally, different types of receipts require different options. For example, for a template of a detailed statement of account issued by a third party, the header information can include options such as issuing agency, issuing number, company name, account name, payment account, bank, transaction number, issuing instructions, handler, reviewer, currency, and receipt number. The body information can include options such as payment date, payment agreement, submitting card number, recipient's name, actual issuing card number, amount, summary, bank, status, ID number, detailed remarks, and gender. Target users can select appropriate options from the header and body information according to their actual needs and adjust the final display order of the options. The electronic signature can be an electronic signature, an electronic seal, or a combination of both; this embodiment does not specifically limit this, and the location of the electronic signature can be flexibly adjusted according to actual needs. If the target user has other content they want to display in the final receipt, they can customize new options or new display elements in the header and body information.
[0072] It should be understood that, in this embodiment, the display style includes at least the paper orientation (portrait / landscape), the number of entries displayed per page, and the detail spacing (pixel-level setting). Other personalized content includes at least the download mode (summary download / entire entry download), whether to split into multiple documents (yes / no), and whether to encrypt the recipient's information (yes / no). The display style and other personalized content can be customized by checking boxes or by direct input. For example, the number of entries displayed per page and the detail spacing can be entered according to actual needs, the paper orientation can be selected between the "portrait" and "landscape" options, and the recipient's information encryption display can be selected between the "yes" and "no" options. If the target user checks the "yes" option for "recipient information encryption display," sensitive fields such as the recipient's account and ID number will be automatically masked (e.g., displayed as "1111******2222") when generating the final receipt to meet data security requirements.
[0073] Furthermore, after receiving the order confirmation request from the target user, it needs to be verified. If the verification passes, the next step can be executed.
[0074] In one feasible implementation, the step of verifying the permissions of the receipt request may include: obtaining the functional permissions of the target user; if the target user has the permission to generate receipts, determining that the functional permission verification is successful; determining the data permission range of the target user based on the role information of the target user; determining the receipt data range based on the receipt type selected by the target user; and determining that the data permission verification is successful when the receipt data range conforms to the data permission range of the target user.
[0075] It should be noted that, in this embodiment, the permission verification includes at least functional permission verification and data permission verification. That is, this embodiment requires dual permission verification, checking both functional and data permissions separately. Functional permission verification checks whether the target user has the operation permission to generate the receipt, while data permission verification checks whether the target user has the permission to obtain the data required to generate the current receipt.
[0076] It is understandable that the target user's functional permissions are all the operation permissions of the target user, and the receipt generation permission is the operation permission to generate receipts. If the target user's functional permissions include the receipt generation permission, it means that the target user has the operation permission to generate receipts and can perform the receipt generation operation. The functional permission verification passes.
[0077] It should be understood that the target user's role information refers to the target user's role within the enterprise / organization. Generally, role information restricts the range of data the target user can access, i.e., the data permission range. For example, a subsidiary user can only generate invoices for their own department. The invoice data range refers to the range of data required to generate the current invoice. If the invoice data range conforms to the target user's data permission range, it means that the data required to generate the current invoice is within the target user's data permission range, and the target user has the right to obtain the required data; the data permission verification passes. If both the functional permission verification and the data permission verification pass, the permission verification is considered successful, and step S20 is executed. If both the functional permission verification and the data permission verification fail, a verification error message is immediately returned.
[0078] Step S20: After the permission verification is passed, obtain the custom configuration information of the target user in the receipt template, and convert the custom configuration information into structured configuration information. The custom configuration information includes at least display element information, display style information and personalized settings information.
[0079] It should be noted that the custom configuration information refers to the overall configuration made by the target user in the visual template through customization. The custom configuration information is usually stored in JSON format on the front end. In order to use the custom configuration information in subsequent steps, it needs to be converted into structured data that the back end can recognize, i.e., structured configuration information.
[0080] Additionally, it should be noted that custom configuration information includes at least display element information, display style information, and personalization settings information. Display element information refers to the display elements set by the target user, display style information refers to the display styles set by the target user, and personalization settings information refers to other personalized content set by the target user.
[0081] Understandably, after the permission verification is passed, this embodiment will convert the target user's personalized configuration on the front end into structured data that the back end can understand, so as to ensure the consistency of information between the front end and the back end.
[0082] Step S30: Based on the order type selected by the target user, extract order generation data from the background database;
[0083] It should be noted that the order type selected by the target user is the type of order that will be generated in the end. This can usually be selected when configuring the order template. The initial order template will also be adjusted accordingly based on the order type selected by the target user.
[0084] It is understandable that the receipt generation data refers to the data required to generate the receipt. In this embodiment, receipt generation data is extracted from the backend database based on the receipt type. For example, if the receipt type is a payroll statement, then data related to payroll business is filtered, including payroll number, company name, recipient information, etc.; if the receipt type is a payment receipt, then data related to payment transaction is filtered, including transaction number, summary, amount, payment account, etc. Target users can input additional conditions (such as date range, transaction status, payroll agency, etc.) through the front-end interface to further narrow down the data filtering scope, ensuring that only valid data is obtained.
[0085] Step S40: Based on the receipt generation data and the structured configuration information, generate the corresponding receipt task;
[0086] In one feasible implementation, step S40 may include steps S401 to S402:
[0087] Step S401: Based on a preset data volume, the receipt generation data is divided into multiple data blocks;
[0088] It should be noted that the preset data volume refers to the pre-defined data volume of each data block, for example, 5000 records. This embodiment does not impose a specific limitation on this and can be flexibly adjusted according to the actual situation. The generated receipt data is divided into multiple data blocks according to the preset data volume.
[0089] Understandably, if the amount of data generated by the order exceeds the set threshold (e.g., 100,000 records), it indicates that the order is generated with a very large amount of data, and a reservation method is adopted. If the amount of data generated by the order does not exceed 100,000 records, then step S401 is executed directly.
[0090] Step S402: Obtain a general return receipt task model. Based on the attributes set in the general return receipt task model, encapsulate the structured configuration information and the multiple data blocks to obtain multiple return receipt tasks.
[0091] It should be noted that, in order to use a unified process to generate different receipts, this embodiment sets up two general models: a general receipt task model and a general receipt content model. The general receipt task model is a general receipt task object, which can encapsulate different types of receipts into the same task object for convenient unified management. Different receipts only need to be populated according to the attributes set in the general receipt task model.
[0092] Additionally, it should be noted that, referring to Figure 3, the attributes of the general return receipt model include at least task information attributes and return receipt data information attributes. The return receipt data information attributes include at least configuration information attributes and task data attributes. The task data attributes include at least summary information attributes and detailed information attributes. Among them, one summary information attribute usually corresponds to multiple (N) detailed information attributes, and one configuration information attribute usually corresponds to multiple (N) task data attributes.
[0093] Understandably, following the general return order task model, structured configuration information and data blocks are encapsulated to obtain corresponding return order tasks, i.e., return order task objects. Generally, each data block generates a separate return order task; that is, one return order task encapsulates one data block. All return order tasks are then executed in an asynchronous thread pool.
[0094] It should be understood that this embodiment can break down large tasks into smaller units to avoid interface timeouts or system lag caused by excessive data volume in a single task, while supporting parallel processing of multiple tasks to improve overall efficiency.
[0095] Step S50: Execute the receipt task to generate a custom receipt for the target user.
[0096] It should be noted that a custom receipt is a receipt generated by the target user in a customized manner.
[0097] In one feasible implementation, step S50 may include steps S501 to S503:
[0098] Step S501: Obtain a general return receipt content model; based on the multiple return receipt tasks executed asynchronously, populate the general return receipt content model to obtain multiple target return receipt content data.
[0099] It should be noted that the generic receipt content model, also known as the generic receipt content object, sets a unified mapping rule for receipt content in order to generate data in a uniform format for assembling the final custom receipt.
[0100] Additionally, it should be noted that the reference Figure 4 The attributes of the general receipt content model include at least the title attribute, file name attribute, summary table attribute, detail table attribute, common configuration information attribute, and content data attribute. The content data attributes include at least the summary information attribute, detail information attribute, summary field configuration attribute, and detail field configuration attribute. Among them, the common configuration information attributes include paper orientation, number of entries per page, detail spacing, whether to display the table header per page, file name rules (e.g., "company name_date_receipt type"), and other related configurations.
[0101] Understandably, multiple receipt tasks are distributed to different receipt processors, which then process them into a generic receipt content object. This object can then be used to call subsequent generic receipt generation processes to generate the corresponding custom receipt. The target receipt content data is the populated generic receipt content model.
[0102] Step S502: Assemble the multiple target receipt content data to obtain assembled receipt content data;
[0103] It is understandable that the data obtained by assembling the target order content data is the assembled order content data.
[0104] Step S503: Generate the custom receipt based on the assembly receipt content data.
[0105] In one feasible implementation, step S503 may include: determining global rules for generating receipts based on common configuration information in the assembled receipt content data; rendering the assembled receipt content data based on the global rules for generating receipts and a preset format to obtain an initial receipt; embedding a target electronic signature at a preset position on the initial receipt and calibrating the position offset to obtain a signed receipt; compressing the signed receipt based on a preset compression rate and adding an electronic receipt watermark to obtain a customized receipt; and returning the file identification information of the customized receipt to the target user so that the target user can download the customized receipt based on the file identification information.
[0106] It should be noted that the common configuration information in the assembled receipt content data refers to the common configuration information attributes obtained by filling in the general receipt content model, namely, the specific styles such as paper orientation, number of items displayed per page, detail spacing, whether to display table headers on each page, and file name rules. The global rules for receipt generation are the global rules used when generating the receipt, usually using the common configuration information as the global rules for receipt generation. The preset format is the pre-set format of the receipt, such as PDF (Portable Document Format), which is not specifically limited in this embodiment. The assembled receipt content data is rendered according to the global rules for receipt generation and the preset format to obtain the initial PDF document, i.e., the initial receipt. For example, the table header is rendered according to the information set in the summary table attributes, the data rows are rendered according to the information set in the detail table attributes, automatic pagination is performed according to the number of items per page set in the common configuration information, and the page layout is adjusted according to the set paper orientation.
[0107] It is understood that the target electronic signature refers to the electronic signature and / or electronic seal required for the customized receipt. The preset position is the position of the electronic signature set in the template beforehand. The target electronic signature is embedded in the preset position of the initial receipt, and the position offset is calibrated to obtain a receipt with the signature, i.e., a signed receipt. The preset compression rate is a pre-set compression rate, for example, 70%, which is not specifically limited in this embodiment. The signed receipt is compressed according to the preset compression rate, and an electronic receipt watermark is added to obtain the final customized receipt.
[0108] It should be understood that file identification information is the file's identifier, usually a file ID (IdentityDocument). Once the receipt is generated, the file ID corresponding to the task will be returned, allowing the target user to download the customized receipt using that file ID.
[0109] In the specific implementation, refer to Figure 5 The specific process for generating receipts can be simplified to data population, assembling PDF to generate dependent objects, generating PDF, adding electronic seals, and file processing / uploading. The data population and PDF assembly to generate dependent objects steps need to be implemented independently for each type of receipt, while other logical nodes can be reused. This significantly reduces the overall coding workload and improves system maintainability.
[0110] Furthermore, upon receiving polling information from the target user, the execution progress of the return receipt task is obtained; when the execution progress of the return receipt task is in the stage of generating file identification information, it is determined that the custom return receipt has been generated and the completion information and download link of the custom return receipt are fed back to the target user; when the execution progress of the return receipt task is not in the stage of generating file identification information, it is determined that the custom return receipt has not been generated and the current progress is fed back to the target user.
[0111] It should be noted that the polling information refers to the target user's client polling the progress of the order confirmation task. The execution progress of the order confirmation task is its current progress. If the execution progress of the order confirmation task is in the stage of generating file identification information, it means that the custom order confirmation has been generated, and the target user can download it. A completion notification and download link will be sent to the target user. If the execution progress of the order confirmation task is not in the stage of generating file identification information, it means that the custom order confirmation has not yet been generated, and the current progress will be sent to the target user.
[0112] This embodiment provides a method for generating custom receipts. It receives a receipt request from a target user and performs permission verification on the request. After successful permission verification, it obtains the target user's custom configuration information in the receipt template and converts this information into structured configuration information. The custom configuration information includes at least display element information, display style information, and personalized settings. Based on the receipt type selected by the target user, it extracts receipt generation data from the backend database. Based on the receipt generation data and the structured configuration information, it generates a corresponding receipt task. The receipt task is then executed to generate the target user's custom receipt. This embodiment can generate corresponding custom receipts based on the user-defined display elements and styles, meeting the customization requirements of different users for receipt content. This improves the flexibility and convenience of the receipt generation function, and different receipts can be generated using a unified process, reducing the overall coding volume, improving maintainability, and enabling rapid and stable response to user needs.
[0113] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in Embodiment 1 above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 6 Step S30 is followed by steps S31 to S33:
[0114] Step S31: When the amount of data generated by the receipt is greater than the preset data amount threshold, generate the reservation task for the target user, set an idle time execution tag for the reservation task for the target user, and store the reservation task for the target user in the reservation queue.
[0115] It should be noted that the preset data volume threshold is a pre-set threshold for the amount of data, usually set to a large value, such as 100,000 records, which can be adjusted flexibly according to the actual situation. If the data volume of the generated receipt exceeds 100,000 records, it means that the receipt to be generated is a large-volume receipt.
[0116] It is understandable that generating a large amount of order data is resource-intensive. Therefore, this embodiment uses a reservation method to make full use of the server's idle time. When the amount of order data to be generated is determined to be greater than 100,000, it is added to the reservation queue as a reservation task, and an idle time execution tag is set. The idle time execution tag is used to indicate that the reservation task will be executed during the server's idle time, that is, when resource occupancy is low.
[0117] Step S32: When the resource occupancy rate is less than or equal to a preset occupancy rate threshold, select a target task with an idle time execution tag from the reservation queue;
[0118] It is understandable that the preset occupancy threshold is a pre-set threshold for resource occupancy, such as 50%, which can be flexibly adjusted according to the actual situation, and there is no specific limitation on it. If the resource occupancy rate is less than or equal to 50%, it means that the current period is idle, and tasks in the scheduled queue that should be executed during idle periods can be executed.
[0119] Step S33: When the target task is the reservation task of the target user, obtain the receipt generation data and the structured configuration information;
[0120] It should be understood that the target task is the task currently selected in the appointment queue that will be executed. If the appointment task of the target user is selected, then steps S40 to S50 are executed to obtain the final customized receipt.
[0121] Furthermore, step S50 includes the following:
[0122] Step S51: Delete the reservation task of the target user from the reservation queue, generate the corresponding reservation result, and return the reservation result to the target user.
[0123] It should be noted that if the target user's reservation task has been completed, it will be removed from the reservation queue. At this point, the reservation result is considered to have been successfully executed, and the reservation result will be returned to the target user.
[0124] This embodiment provides a custom receipt generation method. When the amount of receipt generation data exceeds a preset data volume threshold, a reservation task for the target user is generated, and an idle-time execution tag is set for the target user's reservation task. The target user's reservation task is then stored in a reservation queue. When the resource occupancy rate is less than or equal to a preset occupancy rate threshold, a target task with the idle-time execution tag is selected from the reservation queue. When the target task is the target user's reservation task, the step of generating the corresponding receipt task based on the receipt generation data and structured configuration information is executed. This embodiment can generate corresponding custom receipts according to user-defined display elements and display styles, meeting the customization requirements of different users for receipt content. This improves the flexibility and convenience of the receipt generation function. When the data volume is large, the reservation method is used to make full use of idle resource periods and ensure the stable generation of large-volume receipts.
[0125] For example, to help understand the implementation process of the customized receipt generation method obtained by combining this embodiment with the above-described embodiment two, please refer to... Figure 7 , Figure 7 A simplified flowchart of a custom receipt generation method is provided, specifically:
[0126] 1) After editing the template, the user sends a request to generate a receipt, which supports selecting data on the page or querying data from the backend based on conditions.
[0127] 2) The backend will first verify the current user's operation permissions to prevent unauthorized users from downloading the receipt.
[0128] 3) Convert the data into object data in the backend based on the receipt template configuration.
[0129] 4) Prepare the data required to generate the receipt according to the type of receipt, split the data into different data blocks according to the size of the data, and generate a receipt task for each data block separately.
[0130] 5) The return order task will be put into an asynchronous thread pool for execution. The client polls the task progress. After the task is completed, the corresponding file ID will be returned. The return order can be downloaded based on the file ID.
[0131] 6) To achieve a unified process for generating receipts, a common model or object needs to be extracted. The receipt task model can encapsulate different types of receipts into the same task object, facilitating unified management by the receipt scheduling center. Different receipts only need to assemble the corresponding attributes. The receipt scheduling center distributes tasks to different receipt processors. The receipt processors process the acquired task data into a common receipt content object, and then call the subsequent common receipt generation process to generate the corresponding receipt.
[0132] 7) For downloading order volumes of extremely large amounts, a reservation method will be used. Order generation is resource-intensive; to fully utilize server idle time, users needing to download 100,000 orders can use a reservation system.
[0133] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the custom receipt generation method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.
[0134] This application also provides a custom receipt generation device; please refer to [reference needed]. Figure 8 The custom receipt generation device includes:
[0135] The permission verification module 10 is used to receive a receipt request sent by the target user and perform permission verification on the receipt request.
[0136] The receipt configuration module 20 is used to obtain the custom configuration information of the target user in the receipt template after the permission verification is passed, and convert the custom configuration information into structured configuration information. The custom configuration information includes at least display element information, display style information and personalized setting information.
[0137] The receipt configuration module 20 is also used to extract receipt generation data from the background database based on the receipt type selected by the target user.
[0138] The receipt generation module 30 is used to generate corresponding receipt tasks based on the receipt generation data and the structured configuration information.
[0139] The receipt generation module 30 is also used to execute the receipt task and generate a custom receipt for the target user.
[0140] In one feasible implementation, the receipt generation module 30 is further configured to divide the receipt generation data into multiple data blocks based on a preset data volume.
[0141] A general receipt task model is obtained. Based on the attributes set in the general receipt task model, the structured configuration information and the multiple data blocks are encapsulated to obtain multiple receipt tasks. Each receipt task encapsulates one data block. The attributes of the general receipt model include at least task information attributes and receipt data information attributes. The receipt data information attributes include at least configuration information attributes and task data attributes. The task data attributes include at least summary information attributes and detailed information attributes.
[0142] In one feasible implementation, the receipt generation module 30 is further configured to obtain a general receipt content model, and populate the general receipt content model based on the asynchronously executed multiple receipt tasks to obtain multiple target receipt content data. The attributes of the general receipt content model include at least title attributes, file name attributes, summary table attributes, detail table attributes, common configuration information attributes, and content data attributes. The content data attributes include at least summary information attributes, detail information attributes, summary field configuration attributes, and detail field configuration attributes.
[0143] The multiple target receipt content data are assembled to obtain assembled receipt content data;
[0144] Based on the assembly receipt data, the custom receipt is generated.
[0145] In one feasible implementation, the receipt generation module 30 is further configured to determine global rules for receipt generation based on the common configuration information in the assembled receipt content data;
[0146] The assembled receipt content data is rendered based on the global rules for receipt generation and the preset format to obtain the initial receipt;
[0147] The target electronic signature is embedded at a preset position on the initial receipt, and the position offset is calibrated to obtain a signed receipt;
[0148] The signed receipt is compressed based on a preset compression rate, and an electronic receipt watermark is added to obtain a customized receipt. The file identification information of the customized receipt is then returned to the target user.
[0149] In one feasible implementation, the receipt generation module 30 is further configured to obtain the execution progress of the receipt task when receiving the polling information from the target user;
[0150] When the execution progress of the return receipt task is in the stage of generating file identification information, it is determined that the customized return receipt has been generated and the completion information and the download link of the customized return receipt are sent to the target user.
[0151] If the execution progress of the return receipt task is not in the stage of generating file identification information, it is determined that the custom return receipt has not been completed, and the current progress is fed back to the target user.
[0152] In one feasible implementation, the receipt generation module 30 is further configured to generate the reservation task of the target user when the amount of data of the receipt generation data is greater than a preset data amount threshold, set an idle time execution tag for the reservation task of the target user, and store the reservation task of the target user in the reservation queue.
[0153] When the resource utilization rate is less than or equal to a preset utilization rate threshold, a target task with an idle time execution tag is selected from the reservation queue;
[0154] When the target task is the reservation task of the target user, the receipt generation data and the structured configuration information are obtained, and the step of generating the corresponding receipt task based on the receipt generation data and the structured configuration information is executed.
[0155] In one feasible implementation, the receipt generation module 30 is further configured to delete the target user's reservation task from the reservation queue, generate a corresponding reservation result, and return the reservation result to the target user.
[0156] In one feasible implementation, the permission verification module 10 is further configured to obtain the functional permissions of the target user, and if the function permissions of the target user include the receipt generation permission, the function permission verification is determined to be successful.
[0157] Based on the target user's role information, determine the target user's data permission scope;
[0158] The range of receipt data is determined based on the receipt type selected by the target user;
[0159] When the range of the receipt data matches the data permission range of the target user, the data permission verification is deemed successful.
[0160] The custom receipt generation device provided in this application, employing the custom receipt generation method described in the above embodiments, can solve the technical problem of being unable to personalize display elements and display styles, making it difficult to meet the customization requirements of different users for receipt content. Compared with the prior art, the beneficial effects of the custom receipt generation device provided in this application are the same as those of the custom receipt generation method provided in the above embodiments, and other technical features in the custom receipt generation device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0161] This application provides a custom receipt generation device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to execute the custom receipt generation method in Embodiment 1 above.
[0162] The following is for reference. Figure 9The diagram illustrates a structural schematic suitable for implementing a custom receipt generation device according to embodiments of this application. The custom receipt generation device in these embodiments may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital radio receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 9 The customized receipt generation device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0163] like Figure 9 As shown, the custom receipt generation device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in ROM (Read Only Memory) 1002 or a program loaded from storage device 1003 into RAM (Random Access Memory) 1004. RAM 1004 also stores various programs and data required for the operation of the custom receipt generation device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via bus 1005. Input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to I / O interface 1006: input devices 1007 including, for example, touch screens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows the custom receipt generation device to communicate wirelessly or wiredly with other devices to exchange data. While the figure shows custom receipt generation devices with various systems, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.
[0164] In particular, according to the embodiments disclosed in the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0165] The custom receipt generation device provided in this application, employing the custom receipt generation method described in the above embodiments, solves the technical problem of being unable to personalize display elements and styles, thus failing to meet the customization requirements of different users for receipt content. Compared with the prior art, the beneficial effects of the custom receipt generation device provided in this application are the same as those of the custom receipt generation method provided in the above embodiments, and other technical features of this custom receipt generation device are the same as those disclosed in the previous embodiment method, and will not be repeated here.
[0166] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0167] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0168] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the custom receipt generation method in the above embodiments.
[0169] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0170] The aforementioned computer-readable storage medium may be included in the custom receipt generation device; or it may exist independently and not assembled into the custom receipt generation device.
[0171] The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by the custom receipt generation device, the custom receipt generation device performs the following actions: receives a receipt request sent by a target user and verifies the request's permissions; after successful permission verification, it obtains the target user's custom configuration information in the receipt template and converts the custom configuration information into structured configuration information, which includes at least display element information, display style information, and personalized settings information; based on the receipt type selected by the target user, it extracts receipt generation data from the background database; based on the receipt generation data and the structured configuration information, it generates a corresponding receipt task; and it executes the receipt task to generate the target user's custom receipt.
[0172] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0173] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.
[0174] The modules described in the embodiments of the present application may be implemented in software or hardware, wherein the name of a module does not necessarily limit the unit itself.
[0175] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the aforementioned custom receipt generation method. This solves the technical problem of being unable to personalize display elements and display styles, making it difficult to meet the customization requirements of different users for receipt content. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the custom receipt generation method provided in the above embodiments, and will not be repeated here.
[0176] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the custom receipt generation method described above.
[0177] The computer program product provided in this application can solve the technical problem that it is impossible to personalize the display elements and display styles, making it difficult to meet the customization requirements of different users for receipt content. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the customized receipt generation method provided in the above embodiments, and will not be repeated here.
[0178] The above are only some embodiments of this application and do not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.
Claims
1. A method for generating custom receipts, characterized in that, The method includes: Receive a receipt request sent by the target user and perform permission verification on the receipt request; After the permission verification is passed, the custom configuration information of the target user in the receipt template is obtained, and the custom configuration information is converted into structured configuration information. The custom configuration information includes at least display element information, display style information and personalized settings information. Based on the order type selected by the target user, order generation data is extracted from the background database; Based on the receipt generation data and the structured configuration information, a corresponding receipt task is generated; Execute the receipt task to generate a custom receipt for the target user.
2. The method as described in claim 1, characterized in that, The step of generating the corresponding receipt task based on the receipt generation data and the structured configuration information includes: Based on a preset data volume, the receipt generation data is divided into multiple data blocks; A general receipt task model is obtained. Based on the attributes set in the general receipt task model, the structured configuration information and the multiple data blocks are encapsulated to obtain multiple receipt tasks. Each receipt task encapsulates one data block. The attributes of the general receipt model include at least task information attributes and receipt data information attributes. The receipt data information attributes include at least configuration information attributes and task data attributes. The task data attributes include at least summary information attributes and detailed information attributes.
3. The method as described in claim 2, characterized in that, The steps of executing the receipt task and generating a custom receipt for the target user include: Obtain a general receipt content model, and populate the general receipt content model based on the asynchronously executed multiple receipt tasks to obtain multiple target receipt content data. The attributes of the general receipt content model include at least title attributes, file name attributes, summary table attributes, detail table attributes, common configuration information attributes, and content data attributes. The content data attributes include at least summary information attributes, detail information attributes, summary field configuration attributes, and detail field configuration attributes. The multiple target receipt content data are assembled to obtain assembled receipt content data; Based on the assembly receipt data, the custom receipt is generated.
4. The method as described in claim 3, characterized in that, The step of generating the custom receipt based on the assembled receipt content data includes: Based on the common configuration information in the assembly receipt content data, determine the global rules for receipt generation; The assembled receipt content data is rendered based on the global rules for receipt generation and the preset format to obtain the initial receipt; The target electronic signature is embedded at a preset position on the initial receipt, and the position offset is calibrated to obtain a signed receipt; The signed receipt is compressed based on a preset compression rate, and an electronic receipt watermark is added to obtain a customized receipt. The file identification information of the customized receipt is then returned to the target user.
5. The method as described in claim 4, characterized in that, The method further includes: Upon receiving the polling information from the target user, the execution progress of the return order task is obtained; When the execution progress of the return receipt task is in the stage of generating file identification information, it is determined that the customized return receipt has been generated and the completion information and the download link of the customized return receipt are sent to the target user. If the execution progress of the return receipt task is not in the stage of generating file identification information, it is determined that the custom return receipt has not been completed, and the current progress is fed back to the target user.
6. The method as described in claim 1, characterized in that, The step of retrieving receipt generation data from the background database based on the receipt type selected by the target user further includes: When the amount of data generated by the receipt exceeds a preset data threshold, a reservation task for the target user is generated, an idle time execution tag is set for the reservation task of the target user, and the reservation task of the target user is stored in the reservation queue. When the resource utilization rate is less than or equal to a preset utilization rate threshold, a target task with an idle time execution tag is selected from the reservation queue; When the target task is the reservation task of the target user, the receipt generation data and the structured configuration information are obtained, and the step of generating the corresponding receipt task based on the receipt generation data and the structured configuration information is executed. After the step of executing the receipt task and generating the custom receipt for the target user, the method further includes: The reservation task of the target user is deleted from the reservation queue, and the corresponding reservation result is generated and returned to the target user.
7. The method according to any one of claims 1 to 6, characterized in that, The permission verification includes at least functional permission verification and data permission verification. The steps for performing permission verification on the receipt request include: Obtain the functional permissions of the target user. If the function permissions of the target user include the receipt generation permission, determine that the function permission verification has passed. Based on the target user's role information, determine the target user's data permission scope; The range of receipt data is determined based on the receipt type selected by the target user; When the range of the receipt data matches the data permission range of the target user, the data permission verification is deemed successful.
8. A custom receipt generation device, characterized in that, The device includes: The permission verification module is used to receive the receipt request sent by the target user and perform permission verification on the receipt request. The receipt configuration module is used to obtain the custom configuration information of the target user in the receipt template after the permission verification is passed, and convert the custom configuration information into structured configuration information. The custom configuration information includes at least display element information, display style information and personalized settings information. The receipt configuration module is also used to extract receipt generation data from the background database based on the receipt type selected by the target user. The receipt generation module is used to generate corresponding receipt tasks based on the receipt generation data and the structured configuration information; The receipt generation module is also used to execute the receipt task and generate a custom receipt for the target user.
9. A custom receipt generation device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the custom receipt generation method as described in any one of claims 1 to 7.
10. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the custom receipt generation method as described in any one of claims 1 to 7.