CN113760343A - Method and device for processing service request - Google Patents

Method and device for processing service request Download PDF

Info

Publication number
CN113760343A
CN113760343A CN202010505326.5A CN202010505326A CN113760343A CN 113760343 A CN113760343 A CN 113760343A CN 202010505326 A CN202010505326 A CN 202010505326A CN 113760343 A CN113760343 A CN 113760343A
Authority
CN
China
Prior art keywords
service
identification
script
data
calculation
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
Application number
CN202010505326.5A
Other languages
Chinese (zh)
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.)
Beijing Jingdong Shangke Information Technology Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Shangke Information Technology Co Ltd
Beijing Wodong Tianjun Information Technology 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 Beijing Jingdong Shangke Information Technology Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Shangke Information Technology Co Ltd
Priority to CN202010505326.5A priority Critical patent/CN113760343A/en
Publication of CN113760343A publication Critical patent/CN113760343A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses a method and a device for processing a service request, and relates to the technical field of computers. One embodiment of the method comprises: receiving a service request transmitted by a service system, and analyzing the service request to obtain an input service parameter; wherein, the input service parameters comprise the identification of the calculation script and the identification of the service data; acquiring service data from a database according to the identification of the service data, and assembling the service data into a result object; calling the calculation script according to the identification of the calculation script; and obtaining an output service parameter according to the calculation script and the result object, and returning the output service parameter to the service system. The implementation mode can solve the technical problem that hard coding is needed to change the program logic.

Description

