File numbering method, device, equipment, medium and product
By automatically matching the numbering rules and parsing them character by character, the file number is dynamically generated, which solves the problem of low numbering efficiency in the existing technology and achieves efficient and flexible file number generation.
Patent Information
- Application Number
- CN202411399253.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-09
- Publication Date
- 2025-01-24
AI Technical Summary
The existing archive numbering method is inefficient, especially when the numbering rules change, it requires in-depth modifications at the code level, resulting in inefficiency.
By obtaining the ownership institution of the file to be numbered, the corresponding numbering rules are automatically matched, and through character-by-character analysis, the parsed characters corresponding to each numbered character are dynamically generated, and finally combined into the target file number.
It improves the generating efficiency of the file number, reduces the code modification workload caused by changes in the rules, and enhances the flexibility and automation of the number.
Smart Images

Figure CN119358535A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of big data processing technology, and in particular, relates to a file numbering method, device, equipment, medium and product. Background Art
[0002] In the current archive management system, with the rapid increase in the number of archives and the increasing complexity of archive management rules, the generation and management of archive numbers has become a key link in improving system efficiency and flexibility. Existing archive numbering methods mostly use string concatenation to generate archive numbers. Although this method can meet basic numbering requirements, when the generation rules of archive numbers change, developers have to modify them at the code level, resulting in low efficiency of archive numbering. Summary of the invention
[0003] The embodiments of the present application provide a file numbering method, device, equipment, medium and product, which can improve the efficiency of file numbering.
[0004] In a first aspect, an embodiment of the present application provides a file numbering method, the method comprising:
[0005] Obtain the file to be numbered, which includes the target file identifier;
[0006] Acquire a target numbering rule that matches the institution to which the to-be-numbered file belongs from the first mapping relationship, the target numbering rule includes a plurality of numbering characters, and the first mapping relationship includes a one-to-one correspondence between a plurality of institutions and a plurality of numbering rules;
[0007] Parsing the first character according to the character type of the first character and the target file identifier to obtain a parsed character corresponding to the first character, wherein the first character is any numbered character among a plurality of numbered characters;
[0008] When each numbering character has been parsed, the parsed characters corresponding to each numbering character are combined based on the target numbering rule to obtain the target file number of the file to be numbered.
[0009] In a second aspect, an embodiment of the present application provides a file numbering device, the device comprising:
[0010] A first acquisition module is used to acquire a file to be numbered, wherein the file to be numbered includes a target file identifier;
[0011] A second acquisition module is used to acquire a target numbering rule that matches the institution to which the to-be-numbered file belongs from the first mapping relationship, the target numbering rule includes a plurality of numbering characters, and the first mapping relationship includes a one-to-one correspondence between a plurality of institutions and a plurality of numbering rules;
[0012] a parsing module, configured to parse the first character according to the character type of the first character and the target file identifier to obtain a parsed character corresponding to the first character, wherein the first character is any numbered character among the plurality of numbered characters;
[0013] The combination module is used to combine the parsed characters corresponding to each numbering character based on the target numbering rule when each numbering character has been parsed, so as to obtain the target file number of the file to be numbered.
[0014] In a third aspect, an embodiment of the present application provides an electronic device, the device comprising: a processor and a memory storing computer program instructions;
[0015] When the processor executes the computer program instructions, the processor implements any possible implementation method of the first aspect described above.
[0016] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implements a method in any possible implementation method of the first aspect described above.
[0017] In a fifth aspect, an embodiment of the present application provides a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes a method as any possible implementation method in the first aspect above.
[0018] In the archive numbering method, device, equipment, medium and product provided in the embodiment of the present application, in the archive numbering generation process, firstly, the corresponding numbering rule is automatically matched according to the archive's belonging institution, and this process does not require manual intervention, thereby improving the automation of numbering generation. Subsequently, by means of character-by-character parsing, the parsing characters corresponding to each numbering character are dynamically generated according to the character type and the target archive identification. This fine-grained processing method not only enhances the flexibility of numbering, but also avoids redundant calculations and duplication of work in the traditional string concatenation method. Finally, the parsed parsing characters are combined into the target archive number according to the numbering rule, thereby realizing the rapid generation of numbering. Thus, the workload of code modification caused by rule changes is reduced, and the generation efficiency of archive numbering is significantly improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0020] Figure 1This is one of the flow charts of a file numbering method provided in an embodiment of the present application;
[0021] Figure 2 This is the second flow chart of a file numbering method provided in an embodiment of the present application;
[0022] Figure 3 This is a flowchart of a file numbering method provided in an embodiment of the present application;
[0023] Figure 4 It is a structural schematic diagram of a file numbering device provided in an embodiment of the present application;
[0024] Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0026] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0027] In addition, the acquisition, storage, use, and processing of data in the technical solution of this application comply with the relevant provisions of national laws and regulations.
[0028] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0029] Thus, in order to solve the problems of the prior art, the embodiments of the present application provide a file numbering method, device, equipment, medium and product.
[0030] The following first introduces the file numbering method provided in the embodiment of the present application.
[0031] Figure 1 FIG. 1 is a flow chart of a method for file numbering provided in an embodiment of the present application. Figure 1 As shown, the file numbering method provided in the embodiment of the present application includes the following steps:
[0032] S100, obtaining a file to be numbered, wherein the file to be numbered includes a target file identifier.
[0033] Optionally, archives to be numbered refer to those archive files or records that have not yet been assigned a unique number. In the archive management system, these archives may have just been created, collected or transferred into the system and have not yet been numbered. Therefore, a unique identifier needs to be generated through a certain numbering method to facilitate subsequent retrieval, management and archiving. Archives to be numbered can contain various types of information, such as documents, pictures, audio, video, etc., but no matter what form they are in, they need to go through the numbering process to ensure their uniqueness and traceability in the system.
[0034] The target file identifier is the information or code used to uniquely identify the file in the file to be numbered. It can be automatically generated by the system (such as timestamp + serial number, etc.), or provided by the user or external system (such as the unique identification code specified in the file numbering request). The purpose of the target file identifier is to ensure that each file can be uniquely identified and located in the file management system. In the numbering process, the target file identifier is used as one of the input parameters to guide the matching of numbering rules and the parsing process of numbering characters.
[0035] Optionally, in a feasible implementation of the present application, when a file numbering request is received from a user or other business system, an event is first triggered or a service interface is called to start the generation process of the file numbering. In order to achieve this goal, an interface can be designed to allow the user or external system to submit the relevant information of the file to be numbered to the system by input, upload or selection. This information may include the name, type, creation time, storage location, etc. of the file, but the most critical is the target file identification, which can be the unique identification code, serial number or any information that can uniquely identify the file. After the user or external system submits this information, the system will perform preliminary data verification and cleaning to ensure the accuracy and completeness of the information.
[0036] Subsequently, the system will store the verified files to be numbered in the database. When the system is ready to generate numbers, it will retrieve the information of all the files to be numbered from the database or cache, especially the target file identifier. This retrieval process can be based on specific query conditions, such as the submission time, type or affiliated institution of the file, to ensure that only the files that currently need to be numbered are processed.
[0037] S200, obtaining a target numbering rule that matches the institution to which the to-be-numbered file belongs from a first mapping relationship, wherein the target numbering rule includes a plurality of numbering characters, and the first mapping relationship includes a one-to-one correspondence between a plurality of institutions and a plurality of numbering rules.
[0038] Optionally, the first mapping relationship is a predefined data structure, and the first mapping relationship establishes a one-to-one correspondence between different institutions in the system and their respective numbering rules. This mapping relationship can be a table stored in a database, or a data structure in memory, such as a hash table, a dictionary, etc. The first mapping relationship records the unique numbering rule corresponding to each institution, so that when the system processes the files to be numbered, it can quickly find the corresponding numbering rule according to the institution to which the files belong.
[0039] The organization to which the archive to be numbered belongs refers to the organization or department to which the archive to be numbered belongs. This organization information can be stored as part of the archive metadata and used in the numbering process to determine which numbering rule should be used.
[0040] The target numbering rule refers to the numbering rule that matches the institution to which the archive to be numbered belongs. This rule defines the format and generation method of the archive number, including the type of characters that should be included in the number, the number of characters, the order of characters, and whether dynamic replacement is required based on the specific information of the archive (such as the target archive identification, date, etc.). The target numbering rule is the core basis of the numbering process, which determines the uniqueness and readability of the final generated archive number.
[0041] Optionally, in a feasible implementation of the present application, the information of the affiliated institution in the to-be-numbered file is first extracted, which can be obtained by parsing the target file identifier or querying the file metadata in the database. Once the affiliated institution information is obtained, the system will use the affiliated institution information as a search key to query the corresponding record in the first mapping relationship table or database.
[0042] This first mapping relationship or database is a predefined data structure that stores the correspondence between all institutions in the system and their respective numbering rules. Each row or record represents an institution and its corresponding numbering rule, where the numbering rule can exist in the form of a string template, containing multiple numbering characters, which can be static text characters or placeholders that need to be dynamically replaced according to the specific information of the archive (such as the target archive ID, date, etc.).
[0043] The system finds the records that match the institution to which the archives to be numbered belong by traversing the mapping table or performing database query operations, and extracts the target numbering rules from them. This rule will serve as the basis for subsequent numbering character parsing and combination.
[0044] It is worth noting that in order to ensure the accuracy and real-time nature of the mapping relationship, the system needs to regularly maintain and update the first mapping relationship or database. This includes operations such as adding new institutions and their numbering rules, modifying the numbering rules of existing institutions, or deleting institution records that are no longer in use. These maintenance operations can be completed through the system administrator interface or automated scripts to ensure the stability and availability of the numbering system.
[0045] S300: Parse the first character according to the character type of the first character and the target file identifier to obtain a parsed character corresponding to the first character, where the first character is any one of the multiple numbered characters.
[0046] Optionally, the character type refers to the data type or functional attribute represented by the numbering character. In the archive numbering rules, the numbering characters can be static text characters (such as letters, numbers, special symbols, etc.) or dynamic placeholders or variables, which need to be replaced or calculated based on the specific information of the archive (such as the target archive ID, date, serial number, etc.). The character type determines how the system treats the character and what parsing strategy needs to be adopted to generate or replace the corresponding parsing character.
[0047] Numbering characters refer to each character defined in the target numbering rule and used to generate the file number. In the file numbering rule, numbering characters can be any text characters or placeholders. They are arranged and combined in a certain order and rules to form the template of the file number.
[0048] Parsed characters refer to the characters obtained after the parsing operation and used to construct the final file number. Parsed characters are the basic units for constructing the final file number.
[0049] Optionally, in a feasible implementation of the present application, the first numbering character in the target numbering rule is first selected as the current processing object, that is, the "first character". This character can be a static text character (such as a letter, number or special symbol), or a placeholder or variable that needs to be dynamically replaced according to the specific information of the archive. The system will decide how to parse the character based on its character type (such as text, date, serial number, etc.).
[0050] If the first character is a static text character, the system can directly retain it as the parsing character without additional processing. However, if the first character is a placeholder or variable, the system needs to generate or replace the corresponding parsing character based on the target archive identifier or other archive metadata. For example, if "YYYY" is specified as the placeholder for the year in the numbering rule, and the current year is 2023, the system will replace "YYYY" with "2023" as the parsing character corresponding to the placeholder.
[0051] During the parsing process, the system can also handle various situations that may arise, such as insufficient information in the target file identifier to generate parsing characters (such as missing key fields), the parsing rules and the format of the target file identifier do not match, etc. For these situations, the system can adopt error handling mechanisms, such as recording error logs, throwing exceptions, or requiring users to provide additional information.
[0052] The parsing operation will be performed one by one in the order of the number characters in the target numbering rule until all the number characters are parsed. The parsing result of each number character (i.e. the parsed character) will be recorded so that it can be combined according to the target numbering rule in the subsequent steps.
[0053] S400, when each numbering character is resolved, based on the target numbering rule, the resolved characters corresponding to each numbering character are combined to obtain the target file number of the file to be numbered.
[0054] Optionally, the target file number refers to a character string that is ultimately generated through a series of processing flows and is used to uniquely identify the file to be numbered. This target file number is obtained after a series of parsing and combining operations based on the target numbering rules corresponding to the institution to which the file to be numbered belongs and information such as the target file identifier extracted from the file.
[0055] Optionally, in a feasible implementation of the present application, when all numbering characters have been parsed, the specific content of the target numbering rule will be reviewed and confirmed first, including the order of arrangement of the numbering characters, the separators between characters (if any), and any specific combination rules or formatting requirements. Subsequently, the system can take out the parsed characters corresponding to each numbering character one by one according to this rule, and arrange them in the order defined in the target numbering rule. During the arrangement process, if the target numbering rule specifies separators between characters, the system will also insert these separators at the corresponding positions. In addition, if the numbering rule contains any specific formatting requirements (such as date format, time format, etc.), the system will also ensure that the parsed characters meet these requirements when combined.
[0056] After the arrangement and formatting are completed, the system will combine all parsed characters into a complete string, which is the target file number of the file to be numbered. This number not only follows the format and requirements of the target numbering rules, but also contains the specific information parsed from the target file identifier, so it is unique and readable.
[0057] It should be noted that in order to ensure the accuracy and reliability of the file number, the system can also implement some error handling mechanisms, such as verifying the legitimacy of the number, checking the duplication of the number, etc.
[0058] In the archive numbering method, device, equipment, medium and product provided in the embodiment of the present application, in the archive numbering generation process, firstly, the corresponding numbering rule is automatically matched according to the archive's belonging institution, and this process does not require manual intervention, thereby improving the automation of numbering generation. Subsequently, by means of character-by-character parsing, the parsing characters corresponding to each numbering character are dynamically generated according to the character type and the target archive identification. This fine-grained processing method not only enhances the flexibility of numbering, but also avoids redundant calculations and duplication of work in the traditional string concatenation method. Finally, the parsed parsing characters are combined into the target archive number according to the numbering rule, thereby realizing the rapid generation of numbering. Thus, the workload of code modification caused by rule changes is reduced, and the generation efficiency of archive numbering is significantly improved.
[0059] In one embodiment, if Figure 2 As shown, the above step 300 can specifically perform the following steps:
[0060] S310, when the character type of the first character is a placeholder type, if the first character is a first placeholder type, obtaining the character type of the second character, the second character being the next numbered character of the first character;
[0061] S320, when the second character is of the second placeholder type, if a third character of the third placeholder type exists after the second character, obtaining a fourth character between the second character and the third character;
[0062] S330, acquiring a target replacement rule matching the target archive identifier from a second mapping relationship, the second mapping relationship including a one-to-one correspondence between a plurality of archive identifiers and a plurality of replacement rules under a belonging institution;
[0063] S340: Replace the fourth character according to the replacement rule to obtain a parsed character corresponding to the first character.
[0064] Optionally, in a feasible implementation of the present application, each character in the numbering rule string is first identified, and special attention is paid to characters that serve as placeholders. Placeholders are used to indicate positions that need to be replaced by actual data in the final numbering. It is assumed that the numbering rule follows a specific syntax, such as using "${}" to enclose placeholder names.
[0065] When the system encounters the first placeholder (i.e., the first placeholder type, such as "$"), it looks at the type of character after the placeholder (i.e., the first character) to determine whether further processing is required. If the second character that follows is the beginning of another placeholder (i.e., the second placeholder type, such as "{"), and after the second character, there is also the end of the placeholder (i.e., the third placeholder type, such as "}", and there are non-placeholder characters (i.e., the fourth character) between the third and second placeholders, the system will understand that these non-placeholder characters are specific characters or strings that need to be replaced between the two placeholders (i.e., the second and third characters).
[0066] Next, the system can search for a target replacement rule that matches the target archive identifier in the second mapping relationship according to the target archive identifier. The second mapping relationship can be a database table, a hash table in memory, or other data structure, which stores the correspondence between different archive identifiers and corresponding replacement rules. The replacement rule defines how to convert the fourth character (or other specified part) between the placeholders into the final parsed character.
[0067] For example, suppose the numbering rule string is AR_${YEAR}_FILE_${NUMBER}, where YEAR and NUMBER are the parts that need to be replaced (i.e., the fourth character), representing the year and the file number respectively. Then in the second mapping relationship, the system finds a replacement rule that matches this archive identifier, which specifies that YEAR should be replaced with 2024 and NUMBER should be replaced with 001.
[0068] Therefore, when processing this numbering rule, the system will first recognize that $ is the first placeholder type, then notice that it is followed by {, which is the second placeholder type, and then there is a third placeholder type} after {, from which it can be determined that "YEAR" and "NUMBER" need to be replaced, and then the replacement value corresponding to YEAR, 2024, and the replacement value corresponding to NUMBER, 001, can be obtained from the second mapping relationship. Finally, the system replaces ${YEAR} in AR_${YEAR}_FILE_${NUMBER} with 2024 and NUMBER with 001, and obtains the final target file number such as AR_2023_FILE_001.
[0069] In these optional embodiments, when a rule contains multiple continuous or nested placeholders, by identifying non-placeholder characters (such as text or data in a specific format) between the placeholders and obtaining corresponding replacement rules from the mapping relationship based on the target archive identifier, the system can accurately replace these characters with actual data, thereby generating an archive number that meets the specifications and contains specific information. This method improves the automation of numbering, reduces human errors, and also enhances the flexibility and readability of numbering.
[0070] In one embodiment, replacing the fourth character according to the replacement rule to obtain a parsed character corresponding to the first character includes:
[0071] Obtain a target replacement character that matches the fourth character from the replacement rule, replace the fourth character with the target replacement character, and delete the first character, the second character, and the third character;
[0072] The target replacement character is determined to be the parsed character corresponding to the first character.
[0073] Optionally, in a feasible implementation of the present application, in the process of realizing file numbering, first, the system can retrieve the corresponding institutional file numbering rule string from the database according to the institution to which the file to be numbered belongs. This string is a template, which contains fixed text characters and placeholders for replacement (expressed in the form of ${}), wherein the placeholder represents the part that needs to be dynamically generated according to the specific information of the file. For example, the string may be in the form of ABC-EFG..._${HIJ}_..., wherein ABC-EFG, etc. are identification fields inherent to the institution, and ${HIJ} is a variable that needs to be replaced according to the file data. It should be noted that the representation form of the placeholder is not limited to the format of ${}, and the placeholder can adopt a variety of different forms according to different application scenarios and programming habits. In the context of the present application, although ${} is used as an example of a placeholder for explanation, this is only to exemplarily show the application of placeholders in the file numbering method. Placeholders can also be "%", "<>", "{{}}" and so on.
[0074] Next, the system begins to parse each number character in the number rule string one by one. For non-placeholder characters (i.e. characters other than $, {,}), the system directly caches these characters as part of the result number. When encountering a $ character, the system checks whether the character following it is {, which is used as a sign of the start of the placeholder. If $ is not followed by {, it means that the format of the rule string is incorrect, and the system will report an error and exit the processing flow.
[0075] If $ is followed by {, the system will start to read all the characters between { and} continuously, which form a variable name pointing to the specific content to be replaced. The system will then look for the corresponding replacement value in the target archive identifier or other archive metadata based on this variable name.
[0076] After finding the corresponding replacement value, the system will insert it into the corresponding position of the result number, replacing the original placeholder and its content. If there are other placeholders after the placeholder (such as the second and third placeholders in the description), the system will continue to repeat the above parsing and replacement process until all placeholders are processed.
[0077] It should be noted that if the rule string contains an unexpected format (such as an unclosed placeholder, an illegal character combination, etc.), the system should also have a corresponding error handling mechanism to deal with it.
[0078] Finally, when all characters have been processed and all placeholders have been correctly replaced with corresponding values, the system will obtain a complete file number that complies with the institution's file numbering rules. This number contains both the institution's inherent identification information and the part dynamically generated based on the file data, so it can uniquely identify each file to be numbered.
[0079] In these optional embodiments, by accurately matching and obtaining the target replacement characters from the replacement rules, the system can ensure the accuracy and consistency of the replacement. At the same time, the original placeholder characters (the first character, the second character, and the third character) are deleted to avoid leaving unnecessary marks in the final numbering, maintaining the neatness and readability of the numbering. Finally, the target replacement character is directly determined as the parsed character corresponding to the first character, which simplifies the processing flow and improves the automation and efficiency of numbering generation. This processing method not only reduces human intervention, but also reduces the risk of errors, and is an important optimization measure in the archive numbering system.
[0080] In one embodiment, the method further comprises:
[0081] In the case where the second character is not of the second placeholder type, a warning message is output, where the warning message is used to indicate that the target numbering rule does not comply with the writing specification.
[0082] Optionally, in a feasible implementation of the present application, after the system recognizes the first placeholder (i.e., the first placeholder type), it will immediately check whether the character after the placeholder (i.e., the second character) is also the beginning of the placeholder (i.e., the second placeholder type). This step is to ensure that the use of placeholders in the numbering rule is in line with expectations, such as whether there are nested placeholders or continuous placeholders, which need to be determined according to specific writing specifications.
[0083] If the system finds that the second character is not the second placeholder type, that is, it is not the start of a placeholder, then this may mean that the numbering rule was not written in accordance with the specification. For example, normal text or other non-placeholder characters may have been inserted between two variables that should be replaced, or the end marker of the placeholder (such as}) may be missing.
[0084] In order to alert the user or system administrator to this problem, the system will output an alarm message in this case. This alarm message will clearly indicate that the target numbering rule does not meet the writing specifications, and may include some additional details, such as the specific location of the error, possible causes of the error, and recommended corrective measures. The output method of the alarm message can be determined according to the specific implementation of the system, such as logging, user interface pop-up windows, email notifications, etc.
[0085] Through this step, the system can not only timely discover and report the irregularities of the numbering rules during the parsing process, but also promote the standardization and regularization of the numbering rules, reducing subsequent problems caused by writing errors. At the same time, this also reflects the system's focus on user-friendliness and error handling capabilities, which helps to improve the reliability and ease of use of the entire archive numbering system.
[0086] In these optional embodiments, by checking the continuity of the placeholders, the system can promptly discover and report numbering rules that do not conform to the writing specifications, effectively preventing parsing failures or data errors caused by rule errors. The output of the alarm information not only reminds the user or administrator to pay attention to the problem, but also promotes the timely correction of the numbering rules, ensuring the accuracy and standardization of subsequent number generation. This mechanism helps to reduce human errors and improve the overall reliability and maintenance efficiency of the numbering system.
[0087] In one embodiment, if Figure 3 As shown, the above step 300 may further specifically perform the following steps:
[0088] S350: When the first character is not of a placeholder type, determine the first character as a parsed character corresponding to the first character.
[0089] Optionally, in a feasible implementation of the present application, the character type of the first character currently being processed is first checked. If the first character is not a placeholder type, that is, it does not represent a special mark that needs to be replaced or processed in the subsequent process, then the system will directly regard the character as its final parsed form. This means that for non-placeholder type characters, the system will not perform complex replacement logic or search operations, but simply retain these characters as they are in the final file number result.
[0090] To achieve this, the system can maintain a character type recognition mechanism, which can be a predefined character set, a regular expression set, or a more complex parser that determines the type of each character in real time during the parsing process. When the system encounters non-placeholder type characters, it skips any logical branches related to placeholder processing and directly adds these characters to the numbered result string being built.
[0091] Specifically, in the process of traversing the numbering rule string, the system checks the type of each character one by one. For each character, the system performs the following operations: first, it determines whether the character is a placeholder type; if so, it replaces the placeholder according to the steps described above; if not, the system performs the above-mentioned step of "determining the first character as the parsed character corresponding to the first character".
[0092] In this way, the system can efficiently process all characters in the numbering rule string, whether placeholders or ordinary text characters, and can be correctly parsed and converted into the final numbering result. This processing method not only simplifies the logic of the system, but also improves the efficiency and accuracy of number generation. At the same time, it also reflects the system's support for the flexibility of numbering rules, allowing users to freely use various characters in numbering rules without worrying about them being processed or replaced incorrectly.
[0093] In these optional embodiments, when the numbering rules contain non-placeholder characters, the system can directly retain these characters without complicated replacement or processing logic, thereby reducing unnecessary calculations and resource consumption. This direct processing method enables the system to generate the final numbering results more quickly and ensures the accuracy and invariance of ordinary text characters in the numbering.
[0094] In one embodiment, when each numbering character is resolved, based on the target numbering rule, the resolved characters corresponding to each numbering character are combined to obtain the target file number of the file to be numbered, including:
[0095] When each numbering character is resolved, the resolved characters corresponding to each numbering character are combined according to the numbering sequence in the target numbering rule to obtain the target file number of the file to be numbered.
[0096] Optionally, in a feasible implementation of the present application, first ensure that all numbering characters have been correctly parsed and their corresponding parsed characters have been obtained. Once all numbering characters have been parsed, the system will enter the combination phase. In this phase, the system will guide how to combine the parsed characters corresponding to each numbering character into a complete file number based on the numbering sequence defined in the target numbering rule. The numbering sequence can be clearly specified in the target numbering rule, such as by a specific character position, separator, or hierarchical structure.
[0097] In specific implementation, the system can use a temporary string buffer or similar data structure to store the parsed characters corresponding to each number character corresponding to the archive number being constructed. Then, it will traverse all the parsed number characters and their corresponding parsed characters in the order of numbers. For each number character, the system will append its corresponding parsed character to the end of the buffer until all the parsed characters are combined.
[0098] If the target numbering scheme contains separators (such as hyphens, slashes, or spaces), the system also needs to insert these separators at the appropriate locations to ensure that the final generated file number conforms to the expected format. This can be achieved by identifying specific placeholders or markers during the parsing process and adding separators when replacing them with the corresponding parsing characters.
[0099] Finally, when all parsed characters are combined into the buffer in the order of numbering and all separators have been correctly inserted, the system will output the content in the buffer as the target file number of the file to be numbered. This number will be a complete string that meets the requirements of the target numbering rules and can be used to uniquely identify the file to be numbered.
[0100] Throughout the process, the system needs to ensure the accuracy and consistency of the numbering, and also needs to handle various abnormal situations that may arise, such as parsing errors, duplicate numbers, or format mismatches. By implementing these steps, the system can efficiently and accurately generate target file numbers that meet the specifications for the files to be numbered.
[0101] In these optional embodiments, by following the numbering sequence defined in the target numbering rule, the parsed characters corresponding to each numbering character are combined in order, thereby generating a file number that meets the requirements. This processing method not only improves the efficiency of numbering generation, but also avoids the problem of numbering confusion or invalidity caused by incorrect character sequence, and ensures the uniqueness and identifiability of the file number.
[0102] Optionally, in another embodiment of the present application, the method can be applied to a numbering system, which can be divided into three layers: a request layer, a cache layer, and a storage layer. The request layer is responsible for receiving number generation requests from users or systems, the cache layer is a high-speed access layer based on distributed cache, which is used to store frequently accessed numbering rules and intermediate results during the number generation process, and the storage layer is a database that ultimately stores archive numbers and rules.
[0103] Specifically, when a request to generate a file number is received, the numbering rule can be queried from the distributed cache of the cache layer. The numbering rule contains multiple dynamic placeholders, such as `${YEAR}`, `${DEPT}`, `${SEQ}`, etc. Each placeholder represents specific information, such as year, department code, or serial number.
[0104] Then, you can use the current serial number value in the distributed cache to perform an auto-increment operation based on the serial number part of the numbering rule. For example, if the current serial number is `001`, you can auto-increment it to `002` and update the cache to ensure that there will be no serial number conflicts in subsequent number generation. During the number generation process, the data in the distributed cache can be updated in real time to ensure that each generated number is unique and valid. This step avoids number conflicts caused by concurrent requests.
[0105] After the number generation is completed, the numbering result will not only be written to the cache layer, but also synchronously written to the storage layer. If an exception occurs during the writing process, the rollback operation can be automatically performed and the writing operation can be retried to ensure the integrity and consistency of the data.
[0106] Optionally, in other embodiments of the present application, a distributed lock mechanism is introduced for the number generation requirements in a high-concurrency environment to ensure that conflicts under the same numbering rule can be effectively avoided when there are high-concurrency requests. Specifically, when multiple requests simultaneously attempt to generate archive numbers under the same numbering rule, a distributed lock can be assigned to each number generation task. Only the task that obtains the lock can perform the number generation operation, and other requests will enter a waiting state until the lock is released. This can avoid the problem of serial number duplication caused by concurrent operations. It should be noted that in order to prevent a number generation task from failing to release the lock in time for some reason, a lock timeout mechanism can also be designed. If the lock is occupied for more than a certain time (such as 1 second), the lock will be forcibly released to allow other requests to perform number generation operations.
[0107] Based on the file numbering method provided in the above embodiment, the present application also provides a specific implementation of a file numbering device. Please refer to the following embodiment.
[0108] like Figure 4 As shown, the file numbering device provided in the embodiment of the present application includes the following modules:
[0109] The first acquisition module 401 is used to acquire a file to be numbered, wherein the file to be numbered includes a target file identifier;
[0110] A second acquisition module 402 is used to acquire a target numbering rule that matches the institution to which the to-be-numbered file belongs from the first mapping relationship, the target numbering rule includes a plurality of numbering characters, and the first mapping relationship includes a one-to-one correspondence between a plurality of institutions and a plurality of numbering rules;
[0111] A parsing module 403, configured to parse the first character according to the character type of the first character and the target file identifier to obtain a parsed character corresponding to the first character, wherein the first character is any numbered character among the plurality of numbered characters;
[0112] The combining module 404 is used to combine the parsed characters corresponding to each numbering character based on the target numbering rule when each numbering character has been parsed, so as to obtain the target file number of the file to be numbered.
[0113] In one embodiment, the parsing module 403 may include:
[0114] A first acquisition submodule, used for, when the character type of the first character is a placeholder type, if the first character is a first placeholder type, acquiring the character type of a second character, the second character being the next numbered character of the first character;
[0115] A second acquisition submodule is used for acquiring a fourth character between the second character and the third character if a third character of a third placeholder type exists after the second character when the second character is of a second placeholder type;
[0116] A third acquisition submodule is used to acquire a target replacement rule matching the target archive identifier from a second mapping relationship, wherein the second mapping relationship includes a one-to-one correspondence between multiple archive identifiers and multiple replacement rules under the belonging institution;
[0117] The replacement submodule is used to replace the fourth character according to the replacement rule to obtain a parsed character corresponding to the first character.
[0118] In one embodiment, the replacement submodule may include:
[0119] A first acquiring unit, configured to acquire a target replacement character matching the fourth character from the replacement rule, replace the fourth character with the target replacement character, and delete the first character, the second character, and the third character;
[0120] The first determining unit is used to determine the target replacement character as a parsed character corresponding to the first character.
[0121] In one embodiment, the file numbering device may further include:
[0122] An output module is used to output a warning message when the second character is not of the second placeholder type, wherein the warning message is used to indicate that the target numbering rule does not comply with the writing specification.
[0123] In one embodiment, the parsing module 403 may further include:
[0124] The first determining submodule is configured to determine the first character as a parsed character corresponding to the first character when the first character is not a placeholder type.
[0125] In one embodiment, the combining module 404 may include:
[0126] The combining submodule is used to combine the parsed characters corresponding to each numbering character according to the numbering sequence in the target numbering rule when each numbering character has been parsed, so as to obtain the target file number of the file to be numbered.
[0127] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application, and are devices corresponding to the above-mentioned battery thermal runaway warning method. All implementation methods in the above-mentioned method embodiment are applicable to the embodiments of the device. Its specific functions and technical effects can be found in the method embodiment part, which will not be repeated here.
[0128] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0129] Figure 5 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown.
[0130] The device may include a processor 501 and a memory 502 storing program instructions.
[0131] When the processor 501 executes the program, the steps in any of the above method embodiments are implemented.
[0132] Exemplarily, the program may be divided into one or more modules / units, one or more modules / units are stored in the memory 502, and executed by the processor 501 to complete the present application. One or more modules / units may be a series of program instruction segments capable of completing a specific function, and the instruction segments are used to describe the execution process of the program in the device.
[0133] Specifically, the processor 501 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0134] The memory 502 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 502 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 502 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 502 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 502 is a non-volatile solid-state memory.
[0135] The memory may include read-only memory (ROM), random access memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical or other physical / tangible memory storage devices. Thus, typically, the memory includes one or more tangible (non-transitory) readable storage media (e.g., memory devices) encoded with software including computer executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.
[0136] The processor 501 implements any one of the methods in the above embodiments by reading and executing program instructions stored in the memory 502 .
[0137] In one example, the electronic device may further include a communication interface 503 and a bus 510. The processor 501, the memory 502, and the communication interface 503 are connected via the bus 510 and communicate with each other.
[0138] The communication interface 503 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0139] Bus 510 includes hardware, software or both, and the parts of online data flow billing equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-end bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 510 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.
[0140] In addition, in combination with the method in the above embodiment, the embodiment of the present application can provide a storage medium for implementation. The storage medium stores program instructions; when the program instructions are executed by a processor, any one of the methods in the above embodiment is implemented.
[0141] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0142] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0143] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0144] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0145] The functional modules shown in the above block diagram can be implemented as hardware, software, firmware or their combination. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), suitable firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. Programs or code segments can be stored in machine-readable media, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable media" can include any medium that can store or transmit information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. Code segments can be downloaded via computer grids such as the Internet, intranets, etc.
[0146] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0147] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0148] The above are only specific implementation methods of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A file numbering method, characterized in that: The method comprises: Acquire a file to be numbered, wherein the file to be numbered includes a target file identifier; Acquire a target numbering rule that matches the institution to which the to-be-numbered file belongs from a first mapping relationship, wherein the target numbering rule includes a plurality of numbering characters, and the first mapping relationship includes a one-to-one correspondence between a plurality of institutions and a plurality of numbering rules; Parsing the first character according to the character type of the first character and the target file identifier to obtain a parsed character corresponding to the first character, wherein the first character is any one of the multiple numbered characters; When each numbering character is resolved, the resolved characters corresponding to each numbering character are combined based on the target numbering rule to obtain the target file number of the file to be numbered.
2. The method according to claim 1, characterized in that The step of parsing the first character according to the character type of the first character and the target file identifier to obtain a parsed character corresponding to the first character includes: In the case where the character type of the first character is a placeholder type, if the first character is a first placeholder type, the character type of the second character is acquired, and the second character is a numbered character next to the first character; In the case where the second character is of the second placeholder type, if a third character of the third placeholder type exists after the second character, obtaining a fourth character between the second character and the third character; Acquire a target replacement rule matching the target archive identifier from a second mapping relationship, wherein the second mapping relationship includes a one-to-one correspondence between multiple archive identifiers and multiple replacement rules under the affiliation institution; The fourth character is replaced according to the replacement rule to obtain a parsed character corresponding to the first character.
3. The method according to claim 2, characterized in that The replacing the fourth character according to the replacement rule to obtain a parsed character corresponding to the first character includes: Obtain a target replacement character that matches the fourth character from the replacement rule, replace the fourth character with the target replacement character, and delete the first character, the second character, and the third character; The target replacement character is determined to be the parsed character corresponding to the first character.
4. The method according to claim 2, characterized in that: The method further comprises: In the case where the second character is not of the second placeholder type, a warning message is output, where the warning message is used to indicate that the target numbering rule does not comply with the writing specification.
5. The method according to claim 1, characterized in that The step of parsing the first character according to the character type of the first character and the target file identifier to obtain a parsed character corresponding to the first character further includes: When the first character is not a placeholder type, the first character is determined as a parsed character corresponding to the first character.
6. The method according to claim 1, characterized in that When each numbering character is resolved, based on the target numbering rule, the resolved characters corresponding to each numbering character are combined to obtain the target file number of the file to be numbered, including: When each numbering character is resolved, the resolved characters corresponding to each numbering character are combined according to the numbering sequence in the target numbering rule to obtain the target file number of the file to be numbered.
7. A file numbering device, characterized in that: The device comprises: A first acquisition module is used to acquire a file to be numbered, wherein the file to be numbered includes a target file identifier; A second acquisition module is used to acquire a target numbering rule that matches the institution to which the to-be-numbered file belongs from the first mapping relationship, the target numbering rule includes a plurality of numbering characters, and the first mapping relationship includes a one-to-one correspondence between a plurality of institutions and a plurality of numbering rules; a parsing module, configured to parse the first character according to the character type of the first character and the target file identifier to obtain a parsed character corresponding to the first character, wherein the first character is any numbered character among the plurality of numbered characters; The combination module is used to combine the parsed characters corresponding to each numbering character based on the target numbering rule when each numbering character has been parsed, so as to obtain the target file number of the file to be numbered.
8. An electronic device, characterized in that: The electronic device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the file numbering method as described in any one of claims 1-6 is implemented.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the file numbering method according to any one of claims 1 to 6 is implemented.
10. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the file numbering method as described in any one of claims 1 to 6.