CN112988215A - Method and device for realizing evaluation rule and evaluating user data and electronic equipment - Google Patents

Method and device for realizing evaluation rule and evaluating user data and electronic equipment Download PDF

Info

Publication number
CN112988215A
CN112988215A CN202110177275.2A CN202110177275A CN112988215A CN 112988215 A CN112988215 A CN 112988215A CN 202110177275 A CN202110177275 A CN 202110177275A CN 112988215 A CN112988215 A CN 112988215A
Authority
CN
China
Prior art keywords
rule
class
subclass
evaluation
skeleton
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110177275.2A
Other languages
Chinese (zh)
Inventor
袁铨
刘波
杜翠红
卜林杰
陈帆
李龙飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp filed Critical China Construction Bank Corp
Priority to CN202110177275.2A priority Critical patent/CN112988215A/en
Publication of CN112988215A publication Critical patent/CN112988215A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3628Software debugging of optimised code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management

Abstract

The embodiment of the application provides a method and a device for realizing an evaluation rule and evaluating user data and electronic equipment. The method for realizing the evaluation rule comprises the following steps: creating a framework implementation class, wherein a first common attribute and a first common method are defined in the framework implementation class; the interface corresponding to the rule group is realized through the framework realization class, and a second common attribute required by the corresponding rule group and a second common method required by the rule group are defined in the interface; and establishing a rule subclass based on the skeleton implementation class, wherein the rule subclass is used for implementing the evaluation rule. In the scheme, the mode of realizing the class implementation interface through the framework enables the rule subclass to have the attributes and the methods required by the user evaluation system, and the attributes and the methods required by the rule group, so that the defects of increased code coupling degree, large code repetition quantity and the like possibly caused by the conventional mode can be avoided, the coding efficiency is improved, the structural hierarchy of the system code is ensured, and the code expansibility is ensured.

Description

Method and device for realizing evaluation rule and evaluating user data and electronic equipment
Technical Field
The application relates to the technical field of computers, in particular to a method and a device for realizing an evaluation rule and evaluating user data and electronic equipment.
Background
When evaluating user data, it is generally necessary to base the evaluation on a set of well-established complex rules, usually including one or more rule sets. The evaluation rules in the rule set may be of different types, but have the same attributes.
At system development time, each evaluation rule is generally defined as a rule subclass, and a parent class is defined, wherein some common attributes and common methods required in the system are defined.
Most rule subclasses need to inherit this parent class so that rule subclasses have these common properties and common methods. However, rule subclasses also need to have common properties and common methods for the rule groups, and rule subclasses need to satisfy the principle of inheritance from only one parent class. In order to solve this problem, the prior art generally uses the following two methods:
the first is to define common attributes and common methods required by a rule group in a parent class, and to have these common attributes and common methods by inheriting a rule subclass from the parent class.
The second is to directly define the common attributes and common methods that the rule group needs to have in the subclass.
In the first method, since the common attributes and common methods required by the rule group are defined in the parent class, all the rule subclasses inherited from the parent class have the common attributes and common methods, but most of the rule subclasses do not call the common attributes and common methods, so that the coupling degree between the rule subclasses is improved.
The second method is inconvenient for subsequent function expansion and code maintenance, and greatly increases repeated codes, so that the implementation class of the system has no structural hierarchy.
In summary, the existing methods all have certain disadvantages.
Disclosure of Invention
The present application aims to solve at least one of the above technical drawbacks. The technical scheme adopted by the application is as follows:
in a first aspect, an embodiment of the present application provides an implementation method of an evaluation rule, where the method includes:
creating a framework implementation class, wherein a first common attribute and a first common method are defined in the framework implementation class;
the interface corresponding to the rule group is realized through the framework realization class, and a second common attribute required by the corresponding rule group and a second common method required by the rule group are defined in the interface;
and establishing a rule subclass based on the skeleton implementation class, wherein the rule subclass is used for implementing the evaluation rule.
Optionally, the method further includes:
the rule group is determined based on at least two evaluation rules that implement a second common attribute and a second common method defined in the interface corresponding to the rule group.
Optionally, determining the rule set based on at least two evaluation rules comprises:
combining rule subclasses corresponding to at least two evaluation rules into an aggregation class;
the set of rules is implemented based on the aggregation class.
Optionally, creating a rule subclass based on the skeleton implementation class, including:
a rule subclass is created that inherits from the skeleton implementation class.
Optionally, creating a rule subclass based on the skeleton implementation class, including:
creating an inner class that inherits from the skeleton implementation class;
a rule subclass is created that inherits from the inner class.
Optionally, the method further includes:
and checking the skeleton implementation class inherited by the rule subclass.
Optionally, checking the skeleton implementation class inherited by the rule subclass includes:
creating an external implementation class, and inheriting the rule subclass from the external implementation class;
and checking the skeleton implementation class inherited by the rule subclass through the external implementation class.
Optionally, the first common attribute comprises at least one of:
a last maintenance date;
finally, maintaining the channel;
the first common method includes at least one of:
a method of obtaining a last maintenance date;
a method of setting a last maintenance date;
a method for obtaining the category of the final maintenance channel;
setting a method for maintaining channel types finally;
a method for obtaining the number of the last maintenance staff;
and setting a method for maintaining the employee number finally.
Optionally, the second common attribute comprises at least one of:
a rule expiration date;
a rule effective date;
the second common method comprises at least one of:
a maintenance method of rule expiration date;
a maintenance method of rule effective date;
a method for querying rule details;
method for querying a rule list.
In a second aspect, an embodiment of the present application provides a method for evaluating user data, where the method includes:
acquiring an evaluation rule corresponding to user data to be evaluated, wherein a rule subclass for realizing the evaluation rule is created based on a skeleton realization class, a first common attribute and a first common method are defined in the skeleton realization class, an interface corresponding to a rule group is realized in the skeleton realization class, and a second common attribute required by the corresponding rule group and a second common method required by the rule group are defined in the interface;
and evaluating the user data to be evaluated based on the evaluation rule.
Optionally, the rule subclass implements class creation based on a skeleton by:
creating a rule subclass inherited from the skeleton implementation class; alternatively, the first and second electrodes may be,
an inner class is created that inherits from the skeleton implementation class, and a rule subclass is created that inherits from the inner class.
Optionally, obtaining an evaluation rule corresponding to user data to be evaluated includes:
and obtaining an evaluation rule corresponding to the user data to be evaluated from a pre-configured rule group, wherein the rule group comprises at least two evaluation rules.
In a third aspect, an embodiment of the present application provides an apparatus for implementing an evaluation rule, where the apparatus includes:
the framework realization type creating module is used for creating a framework realization type, and a first common attribute and a first common method are defined in the framework realization type;
the interface realization module is used for realizing the interface corresponding to the rule group through the framework realization class, and the interface defines a second common attribute required by the corresponding rule group and a second common method required by the rule group;
and the rule subclass creating module is used for creating a rule subclass based on the skeleton realization class, and the rule subclass is used for realizing the evaluation rule.
Optionally, the apparatus further comprises:
a rule group determination module for determining a rule group based on at least two evaluation rules, the at least two evaluation rules implementing a second common attribute and a second common method defined in an interface corresponding to the rule group.
Optionally, when determining the rule group based on at least two evaluation rules, the rule group determining module is specifically configured to:
combining rule subclasses corresponding to at least two evaluation rules into an aggregation class;
the set of rules is implemented based on the aggregation class.
Optionally, the rule subclass creating module is specifically configured to, when creating the rule subclass based on the skeleton implementation class:
a rule subclass is created that inherits from the skeleton implementation class.
Optionally, the rule subclass creating module is specifically configured to, when creating the rule subclass based on the skeleton implementation class:
creating an inner class that inherits from the skeleton implementation class;
a rule subclass is created that inherits from the inner class.
Optionally, the apparatus further comprises:
and the checking module is used for checking the skeleton implementation class inherited by the rule subclass.
Optionally, the verification module is specifically configured to:
creating an external implementation class, and inheriting the rule subclass from the external implementation class;
and checking the skeleton implementation class inherited by the rule subclass through the external implementation class.
Optionally, the first common attribute comprises at least one of:
a last maintenance date;
finally, maintaining the channel;
the first common method includes at least one of:
a method of obtaining a last maintenance date;
a method of setting a last maintenance date;
a method for obtaining the category of the final maintenance channel;
setting a method for maintaining channel types finally;
a method for obtaining the number of the last maintenance staff;
and setting a method for maintaining the employee number finally.
The second common attribute comprises at least one of:
a rule expiration date;
a rule effective date;
the second common method comprises at least one of:
a maintenance method of rule expiration date;
a maintenance method of rule effective date;
a method for querying rule details;
method for querying a rule list.
In a fourth aspect, an embodiment of the present application provides an apparatus for evaluating user data, where the apparatus includes:
the evaluation rule module is used for acquiring an evaluation rule corresponding to user data to be evaluated, and a rule subclass for realizing the evaluation rule is created based on a skeleton realization class, wherein a first common attribute and a first common method are defined in the skeleton realization class, an interface corresponding to a rule group is realized in the skeleton realization class, and a second common attribute required by the corresponding rule group and a second common method required by the rule group are defined in the interface;
and the evaluation module is used for evaluating the user data to be evaluated based on the evaluation rule.
Optionally, the rule subclass implements class creation based on a skeleton by:
creating a rule subclass inherited from the skeleton implementation class; alternatively, the first and second electrodes may be,
an inner class is created that inherits from the skeleton implementation class, and a rule subclass is created that inherits from the inner class.
Optionally, when obtaining the evaluation rule corresponding to the user data to be evaluated, the evaluation rule module is specifically configured to:
and obtaining an evaluation rule corresponding to the user data to be evaluated from a pre-configured rule group, wherein the rule group comprises at least two evaluation rules.
In a fifth aspect, an embodiment of the present application provides an electronic device, including: a processor and a memory;
a memory for storing operating instructions;
a processor, configured to execute the method according to any implementation manner of the first aspect or any implementation manner of the second aspect of the present application by calling an operation instruction.
In a sixth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the method as shown in any of the embodiments of the first aspect or any of the embodiments of the second aspect of the present application.
The technical scheme provided by the embodiment of the application has the following beneficial effects:
according to the scheme provided by the embodiment of the application, the framework implementation class is created, the first common attribute and the first common method are defined in the framework implementation class, the interface corresponding to the rule group is implemented through the framework implementation class, the second common attribute required by the corresponding rule group and the second common method required by the rule group are defined in the interface, and therefore the rule subclass is created based on the framework implementation class, and the evaluation rule is implemented through the rule subclass. In the scheme, the mode of realizing the class implementation interface through the framework enables the rule subclass to have the attributes and the methods required by the user evaluation system, and the attributes and the methods required by the rule group, so that the defects of increased code coupling degree, large code repetition quantity and the like possibly caused by the conventional mode can be avoided, the coding efficiency is improved, the structural hierarchy of the system code is ensured, and the code expansibility is ensured.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the description of the embodiments of the present application will be briefly described below.
Fig. 1 is a schematic flowchart of an implementation method of an evaluation rule according to an embodiment of the present application;
FIG. 2 is a frame diagram of a framework implementation provided in an embodiment of the present application;
FIG. 3 is a schematic diagram of a class inheritance relationship in an example provided by an embodiment of the present application;
fig. 4 is a schematic flowchart of a method for evaluating user data according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an apparatus for implementing an evaluation rule according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an apparatus for evaluating user data according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present invention.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
The terms referred to in this application will first be introduced and explained:
skeletal implementation class (skeletal implementation): refers to an abstract type definition class that combines the advantages of an interface with an abstract class.
A user evaluation system: through the combined configuration of multiple basic rules, various behaviors of the user are analyzed in a running mode, evaluation results are generated, and a user contribution value matched with the user rating is given to the system;
evaluation rules: the method refers to a unified basic definition for evaluating and analyzing user data such as user behavior flow and the like, and is the most basic rule;
rule set: a collection of multiple types of evaluation rules is included.
The user evaluation information system needs to match and analyze user data (such as behavior flowing, trajectory classification, etc.) based on a set of effective complex rules, usually one or more rule sets, so as to rate a certain class of users or give contribution values to the users.
The rule group comprises a plurality of evaluation rules of different types, such as a basic contribution value rule of a user, a contribution value coefficient rule, a non-contribution value counting rule, an online and offline rule and the like. These several types of rules may be one or more rule sets that form a category, and then jointly combined into a rule set, and act on the user data through the rule set. Although these evaluation rules belong to different types of rules, most of the attribute values are different, they are commonly affiliated with a rule group, and there are some common attributes and common methods for the rule group. Common attributes required by the rule set are effective date and invalid date, rule set number and the like.
During system development, in order to isolate classes of the system and meet the design idea of single responsibility, each type of evaluation rule is defined as a minimum rule subclass, the rule subclasses of similar types can inherit a same parent class, and some common methods and common attributes required by the type rule of the system are defined in the parent class, such as attributes of last modification of an operator label, last modification time and the like, and methods of obtaining the last modification of the operator label and the last modification time. Most rule subclasses in the system need to inherit this parent class, but they must also be able to have the common methods and common properties required by the rule set, such as: rule group numbers, rule sequence numbers, and the like, and methods of generating these numbers. Meanwhile, the rule subclass needs to satisfy the rule that can only inherit one parent class.
In the prior art, when some common attributes and common methods required by a rule group are involved, a processing mode is to define some common attributes and common methods required by the rule group in a parent class inherited by a rule subclass, for example, a plurality of service classes are allowed to jointly inherit an abstract parent class with an audit field. This allows all rule subclasses to have these common properties and common methods, which most rule subclasses do not call in actual use. This approach therefore improves the degree of coupling between the subclasses of rules. In addition, the subclasses can not inherit other implementation classes in this way, and thus the function expansion of the classes is greatly limited.
Another approach in the prior art is to directly define the common properties and common methods of rule groups in the rule subclasses. This approach has the disadvantage of not facilitating subsequent function expansion and code maintenance, and the large increase in duplicate code may result in an unstructured hierarchy of the implementation class of the system.
At present, in a user evaluation system, there are many types of evaluation rules involved, the association relationship between the rules is complex, and with the development of services, various rules evaluated by a user are expected to have great flexibility, can be quickly split and combined, can be easily maintained, and can be flexibly and widely applied to various service environments, so that a class hierarchy structure of the evaluation rules with a loose coupling structure is required to adapt to flexible development. Aiming at the complex rule configuration of the current user evaluation, the method of the class hierarchy structure with both loose coupling and flexible combination is provided, in development, the reuse rate of rule subclasses can be improved without rewriting the rule subclasses, various rules are easily and flexibly combined, and the method is suitable for multiple service scenes of the user evaluation.
The method, the device and the electronic equipment for realizing the evaluation rule and evaluating the user data provided by the embodiment of the application aim to solve at least one of the above technical problems in the prior art.
The following describes the technical solutions of the present application and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 1 shows a schematic flow diagram of an implementation method of an evaluation rule provided in an embodiment of the present application, and as shown in fig. 1, the method mainly includes:
step S110: creating a framework implementation class, wherein a first common attribute and a first common method are defined in the framework implementation class;
step S120: the interface corresponding to the rule group is realized through the framework realization class, and a second common attribute required by the corresponding rule group and a second common method required by the rule group are defined in the interface;
step S130: and establishing a rule subclass based on the skeleton implementation class, wherein the rule subclass is used for implementing the evaluation rule.
In the embodiment of the application, the first common attribute and the first common method are attributes and methods required in the user evaluation system, and the first common attribute and the first common method are defined through the framework implementation class, so that the rule subclass created based on the framework implementation class can have the first common attribute and the first common method.
In this embodiment, the second common attribute and the second common method are attributes and methods required by the rule groups, and the skeleton implementation class may respectively implement corresponding interfaces for each rule group, that is, the attributes and methods required by each rule group are defined in the corresponding interfaces.
In the embodiment of the present application, the evaluation rule may be defined by a rule subclass, and the rule group may include a plurality of evaluation rules.
Because the second common attribute and the second common method are defined in the interface realized by the skeleton realization class, the rule subclass created based on the skeleton realization class can have the second common attribute and the second common method.
By defining the attributes and methods required by different rule groups in the corresponding interfaces, the attributes and methods required by all rule groups are prevented from being directly defined in a father class, and the height of coupling degree between rule subclasses is avoided. In addition, because the rule set can be newly added in a mode of defining the interface, the expansion of subsequent functions is facilitated, the increase of repeated code responses caused by directly defining the attributes and methods required by the rule set in the rule subclass is avoided, and the structural hierarchy of the code is ensured.
According to the method provided by the embodiment of the application, the framework implementation class is created, the first common attribute and the first common method are defined in the framework implementation class, the interface corresponding to the rule group is implemented through the framework implementation class, the second common attribute required by the corresponding rule group and the second common method required by the rule group are defined in the interface, and therefore the rule subclass is created based on the framework implementation class, and the evaluation rule is implemented through the rule subclass. In the scheme, the mode of realizing the class implementation interface through the framework enables the rule subclass to have the attributes and the methods required by the user evaluation system, and the attributes and the methods required by the rule group, so that the defects of increased code coupling degree, large code repetition quantity and the like possibly caused by the conventional mode can be avoided, the coding efficiency is improved, the structural hierarchy of the system code is ensured, and the code expansibility is ensured.
In an optional manner of the embodiment of the present application, the method further includes:
the rule group is determined based on at least two evaluation rules that implement a second common attribute and a second common method defined in the interface corresponding to the rule group.
In the embodiment of the present application, since the second common attribute and the second common method are defined in the interface, the rule subclass can implement the second common attribute and the second common method, so that the rule subclass can have the attribute and the method required by the rule group to which the rule subclass belongs.
In the embodiment of the present application, the rule group may include a plurality of evaluation rules of different types, and the rule subclass used for implementing the evaluation rules in the rule group needs to have the attributes and methods required by the rule group. The rule subclasses belonging to the same rule group need to implement a second common attribute and a second common method defined in the interface corresponding to the rule group.
By combining multiple rule subclasses into one or more rule groups, different rule groups can be created according to different business scenarios.
In the embodiment of the present application, determining a rule group based on at least two evaluation rules includes:
combining rule subclasses corresponding to at least two evaluation rules into an aggregation class;
the set of rules is implemented based on the aggregation class.
In the embodiment of the application, the rule subclasses corresponding to the evaluation rules belonging to the same rule group can be combined into the aggregation class, so that the rule group is realized based on the aggregation class.
In an optional manner of the embodiment of the present application, creating a rule subclass based on a skeleton implementation class includes:
a rule subclass is created that inherits from the skeleton implementation class.
In an optional manner of the embodiment of the present application, creating a rule subclass based on a skeleton implementation class includes:
creating an inner class that inherits from the skeleton implementation class;
a rule subclass is created that inherits from the inner class.
In the embodiment of the application, the rule subclass can directly inherit from the skeleton implementation class.
Because the rule subclass needs to meet the requirement that more than one parent class cannot be inherited, if the rule subclass is directly inherited from the parent class or the skeleton implementation class, other implementation classes cannot be inherited, and the function extension of the class is greatly limited.
In the embodiment of the application, an internal class inherited from the framework implementation class can be defined, and the rule subclass inherits from the internal class, and at the moment, the rule subclass can inherit other external implementation classes simultaneously, so that the extension of class functions is realized.
In an optional manner of the embodiment of the present application, the method further includes:
and checking the skeleton implementation class inherited by the rule subclass.
In an optional manner of the embodiment of the present application, the verifying the skeleton implementation class inherited by the rule subclass includes:
creating an external implementation class, and inheriting the rule subclass from the external implementation class;
and checking the skeleton implementation class inherited by the rule subclass through the external implementation class.
In the embodiment of the application, the skeleton implementation class inherited by the rule subclass can be checked, as an example, an external implementation class can be created, and the rule subclass is inherited from the external implementation class, so that the external implementation class can be called to complete checking of the skeleton implementation class.
In an optional manner of the embodiment of the present application, the first common attribute includes at least one of:
a last maintenance date;
finally, maintaining the channel;
the first common method includes at least one of:
a method of obtaining a last maintenance date;
a method of setting a last maintenance date;
a method for obtaining the category of the final maintenance channel;
setting a method for maintaining channel types finally;
a method for obtaining the number of the last maintenance staff;
and setting a method for maintaining the employee number finally.
In an optional manner of the embodiment of the present application, the second common attribute includes at least one of:
a rule expiration date;
a rule effective date;
the second common method comprises at least one of:
a maintenance method of rule expiration date;
a maintenance method of rule effective date;
a method for querying rule details;
method for querying a rule list.
As an example, fig. 2 shows a framework diagram for implementing a framework provided by an embodiment of the present application.
As shown in fig. 2, the IuniAttributeService interface (i.e., interface): wherein a second common attribute and a second common method are defined.
AbstractSkeletonObject class: the class is an abstract class which realizes an interface, namely a skeleton realization class, and in the class, a first common attribute and a first common method are defined, and a second common attribute and a second common method which are defined in the interface are also realized.
The subclasses, i.e., rule subclasses, are exemplified in this example by a basic contribution value rule, a contribution value coefficient rule, a non-calculation contribution value rule, and a special contribution value calculation rule. In practice, multiple rule subclasses may be defined as desired. In this example, the basic contribution value rule subclass and the contribution value coefficient rule subclass have the same method and properties, that is, the effective time and the failure time need to be defined, so that the basic contribution value rule subclass and the contribution value coefficient rule subclass inherit the skeleton implementation class;
rule set: the rule set in this example appears as an aggregate class, which consists of one or more rule subclasses;
the ValidateObject class, an external implementation class, may define a validation parent class that part of the child class inherits.
As an example, a schematic diagram illustrating class inheritance relationship in an example provided by an embodiment of the present application is shown in FIG. 3. The rule subclass 1, the rule subclass 2, the rule subclass 3, the rule subclass 4, and the rule subclass 5 … … are rule subclasses in the rule group, wherein the rule subclass 1 and the rule subclass 2 are inherited from the skeleton implementation class. Rule subclass 3 inherits from external implementation class 1, and rule subclass 4 inherits from external implementation class 2.
The method provided by the embodiment of the application integrates a plurality of common attributes belonging to different classes and a common method by providing a skeleton implementation class. A plurality of classes in the system can be conveniently integrated, the logical structure and the code quantity of the codes are simplified, and the functions of the subclasses are expanded. Particularly, in a user evaluation system, the related subclasses are more, the mutual relation is complex, the coding efficiency can be greatly improved, the code readability is increased, and the defined rule subclasses can be flexibly applied to different development scenes in a skeleton implementation class mode.
Fig. 4 is a schematic flowchart illustrating a method for evaluating user data according to an embodiment of the present application, where as shown in fig. 4, the method mainly includes:
step S210: acquiring an evaluation rule corresponding to user data to be evaluated, wherein a rule subclass for realizing the evaluation rule is created based on a skeleton realization class, a first common attribute and a first common method are defined in the skeleton realization class, an interface corresponding to a rule group is realized in the skeleton realization class, and a second common attribute required by the corresponding rule group and a second common method required by the rule group are defined in the interface;
step S220: and evaluating the user data to be evaluated based on the evaluation rule.
In the embodiment of the application, the evaluation rule can be realized through a rule subclass.
The rule subclass can be created based on the skeleton implementation class, the first common attribute and the first common method can be defined through the skeleton implementation class, the interface is simultaneously implemented through the skeleton implementation class, and the second common attribute and the second common method are defined in the interface, so that the rule subclass created based on the skeleton implementation class can have the first common attribute and the first common method and has the second common attribute and the second common method required in the rule group.
In this embodiment, the user data may include data generated by a user in a business process, such as behavior flowing.
According to the method provided by the embodiment of the application, the evaluation rule corresponding to the user data to be evaluated is obtained, and the user data to be evaluated is evaluated based on the evaluation rule. Because the rule subclass for realizing the evaluation rule is created based on the framework realization class, the framework realization class defines a first common attribute and a first common method, the framework realization class realizes an interface corresponding to the rule group, and the interface defines a second common attribute required by the corresponding rule group and a second common method required by the rule group, therefore, in the scheme, the rule subclass can have the attributes and methods required by the user evaluation system through the way of realizing the interface by the framework realization class, and the attributes and methods required by the rule group can avoid the defects of increased code coupling degree, large code repetition amount and the like possibly caused by the existing way, thereby improving the coding efficiency, ensuring the structural hierarchy of the system code and ensuring the code expansibility.
In an optional mode of the embodiment of the application, the rule subclass is created based on the skeleton, and the rule subclass is created by the following mode:
creating a rule subclass inherited from the skeleton implementation class; alternatively, the first and second electrodes may be,
an inner class is created that inherits from the skeleton implementation class, and a rule subclass is created that inherits from the inner class.
In the embodiment of the application, the rule subclass can directly inherit from the framework realization class, and can also define an internal class inheriting from the framework realization class, and the rule subclass inherits from the internal class, and at the moment, the rule subclass can inherit other external realization classes simultaneously, so that the class function is expanded.
In an optional manner of the embodiment of the present application, obtaining an evaluation rule corresponding to user data to be evaluated includes:
and obtaining an evaluation rule corresponding to the user data to be evaluated from a pre-configured rule group, wherein the rule group comprises at least two evaluation rules.
In the embodiment of the application, one or more evaluation rules can be configured as the rule group for different application scenarios, so that when the user data to be evaluated is processed, the corresponding evaluation rule can be obtained from the rule group, and the evaluation of the user data is realized through the evaluation rule.
Based on the same principle as the method shown in fig. 1, fig. 5 shows a schematic structural diagram of an implementation apparatus for an evaluation rule provided in an embodiment of the present application, and as shown in fig. 5, the implementation apparatus 30 for an evaluation rule may include:
a skeleton implementation class creating module 310, configured to create a skeleton implementation class, where a first common attribute and a first common method are defined in the skeleton implementation class;
the interface implementation module 320 is configured to implement an interface corresponding to the rule group through the framework implementation class, where a second common attribute required by the corresponding rule group and a second common method required by the rule group are defined in the interface;
and a rule subclass creating module 330, configured to create a rule subclass based on the skeleton implementation class, where the rule subclass is used to implement the evaluation rule.
The device provided by the embodiment of the application defines the first common attribute and the first common method in the skeleton implementation class by creating the skeleton implementation class, implements the interface corresponding to the rule group by the skeleton implementation class, and defines the second common attribute required by the corresponding rule group and the second common method required by the rule group in the interface, thereby creating the rule subclass based on the skeleton implementation class and implementing the evaluation rule by the rule subclass. In the scheme, the mode of realizing the class implementation interface through the framework enables the rule subclass to have the attributes and the methods required by the user evaluation system, and the attributes and the methods required by the rule group, so that the defects of increased code coupling degree, large code repetition quantity and the like possibly caused by the conventional mode can be avoided, the coding efficiency is improved, the structural hierarchy of the system code is ensured, and the code expansibility is ensured.
Optionally, the apparatus further comprises:
a rule group determination module for determining a rule group based on at least two evaluation rules, the at least two evaluation rules implementing a second common attribute and a second common method defined in an interface corresponding to the rule group.
Optionally, when determining the rule group based on at least two evaluation rules, the rule group determining module is specifically configured to:
combining rule subclasses corresponding to at least two evaluation rules into an aggregation class;
the set of rules is implemented based on the aggregation class.
Optionally, the rule subclass creating module is specifically configured to, when creating the rule subclass based on the skeleton implementation class:
a rule subclass is created that inherits from the skeleton implementation class.
Optionally, the rule subclass creating module is specifically configured to, when creating the rule subclass based on the skeleton implementation class:
creating an inner class that inherits from the skeleton implementation class;
a rule subclass is created that inherits from the inner class.
Optionally, the apparatus further comprises:
and the checking module is used for checking the skeleton implementation class inherited by the rule subclass.
Optionally, the verification module is specifically configured to:
creating an external implementation class, and inheriting the rule subclass from the external implementation class;
and checking the skeleton implementation class inherited by the rule subclass through the external implementation class.
Optionally, the first common attribute comprises at least one of:
a last maintenance date;
finally, maintaining the channel;
the first common method includes at least one of:
a method of obtaining a last maintenance date;
a method of setting a last maintenance date;
a method for obtaining the category of the final maintenance channel;
setting a method for maintaining channel types finally;
a method for obtaining the number of the last maintenance staff;
and setting a method for maintaining the employee number finally.
The second common attribute comprises at least one of:
a rule expiration date;
a rule effective date;
the second common method comprises at least one of:
a maintenance method of rule expiration date;
a maintenance method of rule effective date;
a method for querying rule details;
method for querying a rule list.
It is understood that the above modules of the implementation apparatus of the evaluation rule in the present embodiment have functions of implementing corresponding steps of the implementation method of the evaluation rule in the embodiment shown in fig. 1. The function can be realized by hardware, and can also be realized by executing corresponding software by hardware. The hardware or software includes one or more modules corresponding to the functions described above. The modules can be software and/or hardware, and each module can be implemented independently or by integrating a plurality of modules. For the functional description of each module of the apparatus for implementing the evaluation rule, reference may be specifically made to the corresponding description of the method for implementing the evaluation rule in the embodiment shown in fig. 1, and details are not repeated here.
Based on the same principle as the method shown in fig. 4, fig. 6 shows a schematic structural diagram of an apparatus for evaluating user data according to an embodiment of the present application, and as shown in fig. 6, the apparatus 40 for evaluating user data may include:
the evaluation rule module 410 is configured to obtain an evaluation rule corresponding to user data to be evaluated, where a rule subclass for implementing the evaluation rule is created based on a skeleton implementation class, a first common attribute and a first common method are defined in the skeleton implementation class, an interface corresponding to a rule group is implemented in the skeleton implementation class, and a second common attribute required by the corresponding rule group and a second common method required by the rule group are defined in the interface;
and the evaluation module 420 is configured to evaluate the user data to be evaluated based on the evaluation rule.
The device provided by the embodiment of the application evaluates the user data to be evaluated based on the evaluation rule by acquiring the evaluation rule corresponding to the user data to be evaluated. Because the rule subclass for realizing the evaluation rule is created based on the framework realization class, the framework realization class defines a first common attribute and a first common method, the framework realization class realizes an interface corresponding to the rule group, and the interface defines a second common attribute required by the corresponding rule group and a second common method required by the rule group, therefore, in the scheme, the rule subclass can have the attributes and methods required by the user evaluation system through the way of realizing the interface by the framework realization class, and the attributes and methods required by the rule group can avoid the defects of increased code coupling degree, large code repetition amount and the like possibly caused by the existing way, thereby improving the coding efficiency, ensuring the structural hierarchy of the system code and ensuring the code expansibility.
Optionally, the rule subclass implements class creation based on a skeleton by:
creating a rule subclass inherited from the skeleton implementation class; alternatively, the first and second electrodes may be,
an inner class is created that inherits from the skeleton implementation class, and a rule subclass is created that inherits from the inner class.
Optionally, when obtaining the evaluation rule corresponding to the user data to be evaluated, the evaluation rule module is specifically configured to:
and obtaining an evaluation rule corresponding to the user data to be evaluated from a pre-configured rule group, wherein the rule group comprises at least two evaluation rules.
It is understood that the above modules of the user data evaluation device in the present embodiment have functions of implementing the corresponding steps of the user data evaluation method in the embodiment shown in fig. 4. The function can be realized by hardware, and can also be realized by executing corresponding software by hardware. The hardware or software includes one or more modules corresponding to the functions described above. The modules can be software and/or hardware, and each module can be implemented independently or by integrating a plurality of modules. For the functional description of each module of the above-mentioned user data evaluation apparatus, reference may be specifically made to the corresponding description of the user data evaluation method in the embodiment shown in fig. 4, and details are not repeated here.
The embodiment of the application provides an electronic device, which comprises a processor and a memory;
a memory for storing operating instructions;
and the processor is used for executing the method provided by any embodiment of the application by calling the operation instruction.
As an example, fig. 7 shows a schematic structural diagram of an electronic device to which an embodiment of the present application is applicable, and as shown in fig. 7, the electronic device 2000 includes: a processor 2001 and a memory 2003. Wherein the processor 2001 is coupled to a memory 2003, such as via a bus 2002. Optionally, the electronic device 2000 may also include a transceiver 2004. It should be noted that the transceiver 2004 is not limited to one in practical applications, and the structure of the electronic device 2000 is not limited to the embodiment of the present application.
The processor 2001 is applied to the embodiment of the present application to implement the method shown in the above method embodiment. The transceiver 2004 may include a receiver and a transmitter, and the transceiver 2004 is applied to the embodiments of the present application to implement the functions of the electronic device of the embodiments of the present application to communicate with other devices when executed.
The Processor 2001 may be a CPU (Central Processing Unit), general Processor, DSP (Digital Signal Processor), ASIC (Application Specific Integrated Circuit), FPGA (Field Programmable Gate Array) or other Programmable logic device, transistor logic device, hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. The processor 2001 may also be a combination of computing functions, e.g., comprising one or more microprocessors, DSPs and microprocessors, and the like.
Bus 2002 may include a path that conveys information between the aforementioned components. The bus 2002 may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus 2002 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 7, but this is not intended to represent only one bus or type of bus.
The Memory 2003 may be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions, an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical Disc storage, optical Disc storage (including Compact Disc, laser Disc, optical Disc, digital versatile Disc, blu-ray Disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to these.
Optionally, the memory 2003 is used for storing application program code for performing the disclosed aspects, and is controlled in execution by the processor 2001. The processor 2001 is used to execute the application program code stored in the memory 2003 to implement the methods provided in any of the embodiments of the present application.
The electronic device provided by the embodiment of the application is applicable to any embodiment of the method, and is not described herein again.
Compared with the prior art, the electronic equipment has the advantages that the framework implementation class is created, the first common attribute and the first common method are defined in the framework implementation class, the interface corresponding to the rule group is implemented through the framework implementation class, the second common attribute required by the corresponding rule group and the second common method required by the rule group are defined in the interface, the rule subclass is created based on the framework implementation class, and the evaluation rule is implemented through the rule subclass. In the scheme, the mode of realizing the class implementation interface through the framework enables the rule subclass to have the attributes and the methods required by the user evaluation system, and the attributes and the methods required by the rule group, so that the defects of increased code coupling degree, large code repetition quantity and the like possibly caused by the conventional mode can be avoided, the coding efficiency is improved, the structural hierarchy of the system code is ensured, and the code expansibility is ensured.
The present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the method shown in the above method embodiments.
The computer-readable storage medium provided in the embodiments of the present application is applicable to any of the embodiments of the foregoing method, and is not described herein again.
Compared with the prior art, the embodiment of the application provides a computer-readable storage medium, wherein a skeleton implementation class is created, a first common attribute and a first common method are defined in the skeleton implementation class, an interface corresponding to a rule group is implemented through the skeleton implementation class, a second common attribute required by the corresponding rule group and a second common method required by the rule group are defined in the interface, and therefore a rule subclass is created based on the skeleton implementation class, and an evaluation rule is implemented through the rule subclass. In the scheme, the mode of realizing the class implementation interface through the framework enables the rule subclass to have the attributes and the methods required by the user evaluation system, and the attributes and the methods required by the rule group, so that the defects of increased code coupling degree, large code repetition quantity and the like possibly caused by the conventional mode can be avoided, the coding efficiency is improved, the structural hierarchy of the system code is ensured, and the code expansibility is ensured.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The foregoing is only a partial embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (16)

1. An implementation method of an evaluation rule is characterized by comprising the following steps:
creating a framework implementation class, wherein a first common attribute and a first common method are defined in the framework implementation class;
an interface corresponding to a rule group is realized through the skeleton realization class, and a second common attribute required by the corresponding rule group and a second common method required by the rule group are defined in the interface;
and establishing a rule subclass based on the skeleton implementation class, wherein the rule subclass is used for implementing the evaluation rule.
2. The method of claim 1, further comprising:
determining a rule group based on at least two of the evaluation rules that implement the second common attribute and the second common method defined in an interface corresponding to the rule group.
3. The method of claim 2, wherein determining a rule set based on at least two of the evaluation rules comprises:
combining rule subclasses corresponding to at least two evaluation rules into an aggregation class;
implementing a set of rules based on the aggregation class.
4. The method of claim 1, wherein creating a rule subclass based on the skeleton implementation class comprises:
creating a rule subclass that inherits from the skeleton implementation class.
5. The method of claim 1, wherein creating a rule subclass based on the skeleton implementation class comprises:
creating an inner class that inherits from the skeleton implementation class;
a rule subclass is created that inherits from the inner class.
6. The method of claim 5, further comprising:
and checking the skeleton implementation class inherited by the rule subclass.
7. The method of claim 6, wherein the checking the skeleton implementation class inherited by the rule subclass comprises:
creating an external implementation class from which the rule subclass inherits;
and checking the skeleton implementation class inherited by the rule subclass through the external implementation class.
8. The method according to any of claims 1-7, characterized in that the first common attribute comprises at least one of:
a last maintenance date;
finally, maintaining the channel;
the first common method includes at least one of:
a method of obtaining a last maintenance date;
a method of setting a last maintenance date;
a method for obtaining the category of the final maintenance channel;
setting a method for maintaining channel types finally;
a method for obtaining the number of the last maintenance staff;
and setting a method for maintaining the employee number finally.
9. The method according to any of claims 1-7, wherein the second common attribute comprises at least one of:
a rule expiration date;
a rule effective date;
the second common method comprises at least one of:
a maintenance method of rule expiration date;
a maintenance method of rule effective date;
a method for querying rule details;
method for querying a rule list.
10. A method for evaluating user data, comprising:
acquiring an evaluation rule corresponding to user data to be evaluated, wherein a rule subclass for realizing the evaluation rule is created based on a skeleton realization class, a first common attribute and a first common method are defined in the skeleton realization class, an interface corresponding to a rule group is realized in the skeleton realization class, and a second common attribute required by the corresponding rule group and a second common method required by the rule group are defined in the interface;
and evaluating the user data to be evaluated based on the evaluation rule.
11. The method of claim 10, wherein the rule subclass implements class creation based on a skeleton by:
creating a rule subclass inherited from the skeleton implementation class; alternatively, the first and second electrodes may be,
an inner class is created that inherits from the skeleton implementation class, and a rule subclass is created that inherits from the inner class.
12. The method according to claim 10 or 11, wherein the obtaining of the evaluation rule corresponding to the user data to be evaluated comprises:
and obtaining an evaluation rule corresponding to the user data to be evaluated from a preset rule group, wherein the rule group comprises at least two evaluation rules.
13. An apparatus for implementing an evaluation rule, comprising:
the framework realization type creating module is used for creating a framework realization type, and a first common attribute and a first common method are defined in the framework realization type;
the interface realization module is used for realizing an interface corresponding to the rule group through the framework realization class, and a second common attribute required by the corresponding rule group and a second common method required by the rule group are defined in the interface;
and the rule subclass creating module is used for creating a rule subclass based on the skeleton implementation class, and the rule subclass is used for implementing the evaluation rule.
14. An apparatus for evaluating user data, comprising:
the evaluation rule module is used for acquiring an evaluation rule corresponding to user data to be evaluated, and a rule subclass for realizing the evaluation rule is created based on a skeleton realization class, wherein a first common attribute and a first common method are defined in the skeleton realization class, an interface corresponding to a rule group is realized in the skeleton realization class, and a second common attribute required by the corresponding rule group and a second common method required by the rule group are defined in the interface;
and the evaluation module is used for evaluating the user data to be evaluated based on the evaluation rule.
15. An electronic device comprising a processor and a memory;
the memory is used for storing operation instructions;
the processor is used for executing the method of any one of claims 1-12 by calling the operation instruction.
16. A computer-readable storage medium, characterized in that the storage medium has stored thereon a computer program which, when being executed by a processor, carries out the method of any one of claims 1-12.
CN202110177275.2A 2021-02-07 2021-02-07 Method and device for realizing evaluation rule and evaluating user data and electronic equipment Pending CN112988215A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110177275.2A CN112988215A (en) 2021-02-07 2021-02-07 Method and device for realizing evaluation rule and evaluating user data and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110177275.2A CN112988215A (en) 2021-02-07 2021-02-07 Method and device for realizing evaluation rule and evaluating user data and electronic equipment

Publications (1)

Publication Number Publication Date
CN112988215A true CN112988215A (en) 2021-06-18

Family

ID=76392573

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110177275.2A Pending CN112988215A (en) 2021-02-07 2021-02-07 Method and device for realizing evaluation rule and evaluating user data and electronic equipment

Country Status (1)

Country Link
CN (1) CN112988215A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114020762A (en) * 2021-11-09 2022-02-08 中国建设银行股份有限公司 User evaluation rule engine system and method and device thereof

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114020762A (en) * 2021-11-09 2022-02-08 中国建设银行股份有限公司 User evaluation rule engine system and method and device thereof

Similar Documents

Publication Publication Date Title
US8589884B2 (en) Method and system for identifying regression test cases for a software
US20200183947A1 (en) Integration template generation
US8869111B2 (en) Method and system for generating test cases for a software application
CN106557307B (en) Service data processing method and system
CN112147983B (en) Vehicle diagnosis method and device, electronic equipment and storage medium
CN110688111A (en) Configuration method, device, server and storage medium of business process
CN111858354A (en) Method and device for automatically generating test report, storage medium and electronic equipment
CN112988215A (en) Method and device for realizing evaluation rule and evaluating user data and electronic equipment
CN110851207A (en) State transition management method and device, electronic equipment and computer readable storage medium
CN109522086B (en) Operation method and device for window, computer device and readable storage medium
CN111260336A (en) Business checking method, device and equipment based on rule engine
CN112052157B (en) Method, device and system for constructing test message
CN115495424A (en) Data processing method, electronic device and computer program product
CN111752547A (en) Method for modifying Java serialized object serial number and application thereof
CN110177006B (en) Node testing method and device based on interface prediction model
CN112445461A (en) Business rule generation method and device, electronic equipment and readable storage medium
CN112559346A (en) Service testing method and device
CN113138906A (en) Call chain data acquisition method, device, equipment and storage medium
CN112132664B (en) Shopping data sharing method and system based on big data and electronic mall platform
CN116432219A (en) Data acquisition method, device, electronic equipment and storage medium
US20080162068A1 (en) Evaluation of Access Control and Filter Conditions
CN117077095A (en) Authority request response method and device and electronic equipment
CN111369346A (en) User credit evaluation method, device, server and storage medium
CN117931303A (en) Method, device, equipment and storage medium for managing state of component
CN116561005A (en) Special control flow jump procedure verification method based on semantic interpretation and legal stack constraint

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination