CN116932131A - Service processing method and device - Google Patents

Service processing method and device Download PDF

Info

Publication number
CN116932131A
CN116932131A CN202210375516.9A CN202210375516A CN116932131A CN 116932131 A CN116932131 A CN 116932131A CN 202210375516 A CN202210375516 A CN 202210375516A CN 116932131 A CN116932131 A CN 116932131A
Authority
CN
China
Prior art keywords
rule
business
rules
service
executed
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
CN202210375516.9A
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 Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading 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 Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202210375516.9A priority Critical patent/CN116932131A/en
Publication of CN116932131A publication Critical patent/CN116932131A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45529Embedded in an application, e.g. JavaScript in a Web browser
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45508Runtime interpretation or emulation, e g. emulator loops, bytecode interpretation
    • G06F9/45512Command shells

Landscapes

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

Abstract

The application discloses a business processing method and device, and relates to the technical field of computers. One embodiment of the method comprises the following steps: in response to a service processing request, sequentially reading the identifiers of the service rules to be executed by an automatic flow converter according to a preset execution sequence, calling and executing the corresponding service rules according to the read identifiers, and starting to read the identifiers of the target service rules after the last service rule of the target service rules is determined to be successfully executed, wherein the target service rules are any service rule except the first service rule in the preset execution sequence; and completing the business processing after the last business rule in the preset execution sequence is successfully executed. According to the embodiment, for the scene that the number of business rules is large and the complexity of each business rule is high, the business rules can be prevented from being coupled together, the code complexity is reduced, the code readability and maintainability are improved, the newly added business rules do not influence the existing business rules, the expansibility is good, and the asynchronous behavior is supported to be added in the business rules.

Description

Service processing method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a service processing method and apparatus.
Background
The front-end code often needs to process complex business logic, for example, after a series of operations are completed, a user needs to save and submit the content, and before submitting, the content needs to be checked to ensure that the submitted content accords with a certain rule. The existing sequence checking flow for all rules is as follows: and (3) checking rule 1, wherein the specific logic of the rule 1 is as follows: judging whether the rule 1 check is passed or not, if so, ending the rule 1 check and then executing the rule 2 check; otherwise, feeding back error information of the rule 1 check, and executing the rule 2 check after the rule 1 check is finished, wherein the specific logic for executing the rule 2 check is the same as that of the rule 1 check, and the like until the rule N check is completed. Because each business rule is executed sequentially, the former business rule is executed after the execution result of the former business rule is returned, but js (JavaScript, a programming language of Web) is a single-thread execution program, if the former business rule has asynchronous behaviors, the latter business rule cannot wait for the execution result of the former business rule and is executed immediately in a sequential execution mode, the final execution result cannot be judged correctly, and the method for solving the asynchronous behaviors is solved through callbacks, but if a plurality of rules have asynchronous behaviors, the dilemma of multi-layer callbacks can be faced.
In the process of implementing the present application, the inventor finds that at least the following problems exist in the prior art:
for the scene that the number of business rules is larger and the complexity of each business rule is higher, each business rule may be mutually independent, the sequential execution leads to the coupling of the business rules, the complexity of codes is higher, the readability is reduced, the subsequent codes can be maintained worse, if the subsequent newly added business rule needs to be added on the basis of the original codes, the expansibility is worse, and the asynchronous behavior is not supported to be added in the business rule.
Disclosure of Invention
In view of this, the embodiment of the application provides a service processing method and device, which can avoid the coupling of service rules together, reduce the complexity of codes, improve the readability and maintainability of codes, and enable the addition of asynchronous behaviors in service rules, wherein the new service rules do not affect the existing service rules, have good expansibility, and support the addition of the asynchronous behaviors in the service rules for the scene of larger number of service rules and higher complexity of each service rule.
To achieve the above object, according to an aspect of an embodiment of the present application, there is provided a service processing method.
A business processing method, comprising: responding to the service processing request, and acquiring a preset execution sequence of the service rules in the service rule set through an automatic flow converter; and the automatic flow converter reads the identifiers of the business rules to be executed according to the preset execution sequence in sequence so as to call and execute the corresponding business rules according to the read identifiers, wherein: after the last business rule of the target business rule is successfully executed, starting to read the identification of the target business rule, wherein the target business rule is any business rule except the first business rule in the preset execution sequence; and after the last business rule in the preset execution sequence is successfully executed, completing the business processing.
Optionally, the method further comprises: pre-storing an array comprising identifications of all the business rules; the obtaining, by the automatic flow converter, a preset execution sequence of the service rules in the service rule set includes: and acquiring a preset execution sequence of the business rules in the business rule set according to the sequence of the marks in the array through an automatic flow converter.
Optionally, the sequentially reading the identifiers of the business rules to be executed includes: and sequentially extracting the identifiers of the business rules from the array, and deleting the extracted identifiers of the business rules from the array.
Optionally, the identification of the business rule is a rule name of the business rule; the calling and executing the corresponding business rule according to the read identification comprises the following steps: calling a corresponding rule function according to the read rule name, wherein the rule function is immediately executed under the condition that an asynchronous method is not included in the rule function so as to obtain a function execution result; under the condition that the rule function comprises an asynchronous method, waiting for the execution of the asynchronous method to be completed to obtain a function execution result; and the function execution result indicates that the business rule corresponding to the rule name is successfully executed or fails to be executed.
According to another aspect of the embodiment of the present application, a service processing apparatus is provided.
A traffic processing apparatus comprising: the rule sequence acquisition module is used for responding to the service processing request and acquiring a preset execution sequence of the service rules in the service rule set through the automatic flow converter; the rule execution module is used for sequentially reading the identifiers of the business rules to be executed by the automatic flow converter according to the preset execution sequence so as to call and execute the corresponding business rules according to the read identifiers, wherein the corresponding business rules are read by the automatic flow converter; after the last business rule of the target business rule is successfully executed, starting to read the identification of the target business rule, wherein the target business rule is any business rule except the first business rule in the preset execution sequence; and after the last business rule in the preset execution sequence is successfully executed, completing the business processing.
Optionally, the device further comprises an array generating module for: pre-storing an array comprising identifications of all the business rules; the rule sequence acquisition module is further configured to: and acquiring a preset execution sequence of the business rules in the business rule set according to the sequence of the marks in the array through the automatic flow converter.
Optionally, the rule execution module is further configured to: and sequentially extracting the identifiers of the business rules from the array, and deleting the extracted identifiers of the business rules from the array.
Optionally, the identification of the business rule is a rule name of the business rule; the rule execution module is further configured to: calling a corresponding rule function according to the read rule name, wherein the rule function is immediately executed under the condition that an asynchronous method is not included in the rule function so as to obtain a function execution result; under the condition that the rule function comprises an asynchronous method, waiting for the execution of the asynchronous method to be completed to obtain a function execution result; and the function execution result indicates that the business rule corresponding to the rule name is successfully executed or fails to be executed.
According to yet another aspect of an embodiment of the present application, an electronic device is provided.
An electronic device, comprising: one or more processors; and the memory is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are enabled to realize the service processing method provided by the embodiment of the application.
According to yet another aspect of an embodiment of the present application, a computer-readable medium is provided.
A computer readable medium having stored thereon a computer program which, when executed by a processor, implements a service processing method provided by an embodiment of the present application.
One embodiment of the above application has the following advantages or benefits: and responding to the service processing request, sequentially reading the identifiers of the service rules to be executed according to the preset execution sequence of the service rules in the service rule set through the automatic flow device, and calling and executing the corresponding service rules according to the read identifiers, wherein after the last service rule of the target service rule is determined to be successfully executed, the identifiers of the target service rules are read, the target service rule is any service rule except the first service rule in the preset execution sequence, and when the last service rule in the preset execution sequence is successfully executed, the service processing is completed. For the scene that the number of business rules is larger and the complexity of each business rule is higher, the automatic flow converter sequentially reads the identifiers of the business rules to be executed so as to call and execute the corresponding business rules according to the read identifiers, thereby avoiding the business rules from being coupled together, reducing the complexity of codes, improving the readability and maintainability of codes, ensuring that the newly added business rules do not influence the existing business rules, having good expansibility, and continuously reading the identifiers of the follow-up business rules after the automatic flow converter determines that the last business rule is successfully executed, and further supporting the addition of asynchronous behaviors in the business rules.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the application and are not to be construed as unduly limiting the application. Wherein:
FIG. 1 is a schematic diagram of the main steps of a business processing method according to one embodiment of the present application;
FIG. 2 is a schematic diagram of a verification process according to one embodiment of the application;
fig. 3 is a schematic diagram of main modules of a service processing apparatus according to an embodiment of the present application;
FIG. 4 is an exemplary system architecture diagram in which embodiments of the present application may be applied;
FIG. 5 is a schematic diagram of a computer system suitable for use with a server implementing an embodiment of the application.
Detailed Description
Exemplary embodiments of the present application will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present application are included to facilitate understanding, and are to be considered 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 application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of main steps of a service processing method according to an embodiment of the present application. As shown in fig. 1, the service processing method according to an embodiment of the present application mainly includes the following steps S101 to S102.
Step S101: and responding to the service processing request, and acquiring a preset execution sequence of the service rules in the service rule set through the automatic flow converter.
A business rule set is a set of all business rules required to perform business processes of embodiments of the present application.
Step S102: and the automatic flow device sequentially reads the identifiers of the service rules to be executed according to a preset execution sequence, and calls and executes the corresponding service rules according to the read identifiers, wherein after the last service rule of the target service rule is determined to be successfully executed, the identifiers of the target service rule are started to be read, the target service rule is any service rule except the first service rule in the preset execution sequence, and when the last service rule in the preset execution sequence is successfully executed, the service processing is completed.
In one embodiment, an array including the identities of all business rules in the set of business rules may be pre-saved.
The method for acquiring the preset execution sequence of the business rules in the business rule set through the automatic flow converter specifically comprises the following steps: and acquiring a preset execution sequence of the business rules in the business rule set according to the sequence of the marks in the array through the automatic flow converter. That is, the business rules are executed in the order of the identifications in the array.
The method for sequentially reading the identifiers of the business rules to be executed specifically comprises the following steps: and sequentially extracting the identifiers of the service rules from the array, and deleting the identifiers of the extracted service rules from the array. When the array is empty, it indicates that all business rules in the business rule set have been executed.
The identification of the business rule may specifically be a rule name of the business rule. Accordingly, an array that includes the identity of all business rules in a business rule set may be referred to as a rule name array.
Calling and executing corresponding business rules according to the read identification, and specifically comprising the following steps: and calling a corresponding rule function according to the read rule name, wherein the rule function is a function in the business rule. Under the condition that the rule function does not comprise an asynchronous method, immediately executing the rule function to obtain a function execution result; under the condition that the rule function comprises an asynchronous method, waiting for the execution of the asynchronous method to be completed to obtain a function execution result; the function execution result indicates that the business rule corresponding to the rule name is successfully executed or is failed to be executed. That is, the business rules in the embodiment of the application can be synchronously executed or can be asynchronously executed, and the next business rule is executed after the execution of the current business rule is completed and the execution result is successful.
Any business rule of the embodiment of the application is executed and the result is failure, the flow of the business processing method is ended.
The business processing method of the embodiment of the application is realized based on js (JavaScript, a programming language of Web) flow program.
The business processing method of the embodiment of the application is suitable for various flow programs which need to execute business rules sequentially, but the logic can be split into independent modules, is a general optimization scheme of the complex js flow program, improves the original code organization mode of writing the large complex js flow program in various business processing scenes, improves the code readability, greatly improves the function expandability, solves the problem of asynchronous callback, and overcomes the defect that the asynchronous method is not friendly to be added in the sequential execution flow.
The business processing method of the embodiment of the application is specifically described below by taking a large-scale and high-complexity verification process as an example. For example, in a page with complex interaction, after a series of operations are completed, a user needs to save and submit contents, and before submitting, the contents need to be checked to ensure that the submitted contents conform to a certain rule, specifically, for example, when the user inputs a category, a commodity amount range and a time for placing an order on a page, before submitting the input contents to perform the next operation, the user needs to check the input contents, for example, check whether the category is empty and whether a category of a designated level is checked under the condition of non-empty, check whether the commodity amount lower limit is empty, check whether the time for placing an order is empty, and so on, and the specific check content and the check rule depend on the service requirement.
Taking the flow of the service processing method in the embodiment of the application as an example, the verification flow is taken as the service processing request, the service processing request is specifically a verification request, and the object to be verified, such as the content to be submitted in the page, is determined according to the specific verification scene. The business rule set is specifically a check rule set. The business rules are specifically check rules. The array including the identity of all business rules is the rule name array. The verification rules of the embodiment of the application are mutually independent and do not affect each other, and codes of each verification rule can be independently written according to module distinction, so that the readability of the codes is improved, and a developer who is newly intervened in the follow-up process can quickly understand each verification logic.
The preset execution sequence of the verification rules in the verification rule set can be obtained through a unified automatic flow converter in response to the verification request. And the automatic flow converter sequentially reads the identifiers of the check rules to be executed according to the preset execution sequence, so as to call and execute the corresponding check rules according to the read identifiers. Under the condition that the currently-executed check rule is any check rule after the first check rule in the preset execution sequence, the automatic flow converter starts to read the identification of the currently-executed check rule after determining that the last check rule of the currently-executed check rule is successfully executed. And after the last verification rule in the preset execution sequence is successfully executed, completing the verification process.
The verification flow of the embodiment of the application realizes a unified automatic flow converter, defines rule functions in each independent module, is used for the automatic flow converter to call, the automatic flow converter is responsible for reading rule name arrays, sequentially calls rule functions corresponding to rule names of each verification rule, ensures that all verification rules can be automatically and sequentially executed, and finally returns an execution result, so that if a new verification rule is added later, only the new verification rule module is required to be independently developed, the influence on the existing verification rule is avoided, and the method has good expansibility.
The verification rules in the embodiment of the application are mutually independent, the result of each rule after execution can inform the automatic flow converter in a message-like manner, the automatic flow converter waits for the execution of the verification rule in the execution process of the verification rule, and whether the next rule is executed or not can not be judged until the execution result of the current verification rule is obtained, so that the addition of an asynchronous method in each verification rule is supported, and the final execution result of the verification rule is fed back to the automatic flow converter after the execution result of the asynchronous method is returned.
As shown in fig. 2, a verification process according to an embodiment of the present application is shown. The rule name array of all the check rules to be executed is pre-stored, and is mainly used for the automatic flow converter to call the corresponding rule functions in sequence according to the element sequence in the array, for example: rule name 1, rule name 2,..rule name N ]. Each verification rule corresponds to rule 1, rule 2, … …, rule N, respectively. N is the number of rules and also the number of rule names.
After verification starts, the automatic flow converter acquires the first element in the rule name array, namely rule name 1, deletes the first element (rule name 1) in the rule name array, and the rule name array becomes: rule name 2,..rule name N ].
And calling the rule function corresponding to the check rule name according to the acquired check rule name, namely acquiring the rule function corresponding to the rule name 1.
Rule 1 performs the process: executing the rule function corresponding to the rule name 1, and returning the last execution result of the check rule, wherein the rule 1 is completely executed. And if the rule function has the asynchronous method, executing the asynchronous method, waiting for the asynchronous method to be executed, and returning the final execution result of the check rule.
And returning the execution result of the rule 1, namely the execution result of the check rule corresponding to the rule name 1, and if the execution result is judged to be failed in check, the whole check flow is failed, and the check flow is terminated. If the execution result is judged to be successful in verification, the verification rule corresponding to the rule name 1 informs the automatic flow controller to execute the next step, namely, the rule 2 execution process is continued.
The rule 2 executing process is the same as the rule 1 executing process, except that the rule function corresponding to the rule name 2 is called in the rule 2 executing process, which is not described in detail. For convenience of description, in fig. 2, the next rule of rule 2 is illustrated as rule N, that is, after the execution result of rule 2 is determined to be successful in verification, the verification rule corresponding to rule name 2 notifies the automatic flow converter to execute the next step, that is, the execution process of rule N is continued. The rule N execution is the same as the rule 1 execution and will not be described in detail.
And after finishing the execution process of one check rule, the automatic flow converter reads the rule name array, takes out the rule name of the next check rule to be executed, and deletes the taken out rule name from the rule name array. If the array is empty, that is, the check rule corresponding to all rule names is executed, the whole check flow is exited. If the execution result of the last verification rule is judged to be successful, the result of the whole verification process is judged to be successful. And after the execution result of any one of the verification rules is judged to be verification failure, the verification process is terminated, and the whole verification process result is failure.
The embodiment of the application effectively solves the problems of low maintainability of codes, poor expansibility and unfriendly check rules with asynchronous behaviors in a high-complexity check flow. The method is suitable for content verification or verification processes of other scenes, and can also be suitable for business processing of other large complex programs which need to be executed sequentially and each rule is independent.
Fig. 3 is a schematic diagram of main modules of a service processing apparatus according to an embodiment of the present application.
As shown in fig. 3, a service processing apparatus 300 according to an embodiment of the present application mainly includes: a rule sequence acquisition module 301 and a rule execution module 302.
A rule sequence obtaining module 301, configured to obtain, by using an automatic circulator, a preset execution sequence of a service rule in a service rule set in response to a service processing request;
the rule execution module 302 is configured to sequentially read, by the automatic flow converter according to a preset execution sequence, an identifier of a service rule to be executed, so as to invoke and execute a corresponding service rule according to the read identifier, where after it is determined that execution of a previous service rule of the target service rule is successful, reading the identifier of the target service rule, where the target service rule is any service rule in the preset execution sequence except for the first service rule, and after execution of a last service rule in the preset execution sequence is successful, completing service processing.
The service processing apparatus 300 may further include an array generation module for: pre-storing an array comprising identifications of all business rules; the rule sequence acquisition module is further configured to: and acquiring a preset execution sequence of the business rules in the business rule set according to the sequence of the marks in the array through the automatic flow converter.
The rule execution module 302 is specifically further configured to: and sequentially extracting the identifiers of the service rules from the array, and deleting the identifiers of the extracted service rules from the array.
The identification of the business rule may specifically be a rule name of the business rule.
The rule execution module 302 is specifically further configured to: calling a corresponding rule function according to the read rule name, wherein the rule function is immediately executed under the condition that the rule function does not comprise an asynchronous method so as to obtain a function execution result; under the condition that the rule function comprises an asynchronous method, waiting for the execution of the asynchronous method to be completed to obtain a function execution result; the function execution result indicates that the business rule corresponding to the rule name is successfully executed or is failed to be executed.
In addition, the specific implementation of the service processing device in the embodiment of the present application has been described in detail in the service processing method described above, so that the description is not repeated here.
Fig. 4 illustrates an exemplary system architecture 400 to which a business processing method or business processing apparatus of embodiments of the present application may be applied.
As shown in fig. 4, the system architecture 400 may include terminal devices 401, 402, 403, a network 404, and a server 405. The network 404 is used as a medium to provide communication links between the terminal devices 401, 402, 403 and the server 405. The network 404 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 405 via the network 404 using the terminal devices 401, 402, 403 to receive or send messages or the like. Various communication client applications, such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only) may be installed on the terminal devices 401, 402, 403.
The terminal devices 401, 402, 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 405 may be a server providing various services, such as a background management server (by way of example only) providing support for shopping-type websites browsed by users using the terminal devices 401, 402, 403. The background management server may analyze and process the received data such as the product information query request, and feedback the processing result (e.g., the target push information, the product information—only an example) to the terminal device.
It should be noted that, the service processing method provided in the embodiment of the present application is generally executed by the server 405, and accordingly, the service processing apparatus is generally disposed in the server 405.
It should be understood that the number of terminal devices, networks and servers in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 5, there is illustrated a schematic diagram of a computer system 500 suitable for use in implementing a server of an embodiment of the present application. The server illustrated in fig. 5 is merely an example, and should not be construed as limiting the functionality and scope of use of embodiments of the present application.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other through a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input section 506 including a keyboard, a mouse, and the like; an output portion 507 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker, and the like; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The drive 510 is also connected to the I/O interface 505 as needed. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as needed so that a computer program read therefrom is mounted into the storage section 508 as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 509, and/or installed from the removable media 511. The above-described functions defined in the system of the present application are performed when the computer program is executed by a Central Processing Unit (CPU) 501.
The computer readable medium shown in the present application may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any 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 context of this document, 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 application, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. 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 flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. 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 involved in the embodiments of the present application may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, as: a processor comprises a rule sequence acquisition module and a rule execution module. The names of these modules do not constitute a limitation on the module itself in some cases, and for example, the rule sequence acquisition module may also be described as "a module for acquiring a preset execution sequence of a business rule in a business rule set by an automatic flow transformer" in response to a business process request.
As another aspect, the present application also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include: responding to the service processing request, and acquiring a preset execution sequence of the service rules in the service rule set through an automatic flow converter; the automatic flow device sequentially reads the identifiers of the service rules to be executed according to the preset execution sequence, and calls and executes the corresponding service rules according to the read identifiers, wherein after the last service rule of the target service rule is determined to be successfully executed, the identifier of the target service rule is started to be read, and the target service rule is any service rule except the first service rule in the preset execution sequence; and after the last business rule in the preset execution sequence is successfully executed, completing the business processing.
According to the technical scheme of the embodiment of the application, in response to a service processing request, the identification of the service rule to be executed is sequentially read through an automatic flow converter according to the preset execution sequence of the service rule set so as to call and execute the corresponding service rule according to the read identification, wherein after the last service rule of the target service rule is determined to be successfully executed, the identification of the target service rule is started to be read, the target service rule is any service rule except the first service rule in the preset execution sequence, and when the last service rule in the preset execution sequence is successfully executed, the service processing is completed. For the scenes of larger service rule number and higher complexity of each service rule, the service rules can be prevented from being coupled together, the code complexity is reduced, the code readability and maintainability are improved, the newly added service rules do not influence the existing service rules, the expansibility is good, and the asynchronous behavior is supported to be added in the service rules.
The above embodiments do not limit the scope of the present application. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application should be included in the scope of the present application.

