A data sorting method and device based on grouping
Through the grouping-based data sorting method, the duplicate data and redundancy problems in the data preparation process of the online shopping mall system are solved, efficient sorting and detection are achieved, and manual intervention and resource investment are reduced.
Patent Information
- Application Number
- CN202111458699.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-01
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2041-12-01
AI Technical Summary
The product sorting method of the existing online shopping mall system lacks a grouping form, resulting in duplicate data and redundancy in the data preparation process. In addition, each time the rules are modified, data needs to be copied and structural verification performed, which is inefficient.
A data sorting method based on grouping is adopted. By setting post-conditions and grouping strategies, data grouping insertion and cleaning are performed, and sorting is performed according to priority rules. Finally, the validity of the sorting results is verified.
It effectively avoids the generation of duplicate data, improves sorting efficiency, reduces manual intervention, and reduces the resource investment of testers.
Smart Images

Figure CN114238295B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of automatic data processing, and in particular to a data sorting method and device based on grouping. Background Art
[0002] Current online shopping mall systems generally display product label information according to priority logic in product lists and details, thereby triggering user purchasing behavior.
[0003] The current sorting method is generally to write a script to execute according to the rules defined by the requirements. When adding a new sorting method later, the existing execution method must be copied again (specifically, the existing version of the sorting or display verification scheme is based on the rules defined by the requirements, and then the corresponding test data is prepared for sorting, and then the sorting results are compared. When the requirements priority is adjusted, or a new priority display is added, or the sorting rules are changed, the relevant prepared data needs to be copied again and the verification return results need to be modified. That is, every time a rule is added or modified, the data needs to be copied and the execution structure verification needs to be performed). This sorting method has the following defects: (1) There is no grouping form; (2) There is a lot of useless duplicate data. The data preparation process requires the use of duplicate prepared data. The only difference between the prepared data is the replacement of the sorting label ID required in each. There are many similar data in different use case execution scenarios, which are such duplicate data. In addition, the repeated modification of the verification return results will also cause redundancy and duplication in the sorting execution process settings. Summary of the Invention
[0004] The embodiment of the present invention provides a data sorting method and device based on grouping, which groups all processes involved in the sorting execution process (data initialization, setting rules, expected verification rules, data cleaning, etc.), removes repeatedly written sorting processes, and avoids the sorting process from generating too much duplicated and useless data.
[0005] To achieve the above objectives, a first aspect of an embodiment of the present application provides a grouping-based data sorting method, comprising:
[0006] Set post-conditions and grouping strategies based on the current business scenario and target storage system characteristics;
[0007] Create multiple groups according to the grouping strategy, insert data into the groups according to the insertion logic corresponding to the groups, and obtain data of different groups;
[0008] After the data group insertion is completed, the cleaning process corresponding to the group is performed on the data of the different groups according to the post-condition;
[0009] Define the return structure based on the current business scenario;
[0010] Integrating the cleaned data of the different groups into a preset data format, and sorting the data according to the priority rules configured in the data format to obtain a sorting result;
[0011] The sorting result is matched with the returned structure to verify the validity of the sorting result.
[0012] In a possible implementation of the first aspect, the preset data format includes a priority rule, a creation value, and a hit value;
[0013] The priority rules are formulated based on the current business scenario; the generated values are reference values for initializing the values of the data of the different groups; and the hit values reflect the matching degree of each rule in the priority rules.
[0014] In a possible implementation of the first aspect, sorting the data according to the priority rule configured in the data format to obtain a sorting result specifically includes:
[0015] Use Stream streaming operations to filter and obtain the required grouped data;
[0016] The data to be sorted is generated according to the generated value, and the priority rule matching the hit value is called to sort the data to obtain a sorting result.
[0017] In a possible implementation of the first aspect, matching the sorting result with the returned structure to verify the validity of the sorting result specifically includes:
[0018] If the data format of the sorting result is consistent with that of the returned structure, the sorting result is valid;
[0019] If the data format of the sorting result and the returned structure are inconsistent, the sorting result is invalid.
[0020] A second aspect of an embodiment of the present application provides a data sorting device based on grouping, including:
[0021] The initial setup module is used to set post-conditions and grouping strategies based on the current business scenario and target storage system characteristics;
[0022] A grouping module is used to create multiple groups according to the grouping strategy, insert data into groups according to the insertion logic corresponding to the groups, and obtain data of different groups;
[0023] A cleaning module, configured to perform group-specific cleaning on the data of different groups according to post-conditions after the data group insertion is completed;
[0024] Definition module, used to define the return structure according to the current business scenario;
[0025] A sorting module is used to integrate the cleaned data of the different groups into a preset data format, and sort the data according to the priority rules configured in the data format to obtain a sorting result;
[0026] The matching module is used to match the sorting result with the returned structure to verify the validity of the sorting result.
[0027] In a possible implementation of the second aspect, the preset data format includes a priority rule, a creation value, and a hit value;
[0028] The priority rules are formulated based on the current business scenario; the generated values are reference values for initializing the values of the data of the different groups; and the hit values reflect the matching degree of each rule in the priority rules.
[0029] In a possible implementation of the second aspect, sorting the data according to the priority rule configured in the data format to obtain a sorting result specifically includes:
[0030] Use Stream streaming operations to filter and obtain the required grouped data;
[0031] The data to be sorted is generated according to the generated value, and the priority rule matching the hit value is called to sort the data to obtain a sorting result.
[0032] In a possible implementation of the second aspect, the matching module is specifically configured to:
[0033] If the data format of the sorting result is consistent with that of the returned structure, the sorting result is valid;
[0034] If the data format of the sorting result and the returned structure are inconsistent, the sorting result is invalid.
[0035] Compared to existing technologies, the grouping-based data sorting method and device provided by the present invention integrates data from different groups into a preset data format, thereby avoiding duplication of data. It also groups the steps involved in the sorting execution process (data initialization, rule setting, expected sorting rules, data cleaning, etc.) to obtain a sorting result. Finally, the correctness of the sorting result is determined based on the returned structure.
[0036] In general, the group-based data sorting method and apparatus provided by the embodiments of the present invention only require the development of data and predefined rules, without requiring any additional configuration or modification of the target system. This effectively avoids the generation of duplicate data, thereby improving sorting efficiency. During the sorting and testing process, no manual intervention is required, reducing the resource investment of testers. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 The figure is a flowchart of a data sorting method based on grouping provided by one embodiment of the present invention. DETAILED DESCRIPTION
[0038] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0039] See Figure 1 An embodiment of the present invention provides a data sorting method based on grouping, the method comprising:
[0040] S10. Based on the current business scenario and target storage system characteristics, set post-conditions and grouping strategies.
[0041] S11. Create multiple groups according to the grouping strategy, and insert data into the groups according to the insertion logic corresponding to the groups to obtain data of different groups.
[0042] S12: After the data group insertion is completed, the cleaning process corresponding to the group is performed on the data of the different groups according to the post-condition.
[0043] S13. Define the return structure according to the current business scenario.
[0044] S14: Integrate the cleaned data of the different groups into a preset data format, and sort the data according to the priority rules configured in the data format to obtain a sorting result.
[0045] S15. Match the sorting result with the returned structure to verify the validity of the sorting result.
[0046] S10 is the process of establishing a grouping strategy in the embodiment of this method. The return structure specified in S13 is mainly used to verify whether the sorting result is reliable and is an ideal expected structure. S14 is the process of processing data according to the priority rules. S15 is the final sorting result judgment process, and different categories are analyzed and judged according to the defined priority.
[0047] In S10, based on common business scenarios, postconditions need to be established (behavioral operations that need to be triggered after the script is executed: for example, cleaning up data and restoring the array during execution to its initial state to achieve data recycling). S11-S12 are grouped using similar data execution operation rules, and implementation methods are written using different grouping methods. For general data systems, the main focus is writing to different storage systems. If Java is used to implement S11-S12, it is necessary to define several batch write method names X. Adding groups = method name X to the execution scenario will call the corresponding method to perform batch data insertion.
[0048] Exemplarily, the preset data format includes a priority rule, a creation value, and a hit value;
[0049] The priority rules are formulated based on the current business scenario; the generated values are reference values for initializing the values of the data of the different groups; and the hit values reflect the matching degree of each rule in the priority rules.
[0050] Exemplarily, the sorting of data according to the priority rules configured in the data format to obtain a sorting result specifically includes:
[0051] Use Stream streaming operations to filter and obtain the required grouped data;
[0052] The data to be sorted is generated according to the generated value, and the priority rule matching the hit value is called to sort the data to obtain a sorting result.
[0053] In actual applications, the grouped data obtained by S11 and S12 is generally passed in the parameter format of "priority sorting / created value / expected value". When receiving grouped data like this, different methods need to be called to process it. First, use Java Stream operations to filter and obtain the required values. Priority sorting calls the basic service to deliver configuration information for the current execution scenario. The hit value needs to be determined according to the grouping strategy, and the corresponding service returns specific sorted data based on the business scenario.
[0054] It should be noted that the priority here refers to the rule of sorting whether the data to be processed should be sorted before the previous data or the later data when multiple data appear at the same time according to the required functional points of each business scenario. The priority rule is to write a format according to the business functional points. A similar format is similar to: a|b,c,d>ef, which specifically means initializing and cleaning data a, b, c, d, e, then the sorting priority display or sorting result is a, d, f.
[0055] Exemplarily, S15 specifically includes:
[0056] If the data format of the sorting result is consistent with that of the returned structure, the sorting result is valid;
[0057] If the data format of the sorting result and the returned structure are inconsistent, the sorting result is invalid.
[0058] The following is an example of a product tag system. The function that needs to be implemented is the existence of multiple tags A, B, C, D, and E. The current configuration rule is A|B, C>D, E. The function is finally displayed in the product sorting priority. Only when A, C, E is it normal, otherwise it is abnormal.
[0059] Step 1: Group the current storage system based on tags. After analyzing the business scenario and confirming that the current system requires separate storage in the cache and database, the grouping strategy will define the operation cache (this cache includes local cache and distributed cache) and database, and generate two tags: "Group = Cache" and "Group = Database". When these two tags are present, the execution process initialization and post-execution data cleanup will perform the corresponding logical processing according to the defined grouping method to ensure data initialization and reuse.
[0060] Step 2: Based on the verification format formulated for the sorting results that need to be verified, after confirming that the current business function point needs to return all the content of the tag, including the tag ID, tag name product, display location, corresponding image information, etc., the corresponding structure content information is added to the current structure to ensure that the structure content includes the information required for this function.
[0061] Step 3: The current business function point configuration rule is A|B,C>D,E. Based on this rule, three step instances will be split. The first step is to obtain the configuration rule information A|B,C>D,E and then use this rule to call the corresponding update configuration rule method to ensure that the current rule is only effective for the current execution use case. Secondly, generate label information based on the data. Here, obtain the label A, B, C, D, E information and call the data creation method to generate label data that meets the requirements. Finally, priority display is obtained. By calling the priority acquisition logic processing through the configuration rule information, the final priority display order can be obtained as A>C>E.
[0062] Step 4: Based on the previous steps, the final display order of the A, B, C, D, and E label rules is clear. Here, the execution result information can be obtained by calling the unified interface call method. The execution result is then compared with the expected result returned by step 2 to call the consistency judgment method. If the data matches successfully, the current execution is successful, otherwise the execution fails.
[0063] Compared to existing technologies, the grouping-based data sorting method provided by the present invention consolidates data from different groups into a pre-defined data format, thereby avoiding duplication of data. It also groups the steps involved in the sorting process (data initialization, rule setting, expected sorting rules, data cleaning, etc.) to produce a sorting result. Finally, the correctness of the sorting result is determined based on the returned structure.
[0064] In general, the grouping-based data sorting method provided by the embodiments of the present invention only requires the development of data and predefined rules, without requiring any additional configuration or modification of the target system. This effectively avoids the generation of duplicate data, thereby improving sorting efficiency. During the sorting and testing process, no manual intervention is required, reducing the resource investment of testers.
[0065] A second aspect of an embodiment of the present application provides a data sorting device based on grouping, including: an initial setting module, a grouping module, a cleaning module, a definition module, a sorting module and a matching module.
[0066] The initial settings module is used to set post-conditions and grouping strategies based on the current business scenario and target storage system characteristics.
[0067] The grouping module is used to create multiple groups according to the grouping strategy, insert data groups according to the insertion logic corresponding to the groups, and obtain data of different groups.
[0068] The cleaning module is used to perform group-specific cleaning processing on the data of different groups according to post-conditions after the data group insertion is completed.
[0069] Definition module, used to define the return structure according to the current business scenario.
[0070] The sorting module is used to integrate the cleaned data of the different groups into a preset data format, and sort the data according to the priority rules configured in the data format to obtain a sorting result.
[0071] The matching module is used to match the sorting result with the returned structure to verify the validity of the sorting result.
[0072] Exemplarily, the preset data format includes a priority rule, a creation value, and a hit value;
[0073] The priority rules are formulated based on the current business scenario; the generated values are reference values for initializing the values of the data of the different groups; and the hit values reflect the matching degree of each rule in the priority rules.
[0074] Exemplarily, the sorting of data according to the priority rules configured in the data format to obtain a sorting result specifically includes:
[0075] Use Stream streaming operations to filter and obtain the required grouped data;
[0076] The data to be sorted is generated according to the generated value, and the priority rule matching the hit value is called to sort the data to obtain a sorting result.
[0077] Exemplarily, the matching module is specifically configured to:
[0078] If the data format of the sorting result is consistent with that of the returned structure, the sorting result is valid;
[0079] If the data format of the sorting result and the returned structure are inconsistent, the sorting result is invalid.
[0080] It should be noted that the modules above are executed based on internally stored software applications. These applications can be written in pure Java. If written in Java, they do not rely on other technical components (relying solely on the Message SDK), eliminating the need to modify the system under test and making them simple and convenient to use.
[0081] For Java-based testng data-driven methods, fill in the priority information in the dataProvider according to the rules. Priority here refers to the sorting rules for the simultaneous occurrence of multiple data points according to each business requirement function point.
[0082] Compared to existing technologies, the grouping-based data sorting device provided by the present invention consolidates data from different groups into a pre-defined data format, thereby avoiding duplication of data. It also groups and processes the steps involved in the sorting process (data initialization, rule setting, expected sorting rules, data cleaning, etc.) to produce a sorting result. Finally, the correctness of the sorting result is determined based on the returned structure.
[0083] In general, the group-based data sorting device provided by the embodiments of the present invention only requires the development of data and predefined rules. No additional configuration is required, and no modifications to the target system are required. This effectively avoids the generation of duplicate data, thereby improving sorting efficiency. During the sorting and testing process, no manual intervention is required, reducing the resource investment of testers.
[0084] In general, the message automatic testing method and device provided by the embodiments of the present invention only require the message sender to prepare the required data, message sending content and business scenario process, and verify the logic. There is no need to pay attention to other basic service processing, which effectively reduces the resource investment cost of the tester and improves the message sending efficiency and inspection efficiency.
[0085] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A data sorting method based on grouping, characterized in that: include: Set post-conditions and grouping strategies based on the current business scenario and target storage system characteristics; Create multiple groups according to the grouping strategy, insert data into the groups according to the insertion logic corresponding to the groups, and obtain data of different groups; After the data group insertion is completed, the cleaning process corresponding to the group is performed on the data of the different groups according to the post-condition; Define the return structure based on the current business scenario; Integrating the cleaned data of the different groups into a preset data format, and sorting the data according to the priority rules configured in the data format to obtain a sorting result; Matching the sorting result with the returned structure to verify the validity of the sorting result, specifically including: if the data format of the sorting result and the returned structure are consistent, the sorting result is valid; if the data format of the sorting result and the returned structure are inconsistent, the sorting result is invalid; Wherein, the preset data format includes priority rules, creation values and hit values; The priority rules are formulated based on the current business scenario; the generated values are reference values for initializing the values of the data in different groups; and the hit values reflect the degree of matching between the data and each rule in the priority rules.
2. The data sorting method based on grouping according to claim 1, characterized in that: Sorting the data according to the priority rules configured in the data format to obtain a sorting result specifically includes: Use Stream streaming operations to filter and obtain the required grouped data; The data to be sorted is generated according to the generated value, and the priority rule matching the hit value is called to sort the data to obtain a sorting result.
3. A data sorting device based on grouping, characterized in that: include: The initial setup module is used to set post-conditions and grouping strategies based on the current business scenario and target storage system characteristics; A grouping module is used to create multiple groups according to the grouping strategy, insert data into groups according to the insertion logic corresponding to the groups, and obtain data of different groups; A cleaning module, configured to perform group-specific cleaning on the data of different groups according to post-conditions after the data group insertion is completed; Definition module, used to define the return structure according to the current business scenario; A sorting module is used to integrate the cleaned data of the different groups into a preset data format, and sort the data according to the priority rules configured in the data format to obtain a sorting result; A matching module is used to match the sorting result with the returned structure and verify the validity of the sorting result, specifically including: if the data format of the sorting result and the returned structure are consistent, the sorting result is valid; if the data format of the sorting result and the returned structure are inconsistent, the sorting result is invalid; Wherein, the preset data format includes priority rules, creation values and hit values; The priority rules are formulated based on the current business scenario; the generated values are reference values for initializing the values of the data in different groups; and the hit values reflect the degree of matching between the data and each rule in the priority rules.
4. The data sorting device based on grouping as claimed in claim 3, characterized in that: Sorting the data according to the priority rules configured in the data format to obtain a sorting result specifically includes: Use Stream streaming operations to filter and obtain the required grouped data; The data to be sorted is generated according to the generated value, and the priority rule matching the hit value is called to sort the data to obtain a sorting result.
Citation Information
Patent Citations
Method for realizing multi-packet data sorting by using GPU in field of big data
CN111831861A
Packet re-aligner and packet re-aligning method for distributed switch system
JP2008092485A