General data import method and device based on battery swap station operation and medium
Through the task scheduling mechanism based on message queue, the problem of frequent repeated development during the data import of battery swap stations is solved, and fast access and orderly processing are achieved, ensuring the accuracy and efficiency of the task.
Patent Information
- Application Number
- CN202410377638.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-12-29
- Filing Date
- 2024-03-29
- Publication Date
- 2025-07-08
AI Technical Summary
The existing technology has frequent and repeated developments during the import of battery swap station data, resulting in waste of development costs.
The task scheduling and coordination mechanism based on message queue is adopted, and the task batch messages are obtained, the task files are parsed, the service execution end is determined, and the service execution end is called for the task processing, the result file is generated and the processing results are updated, so as to achieve fast access and orderly processing.
It realizes fast access and orderly processing of battery swap station data import, reduces development costs, and ensures the accuracy and efficiency of task completion.
Smart Images

Figure CN120276881A_ABST
Abstract
Description
[0001] This application claims priority based on the invention patent application filed with the China National Patent Office on December 29, 2023, with the application number 202311870410.7 and the invention title "A General Data Import Method, Device and Medium Based on the Operation of Battery Swap Stations", and this application incorporates the full text of the above-mentioned Chinese patent application by reference. Technical Field
[0002] This application relates to the technical field of data processing, and in particular to a general data import method, device and medium based on the operation of battery swap stations. Background Art
[0003] With the rapid development of new energy vehicles and policy support, the current infrastructure of battery swap stations has taken initial shape. New energy vehicles replenish energy by directly replacing the battery, forming an effective scenario complement to the charging mode, and jointly promoting the continuous increase in the penetration rate of new energy vehicles.
[0004] With the continuous development of battery swap station business, in the operation of battery swap stations, data from multiple parties needs to be used. The demands for data import from multiple users such as finance and operation and maintenance are gradually increasing. However, the existing technology is difficult to control the risk of current system resource occupation when importing a large amount of data, and each system needs to perform frequent and repetitive development for specific import operations, resulting in a large amount of development costs being wasted during the data import process of battery swap stations. Summary of the Invention
[0005] The embodiments of this application provide a general data import method, device and medium based on the operation of battery swap stations to solve the following technical problems: Each system needs to perform frequent and repetitive development for specific import operations, resulting in a large amount of development costs being wasted during the data import process of battery swap stations.
[0006] The embodiments of this application adopt the following technical solutions:
[0007] The embodiments of this application provide a general data import method based on the operation of battery swap stations. The method includes: obtaining an import task message of general data during the operation of a battery swap station, and sending a task creation message to a message queue based on the import task message of general data; receiving a to-be-processed task identifier sent by the message queue, parsing a corresponding task file based on the to-be-processed task identifier, and obtaining a task batch message; based on the task batch message, saving task details, and determining a business execution end according to the parsed task file, and calling the business execution end to process the task based on a callback business execution end interface; obtaining a task completion event corresponding to the business execution end, generating a result file for storage, and updating the import task processing result.
[0008] In the embodiment of the present application, by receiving the to-be-processed task identifier sent by the message queue, parsing the corresponding task file based on the to-be-processed task identifier, and obtaining the task batch message. The multi-tasks are processed through the obtained batch message, the import requests are calculated and processed in batches, and the original data is made consistent and processed orderly through the final summary. Secondly, in the embodiment of the present application, based on the callback business execution end interface, the business execution end is called to process the task, the task completion event corresponding to the business execution end is obtained, the result file is generated and stored, and the import task processing result is updated, so as to process the task requests in batches and realize the fast access of the import requirements.
[0009] In an implementation manner of the present application, receiving the to-be-processed task identifier sent by the message queue, parsing the corresponding task file based on the to-be-processed task identifier, and obtaining the task batch message specifically includes: obtaining the reference task creation message sent by the message queue, parsing the task file corresponding to the reference task creation message, obtaining the parsing result, and sending the task batch message to the message queue and saving the task batch message; and, receiving the to-be-processed task identifier sent by the message queue, parsing the corresponding task file based on the to-be-processed task identifier to obtain the task type field; querying in the preset task type mapping table based on the task type field to determine the task type corresponding to the task type field; wherein, the preset task type mapping table includes multiple task types, and also includes the task type fields having a mapping relationship with the multiple task types; determining the corresponding task priority in the preset task priority table according to the task type, so as to obtain the task batch message based on the task priority.
[0010] In the embodiment of the present application, by determining the task type, the task priority can be determined according to the task type, so as to preferentially process different types of tasks in different queues and process urgent tasks in a timely manner.
[0011] In an implementation manner of the present application, receiving the to-be-processed task identifier sent by the message queue, parsing the corresponding task file based on the to-be-processed task identifier, and obtaining the task batch message specifically includes: determining the task file corresponding to the to-be-processed task identifier in the preset file repository, parsing the task file to obtain the task sequences corresponding to the multiple task contents in the task file; performing task batch allocation on the multiple task contents; sending the allocated task batches to the message queue to process the multiple task contents based on the task batches, and rearranging the multiple task contents based on the task sequences after the processing is completed.
[0012] The message queue in the embodiments of this application plays a role in task scheduling and coordination. By allocating multiple task contents in the same task into batches, it can quickly process multiple task contents. Moreover, through the task sequence stored in the task file, the processed tasks are rearranged to achieve the purpose of orderly data processing and ensuring consistency with the original data.
[0013] In one implementation of this application, according to the parsed task file, the business execution end is determined, and based on the callback business execution end interface, the business execution end is called to process tasks. Specifically, it includes: based on the parsing result, determining the business execution end, obtaining the corresponding request interface based on the callback address of the business execution end, so as to call the business execution end to process tasks; parsing the task file to obtain task parameter values; comparing the task parameter values with the reference task parameter values corresponding to the business execution end, and when the comparison result meets the execution conditions, sending the task parameter values to the business execution end.
[0014] The embodiments of this application obtain task parameter values and compare the task parameter values with the reference task parameter values corresponding to the business execution end. When the comparison result meets the execution conditions, the task parameter values are sent to the business execution end, thereby ensuring that the tasks received by each task execution end are within the processable range to ensure the timely and accurate completion of tasks.
[0015] In one implementation of this application, after updating the import task processing result, the method further includes: obtaining abnormal status task inspection information, and when detecting abnormal task information, triggering the task to be executed again, and repairing the data corresponding to the abnormal task details to complete the result import of the general data in the operation process of the battery swapping station.
[0016] In one implementation of this application, when detecting abnormal task information, triggering the task to be executed again and repairing the data corresponding to the abnormal task details specifically includes: detecting the imported tasks through the distributed task scheduling platform, and when detecting that the task is marked with an abnormal identifier, triggering the re-execution mechanism; obtaining the re-execution instruction sent by the distributed task scheduling platform to detect the details of the abnormal status task; where the details of the abnormal status task at least include one of task-related information, error cause, and imported data; determining the repair method based on the details of the abnormal status task to repair the data of the task marked with an abnormal identifier.
[0017] The embodiments of this application can repair abnormal data by re-executing the detected abnormal tasks and detecting the details of the abnormal status tasks, ensure the accuracy of task completion, and reduce error information.
[0018] In an implementation manner of the present application, when abnormal task information is detected, a task re-execution operation is triggered to repair the data corresponding to the abnormal task details, specifically including: monitoring the result file and the task processing result in real time through a distributed task scheduling platform; determining that the current task is abnormal when the result file of the current task is not generated and the task processing result is updated; obtaining a re-execution instruction sent by the distributed task scheduling platform to re-receive the task batch message corresponding to the task, and re-processing the task based on the task batch message.
[0019] In the embodiment of the present application, by monitoring the result file and the task processing result, it is determined that the task is abnormal. It can quickly respond when an abnormal task is detected, and repair the abnormal data by re-executing the task to ensure the accuracy and integrity of task processing.
[0020] In an implementation manner of the present application, before obtaining the task completion event corresponding to the service execution end, generating a result file for storage, and updating the import task processing result, the method further includes: obtaining the task completion information sent by the service execution end and updating the saved task detail information; sending a task completion message to the message queue; obtaining the task completion event corresponding to the service execution end, generating a result file for storage, and updating the import task processing result, specifically including: generating a result file when receiving the task completion event sent by the message queue, and uploading the result file to the preset file transfer protocol; updating the import task processing result when receiving the transfer success message sent by the preset file transfer protocol.
[0021] In the embodiment of the present application, by generating a result file, uploading the result file to the preset file transfer protocol, and updating the import of the result file, the status of the result file can be updated based on different steps, so as to achieve the purpose of file traceability.
[0022] In an implementation manner of the present application, after obtaining the task completion event corresponding to the service execution end, generating a result file for storage, and updating the import task processing result, the method further includes: calling back the service execution end interface to send the information that the result of the general data in the operation process of the battery swapping station has been imported to each service execution end; saving the information that the result has been imported by each service execution end, and constructing a data chart based on the saved information that the result has been imported and the historical result information; where at least one of the task type, task receiving time, and task completion time is included in the data chart; receiving the data charts corresponding to each service execution end respectively, and analyzing the data charts to determine the execution efficiency situation corresponding to each service execution end.
[0023] In an implementation manner of the present application, the data chart is analyzed to determine the execution efficiency of each business execution end, which specifically includes: obtaining the task receiving time and task completion time corresponding to the latest result imported information, so as to obtain the reference task completion duration corresponding to the latest result imported information through the task receiving time and task completion time; determining the historical task completion duration corresponding to the task type based on the task type corresponding to the latest result imported information; calculating the difference between the reference task completion duration and the historical task completion duration, and determining the execution efficiency of each business execution end based on the difference calculation result.
[0024] In the embodiment of the present application, by establishing a data chart for each business execution end, the task processing process of each execution end can be displayed through the data chart, so as to clearly obtain the task execution ability of each execution end. Furthermore, the tasks are allocated according to the execution ability of each execution end to ensure that the tasks are completed on time.
[0025] The embodiment of the present application provides a general data import device based on the operation of a battery swapping station, including: 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, and the instructions are executed by the at least one processor to enable the at least one processor to: obtain the import task message of the general data during the operation of the battery swapping station, and send a task creation message to the message queue based on the import task message of the general data; receive the to-be-processed task identifier sent by the message queue, parse the corresponding task file based on the to-be-processed task identifier, and obtain the task batch message; based on the task batch message, save the task details, determine the business execution end according to the parsed task file, and call the business execution end for task processing based on the callback business execution end interface; obtain the task completion event corresponding to the business execution end, generate a result file for storage, and update the import task processing result.
[0026] A non-volatile computer storage medium provided by the embodiment of the present application stores computer-executable instructions, and the computer-executable instructions are set to: obtain the import task message of the general data during the operation of the battery swapping station, and send a task creation message to the message queue based on the import task message of the general data; receive the to-be-processed task identifier sent by the message queue, parse the corresponding task file based on the to-be-processed task identifier, and obtain the task batch message; based on the task batch message, save the task details, determine the business execution end according to the parsed task file, and call the business execution end for task processing based on the callback business execution end interface; obtain the task completion event corresponding to the business execution end, generate a result file for storage, and update the import task processing result.
[0027] The above at least one technical solution adopted in the embodiments of the present application can achieve the following beneficial effects: By processing multitasks with the obtained batch messages, the import requests are calculated and processed in batches, and the original data is made consistent and processed orderly through final summarization, realizing the rapid access to import requirements. In addition, by detecting the details of tasks in abnormal states, the embodiments of the present application can repair abnormal data, ensure the accuracy of task completion, and reduce error information. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings described below are only some embodiments recorded in the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts. In the drawings:
[0029] Figure 1 FIG. 1 is a first flowchart of a general data import method based on the operation of a battery swapping station provided by an embodiment of the present application;
[0030] Figure 2 FIG. 2 is a second flowchart of a general data import method based on the operation of a battery swapping station provided by an embodiment of the present application;
[0031] Figure 3 FIG. 3 is a schematic structural diagram of a general data import device based on the operation of a battery swapping station provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0032] The embodiments of the present application provide a general data import method, device and medium based on the operation of a battery swapping station.
[0033] In order to enable those skilled in the art to better understand the technical solutions in the present application, the following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments of this specification, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0034] The technical solutions proposed in the embodiments of the present invention will be described in detail below with reference to the drawings.
[0035] Figure 1 FIG. 1 is a first flowchart of a general data import method based on the operation of a battery swapping station provided by an embodiment of the present application. As Figure 1 shown, the general data import method based on the operation of a battery swapping station includes the following steps:
[0036] S101. Obtain the import task message of the general data during the operation of the battery swapping station, and send a task creation message to the message queue based on the import task message of the general data.
[0037] In an embodiment of the present application, the UI front end imports the general data request of the battery swapping station operation into the central gateway. After receiving it, the central gateway forwards the request to send the request to the import service. The import service stores the file corresponding to the request in the preset file transfer protocol. After receiving the request, the preset file transfer protocol sends a successful return message to the import service. After receiving the successful return message, the import service sends a task creation message to the message queue. After receiving the task creation message, the message queue sends a successful return message to the import service. The import service sends the successful return message to the import gateway center and returns it to the UI front end through the import gateway center.
[0038] S102. Receive the to-be-processed task identifier sent by the message queue, parse the corresponding task file based on the to-be-processed task identifier, and obtain the task batch message.
[0039] In an embodiment of the present application, obtain the reference task creation message sent by the message queue, parse the task file corresponding to the reference task creation message, obtain the parsing result, and send a task batch message to the message queue and save the task batch message; and receive the to-be-processed task identifier sent by the message queue, parse the corresponding task file based on the to-be-processed task identifier to obtain the task type field; query in the preset task type mapping table based on the task type field to determine the task type corresponding to the task type field; where the preset task type mapping table includes multiple task types and also includes task type fields that have a mapping relationship with the multiple task types; determine the corresponding task priority in the preset task priority table according to the task type to obtain the task batch message based on the task priority.
[0040] Specifically, in the embodiment of the present application, a preset task type mapping table is set. The preset task type mapping table includes multiple different task types and also includes task type fields corresponding to the multiple different task types respectively. Among them, the task type has a mapping relationship with the corresponding task type field, and the corresponding task type can be queried through the task type field.
[0041] Further, in the embodiment of the present application, the message queue sends a task creation message to the import service, and the task creation message corresponds to the import request sent by the UI front end. After obtaining the task creation message, the import service obtains the corresponding task identifier to be processed, and parses the corresponding file content based on the task identifier to be processed to obtain the corresponding task type field. The task identifier to be processed is a unique identifier, such as UUID (Universally Unique Identifier), task ID, etc., and is used to uniquely identify a task in the system. Query in the preset task type table according to the task type field to determine the task type that has a mapping relationship with the task type field.
[0042] Further, in the embodiment of the present application, a preset task priority table is provided. The preset task priority table includes multiple task types, and also includes the task priorities corresponding to the multiple task types respectively. Query the currently determined task type in the preset task priority table to determine the priority corresponding to the task type, and determine the task batch message according to the task priority.
[0043] For example, if the task priority is high, it means that the current task is more important and needs to be processed as soon as possible, so the task batch is more forward.
[0044] In an embodiment of the present application, determine the task file corresponding to the task identifier to be processed in the preset file repository, parse the task file to obtain the task sequences corresponding to the multiple task contents in the task file. Perform task batch allocation on the multiple task contents. Send the allocated task batch to the message queue to process the multiple task contents based on the task batch, and rearrange the multiple task contents based on the task sequence after the processing is completed.
[0045] Specifically, quickly locate the corresponding task file according to the received task identifier to be processed, and use a preset parser or parsing rule to parse the file content to obtain the task sequences corresponding to the multiple task contents in the task file. The task sequence can be a number, timestamp, or any other form of sequence information that identifies the task execution order. Secondly, perform task batch allocation on the multiple task contents. For example, task contents with similar attributes or that can be processed in parallel can be combined into a batch to improve the processing efficiency. The allocated task batch is sent to the message queue for waiting to be processed. The message queue is responsible for distributing the task batch to the corresponding consumers. The consumers take out the task batch from the message queue and perform corresponding processing according to the task contents in the batch. After all the task contents are processed, it is necessary to rearrange the processing results according to the original task sequence to ensure that the order of the processed task contents is consistent with the order in the original task file.
[0046] In the embodiments of the present application, by reasonably allocating task batches and using task sequences, a large amount of task content can be efficiently processed, and the correctness and orderliness of the processing results can be ensured.
[0047] S103. Based on the task batch message, save the task details, and based on the parsed task file, determine the service execution end. Based on the callback service execution end interface, call the service execution end to process the task.
[0048] In an embodiment of the present application, the task file is parsed to obtain task parameter values. After determining the service execution end based on the parsed task file, the method further includes comparing the task parameter values with the reference task parameter values corresponding to the service execution end, and when the comparison result meets the execution conditions, sending the task parameter values to the service execution end.
[0049] Specifically, after obtaining the task file, parsing the task file can also obtain the task parameter values corresponding to the task file. According to the determined task type, the service execution end required to complete the task type can be determined. Obtain the reference task parameter values corresponding to the required service execution end, compare the task parameter values parsed from the task file with the reference task parameter values, and determine the similarity between the two.
[0050] Furthermore, if the similarity meets the preset threshold, the task parameter values corresponding to the current task file meet the requirements, and the task can be processed by this service execution end. If the similarity does not meet the preset threshold, it means that the task parameter values corresponding to the current task file do not meet the requirements. For example, the task difficulty exceeds the range that this service execution end can execute. At this time, the service execution end can be replaced to ensure that the task can be executed smoothly.
[0051] In an embodiment of the present application, obtain the reference task creation message sent by the message queue. Parse the task file corresponding to the reference task creation message, obtain the parsing result, and send a task batch message to the message queue. Obtain the reference task batch message sent by the message queue, and save the reference task batch message. Based on the parsing result, determine the service execution end, and obtain the corresponding request interface based on the service execution end callback address to call the service execution end to process the task.
[0052] Specifically, the import service obtains the reference task creation message sent by the message queue, the import service parses the file content corresponding to the reference task creation message, and sends a task batch message to the message queue.
[0053] For example, if the content of the current task file is relatively important, or needs to be completed in a short time, the task batch sent to the message queue is advanced so that the task can be executed in a short time.
[0054] After receiving the task batch message, the message queue sends a success return message to the import service. Based on the task batch message, the message queue sends a reference task batch message to the import service, and the import service saves the task details of the obtained reference task batch message.
[0055] For example, if the current imported data is consumption data, the message queue sends a consumption task batch message to the import service based on the task. The import service parses the file content according to the received consumption batch message to determine the corresponding business execution port.
[0056] Furthermore, the import service obtains the corresponding business execution end according to the parsing result of the task file, obtains the corresponding request interface according to the callback address of the business execution end, so as to call the corresponding business execution end and process the current task.
[0057] S104: Obtain the task completion event corresponding to the business execution end, generate a result file for storage, and update the import task processing result.
[0058] In one embodiment of the present application, the task completion information sent by the business execution end is obtained, and the saved task detail information is updated. A task completion message is sent to a message queue. The task completion event corresponding to the business execution end is obtained, a result file is generated for storage, and the import task processing result is updated, specifically including: when a task completion event sent by the message queue is received, a result file is generated, and the result file is uploaded to a preset file transfer protocol. When a transmission success message sent by the preset file transfer protocol is received, the import task processing result is updated.
[0059] Specifically, the import service obtains the task completion information sent by the business execution end, and the import service updates the saved task details information according to the obtained task completion information. After the update is completed, the import service sends the task completion information to the message queue, and the message queue returns a successful return value to the import service after receiving the task completion information. The message queue sends a task completion event to the import service, and the import service generates a result file based on the received task completion event. The import service sends the result file to the preset file transfer protocol, and the preset file transfer protocol sends return information to the import service when receiving the result file. When the import service receives the return information, it updates the result file and updates the import task processing result.
[0060] In an embodiment of the present application, the callback business execution end interface sends the imported information of the results of the general data in the operation process of the battery swapping station to each business execution end. Each business execution end saves the imported information of the results, and constructs a data chart based on the saved imported information of the results and the historical result information; wherein, the data chart includes at least one of the task type, the task receiving time, and the task completion time. Receive the data charts corresponding to each business execution end respectively, and analyze the data charts to determine the execution efficiency conditions corresponding to each business execution end respectively.
[0061] Specifically, after the import service updates and imports the task results, it calls back each business execution end to inform each business execution end that the import task has been completed. After each business execution end receives the imported information of the results, it saves the imported information of the results. Secondly, according to the currently saved imported information of the results and the saved historical imported information of the results, it constructs a data chart.
[0062] Further, the data chart can display the task types corresponding to each task, for example, it can be a consumption data type or a salary data type, etc., and also display the receiving time when the business execution end receives each task, and the completion time when each business execution end completes each task.
[0063] Further, each business execution end sends the drawn data chart to the import service, and the import service analyzes the task execution efficiency of each business execution end according to the obtained chart data.
[0064] In an embodiment of the present application, obtain the task receiving time and the task completion time corresponding to the latest imported information of the results, so as to obtain the reference task completion duration corresponding to the latest imported information of the results through the task receiving time and the task completion time. Based on the task type corresponding to the latest imported information of the results, determine the historical task completion duration corresponding to the task type. Calculate the difference between the reference task completion duration and the historical task completion duration, and based on the difference calculation result, determine the execution efficiency conditions corresponding to each business execution end respectively.
[0065] For example, the import center analyzes the data charts of the business execution ends corresponding to the tasks of the consumption type. According to the obtained task receiving time and task completion time of each business execution end, the reference task completion duration required for each business execution end to execute the task of the consumption type can be calculated. Secondly, according to the historical data in the chart data, determine the historical task completion duration required for each business execution end to execute the historical tasks of the consumption type.
[0066] Further, compare the reference task completion duration corresponding to each service execution end with the historical task completion duration, and obtain the difference between the two. If the difference is greater than the preset duration threshold, it indicates that the current reference task completion duration is relatively long, and the execution efficiency of this service execution end needs to be improved. If the difference is less than the preset duration threshold, it indicates that the current reference task completion duration meets the requirements, and the execution efficiency of this service execution end meets the requirements.
[0067] In an embodiment of the present application, abnormal status task inspection information is obtained. When it is detected that there is abnormal task information, a task re-execution operation is triggered to repair the data corresponding to the abnormal task details, so as to complete the result import of general data in the operation process of the battery swapping station.
[0068] Specifically, the inspection information may include the execution status of the task, the generation situation of the result file, the data processing result, etc. Through inspection, tasks that have not been successfully executed or whose results do not meet expectations can be discovered in a timely manner and marked as abnormal status tasks. After determining that there are abnormal tasks, a task re-execution operation needs to be triggered to repair the abnormal tasks. By effectively handling the abnormal tasks in the operation process of the battery swapping station, the correct import of general data results can be ensured, thereby improving the operation efficiency and data quality of the battery swapping station.
[0069] In an embodiment of the present application, the imported tasks are detected through a distributed task scheduling platform. When it is detected that a task is marked with an abnormal identifier, a re-execution mechanism is triggered. Obtain the re-execution instruction sent by the distributed task scheduling platform to detect the details of the abnormal status task; wherein, the details of the abnormal status task at least include one of task-related information, error reason, and imported data. Determine the repair method based on the details of the abnormal status task to repair the data of the task marked with an abnormal identifier.
[0070] Specifically, during the general data import process, some tasks may fail to execute or be abnormal. To solve these problems, a corresponding exception handling mechanism can be set during the import process. Once it is detected that a task execution is abnormal, a re-execution operation is triggered. Abnormal status task inspection: After triggering the re-execution, the system needs to perform an inspection of the abnormal status tasks. This involves monitoring and checking the status of the imported tasks to find out the tasks that have failed to execute or are abnormal.
[0071] Furthermore, once a task in an abnormal state is detected, the system needs to provide relevant task details, including task-related information, error reasons, imported data, etc. These details can be used for subsequent troubleshooting and handling. For tasks in an abnormal state, perform operations on the task details. This may include re-executing the task, fixing data errors, re-importing data, etc. Depending on the specific situation, the system can provide a graphical interface or command-line tools for operators to execute the task details. When executing the task details, the system can provide a mechanism for exception notification and feedback. This can include sending notifications to relevant personnel, informing them of the abnormal state and processing progress of the task, and providing a problem feedback channel for users to report abnormal situations.
[0072] Furthermore, in some cases, task failure may be caused by data errors. The system may provide some tools or options to fix these data errors. This can include data verification, error correction algorithms, data restoration, etc. By fixing data errors, it can be ensured that the task can be successfully executed. If the task involves importing data and an abnormal state occurs, you can try to re-import the data. The system may provide an option or interface to re-import the data, allowing users to re-select the data files to be imported and re-execute the task. The specific data repair and data import methods depend on the specific requirements of the task and the implementation of the system. For example, data verification algorithms can be used to detect and fix data errors. For example, the integrity, consistency, and validity of the data can be checked, and any errors can be tried to be corrected. If data errors are found, the system may provide options to automatically fix the errors or manually correct them. If the task involves importing data, an interface can be provided to select the data files to be imported and specify import options, such as data mapping, field conversion, etc. The system may also provide some data verification functions, such as checking data formats, deduplication, etc.
[0073] In an embodiment of the present application, the result file and the task processing result are monitored in real time through a distributed task scheduling platform. In the case where the current task has not generated a result file and the task processing result is updated, it is determined that the current task is abnormal. Obtain the re-execution instruction sent by the distributed task scheduling platform to re-receive the task batch message corresponding to the task, and re-process the task based on the task batch message.
[0074] Specifically, the distributed task scheduling platform has the ability to monitor the generation status of result files and the task processing results in real time, and can continuously track the entire process of task processing. The result file includes the task completion result, for example, the task completed result or the task uncompleted result. The task processing result contains key information during the task execution process, such as the task status (whether the task is in execution), the task execution address, etc. Regularly check whether the current task has generated the expected result file. At the same time, it also checks whether the task processing result has been updated, for example, it can include checking database records, log outputs, task status flags, and task addresses. If it is found during the inspection that the current task has not generated a result file and the task processing result has been updated, it will be determined that the task may have an exception.
[0075] Furthermore, once it is determined that the task has an exception, the distributed task scheduling platform will generate a re-execution instruction. After the re-execution instruction, it will re-obtain the task batch message corresponding to the task from the message queue to re-process the task. After the processing is completed, a new result file will be generated and the status of the task processing result will be updated.
[0076] The embodiment of the present application ensures that the task can be correctly completed and the expected result file can be generated by timely discovering and handling exceptions during the task execution process. Thereby improving the reliability and efficiency of task processing and reducing data loss or errors caused by exceptions.
[0077] Figure 2 This is the second flowchart of a general data import method based on the operation of a battery swapping station provided by the embodiment of the present application. As Figure 2 shown, the general data import method based on the operation of a battery swapping station includes the following steps:
[0078] S201. Obtain the import task message of the general data during the operation of the battery swapping station, and send a task creation message to the message queue based on the import task message of the general data.
[0079] S202. Receive the task file sent by the message queue, parse the task file, and obtain the task batch message.
[0080] S203. Based on the task batch message, save the task details, and determine the business execution end according to the parsed task file. Based on the callback business execution end interface, call the business execution end to process the task.
[0081] S204. Obtain the task completion event corresponding to the business execution end, generate a result file for storage, and update the data import result.
[0082] S205. Obtain the patrol inspection information of the abnormal status tasks. When detecting the existence of abnormal task information, trigger the task to be executed again, and repair the data corresponding to the abnormal task details, so as to complete the result import of the general data in the operation process of the battery swapping station.
[0083] Figure 3 This is a schematic structural diagram of a general data import device based on the operation of a battery swapping station provided by an embodiment of the present application. As Figure 3 shown, the general data import device based on the operation of the battery swapping station 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, and the instructions are executed by the at least one processor, so that the at least one processor can: obtain the import task message of the general data in the operation process of the battery swapping station, and send a task creation message to the message queue based on the import task message of the general data; receive the to-be-processed task identifier sent by the message queue, parse the corresponding task file based on the to-be-processed task identifier, and obtain the task batch message; based on the task batch message, save the task details, and determine the service execution end according to the parsed task file, and call the service execution end for task processing based on the callback service execution end interface; obtain the task completion event corresponding to the service execution end, generate a result file for storage, and update the import task processing result.
[0084] A non-volatile computer storage medium provided by an embodiment of the present application stores computer-executable instructions, and the computer-executable instructions are set to: obtain the import task message of the general data in the operation process of the battery swapping station, and send a task creation message to the message queue based on the import task message of the general data; receive the to-be-processed task identifier sent by the message queue, parse the corresponding task file based on the to-be-processed task identifier, and obtain the task batch message; based on the task batch message, save the task details, and determine the service execution end according to the parsed task file, and call the service execution end for task processing based on the callback service execution end interface; obtain the task completion event corresponding to the service execution end, generate a result file for storage, and update the import task processing result.
[0085] Each embodiment in the present application is described in a progressive manner. The same or similar parts among the embodiments can be referred to each other, and the differences between each embodiment and other embodiments are emphasized. In particular, for the embodiments of the device, equipment, and non-volatile computer storage medium, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiments.
[0086] The above are only examples of the present application and are not intended to limit the present application. For those skilled in the art, various changes and modifications can be made to the embodiments of the present application. These modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A general data import method based on the operation of battery swapping stations, characterized in that, The method includes: Obtaining an import task message of general data during the operation of the battery swapping station, and sending a task creation message to the message queue based on the import task message of the general data; Receiving a to-be-processed task identifier sent by the message queue, parsing a corresponding task file based on the to-be-processed task identifier, and obtaining a task batch message; Based on the task batch message, saving task details, determining a service execution end according to the parsed task file, and calling the service execution end to process the task based on the callback service execution end interface; Obtaining a task completion event corresponding to the service execution end, generating a result file for storage, and updating the import task processing result.
2. The general data import method based on the operation of a battery swapping station according to claim 1, wherein, The step of receiving a to-be-processed task identifier sent by the message queue, parsing a corresponding task file based on the to-be-processed task identifier, and obtaining a task batch message specifically includes: Obtaining a reference task creation message sent by the message queue, Parsing the task file corresponding to the reference task creation message, obtaining a parsing result, sending a task batch message to the message queue, and saving the task batch message; and receiving a to-be-processed task identifier sent by the message queue, parsing a corresponding task file based on the to-be-processed task identifier to obtain a task type field; Querying in a preset task type mapping table based on the task type field to determine the task type corresponding to the task type field; wherein, the preset task type mapping table includes multiple task types, and also includes task type fields having a mapping relationship with the multiple task types; Determining a corresponding task priority in a preset task priority table according to the task type, so as to obtain the task batch message based on the task priority.
3. A general data import method based on the operation of a battery swapping station according to claim 1, characterized in that, The step of receiving a to-be-processed task identifier sent by the message queue, parsing a corresponding task file based on the to-be-processed task identifier, and obtaining a task batch message specifically includes: Determining a task file corresponding to the to-be-processed task identifier in a preset file repository, parsing the task file to obtain task sequences corresponding to multiple task contents in the task file; Performing task batch allocation on the multiple task contents; Sending the allocated task batch to the message queue to process the multiple task contents based on the task batch, and rearranging the multiple task contents based on the task sequences after the processing is completed.
4. A general data import method based on the operation of a battery swapping station according to claim 1, characterized in that, The step of determining a service execution end according to the parsed task file, and calling the service execution end to process the task based on the callback service execution end interface specifically includes: Determining the service execution end based on the parsing result, obtaining a corresponding request interface based on the service execution end callback address, and calling the service execution end to process the task; Parsing the task file to obtain task parameter values; Comparing the task parameter values with reference task parameter values corresponding to the service execution end, and sending the task parameter values to the service execution end when the comparison result meets the execution conditions.
5. A general data import method based on the operation of a battery swapping station according to claim 1, characterized in that, After updating the import task processing result, the method further includes: Obtain the patrol inspection information of the abnormal status task. When abnormal task information is detected, trigger the task to execute again, and repair the data corresponding to the abnormal task details, so as to complete the result import of the general data in the operation process of the battery swapping station.
6. A general data import method based on the operation of a battery swapping station according to claim 5, characterized in that, When abnormal task information is detected, trigger the task to execute again, and repair the data corresponding to the abnormal task details, specifically including: Detect the imported task through the distributed task scheduling platform. When it is detected that the task is marked with an abnormal identifier, trigger the re-execution mechanism; Obtain the re-execution instruction sent by the distributed task scheduling platform to detect the details of the abnormal status task; wherein, the details of the abnormal status task at least include one of task-related information, error reason, and imported data; Determine the repair method based on the details of the abnormal status task to repair the data of the task marked with an abnormal identifier.
7. A general data import method based on the operation of a battery swapping station according to claim 5, characterized in that, When abnormal task information is detected, trigger the task to execute again, and repair the data corresponding to the abnormal task details, specifically including: Monitor the result file and the task processing result in real time through the distributed task scheduling platform; When the result file of the current task is not generated and the task processing result is updated, determine that the current task is abnormal; Obtain the re-execution instruction sent by the distributed task scheduling platform to re-receive the task batch message corresponding to the task, and re-process the task based on the task batch message.
8. A general data import method based on the operation of a battery swapping station according to claim 1, wherein, Before obtaining the task completion event corresponding to the business execution end, generating a result file for storage, and updating the import task processing result, the method further includes: Obtain the task completion information sent by the business execution end and update the saved task details information; Send a task completion message to the message queue; Obtaining the task completion event corresponding to the business execution end, generating a result file for storage, and updating the import task processing result, specifically including: When receiving the task completion event sent by the message queue, generate a result file and upload the result file to the preset file transfer protocol; When receiving the transmission success message sent by the preset file transfer protocol, update the import task processing result.
9. A general data import method based on the operation of a battery swapping station according to claim 1, characterized in that, After obtaining the task completion event corresponding to the business execution end, generating a result file for storage, and updating the import task processing result, the method further includes: Callback the business execution end interface and send the information that the general data result in the operation process of the battery swapping station has been imported to each business execution end; Save the imported information by each business execution end, and construct a data chart based on the saved imported information and historical result information; wherein, the data chart at least includes one of task type, task reception time, and task completion time; Receive the data charts corresponding to each business execution end respectively, and analyze the data charts to determine the execution efficiency of each business execution end respectively.
10. A general data import method based on the operation of a battery swapping station according to claim 9, characterized in that, Analyze the data chart to determine the execution efficiency of each business execution end, specifically including: Obtain the task receiving time and task completion time corresponding to the latest result imported information, and obtain the reference task completion duration corresponding to the latest result imported information through the task receiving time and the task completion time; Based on the task type corresponding to the latest result imported information, determine the historical task completion duration corresponding to the task type; Calculate the difference between the reference task completion duration and the historical task completion duration, and determine the execution efficiency of each business execution end based on the difference calculation result.
11. A general data import device based on the operation of a battery swapping station, characterized in that, The device includes a memory for storing computer program instructions and a processor for executing the program instructions. When the computer program instructions are executed by the processor, the device is triggered to execute the method described in any one of claims 1-10.
12. A non-volatile computer storage medium stores computer-executable instructions, characterized in that, The computer-executable instructions can execute the method described in any one of claims 1-10.