Claims (10)

1. A method for processing a service, comprising:
responding to the service processing request, and acquiring a preset execution sequence of the service rules in the service rule set through an automatic flow converter;
and the automatic flow converter reads the identifiers of the business rules to be executed according to the preset execution sequence in sequence so as to call and execute the corresponding business rules according to the read identifiers, wherein: after the last business rule of the target business rule is successfully executed, starting to read the identification of the target business rule, wherein the target business rule is any business rule except the first business rule in the preset execution sequence; and after the last business rule in the preset execution sequence is successfully executed, completing the business processing.
2. The method as recited in claim 1, further comprising: pre-storing an array comprising identifications of all the business rules;
the obtaining, by the automatic flow converter, a preset execution sequence of the service rules in the service rule set includes: and acquiring a preset execution sequence of the business rules in the business rule set according to the sequence of the marks in the array through the automatic flow converter.
3. The method according to claim 2, wherein the sequentially reading the identities of the business rules to be executed comprises:
and sequentially extracting the identifiers of the business rules from the array, and deleting the extracted identifiers of the business rules from the array.
4. The method of claim 1, wherein the identity of the business rule is a rule name of the business rule;
the calling and executing the corresponding business rule according to the read identification comprises the following steps:
calling a corresponding rule function according to the read rule name, wherein the rule function is immediately executed under the condition that an asynchronous method is not included in the rule function so as to obtain a function execution result; under the condition that the rule function comprises an asynchronous method, waiting for the execution of the asynchronous method to be completed to obtain a function execution result; and the function execution result indicates that the business rule corresponding to the rule name is successfully executed or fails to be executed.
5. A service processing apparatus, comprising:
the rule sequence acquisition module is used for responding to the service processing request and acquiring a preset execution sequence of the service rules in the service rule set through the automatic flow converter;
the rule execution module is used for reading the identifiers of the business rules to be executed according to the preset execution sequence by the automatic flow converter in sequence so as to call and execute the corresponding business rules according to the read identifiers, wherein: after the last business rule of the target business rule is successfully executed, starting to read the identification of the target business rule, wherein the target business rule is any business rule except the first business rule in the preset execution sequence; and after the last business rule in the preset execution sequence is successfully executed, completing the business processing.
6. The apparatus of claim 5, further comprising an array generation module configured to: pre-storing an array comprising identifications of all the business rules;
the rule sequence acquisition module is further configured to: and acquiring a preset execution sequence of the business rules in the business rule set according to the sequence of the marks in the array through the automatic flow converter.
7. The apparatus of claim 6, wherein the rule execution module is further to:
and sequentially extracting the identifiers of the business rules from the array, and deleting the extracted identifiers of the business rules from the array.
8. The apparatus of claim 5, wherein the identity of the business rule is a rule name of the business rule;
the rule execution module is further configured to:
calling a corresponding rule function according to the read rule name, wherein the rule function is immediately executed under the condition that an asynchronous method is not included in the rule function so as to obtain a function execution result; under the condition that the rule function comprises an asynchronous method, waiting for the execution of the asynchronous method to be completed to obtain a function execution result; and the function execution result indicates that the business rule corresponding to the rule name is successfully executed or fails to be executed.
9. An electronic device, comprising:
one or more processors;
a memory for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-4.
10. A computer readable medium, on which a computer program is stored, which computer program, when being executed by a processor, implements the method according to any of claims 1-4.
CN202210375516.9A 2022-04-11 2022-04-11 Service processing method and device Pending CN116932131A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210375516.9A CN116932131A (en) 2022-04-11 2022-04-11 Service processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210375516.9A CN116932131A (en) 2022-04-11 2022-04-11 Service processing method and device

