CN113516541A - Dynamic configuration method and device for store distribution scene and electronic device - Google Patents

Dynamic configuration method and device for store distribution scene and electronic device Download PDF

Info

Publication number
CN113516541A
CN113516541A CN202111074545.3A CN202111074545A CN113516541A CN 113516541 A CN113516541 A CN 113516541A CN 202111074545 A CN202111074545 A CN 202111074545A CN 113516541 A CN113516541 A CN 113516541A
Authority
CN
China
Prior art keywords
allocation
distribution
scene
rule template
target
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.)
Granted
Application number
CN202111074545.3A
Other languages
Chinese (zh)
Other versions
CN113516541B (en
Inventor
张志强
王伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Xiaodian Technology Co Ltd
Original Assignee
Hangzhou Xiaodian 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 Hangzhou Xiaodian Technology Co Ltd filed Critical Hangzhou Xiaodian Technology Co Ltd
Priority to CN202111074545.3A priority Critical patent/CN113516541B/en
Publication of CN113516541A publication Critical patent/CN113516541A/en
Application granted granted Critical
Publication of CN113516541B publication Critical patent/CN113516541B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/06Buying, selling or leasing transactions
    • G06Q30/0645Rental transactions; Leasing transactions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Systems or methods specially adapted for specific business sectors, e.g. utilities or tourism
    • G06Q50/06Electricity, gas or water supply
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/50Network service management, e.g. ensuring proper service fulfilment according to agreements
    • H04L41/5041Network service management, e.g. ensuring proper service fulfilment according to agreements characterised by the time relationship between creation and deployment of a service
    • H04L41/5048Automatic or semi-automatic definitions, e.g. definition templates
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/50Network service management, e.g. ensuring proper service fulfilment according to agreements
    • H04L41/5041Network service management, e.g. ensuring proper service fulfilment according to agreements characterised by the time relationship between creation and deployment of a service
    • H04L41/5054Automatic deployment of services triggered by the service manager, e.g. service implementation by automatic configuration of network components

Landscapes

  • Business, Economics & Management (AREA)
  • Engineering & Computer Science (AREA)
  • Economics (AREA)
  • Accounting & Taxation (AREA)
  • Marketing (AREA)
  • Physics & Mathematics (AREA)
  • Finance (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Signal Processing (AREA)
  • General Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Human Resources & Organizations (AREA)
  • Tourism & Hospitality (AREA)
  • Primary Health Care (AREA)
  • General Health & Medical Sciences (AREA)
  • Water Supply & Treatment (AREA)
  • Public Health (AREA)
  • Development Economics (AREA)
  • Information Transfer Between Computers (AREA)
  • Stored Programmes (AREA)

Abstract

The application relates to a dynamic configuration method, a dynamic configuration device and an electronic device for an store distribution scene, wherein a preset distribution rule is encapsulated according to a strategy mode to obtain a distribution rule template; when the application is started, acquiring an identification key value pair of an allocation scene and an allocation rule template, serving as a mapping relation, and registering the mapping relation to a nacos server; after receiving an allocation request of a user for a target allocation scene, obtaining an example of an allocation rule template corresponding to the target allocation scene according to the allocation request and a mapping relation corresponding to the target allocation scene, which is obtained from a nacos server, and after the example of the allocation rule template passes allocation verification of each verification node, allocating the target allocation scene according to the example of the execution rule template; generating an allocation completion notification after completing allocation of the target allocation scenario; the dynamic configuration of the allocation rules is realized, the coupling degree of the execution codes of the store allocation business at the back end is reduced, and the expansibility of the store allocation business is improved.

Description

Dynamic configuration method and device for store distribution scene and electronic device
Technical Field
The present application relates to the field of shared charging technologies, and in particular, to a dynamic configuration method and apparatus for store allocation scenario, and an electronic apparatus.
Background
The store distribution business in the field of shared charging comprises a plurality of different distribution scenes, and each distribution scene corresponds to a plurality of different distribution rules. By utilizing the back-end technology, the execution logic of the distribution rules in the store distribution business can be converted into codes executed by the back end, so that manual verification is replaced, and automatic verification of the distribution scene is realized. At present, for code conversion of execution logic at a back end, an execution logic of an allocation scenario and an allocation rule is often written into a fixed code in a back end server in a hard coding mode, and when a certain allocation rule changes, a part corresponding to the allocation rule needs to be re-encoded at the back end, which is not beneficial to subsequent maintenance and expansion of shop allocation services.
Aiming at the problem of low expansibility of store distribution service caused by hard coding in the related art, no effective solution is provided at present.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a dynamic configuration method and apparatus for store allocation scenario, and an electronic apparatus.
In a first aspect, an embodiment of the present application provides a dynamic configuration method for an allocation scenario of an store, configured to configure a corresponding allocation rule for the allocation scenario of the store, where the method includes:
according to a strategy mode, packaging the preset distribution rule of the distribution scene to obtain a distribution rule template;
when the application is started, acquiring a pre-configured identification key value pair consisting of a first identifier of the distribution scene and a second identifier of the distribution rule template, serving as a mapping relation, and registering the mapping relation to a nacos server, wherein the distribution rule template comprises a check rule template and an execution rule template;
after receiving an allocation request of a user for a target allocation scene, acquiring a mapping relation corresponding to the target allocation scene from the nacos server according to the allocation request, acquiring an example of an allocation rule template corresponding to the target allocation scene according to the mapping relation, and after passing allocation verification of each verification node according to the example of the verification rule template, performing allocation of the target allocation scene according to the example of the execution rule template;
and generating an allocation completion notification after completing the allocation of the target allocation scenario.
In one embodiment, when at least two allocation rules are preset in the allocation scenario, in the pair of identification key values, the first identifier corresponds to at least two of the second identifiers.
In one embodiment, the pair of identification key values further includes a rank order of the second identifier, and the rank order corresponds to an execution order of the allocation rule.
In one embodiment, after receiving an allocation request of a user for a target allocation scenario, according to the allocation request, obtaining a mapping relationship corresponding to the target allocation scenario from the nacos server, includes the following steps:
analyzing the distribution request to obtain request parameters;
and acquiring the mapping relation corresponding to the target distribution scene from the nacos server according to the request parameter.
In one embodiment, the obtaining, according to the mapping relationship, an example of the distribution rule template corresponding to the target distribution scenario includes:
acquiring a groovy script of the distribution rule according to the mapping relation;
and acquiring an example of the distribution rule template according to the groovy script.
In one embodiment, the method further comprises:
before receiving an allocation request of the user for a target allocation scene, if an authority check exception is captured when role authority check is performed on the user, packaging the authority check exception into prompt information and sending the prompt information to the user;
after receiving an allocation request of a user for a target allocation scene, if capturing an instance acquisition exception of the allocation rule template, performing degradation processing on the configuration of the mapping relation between the target allocation scene and the allocation rule template;
when distribution verification is carried out on the basis of the example of the verification rule template and distribution verification abnormity is captured, the distribution verification abnormity is packaged as an object, and then the next verification node of the verification node generating the distribution verification abnormity is transmitted to enable the next verification node to execute a corresponding preset processing mechanism aiming at the specific category of the distribution verification abnormity;
and when the allocation execution abnormity is captured, generating an abnormity prompt message for a user according to the allocation execution abnormity, and rolling back the data of the allocation process.
In one embodiment, the allocation scenarios include grid allocation, background administrator allocation, agent allocation, cross-organizational allocation, and deferred allocation.
In a second aspect, an embodiment of the present application further provides an apparatus for dynamically configuring an store allocation scenario, where the apparatus is configured to configure a corresponding allocation rule for the store allocation scenario, and the apparatus includes an encapsulation module, a configuration module, an acquisition module, and a notification module:
the encapsulation module is used for encapsulating the preset distribution rule of the distribution scene according to a strategy mode to obtain a distribution rule template;
the configuration module is used for acquiring a pre-configured identification key value pair consisting of a first identifier of the distribution scene and a second identifier of the distribution rule template when the application is started, taking the pre-configured identification key value pair as a mapping relation, and registering the mapping relation to the nacos server, wherein the distribution rule template comprises a check rule template and an execution rule template;
the acquisition module is used for acquiring a mapping relation corresponding to a target distribution scene from the nacos server according to the distribution request after receiving a distribution request of a user for the target distribution scene, acquiring an example of a distribution rule template corresponding to the target distribution scene according to the mapping relation, and distributing the target distribution scene according to the example of the execution rule template after the example of the verification rule template passes distribution verification of each verification node;
and the notification module is used for generating a distribution completion notification after the distribution of the target distribution scene is completed.
In a third aspect, an embodiment of the present application provides an electronic apparatus, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor, when executing the computer program, implements the dynamic configuration method for store allocation scenarios as described in the first aspect.
In a fourth aspect, the present application provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the dynamic configuration method of the store allocation scenario when executing the computer program.
In a fifth aspect, the present application provides a storage medium, on which a computer program is stored, where the computer program is executed by a processor to implement the above-mentioned dynamic configuration method for store allocation scenarios.
According to the dynamic configuration method, the dynamic configuration device and the electronic device for the store distribution scene, the distribution rule template is obtained after the preset distribution rule of the distribution scene is encapsulated according to the strategy mode; when the application is started, acquiring a pre-configured identification key value pair consisting of a first identifier of an allocation scene and a second identifier of an allocation rule template, serving as a mapping relation, and registering the mapping relation to a nacos server, wherein the allocation rule template comprises a check rule template and an execution rule template; after receiving an allocation request of a user for a target allocation scene, acquiring a mapping relation corresponding to the target allocation scene from a nacos server according to the allocation request, obtaining an example of an allocation rule template corresponding to the target allocation scene according to the mapping relation, and after passing allocation verification of each verification node according to the example of the verification rule template, performing allocation of the target allocation scene according to the example of the execution rule template; generating an allocation completion notification after completing allocation of the target allocation scenario; the dynamic configuration of the allocation rules is realized, the coupling degree of the execution codes of the store allocation business at the back end is reduced, and the expansibility of the store allocation business is improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is an application scenario diagram of a dynamic configuration method of a store allocation scenario according to an embodiment of the present application;
FIG. 2 is a flow diagram of a method for dynamic configuration of store allocation scenarios according to an embodiment of the present application;
FIG. 3 is a flow diagram of a method of dynamically performing an allocation of store allocation scenarios in accordance with an embodiment of the present application;
FIG. 4 is a flow diagram of a dynamic execution allocation of yet another store allocation scenario in accordance with an embodiment of the present application;
FIG. 5 is a timing diagram of a method of dynamically performing allocation for yet another store allocation scenario in accordance with an embodiment of the present application;
FIG. 6a is a flowchart of a dynamic configuration method in a grid allocation scenario according to an embodiment of the present application;
FIG. 6b is a flowchart of related control in a grid allocation scenario according to an embodiment of the present application;
FIG. 7 is a schematic diagram of a dynamic configuration apparatus for store allocation scenarios according to an embodiment of the present application;
FIG. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments provided in the present application without any inventive step are within the scope of protection of the present application.
It is obvious that the drawings in the following description are only examples or embodiments of the present application, and that it is also possible for a person skilled in the art to apply the present application to other similar contexts on the basis of these drawings without inventive effort. Moreover, it should be appreciated that in the development of any such actual implementation, as in any engineering or design project, numerous implementation-specific decisions must be made to achieve the developers' specific goals, such as compliance with system-related and business-related constraints, which may vary from one implementation to another.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the specification. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of ordinary skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments without conflict.
Unless defined otherwise, technical or scientific terms referred to herein shall have the ordinary meaning as understood by those of ordinary skill in the art to which this application belongs. Reference to "a," "an," "the," and similar words throughout this application are not to be construed as limiting in number, and may refer to the singular or the plural. The present application is directed to the use of the terms "including," "comprising," "having," and any variations thereof, which are intended to cover non-exclusive inclusions; for example, a process, method, system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to the listed steps or elements, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. Reference to "connected," "coupled," and the like in this application is not intended to be limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The term "plurality" as referred to herein means two or more. "and/or" describes an association relationship of associated objects, meaning that three relationships may exist, for example, "A and/or B" may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. Reference herein to the terms "first," "second," "third," and the like, are merely to distinguish similar objects and do not denote a particular ordering for the objects.
Fig. 1 is an application scenario diagram of a dynamic configuration method for an store allocation scenario according to an embodiment of the present application, and the method embodiment provided in this embodiment may be applied to the application scenario shown in fig. 1. In the application scenario shown in fig. 1, the application server 102, the configuration server 104, and the terminal 106 are included, where the application server 102, the configuration server 104, and the terminal 106 are connected through a network. When the application server 102 is started, the mapping relationship between the pre-configured distribution scenario and the distribution rule template is registered in the configuration server 104. In addition, after the terminal 106 sends an allocation request for a target allocation scenario to the application server 102, the application server 102 accesses the configuration server 104 to obtain a mapping relationship corresponding to the target allocation scenario according to the allocation request, executes an allocation rule corresponding to the target allocation scenario according to the mapping relationship, and returns a verification result to the terminal 106.
In an embodiment, fig. 2 is a flowchart of a dynamic configuration method for store allocation scenarios according to an embodiment of the present application, which is described by taking the application server 102 in fig. 1 as an example, and includes the following steps:
step S210, according to the strategy mode, packaging the preset distribution rule of the distribution scene to obtain a distribution rule template.
Specifically, the allocation scenario is a scenario in which an allocation operation is performed on a service object such as a resource, a right, and service data in an actual service. For example, channel agent store assignments, channel operator store assignments, employee exit store automatic assignments, and offline equipment store delayed assignments. Different allocation scenarios correspond to different allocation rules. The distribution rule template is an abstraction of a plurality of check rules before distribution is executed and a plurality of execution rules when distribution is executed in the distribution scene, and the content in the distribution rule template is execution logic of the distribution rules. For example, before a current owner of a store is allocated in a store allocation service, a plurality of complex personnel role checks and state information checks need to be performed, and in order to implement dynamic configuration of the personnel role check rule and the state information check rule and the current owner allocation scenario, a plurality of check rules for the allocation scenario of the current owner may be abstracted as an allocation rule template in an application server.
Further, the distribution rule template may be implemented by using a computer language, for example, Java language may be used to package the distribution rule in the actual service into a distribution rule class that can be executed in the background, where the distribution rule class is the distribution rule template, and in the distribution rule class, the distribution rule contains a distribution rule written as a method code or a function code, and the distribution rule is executed by calling a corresponding method or function.
In addition, the distribution rule template can be implemented based on a policy mode, and different distribution rules are packaged into different distribution rule policy classes, which are the distribution rule templates. Each strategy class only corresponds to one distribution rule, and the execution logics of the distribution rules in different strategy classes are different, so that the corresponding distribution rule strategy class can be dynamically executed according to the configuration of the terminal at the service side on the mapping relation, and the flexibility of the distribution scene and the distribution rule configuration is realized.
The strategy mode is an idea that an algorithm can be packaged in a programming language, belongs to a design mode in the programming language, and is used for enabling an object to dynamically execute different behaviors in different scenes. The strategy mode is used for organizing the dependence and calling relation among different code modules so as to realize corresponding business rules, wherein the code modules organized by the strategy mode are designed in advance by developers according to actual application scenes and business requirements. The policy schema encapsulates the set of algorithms as classes in the programming language as policy classes. The policy class may be implemented by code that includes the above-described pre-designed algorithm. In addition, different execution logic is contained in different policy classes, so that after encapsulation is completed, different logic can be dynamically executed based on different policy classes through codes. Further, the policy schema applied to the distribution scenario of the store may specifically be an idea of an abstract process of executing logic and business rules of the distribution process. The distribution rules preset by the target distribution scene are divided into different categories under the same distribution scene due to the difference of execution logic, action objects and processing results. Different distribution rules are encapsulated into different policy classes in the background by using the policy mode based on the class, each policy class only comprises one policy behavior, namely a set of execution logic corresponding to the distribution rule, and the policy behaviors contained in the different policy classes are different and mutually independent, when the execution logic of a certain distribution rule is modified, the execution logic of other distribution rules cannot be influenced, so that the later maintenance of the distribution rules is facilitated, and the maintenance cost is reduced.
Step S220, when the application is started, a pre-configured identification key value pair consisting of a first identifier of an allocation scene and a second identifier of an allocation rule template is obtained and serves as a mapping relation to be registered in the nacos server, wherein the allocation rule template comprises a verification rule template and an execution rule template.
The mapping relationship between the distribution scenario and the distribution rule template is the corresponding relationship between the distribution scenario and the corresponding distribution rule in the actual service. Specifically, the mapping relationship may be written into a configuration file in advance in the form of an identifier key value pair, and when the application is started, the mapping relationship in the configuration file is read by the application server, and the mapping relationship is registered in the configuration center, so as to complete the corresponding configuration of the distribution scenario and the distribution rule template. The configuration center may be a nacos server. As an open source management configuration platform, the nacos server can be used for configuring information in the process of service development. The Nacos server can manage application configuration and service configuration, and the application and the service do not need to be redeployed when configuration information is changed, so that dynamic configuration of the information can be realized. In an allocation scenario of a store, a mapping relationship between an encapsulated allocation rule template and a corresponding allocation scenario may be specifically registered in a nacos server as configuration information, so as to implement association between the allocation scenario and the allocation rule template. After the configuration of the mapping relationship is completed, the sequence of the distribution rule templates can be modified and a certain distribution rule template can be added or deleted in the mapping relationship to adjust the execution of the distribution rule in the distribution scene. The first identifier of the allocation scenario is unique identification information of the allocation scenario, and specifically may be an ID (Identity Document) code set for the allocation scenario or a unique scenario name of the allocation scenario. Similarly, the second identifier of the distribution rule template is unique identification information of the distribution rule template, and specifically may be a template name or a class name that is set in the application server after the distribution rule template is encapsulated, and in the policy mode, the second identifier is a policy name. The first identifier and the second identifier may each be configured in the nacos server in the form of a string.
Specifically, the identification key value pair may be set in a form or a configuration file, and in subsequent service maintenance, according to adjustment of an actual service, the mapping relationship may be updated by submitting the form or modifying the configuration file, so as to adjust execution of a corresponding distribution rule. And because the configuration center in the nacos server has an automatic refreshing mechanism, the configuration of the mapping relation can be updated in real time by directly utilizing the automatic refreshing mechanism after the mapping relation in the nacos server is modified subsequently, and the updating of the mapping relation is not required to be carried out by restarting the server, so that the configuration efficiency is improved, and the influence on other services deployed on the server is reduced.
Additionally, the allocation rule template may include a check rule template and an execution rule template, as the allocation rule template may be an abstraction of several check rules prior to performing the allocation, and several execution rules during performing the allocation. For example, the verification rules may include verification rules such as an allocation procedure verification in a store allocation scenario, other related exclusive procedure verifications, a delayed allocation verification, a delivery order verification, an offline device verification, a flow work order verification, a grid attribution verification, and an allocation authority verification. The execution rules can include execution rules such as an administrator allocation strategy, an approval allocation strategy, an employee attendance allocation strategy, a grid allocation strategy, a direct operation and maintenance team allocation strategy, an open sea allocation strategy, a channel allocation strategy and a store circulation allocation strategy under a store allocation scene. It is understood that a check rule template is an abstraction of the execution logic for a series of check rules. An execution rule template is an abstraction of the execution logic of a series of execution rules. For example, the check rule in the grid allocation scenario includes: the method includes the steps of determining whether the relationship between the distributor and the holder and between the distributor and the receiver is a permission check of a leader relationship, determining whether the distributed store is in a delayed distribution check in a delayed distribution process, determining whether the distributed store has a distribution order check of a distribution order, determining whether the distributed store has an offline device check of an offline device, and the like. By abstracting the execution logic of the check rule under the series of grid distribution scenes by using the policy mode, a check rule template under the grid distribution scenes, namely one or more policy classes in the code, can be obtained. For another example, the execution rule in the grid allocation scenario may be processing logic for changing an affiliate of the grid, and specifically may include persisting information of the affiliate of the grid change in a database, so as to change the operation authority that can be performed by the affiliate under the grid, and sending a change event generation message to the corresponding monitoring end. The monitoring terminal may be a terminal used by a user interested in distributing events or related processing personnel on an organization level. And packaging the execution rule based on the strategy mode to obtain an execution rule template under the grid distribution scene.
Taking a grid distribution scene as an example, the mapping relationship between the grid distribution scene and the corresponding distribution rule template is a group of one-to-many identifier key value pairs, wherein the identifier key value pairs take the scene name of the character string type of the grid distribution scene as a key and the template name of the character string type of the distribution rule template as a value, and the specific form is as follows: "grid" [ "delayCheck", "approvalProcessCheck", "deleveryOrderCheck", "gridCheck", "allocateProcessCheck", "deviceOfflineCheck" ], when the off-line equipment Check needs to be cancelled in the actual service, only the template name "device Offline Check" corresponding to the off-line equipment Check in the mapping relation needs to be removed, and the removal operation will inform the application server to update the distribution Check logic of the grid distribution scene.
The mapping relation between the distribution scene and the distribution rule template is registered in the nacos server, so that the coupling degree of the implementation code can be reduced, the maintenance of the mapping relation during the subsequent service adjustment is facilitated, and the expandability of the dynamic configuration is improved.
Step S230, after receiving the allocation request of the user for the target allocation scenario, obtaining the mapping relationship corresponding to the target allocation scenario from the nacos server according to the allocation request, obtaining an instance of the allocation rule template corresponding to the target allocation scenario according to the mapping relationship, and after passing through the allocation verification of each verification node according to the instance of the verification rule template, performing allocation of the target allocation scenario according to the instance of the execution rule template.
The allocation request may be initiated by the terminal to the application server to execute the allocation rule of the target allocation scenario, and the terminal may be a service party in an actual service scenario, for example, a responsible party or an operator of an store in a store allocation service. The target allocation scenario may be a scenario in which the current terminal needs to perform allocation operation, and the allocation request may be any http request including target allocation scenario information. The application server determines a target distribution scene needing to execute the distribution rule by analyzing the distribution request, and obtains a mapping relation corresponding to the target distribution scene by accessing the nacos server serving as a configuration center. It can be understood that the mapping relation can determine the corresponding distribution rule template for the target distribution scenario, so that the application server can execute the distribution rule in the corresponding distribution rule template based on the mapping relation.
Taking the grid distribution scenario as an example, after the scene name "grid" of the grid distribution scenario is analyzed from the distribution request, the application server obtains the mapping relationship corresponding to the grid distribution scenario from the configuration center according to the scene name "grid", that is, "grid" ("advance process check", "delivery order check", "grid check", "allocatprocess check", and "deviceOfflineCock"), and according to the mapping relationship, it can be determined that the distribution rule template corresponding to the target distribution scenario includes five types of "advance process check", "delivery order check", "grid", "allocateProcesscheck", and "deviceOfflieCock", and based on these five template names, the corresponding distribution rule can be obtained and executed.
Specifically, the distribution rule in the distribution rule template may be a groovy code running on a groovy script, after the application server determines the distribution rule template in the distribution scenario according to the mapping relationship, the application server scans a groovy file, so as to compile the corresponding groovy file into an instance running on the application server, specifically, the instance may be an object in a Java language, and the distribution rule corresponding to the target distribution scenario is executed by calling a corresponding distribution rule method in the object. Additionally, when the actual service changes and causes a change in the execution logic of a certain distribution rule, the corresponding distribution rule method may also be modified in the corresponding groovy file, so as to implement the update of the distribution rule template.
In the policy mode, the allocation rules in the allocation scenario may be encapsulated into a policy link composed of a set of policies, where the order of the policy link is an execution order of the allocation rules in the allocation scenario. After the application server obtains the mapping relationship between the target distribution scenario and the distribution rule template from the configuration center, the order of the policy link may be determined from the mapping relationship, and the corresponding distribution rules are sequentially executed according to the order. And further, after the distribution verification of each check node is sequentially executed according to the sequence of the strategy link, the target distribution scene is distributed according to the example of the execution rule template.
The method comprises the steps of analyzing an allocation request to obtain a mapping relation corresponding to a target allocation scene from a configuration center, obtaining an example of an allocation rule template corresponding to the target allocation scene according to the mapping relation, performing allocation of the target allocation scene according to the example of an execution rule template after the example of the check rule template passes allocation check of each check node, executing the allocation rule of the corresponding allocation scene based on different allocation requests, and realizing dynamic execution of the allocation rule.
In step S240, after the allocation of the target allocation scenario is completed, an allocation completion notification is generated.
Specifically, after the assignment of the target assignment scenario is completed, the user may be notified of the assignment completion in a short message notification, a nail notification, a mail notification, or the like.
In the above steps S210 to S240, according to the policy mode, the allocation rule preset in the allocation scene is encapsulated to obtain an allocation rule template; when the application is started, acquiring a pre-configured identification key value pair consisting of a first identifier of an allocation scene and a second identifier of an allocation rule template, serving as a mapping relation, and registering the mapping relation to a nacos server, wherein the allocation rule template comprises a check rule template and an execution rule template; after receiving an allocation request of a user for a target allocation scene, acquiring a mapping relation corresponding to the target allocation scene from a nacos server according to the allocation request, obtaining an example of an allocation rule template corresponding to the target allocation scene according to the mapping relation, and after passing allocation verification of each verification node according to the example of the verification rule template, performing allocation of the target allocation scene according to the example of the execution rule template; generating an allocation completion notification after completing allocation of the target allocation scenario; the dynamic configuration of the allocation rules is realized, the coupling degree of the execution codes of the store allocation business at the back end is reduced, and the expansibility of the store allocation business is improved.
Further, in an embodiment, when at least two allocation rules are preset in an allocation scenario, in the pair of identification key values, the first identifier corresponds to at least two second identifiers.
Further, in an embodiment, the pair of identification keys further includes a rank order of the second identifier, and the rank order corresponds to an execution order of the allocation rule.
In the policy mode, the rank order of the plurality of second identifiers in the pair of identification key values corresponds to the link order of the policy link. According to the execution sequence, the corresponding distribution rules are executed in sequence, the ordering of the execution of the verification rules and the distribution rules of the distribution scenes can be improved, and the stability of the service is maintained.
Additionally, in an embodiment, based on the step S230, after receiving an allocation request of a user for a target allocation scenario, according to the allocation request, acquiring a mapping relationship corresponding to the target allocation scenario from the nacos server, including the following steps:
step S231, analyzes the allocation request to obtain the request parameter.
Specifically, the allocation request may include a plurality of request parameters for providing data for obtaining the mapping relationship corresponding to the target scene and subsequently executing the allocation rule. The request parameter may include a first identifier of the target allocation scenario, for example, a scenario name of the target allocation scenario.
Step S232, according to the request parameters, obtaining the mapping relation corresponding to the target distribution scene from the nacos server.
When the application server receives the allocation request and analyzes the first identifier, a mapping relation corresponding to the first identifier, for example, an identification key value pair corresponding to the first identifier, is searched from the configuration center, so that an allocation rule template corresponding to the target allocation scene can be determined.
In an embodiment, based on the foregoing steps S231 and S232, the distribution rule template is set in the groovy script, and an example of the distribution rule template corresponding to the target distribution scenario is obtained according to the mapping relationship, further including the following steps:
step S233, according to the mapping relationship, a groovy script of the distribution rule is obtained.
The groovy is a dynamic code language, and the groovy script is a file written by the groovy language. In the present embodiment, the groovy script includes a code set to execute the allocation rule. Specifically, the groovy script may be bound to the second identifier in advance, and after the allocation request is obtained, the groovy script may be obtained based on the second identifier in the mapping relationship. That is, the groovy script corresponding to the file directory in which the groovy script is located may be scanned according to the policy name.
Step S234, obtaining an example of the distribution rule template according to the groovy script.
And registering the groovy script corresponding to the second identifier into the application server, so as to obtain an instance of the distribution rule template corresponding to the second identifier, and thus, the execution of the distribution rule can be realized by calling a method in the instance. That is, after the groovy script file corresponding to the policy name is obtained, the content in the groovy script is compiled into a class executable in code, such as a spring bean in java language. Based on the executable class, the corresponding allocation rule can be executed.
Additionally, in an embodiment, the above dynamic configuration method further includes the following steps:
step S250, before receiving the distribution request of the user for the target distribution scene, if capturing the authority verification exception when performing role authority verification on the user, packaging the authority verification exception into prompt information and sending the prompt information to the user.
In particular, an exception handler may be provided to capture exception information, which may be implemented by some exception handling class in code, such as the Check class in Java. In the case that the user does not have the right to assign to the target assignment scenario, the exception handler will capture an exception to the right check.
Step S260, after receiving the allocation request of the user for the target allocation scenario, if the instance capturing the allocation rule template obtains an exception, performing degradation processing on the configuration of the mapping relationship between the target allocation scenario and the allocation rule template.
When an instance of the distribution rule template is acquired, an exception caused by a configuration problem or a network problem may exist, and the exception belongs to an instance acquisition exception.
Step S270, when distribution verification is carried out on the example based on the verification rule template and distribution verification abnormity is captured, the distribution verification abnormity is packaged as an object, and then the next verification node of the verification nodes generating the distribution verification abnormity is transmitted, so that the next verification node executes a corresponding preset processing mechanism according to the specific category of the distribution verification abnormity.
One distribution scene can correspond to a plurality of check rules, the check rules can form a check link, and each check rule corresponds to one check node. When the execution exception of the check rule is captured, the exception and the check result can be packaged together and then processed at the next check node.
Further, when one of the check nodes catches the distribution check abnormality, the distribution check abnormality may be packaged as an object and then flows through the entire check link as a parameter. The check node on the check link can obtain the check result and the abnormal information of the previous check node and perform targeted processing on the check result and the abnormal information.
Additionally, if the check node generating the distribution check exception is not the last check node of the check link, the distribution check exception may be encapsulated as an object when the distribution check exception is captured, and then the next check node of the check node generating the distribution check exception is transmitted, so that the next check node executes a corresponding preset processing mechanism for the specific category of the distribution check exception; if the check node generating the distribution check exception is the last check node, the check result and the exception information output by the check link are directly output, and before distribution is executed, a corresponding preset processing mechanism is executed according to the specific category of the distribution check exception. The preset processing mechanism can generate two results, wherein one result is that the objects packaged by the distribution verification exception are submitted to the exception handler in the distribution execution process for processing, and the other result is that the verification result generates prompt information and sends the prompt information to the user.
Step S280, when the target distribution scene is distributed based on the instance of the execution rule template and the distribution execution abnormity is captured, generating an abnormity prompt message for the user according to the distribution execution abnormity, and rolling back the data of the distribution process.
When capturing an allocation execution exception, since the exception affects the specific allocation process of the allocation scenario, the exception may be recorded and data may be rolled back, and in addition, specific exception information may also be returned for the request sender.
Additionally, after the execution of the distribution rule is completed, a notification may be sent to the request sending party to prompt the completion of the distribution, and when a notification abnormality occurs in the notification process, a degradation alternative process may be performed for the abnormality, for example, a replacement form is selected for notification, a short message notification is used when a mail notification is abnormal, a nail notification is selected when a short message notification is abnormal, and the like. If all the notifications are abnormal, the abnormal information is directly stored in an abnormal log, and an abnormal alarm is triggered.
Specifically, in one embodiment, based on the above steps, the allocation scenario includes grid allocation, background administrator allocation, agent allocation, cross-organizational allocation, and deferred allocation.
The grid in grid allocation refers to a map grid and represents an area on a map. The grid can be drawn on a map through some interfaces or services provided by map software. The area represented by the grid corresponds to the actual geographical area. The stores set under the grid are stores in the corresponding actual geographic area. The grid allocation refers to the allocation of the grid attribution, namely, the grid attribution is changed from a previously determined attribution A to an attribution B. The grid owner is also the responsible person for managing the sales transaction in the actual geographic area corresponding to the grid. After the grid distribution is completed, the store affiliate in the grid is changed from the affiliate A to the affiliate B synchronously. It is to be understood that the store owner is also the responsible person of the store.
Additionally, the back-office administrator assigns the assignment of changes to the affiliates of stores that do not meet some preset conditions in the actual business under special circumstances. For example, when a store a needs to replenish the shared portable power source, and a person a belonging to the store a cannot perform the process for another reason, in order to enable a person b belonging to the store a who does not have the authority to replenish the shared portable power source with the shared portable power source to temporarily perform the process, the store a can be assigned to the person b belonging to the store by a background administrator, so that the shared portable power source can be replenished in time. Background administrator allocation does not need to verify the authority between the grid and the stores, and can be used as an emergency and bottom-binding solution in a store allocation scene.
The agent assignment is specifically assignment performed inside an agent team to stores contracted by enterprises or individuals as agents, that is, the home owner c of a certain store is changed to the home owner d in the agent team with the home owner c. Where the agent is a business or individual that has a cooperative relationship with the business party performing the assignment. The cross-organization architecture distribution refers to cross-group distribution or cross-city distribution of stores on a management level according to actual business needs.
In the normal distribution process, after the request of store distribution is submitted, distribution can be executed after the distribution verification is passed. However, if an offline device exists in a store and the offline device is not restored to an online device within a predetermined time, subsequent allocation is not performed, or the store is allocated to an upper level of a person to which the store belongs, and such an allocation scenario is a delayed allocation scenario.
In one embodiment, as shown in FIG. 3, there is provided a method for dynamically performing allocation of store allocation scenarios, comprising the steps of:
step S310, identifying an allocation scene in the allocation request;
step S320, a verification strategy group corresponding to the distribution scene is dynamically obtained;
step S330, obtaining a verification strategy instance according to the verification strategy name in the verification strategy group;
step S340, executing distribution verification according to the verification strategy instance;
step S350, performing allocation;
and step S360, notifying the user after the distribution is finished.
Additionally, in one embodiment, as shown in FIG. 4, there is provided yet another method of dynamically performing allocation of store allocation scenarios, comprising the steps of:
step S401, judging whether the distribution request is matched with the current distribution scene, if so, executing step S402, otherwise, executing step S411;
step S402, judging whether the role authority and the request parameter check is passed, if so, executing step S403, otherwise, executing step S411;
step S403, assembling request parameters;
step S404, a checking strategy group dynamically configured from the nacos server, if the acquisition fails, a checking strategy group statically configured is acquired from the local;
step S405, acquiring a corresponding verification strategy instance;
step S406, executing distribution verification according to the verification strategy group link;
step 407, determining whether the distribution check passes, if so, executing step 408, otherwise, executing step 411;
step S408, distribution is executed;
step S409, determining whether the allocation is successfully executed, if so, executing step S410, otherwise, executing step S411;
step S410, distribution completion notification;
in step S411, exception processing is assigned.
Additionally, fig. 5 is a timing diagram of a method for dynamically performing allocation of store allocation scenarios in one embodiment, the method running in the form of a program in a backend server, the method comprising:
the store allocation controller performs allocation scene recognition on the allocation request, and triggers a store allocation processing class to start an allocation process after recognition;
the store allocation processing class checks the allocation request and the role authority and triggers a scheme selector to analyze the allocation request;
the scheme selector assembles request parameters in the allocation request, acquires an actuator and an execution container for executing the strategy, and triggers the scheme processor to perform allocation verification;
the scheme processor triggers the verification end to execute the verification strategy, triggers the execution end to execute distribution after the distribution verification is passed, and sends a message to inform a user after the distribution is executed;
and the scheme processor performs exception handling after the distribution verification fails and performs exception handling after the distribution execution fails.
The store allocation controller, the store allocation processing class, the scheme selector, the scheme processor, the execution end and the verification end are all code modules formed by programs.
In the steps, the corresponding distribution rules are sequentially executed according to the arrangement sequence of the second identifiers in the identification key value pairs, so that the execution order of the distribution rules is improved; setting execution logic of the distribution rule template in the groovy script, scanning the groovy script according to the second identifier, and packaging the corresponding groovy script as an example of the distribution rule template, so that dynamic processing and dynamic modification of the distribution rule execution logic are realized, a corresponding exception handler is configured for a distribution scene, and when the exception handler captures an exception, corresponding processing is executed according to the type of the exception, so that the stability of a service is improved; finally, the real-time modification and updating of the distribution rules are realized, the dynamic configuration of the distribution rules is realized, and the coupling degree of execution codes of the store distribution business at the back end is reduced, so that the expansibility of the store distribution business is improved.
In one embodiment, a dynamic configuration process in a grid allocation scenario is provided, as shown in fig. 6a, including the following steps:
step S601, based on the policy mode, packages a series of check rules in the grid distribution scenario into a corresponding check policy class, and packages the execution rules in the grid distribution scenario into a corresponding execution policy class.
The verification policy class is the verification policy template of the above embodiment, and the execution policy class is the execution policy template of the above embodiment. Specifically, the verification rules in the permission verification, the delay verification, the delivery order verification, the grid verification and the offline device verification are correspondingly packaged into a permission verification policy class, a delay verification policy class, a delivery order verification policy class, a grid verification policy class and an offline device verification policy class. And correspondingly packaging the change process of the affiliate into a grid distribution execution strategy class under the grid distribution scene. And storing the strategy class in a file directory specified by a service person in the form of a code file. Specifically, the execution logic included in the policy class is saved in the form of a groovy script.
Step S602, a mapping relationship between the identifier of the grid distribution scenario and the corresponding policy class is established.
That is, a one-to-many identifier key-value pair consisting of a scene name of a grid allocation scene and a policy name of a policy class is established. For example, the identifier key-value pair may be in the form of: { "gridCase" [ "permissionCheck", "delayCheck", "deleveryOrdercheck", "gridCheck", "deviceOfflineCheck", "allocateProcessCheck" ] }.
Step S603, associating the code logic of the check rule with the policy name corresponding to the check rule, and associating the code logic of the execution rule with the policy name corresponding to the execution rule.
By associating the allocation rule with the corresponding policy name, the server can resolve the grid allocation scenario to the corresponding check policy link and the corresponding execution policy link according to the identifier key value pair in S602.
Step S604, store the identifier key-value pair in step S602 to a storage system, such as MySQL, Redis, or Nacos server. Preferably, the identifier key-value pair is stored using a Nacos server.
Step S605, deploying the service code of the relevant control flow in the application server, and waiting for the user to initiate the allocation request of the grid allocation scenario.
As shown in fig. 6b, the service code is specifically controlled as follows:
step S605-1, acquiring a distribution request aiming at a grid distribution scene initiated by a user, and analyzing the relevant context information and scene information of the grid distribution scene in the distribution request;
step S605-2, identifying the grid distribution scene based on the scene information, performing adaptation check of the grid distribution scene and the related context information, executing step S605-3 after the check is passed, otherwise prompting the user that the adaptation check is failed;
step S605-3, acquiring an identifier key value pair from a storage system according to the scene name of the grid distribution scene, and acquiring a corresponding group of verification strategy classes, namely a verification rule template, based on the identifier key value pair;
step S605-4, based on the sequence of the group of verification strategy classes in the strategy link, scanning the directory where the groovy script is located, acquiring the corresponding groovy script, executing the verification rules contained in the verification strategy classes, if the verification is completed in sequence, executing step S605-5, otherwise executing step S605-6;
step S605-5, acquiring a corresponding groovy script based on the execution strategy class of the grid distribution scene, and executing distribution, namely completing the process of changing the affiliates in the grid;
and step S605-6, executing abnormity detection, and sending prompt information for prompting verification failure for the user after the abnormity is detected.
In one embodiment, a dynamic configuration process in a background administrator allocation scenario is provided, comprising the steps of:
step S701, based on the policy mode, packaging the check rules in the background administrator distribution scene as the corresponding check policy class, and packaging the execution rules in the background administrator distribution scene as the corresponding execution policy class.
Specifically, according to the policy mode, the delay verification, the delivery order verification and the distribution process verification in the background administrator distribution scene are packaged into a verification policy class, and the execution rule for performing delay distribution is packaged into an execution policy class. The delayed verification is to determine whether the store to be distributed is in the delayed distribution process, the delivery order verification is to determine whether the store to be distributed has an order in the delivery process, and the distribution in-out verification is to determine whether the store to be distributed is in other distribution processes.
Step S702, establishing a mapping relation between the identifier of the background administrator distribution scene and the corresponding policy class.
For example, a one-to-many identifier key-value pair of a scene name of a background administrator assigned scene and a policy name of a policy class may be established. For example, { "gridCase" [ "delayCheck", "delaviryOrderCheck", "allocateProcessCheck" ] }.
Step S703 associates the code logic of the check rule with the policy name corresponding to the check rule, and associates the code logic of the execution rule with the policy name corresponding to the execution rule.
Step S704, store the identifier key-value pair in step S702 to a storage system, such as MySQL, Redis, or Nacos server. Preferably, the identifier key-value pair is stored using a Nacos server.
Step S705, deploying the service code of the relevant control flow in the application server, and waiting for the user to initiate the allocation request of the grid allocation scenario.
The control flow of the service code is similar to the above steps S605-1 to S605-6, and is not described herein again.
The present embodiment further provides a dynamic configuration apparatus for store allocation scenarios, where the apparatus is used to implement the foregoing embodiments and preferred embodiments, and details are not repeated for what has been described. As used hereinafter, the terms "module," "unit," "subunit," and the like may implement a combination of software and/or hardware for a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Based on the same inventive concept, as shown in fig. 7, an embodiment of the present application further provides a dynamic configuration apparatus 70 for a store allocation scenario, which includes an encapsulation module 72, a configuration module 74, an acquisition module 76, and a notification module 78, where:
the encapsulation module 72 is configured to encapsulate an allocation rule preset in an allocation scene according to the policy mode to obtain an allocation rule template;
a configuration module 74, configured to, when an application is started, obtain a preconfigured identification key value pair composed of a first identifier of an allocation scenario and a second identifier of an allocation rule template, as a mapping relationship, and register the mapping relationship to the nas server, where the allocation rule template includes a check rule template and an execution rule template;
an obtaining module 76, configured to, after receiving an allocation request of a user for a target allocation scenario, obtain a mapping relationship corresponding to the target allocation scenario from the nacos server according to the allocation request, obtain an instance of an allocation rule template corresponding to the target allocation scenario according to the mapping relationship, and perform allocation of the target allocation scenario according to the instance of the execution rule template after passing through allocation verification of each verification node according to the instance of the verification rule template;
a notification module 78, configured to generate an allocation completion notification after completing allocation of the target allocation scenario.
The dynamic configuration device for the store distribution scene packages the preset distribution rule of the distribution scene according to the strategy mode to obtain a distribution rule template; when the application is started, acquiring a pre-configured identification key value pair consisting of a first identifier of an allocation scene and a second identifier of an allocation rule template, serving as a mapping relation, and registering the mapping relation to a nacos server, wherein the allocation rule template comprises a check rule template and an execution rule template; after receiving an allocation request of a user for a target allocation scene, acquiring a mapping relation corresponding to the target allocation scene from a nacos server according to the allocation request, obtaining an example of an allocation rule template corresponding to the target allocation scene according to the mapping relation, and after passing allocation verification of each verification node according to the example of the verification rule template, performing allocation of the target allocation scene according to the example of the execution rule template; generating an allocation completion notification after completing allocation of the target allocation scenario; the dynamic configuration of the allocation rules is realized, the coupling degree of the execution codes of the store allocation business at the back end is reduced, and the expansibility of the store allocation business is improved.
In one embodiment, when at least two allocation rules are preset in an allocation scenario, in an identification key value pair, a first identifier corresponds to at least two second identifiers.
In one embodiment, the pair of identification keys further includes a rank order of the second identifier, and the rank order corresponds to an execution order of the allocation rule.
In an embodiment, the obtaining module 76 is further configured to parse the allocation request to obtain a request parameter, and obtain, according to the request parameter, a mapping relationship corresponding to the target allocation scenario from the nacos server.
In an embodiment, the obtaining module 76 is further configured to obtain a groovy script of the distribution rule according to the mapping relationship, and obtain an instance of the distribution rule template according to the groovy script.
In one embodiment, the dynamic configuration apparatus 70 further includes an exception handling module, configured to, before receiving an allocation request of a user for a target allocation scenario, package an authority verification exception into prompt information and send the prompt information to the user if the authority verification exception is captured when performing role authority verification on the user; the method is also used for performing degradation processing on the configuration of the mapping relation between the target distribution scene and the distribution rule template if the abnormal situation is acquired when the example of the distribution rule template is captured after the distribution request of the user for the target distribution scene is received; the system is also used for carrying out distribution verification on an example based on a verification rule template, when distribution verification abnormity is captured, the distribution verification abnormity is packaged as an object, and then the next verification node of the verification node generating the distribution verification abnormity is transmitted, so that the next verification node executes a corresponding preset processing mechanism aiming at the specific category of the distribution verification abnormity; and the method is also used for generating an exception prompt message for a user according to the allocation execution exception and rolling back the data in the allocation process when the allocation of the target allocation scene is carried out based on the instance of the execution rule template and the allocation execution exception is captured.
In one embodiment, the allocation scenarios include grid allocation, background administrator allocation, agent allocation, cross-organizational allocation, and deferred allocation.
For specific limitations of the embodiment of the dynamic configuration apparatus for store allocation scenarios, reference may be made to the above limitations of the dynamic configuration method for store allocation scenarios, and details are not repeated here. The various modules in the dynamic configuration apparatus of the store allocation scenario described above may be implemented in whole or in part by software, hardware, and combinations thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, as shown in FIG. 8, an electronic device is provided that includes a memory and a processor. The memory has stored therein a computer program for providing computing and control capabilities to the processor of the electronic device. The memory of the electronic device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
Optionally, in this embodiment, the processor, when executing the computer program, implements the following steps:
according to the strategy mode, packaging the preset distribution rule of the distribution scene to obtain a distribution rule template;
when the application is started, acquiring a pre-configured identification key value pair consisting of a first identifier of an allocation scene and a second identifier of an allocation rule template, serving as a mapping relation, and registering the mapping relation to a nacos server, wherein the allocation rule template comprises a check rule template and an execution rule template;
after receiving an allocation request of a user for a target allocation scene, acquiring a mapping relation corresponding to the target allocation scene from a nacos server according to the allocation request, obtaining an example of an allocation rule template corresponding to the target allocation scene according to the mapping relation, and after passing allocation verification of each verification node according to the example of the verification rule template, performing allocation of the target allocation scene according to the example of the execution rule template;
upon completion of the allocation of the target allocation scenario, an allocation completion notification is generated.
In one embodiment, when at least two allocation rules are preset in an allocation scenario, in an identification key value pair, a first identifier corresponds to at least two second identifiers.
In one embodiment, the pair of identification keys further includes a rank order of the second identifier, and the rank order corresponds to an execution order of the allocation rule.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
analyzing the distribution request to obtain a request parameter;
and acquiring the mapping relation corresponding to the target distribution scene from the nacos server according to the request parameter.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
acquiring a groovy script of the distribution rule according to the mapping relation;
and acquiring an example of the distribution rule template according to the groovy script.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
before receiving an allocation request of a user for a target allocation scene, if an authority verification exception is captured when role authority verification is carried out on the user, packaging the authority verification exception into prompt information and sending the prompt information to the user;
after receiving an allocation request of a user for a target allocation scene, if capturing an instance of an allocation rule template to obtain exception, performing degradation processing on the configuration of the mapping relation between the target allocation scene and the allocation rule template;
when distribution check is carried out on the example based on the check rule template and distribution check abnormity is captured, the distribution check abnormity is packaged as an object, and then the next check node of the check node generating the distribution check abnormity is transmitted, so that the next check node executes a corresponding preset processing mechanism according to the specific category of the distribution check abnormity;
and when the allocation execution abnormity is captured, generating an abnormity prompt message for a user according to the allocation execution abnormity, and rolling back the data of the allocation process.
In one embodiment, the allocation scenarios include grid allocation, background administrator allocation, agent allocation, cross-organizational allocation, and deferred allocation.
The electronic device packages a preset distribution rule of a distribution scene according to a strategy mode to obtain a distribution rule template; when the application is started, acquiring a pre-configured identification key value pair consisting of a first identifier of an allocation scene and a second identifier of an allocation rule template, serving as a mapping relation, and registering the mapping relation to a nacos server, wherein the allocation rule template comprises a check rule template and an execution rule template; after receiving an allocation request of a user for a target allocation scene, acquiring a mapping relation corresponding to the target allocation scene from a nacos server according to the allocation request, obtaining an example of an allocation rule template corresponding to the target allocation scene according to the mapping relation, and after passing allocation verification of each verification node according to the example of the verification rule template, performing allocation of the target allocation scene according to the example of the execution rule template; generating an allocation completion notification after completing allocation of the target allocation scenario; the dynamic configuration of the allocation rules is realized, the coupling degree of the execution codes of the store allocation business at the back end is reduced, and the expansibility of the store allocation business is improved.
In one embodiment, as shown in FIG. 9, a computer device is provided, which may be a terminal. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method for dynamic configuration of store allocation scenarios. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the above-described architecture is merely a block diagram of some of the structures associated with the present aspects and is not intended to limit the computing devices to which the present aspects apply, as particular computing devices may include more or less components than those described, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
according to the strategy mode, packaging the preset distribution rule of the distribution scene to obtain a distribution rule template;
when the application is started, acquiring a pre-configured identification key value pair consisting of a first identifier of an allocation scene and a second identifier of an allocation rule template, serving as a mapping relation, and registering the mapping relation to a nacos server, wherein the allocation rule template comprises a check rule template and an execution rule template;
after receiving an allocation request of a user for a target allocation scene, acquiring a mapping relation corresponding to the target allocation scene from a nacos server according to the allocation request, obtaining an example of an allocation rule template corresponding to the target allocation scene according to the mapping relation, and after passing allocation verification of each verification node according to the example of the verification rule template, performing allocation of the target allocation scene according to the example of the execution rule template;
upon completion of the allocation of the target allocation scenario, an allocation completion notification is generated.
In one embodiment, when at least two allocation rules are preset in an allocation scenario, in an identification key value pair, a first identifier corresponds to at least two second identifiers.
In one embodiment, the pair of identification keys further includes a rank order of the second identifier, and the rank order corresponds to an execution order of the allocation rule.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
analyzing the distribution request to obtain a request parameter;
and acquiring the mapping relation corresponding to the target distribution scene from the nacos server according to the request parameter.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
acquiring a groovy script of the distribution rule according to the mapping relation;
and acquiring an example of the distribution rule template according to the groovy script.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
before receiving an allocation request of a user for a target allocation scene, if an authority verification exception is captured when role authority verification is carried out on the user, packaging the authority verification exception into prompt information and sending the prompt information to the user;
after receiving an allocation request of a user for a target allocation scene, if capturing an instance of an allocation rule template to obtain exception, performing degradation processing on the configuration of the mapping relation between the target allocation scene and the allocation rule template;
when distribution check is carried out on the example based on the check rule template and distribution check abnormity is captured, the distribution check abnormity is packaged as an object, and then the next check node of the check node generating the distribution check abnormity is transmitted, so that the next check node executes a corresponding preset processing mechanism according to the specific category of the distribution check abnormity;
and when the allocation execution abnormity is captured, generating an abnormity prompt message for a user according to the allocation execution abnormity, and rolling back the data of the allocation process.
In one embodiment, the allocation scenario is for store allocation, including grid allocation, back-office administrator allocation, agent allocation, cross-organizational allocation, and delayed allocation.
The computer equipment encapsulates the preset distribution rule of the distribution scene according to the strategy mode to obtain a distribution rule template; when the application is started, acquiring a pre-configured identification key value pair consisting of a first identifier of an allocation scene and a second identifier of an allocation rule template, serving as a mapping relation, and registering the mapping relation to a nacos server, wherein the allocation rule template comprises a check rule template and an execution rule template; after receiving an allocation request of a user for a target allocation scene, acquiring a mapping relation corresponding to the target allocation scene from a nacos server according to the allocation request, obtaining an example of an allocation rule template corresponding to the target allocation scene according to the mapping relation, and after passing allocation verification of each verification node according to the example of the verification rule template, performing allocation of the target allocation scene according to the example of the execution rule template; generating an allocation completion notification after completing allocation of the target allocation scenario; the dynamic configuration of the allocation rules is realized, the coupling degree of the execution codes of the store allocation business at the back end is reduced, and the expansibility of the store allocation business is improved.
In addition, in combination with the dynamic configuration method provided in the foregoing embodiment, a storage medium may also be provided to implement this embodiment. The storage medium having stored thereon a computer program; the computer program, when executed by a processor, implements any of the dynamic configuration methods of the above embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware related to instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, the computer program can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (11)

1. A dynamic configuration method for an outlet distribution scene is used for configuring corresponding distribution rules for the outlet distribution scene, and is characterized by comprising the following steps:
according to a strategy mode, packaging the preset distribution rule of the distribution scene to obtain a distribution rule template;
when the application is started, acquiring a pre-configured identification key value pair consisting of a first identifier of the distribution scene and a second identifier of the distribution rule template, serving as a mapping relation, and registering the mapping relation to a nacos server, wherein the distribution rule template comprises a check rule template and an execution rule template;
after receiving an allocation request of a user for a target allocation scene, acquiring a mapping relation corresponding to the target allocation scene from the nacos server according to the allocation request, acquiring an example of an allocation rule template corresponding to the target allocation scene according to the mapping relation, and after passing allocation verification of each verification node according to the example of the verification rule template, performing allocation of the target allocation scene according to the example of the execution rule template;
and generating an allocation completion notification after completing the allocation of the target allocation scenario.
2. The dynamic configuration method of the store allocation scenario according to claim 1, wherein when at least two allocation rules are preset in the allocation scenario, the first identifier corresponds to at least two of the second identifiers in the pair of identification key values.
3. The dynamic configuration method of the store allocation scenario according to claim 2, wherein the pair of identification key values further includes a rank order of the second identifier, and the rank order corresponds to an execution order of the allocation rule.
4. The dynamic configuration method of the store allocation scenario according to claim 1, wherein the obtaining, according to the allocation request, the mapping relationship corresponding to the target allocation scenario from the nacos server after receiving the allocation request of the user for the target allocation scenario includes:
analyzing the distribution request to obtain request parameters;
and acquiring the mapping relation corresponding to the target distribution scene from the nacos server according to the request parameter.
5. The dynamic configuration method for the store distribution scenario according to claim 4, wherein the distribution rule template is set in a groovy script, and obtaining the instance of the distribution rule template corresponding to the target distribution scenario according to the mapping relationship comprises:
acquiring a groovy script of the distribution rule according to the mapping relation;
and acquiring an example of the distribution rule template according to the groovy script.
6. The method for dynamically configuring store allocation scenarios according to claim 1, further comprising:
before receiving an allocation request of the user for a target allocation scene, if an authority check exception is captured when role authority check is performed on the user, packaging the authority check exception into prompt information and sending the prompt information to the user;
after receiving an allocation request of a user for a target allocation scene, if capturing an instance acquisition exception of the allocation rule template, performing degradation processing on the configuration of the mapping relation between the target allocation scene and the allocation rule template;
when distribution verification is carried out on the basis of the example of the verification rule template and distribution verification abnormity is captured, the distribution verification abnormity is packaged as an object, and then the next verification node of the verification node generating the distribution verification abnormity is transmitted to enable the next verification node to execute a corresponding preset processing mechanism aiming at the specific category of the distribution verification abnormity;
and when the target distribution scene is distributed based on the instance of the execution rule template and the distribution execution abnormity is captured, generating an abnormity prompt message for the user according to the distribution execution abnormity, and rolling back the data of the distribution process.
7. The dynamic configuration method of the store allocation scenario according to any of claims 1 to 6, wherein the allocation scenario comprises grid allocation, back-office administrator allocation, agent allocation, cross-organizational allocation, and delayed allocation.
8. The dynamic configuration device for the store distribution scene is used for configuring corresponding distribution rules for the store distribution scene, and is characterized by comprising an encapsulation module, a configuration module, an acquisition module and a notification module:
the encapsulation module is used for encapsulating the preset distribution rule of the distribution scene according to a strategy mode to obtain a distribution rule template;
the configuration module is used for acquiring a pre-configured identification key value pair consisting of a first identifier of the distribution scene and a second identifier of the distribution rule template when the application is started, taking the pre-configured identification key value pair as a mapping relation, and registering the mapping relation to the nacos server, wherein the distribution rule template comprises a check rule template and an execution rule template;
the acquisition module is used for acquiring a mapping relation corresponding to a target distribution scene from the nacos server according to the distribution request after receiving a distribution request of a user for the target distribution scene, acquiring an example of a distribution rule template corresponding to the target distribution scene according to the mapping relation, and distributing the target distribution scene according to the example of the execution rule template after the example of the verification rule template passes distribution verification of each verification node;
and the notification module is used for generating a distribution completion notification after the distribution of the target distribution scene is completed.
9. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, and wherein the processor when executing the computer program performs the steps of the method for dynamic configuration of store allocation scenarios as claimed in any one of claims 1 to 7.
10. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor, when executing the computer program, carries out the steps of the method for dynamic configuration of store allocation scenarios according to any one of claims 1 to 7.
11. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method for dynamic configuration of store allocation scenarios according to any one of claims 1 to 7.
CN202111074545.3A 2021-09-14 2021-09-14 Dynamic configuration method and device for store distribution scene and electronic device Active CN113516541B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111074545.3A CN113516541B (en) 2021-09-14 2021-09-14 Dynamic configuration method and device for store distribution scene and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111074545.3A CN113516541B (en) 2021-09-14 2021-09-14 Dynamic configuration method and device for store distribution scene and electronic device

Publications (2)

Publication Number Publication Date
CN113516541A true CN113516541A (en) 2021-10-19
CN113516541B CN113516541B (en) 2022-01-11

Family

ID=78063188

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111074545.3A Active CN113516541B (en) 2021-09-14 2021-09-14 Dynamic configuration method and device for store distribution scene and electronic device

Country Status (1)

Country Link
CN (1) CN113516541B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130031201A1 (en) * 2008-04-03 2013-01-31 Electro Industries/Gauge Tech Intelligent electronic device communication solutions for network topologies
US8631505B1 (en) * 2013-03-16 2014-01-14 Jrc Holdings, Llc Method, system, and device for providing a market for digital goods
CN107274084A (en) * 2017-06-08 2017-10-20 北京惠赢天下网络技术有限公司 A kind of order intelligent dispatching method, system and terminal based on standard container
CN107886279A (en) * 2017-11-29 2018-04-06 商派软件有限公司 A kind of full channel inventory allocation method based on businessman stock
CN110322315A (en) * 2019-05-30 2019-10-11 苏宁云计算有限公司 A kind of commodity auto-allocation method, device, computer equipment and storage medium
CN111435495A (en) * 2019-01-14 2020-07-21 阿里巴巴集团控股有限公司 Service processing method, device and equipment
CN111506584A (en) * 2020-03-26 2020-08-07 金蝶软件(中国)有限公司 Service data processing method and device based on block chain and computer equipment
CN112148258A (en) * 2020-09-23 2020-12-29 厦门锐特信息技术有限公司 Method and system for allocating required goods in store of business department and store department
CN112613288A (en) * 2020-12-26 2021-04-06 杭州搜车网科技有限公司 Bill generation method and device, computer equipment and storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130031201A1 (en) * 2008-04-03 2013-01-31 Electro Industries/Gauge Tech Intelligent electronic device communication solutions for network topologies
US8631505B1 (en) * 2013-03-16 2014-01-14 Jrc Holdings, Llc Method, system, and device for providing a market for digital goods
CN107274084A (en) * 2017-06-08 2017-10-20 北京惠赢天下网络技术有限公司 A kind of order intelligent dispatching method, system and terminal based on standard container
CN107886279A (en) * 2017-11-29 2018-04-06 商派软件有限公司 A kind of full channel inventory allocation method based on businessman stock
CN111435495A (en) * 2019-01-14 2020-07-21 阿里巴巴集团控股有限公司 Service processing method, device and equipment
CN110322315A (en) * 2019-05-30 2019-10-11 苏宁云计算有限公司 A kind of commodity auto-allocation method, device, computer equipment and storage medium
CN111506584A (en) * 2020-03-26 2020-08-07 金蝶软件(中国)有限公司 Service data processing method and device based on block chain and computer equipment
CN112148258A (en) * 2020-09-23 2020-12-29 厦门锐特信息技术有限公司 Method and system for allocating required goods in store of business department and store department
CN112613288A (en) * 2020-12-26 2021-04-06 杭州搜车网科技有限公司 Bill generation method and device, computer equipment and storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
H. PANETTO ET AL.: ""Information systems for enterprise integration, interoperability and networking: theory and applications"", 《ENTERPRISE INFORMATION SYSTEMS》 *
罗晓雯: ""基于信息系统集成的A公司经销商系统构建研究"", 《中国优秀博硕士学位论文全文数据库(硕士) 经济与管理科学辑》 *
陈童 等: "《移动Web前端开发基础》", 31 January 2020 *

Also Published As

Publication number Publication date
CN113516541B (en) 2022-01-11

Similar Documents

Publication Publication Date Title
CN109474578B (en) Message checking method, device, computer equipment and storage medium
AU2018374912B2 (en) Model training system and method, and storage medium
CN108959385B (en) Database deployment method, device, computer equipment and storage medium
CN110673881B (en) Configuration management method and device for micro-service cluster and computer equipment
CN110704177B (en) Computing task processing method and device, computer equipment and storage medium
CN110633160A (en) Interface calling method and device, computer equipment and storage medium
CN111726370B (en) Method, system and device for automatically switching block chain consensus protocol
CN108446172B (en) Data calling method and device, computer equipment and storage medium
CN112953745A (en) Service calling method, system, computer device and storage medium
CN110908812A (en) Business data processing method and device, readable storage medium and computer equipment
US20220377556A1 (en) Internet-of-things device registration method and apparatus, device, and storage medium
CN113315828A (en) Traffic recording method and device, traffic recording equipment and storage medium
CN109902028A (en) Automated testing method, device, equipment and the storage medium of ACL characteristic
CN114168179A (en) Micro-service management method, device, computer equipment and storage medium
CN110531984B (en) Code compiling method, device, system, computer equipment and storage medium
CN113722114A (en) Data service processing method and device, computing equipment and storage medium
CN113961179A (en) Service access method, system, electronic device and storage medium of SOAR platform
CN111273962B (en) Configuration management method, device, computer readable storage medium and computer equipment
CN113516541B (en) Dynamic configuration method and device for store distribution scene and electronic device
CN113377669A (en) Automatic testing method and device, computer equipment and storage medium
CN112559352A (en) Interface test method, device, equipment and storage medium
CN114006815A (en) Automatic deployment method and device for cloud platform nodes, nodes and storage medium
CN114579473B (en) Application testing method, device, equipment and storage medium
CN112637085B (en) Flow recording method and device, computer equipment and storage medium
CN110609707A (en) Online data processing system generation method, device and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant