CN106790067B - MVC layering-based service processing method, device and system - Google Patents

MVC layering-based service processing method, device and system Download PDF

Info

Publication number
CN106790067B
CN106790067B CN201611189130.XA CN201611189130A CN106790067B CN 106790067 B CN106790067 B CN 106790067B CN 201611189130 A CN201611189130 A CN 201611189130A CN 106790067 B CN106790067 B CN 106790067B
Authority
CN
China
Prior art keywords
service
service processing
module
mvc
calling party
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
CN201611189130.XA
Other languages
Chinese (zh)
Other versions
CN106790067A (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.)
Zhejiang Public Information Industry Co ltd
Original Assignee
Zhejiang Public Information Industry 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 Zhejiang Public Information Industry Co ltd filed Critical Zhejiang Public Information Industry Co ltd
Priority to CN201611189130.XA priority Critical patent/CN106790067B/en
Publication of CN106790067A publication Critical patent/CN106790067A/en
Application granted granted Critical
Publication of CN106790067B publication Critical patent/CN106790067B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/567Integrating service provisioning from a plurality of service providers

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a service processing method, a device and a system based on MVC layering, and relates to the field of communication. The service processing module calls a corresponding function to process after receiving a call request sent by a service calling party to obtain a service processing result, and returns the service processing result to the service calling party, wherein the service calling party can be a controller module or a data access object DAO module. The invention further increases the service hierarchy in the MVC hierarchy, thereby making the traditional MVC hierarchy clearer in the architecture, increasing the flexibility of the system, and effectively realizing the separation of service codes to release the coupling between the objects.

Description

MVC layering-based service processing method, device and system
Technical Field
The present invention relates to the field of communications, and in particular, to a service processing method, apparatus, and system based on MVC layering.
Background
With the continuous improvement of Internet technology, the current trend of information system construction is to adopt B/S (Browser/Server) structure instead of C/S (Client/Server) structure. Compared with the traditional C/S structure, the project based on the B/S structure simplifies the load of the client side because the business logic is concentrated on the server side, but increases the load of the server side, so that the project based on the B/S structure needs a clearer hierarchical structure in the aspect of system architecture, and a large number of MCV frameworks are emerged.
MVC is a software design model that is currently widely prevalent. In recent years, with the maturity of J2EE, MVC has become widely used and is a design model recommended on the J2EE platform. As shown in fig. 1, the MVC (Model/View/Controller) mode just divides the system into a Model layer, a View layer and a control layer, and therefore, the MVC mode adapts to the design requirements of increasingly complex Web application systems. The existing MVC framework business flow is shown in FIG. 2.
However, in the architecture of the Web application system constructed by the MVC mode, how to solve the problems of high coupling degree between service codes, poor maintainability of codes, improvement of reusability of an application framework, reusability of components and the like caused by high complexity of the system structure in the development process of the Web application system is urgently needed to be solved at present.
Disclosure of Invention
The embodiment of the invention provides a service processing method, a device and a system based on MVC layering.
According to one aspect of the present invention, a service processing method based on MVC layering is provided, including:
after receiving a calling request sent by a service calling party, calling a corresponding function for processing to obtain a service processing result;
and returning the service processing result to the service calling party.
In one embodiment, the service invoker is a controller module or a data access object DAO module.
In one embodiment, invoking the corresponding function for processing to obtain the service processing result further includes:
and calling the DAO module to perform corresponding data service processing.
In one embodiment, the invocation request further includes specified data type information, so that the returned business processing result is matched with the specified data type information.
According to another aspect of the present invention, an MVC hierarchy-based service processing module is provided, which includes a receiving unit, a service processing unit, and a transmitting unit, wherein:
the receiving unit is used for receiving a calling request sent by a service calling party;
the service processing unit is used for calling a corresponding function for processing after the receiving unit receives the calling request sent by the service calling party so as to obtain a service processing result;
and the sending unit is used for returning the service processing result to the service calling party.
In one embodiment, the service invoker is a controller module or a data access object DAO module.
In one embodiment, the service processing module further includes a service invoking unit, wherein:
and the service calling unit is used for calling the DAO module to perform corresponding data service processing.
In one embodiment, the invocation request further includes specified data type information, so that the returned business processing result is matched with the specified data type information.
According to another aspect of the present invention, there is provided an MVC hierarchy-based service processing system, including the service processing module according to any of the above embodiments, and
and the service calling party is used for sending a calling request to the service processing module and receiving a service processing result returned by the service processing module.
In one embodiment, the service invoker is a controller module or a data access object DAO module.
In one embodiment, the controller module is further configured to provide the service processing result to the view layer module for presentation to the user after receiving the service processing result returned by the service processing module.
Other features of the present invention and advantages thereof will become apparent from the following detailed description of exemplary embodiments thereof, which proceeds with reference to the accompanying drawings.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a schematic view of the MVC framework architecture.
Fig. 2 is a schematic diagram of a service flow of an MVC framework in the prior art.
Fig. 3 is a schematic diagram of an embodiment of an MVC-based hierarchical service processing method according to the present invention.
Fig. 4 is a schematic diagram of an embodiment of an MVC hierarchy-based service processing module according to the present invention.
Fig. 5 is a schematic diagram of another embodiment of the MVC-based hierarchical service processing module according to the present invention.
Fig. 6 is a schematic diagram of an embodiment of an MVC hierarchy-based service processing system according to the present invention.
FIG. 7 is a schematic view of the MVC framework service flow of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The relative arrangement of the components and steps, the numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present invention unless specifically stated otherwise.
Meanwhile, it should be understood that the sizes of the respective portions shown in the drawings are not drawn in an actual proportional relationship for the convenience of description.
Techniques, methods, and apparatus known to those of ordinary skill in the relevant art may not be discussed in detail but are intended to be part of the specification where appropriate.
In all examples shown and discussed herein, any particular value should be construed as merely illustrative, and not limiting. Thus, other examples of the exemplary embodiments may have different values.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, further discussion thereof is not required in subsequent figures.
Fig. 3 is a schematic diagram of an embodiment of an MVC-based hierarchical service processing method according to the present invention. Optionally, the method steps of this embodiment may be executed by a service processing module, where:
step 301, after receiving a call request sent by a service caller, calling a corresponding function to perform processing to obtain a service processing result.
Step 302, returning the service processing result to the service caller.
Alternatively, the service invoker may be a controller module or a data access object DAO module.
For example, a controller module is filled with a large number of service codes, wherein a function F is called many times, and in order to separate the service codes and release the coupling between objects, the function F is packaged into a service processing module, so that when the controller module calls the function F, the function F interacts with the service processing module to obtain the operation result of the function F, thereby making the service logic clearer.
Correspondingly, when the service code in the DAO module of the data access object also needs to call the function F, the operation result of the function F is obtained through interaction with the service processing module.
Based on the MVC hierarchy-based service processing method provided by the above embodiment of the present invention, by further adding service hierarchies to the MVC hierarchies, the traditional MVC hierarchies are clearer in architecture, the flexibility of the system is increased, and service code separation is effectively realized to release the coupling between objects.
Optionally, in the foregoing embodiment, the step of calling the corresponding function to perform processing to obtain the service processing result may further include:
and calling the DAO module to perform corresponding data service processing.
That is, if the service processing module needs to call the DAO module to perform corresponding service processing according to the received service request, the DAO module is called to perform corresponding data service processing, persistence operation, data addition, deletion, modification, and mapping of the encapsulation database to a corresponding model object.
Optionally, in the above embodiment, the invocation request further includes information of specified data type, so that the returned service processing result matches with the information of specified data type.
For example, the controller module needs the service processing module to return a result of the character string type, and the service processing module directly provides the service processing result of the character string type to the controller module, so that the controller module is not required to convert the received result. Through the design of the generic interface, the processing efficiency of the system can be effectively improved.
Fig. 4 is a schematic diagram of an embodiment of an MVC hierarchy-based service processing module according to the present invention. As shown in fig. 4, the service processing module may include a receiving unit 401, a service processing unit 402, and a transmitting unit 403. Wherein:
the receiving unit 401 is configured to receive a call request sent by a service caller.
The service processing unit 402 is configured to, after the receiving unit 401 receives the call request sent by the service caller, call a corresponding function to perform processing, so as to obtain a service processing result.
The sending unit 403 is configured to return the service processing result to the service caller.
Alternatively, the service invoker may be a controller module or a DAO module.
In addition, the call request also comprises specified data type information, so that the returned service processing result is matched with the specified data type information.
Based on the MVC hierarchy-based service processing apparatus provided in the above embodiment of the present invention, by further adding a service hierarchy in the MVC hierarchy, the conventional MVC hierarchy is made clearer in architecture, the flexibility of the system is increased, and service code separation is effectively implemented to release coupling between objects.
Fig. 5 is a schematic diagram of another embodiment of the MVC-based hierarchical service processing module according to the present invention. Compared with the embodiment shown in fig. 4, in addition to the receiving unit 501, the service processing unit 502 and the sending unit 503, the embodiment further includes a service invoking unit 504, where:
the service invoking unit 504 is configured to invoke the DAO module to perform corresponding data service processing.
Fig. 6 is a schematic diagram of an embodiment of an MVC hierarchy-based service processing system according to the present invention. As shown in fig. 6, the system may include a service caller 601 and a service processing module 602, where the service processing module 602 may be the service processing module according to any one of the embodiments in fig. 4 or fig. 5.
The service caller 601 is configured to send a call request to the service processing module 602, and is further configured to receive a service processing result returned by the service processing module 602.
Alternatively, the service invoker 601 may be a controller module or a data access object DAO module.
In addition, in the case that the service caller 601 is a controller module, the controller module is further configured to provide the service processing result to the view layer module for presentation to the user after receiving the service processing result returned by the service processing module.
FIG. 7 is a schematic view of the MVC framework service flow of the present invention. Compared with the prior art shown in fig. 2, a service processing module is arranged between the controller module and the DAO module, thereby effectively realizing service code separation to decouple objects. One specific implementation of which is described below.
Model (Model): the model is used as a main part of the application program, and can represent business data and business logic. One model can provide data for multiple views while improving application repeatability since the same model can be reused for multiple views.
View (View): the view is the interface that the user sees and interacts with. It can both display one or more model data to the user and receive the user's input data, but it does not perform any actual business processing and does not change the model state. The view can inquire the service state of the model, and the view can also receive a data updating event sent by the model, so that the user interface is synchronously updated.
Controller (Controller): generally, the controller accepts user input and invokes models and views to fulfill the user's requirements. On the one hand it interprets the input from the view as an object that the system can understand; on the other hand, it handles events from the model and results of model logic execution, invoking the appropriate views to provide feedback to the user.
Service processing module (Service): the addition of the service processing module (namely, the service layer) makes the layered architecture clearer, and increases the flexibility of the system. There are three strategies for the application of the business layer: firstly, the method comprises the following steps: biased to the Controller layer; II, secondly: biased toward the Model layer; thirdly, the method comprises the following steps: the combination of the two. An embodiment of the present invention employs a third strategy, but other strategies may be applicable. The basic implementation of the Model layer is defined by writing generic interfaces BaseServer < T, K > (T corresponds to the Model layer object, K is the type of the database primary key corresponding to the Model layer in the Model), and Service needs to contain the Service logic of a large department.
For example, in one particular implementation, the frontend controller FrontController performs interception of the matching request. Creating a Controller parent class BaseController, declaring instance variables HttpServletRequest, HttpServletResponse and HttpSession, annotating @ Resource through J2EE to automatically assemble a Bean object, acquiring request, respons and session objects, and inheriting the BaseController by a Controller layer.
Part of the Service layer needs to contain most of Service logic and provide basic data Service, the Service needs to inherit the parent interface BaseServer < T, K > to realize the basic encapsulation processing of the Model layer data, part of the Service layer only needs to contain the Service logic and does not need to inherit the parent interface BaseServer < T, K >, and the Service of the basic data can be realized by calling other Service layers inheriting the BaseServer < T, K >.
And the control layer calls the service layer to process the request data or (and) calls the DAO layer to package and process the data, further transmits the data to the View layer View, and renders the View layer View to be displayed to a front-end user.
And in the service layer basic interface, T corresponds to a Model layer object, and K is the type of a database main key corresponding to the Model layer in the Model:
Figure BDA0001186822150000071
Figure BDA0001186822150000081
and the DAO layer performs data service processing and persistence operation, and realizes the data addition, deletion, modification and mapping of a packaging database into a corresponding model object.
The model layer corresponds to a database, the DAO layer encapsulates database data to a corresponding model object, processing of the service layer on the data is simplified, the Controller obtains the processed model layer data and returns the processed model layer data to the view layer, and the view layer renders corresponding data to be presented to a front-end user, so that real-time interaction of the user is facilitated.
By implementing the invention, the following beneficial effects can be obtained:
1) separating the service codes and decoupling the objects.
2) The universal BaseServer Service < T, K > generic interface is packaged, and the Service intelligence is defined.
3) The system coupling is reduced, and the system expandability is increased.
4) And the system maintenance is convenient.
Based on the advantages of the invention, the method can be applied to the scenes of Web project development based on MVC layering, application development based on a generic interface and the like.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The description of the present invention has been presented for purposes of illustration and description, and is not intended to be exhaustive or limited to the invention in the form disclosed. Many modifications and variations will be apparent to practitioners skilled in this art. The embodiment was chosen and described in order to best explain the principles of the invention and the practical application, and to enable others of ordinary skill in the art to understand the invention for various embodiments with various modifications as are suited to the particular use contemplated.

Claims (7)

1. A service processing method based on MVC layering is characterized by comprising the following steps:
after receiving a calling request sent by a service calling party, calling a corresponding function for processing to obtain a service processing result, wherein the function comprises a DAO module;
returning the service processing result to the service calling party;
the calling request also comprises appointed data type information, so that the service processing result returned by the function is matched with the appointed data type information.
2. The method of claim 1,
the service calling party is a controller module or a data access object DAO module.
3. A MVC layering-based service processing module is characterized by comprising a receiving unit, a service processing unit and a transmitting unit, wherein:
the receiving unit is used for receiving a calling request sent by a service calling party;
the service processing unit is used for calling a corresponding function for processing after the receiving unit receives a calling request sent by a service calling party so as to obtain a service processing result, wherein the function comprises a DAO module, and the calling request also comprises specified data type information, so that the service processing result returned by the function is matched with the specified data type information;
and the sending unit is used for returning the service processing result to the service calling party.
4. The traffic processing module of claim 3,
the service calling party is a controller module or a data access object DAO module.
5. MVC-hierarchy-based business processing system, characterized in that it comprises a business processing module according to any one of claims 3 to 4, and
and the service calling party is used for sending a calling request to the service processing module and receiving a service processing result returned by the service processing module.
6. The system of claim 5,
the service calling party is a controller module or a data access object DAO module.
7. The system of claim 6,
the controller module is also used for providing the service processing result to the view layer module for presenting to the user after receiving the service processing result returned by the service processing module.
CN201611189130.XA 2016-12-21 2016-12-21 MVC layering-based service processing method, device and system Active CN106790067B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611189130.XA CN106790067B (en) 2016-12-21 2016-12-21 MVC layering-based service processing method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611189130.XA CN106790067B (en) 2016-12-21 2016-12-21 MVC layering-based service processing method, device and system

Publications (2)

Publication Number Publication Date
CN106790067A CN106790067A (en) 2017-05-31
CN106790067B true CN106790067B (en) 2020-05-26

Family

ID=58896687

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611189130.XA Active CN106790067B (en) 2016-12-21 2016-12-21 MVC layering-based service processing method, device and system

Country Status (1)

Country Link
CN (1) CN106790067B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108616597B (en) * 2018-05-09 2021-06-15 四川华创世纪科技有限公司 Distributed operation method for realizing service uninterrupted forever
CN108762780B (en) * 2018-05-09 2021-09-21 四川华创世纪科技有限公司 Method for realizing service software program separation operation
CN109739502A (en) * 2018-12-18 2019-05-10 南京宽慧无线网络通信有限公司 One kind being based on MVC framework mode service provisioning platform system
CN109783072A (en) * 2019-01-23 2019-05-21 深圳智链物联科技有限公司 Method for processing business, device, terminal device and computer readable storage medium
CN110389749A (en) * 2019-06-19 2019-10-29 深圳壹账通智能科技有限公司 Software development methodology, device and storage medium, computer equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102968742A (en) * 2012-12-19 2013-03-13 镇江市新创计算机系统集成有限公司 Local fund joint supervision platform system and optimization method thereof
CN104484182A (en) * 2014-12-25 2015-04-01 广东电子工业研究院有限公司 Elastic extensible multi-data-source mvc (model-view-controller) model architecture
CN104765596A (en) * 2014-01-08 2015-07-08 腾讯科技(深圳)有限公司 Request handling method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102968742A (en) * 2012-12-19 2013-03-13 镇江市新创计算机系统集成有限公司 Local fund joint supervision platform system and optimization method thereof
CN104765596A (en) * 2014-01-08 2015-07-08 腾讯科技(深圳)有限公司 Request handling method and device
CN104484182A (en) * 2014-12-25 2015-04-01 广东电子工业研究院有限公司 Elastic extensible multi-data-source mvc (model-view-controller) model architecture

Also Published As

Publication number Publication date
CN106790067A (en) 2017-05-31

Similar Documents

Publication Publication Date Title
CN106790067B (en) MVC layering-based service processing method, device and system
US11714665B2 (en) Method and apparatus for composite user interface creation
US10984012B2 (en) System and method of consuming and integrating with rest-based cloud and enterprise services
US11025750B2 (en) Determining whether to perform requests at a server or at a client device based on resources provided by the client device
US11226854B2 (en) Automatic integration of multiple graph data structures
US7920852B2 (en) Compression of data transmitted between server and mobile device
US20120102414A1 (en) Distributed controller of a user interface framework for web applications
KR20140033494A (en) Method and system for implementing function extension of open platform
CN104967689B (en) A kind of data processing method and device
US20210034338A1 (en) Communications Enablement Platform, System, and Method
US7996828B2 (en) Back-end field control for multiple software layers
CN101861578A (en) Network operating system
US20170168854A1 (en) Application specific configurable graphical user interface
CN101861580A (en) Network operating system
EP2395468A1 (en) Semantic user interface data assembling
WO2023125773A1 (en) Global exception handling method and platform in large-scale micro-service cluster scenario
KR101862840B1 (en) Remotely sited execution of a software application within a network
US9075597B2 (en) Modeled communication between deployment units
US20210392191A1 (en) User advanced media presentations on mobile devices using multiple different social media apps
JP2009508255A (en) Script application framework
CN113407652A (en) Space-time data model based on 3DPS
CN114051058B (en) Interface calling method, platform, electronic equipment and computer storage medium
CN114398082B (en) Compatible operation method and device for frame type block chain application
CN116560756B (en) Service orchestration method, electronic device, computer-readable storage medium
CN113468893B (en) Semantic-based sharing collaboration method and device

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