Publications (1)

Publication Number Publication Date
CN116932131A true CN116932131A (en) 2023-10-24

Family

ID=88383274

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210375516.9A Pending CN116932131A (en) 2022-04-11 2022-04-11 Service processing method and device

Country Status (1)

Country Link
CN (1) CN116932131A (en)

Similar Documents

Publication Publication Date Title
CN107302597B (en) Message file pushing method and device
CN109002389B (en) Method and device for automatically testing page
CN113076153B (en) Interface calling method and device
CN111294395A (en) Terminal page transmission method, device, medium and electronic equipment
CN110609755A (en) Message processing method, device, equipment and medium for cross-block chain node
CN110019158A (en) A kind of method and apparatus of monitoring data quality
CN112214250A (en) Application program assembly loading method and device
CN113778581A (en) Page loading method, electronic equipment and storage medium
CN110647327B (en) Method and device for dynamic control of user interface based on card
CN110825622A (en) Software testing method, device, equipment and computer readable medium
CN116775613A (en) Data migration method, device, electronic equipment and computer readable medium
CN116737662A (en) Method, device, electronic equipment and storage medium for processing business data
CN112052152A (en) Simulation test method and device
CN109213815B (en) Method, device, server terminal and readable medium for controlling execution times
JP7481067B2 (en) Order data processing method and processing device, and computer readable medium
US20230093004A1 (en) System and method for asynchronous backend processing of expensive command line interface commands
CN113760274B (en) Front-end assembly logic injection method and device
CN116932131A (en) Service processing method and device
CN113760487B (en) Service processing method and device
CN110806967A (en) Unit testing method and device
CN113297087A (en) Test method and device
CN110909269B (en) Log reporting method and device
CN111415262A (en) Service processing method and device
CN113448652A (en) Request processing method and device
CN112395194A (en) Method and device for accessing test platform

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication