Business object deserialization index alignment method, computer device and storage medium

By configuring the attribute field index assignment business class in the business system and generating a hash array, the inconsistency problem between the business CSV attribute fields and the system CSV attribute fields is solved, achieving flexible code development and efficient system maintenance.

CN120234329BActive Publication Date: 2025-09-16SHENZHOU LINGYUN (BEIJING) TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510707614.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-29
Publication Date
2025-09-16
Estimated Expiration
2045-05-29

AI Technical Summary

Technical Problem

In business program development, due to different writing habits among different developers, the expression and sorting of business CSV attribute fields are inconsistent with those of system CSV attribute fields. The existing alignment method affects code flexibility or is inefficient.

Method used

By configuring the attribute field index assignment business class, the system attribute field is processed using the preset deformation strategy to generate a hash array, and the hash calculation is used to achieve automatic index alignment between the business attribute field and the system attribute field.

Benefits of technology

It improves the flexibility of code development and the convenience of system maintenance, adapts to different development styles, and improves the compatibility and efficiency of attribute field alignment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120234329B_ABST
    Figure CN120234329B_ABST
Patent Text Reader

Abstract

The present invention proposes a business object deserialization index alignment method, computer device, and storage medium. The method includes: configuring an attribute field index assignment business class in a business system; using a preset deformation strategy to deform the system attribute field and extending the deformed system attribute field to the system configuration; using the attribute field index assignment business class to initialize the system attribute field to obtain a hash array for indexing the system field; in response to obtaining business data, deserializing the business data to determine the business attribute field corresponding to the business data; calling the attribute field index assignment business class to perform a hash calculation on the business attribute field, and matching the index in the hash array based on the hash calculation result to determine the system attribute field corresponding to the business attribute field. The present invention automatically aligns the system attribute field and the business attribute field through a hash index method, and improves the alignment compatibility by deforming the system attribute field.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a business object deserialization index alignment method, computer equipment, and storage medium. Background Art

[0002] During business program development, to shorten the development cycle, the business system architecture and specific business functions are divided into different parts of the code to develop the corresponding parts. However, different developers have their own writing habits, which can lead to differences in the expression and sorting of the attribute fields in the business CSV (Comma-Separated Values) they write and the expression and sorting of the attribute fields in the system CSV built into the business system. Therefore, it is necessary to align the attribute fields in the business CSV with the attribute fields in the system CSV later (that is, to determine the corresponding relationship).

[0003] There are two ways to align traditional CSV fields. The specific methods and disadvantages are as follows:

[0004] 1. Hard-coding the input order of fixed CSV attribute fields. This approach not only hinders the flexibility of code writing, but also requires corresponding modifications to the business function codes every time the order of the system CSV attribute fields is modified, which is not conducive to subsequent maintenance and upgrades.

[0005] 2. Based on the reflection method, the input fields are mapped to the attributes in the business class, and the reflection method of the base class is called to set the value of the object. Although this method is more flexible, the execution efficiency is low due to one mapping and one reflection operation. Summary of the Invention

[0006] In order to improve the flexibility of code development and facilitate subsequent system maintenance, in a first aspect of the present invention, a business object deserialization index alignment method is proposed, the method comprising: configuring an attribute field index assignment business class in a business system; using a preset deformation strategy to deform the system attribute field and extending the deformed system attribute field to the system configuration; using the attribute field index assignment business class to initialize the system attribute field to obtain a hash array for indexing the system attribute field; in response to obtaining business data, deserializing the business data to determine the business attribute field corresponding to the business data; calling the attribute field index assignment business class to perform hash calculation on the business attribute field, and matching the index in the hash array based on the hash calculation result to determine the system attribute field corresponding to the business attribute field.

[0007] In one or more embodiments, the method further includes: before initializing the system attribute field using the attribute field index assignment business class and obtaining a hash array for indexing the system attribute field, using a preset deformation strategy to deform the system attribute field and expanding the deformed system attribute field into the system configuration.

[0008] In one or more embodiments, a preset deformation strategy is used to deform the system attribute field, including: converting each of the system attribute fields into all lowercase, all uppercase, capitalizing the first letter of the first word, capitalizing the first letter of the second word, capitalizing the first letter of the first word and the second word, and adding specified characters between the first word and the second word.

[0009] In one or more embodiments, the attribute field index assignment business class is used to initialize the system attribute field to obtain a hash array for indexing the system attribute field, including: sorting the system attribute field and assigning serial numbers; calling a preset weak hash algorithm to calculate the weak hash value of the system attribute field; and constructing a hash array using the weak hash value as the index key and the serial number as the index value.

