CN112417020A - Method and device for realizing service expansion, computer equipment and storage medium - Google Patents

Method and device for realizing service expansion, computer equipment and storage medium Download PDF

Info

Publication number
CN112417020A
CN112417020A CN202011338306.XA CN202011338306A CN112417020A CN 112417020 A CN112417020 A CN 112417020A CN 202011338306 A CN202011338306 A CN 202011338306A CN 112417020 A CN112417020 A CN 112417020A
Authority
CN
China
Prior art keywords
service
class object
implementation class
target
log
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.)
Granted
Application number
CN202011338306.XA
Other languages
Chinese (zh)
Other versions
CN112417020B (en
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.)
Wuhan United Imaging Healthcare Co Ltd
Original Assignee
Wuhan United Imaging Healthcare Co Ltd
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 Wuhan United Imaging Healthcare Co Ltd filed Critical Wuhan United Imaging Healthcare Co Ltd
Priority to CN202011338306.XA priority Critical patent/CN112417020B/en
Publication of CN112417020A publication Critical patent/CN112417020A/en
Application granted granted Critical
Publication of CN112417020B publication Critical patent/CN112417020B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The application relates to a method and a device for realizing service expansion, computer equipment and a storage medium. The method comprises the steps of determining a target realization class object corresponding to a target service type according to the corresponding relation between the realization class object and the service type when the corresponding relation between the realization class object and the service type contained in a service interface is obtained and the target service type corresponding to the input target service data is obtained, and processing the target service data by calling the target realization class object. In the method, the implementation class objects contained in the service interface are separated and decoupled without mutual influence, when the service is expanded, the processing operation of the newly added service data can be realized only by newly adding the implementation class objects and realizing the service interface, and the original codes in the service interface are not required to be changed, so that the service expansion process is simplified, and the service expansion efficiency is improved.

Description

Method and device for realizing service expansion, computer equipment and storage medium
Technical Field
The present application relates to the technical field of computer devices, and in particular, to a method and an apparatus for implementing service extension, a computer device, and a storage medium.
Background
Spring is an open source framework created to address enterprise application development complexities. More and more enterprises adopt Spring frameworks to develop and apply application programs. In the development process of the application program, the implementation method of the spring dynamic injection interface is particularly important.
At present, a spring dynamic injection interface generally uses a method for realizing an interface thereof by using a class object, and the class object corresponds to a method for realizing a service logic, but in practical application, a certain service logic may have a plurality of branch service logics or a new branch logic needs to be extended in the future, in the application scenario, an application program developer needs to add a judgment condition of the branch logic in the class object of the interface, and simultaneously modify the service logic in the class object according to the judgment condition, so as to achieve the purpose of extending the service function of the interface.
However, the method for implementing the service expansion has the problems of complicated expansion and low efficiency.
Disclosure of Invention
In view of the foregoing, it is necessary to provide a method, an apparatus, a computer device, and a storage medium for implementing service expansion, which can improve expansion efficiency and simplify an expansion process.
In a first aspect, a method for implementing service extension includes:
acquiring the corresponding relation between each implementation class object and the service type contained in the service interface;
acquiring a target service type corresponding to input target service data;
determining a target realization class object corresponding to the target service type according to the corresponding relation between the realization class object and the service type; the target implementation class object is used for processing the target service data.
In one embodiment, the implementation class object is used for processing business data and returning the type of the business data.
In one embodiment, the obtaining the corresponding relationship between each implementation class object and the service type included in the service interface includes:
acquiring all implementation class objects contained in the service interface;
calling a type return method in each implementation class object to obtain a service type corresponding to each implementation class object;
and establishing a corresponding relation between each implementation class object and the service type.
In one embodiment, the method further comprises:
and calling a service processing method in the target implementation class object to process the target service data.
In one embodiment, the service interface includes: the realization class object of the CT log, the realization class object of the MR log and the realization class object of the newly added log;
the service type corresponding to the implementation class object of the CT log is the type of CT equipment;
the service type corresponding to the implementation class object of the MR log is the MR equipment type;
and the service type corresponding to the implementation class object of the newly added log is the type of newly added equipment.
In one embodiment, the target service data includes one of the CT log, the MR log, and the new log.
In one embodiment, different implementation class objects are used to process different types of business data.
In one embodiment, the service interface includes an original implementation class object and a newly added implementation class object, the target service data is newly added service data, and the newly added implementation class object is used for processing the newly added service data.
In a second aspect, an apparatus for implementing service extension includes:
the first acquisition module is used for acquiring the corresponding relation between each implementation class object and the service type contained in the service interface;
the second acquisition module is used for acquiring a target service type corresponding to the input target service data;
the determining module is used for determining a target implementation class object corresponding to the target service type according to the corresponding relation between the implementation class object and the service type; the target implementation class object is used for processing the target service data.
In a third aspect, a computer device comprises a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
acquiring the corresponding relation between each implementation class object and the service type contained in the service interface;
acquiring a target service type corresponding to input target service data;
determining a target realization class object corresponding to the target service type according to the corresponding relation between the realization class object and the service type; the target implementation class object is used for processing the target service data.
In a fourth aspect, a computer readable storage medium having stored thereon a computer program which when executed by a processor implements the steps of:
acquiring the corresponding relation between each implementation class object and the service type contained in the service interface;
acquiring a target service type corresponding to input target service data;
determining a target realization class object corresponding to the target service type according to the corresponding relation between the realization class object and the service type; the target implementation class object is used for processing the target service data.
The method, the device, the computer equipment and the storage medium for realizing the service expansion determine the target realization class object corresponding to the target service type according to the corresponding relation between the realization class object and the service type when the corresponding relation between each realization class object and the service type contained in the service interface is obtained and the target service type corresponding to the input target service data is obtained, and then the target service data is processed by calling the target realization class object. In the method, the implementation class objects contained in the service interface are separated and decoupled without mutual influence, when the service is expanded, the processing operation of the newly increased service data can be realized only by newly increasing the implementation class objects and realizing the service interface, the original codes in the service interface do not need to be changed, and the maintenance and management of the service expansion and the service interface realization are convenient, so that the method has universality, simplifies the process of the service expansion and improves the efficiency of the service expansion.
Drawings
FIG. 1 is a diagram illustrating an internal structure of a computer device according to an embodiment;
fig. 2 is a schematic flow chart of a method for implementing service expansion in an embodiment;
FIG. 3 is a schematic flow chart illustrating an implementation manner of S101 in the embodiment of FIG. 2;
fig. 4 is a flowchart illustrating a method for implementing service extension in an embodiment;
fig. 5 is a flowchart illustrating a method for implementing service extension in one embodiment;
fig. 6 is a flowchart illustrating a method for implementing service extension in one embodiment;
fig. 7 is a block diagram showing a structure of an apparatus for implementing service extension in one embodiment;
fig. 8 is a block diagram showing a structure of an apparatus for implementing service extension in one embodiment;
fig. 9 is a block diagram showing an arrangement for implementing service extension in one embodiment;
FIG. 10 is a diagram showing an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The method for implementing service expansion provided by the present application may be applied to a computer device shown in fig. 1, where the computer device may be a server, the computer device may also be a terminal, and an internal structure diagram of the computer device may be as shown in fig. 1. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of implementing service extensions. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 1 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In an embodiment, as shown in fig. 2, a method for implementing service expansion is provided, which is described by taking the method as an example applied to the computer device in fig. 1, and includes the following steps:
s101, acquiring the corresponding relation between each implementation class object and the service type contained in the service interface.
The implementation class object is used for processing the service data and returning the type of the service data, wherein the service data comprises service logic. A service interface may contain a plurality of different implementation class objects, where the different implementation class objects are used to process different types of service data, that is, in practical applications, for a total service logic, how many branch logics define how many implementation class objects, for example, a service interface common service is defined, and the common service may include different implementation class objects such as ServiceA, ServiceB, ServiceC, and the like. The service type represents a type of service data or service logic, which may be characterized by key values, numbers, letters, chinese characters, and the like, but is not limited thereto. The corresponding relation between the implementation class object and the service type can be obtained and stored by the computer device in advance in a mode of rewriting the service interface. The service interface in this embodiment includes an original implementation class object and a newly added implementation class object, where the newly added implementation class object is used to process newly added service data.
In this embodiment, when the computer device needs to perform service expansion, a method of rewriting the service interface may be used in advance to add a newly expanded implementation class object to the service interface based on an original implementation class object, obtain all implementation class objects included in the service interface by initializing the service interface, obtain a service type corresponding to each implementation class object by calling each implementation class object, and store a correspondence between each implementation class object and the service type, so that the computer device is used when implementing expanded service data processing using the service interface.
The above process is illustrated by way of example: the computer device defines a common service () in advance, and the common service () includes a service processing method Servicempl () and a return type method getCondition (). When a computer device performs an extended service interface, a setappticationcontext method of a spring interface may be rewritten in advance, and when the setappticationcontext method of the spring interface is initialized and executed, all implementation class objects in interface commonService () may be obtained (for example, assencimpil, bservisimpl, cservisimpl … … serviceimpl, etc.), a getCondition () method in each implementation class object is called to obtain a return value of the getCondition () method, and then the return value is used as a key value (for example, a key value corresponding to assempil is assember, a key value corresponding to bservisimpli is bservi is Csyle, a key value corresponding to cservisimpli is cservisible, a key value corresponding to … … xservisimple is xsile), and each implementation class object is stored in a key value-to-value pair, that is equivalent to a key value pair, that is a key value pair corresponding to an implementation class object, and a specific operation may be used when the implementation class objects are stored in a key value pair, for example, the assignment objects ("aspervice objects" may be stored in a key value pair operation corresponding to an xservice object, and "may be used, put ("Csyle", CServiceImpl) … …, etc. functions enable efficient storage. Optionally, the computer device may also store the corresponding relationship between each implementation class object and the key value in the mapping table for later reading, and the storage method is not limited in this embodiment.
Specifically, when the computer device expands the service using the expanded service interface, the corresponding relationship between each implementation class object and the service type included in the service interface may be obtained from the database or in another manner, for example, the computer device may obtain the corresponding relationship between each implementation class object and a key value from a constructed key value pair object, where the key value represents the service type.
S102, acquiring a target service type corresponding to the input target service data.
The target service data is newly added service data, and the target service type is the service type of the newly added service data. In this embodiment, a user inputs an extended service instruction on a computer device, the computer device may obtain target service data from a database or other devices based on the extended service instruction, and further analyze the target service data to obtain a type of the target service data, and specifically, during the analysis, the type of the target service data, that is, a target service type, may be obtained by performing type recognition on the target service data by using an existing classification method.
S103, determining a target implementation class object corresponding to the target service type according to the corresponding relation between the implementation class object and the service type; and the target implementation class object is used for processing the target service data.
In this embodiment, when the computer device receives target service data transmitted from the outside and obtains a target service type through analysis, it indicates that the computer device needs to process newly added service data, and at this time, the computer device may further query a correspondence between an implementation class object and a service type obtained before, find an implementation class object corresponding to the target service type, and call the found implementation class object as the target implementation class object, so as to achieve the purpose of processing the target service data. Specifically, the computer device may process the target service data by calling a service processing method in the target implementation class object, where the service processing method is a member method in the target implementation class object and is used to process the target service data corresponding to the target implementation class object when being called.
In the method for implementing service extension provided in the foregoing embodiment, the corresponding relationship between each implementation class object included in the service interface and the service type is obtained, and when the target service type corresponding to the input target service data is obtained, the target implementation class object corresponding to the target service type is determined according to the corresponding relationship between the implementation class object and the service type, and then the target service data is processed by calling the target implementation class object. In the method, the implementation class objects contained in the service interface are separated and decoupled without mutual influence, when the service is expanded, the processing operation of the newly increased service data can be realized only by newly increasing the implementation class objects and realizing the service interface, the original codes in the service interface do not need to be changed, and the maintenance and management of the service expansion and the service interface realization are convenient, so that the method has universality, simplifies the process of the service expansion and improves the efficiency of the service expansion.
In an embodiment, an implementation manner of the foregoing S101 is provided, and as shown in fig. 3, the aforementioned S101 "obtaining a correspondence between each implementation class object included in a service interface and a service type" includes:
s201, all the implementation class objects contained in the service interface are obtained.
In this embodiment, a service interface may be predefined by a computer device, and further, according to original service data to be processed and service data to be expanded, each implementation class object included in the service interface is defined for processing a specific service, where different implementation class objects are used for processing different types of service data, and the number of the implementation class objects may be determined according to actual processing requirements, which is not limited herein. When the computer device initializes a corresponding application (e.g., Spring), all implementation class objects in the service interface may be acquired.
S202, calling a type returning method in each implementation class object to obtain a service type corresponding to each implementation class object.
The type return method may be defined by the computer device in advance when defining the implementation class object, and is a member method of the implementation class object, and may return the service type of the implementation class object when being called, for example, the type return method may be represented by getCondition (). In this embodiment, after the computer device obtains all the implementation class objects in the service interface, the type return method in each implementation class object may be called to obtain the service type corresponding to each implementation class object.
S203, constructing the corresponding relation between each realization class object and the service type.
When the computer device obtains all the implementation class objects in the service interface and the service types corresponding to the implementation class objects based on the foregoing steps, the corresponding relationship between the implementation class objects and the service types may be further constructed and stored for later use.
The foregoing embodiment provides a method for obtaining a correspondence between an implementation class object and a service type, where a computer device in this embodiment may obtain, by querying the correspondence, an implementation class object for processing extended service data when a service is extended each time through the correspondence. Compared with the traditional method for expanding the service, the method for further processing the expanded service needs to detect whether the condition exists or not, and if the condition exists, the expanded service can be further processed, so that the processing efficiency of the expanded method is higher.
With the above embodiments, the present application provides a method for implementing service expansion, as shown in fig. 4, the method includes:
s301, a service interface (e.g., common service ()) and member methods (e.g., processTask () and getCondition ()) of the service interface are defined. Wherein, processTask () is used to process specific service data, getCondition () is used to obtain the service type of the service data.
S302, defining each implementation class object (such as servicempl1()) contained in the service interface, rewriting the processTask () method in each implementation class object to process specific service data, and rewriting the getCondition () to return the service type of the service data.
S303, if there is extended service data, defining an implementation class object (e.g., servicempl2()) of the extended service data.
S304, initializing Spring, obtaining all implementation class objects in the service interface (common service ()), and implementing a member method getCondition () in each implementation class object in the service interface (common service ()), to obtain a service type (for example, represented by a key value) corresponding to each implementation class object.
S305, storing the corresponding relation between each implementation class object and the service type in the service interface into a key value pair object (such as map).
S306, receiving externally transmitted target service data, and analyzing the target service data to obtain the target service type of the target service data.
S307, acquiring the corresponding relation between each implementation class object and the service type from the key value pair object, and inquiring to obtain the implementation class object corresponding to the target service type, namely the target implementation class object (such as servicempl2()) based on the corresponding relation.
S308, the processTask () method in the target implementation class object is called to process the target service data.
In the medical field, an application scenario for parsing a medical device log is usually encountered, for example, the log is usually a file in xml format, and the beginning is only an xml log of a Computed Tomography (CT), and when the computer device needs to parse the xml log of the CT, a method may be defined to parse the xml log, for example, a processTask (document xml { }) is used to implement parsing of the xml log. Later, it is necessary to resolve the Magnetic Resonance equipment (MR) log, which is also an xml file. Obviously, the contents and structures of the MR log and the CT log are different, and when a new MR log needs to be analyzed, the conventional method for extending the MR log analyzing function is a method of manually modifying a processTask (document xml { }), and in the method, a judgment condition for distinguishing the CT log and the MR log is determined, and an MR log logic code is added, so that when the processTask method is executed later, the method can distinguish the CT log and the MR log by the judgment condition input from the outside, and simultaneously, the MR log analyzing code is executed to analyze the MR log. If a new log needs to be added, the above process needs to be repeated to modify the processTask method again, and so on, as long as a new device log exists, the processTask method needs to be modified, a new judgment condition needs to be added, and a new service logic code needs to be edited, so that the code of the whole processTask method becomes bloated and difficult to maintain, and the logic code of the newly added device log is added on the basis of the original log code in the processTask method, so that the original log code is extremely easy to destroy in the adding process, and if the newly modified processTask method has an error, the original log code in the processTask method cannot be realized, so that the whole service logic cannot be executed, and the processTask method needs to be overhauled or corrected again, so that the efficiency of the whole service expansion process is extremely low. In view of the technical problems brought by the above application scenarios, the present application provides a method for implementing service expansion applied to the medical field for expanding different types of device logs, and the following embodiments will explain the method.
In one embodiment, the service interface in the embodiment of fig. 2 includes: the realization class object of the CT log, the realization class object of the MR log and the realization class object of the newly added log. Correspondingly, the service type corresponding to the implementation class object of the CT log is the type of the CT equipment; the service type corresponding to the implementation class object of the MR log is the MR equipment type; and the service type corresponding to the realization class object of the newly added log is the type of the newly added equipment. The target business data comprises one of CT logs, MR logs and newly-added logs.
Based on the service interface described in the foregoing embodiment, the method for implementing service extension provided by the present application, as shown in fig. 5, includes:
s401, a service interface (e.g., common service ()) and member methods (e.g., processTask () and getCondition ()) of the service interface are defined. Wherein, processTask () is used to process specific service data, getCondition () is used to obtain the service type of the service data.
S402, defining each implementation class object contained in the service interface, CT log implementation class object, MR log implementation class object and newly added log implementation class object, rewriting the processTask () method in the three implementation class objects to process specific service data, and rewriting getCondition () to return the service type of the service data.
S403, initializing Spring, obtaining a CT log implementation class object, an MR log implementation class object and a newly added log implementation class object in a service interface (common service ()), calling a member method getCondition () in the CT log implementation class object to obtain a CT device type, calling a member method getCondition () in the MR log implementation class object to obtain an MR device type, and calling a member method getCondition () in the newly added log implementation class object to obtain a newly added device type.
S404, storing the corresponding relations between the implementation class object of the CT log, the implementation class object of the MR log and the implementation class object of the newly added log, the CT device type, the MR device type and the newly added device type into the key value pair object.
S405, receiving target service data transmitted from the outside, and acquiring the corresponding relation between each implementation class object and the service type from the key value pair object.
S406, analyzing the target service data to obtain a target service type of the target service data, and if the target service type is a CT equipment type, executing a step S407; if the target service type is the MR device type, step S408 is executed; if the target service type is the type of the newly added device, step S409 is executed.
S407, according to the corresponding relation, inquiring to obtain a realization class object of the CT log corresponding to the CT device type, and calling a processTask () method in the realization class object of the CT log to analyze the CT log.
S408, according to the corresponding relation, inquiring to obtain an implementation class object of the MR log corresponding to the MR equipment type, and calling a processTask () method in the implementation class object of the MR log to analyze the MR log.
S409, according to the corresponding relation, inquiring to obtain the realization class object of the newly added log corresponding to the type of the newly added equipment, and calling a processTask () method in the realization class object of the newly added log to analyze the newly added log.
The method can analyze any type of the CT log, the MR log and the newly added log.
For the method described in the above embodiment, the following embodiment exemplifies the above method, as shown in fig. 6, including:
s501, a service interface and a member method are defined, for example, a service interface common () and member methods processTask () and getCondition () are defined. Wherein, processTask () is used to process specific service data, getCondition () is used to obtain the service type of the service data.
S502, define an implementation class object of the CT log, such as CTServicelmpl, define a member method processTask () in the CTServicelmpl, for parsing the CT log, define a member method getCondition () in the CTServicelmpl, for returning a character string "CTLOG", where the character string represents a service type of the implementation class object of the CT log.
S503, define an implementation class object of the MR log, such as MRServicelmpl, define a member method processTask () in the MRServicelmpl, for parsing the MR log, define a member method getCondition () in the MRServicelmpl, for returning a character string "MRLOG", where the character string represents a service type of the implementation class object of the MR log.
S504, define an implementation class object of the newly added log, such as XXServicelmpl, define a member method processTask () in XXServicelmpl, which is used to parse the newly added log, define a member method getCondition () in XXServicelmpl, which is used to return a character string "XXLOG", where the character string represents a service type of the implementation class object of the newly added log.
S505, initializing Spring, obtaining a realization class object CTServicelmpl of a CT log, a realization class object MRServicelmpl of an MR log and a realization class object XXServicelmpl of a newly added log in a service interface (common ()), calling a member method getCondition () in the CTServicelmpl to obtain 'CTLOG', calling a member method getCondition () in the realization class object MRServicelmpl of the MR log to obtain 'MRLOG', and calling a member method getCondition () in the realization class object XXServicelmpl of the newly added log to obtain 'XXLOG'.
S506, by calling the methods map.put ("CTLOG", CTServicelmpl), map.put ("MRLOG", MRServicelmpl), and map.put ("XXLOG", XXServicelmpl), the correspondence between CTServicelmpl, MRServicelmpl, XXServicelmpl, and "CTLOG", "MRLOG", and "XXLOG" is saved to the map.
S507, receiving externally transmitted target service data, analyzing the target service data to obtain a target service type of the target service data, and if the target service type is CTLOG, executing a step S508; if the target service type is "MRLOG", then step S509 is executed; if the target service type is "XXLOG", step S510 is executed.
S508, through calling the corresponding implementation class object acquisition method, the target implementation class object CTServicelmpl corresponding to the CTLOG is obtained from the map, and a member method processTask () in the CTServicelmpl is called to analyze the CT log.
S509, the target implementation class object MRServiceLmpl corresponding to the MRLOG is obtained from the map by calling the corresponding implementation class object obtaining method, and a member method processTask () in the MRServiceLmpl is called to analyze the MR log.
S510, obtaining a target implementation class object XXServicelmpl corresponding to the 'XXLOG' from the map by calling a corresponding implementation class object obtaining method, and calling a member method processTask () in the XXServicelmpl to analyze the XX log.
It should be noted that, when obtaining the implementation class object corresponding to the target service type from the map, the computer device may specifically call the corresponding implementation class object obtaining method to implement. For example, if LogType is used to represent the target service type, the implementation class object obtaining method is logServicelmpl () ═ map.get (LogType), and by calling map.get (LogType), the target implementation class object logServicelmpl () corresponding to the target service type can be obtained from map.
In the method, the whole process does not know which method for calling the implementation class object in advance until the computer equipment acquires the corresponding target implementation class object from the map according to the target service type, the target implementation class object is obviously dynamic and is dynamically acquired according to the type of the transmitted target service data, different target service types correspond to different target implementation class objects, no matter how many equipment logs are added, only the corresponding implementation class object needs to be added, no change is needed to be carried out on other implementation class objects, and even if the analysis of a certain log implementation class object is wrong, the analysis of other types of logs is not influenced, so that the method provided by the application does not influence the processing of the original service data while expanding the service and has higher reliability.
It should be understood that although the various steps in the flow charts of fig. 2-6 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 described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-6 may include multiple 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 in turn or alternately with other steps or at least some of the other steps.
In one embodiment, as shown in fig. 7, an apparatus for implementing service extension is provided, including: a first obtaining module 11, a second obtaining module 12 and a determining module 13, wherein:
a first obtaining module 11, configured to obtain a correspondence between each implementation class object included in the service interface and a service type;
a second obtaining module 12, configured to obtain a target service type corresponding to input target service data;
a determining module 13, configured to determine, according to a correspondence between the implementation class object and a service type, a target implementation class object corresponding to the target service type; the target implementation class object is used for processing the target service data.
In one embodiment, the implementation class object is used for processing business data and returning the type of the business data.
In an embodiment, as shown in fig. 8, the first obtaining module 11 includes:
an obtaining unit 111, configured to obtain all implementation class objects included in the service interface;
a calling unit 112, configured to call a type return method in each implementation class object to obtain a service type corresponding to each implementation class object;
the establishing unit 113 is configured to establish a corresponding relationship between each implementation class object and a service type.
In an embodiment, as shown in fig. 9, the apparatus for implementing service extension further includes:
and the calling module 14 is configured to call a service processing method in the target implementation class object to process the target service data.
In one embodiment, the service interface includes: the realization class object of the CT log, the realization class object of the MR log and the realization class object of the newly added log;
the service type corresponding to the implementation class object of the CT log is the type of CT equipment;
the service type corresponding to the implementation class object of the MR log is the MR equipment type;
and the service type corresponding to the implementation class object of the newly added log is the type of newly added equipment.
In one embodiment, the target service data includes one of the CT log, the MR log, and the new log.
In one embodiment, different implementation class objects are used to process different types of business data.
In an embodiment, the service interface includes an original implementation class object and a newly added implementation class object, the target service data is newly added service data, and the newly added implementation class object is used for processing the newly added service data.
For specific limitations of the implementation apparatus for service extension, reference may be made to the above limitations of the implementation method for service extension, and details are not described here. All or part of the modules in the service expansion implementation device can be implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 10. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing various types of business data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of implementing service extensions.
Those skilled in the art will appreciate that the architecture shown in fig. 10 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
acquiring the corresponding relation between each implementation class object and the service type contained in the service interface;
acquiring a target service type corresponding to input target service data;
determining a target realization class object corresponding to the target service type according to the corresponding relation between the realization class object and the service type; the target implementation class object is used for processing the target service data. The implementation principle and technical effect of the computer device provided by the above embodiment are similar to those of the above method embodiment, and are not described herein again.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring the corresponding relation between each implementation class object and the service type contained in the service interface;
acquiring a target service type corresponding to input target service data;
determining a target realization class object corresponding to the target service type according to the corresponding relation between the realization class object and the service type; the target implementation class object is used for processing the target service data. The implementation principle and technical effect of the computer-readable storage medium provided by the above embodiments are similar to those of the above method embodiments, and are not described herein again.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method for implementing service expansion is characterized in that the method comprises the following steps:
acquiring the corresponding relation between each implementation class object and the service type contained in the service interface;
acquiring a target service type corresponding to input target service data;
determining a target realization class object corresponding to the target service type according to the corresponding relation between the realization class object and the service type; the target implementation class object is used for processing the target service data.
2. The method of claim 1, wherein the implementation class object is used to process business data and return a type of the business data.
3. The method according to claim 1 or 2, wherein the obtaining of the correspondence between each implementation class object included in the service interface and the service type includes:
acquiring all implementation class objects contained in the service interface;
calling a type return method in each implementation class object to obtain a service type corresponding to each implementation class object;
and constructing the corresponding relation between each implementation class object and the service type.
4. The method of claim 1, further comprising:
and calling a service processing method in the target implementation class object to process the target service data.
5. The method of claim 1, wherein the service interface comprises: the realization class object of the CT log, the realization class object of the MR log and the realization class object of the newly added log;
the service type corresponding to the implementation class object of the CT log is the type of CT equipment;
the service type corresponding to the implementation class object of the MR log is the MR equipment type;
and the service type corresponding to the implementation class object of the newly added log is the type of newly added equipment.
6. The method of claim 5, wherein the target traffic data comprises one of the CT log, the MR log, and the Add-on log.
7. The method of claim 1, wherein different implementation class objects are used to process different types of business data.
8. The method according to claim 1, wherein the service interface includes an original implementation class object and a new implementation class object, the target service data is new service data, and the new implementation class object is used for processing the new service data.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 8 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 8.
CN202011338306.XA 2020-11-25 2020-11-25 Service expansion realization method, device, computer equipment and storage medium Active CN112417020B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011338306.XA CN112417020B (en) 2020-11-25 2020-11-25 Service expansion realization method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011338306.XA CN112417020B (en) 2020-11-25 2020-11-25 Service expansion realization method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112417020A true CN112417020A (en) 2021-02-26
CN112417020B CN112417020B (en) 2023-08-18

Family

ID=74842108

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011338306.XA Active CN112417020B (en) 2020-11-25 2020-11-25 Service expansion realization method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112417020B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115794927A (en) * 2023-01-29 2023-03-14 北京仁科互动网络技术有限公司 Service function expansion method and system

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140173632A1 (en) * 2012-12-14 2014-06-19 Johannes Haselberger Typed Access of Business Object Data Structures
CN108196879A (en) * 2018-01-09 2018-06-22 平安科技(深圳)有限公司 Method for processing business, device, equipment and computer readable storage medium
CN108196916A (en) * 2017-12-18 2018-06-22 广州视源电子科技股份有限公司 A kind of method and its device, storage medium and electronic equipment that parameter verification is carried out to interface
CN108874504A (en) * 2018-06-05 2018-11-23 郑州云海信息技术有限公司 A kind of management method and device of multiple virtualization platform
CN109710428A (en) * 2018-12-27 2019-05-03 杭州数梦工场科技有限公司 A kind of dynamic call method and device for realizing class
CN109767316A (en) * 2018-12-14 2019-05-17 深圳壹账通智能科技有限公司 Regular configuration method, device, computer equipment and storage medium
US20190334789A1 (en) * 2018-04-26 2019-10-31 EMC IP Holding Company LLC Generating Specifications for Microservices Implementations of an Application
CN111241107A (en) * 2020-01-16 2020-06-05 北京字节跳动网络技术有限公司 Service processing method, device, medium and electronic equipment
CN111443901A (en) * 2018-12-27 2020-07-24 北京奇虎科技有限公司 Business expansion method and device based on Java reflection

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140173632A1 (en) * 2012-12-14 2014-06-19 Johannes Haselberger Typed Access of Business Object Data Structures
CN108196916A (en) * 2017-12-18 2018-06-22 广州视源电子科技股份有限公司 A kind of method and its device, storage medium and electronic equipment that parameter verification is carried out to interface
CN108196879A (en) * 2018-01-09 2018-06-22 平安科技(深圳)有限公司 Method for processing business, device, equipment and computer readable storage medium
US20190334789A1 (en) * 2018-04-26 2019-10-31 EMC IP Holding Company LLC Generating Specifications for Microservices Implementations of an Application
CN108874504A (en) * 2018-06-05 2018-11-23 郑州云海信息技术有限公司 A kind of management method and device of multiple virtualization platform
CN109767316A (en) * 2018-12-14 2019-05-17 深圳壹账通智能科技有限公司 Regular configuration method, device, computer equipment and storage medium
CN109710428A (en) * 2018-12-27 2019-05-03 杭州数梦工场科技有限公司 A kind of dynamic call method and device for realizing class
CN111443901A (en) * 2018-12-27 2020-07-24 北京奇虎科技有限公司 Business expansion method and device based on Java reflection
CN111241107A (en) * 2020-01-16 2020-06-05 北京字节跳动网络技术有限公司 Service processing method, device, medium and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115794927A (en) * 2023-01-29 2023-03-14 北京仁科互动网络技术有限公司 Service function expansion method and system

Also Published As

Publication number Publication date
CN112417020B (en) 2023-08-18

Similar Documents

Publication Publication Date Title
CN109901834B (en) Document page generation method, device, computer equipment and storage medium
CN111563368B (en) Report generation method, report generation device, computer equipment and storage medium
CN109684607B (en) JSON data analysis method and device, computer equipment and storage medium
CN112765023B (en) Test case generation method and device
CN109840083B (en) Webpage component template construction method and device, computer equipment and storage medium
CN108492005B (en) Project data processing method and device, computer equipment and storage medium
CN111984228B (en) Interface document processing method and device, computer equipment and storage medium
CN110688598A (en) Service parameter acquisition method and device, computer equipment and storage medium
CN106557307B (en) Service data processing method and system
CN111581271A (en) Interface parameter determination method and device, computer equipment and storage medium
CN112187713B (en) Message conversion method, device, computer equipment and storage medium
CN113504918A (en) Equipment tree configuration optimization method and device, computer equipment and storage medium
CN108415998B (en) Application dependency relationship updating method, terminal, device and storage medium
CN112433712A (en) Report display method and device, computer equipment and storage medium
CN112417020B (en) Service expansion realization method, device, computer equipment and storage medium
CN110442636B (en) Data reading and writing method and device and data reading and writing equipment
CN112433753A (en) Interface document generation method, device, equipment and medium based on parameter information
CN111901383A (en) Data request processing method and device, computer equipment and storage medium
CN111159226A (en) Index query method and system
CN116414689A (en) Interface parameter verification method and system based on reflection mechanism
CN109840080B (en) Character attribute comparison method and device, storage medium and electronic equipment
CN111857662A (en) Programming method for describing object specific constitution based on MAP and interface
CN110928607A (en) Service implementation method, device, computer equipment and storage medium
CN116755684B (en) OAS Schema generation method, device, equipment and medium
CN116700840B (en) File execution method, device, electronic equipment and readable storage medium

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
GR01 Patent grant
GR01 Patent grant