Method and device for processing service request
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for processing a service request.
Background
Generally, the flexibility of programs is achieved without hard coding through a configuration mode, and the flexibility is mostly applied to switch configuration of services, page file replacement functions and the like. But this is only an optimization in configuration and if the configuration information needs to be reprocessed to produce the desired result, the service needs to be hard coded.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
the configuration can only solve the simple application scene configuration, if the program logic is changed in a configuration mode, the program logic change must be realized in a hard coding mode, and the application needs to be redeployed.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for processing a service request, so as to solve the technical problem that a hard code is required to change a program logic.
To achieve the above object, according to an aspect of the embodiments of the present invention, there is provided a method for processing a service request, including:
receiving a service request transmitted by a service system, and analyzing the service request to obtain an input service parameter; wherein, the input service parameters comprise the identification of the calculation script and the identification of the service data;
acquiring service data from a database according to the identification of the service data, and assembling the service data into a result object;
calling the calculation script according to the identification of the calculation script;
and obtaining an output service parameter according to the calculation script and the result object, and returning the output service parameter to the service system.
Optionally, acquiring the service data from the database according to the identifier of the service data, including:
judging whether the identification of the calculation script is one of the configured identifications of the calculation script;
if yes, continuing to judge whether the input attribute corresponding to the identification of the business data is matched with the identification of the calculation script;
if yes, acquiring the service data from a database according to the identification of the service data;
if not, returning an error code and an error message to the service system;
if not, returning an error code and an error message to the service system.
Optionally, the identification of the business data includes an item ID and a basic attribute ID of the item;
acquiring service data from a database according to the identification of the service data, and assembling the service data into a result object, wherein the method comprises the following steps:
and acquiring at least one detailed data from a database according to the identification of the service data, and assembling the at least one detailed data into a result object.
Optionally, the calculation script is stored in a directory node of a Zookeeper as a node value of the directory node; and the name of the target node is the identification of the calculation script.
Optionally, obtaining an output service parameter according to the calculation script and the result object includes:
and transmitting the calculation script and the result object to a rendering engine, and operating the rendering engine to obtain an output service parameter.
Optionally, the rendering engine is Rhino, and the computation script is a JavaScript computation script.
Optionally, the input service parameter and the output service parameter are both JSON objects.
In addition, according to another aspect of the embodiments of the present invention, there is provided an apparatus for processing a service request, including:
the receiving module is used for receiving a service request transmitted by a service system and analyzing the service request to obtain an input service parameter; wherein, the input service parameters comprise the identification of the calculation script and the identification of the service data;
the assembly module is used for acquiring the service data from a database according to the identification of the service data and assembling the service data into a result object;
the calling module is used for calling the calculation script according to the identification of the calculation script;
and the calculation module is used for obtaining output service parameters according to the calculation script and the result object and returning the output service parameters to the service system.
Optionally, the assembly module is further configured to:
judging whether the identification of the calculation script is one of the configured identifications of the calculation script;
if yes, continuing to judge whether the input attribute corresponding to the identification of the business data is matched with the identification of the calculation script;
if yes, acquiring the service data from a database according to the identification of the service data;
if not, returning an error code and an error message to the service system;
if not, returning an error code and an error message to the service system.
Optionally, the identification of the business data includes an item ID and a basic attribute ID of the item;
the assembly module is further configured to:
and acquiring at least one detailed data from a database according to the identification of the service data, and assembling the at least one detailed data into a result object.
Optionally, the calculation script is stored in a directory node of a Zookeeper as a node value of the directory node; and the name of the target node is the identification of the calculation script.
Optionally, the computing module is further configured to:
and transmitting the calculation script and the result object to a rendering engine, and operating the rendering engine to obtain an output service parameter.
Optionally, the rendering engine is Rhino, and the computation script is a JavaScript computation script.
Optionally, the input service parameter and the output service parameter are both JSON objects.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any of the embodiments described above.
According to another aspect of the embodiments of the present invention, there is also provided a computer readable medium, on which a computer program is stored, which when executed by a processor implements the method of any of the above embodiments.
One embodiment of the above invention has the following advantages or benefits: the technical means that the service data are acquired from the database according to the identification of the service data, the service data are assembled into the result object, and the calculation script is called according to the identification of the calculation script, so that the output service parameters are obtained according to the calculation script and the result object is adopted, and the technical problem that the program logic can be changed by hard coding in the prior art is solved. The embodiment of the invention transmits the parameters through the service system and matches the corresponding calculation script for dynamic calculation, so that the dynamic calculation service source code does not need to be modified, the deployment application does not need to be newly added or newly added, and the technical effect of zero deployment is achieved. Moreover, from a program perspective, the embodiment of the invention improves extensibility.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
fig. 1 is a schematic diagram of a main flow of a method of processing a service request according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a main flow of a method of processing a service request according to a referential embodiment of the present invention;
FIG. 3 is a schematic diagram of a regularity check of an input traffic parameter according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of data acquisition and data assembly according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of invoking a computing script, according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of computing output traffic parameters according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a main flow of a method of processing a service request according to another referential embodiment of the present invention;
fig. 8 is a schematic diagram of the main modules of an apparatus for processing a service request according to an embodiment of the present invention;
FIG. 9 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 10 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In order to solve the technical problem in the prior art, the embodiment of the invention realizes that the program computing logic can be changed without hard coding in a configuration mode.
Fig. 1 is a schematic diagram of a main flow of a method for processing a service request according to an embodiment of the present invention. As an embodiment of the present invention, as shown in fig. 1, the method for processing a service request may include:
step 101, receiving a service request transmitted by a service system, and analyzing the service request to obtain an input service parameter.
The business system calls the dynamic computing service and transmits business parameters. As shown in fig. 2, the dynamic computing service receives a service request sent by a service system, and parses the service request, thereby obtaining an input service parameter. Wherein the input service parameters include an identifier of the computation script and an identifier of the service data. And acquiring service data for calculation from the database through the identification of the service data, and calling a calculation logic for processing the service data through the identification of the calculation script.
The input service parameters are JSON objects when the service calls the dynamic computing service, so that the service system service can configure the data structure (i.e., input attribute) of the input service parameters according to different computing scripts, and the data structure of the input service parameters is as follows:
Figure BDA0002526332250000061
attrObj can define a data structure according to different calculation scripts, so that the aim of dynamically configuring input service parameters is fulfilled.
And 102, acquiring service data from a database according to the identification of the service data, and assembling the service data into a result object.
As shown in fig. 2, after the dynamic computation service analyzes and obtains the input service parameters, the steps of parameter verification, data assembly, computation script calling, rendering engine running, and the like may be performed according to the input service parameters, so as to obtain output service parameters (i.e., computation results).
Optionally, acquiring the service data from the database according to the identifier of the service data, including: judging whether the identification of the calculation script is one of the configured identifications of the calculation script; if yes, continuing to judge whether the input attribute corresponding to the identification of the business data is matched with the identification of the calculation script; if yes, acquiring the service data from a database according to the identification of the service data; if not, returning an error code and an error message to the service system; if not, returning an error code and an error message to the service system. In the embodiment of the present invention, each calculation script has its corresponding input attribute, such as an article ID, a basic attribute ID of an article, and the like, and as described in step 101, a data structure needs to be defined in advance according to different calculation scripts, so in step 102, firstly, a regularity check is performed on an input service parameter, that is, it is determined whether the input attribute corresponding to the identifier of the service data matches the identifier of the calculation script, as shown in fig. 3. And if the matching is successful, acquiring the service data from a database according to the identification of the service data, and assembling the service data into a result object. If the matching fails, the service processing is terminated, and an error code and an error message are returned to the service system, which indicates that the input service parameters are wrong.
Alternatively, as shown in fig. 4, taking the input service parameter a transmitted by the service system a as an example, the identification of the service data includes an item ID and a basic attribute ID of the item. Optionally, acquiring service data from a database according to the identifier of the service data, and assembling the service data into a result object, including: and acquiring at least one detailed data from a database according to the identification of the service data, and assembling the at least one detailed data into a result object. The input service parameters are only key identification, and the actual data is stored in a relational or non-relational database, such as (MySQL, MongoDB, HBASE and the like); and acquiring corresponding detail line data from the database through the key identification, and transmitting the data to the calculation script for calculation after the data is assembled again.
And 103, calling the calculation script according to the identification of the calculation script.
Optionally, the calculation script is stored in a directory node of a Zookeeper as a node value of the directory node; and the name of the target node is the identification of the calculation script. As shown in fig. 5, each computation script is stored in a directory node of the Zookeeper (the unique identifier of each computation script is used as a node, or other key values are used as nodes), and the directory node-node in the Zookeeper is matched by inputting the identifier of the computation script in the service parameter, so as to obtain a corresponding node value-value (computation script), thereby achieving the purpose of dynamically calling the computation script.
And 104, obtaining output service parameters according to the calculation script and the result object, and returning the output service parameters to the service system.
Optionally, as shown in fig. 6, obtaining the output service parameter according to the calculation script and the result object includes: and transmitting the calculation script and the result object to a rendering engine, and operating the rendering engine to obtain an output service parameter.
When the script calculation is completed, the returned output service parameter is a JSON object, and the data structure (i.e., the return attribute) of the output service parameter can also be configured according to different calculation scripts, so that the purpose of dynamically configuring the output service parameter is achieved, and the data structure of the output service parameter is as follows:
name (R) Field(s) Type (B) Must fill in Description of the invention
Return coding code String Is that
Error messages msg String Is that
Results dataJson JSON object Is that Dynamic results
Optionally, the rendering engine is Rhino, and the computation script is a JavaScript computation script. The embodiment of the invention transmits the input service parameters and the called calculation script to the Rhino JavaScript rendering engine, and the engine outputs the JSON object after running, thereby returning to the service system. The JavaScript has strong calculation capability, self-defined formulas and self-defined document conversion rules, the data type is JSON, and the performance advantage is established for real-time calculation, so that the embodiment of the invention adopts the JavaScript as a calculation script.
When the calculation script is adjusted according to the service requirement, the data structures of the input service parameter and the output service parameter are modified, and the node value (calculation script logic) in the Zookeeper is also modified, so that the service system calls the dynamic calculation service again to obtain a corresponding calculation result, and the technical effect of zero deployment is achieved.
According to the various embodiments described above, it can be seen that the technical means of acquiring the service data from the database according to the identifier of the service data, assembling the service data into the result object, and calling the computation script according to the identifier of the computation script, thereby obtaining the output service parameter according to the computation script and the result object, solves the technical problem that the program logic can be changed by hard coding in the prior art. The embodiment of the invention transmits the parameters through the service system and matches the corresponding calculation script for dynamic calculation, so that the dynamic calculation service source code does not need to be modified, the deployment application does not need to be newly added or newly added, and the technical effect of zero deployment is achieved. Moreover, from a program perspective, the embodiment of the invention improves extensibility.
Fig. 7 is a schematic diagram of a main flow of a method of processing a service request according to another referential embodiment of the present invention. As another embodiment of the present invention, as shown in fig. 7, the method for processing a service request may include:
step 701, receiving a service request transmitted by a service system, and analyzing the service request to obtain an input service parameter.
The business system calls the dynamic computing service and transmits business parameters. And the dynamic computing service receives a service request transmitted by a service system and analyzes the service request so as to obtain an input service parameter. Wherein the input service parameters include an identifier of the computation script and an identifier of the service data. The input business parameters transmitted when the business service calls the dynamic computing service are JSON objects, so the business system service can configure the data structure (namely the input attribute) of the input business parameters according to different computing scripts.
Step 702, judging whether the identification of the calculation script is one of the configured identifications of the calculation script; if yes, go to step 703; if not, go to step 708.
Step 703, determining whether the input attribute corresponding to the identifier of the service data matches the identifier of the calculation script; if yes, go to step 704; if not, go to step 708.
Step 704, obtaining the service data from the database according to the identification of the service data, and assembling the service data into a result object.
The input service parameters are only key identification, and the actual data is stored in a relational or non-relational database, such as (MySQL, MongoDB, HBASE and the like); and acquiring corresponding detail line data from the database through the key identification, and transmitting the data to the calculation script for calculation after the data is assembled again.
Step 705, invoking the calculation script according to the identification of the calculation script.
The calculation script is stored in a directory node of the Zookeeper and used as a node value of the directory node; and the name of the target node is the identification of the calculation script. Each calculation script is stored in a directory node of the Zookeeper (the unique identifier of different calculation scripts is used as a node, and other key values can also be used as nodes), and the directory node-node in the Zookeeper is matched by inputting the identifier of the calculation script in the service parameter, so as to obtain the corresponding node value-value, thereby achieving the purpose of dynamically calling the calculation script.
Step 706, the calculation script and the result object are transmitted to a rendering engine, and the rendering engine is operated to obtain an output service parameter.
When the script calculation is completed, the returned output service parameters are JSON objects, and the data structure (namely the return attribute) of the output service parameters can be configured according to different calculation scripts, so that the purpose of dynamically configuring the output service parameters is achieved.
Optionally, the rendering engine is Rhino, and the computation script is a JavaScript computation script. The embodiment of the invention transmits the input service parameters and the called calculation script to the Rhino JavaScript rendering engine, and the engine outputs the JSON object after running, thereby returning to the service system.
When the calculation script is adjusted according to the service requirement, the data structures of the input service parameter and the output service parameter are modified, and the node value (calculation script logic) in the Zookeeper is also modified, so that the service system calls the dynamic calculation service again to obtain a corresponding calculation result, and the technical effect of zero deployment is achieved.
Step 707, returning the output service parameters to the service system.
Step 708, an error code and an error message are returned to the service system.
In addition, in a reference embodiment of the present invention, the detailed implementation content of the method for processing a service request is already described in detail in the above-mentioned method for processing a service request, so that the repeated content is not described again.
Fig. 8 is a schematic diagram of main modules of an apparatus for processing a service request according to an embodiment of the present invention, and as shown in fig. 8, the apparatus 800 for processing a service request includes a receiving module 801, an assembling module 802, a calling module 803, and a calculating module 804; the receiving module 801 is configured to receive a service request sent by a service system, and analyze the service request to obtain an input service parameter; wherein, the input service parameters comprise the identification of the calculation script and the identification of the service data; the assembling module 802 is configured to obtain service data from a database according to the identifier of the service data, and assemble the service data into a result object; the calling module 803 is used for calling the calculation script according to the identification of the calculation script; the calculation module 804 is configured to obtain an output service parameter according to the calculation script and the result object, and return the output service parameter to the service system.
Optionally, the assembly module 802 is further configured to:
judging whether the identification of the calculation script is one of the configured identifications of the calculation script;
if yes, continuing to judge whether the input attribute corresponding to the identification of the business data is matched with the identification of the calculation script;
if yes, acquiring the service data from a database according to the identification of the service data;
if not, returning an error code and an error message to the service system;
if not, returning an error code and an error message to the service system.
Optionally, the identification of the business data includes an item ID and a basic attribute ID of the item;
the assembly module is further configured to:
and acquiring at least one detailed data from a database according to the identification of the service data, and assembling the at least one detailed data into a result object.
Optionally, the calculation script is stored in a directory node of a Zookeeper as a node value of the directory node; and the name of the target node is the identification of the calculation script.
Optionally, the calculating module 804 is further configured to:
and transmitting the calculation script and the result object to a rendering engine, and operating the rendering engine to obtain an output service parameter.
Optionally, the rendering engine is Rhino, and the computation script is a JavaScript computation script.
Optionally, the input service parameter and the output service parameter are both JSON objects.
According to the various embodiments described above, it can be seen that the technical means of acquiring the service data from the database according to the identifier of the service data, assembling the service data into the result object, and calling the computation script according to the identifier of the computation script, thereby obtaining the output service parameter according to the computation script and the result object, solves the technical problem that the program logic can be changed by hard coding in the prior art. The embodiment of the invention transmits the parameters through the service system and matches the corresponding calculation script for dynamic calculation, so that the dynamic calculation service source code does not need to be modified, the deployment application does not need to be newly added or newly added, and the technical effect of zero deployment is achieved. Moreover, from a program perspective, the embodiment of the invention improves extensibility.
It should be noted that, in the implementation of the apparatus for processing a service request according to the present invention, the details of the method for processing a service request are already described in detail, and therefore, the repeated contents are not described again here.
Fig. 9 shows an exemplary system architecture 900 of a method of processing a service request or an apparatus for processing a service request to which embodiments of the present invention may be applied.
As shown in fig. 9, the system architecture 900 may include end devices 901, 902, 903, a network 904, and a server 905. Network 904 is the medium used to provide communication links between terminal devices 901, 902, 903 and server 905. Network 904 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 901, 902, 903 to interact with a server 905 over a network 904 to receive or send messages and the like. The terminal devices 901, 902, 903 may have installed thereon various messenger client applications such as, for example only, a shopping-like application, a web browser application, a search-like application, an instant messaging tool, a mailbox client, social platform software, etc.
The terminal devices 901, 902, 903 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 905 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 901, 902, 903. The background management server may analyze and otherwise process the received data such as the item information query request, and feed back a processing result (for example, target push information, item information — just an example) to the terminal device.
It should be noted that the method for processing the service request provided by the embodiment of the present invention is generally executed by the server 905, and accordingly, the apparatus for processing the service request is generally disposed in the server 905.
It should be understood that the number of terminal devices, networks, and servers in fig. 9 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 10, a block diagram of a computer system 1000 suitable for use with a terminal device implementing an embodiment of the invention is shown. The terminal device shown in fig. 10 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 10, the computer system 1000 includes a Central Processing Unit (CPU)1001 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)1002 or a program loaded from a storage section 1008 into a Random Access Memory (RAM) 1003. In the RAM1003, various programs and data necessary for the operation of the system 1000 are also stored. The CPU 1001, ROM 1002, and RAM1003 are connected to each other via a bus 1004. An input/output (I/O) interface 1005 is also connected to bus 1004.
The following components are connected to the I/O interface 1005: an input section 1006 including a keyboard, a mouse, and the like; an output section 1007 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 1008 including a hard disk and the like; and a communication section 1009 including a network interface card such as a LAN card, a modem, or the like. The communication section 1009 performs communication processing via a network such as the internet. The driver 1010 is also connected to the I/O interface 1005 as necessary. A removable medium 1011 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 1010 as necessary, so that a computer program read out therefrom is mounted into the storage section 1008 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication part 1009 and/or installed from the removable medium 1011. The computer program executes the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 1001.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer programs according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a receiving module, an assembling module, a calling module, and a calculating module, where the names of the modules do not in some cases constitute a limitation on the modules themselves.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, implement the method of: receiving a service request transmitted by a service system, and analyzing the service request to obtain an input service parameter; wherein, the input service parameters comprise the identification of the calculation script and the identification of the service data; acquiring service data from a database according to the identification of the service data, and assembling the service data into a result object; calling the calculation script according to the identification of the calculation script; and obtaining an output service parameter according to the calculation script and the result object, and returning the output service parameter to the service system.
According to the technical scheme of the embodiment of the invention, because the technical means that the service data are acquired from the database according to the identification of the service data, the service data are assembled into the result object, and the calculation script is called according to the identification of the calculation script, so that the output service parameters are obtained according to the calculation script and the result object is adopted, the technical problem that the program logic can be changed by hard coding in the prior art is solved. The embodiment of the invention transmits the parameters through the service system and matches the corresponding calculation script for dynamic calculation, so that the dynamic calculation service source code does not need to be modified, the deployment application does not need to be newly added or newly added, and the technical effect of zero deployment is achieved. Moreover, from a program perspective, the embodiment of the invention improves extensibility.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method for processing a service request, comprising:
receiving a service request transmitted by a service system, and analyzing the service request to obtain an input service parameter; wherein, the input service parameters comprise the identification of the calculation script and the identification of the service data;
acquiring service data from a database according to the identification of the service data, and assembling the service data into a result object;
calling the calculation script according to the identification of the calculation script;
and obtaining an output service parameter according to the calculation script and the result object, and returning the output service parameter to the service system.
2. The method of claim 1, wherein obtaining the service data from the database according to the identification of the service data comprises:
judging whether the identification of the calculation script is one of the configured identifications of the calculation script;
if yes, continuing to judge whether the input attribute corresponding to the identification of the business data is matched with the identification of the calculation script;
if yes, acquiring the service data from a database according to the identification of the service data;
if not, returning an error code and an error message to the service system;
if not, returning an error code and an error message to the service system.
3. The method of claim 1, wherein the identification of the business data comprises an item ID and an underlying attribute ID of the item;
acquiring service data from a database according to the identification of the service data, and assembling the service data into a result object, wherein the method comprises the following steps:
and acquiring at least one detailed data from a database according to the identification of the service data, and assembling the at least one detailed data into a result object.
4. The method according to claim 1, wherein the computation script is stored in a directory node of a Zookeeper as a node value of the directory node; and the name of the target node is the identification of the calculation script.
5. The method of claim 1, wherein deriving output service parameters from the computation script and the result object comprises:
and transmitting the calculation script and the result object to a rendering engine, and operating the rendering engine to obtain an output service parameter.
6. The method of claim 5, wherein the rendering engine is Rhino and the computing script is a JavaScript computing script.
7. The method of claim 1, wherein the input service parameters and the output service parameters are both JSON objects.
8. An apparatus for processing a service request, comprising:
the receiving module is used for receiving a service request transmitted by a service system and analyzing the service request to obtain an input service parameter; wherein, the input service parameters comprise the identification of the calculation script and the identification of the service data;
the assembly module is used for acquiring the service data from a database according to the identification of the service data and assembling the service data into a result object;
the calling module is used for calling the calculation script according to the identification of the calculation script;
and the calculation module is used for obtaining output service parameters according to the calculation script and the result object and returning the output service parameters to the service system.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
the one or more programs, when executed by the one or more processors, implement the method of any of claims 1-7.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN202010505326.5A 2020-06-05 2020-06-05 Method and device for processing service request Pending CN113760343A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010505326.5A CN113760343A (en) 2020-06-05 2020-06-05 Method and device for processing service request

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010505326.5A CN113760343A (en) 2020-06-05 2020-06-05 Method and device for processing service request

