CN112417020B - Service expansion realization method, device, computer equipment and storage medium - Google Patents

Service expansion realization method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN112417020B
CN112417020B CN202011338306.XA CN202011338306A CN112417020B CN 112417020 B CN112417020 B CN 112417020B CN 202011338306 A CN202011338306 A CN 202011338306A CN 112417020 B CN112417020 B CN 112417020B
Authority
CN
China
Prior art keywords
service
class object
implementation class
target
type
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.)
Active
Application number
CN202011338306.XA
Other languages
Chinese (zh)
Other versions
CN112417020A (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

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 service expansion realization method, a service expansion realization device, computer equipment and a storage medium. According to the method, the corresponding relation between each realization class object and the service type contained in the service interface is obtained, when the target service type corresponding to the input target service data is obtained, the target realization class object corresponding to the target service type is determined according to the corresponding relation between the realization class object and the service type, and then the target service data is processed by calling the target realization class object. In the method, all the implementation class objects contained in the service interface are decoupled, the mutual influence is avoided, when the service is expanded, only the implementation class objects are needed to be newly added, and the method for realizing the service interface can realize the processing operation of the newly added service data, and the original codes in the service interface are not changed, so that the service expansion process is simplified, and the service expansion efficiency is improved.

Description

Service expansion realization method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer devices, and in particular, to a method and 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 complexity. More and more enterprises now use Spring frameworks to develop and apply application programs. In the development process of an application program, the implementation method of the spring dynamic injection interface is particularly important.
At present, a method for realizing an interface by using a class object is generally used by a spring dynamic injection interface, and the class object corresponds to a method for realizing service logic, but in practical application, a certain service logic can have a plurality of branch service logics or new branch logics need to be expanded in future, under the application scene, an application program developer needs to newly increase judging conditions of the branch logics in the class object of the interface, and meanwhile, the service logic in the class object is modified according to the judging conditions, so that the purpose of expanding the service functions of the interface is achieved.
However, the method for implementing service expansion has the problems of complex expansion and low efficiency.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a method, apparatus, computer device, and storage medium for implementing service expansion that can improve expansion efficiency and simplify expansion procedures.
In a first aspect, a method for implementing service extension, the method includes:
acquiring the corresponding relation between each implementation class object contained in the service interface and the service type;
acquiring a target service type corresponding to input target service data;
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 business data.
In one embodiment, the implementation class object is used to process business data and return the type of business data.
In one embodiment, the obtaining the correspondence between the implementation class objects and the service types included in the service interface includes:
acquiring all realization 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 the corresponding relation between the implementation class objects and the service types.
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: an implementation class object of the CT log, an implementation class object of the MR log and an implementation class object of the newly added log;
the service type corresponding to the implementation class object of the CT log is a CT equipment type;
the service type corresponding to the implementation class object of the MR log is an MR equipment type;
and the service type corresponding to the implementation class object of the newly added log is a newly added equipment type.
In one embodiment, the target service data includes one of the CT log, the MR log, and the new log.
In one embodiment, different ones of the 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 implementation apparatus for service extension, the apparatus includes:
the first acquisition module is used for acquiring the corresponding relation between each implementation class object contained in the service interface and the service type;
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 business data.
In a third aspect, a computer device comprises a memory storing a computer program and a processor implementing the following steps when executing the computer program:
acquiring the corresponding relation between each implementation class object contained in the service interface and the service type;
acquiring a target service type corresponding to input target service data;
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 business data.
In a fourth aspect, a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
acquiring the corresponding relation between each implementation class object contained in the service interface and the service type;
acquiring a target service type corresponding to input target service data;
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 business data.
The method, the device, the computer equipment and the storage medium for realizing the service expansion are used for determining 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 the realization class object and the service type corresponding to the input target service data is obtained through obtaining the corresponding relation between each realization class object and the service type contained in the service interface, and then processing the target service data in a mode of calling the target realization class object. In the method, all the implementation type objects contained in the service interface are separated and decoupled, the mutual influence is avoided, when the service is expanded, only the implementation type objects are needed to be newly added, the method for realizing the service interface can realize the processing operation of newly added service data, the original codes in the service interface are not changed, the service expansion and the maintenance and management of the service interface are convenient, so that the method has higher universality, and the method not only simplifies the service expansion process, but also improves the service expansion efficiency.
Drawings
FIG. 1 is an internal block diagram of a computer device in one embodiment;
FIG. 2 is a flow diagram of a method for implementing service extension in one embodiment;
FIG. 3 is a flow chart of one implementation of S101 in the embodiment of FIG. 2;
FIG. 4 is a flow diagram of a method for implementing service extension in one embodiment;
FIG. 5 is a flow diagram of a method for implementing service extension in one embodiment;
FIG. 6 is a flow diagram of a method for implementing service extension in one embodiment;
FIG. 7 is a block diagram of an implementation of service extension in one embodiment;
FIG. 8 is a block diagram of an implementation of service extension in one embodiment;
FIG. 9 is a block diagram of an implementation of service extension in one embodiment;
fig. 10 is an internal structural view of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The method for realizing service expansion provided by the application can be applied to the computer equipment shown in fig. 1, wherein the computer equipment can be a server, the computer equipment can also be a terminal, and the internal structure diagram of the computer equipment can be 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 includes a non-volatile 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 the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a method of implementing a service extension. 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, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the architecture shown in fig. 1 is merely a block diagram of some of the architecture relevant to the present inventive arrangements and is not limiting as to the computer device to which the present inventive arrangements may be implemented, as a particular computer device may include more or less components than those shown, or may be combined with some components, or may have a different arrangement of components.
In one embodiment, as shown in fig. 2, a method for implementing service extension is provided, and the method is applied to the computer device in fig. 1 for illustration, and includes the following steps:
s101, obtaining the corresponding relation between each realization object contained in the service interface and the service type.
Wherein the implementation class object is used to process the service data and return 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 different implementation class objects are used to process different types of service data, i.e. in practical application, for a total service logic, how many branch logics define how many implementation class objects, for example, a service interface common service is defined, where the common service may include different implementation class objects such as ServiceA, serviceB, serviceC. The service type represents a type of service data or service logic, which may be characterized using key values, numbers, letters, kanji, characters, etc., without limitation herein. The corresponding relation between the class object and the service type can be obtained and stored in advance by the computer equipment through 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 the newly added service data.
In this embodiment, when the computer device needs to perform service expansion, a method of rewriting a service interface may be used in advance to enable the service interface to add a new expanded implementation class object based on an original implementation class object, then all implementation class objects included in the service interface are further obtained by initializing the service interface, then service types corresponding to the implementation class objects are further obtained by calling the implementation class objects, and then correspondence between the implementation class objects and the service types is stored, so that the computer device is used later when implementing expanded service data processing using the service interface.
Exemplary description of the above procedure: the computer equipment predefines a service interface common () which contains a service processing method Servicempl () and a return type method getCondition (). When the computer device performs the extension service interface, the setapplication context method of the spring interface may be rewritten in advance, when the setapplication context method of the spring interface is initialized and executed, all implementation class objects (for example, AServiceImpl, BServiceImpl, CServiceImpl … … xserviceim and the like) in the interface common () may be obtained, and then the 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 an aserviceim is an ase, a key value corresponding to a bserviceim is an xsync, a key value corresponding to a Bsyle, CServiceImpl is a Csyle, a key value corresponding to a … … xserviceim is an xsile), and a correspondence between each implementation class object and a key value is stored in a key value pair object, for example, a key value pair may be defined as a map, and a specific operation ("csple" may be performed by using a csple "and a" csple "may be stored in the key value pair" and "may be used. Alternatively, the computer device may store the correspondence between the implementation class objects and the key values in the mapping table for later reading, and the storage manner is not limited in this embodiment.
Specifically, when the computer device utilizes the extended service interface to extend the service, the corresponding relationship between each implementation class object and the service type included in the service interface may be obtained from the database or by other methods, for example, the computer device may obtain the corresponding relationship between each implementation class object and the key value from the constructed key value pair object, where the key value represents the service type.
S102, obtaining 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, and the computer device may acquire 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 analysis, may perform type identification on the target service data by using an existing classification method to obtain a type of the target service data, that is, a target service type.
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; the target implementation class object is used for processing the target business data.
In this embodiment, when the computer device receives the external incoming target service data and obtains the target service type through analysis, it is described that the computer device needs to process the newly added service data, at this time, the computer device may further query the correspondence between the implementation class object obtained before and the service type, find the 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 called.
According to the implementation method of the service extension, the corresponding relation between each implementation class object and the service type in the service interface is obtained, 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 relation 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, all the implementation type objects contained in the service interface are separated and decoupled, the mutual influence is avoided, when the service is expanded, only the implementation type objects are needed to be newly added, the method for realizing the service interface can realize the processing operation of newly added service data, the original codes in the service interface are not changed, the service expansion and the maintenance and management of the service interface are convenient, so that the method has higher universality, and the method not only simplifies the service expansion process, but also improves the service expansion efficiency.
In one embodiment, an implementation manner of the S101 is provided, as shown in fig. 3, where the S101 "obtaining a correspondence between each implementation class object included in a service interface and a service type" includes:
s201, all the realization class objects contained in the service interface are obtained.
In this embodiment, the computer device may define a service interface in advance, further define each implementation class object for processing a specific service included in the service interface according to service data to be processed and service data to be expanded, where different implementation class objects are used to process different types of service data, and the number of 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 obtained.
S202, calling a type return method in each implementation class object to obtain the service type corresponding to each implementation class object.
The type return method can be defined in advance by the computer device when the class object is defined, is a member method for realizing the class object, and can return the service type of the class object when being called, for example, the type return method can be represented by getCondition (). In this embodiment, after the computer device obtains all the implementation class objects in the service interface, the type returning 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 implementation 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 steps, the corresponding relation between the implementation class objects and the service types can be further constructed and stored for later use.
The above embodiment provides a method for obtaining a correspondence between an implementation class object and a service type, and the computer device in this embodiment may obtain, through the correspondence, the implementation class object for processing extended service data by querying the correspondence when extending the service each time. Compared with the traditional method for expanding the service, the method for expanding the service needs to detect and judge whether the condition exists or not, and if the condition exists, the method for expanding the service can be further processed.
In summary, the present application provides a method for implementing service extension, as shown in fig. 4, where the method includes:
s301 defines a service interface (such as commonality ()), and member methods of the service interface (such as processTask () and getCondition ()). Wherein, processTask () is used to process specific service data, and 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 service type of the getCondition () returned to the service data.
S303, if there is extended service data, an implementation class object (such as servicempl2 ()) of the extended service data is defined.
S304, initializing Spring, obtaining all realization class objects in a service interface (common ()), and obtaining a member method getCondition (), in each realization class object in the service interface (common ()), to obtain a service type (for example, using a key value to represent) corresponding to each realization class object.
S305, storing the corresponding relation between each realization class object and the service type in the service interface into a key value pair object (such as map).
S306, receiving the target service data transmitted from the outside, and analyzing the target service data to obtain the target service type of the target service data.
S307, obtaining the corresponding relation between each realization class object and the service type from the key value pair object, and inquiring to obtain the realization class object corresponding to the target service type, namely the target realization class object (such as servicempl2 ()) based on the corresponding relation.
S308, calling a processTask () method in the target implementation class object to process the target service data.
In the medical field, an application scenario of parsing a log of a medical device is usually encountered, for example, the log is usually a file in xml format, and when the log is only an xml log of a computed tomography (Computed Tomography, CT) device, and the computer device needs to parse the xml log of the CT device, a method may be defined to parse the xml log, for example, using a processTask (document xml { }) to implement parsing of the xml log. Later on, the magnetic resonance device (Magnetic Resonance, MR) log, also an xml file, needs to be parsed. Obviously, when the content and structure of the MR log and the CT log are different, and the new MR log needs to be resolved, the conventional method for expanding the MR log resolving function is to manually modify the processTask (document xml { }), determine the judging condition for distinguishing the CT log and the MR log in the method, and add the MR log logic code, so that when the processTask method is executed later, the method can distinguish the CT log and the MR log through the judging condition input externally, and simultaneously execute the resolving code of the MR log to resolve the MR log. If a new log is needed to be added, the process task method is needed to be modified again by repeating the above process, so that the process task method is needed to be modified as long as a new equipment log exists, new judging conditions are added, new business logic codes are edited, the code of the whole process task method is changed to be bloated and difficult to maintain, the logic codes of the newly added equipment log are added on the basis of the original log codes in the process task method, the original log codes are easily damaged in the adding process, if the newly modified process task method has errors, the original log codes in the process task method cannot be realized, the whole business logic cannot be executed, and the process task method is needed to be overhauled or corrected again, so that the efficiency of the whole business expansion process is extremely low. Aiming at the technical problems brought by the application scenes, the application provides a service expansion realization method applied to the medical field for expanding logs of different types of equipment, and the following embodiment is used for expanding the method.
In one embodiment, the service interface in the embodiment of fig. 2 includes: an implementation class object of the CT log, an implementation class object of the MR log and an implementation class object of the newly added log. Correspondingly, the service type corresponding to the implementation class object of the CT log is the CT equipment type; the service type corresponding to the implementation class object of the MR log is the MR equipment type; the service type corresponding to the implementation class object of the newly added log is the newly added equipment type. 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 (such as commonality ()) and member methods of the service interface (such as processTask () and getCondition ()) are defined. Wherein, processTask () is used to process specific service data, and getCondition () is used to obtain the service type of the service data.
S402, defining each implementation class object contained in the service interface, 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, and rewriting the processTask () method in the three implementation class objects to process specific service data and rewriting the service type of the service data returned by getCondition ().
S403, initializing Spring, obtaining an implementation class object of a CT log, an implementation class object of an MR log and an implementation class object of a newly added log in a service interface (common ()), calling a member method getCondition (), in the implementation class object of the CT log, to obtain a CT equipment type, calling a member method getCondition (), in the implementation class object of the MR log, to obtain an MR equipment type, and calling a member method getCondition (), in the implementation class object of the newly added log, to obtain the newly added equipment type.
S404, storing the corresponding relations among 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 equipment type, the MR equipment type and the newly added equipment type into the key value pair object.
S405, receiving target business data transmitted from outside, and acquiring the corresponding relation between each realization class object and the business 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, then step S408 is executed; if the target service type is the newly added equipment type, step S409 is performed.
S407, according to the corresponding relation, inquiring to obtain an implementation class object of the CT log corresponding to the type of the CT equipment, and calling a processTask () method in the implementation 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 newly added equipment type, 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 log among CT log, MR log and newly added log.
With respect to the method described in the above embodiment, the following embodiment exemplifies the above method, as shown in fig. 6, including:
s501, defining a service interface and a member method, for example, defining a service interface common () and a member method processTask () and a getCondition (). Wherein, processTask () is used to process specific service data, and getCondition () is used to obtain the service type of the service data.
S502, defining an implementation class object of the CT log, such as CTServicelmpl, defining a member method procesTask () in the CTServicelmpl, for analyzing the CT log, defining a member method getCondition () in the CTServicelmpl, and returning a character string "CTLOG", wherein the character string represents the service type of the implementation class object of the CT log.
S503, defining an implementation class object of the MR log, such as MRServicell, defining a member method processTask () in the MRServicell, analyzing the MR log, defining a member method getCondition () in the MRServicell, and returning a character string 'MRLOG', wherein the character string represents the service type of the implementation class object of the MR log.
S504, defining an implementation class object of the newly added log, such as XXServicelmpl, defining a member method procesTask () in the XXServicelmpl, for analyzing the newly added log, defining a member method getCondition () in the XXServicelmpl, and for returning a character string "XXLOG", wherein the character string represents the service type of the implementation class object of the newly added log.
S505, initializing Spring, obtaining an implementation class object CTServicelmpl, MR log of a CT log in a business interface (commonservice ()), an implementation class object MRservicell of a newly added log, and calling a member method getCondition (), in the CTservicell, to obtain "CTLOG", calling a member method getCondition (), in the MRservicell, of the MR log, to obtain "MRLOG", and calling a member method getCondition (), in the implementation class object XXservicell of the newly added log, to obtain "XXLOG".
S506, storing the corresponding relation between CTServicelmpl, MRServicelmpl, XXServicelmpl and CTLOG, MRLOG and XXLOG into the map by calling methods map.put ("CTLOG", CTServicelmpl), map.put ("MRLOG", MRervicellmpl) and map.put ("XXLOG", XXServicelmpl).
S507, receiving target service data transmitted from outside, 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 step S508; if the target service type is "MRLOG", step S509 is executed; if the target service type is "XXLOG", step S510 is performed.
S508, obtaining a target implementation class object CTServicelmpl corresponding to the CTLOG from the map by calling a corresponding implementation class object acquisition method, and calling a member method processTask () in the CTServicelmpl to analyze the CT log.
S509, obtaining a target implementation class object MRServicell corresponding to the MRLOG from the map by calling a corresponding implementation class object acquisition method, and calling a member method processTask () in the MRServicell 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 acquisition method, and calling a member method processTask () in the XXServicelmpl to analyze the XX log.
It should be noted that, when the computer device obtains 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 the LogType is used to represent the target service type, the implementation class object obtaining method is logservicel () =map.get (LogType), and by calling map.get (LogType), the target implementation class object logservicel (), corresponding to the target service type, can be obtained from the map.
In the method, the whole process does not know which method for realizing the class object is required to be called in advance until the computer equipment obtains the corresponding target realization class object from the map according to the target service type, the target realization class object is obviously dynamic and is dynamically obtained according to the type of the input target service data, different target service types correspond to different target realization class objects, no matter how many equipment logs are added, the corresponding realization class object is only needed to be added, no change is needed to other realization class objects, and even if analysis of a certain log realization class object is wrong, the analysis of other types of logs is not influenced, so 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 steps in the flowcharts of fig. 2-6 are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in fig. 2-6 may include multiple steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor does the order in which the steps or stages are performed necessarily performed in sequence, but may be performed alternately or alternately with at least a portion of the steps or stages in other steps or other steps.
In one embodiment, as shown in fig. 7, there is provided a service extension implementation apparatus, including: a first acquisition module 11, a second acquisition module 12 and a determination 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 the input target service data;
a determining module 13, configured to determine a target implementation class object corresponding to the target service type according to a correspondence between the implementation class object and the service type; the target implementation class object is used for processing the target business data.
In one embodiment, the implementation class object is used to process business data and return the type of business data.
In one 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;
and the establishing unit 113 is configured to establish a correspondence between the implementation class objects and the service types.
In one embodiment, as shown in fig. 9, the implementation apparatus for service extension further includes:
and the calling module 14 is used for calling the service processing method in the target implementation class object to process the target service data.
In one embodiment, the service interface includes: an implementation class object of the CT log, an implementation class object of the MR log and an implementation class object of the newly added log;
the service type corresponding to the implementation class object of the CT log is a CT equipment type;
the service type corresponding to the implementation class object of the MR log is an MR equipment type;
and the service type corresponding to the implementation class object of the newly added log is a newly added equipment type.
In one embodiment, the target business data includes one of the CT log, the MR log, and the newly added log.
In one embodiment, different ones of the 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.
For specific limitation of the implementation device of the service extension, reference may be made to the limitation of the implementation method of the service extension hereinabove, and the description thereof will not be repeated here. The modules in the service extension implementation device may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which 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 includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used to store 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, when executed by a processor, implements a method of implementing a service extension.
It will be appreciated by those skilled in the art that the structure shown in FIG. 10 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the 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 stored therein a computer program, the processor when executing the computer program performing the steps of:
acquiring the corresponding relation between each implementation class object contained in the service interface and the service type;
acquiring a target service type corresponding to input target service data;
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 business data. The computer device provided in the foregoing embodiments has similar implementation principles and technical effects to those of the foregoing method embodiments, and will not be described herein in detail.
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 contained in the service interface and the service type;
acquiring a target service type corresponding to input target service data;
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 business data. The foregoing embodiment provides a computer readable storage medium, which has similar principles and technical effects to those of the foregoing method embodiment, and will not be described herein.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, or the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.

Claims (10)

1. A method for implementing service extension, which is applied in the medical field and is used for extending logs of different types of devices, the method comprising:
acquiring the corresponding relation between each implementation class object contained in the service interface and the service type; the service type represents the type of service data, the implementation class object is used for processing the service data and returning the type of the service data, and each implementation class object is separated and decoupled; the service interface comprises the following steps: an implementation class object of the CT log, an implementation class object of the MR log and an implementation class object of the newly added log; the service type corresponding to the implementation class object of the CT log is a CT equipment type; the service type corresponding to the implementation class object of the MR log is an MR equipment type; the service type corresponding to the implementation class object of the newly added log is a newly added equipment type;
acquiring a target service type corresponding to input target service data; wherein, the target service data is newly added service data, and the target service type is the service type of the newly added service data;
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 realization class object is used for processing the target service data;
when the service expansion is performed, the obtaining the corresponding relation between each implementation class object and the service type included in the service interface includes:
adding a newly added implementation class object to the original implementation class object by the service interface through a method of rewriting the service interface;
initializing the service interface and acquiring all realization 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 the implementation class objects and the service types.
2. The method according to claim 1, wherein the method further comprises:
and calling a service processing method in the target implementation class object to process the target service data.
3. The method of claim 1, wherein the target business data comprises one of the CT log, the MR log, and the new log.
4. The method of claim 1, wherein different ones of the implementation class objects are used to process different types of business data.
5. A device for implementing service expansion, which is applied in the medical field and is used for expanding logs of different types of equipment, the device comprising:
the first acquisition module is used for acquiring the corresponding relation between each implementation class object contained in the service interface and the service type; the service type represents the type of service data, the implementation class object is used for processing the service data and returning the type of the service data, and each implementation class object is separated and decoupled; the service interface comprises the following steps: an implementation class object of the CT log, an implementation class object of the MR log and an implementation class object of the newly added log; the service type corresponding to the implementation class object of the CT log is a CT equipment type; the service type corresponding to the implementation class object of the MR log is an MR equipment type; the service type corresponding to the implementation class object of the newly added log is a newly added equipment type;
the second acquisition module is used for acquiring a target service type corresponding to the input target service data; wherein, the target service data is newly added service data, and the target service type is the service type of the newly added 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, and the target implementation class object is used for processing the target service data;
the first acquisition module is also used for adding a newly added implementation class object to the original implementation class object by a method of rewriting a service interface when the service is expanded; initializing the service interface and acquiring each realization class object contained in the service interface; and obtaining the service type corresponding to each implementation class object by calling each implementation class object, and determining the corresponding relation between each implementation class object and the service type.
6. The apparatus of claim 5, wherein the apparatus further comprises:
and the calling module is used for calling the service processing method in the target implementation class object to process the target service data.
7. The apparatus of claim 5, wherein the target traffic data comprises one of the CT log, the MR log, and the new log.
8. The apparatus of claim 5, wherein different ones of the implementation class objects are used to process different types of traffic data.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 4 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 4.
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 CN112417020A (en) 2021-02-26
CN112417020B true 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)

Families Citing this family (1)

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

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
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

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9524146B2 (en) * 2012-12-14 2016-12-20 Sap Se Typed access of business object data structures
US10666527B2 (en) * 2018-04-26 2020-05-26 EMC IP Holding Company LLC Generating specifications for microservices implementations of an application

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
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

Also Published As

Publication number Publication date
CN112417020A (en) 2021-02-26

Similar Documents

Publication Publication Date Title
CN109800258B (en) Data file deployment method, device, computer equipment and storage medium
CN109684607B (en) JSON data analysis method and device, computer equipment and storage medium
CN112148509A (en) Data processing method, device, server and computer readable storage medium
CN112765023A (en) Test case generation method and device
CN111159329A (en) Sensitive word detection method and device, terminal equipment and computer-readable storage medium
CN112187713B (en) Message conversion method, device, computer equipment and storage medium
CN111190551B (en) Redis data migration system, migration method, migration device and terminal
CN112181430A (en) Code change statistical method and device, electronic equipment and storage medium
CN112417020B (en) Service expansion realization method, device, computer equipment and storage medium
CN114281803A (en) Data migration method, device, equipment, medium and program product
CN113391972A (en) Interface testing method and device
CN111124883B (en) Test case library introduction method, system and equipment based on tree form
CN113779452A (en) Data processing method, device, equipment and storage medium
CN116561003A (en) Test data generation method, device, computer equipment and storage medium
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
CN113342647A (en) Test data generation method and device
CN112231232A (en) Method, device and equipment for determining test data model and generating test data
CN114371866A (en) Version reconfiguration test method, device and equipment of service system
CN111538651A (en) Interface testing method, device, server and storage medium
CN116755684B (en) OAS Schema generation method, device, equipment and medium
CN116933267B (en) Intelligent contract vulnerability detection method, system and equipment for symbol execution
CN117573130A (en) Code processing method, device, electronic equipment and storage medium
CN116303317A (en) Log processing method and device for lua program interface and computer equipment
CN117453561A (en) Test script calling method, device, computer equipment and 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