[0010] In one or more embodiments, the attribute field index assignment business class is called to perform hash calculation on the business attribute field, and the index is matched in the hash array based on the hash calculation result, including: calling the preset weak hash algorithm to calculate the weak hash value of the business attribute field; matching the weak hash value with the index key in the hash array; and in response to matching the same index key, indexing the system attribute field at the corresponding sort position based on the corresponding key value.

[0011] In one or more embodiments, the business object deserialization index alignment method of the present invention further includes: in response to the weak hash value of the business attribute field calculated using the preset weak hash algorithm being 0, ending the matching index operation and outputting an error prompt.

[0012] In one or more embodiments, the business object deserialization index alignment method of the present invention further includes: in response to the absence of a system attribute field at a corresponding sorting position based on the key value index, ending the matching index operation and prompting to restart the business system.

[0013] In one or more embodiments, the attribute field index assignment business class is called to perform hash calculation on the business attribute field, and the index is matched in the hash array based on the hash calculation result, including: obtaining multiple business attribute fields in response to deserializing the business data; using multi-threaded concurrent execution to call the attribute field index assignment business class to perform hash calculation on the business attribute field, and matching the index in the hash array based on the hash calculation result.

[0014] In one or more embodiments, the business object deserialization index alignment method of the present invention further includes: in response to the presence of a hash value matching the hash calculation result in the hash array, determining a system attribute field aligned with the business attribute field.

[0015] In a second aspect of the present invention, a computer device is proposed, comprising: at least one processor; and a memory, wherein the memory stores an executable computer program, and when the computer program is executed by the at least one processor, it is used to implement the steps of the business object deserialization index alignment method as described in any of the above method embodiments.

[0016] In a third aspect of the present invention, a readable storage medium is proposed, comprising: an executable computer program, which, when executed by an executor, is used to implement the steps of the business object deserialization index alignment method as described in any of the above method embodiments.

[0017] The beneficial effects of the present invention include: the present invention develops an attribute field index assignment business class in the business system to realize automatic index alignment of business attribute fields and system attribute fields, so that users do not need to pay attention to the order of entering business attribute fields when developing business functions, thereby greatly improving the flexibility of coding, and before using the attribute field index assignment business class to initialize the system attribute field, the system attribute field is deformed and the deformed system attribute field is expanded to the system configuration, thereby greatly improving the compatibility of the alignment of system attribute fields and business attribute fields to adapt to different development styles, and automatically scans the system attribute field through the initialization operation after each system restart, thereby generating an updated hash array, combined with the automatic index alignment function, thereby greatly improving the convenience of subsequent system maintenance. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can be obtained based on these drawings without paying any creative work.

[0019] Figure 1 This is a workflow diagram of a method for aligning business object deserialization indexes according to an embodiment of the present invention;

[0020] Figure 2 A schematic structural diagram of a computer device according to an embodiment of the present invention;

[0021] Figure 3This is a schematic structural diagram of a readable storage medium according to an embodiment of the present invention. DETAILED DESCRIPTION

[0022] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the embodiments of the present invention are further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings.

[0023] It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are for distinguishing two non-identical entities with the same name or non-identical parameters. It can be seen that "first" and "second" are only for the convenience of expression and should not be understood as limitations on the embodiments of the present invention. Subsequent embodiments will not explain this one by one.

[0024] In order to improve the flexibility of code development and facilitate the subsequent system maintenance, the present invention proposes a business object deserialization index alignment method, such as Figure 1 As shown, in one embodiment, the method of the present invention includes: step S1, configuring an attribute field index assignment business class in a business system; step S2, using a preset deformation strategy to deform the system attribute field and extending the deformed system attribute field to the system configuration; step S3, using the attribute field index assignment business class to initialize the system attribute field, and obtain a hash array for indexing the system attribute field; step S4, in response to obtaining business data, deserializing the business data to determine the business attribute field corresponding to the business data; step S5, calling the attribute field index assignment business class to perform hash calculation on the business attribute field, and matching the index in the hash array based on the hash calculation result to determine the system attribute field corresponding to the business attribute field.

[0025] This embodiment develops an attribute field index assignment business class in the business system to achieve automatic index alignment of business attribute fields and system attribute fields, so that users do not need to pay attention to the order of entering business attribute fields when developing business functions, thereby greatly improving the flexibility of coding. Before using the attribute field index assignment business class to initialize the system attribute field, the system attribute field is deformed and the deformed system attribute field is expanded to the system configuration, thereby greatly improving the compatibility of the alignment of system attribute fields and business attribute fields to adapt to different development styles. After each system restart, the system attribute field is automatically scanned through the initialization operation to generate an updated hash array. Combined with the automatic index alignment function, the convenience of subsequent system maintenance is greatly improved.

[0026] In one embodiment, a preset deformation strategy is used to deform the system attribute field, including: converting the business attribute field into all lowercase, all uppercase, capitalizing the first letter of the first word, capitalizing the first letter of the second word, capitalizing the first letter of the first word and the second word, and adding a specified character between the first word and the second word.

[0027] Specifically, each application system has its own business scope, and accordingly, a maximum set of business fields is defined for it. For example, for network performance analysis, approximately 500 fields cover all business data. If these 500 data points are further divided into all possible writing styles, including camel case, snake case, all uppercase, and all lowercase, approximately 2000 fields can cover all possible fields. For example, the timestamp field is classified into four forms: timeStamp, time_stamp, TIMESTAMP, and timestamp. To improve indexing success rates, this embodiment automatically expands business attribute fields, such as comma-separated values ​​(CSV) fields, using a preset transformation strategy. A hash array for index alignment is then initialized based on the expanded CSV fields. The designated symbols in this embodiment include not only the "-" in snake case, but also some user-defined symbols, such as "&" and "*." The prerequisite is that the designated symbols cannot be specific command symbols and cannot affect the correct expression of the command.

[0028] In an optional embodiment, the deformation strategy is triggered and started each time the system is restarted, and the business attribute fields in each business function code are scanned to determine whether there is an extension field. If there is no extension field, it is expanded and the expanded deformed business attribute field is solidified into the business function code.

[0029] In an optional implementation, the deformation strategy is triggered and started each time the system is restarted, and the business attribute fields in each business function code are scanned to determine whether there is an extension field. If there is no extension field, it is expanded and the expanded deformed business attribute field is temporarily saved in the system's memory. When the system is shut down, the deformed business attribute field is cleared.

[0030] In one embodiment, the specific operations of initializing the system attribute field using the attribute field index assignment business class in step S1 of the present invention and obtaining the hash array for indexing the system attribute field include: sorting the system attribute field and assigning serial numbers; calling a preset weak hash algorithm to calculate the weak hash value of the system attribute field; and constructing a hash array using the weak hash value as the index key and the serial number as the index value.

[0031] Specifically, for the hash array construction process, taking timeStamp as an example, assuming the weak hash value of timeStamp is 10000 and the sequence number of timeStamp in the system attribute field is 3, the assignment instruction for constructing the hash array is expressed as: weakHashCodeArray

[10000] =3, where weakHashCode represents the hash function (specifically, a weak hash function) called when generating the array Array, Array

[10000] represents the array element 10000, and Array

[10000] =3 assigns the value 3 to Array

[10000] , establishing a connection between the weak hash value 10000 and the third field in the system attribute field. Multiple business attribute fields in a business function are hashed and indexed using the above method to form the array Array[10000,…,11111], where each element represents the hash value of a business attribute field, and the index relationship is hidden. Among them, the weak hash function can be customized by the user to have a hash range, so as to control the hashing to a reasonable range according to the number of system attribute fields involved in the business function.

[0032] In an alternative implementation, the system attribute fields are first categorized, with multiple fields with the same reference grouped together, and then sorted. For example, fields that all refer to timestamps are grouped together: timeStamp, time_stamp, TIMESTAMP, timestamp, and then sorted: timeStamp1, time_stamp2, TIMESTAMP3, timestamp4. This embodiment has the advantage that, when multithreading is enabled, multiple variations of a field can be matched and indexed simultaneously, allowing for rapid retrieval of a particular attribute type.

[0033] In an alternative implementation, the system attribute fields are first categorized, with fields with the same expression format grouped together, and then sorted. For example, timestamp, protocoltype, timeStamp, protocolType, and then timestamp1, protocoltype2, timeStamp3, protocolType4 are sorted. This embodiment offers the advantage of enabling fast matching and indexing of multiple attributes simultaneously when multithreading is enabled.

[0034] In one embodiment, the specific steps of calling the attribute field index assignment business class in step S3 to perform hash calculation on the business attribute field and matching the index in the hash array based on the hash calculation result include: calling a preset weak hash algorithm to calculate the weak hash value of the business attribute field; matching the weak hash value with the index key in the hash array; and in response to matching the same index key, indexing the system attribute field at the corresponding sorting position based on the corresponding key value.

[0035] In one embodiment, the method of the present invention further includes: in response to a weak hash value calculated using a preset weak hash algorithm for the business attribute field being 0, terminating the matching index operation and outputting an error message. The weak hash value of 0 may indicate that the length of the input business attribute field exceeds a certain range, requiring the developer to recheck the maximum length of the business field.

[0036] In one embodiment, the method of the present invention further includes: in response to the absence of a system attribute field at a corresponding sort position based on the key value index, terminating the index matching operation and outputting an error message. If the system attribute field is deleted during subsequent system maintenance without a system restart, the absence of the attribute field at the corresponding position may occur, requiring a prompt to restart the business system.