Publications (1)

Publication Number Publication Date
CN113760343A true CN113760343A (en) 2021-12-07

Family

ID=78784974

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010505326.5A Pending CN113760343A (en) 2020-06-05 2020-06-05 Method and device for processing service request

Country Status (1)

Country Link
CN (1) CN113760343A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114371808A (en) * 2022-01-10 2022-04-19 百融至信(北京)征信有限公司 Scheduling system based flow node parameter transmission method and system

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1859629A (en) * 2006-03-17 2006-11-08 华为技术有限公司 Business information processing system and method
CN104182234A (en) * 2014-08-25 2014-12-03 杭州华为数字技术有限公司 Business processing method and business system
CN107092522A (en) * 2017-03-30 2017-08-25 阿里巴巴集团控股有限公司 The computational methods and device of real time data
CN109063180A (en) * 2018-08-23 2018-12-21 郑州云海信息技术有限公司 A kind of data processing method, device, equipment and computer readable storage medium
CN109447443A (en) * 2018-10-18 2019-03-08 阳光人寿保险股份有限公司 Index calculating method and device
CN109902103A (en) * 2019-01-17 2019-06-18 平安城市建设科技(深圳)有限公司 Service data management method, device, equipment and computer readable storage medium
CN111026797A (en) * 2019-12-02 2020-04-17 卫盈联信息技术(深圳)有限公司 Service data processing method, server and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1859629A (en) * 2006-03-17 2006-11-08 华为技术有限公司 Business information processing system and method
CN104182234A (en) * 2014-08-25 2014-12-03 杭州华为数字技术有限公司 Business processing method and business system
CN107092522A (en) * 2017-03-30 2017-08-25 阿里巴巴集团控股有限公司 The computational methods and device of real time data
CN109063180A (en) * 2018-08-23 2018-12-21 郑州云海信息技术有限公司 A kind of data processing method, device, equipment and computer readable storage medium
CN109447443A (en) * 2018-10-18 2019-03-08 阳光人寿保险股份有限公司 Index calculating method and device
CN109902103A (en) * 2019-01-17 2019-06-18 平安城市建设科技(深圳)有限公司 Service data management method, device, equipment and computer readable storage medium
CN111026797A (en) * 2019-12-02 2020-04-17 卫盈联信息技术(深圳)有限公司 Service data processing method, server and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114371808A (en) * 2022-01-10 2022-04-19 百融至信(北京)征信有限公司 Scheduling system based flow node parameter transmission method and system

Similar Documents

Publication Publication Date Title
CN110019080B (en) Data access method and device
CN110471848B (en) Method and device for dynamically returning message
CN113076153B (en) Interface calling method and device
CN110795315A (en) Method and device for monitoring service
CN109753424B (en) AB test method and device
CN114461247A (en) Hot update method, device, electronic equipment and computer readable medium
CN113761565B (en) Data desensitization method and device
CN114327493A (en) Data processing method and device, electronic equipment and computer readable medium
CN113760343A (en) Method and device for processing service request
CN112948138A (en) Method and device for processing message
CN113536748A (en) Method and device for generating chart data
CN112052152A (en) Simulation test method and device
CN114417318A (en) Third-party page jumping method and device and electronic equipment
CN113393288A (en) Order processing information generation method, device, equipment and computer readable medium
CN110019671B (en) Method and system for processing real-time message
CN113760487A (en) Service processing method and device
CN111984616A (en) Method, device and system for updating shared file
CN113779018A (en) Data processing method and device
CN113556370A (en) Service calling method and device
CN113760695A (en) Method and device for positioning problem code
CN112131287A (en) Method and device for reading data
CN115495518B (en) Method and device for generating chart
CN115617851A (en) Method, device, electronic equipment and computer readable medium for processing request
CN113765868B (en) Service processing method and device
CN110866002A (en) Method and device for processing sub-table data

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