Disclosure of Invention
In order to solve the technical problems, the invention discloses a verification service arrangement method and device, wherein the general verification service can be called through a reflection mechanism, so that the verification service is separated from specific business logic, and further the verification service has better expandability.
The first aspect of the present invention provides a verification service arrangement method, including: receiving a check request aiming at certain service data, wherein the check request comprises an identification of the service data;
determining at least one check service identifier associated with the identifier of the service data according to the identifier of the service data;
Marking the check service identifier as an incoming parameter of a check service calling interface, so that the check service calling interface calls the check service pointed by the check service identifier through a reflection mechanism, and the check service finishes the check operation on the service data.
As an optional implementation manner, the determining at least one verification service identifier required for verifying the service data according to the identifier of the service data includes:
Reading a service data checking configuration table;
And inquiring the identification of the service data in the service data verification configuration table to obtain the verification service identification associated with the identification of the service data.
As an optional implementation manner, before the receiving the check request for a certain service data, the method further includes:
receiving a verification service configuration request, wherein the verification service configuration request comprises at least one preset service data identifier and a preset verification service identifier corresponding to the preset service data identifier;
Writing the preset check service identifier corresponding to the preset service data identifier into the service data check configuration table.
The verification request also comprises a service dynamic parameter and a value of the service dynamic parameter;
And after determining at least one verification service identifier associated with the identifier of the service data according to the identifier of the service data, the method further comprises:
And marking the service dynamic parameters and the values of the service dynamic parameters as configuration parameters of the verification service calling interface and the values of the configuration parameters, so that the verification service calling interface modifies the values of members matched with the service dynamic parameters in the verification service through a reflection mechanism.
A second aspect of the present invention provides a verification service orchestration device, comprising:
The receiving module is used for receiving a check request aiming at certain service data, wherein the check request comprises an identification of the service data;
the matching module is used for determining at least one check service identifier associated with the identifier of the service data according to the identifier of the service data;
and the check service calling module is used for marking the check service identifier as an incoming parameter of a check service calling interface, so that the check service calling interface calls the check service pointed by the check service identifier through a reflection mechanism, and the check service finishes the check operation on the service data.
As an alternative embodiment, the matching module includes:
The reading sub-module is used for reading the service data checking configuration table;
And the inquiring sub-module is used for inquiring the check service identifier associated with the identifier of the service data in the service data check configuration table.
As an alternative embodiment, the receiving module is further configured to:
receiving a verification service configuration request, wherein the verification service configuration request comprises at least one preset service data identifier and a preset verification service identifier corresponding to the preset service data identifier;
The device further comprises a writing module, wherein the writing module is used for writing the preset check service identifier corresponding to the preset service data identifier into the service data check configuration table.
As an optional implementation manner, the verification request further includes a service dynamic parameter and a value of the service dynamic parameter;
and the device further comprises a modification module, wherein the modification module is used for marking the service dynamic parameters and the values of the service dynamic parameters as configuration parameters of the verification service call interface and the values of the configuration parameters, so that the verification service call interface modifies the values of members matched with the service dynamic parameters in the verification service through a reflection mechanism.
A third aspect of the present invention provides still another verification service arrangement apparatus, comprising:
At least 1 memory cell;
a processing unit coupled to the at least 1 memory unit;
Wherein the at least 1 memory unit is configured to store computer instructions;
the processing unit is used for calling the computer instruction to execute the verification service arrangement method disclosed in the first aspect of the invention.
A fourth aspect of the present invention provides a computer storage medium storing computer instructions for executing the verification service orchestration method disclosed in the first aspect of the present invention when called.
Compared with the prior art, the invention has the following beneficial effects:
The invention can transmit the business check service identification to the check service call interface, and the check service call interface calls the check service through the reflection mechanism, so that the check service is independent of specific business processing logic to process business data, and one check service can be used for checking a plurality of different business data, and code redundancy caused by the fact that different business data correspond to one set of check service is avoided.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The terms first, second and the like in the description and in the claims and in the above-described figures are used for distinguishing between different objects and not necessarily for describing a sequential or chronological order. Furthermore, the terms "comprise" and "have," as well as any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, apparatus, article, or device that comprises a list of steps or elements is not limited to the list of steps or elements but may, in the alternative, include other steps or elements not expressly listed or inherent to such process, method, article, or device.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the invention. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
In order to verify the collected service data from various aspects, the prior art generally performs multi-dimensional verification on each collected service data, and the multi-dimensional verification on one service data generally depends on a verification service provided with specific service logic, that is, in the prior art, the verification service including specific service processing logic is generally used to verify one service data, so that the following problems occur:
Firstly, since the service data has multiple dimensions, and since the check service includes specific service processing logic, a certain check service can only be used for checking a certain dimension of the service data under the general condition, and when the multi-dimension check is needed to be performed on a certain service data, the multiple check services need to be invoked, and when the multi-dimension check is needed to be performed on the multiple service data, the number of the invoked check services will be large, thereby causing redundancy and low reuse rate of the check service. Second, the scalability of the verification service containing specific business processing logic is low, which is not beneficial to the update of the system.
Aiming at the above scene, the invention provides a verification service arrangement method and device.
Example 1
Referring to fig. 1, fig. 1 is a flowchart of a verification service arrangement method according to an embodiment of the invention. The method shown in fig. 1 may be used in a user terminal such as a smart phone (Android Mobile phone, iOS Mobile phone, etc.), a smart phone watch, a tablet computer, a palm computer, and a Mobile internet device (Mobile INTERNET DEVICES, MID), which is not limited in the embodiment of the present invention. As shown in fig. 1, the verification service orchestration method may include:
s101, receiving a check request aiming at certain service data, wherein the check request comprises identification of the service data.
In the embodiment of the invention, optionally, the service data can be collected through the data intelligent collection platform, and then the data intelligent collection platform sends the collected service data to the verification center, and the verification center verifies the service data after receiving a verification request of certain service data.
S102, determining at least one check service identifier associated with the identifier of the service data according to the identifier of the service data.
S103, marking the verification service identifier as an incoming parameter of a verification service calling interface, so that the verification service calling interface calls the verification service pointed by the verification service identifier through a reflection mechanism, and the verification service finishes the verification operation on the service data.
In the embodiment of the invention, optionally, the verification service pointed by the reflection calling verification service identifier can be realized by using the reflection tool class in the Spring framework, wherein the redundancy of codes can be further reduced by adopting the reflection tool class of the Spring framework to realize the verification service pointed by the reflection calling verification service identifier because the Spring is a lightweight control inversion (IoC) and a container framework facing to a tangent plane (AOP).
In the embodiment of the invention, optionally, after the verification service finishes the verification operation on the service data, a verification result is returned to the verification service calling interface.
A reflection mechanism primarily refers to a capability of a program to access, detect and modify its own state or behavior. Among them, LEAD/LEAD++, openC ++, metaXa, openJava, etc. are commonly known as reflection mechanism-based languages. In Java, for example, the Java reflection (radiation) mechanism refers to: "program runtime, which allows changing program structure or variable type, this language is called dynamic language", and Java, for example, has a very prominent dynamic correlation mechanism: reflection, used on Java, refers to classes that we can load, ascertain, use what is not known at all during compilation at runtime. In other words, a Java program may load a class whose name is known at runtime, learn its complete construct (but does not include methods definitions), and generate its object entity, or set its fields, or evoke its methods.
Therefore, the service verification service identification is transmitted to the verification service call interface, and the verification service call interface calls the verification service through the reflection mechanism, so that the verification service is independent of specific service processing logic to process service data, one verification service can be used for verifying a plurality of different service data, and code redundancy caused by the fact that the different service data correspond to one set of verification service is avoided.
Example two
Referring to fig. 2, fig. 2 is a flow chart of a verification service arrangement method according to a second embodiment of the invention. The method shown in fig. 1 may be used in a user terminal such as a smart phone (Android Mobile phone, iOS Mobile phone, etc.), a smart phone watch, a tablet computer, a palm computer, and a Mobile internet device (Mobile INTERNET DEVICES, MID), which is not limited in the embodiment of the present invention. As shown in fig. 2, the verification service orchestration method may include:
S201, receiving a verification service configuration request, wherein the verification service configuration request comprises at least one preset service data identifier and a preset verification service identifier corresponding to the preset service data identifier.
S202, writing a preset check service identifier corresponding to the preset service data identifier into a service data check configuration table.
In the embodiment of the present invention, optionally, a specific manner of writing the preset check service identifier corresponding to the preset service data identifier into the service data check configuration table may be:
And establishing an association relationship between the preset service data identifier and the preset check service identifier by taking the identifier of the preset service data as a main key.
S203, a check request for certain service data is received, wherein the check request comprises the identification of the service data.
S204, reading the service data check configuration table.
In the embodiment of the present invention, optionally, the data verification configuration table may be pre-stored in a data center, and further optionally, the data center may be a cloud storage space, a local database, or other types of data storage devices.
In the embodiment of the present invention, the format of the service data check configuration table may be xml format or excel format, which is not limited in the present invention.
In the embodiment of the invention, a plurality of check service identifiers are stored in the data check configuration table, wherein one or more check service identifiers can be associated with an identifier of one piece of service data. For example, assume that there is one piece of service data: { type of merchandise sales: 1}, and the identification of the business data is "sales", and in the data verification configuration table, "sales" is associated with "verification service 1" and "verification service 2".
S205, inquiring the service data identifier in the service data check configuration table to check the service identifier associated with the service data identifier.
S206, marking the verification service identification as an incoming parameter of the verification service calling interface, so that the verification service calling interface calls the verification service pointed by the verification service identification through a reflection mechanism, and the verification service finishes the verification operation on the service data.
As an optional implementation manner, the verification request further includes a service dynamic parameter and a value of the service dynamic parameter, and after determining at least one verification service identifier associated with the identifier of the service data according to the identifier of the service data, the verification service arrangement method in the embodiment of the present invention further includes the following steps:
And marking the service dynamic parameters and the values of the service dynamic parameters as configuration parameters of the check service call interface and the values of the configuration parameters, so that the check service call interface modifies the values of members matched with the service dynamic parameters in the check service through a reflection mechanism.
From the above, according to the embodiment of the invention, the associated personnel can configure what verification service is used for verifying each service data in the service data verification configuration table, so that the calling relationship between the service data and the verification service can be set conveniently and rapidly, thereby further reducing the redundancy of codes and improving the expandability of the verification service.
Example III
Referring to fig. 3, fig. 3 is a schematic structural diagram of a verification service arrangement device according to a third embodiment of the present invention. The device shown in fig. 3 may be applied to a user terminal such as a smart phone (Android Mobile phone, iOS Mobile phone, etc.), a smart phone watch, a tablet computer, a palm computer, a Mobile internet device (Mobile INTERNET DEVICES, MID), etc., which is not limited by the embodiment of the present invention. As shown in fig. 3, the verification service orchestration device may include:
the receiving module 301 is configured to receive a verification request for a certain service data, where the verification request includes an identifier of the service data.
In the embodiment of the invention, optionally, the service data can be collected through the data intelligent collection platform, and then the data intelligent collection platform sends the collected service data to the verification center, and the verification center verifies the service data after receiving a verification request of certain service data.
A matching module 302, configured to determine at least one verification service identifier associated with the identifier of the service data according to the identifier of the service data.
And the check service calling module 303 is configured to mark the check service identifier as an incoming parameter of the check service calling interface, so that the check service calling interface calls the check service pointed by the check service identifier through the reflection mechanism, and the check service completes the check operation on the service data.
In the embodiment of the invention, optionally, the verification service pointed by the reflection calling verification service identifier can be realized by using the reflection tool class in the Spring framework, wherein the redundancy of codes can be further reduced by adopting the reflection tool class of the Spring framework to realize the verification service pointed by the reflection calling verification service identifier because the Spring is a lightweight control inversion (IoC) and a container framework facing to a tangent plane (AOP).
In the embodiment of the present invention, optionally, after the verification service calling module 303 completes the verification operation on the service data, a verification result is returned to the verification service calling interface.
As an alternative embodiment, the matching module includes:
a reading submodule 3021 for reading the service data check configuration table;
and a query submodule 3022, configured to query the service data identifier in the service data verification configuration table for a verification service identifier associated with the service data identifier.
In the embodiment of the present invention, the format of the service data check configuration table may be xml format or excel format, which is not limited in the present invention.
As an alternative embodiment, the receiving module 301 is further configured to:
receiving a verification service configuration request, wherein the verification service configuration request comprises at least one preset service data identifier and a preset verification service identifier corresponding to the preset service data identifier;
And, the apparatus further includes a writing module 304, where the writing module 304 is configured to write a preset check service identifier corresponding to the preset service data identifier into the service data check configuration table.
In the embodiment of the present invention, optionally, a specific manner of writing the preset check service identifier corresponding to the preset service data identifier into the service data check configuration table may be:
And establishing an association relationship between the preset service data identifier and the preset check service identifier by taking the identifier of the preset service data as a main key.
As an optional implementation manner, the verification request further includes a service dynamic parameter and a value of the service dynamic parameter;
and the apparatus further comprises a modification module 305, wherein the modification module 305 is configured to mark the service dynamic parameter and the value of the service dynamic parameter as the configuration parameter and the value of the configuration parameter of the verification service call interface, so that the verification service call interface modifies the value of the member matched with the service dynamic parameter in the verification service through the reflection mechanism.
It should be noted that, after the writing module 304 writes the preset check service identifier corresponding to the preset service data identifier into the service data check configuration table after execution, the modification module 305 may be triggered to start.
A reflection mechanism primarily refers to a capability of a program to access, detect and modify its own state or behavior. Among them, LEAD/LEAD++, openC ++, metaXa, openJava, etc. are commonly known as reflection mechanism-based languages. In Java, for example, the Java reflection (radiation) mechanism refers to: "program runtime, which allows changing program structure or variable type, this language is called dynamic language", and Java, for example, has a very prominent dynamic correlation mechanism: reflection, used on Java, refers to classes that we can load, ascertain, use what is not known at all during compilation at runtime. In other words, a Java program may load a class whose name is known at runtime, learn its complete construct (but does not include methods definitions), and generate its object entity, or set its fields, or evoke its methods.
Therefore, the service verification service identification is transmitted to the verification service call interface, and the verification service call interface calls the verification service through the reflection mechanism, so that the verification service is independent of specific service processing logic to process service data, one verification service can be used for verifying a plurality of different service data, and code redundancy caused by the fact that the different service data correspond to one set of verification service is avoided.
Example IV
Referring to fig. 4, as shown in fig. 4, embodiment 4 of the present invention discloses another verification service arrangement apparatus, which includes:
A communication interface 401 for enabling the verification service arrangement apparatus 40 to communicate with other communication devices. In particular implementations, communication interface 401 may include a wired communication interface (e.g., an ethernet interface) as well as a wireless communication interface.
Memory 403 is coupled to processor 402 for storing various software programs and/or sets of instructions, network communication programs, and the like. In an embodiment of the present invention, the memory 403 may be used to store a database.
In an embodiment of the present invention, the memory 403 may be optionally used to store an implementation program of the verification service arrangement method provided in one or more embodiments of the present invention. Regarding the implementation of the verification service orchestration method provided by one or more embodiments of the present invention, please refer to the method embodiments shown in fig. 1 and fig. 2.
In an embodiment of the invention, processor 402 may be used to read and execute computer readable instructions. In particular, the processor 402 may be configured to invoke a program stored in the memory 403, for example, an implementation program for providing a verification service orchestration method according to one or more embodiments of the present invention, and execute instructions contained in the implementation program.
When the processor 402 invokes the computer instructions, the following steps may be performed: screening out the account to be expired from an account database according to preset screening conditions; generating processing prompt information of an account to be expired; and receiving the processing instruction and processing the account to be expired according to the processing instruction.
In the embodiment of the present invention, when the processor 402 invokes the computer instruction, the verification service arrangement method provided in the second embodiment of the present invention may also be executed.
The service verification service identification is transmitted to the verification service call interface, and the verification service call interface calls the verification service through the reflection mechanism, so that the verification service is independent of specific service processing logic to process service data, one verification service can be used for verifying a plurality of different service data, and code redundancy caused by the fact that the different service data correspond to one set of verification service is avoided.
Example five
An embodiment five of the present invention discloses a computer-readable storage medium storing a computer program for electronic data exchange, where the computer program causes a computer to execute the steps in the verification service arrangement method described in any one of the first embodiment and the second embodiment.
The service verification service identification is transmitted to the verification service call interface, and the verification service call interface calls the verification service through the reflection mechanism, so that the verification service is independent of specific service processing logic to process service data, one verification service can be used for verifying a plurality of different service data, and code redundancy caused by the fact that the different service data correspond to one set of verification service is avoided.
Example six
An embodiment six of the present invention discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute the steps in the verification service arrangement method described in any one of the embodiment one and the embodiment two.
The service verification service identification is transmitted to the verification service call interface, and the verification service call interface calls the verification service through the reflection mechanism, so that the verification service is independent of specific service processing logic to process service data, one verification service can be used for verifying a plurality of different service data, and code redundancy caused by the fact that the different service data correspond to one set of verification service is avoided.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable memory. Based on this understanding, the technical solution of the present invention may be embodied essentially or partly in the form of a software product, or all or part of the technical solution, which is stored in a memory, and includes several instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned memory includes: a usb disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Those of ordinary skill in the art will appreciate that all or a portion of the steps in the various methods of the above embodiments may be implemented by a program that instructs associated hardware, and the program may be stored in a computer readable memory, which may include: flash disk, read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), magnetic disk or optical disk.
The foregoing has outlined rather broadly the more detailed description of embodiments of the invention, wherein the principles and embodiments of the invention are explained in detail using specific examples, the above examples being provided solely to facilitate the understanding of the method and core concepts of the invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.