CN117850771A - Business application development platform, method and storage medium for web service - Google Patents
Business application development platform, method and storage medium for web service Download PDFInfo
- Publication number
- CN117850771A CN117850771A CN202311559857.2A CN202311559857A CN117850771A CN 117850771 A CN117850771 A CN 117850771A CN 202311559857 A CN202311559857 A CN 202311559857A CN 117850771 A CN117850771 A CN 117850771A
- Authority
- CN
- China
- Prior art keywords
- script
- service
- request
- application development
- platform
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000011161 development Methods 0.000 title claims abstract description 72
- 238000000034 method Methods 0.000 title claims abstract description 57
- 238000003860 storage Methods 0.000 title claims abstract description 6
- 238000013515 script Methods 0.000 claims abstract description 254
- 238000004458 analytical method Methods 0.000 claims abstract description 17
- 238000012986 modification Methods 0.000 claims description 10
- 230000004048 modification Effects 0.000 claims description 10
- 230000000977 initiatory effect Effects 0.000 claims description 6
- 230000001360 synchronised effect Effects 0.000 claims description 5
- 238000007792 addition Methods 0.000 claims description 3
- 238000012217 deletion Methods 0.000 claims description 3
- 230000037430 deletion Effects 0.000 claims description 3
- 230000005540 biological transmission Effects 0.000 claims 1
- 230000008569 process Effects 0.000 abstract description 19
- 238000012423 maintenance Methods 0.000 abstract description 7
- 230000006870 function Effects 0.000 description 36
- 238000005259 measurement Methods 0.000 description 9
- 230000004044 response Effects 0.000 description 9
- 230000014509 gene expression Effects 0.000 description 8
- 238000012360 testing method Methods 0.000 description 7
- 230000004927 fusion Effects 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 238000006243 chemical reaction Methods 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000004590 computer program Methods 0.000 description 2
- 230000001419 dependent effect Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000003203 everyday effect Effects 0.000 description 2
- 238000012544 monitoring process Methods 0.000 description 2
- 238000005457 optimization Methods 0.000 description 2
- 238000004806 packaging method and process Methods 0.000 description 2
- 238000011084 recovery Methods 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 238000012795 verification Methods 0.000 description 2
- 235000006719 Cassia obtusifolia Nutrition 0.000 description 1
- 235000014552 Cassia tora Nutrition 0.000 description 1
- 244000201986 Cassia tora Species 0.000 description 1
- 230000009471 action Effects 0.000 description 1
- 238000013475 authorization Methods 0.000 description 1
- 239000011230 binding agent Substances 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 210000001072 colon Anatomy 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- JHIVVAPYMSGYDF-UHFFFAOYSA-N cyclohexanone Chemical compound O=C1CCCCC1 JHIVVAPYMSGYDF-UHFFFAOYSA-N 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000000705 flame atomic absorption spectrometry Methods 0.000 description 1
- 239000012634 fragment Substances 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000002123 temporal effect Effects 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 238000012800 visualization Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/38—Creation or generation of source code for implementing user interfaces
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
- G06F8/315—Object-oriented languages
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/42—Syntactic analysis
- G06F8/427—Parsing
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Human Computer Interaction (AREA)
- Stored Programmes (AREA)
Abstract
The application discloses a business application development platform, a business application development method and a storage medium of web services, wherein the platform comprises a database, and business scripts of the web services are stored; the external general service interface is used for receiving a service request; the script management module is used for analyzing the service request to obtain an analysis result, executing corresponding operation on the service script according to the analysis result, and returning the execution result to the external general service interface. The method and the device realize scripting of the back-end logic codes, decouple the scripting logic and platform logic and store the scripting logic and platform logic in the database, so that business logic can be dynamically modified and updated without independently installing, compiling and configuring the back-end codes, only a service request is received through an external general service interface, related parameters are transmitted through the service request, corresponding operation is executed on the business scripts by utilizing the script management module, deployment and maintenance processes are simplified, and higher customization requirements can be realized through the scripting logic codes, and user experience is improved.
Description
Technical Field
The application belongs to the technical field of Internet, and particularly relates to a business application development platform, a business application development method and a storage medium of web services.
Background
The B/S architecture is known as Browser/Server, i.e., browser/Server architecture. Typically, very few transaction logic is implemented at the front end and the main transaction logic is implemented at the server side. The Browser client, web server and DB database constitute a so-called three-tier architecture. The B/S architecture system does not need special installation, only a Web browser is needed, the display logic is given to the Web browser, and the transaction processing logic is placed on the Web, so that a huge thick client is avoided, and the pressure of the client is reduced. It is with these advantages that the B/S architecture is becoming more popular in the internet age today. The process of creating, implementing, testing and deploying a service is not simple.
The existing development method of Web service logic generally adopts static language, and after modifying code logic, the code logic needs to be compiled again and released. Under the micro-service architecture, the whole process takes a long time, a few minutes and a half hours. For a very complex large project with tens of thousands of code volumes, the development process of the existing Web business logic is very beneficial to the stability, safety and scalability of the system, but if the business system is very light, the business code volumes are thousands, and similar light-weight business systems are very many, the development process of the existing Web business logic is not suitable.
Disclosure of Invention
The technical aim of the application is to provide a business application development platform and a business application development method for web services, so that a developer can simply, flexibly and efficiently complete the business application development of the web services.
To achieve the above technical object, the present application adopts the following method.
In a first aspect, the present application provides a business application development platform for a web service, including:
a database storing business scripts of web services;
the external general service interface is used for receiving service requests;
the script management module is respectively connected with the external general service interface and the database; the script management module is used for analyzing the service request, obtaining an analysis result, executing corresponding operation on the service script according to the analysis result, and returning an execution result to the external general service interface.
In a second aspect, an embodiment of the present application provides a method for developing a business application of a web service, including:
acquiring a business script of a web service, and storing the business script in a database;
receiving a service request, analyzing the service request, acquiring an analysis result, executing corresponding operation on the service script according to the analysis result, and returning an execution result.
In a third aspect, embodiments of the present application provide a computer-readable storage medium storing computer-executable instructions which, when executed by a processor, implement steps of a method for developing a business application for a web service as provided by any one of the possible embodiments of the second aspect.
Compared with the prior art, the business application development platform of the web service provided by the embodiment of the application realizes scripting of the back-end logic code, decouples the scripting logic from the platform logic, stores the logic in the database, enables the business logic to be dynamically modified and updated, does not need to independently install, compile, package and deploy the back-end code, only needs to receive a service request through an external general service interface, transmits related parameters through the service request, and uses the script management module to execute corresponding operations on the business script, thereby simplifying deployment and maintenance processes, realizing rapid updating and iteration of functions, realizing higher customization requirements through the scripting logic code, and improving user experience.
The business application development method of the web service realizes the scripting of the back-end logic codes, decouples the scripting logic from the platform logic and stores the scripting logic in the database; the modification of the back-end logic code can be completed by updating the service script in the database by using the external general service interface, and the quick updating and iteration of the functions can be realized.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic structural diagram of a business application development platform of a web service provided in an embodiment of the present application;
fig. 2 is a schematic structural diagram of a business application development platform for applying for a web service provided in the second embodiment;
fig. 3 is a schematic structural diagram of a business application development platform for applying for the web service provided in the second embodiment;
FIG. 4 is a schematic flow chart of a business script execution of a business application development platform for applying for web services provided in the second embodiment;
fig. 5 is a schematic flow chart of a cache module implementation in a business application development platform for applying for web services provided in an embodiment;
fig. 6 is a schematic diagram of a time-series database data query flow in a service application development platform applying for web services provided in the embodiment.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. It will be apparent that the described embodiments are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
The existing development method of Web service logic is to realize a Java Web service, and generally needs the following process.
Firstly, analyzing service requirements and designing a service interface; secondly, selecting a proper frame (such as Spring Boot) to build a service framework; thirdly, writing specific realization logic of the service interface according to interface definition, wherein the specific realization logic comprises calling a database, external services and the like to complete business functions; fourth, writing unit test aiming at core business logic to ensure that operation of each interface meets expectations; fifthly, adding security control, including parameter verification, exception handling, log recording and the like, to improve service security and robustness; step six, adding monitoring indexes and alarm rules to ensure the service running state visualization; seventh, if RPC service is needed to be provided, a service registration center is needed to be configured, and automatic registration and discovery of the service are realized; eighth step, write interface file, facilitate the caller to understand and use; ninth step: and deploying services in a test environment, performing integrated test, and repairing the problems step by step.
Conventional Java Web development, business logic is typically present in the project in the form of Java code. Java codes are used as static languages, after the logic of the codes is modified, the Java codes need to be compiled again and then released, and under a micro-service architecture, the whole process needs to take a long time, a few minutes and a half of many hours. For a very complex large project with code amounts in the tens of thousands, the above procedure is very beneficial for the stability, safety and scalability of the system. However, if the service system is very lightweight, the service code amount is thousands, and the similar lightweight service system is very many, the conventional Java Web development process is not suitable. Firstly, because the business logic is simple, in projects created by the process, the proportion of the business codes of the real core to the code quantity of the whole project is low, and the scaffold codes can increase the understanding and maintenance cost of developers; second, the maintenance cost of operation and maintenance is greatly exacerbated by the large and lightweight traffic, and each service needs to use basic operating resources, which is also a significant burden on limited hardware resources.
The application provides a business application development platform and a business application development method of web services, wherein the business application development platform of the web services (hereinafter, the platform can be simply called as a platform) comprises a database, an external general service interface and a script management module. The database stores business script of web service and other configuration data related to the platform, the external general service interface is used for receiving service requests, the script management module analyzes the service requests, obtains analysis results, executes corresponding operation on the business script according to the analysis results, and returns execution results to the external general service interface. Based on the platform, a developer can simply, flexibly and efficiently complete the business application development of the web service.
The embodiment of the application mainly realizes the scripting of the back-end logic codes, uses the script to independently store the service codes in the database from the platform logic, and can finish the modification of the back-end logic codes by decoupling the scripting logic from the platform logic and storing the scripting logic in the database and updating the service scripts in the database by using the external general service interface, thereby realizing the rapid updating and iteration of the functions.
The present application is further described below with reference to the drawings and specific examples.
Example 1
The present embodiment provides a business application development platform of a web service, as shown in fig. 1, including: the system comprises a database, an external general service interface and a script management module.
The database stores business scripts for web services. The external general service interface is used for receiving the service request.
The script management module is respectively connected with the external general service interface and the database. The script management module is used for analyzing the service request to obtain an analysis result, executing corresponding operation on the service script according to the analysis result, and returning the execution result to the external general service interface.
In a specific example, MVEL may be used as a dynamic scripting language for business logic code. Business scripts for the web service are first formed and stored in a database.
MVEL (MVFLEX Expression Language) is an open-source lightweight expression language, commonly used in Java Web platforms.
The main features and uses of MVEL include:
1. simple and easy to use, and the grammar is similar to Java language.
2. And the custom function is supported, and the function extension language function can be written.
3. Can be directly embedded into Java code for use, and is non-invasive.
4. Dynamic types are supported without the need to predefine variable types.
5. The running speed is high, and the performance is close to Java by analysis and optimization.
6. Rule languages such as Drools, JBoss Rules, etc. are commonly used in rule engines.
7. Also used to parse and run EL expressions, JSONPath expressions.
8. A binder is provided to integrate MVELs into Java applications.
9. Supporting plug-in extension syntax.
The Java Web platform can compile and cache the MVEL expression, and avoid re-parsing the expression each time. Similar to JavaScript, MVEL can be very conveniently embedded into Java code and applications to define business rules, configurations, templates, small-segment logic, etc., which is one of the lightweight scripting languages commonly used in the Java world. It is because of the above advantages of MVEL language that specific examples may choose to use MVEL as a dynamic scripting language.
The following is one example of an MVEL service script file format:
//@app tb
/(p param tableName { "type": "string", "required": true }: data table name to be operated// @ param tableFieldNames: data field name
//@anon
Data for/(and@comment query form
sqlExp='select`'+utils.string.join('`,`',tableFieldNames)+'`from'+tableName;
data=sql.selectRaw(sqlExp);
return{"data":data}。
MVEL service script configuration information starts with a preset symbol (for example, the symbol// @ is adopted in the embodiment of the application), and the server analyzes the script configuration information and stores the script configuration information in a database. The app represents an application to which the script belongs, all information such as cache, configuration and the like is isolated by taking the application as a unit, and the configuration of the corresponding application is read by using config. param represents parameters required for script execution. As in the example above, the tableName parameter, the tablefile names parameter, the tableName parameter, the contents in brackets thereafter represent parameter information, type represents the type of parameter, such as int, string, etc., required represents whether it must be entered by the front end (e.g., browser), and if so, the body of the HTTP request sent by the front end must include the parameter specified by the parameter name.
Still as illustrated above, if the value of "required" is False after the tableName parameter, the tableName parameter in the body of the HTTP request may not be filled. If a default value (defaultValue) is set in @ param tableName { }, the value of the tableName parameter in the body of the HTTP request may be replaced with the defaultValue, which represents the default value that would be used if the user had no parameters entered. The @ param parameter configuration information in the script file can also not specify the content in the bracket, so that the system defaults to use required as a wire, the type is determined by the front-end incoming data, the default value is not provided, and the content behind the param colon represents the parameter description for increasing the readability and not participating in script execution. any indicates whether the script allows anonymous execution, and if not @ any indicates that the script is not allowed to execute anonymously, i.e., the user cannot execute the script without logging in. The comment is used to describe the function of the script and does not participate in script execution. The parameters are not followed by// beginning lines to execute script code. Optionally, the business script file may also include comments,// represent a comment symbol, in the C, C ++, java, etc. language. And designating the object returned to the front end by return, wherein the result field of the received response is the returned result. The code before return is logic written by MVEL, wherein, for example sql, utils, config is a functional module packaged by the platform, and a developer can directly use the functional module in the script.
It will be appreciated that in some embodiments, some configuration information of the business application development platform, such as third party service address information, platform monitoring configuration information, etc., may also be stored in the database.
In this embodiment, the service request is in the HTTP POST request manner. The POST request method of HTTP (Hypertext Transfer Protocol) allows clients to submit data to a server, including the requested data in the request body and send to the target URL.
HTTP POST requests generally include:
request line: in the request line of the POST request, the POST method is used to specify the action of the request.
Request Header (Header): various header fields, such as Content-Type, content-Length, authorization, etc., may be included in the request header to describe the details of the request.
Request Body (Body): the data of the POST request is contained in the request body and sent to the server. The request body may carry Data in any format, and forms Data (Form Data) or JSON are generally used.
MIME type: depending on the Type of data in the request body, the Content-Type field needs to be set to specify the MIME Type of the data. Common types include application/x-www-form-URL coded (for transmitting URL encoded form data) and application/JSON (for transmitting JSON formatted data).
Data submission mode: in POST requests, data may be submitted in a variety of ways. A common way is to submit using HTML forms, or send POST requests in the background to submit data through Ajax technology.
The HTTP service request must conform to a specified format. In this embodiment, the service request at least includes URL parameters, script execution type and script name, and the encoding mode of the service request sending data is JSON type. JSON (JavaScript Object Notation, JS object tag) is a lightweight data exchange format. The URL parameter is a preset path, for example, the path part of the URL address is fixed to be/sys/online/execution, and the script execution type includes execution, addition, deletion or modification, for example, execution indicates that the execution type is execution. The HTTP service request must have a query parameter, i.e., an interfaceName, whose value is the MVEL service script name, and the system obtains script data from the database according to the script name. The content-type of the service request must be application/JSON and the requestor must also be a JSON object.
In some embodiments, in order to implement access control and rights management, it is ensured that only authorized personnel can modify and execute the logic code, reducing potential security vulnerabilities, and authentication of the user is required if @ anon is not set in the MVEL service script configuration information. At this time, there must be an X-Access-Token field in the header, which is used to request authentication.
The format of the execution result returned after the execution of the external general interface is as follows:
{
"success":true,
"message":"",
"code":200,
"result":{},
"timestamp":1676955862043;
}。
wherein the success field indicates whether the request is successfully executed, when the execution fails, the message returns text information that causes the execution failure, the code indicates a failure code of the execution failure, and when the success is equal to 200, the result indicates an execution result, and the timestamp indicates a timestamp of the request execution.
The database may be selected from MySQL database, which is an open source relational database management system (RDBMS). The method has good performance, reliability, security and usability, and is widely used for Web application programs, enterprise-level systems, big data processing tasks and the like.
In this embodiment, the external general service interface and the script management module may be provided on a JVM (Java virtual machine) in the server. The JVM is a key component of the Java platform and is a virtual machine for executing Java bytecodes. The JVM provides a consistent running environment across different operating systems, allowing Java programs to run across platforms.
The method and the device realize scripting of the back-end logic codes, decouple the scripting logic from the platform logic and store the scripting logic in the database, so that the business logic can be dynamically modified and updated without redeploying the whole system. Therefore, the flexibility and maintainability of the system can be improved, the change of service requirements can be responded quickly, independent compiling, packaging and deploying of back-end codes are not needed, service requests are only needed to be received through an external general service interface, related parameters are transmitted through the service requests, corresponding operation is executed on service scripts by utilizing the script management module, deploying and maintaining processes are simplified, higher customized requirements can be achieved through scripted logic codes, and user experience is improved.
Example two
In the conventional Java development, codes are usually subjected to version management by using a GIT or SVN version control system, so that quick rollback can be realized after the system has running problems, and later problem backtracking is facilitated. If the service logic script is stored in the database, the service logic script cannot be managed by the version control system, so that the service application development of the web service provided by the embodiment designs a script synchronization module for synchronizing the code warehouse and the database, so that a developer can develop the script in an integrated development environment (IDE, integrated Development Environment) familiar to the developer, and the version management target of the script is also completed. The script synchronization module operates as shown in figure 2.
On the basis of the above embodiment, the business application development platform of the web service provided by the embodiment further includes a script synchronization module, where the script synchronization module is connected with the external general service interface; the script synchronization module is used for acquiring the developed new service script and initiating a service request of the synchronization script to the external general service interface according to the new service script.
The user may choose to select the IDE according to his own preferences, such as VSCode, intllijIDEA, which is commonly used. After the development of the business logic is completed through IDE, a user can create a new interface record through an online form management function provided by a business application development platform, then the script is synchronized to the business application development platform through a synchronization tool oli-upload.py in a script synchronization module, and the platform is responsible for finally writing script data into a database.
The script synchronization module realizes the service script synchronization function through Python language, and aims to improve the writing efficiency of MVEL service scripts. For example, a common VSCode editor has powerful functions and supports a large number of plugins, a user can rapidly develop scripts by using the editor and has the functions of grammar checking, intelligent prompting, text highlighting and the like, the user can select any editor which is liked by the user to write the scripts, and then the scripts are synchronized into a database of a server through a service script synchronization tool. If the service script synchronization function is not used, the user can only write the script through the ordinary text tool of the webpage, and the functions of grammar checking, intelligent prompt and the like are not provided, so that the development efficiency is greatly reduced.
In addition, because the script is developed locally, the script can be managed through the git, and the functions of backup, snapshot and the like are realized.
In some embodiments, after completion of script synchronization, the user may test the interface using an HTTP API service test tool (e.g., postman, apipost, apifox). If the test passes, the developer may save and submit the code through tools provided by the version management system. If the problem is found later, the developer can conveniently roll back the local code and synchronize the roll-back operation into the database by using the script synchronization tool, so that the version management of script data in the database can be realized.
Meanwhile, to prevent a developer from synchronizing scripts to a remote repository multiple times, after a problem occurs on-line, the developer is unaware of which scripts need to be rolled back because many interface changes may be involved, so a timing task is added to the business application development platform provided in some embodiments. The timing task can backup the service scripts in the database in the early morning every day and store the service scripts in the remote warehouse, and after the situation occurs, an administrator can cancel all the modifications in the day by only restoring the database snapshot backed up in the early morning, so that the controllability and the safety of the online codes are enhanced.
In some embodiments, if the on-line database is deleted entirely due to accidents, it is very inefficient to restore all traffic services through the synchronization tool when the traffic interfaces are very many. Thus, optionally, the platform may further include a database snapshot tool for backing up the service script database at a time point set every day (e.g., in the morning of each day), and when the accident occurs, the service can be quickly restored by the backed up database snapshot.
According to the business application development platform of the web service, business codes are stored in the database, and the local MVEL business script is synchronized to the database through the script synchronization module, so that quick modification of the codes can be realized, switching of code logic can be realized in a non-stop state, after the MVEL business script is modified, the deployment process usually only needs a few seconds, and hundreds of times of online time is saved compared with a traditional mode. The script is managed by using Git, so that codes stored in a database can be incorporated into version management. By means of the timing task timing backup script, quick recovery after data loss in the database can be guaranteed.
Example III
On the basis of the above embodiment, the business application development platform of the web service provided by the embodiment further includes a script execution module, as shown in fig. 3, where the script execution module is connected with the external general service interface and the database respectively; the script execution module is used for analyzing the service request to obtain request parameters (the request parameters comprise service script names, parameter information in service script configuration information and the like); and pulling the corresponding service script from the database according to the request parameters, taking the request parameters as the execution context of the service script, and returning an execution result to the external general service interface after the service script is executed.
The flow of the script execution module executing the service script is shown in fig. 4. Fig. 4 shows a specific flow of executing service logic after receiving a service request from a user by an external generic service interface. Firstly, a script executing module acquires a requested service script name from a query field of a URL of an HTTP request, queries corresponding script data from a database according to the service script name, judges whether the script has anonymous attribute, if so, directly loads codes into a virtual machine container for execution, and if not, acquires a token field from a Header, checks the correctness of the token, and executes the script codes after checking.
The specific execution process is that firstly, request parameters in a body request body of HTTP are stored into a memory, namely, the request parameters are stored into a context variable with the type of Map to form script execution context, then script data are pulled from a database, and finally, execution rights are given to a script. After script execution is completed, the server packages the execution result into an HTTP response and returns the HTTP response to the browser.
Example IV
On the basis of the above embodiments, the business application development platform of the web service provided in this embodiment may update and modify the business script in the database by using a browser.
In the implementation process, the external general service interface and the script management module can be arranged in a virtual machine in the server.
The platform provided by the embodiment further comprises a script management page (not shown in the figure), wherein the script management page is connected with the script management module; the script management page is used for initiating a service request of adding, deleting, modifying and viewing the script so as to enable the script management module to execute corresponding operations; the script management page is also used for displaying an execution result corresponding to the operation.
Optionally, the script management page includes a form module, where the form module is configured to receive script data of the service script when the service script is newly added or modified, where the script data includes a service script name, configuration information of the service script, and script logic code of the newly added or modified service script, and initiate a service request according to the script data.
On the business application development platform of the web service provided by the embodiment of the application, the MVEL business script is managed by taking the application as a unit, and one script necessarily belongs to only one application.
The process of updating the service script in the database by the browser is as follows:
a developer can open a script management page of the platform through a browser, and can add, delete, modify and view scripts through the page. When the script is newly added or modified, a form module is used for filling in a form, script data of the service script is written in the form, and the script data comprises a service script name, configuration information of the service script, script logic codes of the service script and script function description. The script data respectively correspond to the file names of the MVEL service script files, the configuration information @ parameter value, the @ comment value and the @ anon value of the specific service script, and the content of the script files are shown in the above examples, and the specific meaning is not repeated.
After completing the form filling, the developer clicks the ok button and the browser will send a POST type HTTP request to the platform. After receiving the request, the platform forwards the request to the script management module.
The script management module analyzes the application name of the script from the request, if the application name does not exist in the database, the platform directly returns a response of requesting for errors to the browser, and the error information is that the application does not exist. Otherwise, the script management module analyzes the service script name and the script execution type from the service request, and if the execution type of the request is a deleted script, the script management module inquires whether the script exists in the database. If not, a response requesting an error is returned to the browser, and the error information is that the application does not exist. If the script is found in the database, the isDeleted field of the corresponding record of the script in the database is set to 1, which represents a soft delete, and a response requesting success is returned to the browser.
If the execution type of the service request is newly added or updated script, the script management module also queries the database for whether the script exists. If not, a record with name equal to the name of the script and other fields empty is established in the database. The platform will then check if the content in the user form is legal, e.g. the type field of the param can only be string, int, double, the any field can only be 0 or 1, the anon is not allowed or anonymity is allowed. If the form content is not legal, the platform will return a response to the browser requesting for errors, and the error information will indicate the reason of the illegal form in the user. If the verification is passed, the script data is updated and a response is returned to the browser requesting success.
After the deleting or updating script request is successfully executed, if the corresponding script data is already cached in the redis, the script management module deletes the script data cache. The user can compose the URL address for executing the script through a certain rule, and if the composition rule is: HTTP:// platform domain name: port number/path prefix/sys/online face/execute? interfacename=scriptname. The platform domain name, the port number and the path prefix are related to deployment, the deployment can be determined after the deployment is completed, the interfaceName is the service script name, and different scripts can be called by modifying the value of the interfaceName. Script execution parameters are passed to the script management module via the body of HTTP.
After the script is updated, after the platform receives the service request corresponding to the user, if the corresponding script does not exist in the cache, the platform queries script information from the database and caches the script information into the redis, so that the access times of the database can be reduced, the effect of immediately modifying logic after the script is updated by the user is realized, and the processes of compiling, packaging, publishing and the like are not needed.
Example five
On the basis of the above embodiment, as shown in fig. 3, the embodiment further includes an identity authentication and authority management module, which is connected with the external general service interface; the identity authentication and authority management module is configured to acquire a token from the service request, check the token, allow the legal request according to the check result, and intercept the illegal request.
The service application development platform provided by the embodiment of the application can be developed based on the SpringBoot framework and run on a Java virtual machine. In some embodiments, platform base functions may include business system configuration functions, identity authentication and rights management functions, script management functions, database management functions.
Optionally, in the platform provided in some embodiments, preselected functions (such as selecting common functions) in the service logic are encapsulated to form a complete set of SDK modules for use by script developers, where the SDK modules include one or more of a cache management module, a configuration read-write module, an HTTP module, a database access module, a time-series data reading module, a tool module, and the like, and the tool module is a collection of multiple sub-modules, such as a time data conversion sub-module, a mathematical computation sub-module, a character string processing sub-module, and the like.
And the cache management module stores the data which are not frequently modified in the memory, and when the request hits the effective cache, the cache data are directly returned to the user, so that the pressure on the database and the external service interface is reduced, and the response speed of the HTTP service interface is accelerated. An implementation of the caching module is shown in fig. 5.
The configuration read-write module provides a UI interface for a developer to modify data in the configuration database, after modification is completed, the platform clears the corresponding configuration cache, and the HTTP request of a subsequent user is processed according to the new configuration value.
The HTTP module encapsulates interfaces of HTTP sending POST and GET requests of the platform, and the encapsulated interfaces can be used for sending the requests to the outside in the MVEL expression, so that the calling of the external service interface is realized.
The database access module encapsulates reading and writing of MySQL, a developer can acquire data from the database by directly writing SQL sentences in an interface without predefining JavaBean as a container, the returned data is an array of Map, each record is a Map, when a query result has a plurality of records, an array formed by Map objects is returned, and keys of the Map objects correspond to field of the database.
In some embodiments, the database stores TDengine, which is a high-performance, distributed internet of things and industrial big data platform for the development of the tsu data, and the time sequence database reading module mainly refers to the reading of TDengine, and the reading flow is shown in fig. 6. And for the reading of the data of the real measuring point, after the data is obtained from the database, the data is directly returned after the conversion of the precision and the step code. For a virtual measurement point formed by fusing a plurality of measurement points or a measurement point requiring special conversion, after all the dependent measurement points are required to be acquired, logic calculation final results configured by a user are executed, and the logic configured by the user is also written by using an MVEL expression.
In a specific embodiment, the database is used for storing real-time measurement point data, and the service script is executed according to the measurement point data and preset service logic.
The following example is one example of a quick development implementation of temporal database query logic using MVEL service scripts.
In industrial internet of things application, it is very common application to query and process data of specified measuring points in a time sequence database, and the measuring point selection logic and the data processing logic are very different, so that the request logic of the measuring points can be quickly realized through MVEL service scripts.
The user sends a time sequence data request through the browser, the server acquires the measuring point information from the database after receiving the request, and if the requested measuring point does not need to fuse the data of other measuring points, the data is directly returned to the front end after the step code and the precision are adjusted. If the requested measurement point is the result of multiple data fusion, the values of all the dependent measurement points are obtained from the database, and the data fusion logic is stored in the database in the form of MVEL service script. The fusion measuring points are configured as follows:
{
monitorName:“dg1Voltage”,
displayName: "DG1 voltage",
depends:{"u":"903645","v":"903646","w":"903647"},
formula:“u=(Double)u;v=(Double)v;w=(Double)w;((u*u+v*v+w*w)/3.0)**0.5;”}。
this configuration indicates that DG1 voltage value depends on 3 measurement points 903645, 903646, 903647, the fusion formula is specified by formula, the specific meaning of the measurement points is that DG1 voltage is fused by three-phase electricity u, v, w, and the formula is the fusion formula. The business script execution logic can be quickly adjusted by modifying the configuration.
The platform provided by the embodiment of the application encapsulates the functions commonly used in the business logic into the SDK, so that when developing the MVEL business script, a developer usually needs only a small code amount to realize the functions which can be realized by a large amount of Java codes before the development of the MVEL business script. Summarizing according to actual use conditions, the code quantity is reduced by more than 80%. The smaller code amount reduces the understanding cost of the developer, improves the development efficiency, and reduces the debugging time. Meanwhile, because the functions are shared by all businesses, only one code needs to be maintained, and the optimization of one function can be applied to all business systems instead of synchronizing the codes or reintroducing updated version packages as in the traditional mode, so that the management of the codes by a developer is optimized.
It can be understood that, based on the service application development platform provided by the embodiment of the application, new services can be directly developed based on the platform, so that the construction process of a service framework is omitted, and a plurality of services share the service resources of the platform, and the platform can provide the computing service of class FAAS (method for realizing server-free computing), namely 'function as service', so that hardware resources are greatly saved; the platform can be based on a micro-service architecture, and can be conveniently horizontally expanded after the traffic is increased, so that the utilization rate of hardware resources is always kept at a higher level.
Faas is one implementation of the Serverless computing model. The main features of Faas are: 1. the application program and the business logic are abstracted into stateless functions, 2, the functions can be deployed to the Faas platform and completely managed by the platform, 3, developers only need to pay attention to function codes, and do not need to maintain infrastructure such as a server, 4, when the functions need to be executed, call requests are initiated to the Faas platform, and 5, the Faas platform can automatically and elastically expand computing resources to run the functions.
In brief, faas allows developers to deploy event-driven function code and expand and execute it according to specific requests, completely without regard to the details of the infrastructure, such as servers, which implements a schema for server computing. The use of Faas can result in higher development efficiency without the need for management servers and infrastructure, focusing on writing core business logic code. Repeated work is reduced, and independent functional code fragments are directly developed; the resource utilization rate is better, the resources are allocated according to the needs, the resource waste is avoided, and the maximum possible resources are not required to be allocated in advance; the operation and maintenance workload is reduced, and the developer does not need server maintenance and management. High availability and failure recovery at the infrastructure level is provided by the platform.
The whole platform project is developed based on SpringBoot Cloud, a Java version selects JDK8, nacos is used as a platform system configuration center and a service discovery registry, springCloud Gateway is used as a service gateway, redis is used as a system cache, mySQL is used for storing relational data, TDengine is used for storing a time sequence database, and the platform provides REST API for the outside. In a production environment, a platform is deployed in a micro-service mode, nacos, springCloudGateway, front-end service and back-end service of the platform run in a Docker container, and the container is managed through Kubernetes.
Example six
Corresponding to the business application development platform of the web service provided by the embodiment above, the present embodiment provides a business application development platform of the web service, and the method includes: acquiring a business script of the web service, and storing the business script in a database; receiving a service request, analyzing the service request, acquiring an analysis result, executing corresponding operation on the service script according to the analysis result, and returning an execution result.
The business application development method of the web service realizes the scripting of the back-end logic codes, decouples the scripting logic from the platform logic and stores the scripting logic in the database; the service script in the database is updated by using the external general service interface, so that the modification of the back-end logic code can be completed, and the quick updating and iteration of the functions can be realized.
Further, the method further comprises: acquiring a developed new service script; and initiating a service request of the synchronous script according to the new service script (to the external general service interface).
Optionally, the method further comprises: developing a service script and setting configuration information of the service script; the configuration information comprises the application name of the service script, parameter information of parameters required when the service script is executed, and whether the script allows anonymous execution or not; wherein the parameter information is allowed to be null; the parameter information includes a parameter name, a parameter type, and whether it must be entered by the service request, and if so, the parameter name must be included in the requestor of the service request.
It should be noted that, in the specific implementation process of the service application development method in the embodiment of the present application, reference may be made to the related description of the functions of each functional module of the service application development method in the above embodiment, which is not repeated herein.
The embodiment of the application also provides a computer readable medium, which is characterized in that a computer program is stored on the computer readable medium, and the computer program is executed by a processor to realize the business application development method of the web service.
Note that references in the specification to "one embodiment," "an embodiment," "example embodiments," "some embodiments," etc., indicate that the embodiment described may include a particular feature, structure, or characteristic, but every embodiment may not necessarily include the particular feature, structure, or characteristic. Moreover, such phrases are not necessarily referring to the same embodiment. Furthermore, when a particular feature, structure, or characteristic is described in connection with an embodiment, it is submitted that it is within the knowledge of one skilled in the art to effect such feature, structure, or characteristic in connection with other embodiments whether or not explicitly described.
The previous description of the disclosure is provided to enable any person skilled in the art to make or use the disclosure. Various modifications to the disclosure will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other variations without departing from the spirit or scope of the disclosure. Thus, the disclosure is not intended to be limited to the examples and designs described herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (15)
1. A business application development platform for web services, the platform comprising:
a database storing business scripts of web services;
the external general service interface is used for receiving service requests;
the script management module is respectively connected with the external general service interface and the database; the script management module is used for analyzing the service request, obtaining an analysis result, executing corresponding operation on the service script according to the analysis result, and returning an execution result to the external general service interface.
2. The business application development platform of web services according to claim 1, wherein the platform further comprises:
The script synchronization module is connected with the external general service interface;
the script synchronization module is used for acquiring a new service script which is developed and completed, and initiating the service request of the synchronization script to the external general service interface according to the new service script.
3. The web service business application development platform of claim 1 wherein the business script comprises configuration information and script logic code;
the configuration information comprises an application name to which the service script belongs, parameter information of parameters needed when the service script is executed, and whether the service script allows anonymous execution or not;
wherein the parameter information is allowed to be null; the parameter information includes a parameter name, a parameter type, and whether the parameter must be entered by the service request, and if so, the request body of the service request must include the parameter specified by the parameter name.
4. The business application development platform of web service according to claim 3, wherein the service request is an HTTP POST request manner, the service request at least includes URL parameters, script execution types, and script names, and the encoding manner of the service request transmission data is a JSON type;
The URL parameter is a preset path, and the script execution type comprises execution, addition, deletion or modification.
5. The business application development platform of web services according to claim 1, wherein the platform further comprises:
the script management page is connected with the script management module;
the script management page is used for initiating a service request of adding, deleting, modifying and viewing the service script so as to enable the script management module to execute corresponding operations;
the script management page is also used for displaying an execution result corresponding to the operation.
6. The business application development platform of web services of claim 5 wherein said script management page comprises:
a form module;
the form module is used for receiving script data of the service script when the service script is newly added or modified, wherein the script data comprises the service script name, configuration information of the service script and script logic codes of the service script after being newly added or modified, and the service request is initiated according to the script data.
7. The business application development platform of web services according to claim 1, wherein the platform further comprises:
The script execution module is respectively connected with the external general service interface and the database;
the script execution module is used for analyzing the service request to obtain request parameters; and pulling the corresponding service script from the database according to the request parameters, taking the request parameters as the execution context of the service script, and returning an execution result to an external general service interface after the service script is executed.
8. The business application development platform of web services of claim 7, wherein the platform further comprises:
the identity authentication and authority management module is connected with the external general service interface;
the identity authentication and authority management module is configured to obtain a token from the service request, check the token to obtain a check result, allow legal requests according to the check result, and intercept illegal requests.
9. A business application development method for web services, the method comprising:
acquiring a business script of a web service, and storing the business script in a database;
receiving a service request, analyzing the service request, acquiring an analysis result, executing corresponding operation on the service script according to the analysis result, and returning an execution result.
10. The business application development method according to claim 9, characterized in that the method further comprises:
acquiring a developed new service script;
and initiating the service request of the synchronous script according to the new service script.
11. The business application development method according to claim 9, characterized in that the method further comprises:
developing the service script and setting configuration information of the service script;
the configuration information comprises an application name to which the service script belongs, parameter information of parameters required when the service script is executed, and whether the script allows anonymous execution or not;
wherein the parameter information is allowed to be null; the parameter information includes a parameter name, a parameter type, and whether the parameter must be entered by the service request, and if so, the parameter specified by the parameter name must be included in the request body of the service request.
12. The service application development method according to claim 9, characterized in that the method comprises: and storing real-time measuring point data by utilizing a database, and executing the service script according to the measuring point data and preset service logic.
13. The service application development method according to claim 9, wherein the service request is in an HTTP POST request manner, the service request includes at least URL parameters, script execution type, and script name, and a media type of the service request transmitting data is a JSON type;
The URL parameter is a preset path, and the script execution type comprises execution, addition, deletion or modification.
14. The business application development method according to claim 9, characterized in that the method further comprises: and obtaining a token from the service request, checking the token to obtain a check result, allowing the legal request according to the check result, and intercepting the illegal request.
15. A computer readable storage medium storing computer executable instructions which when executed by a processor implement the steps of the business application development method of a web service of any one of claims 9 to 14.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311559857.2A CN117850771A (en) | 2023-11-21 | 2023-11-21 | Business application development platform, method and storage medium for web service |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311559857.2A CN117850771A (en) | 2023-11-21 | 2023-11-21 | Business application development platform, method and storage medium for web service |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117850771A true CN117850771A (en) | 2024-04-09 |
Family
ID=90527599
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311559857.2A Pending CN117850771A (en) | 2023-11-21 | 2023-11-21 | Business application development platform, method and storage medium for web service |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117850771A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118276875A (en) * | 2024-05-31 | 2024-07-02 | 欢乐互娱(上海)科技股份有限公司 | Dynamic form linkage configuration method and system |
-
2023
- 2023-11-21 CN CN202311559857.2A patent/CN117850771A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118276875A (en) * | 2024-05-31 | 2024-07-02 | 欢乐互娱(上海)科技股份有限公司 | Dynamic form linkage configuration method and system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR102220127B1 (en) | Method and apparatus for customized software development kit (sdk) generation | |
EP3465436B1 (en) | Extending object-schema-based application programming interfaces (apis) | |
US20230036980A1 (en) | Micro-frontend system, sub-application loading method, electronic device, computer program product, and computer-readable storage medium | |
US8060863B2 (en) | Conformance control module | |
US7895571B2 (en) | Method and apparatus for resolving client-side logic | |
US8826297B2 (en) | Creating web services from an existing web site | |
CN112506747B (en) | Business process monitoring method and device, electronic equipment and storage medium | |
KR20140047580A (en) | Method and system for synchronization mechanism on multi-server reservation system | |
CN100512115C (en) | Method and system for providing service to user | |
CN112579097A (en) | Software project construction method and device, storage medium and electronic equipment | |
US20210117313A1 (en) | Language agnostic automation scripting tool | |
CN108984202B (en) | Electronic resource sharing method and device and storage medium | |
US11232105B2 (en) | Unified metrics computation platform | |
CN117850771A (en) | Business application development platform, method and storage medium for web service | |
Rattanapoka et al. | An MQTT-based IoT cloud platform with flow design by Node-RED | |
Varanasi et al. | Spring Rest | |
Pinandito et al. | Framework design for modular web-based application using model-collectionservice-controller-presenter (mccp) pattern | |
CN114398152A (en) | Interface simulation service calling method and device | |
Chakraborty et al. | CRUD Operation on WordPress Database Using C# And REST API | |
CN113542323A (en) | Service processing method, device, equipment and computer readable storage medium | |
Kuzmovych | ElateMe-backend | |
US11726776B2 (en) | Super-app extension discovery and configuration via source code management platform comments | |
Xu | Web-based billing system exploits mature and emerging technology | |
Aryal | MERN stack with modern web practices | |
Bondili | Online Banking Application with Angular JS, RESTful Web Services and Cassandra Database |
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 |