[0037] In one embodiment, the attribute field index assignment service class is called to perform a hash calculation on the business attribute field, and the index is matched in the hash array based on the hash calculation result, including: obtaining multiple business attribute fields in response to deserializing the business data; using multi-threaded concurrent execution to call the attribute field index assignment service class to perform a hash calculation on the business attribute field, and matching the index in the hash array based on the hash calculation result; in response to the presence of a hash value matching the above-mentioned hash calculation result in the hash array, determining the system attribute field aligned with the above-mentioned business attribute field. Since the present invention adopts an index alignment mechanism, multi-threaded concurrent processing can be used, thereby further improving the attribute field alignment speed.

[0038] Through the above method, the present invention abstracts the hash array of each business function for index alignment, which can be applied to most application scenarios, while maintaining the alignment efficiency at the same level as fixed order hard coding.

[0039] In a second aspect of the present invention, a computer device is provided, such as Figure 2 As shown, it includes: at least one processor 100; and a memory 200, in which an executable computer program is stored. When the computer program is executed by at least one processor 100, it is used to implement the steps in any of the above business object deserialization index alignment method examples.

[0040] In a third aspect of the present invention, a readable storage medium 300 is provided, such as Figure 3 As shown, it includes: an executable computer program 301, which is used to implement the steps in any of the above business object deserialization index alignment method examples when executed by an executor.

[0041] The above are exemplary embodiments disclosed herein, but it should be noted that various changes and modifications may be made without departing from the scope of the embodiments disclosed herein as defined in the claims. The functions, steps, and / or actions of the method claims according to the disclosed embodiments described herein do not need to be performed in any particular order.

[0042] The serial numbers of the embodiments disclosed in the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0043] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to limit the scope of the disclosure of the present invention (including the claims) to these examples. Within the spirit of the present invention, the technical features of the above embodiments or different embodiments may be combined, and many other variations exist in different aspects of the above embodiments, which are not provided in detail for the sake of clarity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A business object deserialization index alignment method, characterized in that: The method comprises: Configure the attribute field index assignment business class in the business system; Using a preset deformation strategy to deform the system attribute field and extending the deformed system attribute field to the system configuration; Initializing the system attribute field using the attribute field index assignment service class to obtain a hash array for indexing the system attribute field, including sorting the system attribute field and assigning serial numbers, calling a preset weak hash algorithm to calculate a weak hash value of the system attribute field, and constructing a hash array using the weak hash value of the system attribute field as an index key and the serial number as an index value; In response to acquiring the business data, deserializing the business data to determine a business attribute field corresponding to the business data; Calling the attribute field index assignment service class to perform a hash calculation on the business attribute field, and matching the index in the hash array based on the hash calculation result to determine the system attribute field corresponding to the business attribute field, including calling the preset weak hash algorithm to calculate a weak hash value of the business attribute field, performing an index key match on the weak hash value of the business attribute field in the hash array, and in response to matching the same index key, indexing the system attribute field at the corresponding sort position based on the corresponding key value; Among them, the system attribute field is deformed using a preset deformation strategy, including: converting each of the system attribute fields into all lowercase, all uppercase, capitalizing the first letter of the first word, capitalizing the first letter of the second word, capitalizing the first letter of the first word and the second word, and adding a specified character between the first word and the second word.

2. The business object deserialization index alignment method according to claim 1, characterized in that: The method further comprises: In response to the weak hash value of the business attribute field calculated using the preset weak hash algorithm being 0, the matching index operation is terminated and an error prompt is output.

3. The business object deserialization index alignment method according to claim 1, characterized in that: The method further comprises: In response to the absence of a system attribute field at a corresponding sort position based on the key value index, the matching index operation is terminated and a prompt is given to restart the business system.

4. The business object deserialization index alignment method according to claim 1, characterized in that: Calling the attribute field index assignment service class to perform hash calculation on the service attribute field, and matching the index in the hash array based on the hash calculation result, including: In response to deserializing the business data, a plurality of business attribute fields are obtained; The attribute field index assignment service class is called by multi-threaded concurrent execution to perform hash calculation on the service attribute field, and the index is matched in the hash array based on the hash calculation result.

5. The business object deserialization index alignment method according to claim 4, characterized in that: The method further comprises: In response to a hash value matching the hash calculation result existing in the hash array, a system attribute field aligned with the business attribute field is determined.

6. A computer device, characterized in that: include: at least one processor; as well as A memory storing an executable computer program, wherein the computer program is used to implement the steps of the business object deserialization index alignment method as described in any one of claims 1 to 5 when executed by the at least one processor.

7. A readable storage medium, characterized in that: include: An executable computer program, which, when executed by an executor, is used to implement the steps of the business object deserialization index alignment method as described in any one of claims 1 to 5 above.

Citation Information

Patent Citations

  • Data transfer method and device, equipment and storage medium

    CN116244381A