CN113935285A - Service code generation method and system - Google Patents

Service code generation method and system Download PDF

Info

Publication number
CN113935285A
CN113935285A CN202111065892.XA CN202111065892A CN113935285A CN 113935285 A CN113935285 A CN 113935285A CN 202111065892 A CN202111065892 A CN 202111065892A CN 113935285 A CN113935285 A CN 113935285A
Authority
CN
China
Prior art keywords
code
coding
service
sequence number
rule
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111065892.XA
Other languages
Chinese (zh)
Inventor
张伟庆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur General Software Co Ltd
Original Assignee
Inspur General Software 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 Inspur General Software Co Ltd filed Critical Inspur General Software Co Ltd
Priority to CN202111065892.XA priority Critical patent/CN113935285A/en
Publication of CN113935285A publication Critical patent/CN113935285A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/126Character encoding

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention provides a method and a system for generating service codes, wherein the method comprises the following steps: configuring coding rules corresponding to multiple services at a coding server in advance, and synchronizing the coding rules to a distributed cache for storage; when a business system receives a code generation requirement of a user, calling a code generation service of a code client to acquire a code rule from a distributed cache, sending set parameters of a rule ID, a continuous identification and a sequence number field in the code rule to the code server, so that when the continuous identification of the code server is a first value, a broken number under the rule ID is searched in a code library, the broken number is returned to the code client, and the broken number is deleted from the code library; and the coding client returns the break number as a service code to the service system. The invention can ensure the continuity of the service coding under the same rule ID in the distributed deployment mode without generating the repeated number.

Description

Service code generation method and system
Technical Field
One or more embodiments of the present disclosure relate to the technical field of service code generation, and in particular, to a method and a system for generating a service code.
Background
In an application system, a plurality of services are involved, and corresponding service data may need one or more codes with service meaning, for example, a code corresponding to an reimbursement receipt. The coding format required for each service data is often different. In the conventional mode, a developer of the service application needs to write a generation program of the service code according to the requirement. This approach has the following problems: (1) the workload of service developers is large, codes need to be written for each service code, and the code reusability is poor due to different formats of the service codes; (2) the encoding format is difficult to adjust in the later period and is not flexible enough; (3) with the expansion of the service scale, after the deployment mode of the service application is switched from a stand-alone mode to a distributed mode, the generation of codes is difficult to ensure the consistency and the like.
Disclosure of Invention
One or more embodiments of the present specification describe a service code generation method and system.
According to a first aspect, a method for generating service codes is provided, including:
configuring coding rules corresponding to multiple services at a coding server in advance, and synchronizing the coding rules to a distributed cache for storage; the coding rule comprises a rule ID, a continuous identifier and a coding segment list, wherein the rule ID is a unique identifier of the coding rule, the continuous identifier is used for representing whether a service code generated according to the service code requires continuity, the coding segment list is used for describing each component in the service code, the coding segment list at least comprises a sequence number field, and the sequence number field comprises setting parameters of a sequence number;
when a business system receives a code generation requirement of a user, calling a code generation service of a code client to enable the code generation service to acquire a code rule corresponding to the code generation requirement from the distributed cache, sending the rule ID, the continuous identification and the setting parameters of sequence number fields in the code rule to a code server, so that when the continuous identification of the code server is a first value, a broken number under the rule ID is searched in a code library, if the broken number is searched, returning the broken number to the code client, and deleting the broken number from the code library; the coding client takes the break number as the service code and returns the service code to the service system; the break number is a service code deleted before the service system, and the first value is used for representing that the service code requirement is continuous.
According to a second aspect, a service code generation system is provided, which includes a coding server, a coding client and a service system, wherein:
the coding server is used for: configuring coding rules corresponding to various services at a coding server in advance by personnel, and synchronizing the coding rules into a distributed cache for storage; the coding rule comprises a rule ID, a continuous identifier and a coding segment list, wherein the rule ID is a unique identifier of the coding rule, the continuous identifier is used for representing whether a service code generated according to the service code requires continuity, the coding segment list is used for describing each component in the service code, the coding segment list at least comprises a sequence number field, and the sequence number field comprises setting parameters of a sequence number;
the service system is used for: when receiving a code generation requirement of a user, calling a code generation service of a code client so that the code generation service acquires a code rule corresponding to the code generation requirement from the distributed cache, sending the rule ID, the continuous identification and the setting parameters of the sequence number field in the code rule to the code server, so that when the continuous identification of the code server is a first value, a broken number under the rule ID is searched in a code library, if the broken number is searched, returning the broken number to the code client, and deleting the broken number from the code library; the coding client takes the break number as the service code and returns the service code to the service system; the break number is a service code deleted before the service system, and the first value is used for representing that the service code requirement is continuous.
In the service code generation method and system provided in the embodiments of the present description, after the coding server configures the coding rules, the coding rules are stored in the distributed cache, so that each coding client can download the coding rules as needed, thereby implementing the sharing of the coding rules of multiple coding clients. When the continuous identification is the first value, firstly, the broken number is searched under the rule ID in the coding library, and the broken number is preferentially used as the service code, so that the continuity of the service code under the same rule ID in the distributed deployment mode is ensured, the repeated number cannot occur, and the broken number generated by deletion is reduced. Meanwhile, because the coding rule comprises the coding section list, various different types of coding rules can be flexibly obtained by configuring a plurality of fields in the coding section list, various coding generation requirements are further used, codes do not need to be compiled aiming at each business code, the workload of business personnel is reduced, later-stage adjustment is convenient, and the flexibility is strong. Moreover, the user only needs to operate in the service system, the coding client and the coding server assist the service system to realize various operations such as coding generation and the like, and the user cannot perceive the coding client and the coding server, so that the operation is simple and convenient.
Drawings
In order to more clearly illustrate the embodiments of the present specification or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present specification, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a schematic flow chart of a service code generation method in one embodiment of the present specification.
Detailed Description
The scheme provided by the specification is described below with reference to the accompanying drawings.
In a first aspect, the present invention provides a method for generating service codes, as shown in fig. 1, the method includes the following steps:
s100, configuring coding rules corresponding to multiple services at a coding server in advance, and synchronizing the coding rules to a distributed cache for storage;
the encoding rule comprises a rule ID, a continuous identifier and an encoding segment list, wherein the rule ID is a unique identifier of the encoding rule, the continuous identifier is used for representing whether service codes generated according to the service codes require continuity, the encoding segment list is used for describing each component in the service codes, and the encoding segment list at least comprises a sequence number field.
It can be understood that the coding server serves as a common configuration entry, and can uniformly configure and manage various coding rules. And synchronizing the configured multiple encoding rules into a distributed cache, so that the encoding client can download the encoding rules.
The rule ID is a unique identity of the encoding rule and is globally unique. The continuous identifier may take a first value and a second value, where the first value indicates that the service code obtained after encoding according to the encoding rule is required to be continuous, that is, there is a requirement for continuity of the service code. When the continuous coding is required, the deleted codes need to be stored in a coding library of a coding server side and are preferentially used when the codes are generated later. The second value indicates that the service code obtained after coding according to the coding rule can be discontinuous, and the continuity of the service code is not required. For example, the continuation flag is a boolean type, the first value is true, and the second value is false.
Besides the sequence number field, the encoding segment list may further include a constant field, an expression field, and the like. The coding segment list is used to describe each component in the service coding. Since the formats of the codes required in different service scenarios are often different, each component of different service codes is specified by each field of the code segment list. The following describes each field of the encoded segment list:
(1) a start number, a step size, a number of bits, and the like may be set in the sequence number field. When the code is generated each time, the sequence number of the current time is obtained according to the sequence number in the code generated last time plus the step length. For example, the number of bits is set to 4, i.e., a total of four bits of the sequence number, and if the sequence number is less than four bits, it is complemented with 0 in the front. For example, if a sequence number is 3, the sequence number after complementing with 0 is 0003. The sequence number may be included as a component of the generated traffic code.
(2) A constant string of the service code may be set in the constant field, and the service code may be generated with the constant string, that is, the constant string is a component of the service code.
(3) The expression field can be an expression for calculating a certain variable, that is, the expression field is used for representing a generation mode of a preset variable in the service code, a system public attribute, a calling public method and the like can be used in the expression, when the service system has a code generation requirement, service data is input into the expression, attribute value taking, calculation, formatting and other processing are carried out through the expression to obtain a calculation result, and the calculation result is used as a component of the service code.
For example, in the encoding rule configured for reimbursement documents, a constant string BX is specified in a constant field; the expression field specifies an expression for acquiring the reimbursement bill type and the year of the reimbursement bill, and for the reimbursement bill type, the expression is GetData ("bxdlx") and is used for acquiring a value corresponding to the reimbursement bill type in the current reimbursement bill; for the year, the expression FormatCurrentDate ("yyyyy") functions to take the current date in the current reimbursement document and format it into the year. The initial number of the sequence number is 1, the step length is 1, the digit number is 4, which indicates that the sequence number starts from 1, each time a service code is generated, the sequence number is added with 1, and if the digit number of the sequence number is less than 4, the sequence number is complemented with 0. The service codes which can be generated according to the coding rule are as follows: BXTX2021005, BXJT 2021006. Wherein BX is a fixed character string, TX indicates that the reimbursement form is communication, JT indicates that the reimbursement form is traffic, 2020 and 2021 are years, and 0005 and 0006 are sequence numbers. This encoding rule contains two expression fields, for a total of 4 fields in the encoded segment list.
It can be seen that, in each encoding rule, the encoding segment list may include a plurality of fields of different types, and when generating an encoding, the values of the fields are generated according to the information specified in the fields of the encoding segment list, and then the values of the fields are assembled into a service encoding according to a predefined sequence.
S200, when a business system receives a code generation requirement of a user, calling a code generation service of a code client to enable the code generation service to obtain a code rule corresponding to the code generation requirement from the distributed cache, sending the rule ID, the continuous identification and the setting parameters of sequence number fields in the code rule to a code server, so that when the continuous identification of the code server is a first value, a broken number under the rule ID is searched in a code library, if the broken number is searched, returning the broken number to the code client, and deleting the broken number from the code library; the coding client takes the break number as the service code and returns the service code to the service system; the break number is a service code deleted before the service system, and the first value is used for representing that the service code requirement is continuous.
It can be understood that a user can perform various operations such as generating a service code and deleting the service code in a service system, the user cannot perceive a coding client and a coding server, and the coding client and the coding server provide services for the service system to realize operations such as generating the service code and deleting the service code. Calling the code generation service of the code client is equivalent to calling a code generation interface, and the code generation service of the code client can generate the service code by combining the sequence number generation service of the code server. The code release service of the code client is called equivalently to a code release interface, and the code release service of the code client can be combined with the code release service of the code server to release the service codes corresponding to the code rules continuously identified as the first value, namely the service codes are stored as the break numbers for subsequent preferential use.
When a user puts forward a code generation requirement in a service system, the service system calls a code generation service of a code client, the code generation service acquires a required code rule from a distributed cache at the moment, the acquired code rule comprises a rule ID, a continuous identifier and a code segment list, and the code generation service transmits setting parameters of sequence number fields in the rule ID, the continuous identifier and the code segment list to a code service terminal. And after receiving the information, the coding service end calls the sequence number to generate service. The sequence number generation service determines whether the consecutive identity is a first value or a second value. If the continuous identifier is the first value, the sequence number generation service searches the break number in the coding library, wherein the break number is the service code deleted by the user before, and because the continuous identifier is the first value, the requirement of the coding rule on the continuity of the service code is shown, the break number is searched first, and the break number is preferentially adopted as the service code. If the broken number is found, the broken number is returned to the coding client side, and the broken number in the coding library is deleted. And when the coding client receives the break number, directly returning the break number serving as the service code to the service system.
The coding library comprises all sequence numbers and break numbers generated by a coding server, wherein the break numbers are complete service codes, and the sequence numbers do not comprise values in a constant field and an expression field.
In specific implementation, S200 provided by the present invention may further include:
under the condition that the continuous identification is the first value, if the coding server side does not find a broken number, searching the current maximum sequence number under the rule ID in the coding library, generating a new maximum sequence number according to the step length and the current maximum sequence number, storing the new maximum sequence number in the coding library, and returning the new maximum sequence number to the coding client side; the coding client takes the new maximum sequence number as a value corresponding to the sequence number field, generates a value corresponding to the constant field and a value corresponding to the expression field according to the service data corresponding to the coding generation requirement and the coding rule, generates a corresponding service code according to the value corresponding to each field, and returns the service code to the service system; the code library stores the break number and the sequence number generated by the code server.
That is, if the consecutive identifier is the first value, and the sequence number generation service of the encoding service end does not find the break number under the rule ID in the encoding library, that is, for each service code generated by the encoding rule of the rule ID, no deletion operation is performed, and all service codes are consecutive. At this time, each sequence number corresponding to the rule ID may be searched in the coding library, the largest sequence number may be found, and a new sequence number may be generated on the basis of the largest sequence number, for example, if the largest sequence number in the coding library is 0004, the new sequence number generated after increasing step size 1 is 0005, and 0005 is taken as the new largest sequence number. And sending the new maximum sequence number to the coding client, wherein the coding generation service of the coding client takes the new maximum sequence number as a value corresponding to the sequence number field. The value corresponding to the constant field can be determined according to the coding rule, the service data is input into the expression of the expression field, the value corresponding to the expression field can be obtained, and therefore the value of each field is assembled into the corresponding service code according to the sequence of the constant field, the expression field and the sequence number field. The service code is then returned to the service system.
Of course, if the first service encoding is performed for one encoding rule, the sequence number corresponding to the rule ID does not exist in the encoding library. At this time, S200 may further include:
and under the condition that the continuous identifier is the first value, if the sequence number under the rule ID is not found in the coding server, storing the initial number into the coding library, and returning the initial number serving as the current maximum sequence number to the coding client.
That is to say, the sequence number generating service of the encoding server finds that no sequence number corresponding to the rule ID exists in the encoding library, and at this time, the start number is used as the current maximum sequence number, the sequence number is stored in the encoding library, and then the maximum sequence number is returned to the encoding client, so that the encoding generating service of the encoding client uses the received maximum sequence number as a value corresponding to a sequence number field, determines a value corresponding to a constant field according to the encoding rule, inputs the service data into an expression of an expression field, obtains a value corresponding to the expression field, and assembles the values of the fields into the corresponding service code according to the sequence of the constant field, the expression field and the sequence number field. The service code is then returned to the service system.
Of course, if the consecutive flag is the second value, it indicates that the corresponding coding rule has no requirement for the continuity of the service coding, and therefore, it is not necessary to query the number of the interruption, and the new maximum sequence number may be generated directly on the basis of the current maximum sequence number, that is, S200 may further include:
when the continuous identification is a second value, the coding server searches the current maximum sequence number under the rule ID in the coding library, generates a new maximum sequence number according to the maximum sequence number and the step length in the setting parameter, generates a new maximum sequence number according to the step length and the current maximum sequence number, stores the new maximum sequence number into the coding library, and returns the new maximum sequence number to the coding client; the coding client takes the new maximum sequence number as a value corresponding to the sequence number field, generates a value corresponding to the constant field and a value corresponding to the expression field according to the service data corresponding to the coding generation requirement and the coding rule, generates a corresponding service code according to the value corresponding to each field, and returns the service code to the service system; the code library stores the break number and the sequence number generated by the code server; the second value is used to characterize that the traffic coding does not require continuity.
That is, if the continuous identifier in the encoding rule is the second value, and there is no requirement for the continuity of the service code, at this time, the encoding server may directly search the maximum sequence number under the rule ID in the encoding library, add the maximum sequence number and the step length to obtain a new maximum sequence number, then store the new maximum sequence number in the encoding library, and return the new maximum sequence number to the encoding client, where the encoding client uses the new maximum sequence number as the value of the sequence number field, and also generates the value corresponding to the constant field and the value corresponding to the expression field, and then assembles the value into the service code according to a certain sequence, and finally returns the service code to the service system.
Certainly, under the condition that the continuous identifier is the second value, if the sequence number under the rule ID is not found in the coding server, it indicates that the service code under the rule ID is generated for the first time, and at this time, there is no sequence number under the rule ID, at this time, the start number may be stored in the coding library as the maximum sequence number, and the maximum sequence number is returned to the coding client to participate in the generation of the service code.
It can be seen that when the continuous identifier is the first value and the second value, the manner of generating the sequence number by the coding service end is different, and for the continuous identifier is the first value, the coding service end needs to search for the broken number first, selects the current maximum sequence number under the rule ID in the coding library when the number is not broken, and takes the start number as the current maximum sequence number to participate in the generation of the service code when the sequence number corresponding to the rule ID does not exist in the coding library. And when the continuous identification is the second value, the coding server does not need to search the broken number, but directly selects the current maximum sequence number under the rule ID from the coding library, and takes the initial number as the current maximum sequence number to participate in the generation of the service coding when the sequence number corresponding to the rule ID does not exist in the coding library.
In specific implementation, the method provided by the invention can further comprise the following steps:
s300, when a business system receives a data deletion requirement of a user, calling a code release service of the code client so that the code release service acquires a code rule corresponding to the data deletion requirement from the distributed cache, and if a continuous identifier in the code rule is the first value, sending a rule ID in the code rule and a business code corresponding to the data deletion requirement to the code server so as to call the code release service of the code server, wherein the code release service is used for storing the business code as a broken number in the code library.
It can be understood that when a user puts forward a data deletion request in a service system, in addition to deleting corresponding service data, it is further necessary to determine whether the corresponding service code needs to be stored as a broken number. Therefore, the code release service of the coding client needs to be called at this time, after the code release service of the coding client acquires the coding rule from the distributed cache, whether the continuous identifier in the coding rule is a first value or a second value can be known, if the continuous identifier is the first value, the rule ID and the service code are sent to the coding server, and the code release service of the coding server stores the service code under the rule ID in the coding library.
For example, when the reimbursement receipt needs to be deleted, the business system calls the code release service of the code client, and if the continuous identifier in the code rule obtained from the distributed cache is the first value, the rule ID and the business code are transmitted to the code server, so that the code release service of the code server stores the business code in the code library under the rule ID. Taking the deletion of BXJT2021002 as an example, after data is deleted, the service code of the document is stored in the code library as a break number. When the code generation service is called twice in succession again, the service system will get numbers BXJT2021002 and BXJT2021004, where BXJT2021002 is the open number of release and BXJT2021004 is the newly generated sequence number.
In summary, the encoding client may provide an encoding generation service and an encoding release service. The coding service end can provide a sequence number generation service and a coding release service. The code generation service of the code client and the sequence number generation service of the code server jointly complete the code generation service, and the code release service of the code client and the code release service of the code server jointly provide the code release service.
According to the business code generation method provided by the invention, after the coding server side configures the coding rules, the coding rules are stored in the distributed cache so as to be downloaded by each coding client side when needed, so that the sharing of the coding rules of a plurality of coding client sides is realized. When the continuous identification is the first value, firstly, the broken number is searched under the rule ID in the coding library, and the broken number is preferentially used as the service code, so that the continuity of the service code under the same rule ID in the distributed deployment mode is ensured, the repeated number cannot occur, and the broken number generated by deletion is reduced.
Meanwhile, because the coding rule comprises the coding section list, various different types of coding rules can be flexibly obtained by configuring a plurality of fields in the coding section list, various coding generation requirements are further used, codes do not need to be compiled aiming at each business code, the workload of business personnel is reduced, later-stage adjustment is convenient, and the flexibility is strong. Moreover, the user only needs to operate in the service system, the coding client and the coding server assist the service system to realize various operations such as coding generation and release, and the user cannot perceive the coding client and the coding server, so that the operation is simple and convenient.
In a second aspect, the present invention provides a service code generation system, which includes a coding server, a coding client and a service system, wherein:
the coding server is used for: configuring coding rules corresponding to various services at a coding server in advance by personnel, and synchronizing the coding rules into a distributed cache for storage; the coding rule comprises a rule ID, a continuous identifier and a coding segment list, wherein the rule ID is a unique identifier of the coding rule, the continuous identifier is used for representing whether a service code generated according to the service code requires continuity, the coding segment list is used for describing each component in the service code, the coding segment list at least comprises a sequence number field, and the sequence number field comprises setting parameters of a sequence number;
the service system is used for: when receiving a code generation requirement of a user, calling a code generation service of a code client so that the code generation service acquires a code rule corresponding to the code generation requirement from the distributed cache, sending the rule ID, the continuous identification and the setting parameters of the sequence number field in the code rule to the code server, so that when the continuous identification of the code server is a first value, a broken number under the rule ID is searched in a code library, if the broken number is searched, returning the broken number to the code client, and deleting the broken number from the code library; the coding client takes the break number as the service code and returns the service code to the service system; the break number is a service code deleted before the service system, and the first value is used for representing that the service code requirement is continuous.
In some embodiments, the code segment list further includes a constant field and an expression field, the constant field is used to specify a constant string in the service code, the expression field is used to specify a generation manner of at least one preset variable in the service code, and the setting parameter includes a start number and a step size;
the coding server is further configured to: under the condition that the continuous identification is the first value, if a disconnected number is not found, searching the current maximum sequence number under the rule ID in the coding library, generating a new maximum sequence number according to the step length and the current maximum sequence number, storing the new maximum sequence number in the coding library, and returning the new maximum sequence number to the coding client; the coding client takes the new maximum sequence number as a value corresponding to the sequence number field, generates a value corresponding to the constant field and a value corresponding to the expression field according to the service data corresponding to the coding generation requirement and the coding rule, generates a corresponding service code according to the value corresponding to each field, and returns the service code to the service system; the code library stores the break number and the sequence number generated by the code server.
In some embodiments, the encoding server is further configured to: and under the condition that the continuous identifier is the first value, if the sequence number under the rule ID is not found, storing the starting number into the coding library, and returning the starting number serving as the current maximum sequence number to the coding client.
In some embodiments, the encoding server is further configured to: when the continuous identification is a second value, searching the current maximum sequence number under the rule ID in the coding library, generating a new maximum sequence number by using the maximum sequence number and the step length in the setting parameter, generating a new maximum sequence number according to the step length and the current maximum sequence number, storing the new maximum sequence number into the coding library, and returning the new maximum sequence number to the coding client; the coding client takes the new maximum sequence number as a value corresponding to the sequence number field, generates a value corresponding to the constant field and a value corresponding to the expression field according to the service data corresponding to the coding generation requirement and the coding rule, generates a corresponding service code according to the value corresponding to each field, and returns the service code to the service system; the code library stores the break number and the sequence number generated by the code server; the second value is used to characterize that the traffic coding does not require continuity.
It is understood that, in the system provided in the embodiment of the present invention, for the explanation, examples, and beneficial effects of the related contents, reference may be made to the corresponding parts in the above method, and details are not described here.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Those skilled in the art will recognize that, in one or more of the examples described above, the functions described in this disclosure may be implemented in hardware, software, hardware, or any combination thereof. When implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium.
The above-mentioned embodiments, objects, technical solutions and advantages of the present invention are further described in detail, it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made on the basis of the technical solutions of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method for generating service codes, comprising:
configuring coding rules corresponding to multiple services at a coding server in advance, and synchronizing the coding rules to a distributed cache for storage; the coding rule comprises a rule ID, a continuous identifier and a coding segment list, wherein the rule ID is a unique identifier of the coding rule, the continuous identifier is used for representing whether a service code generated according to the service code requires continuity, the coding segment list is used for describing each component in the service code, the coding segment list at least comprises a sequence number field, and the sequence number field comprises setting parameters of a sequence number;
when a business system receives a code generation requirement of a user, calling a code generation service of a code client to enable the code generation service to acquire a code rule corresponding to the code generation requirement from the distributed cache, sending the rule ID, the continuous identification and the setting parameters of sequence number fields in the code rule to a code server, so that when the continuous identification of the code server is a first value, a broken number under the rule ID is searched in a code library, if the broken number is searched, returning the broken number to the code client, and deleting the broken number from the code library; the coding client takes the break number as the service code and returns the service code to the service system; the break number is a service code deleted before the service system, and the first value is used for representing that the service code requirement is continuous.
2. The method according to claim 1, wherein the code segment list further includes a constant field and an expression field, the constant field is used for specifying a constant string in the service code, the expression field is used for specifying a generation manner of at least one preset variable in the service code, and the setting parameters include a start number and a step size; the method further comprises the following steps:
under the condition that the continuous identification is the first value, if the coding server side does not find a broken number, searching the current maximum sequence number under the rule ID in the coding library, generating a new maximum sequence number according to the step length and the current maximum sequence number, storing the new maximum sequence number in the coding library, and returning the new maximum sequence number to the coding client side; the coding client takes the new maximum sequence number as a value corresponding to the sequence number field, generates a value corresponding to the constant field and a value corresponding to the expression field according to the service data corresponding to the coding generation requirement and the coding rule, generates a corresponding service code according to the value corresponding to each field, and returns the service code to the service system; the code library stores the break number and the sequence number generated by the code server.
3. The method of claim 2, further comprising:
and under the condition that the continuous identifier is the first value, if the sequence number under the rule ID is not found in the coding server, storing the initial number into the coding library, and returning the initial number serving as the current maximum sequence number to the coding client.
4. The method of claim 2, further comprising:
when the continuous identification is a second value, the coding server searches the current maximum sequence number under the rule ID in the coding library, generates a new maximum sequence number according to the maximum sequence number and the step length in the setting parameter, generates a new maximum sequence number according to the step length and the current maximum sequence number, stores the new maximum sequence number into the coding library, and returns the new maximum sequence number to the coding client; the coding client takes the new maximum sequence number as a value corresponding to the sequence number field, generates a value corresponding to the constant field and a value corresponding to the expression field according to the service data corresponding to the coding generation requirement and the coding rule, generates a corresponding service code according to the value corresponding to each field, and returns the service code to the service system; the code library stores the break number and the sequence number generated by the code server; the second value is used to characterize that the traffic coding does not require continuity.
5. The method of claim 4, further comprising:
and under the condition that the continuous identifier is the second value, if the sequence number under the rule ID is not found in the coding server, storing the initial number into the coding library, and returning the initial number serving as the current maximum sequence number to the coding client.
6. The method of claim 1, further comprising:
when a business system receives a data deletion requirement of a user, calling a code release service of a code client to enable the code release service of the code client to acquire a code rule corresponding to the data deletion requirement from the distributed cache, and if a continuous identifier in the code rule is the first value, sending a rule ID in the code rule and a business code corresponding to the data deletion requirement to the code server to call the code release service of the code server, so that the code release service of the code server stores the business code as a broken number in the code library.
7. A service code generation system is characterized by comprising a code server, a code client and a service system, wherein:
the coding server is used for: configuring coding rules corresponding to various services at a coding server in advance by personnel, and synchronizing the coding rules into a distributed cache for storage; the coding rule comprises a rule ID, a continuous identifier and a coding segment list, wherein the rule ID is a unique identifier of the coding rule, the continuous identifier is used for representing whether a service code generated according to the service code requires continuity, the coding segment list is used for describing each component in the service code, the coding segment list at least comprises a sequence number field, and the sequence number field comprises setting parameters of a sequence number;
the service system is used for: when receiving a code generation requirement of a user, calling a code generation service of a code client so that the code generation service acquires a code rule corresponding to the code generation requirement from the distributed cache, sending the rule ID, the continuous identification and the setting parameters of the sequence number field in the code rule to the code server, so that when the continuous identification of the code server is a first value, a broken number under the rule ID is searched in a code library, if the broken number is searched, returning the broken number to the code client, and deleting the broken number from the code library; the coding client takes the break number as the service code and returns the service code to the service system; the break number is a service code deleted before the service system, and the first value is used for representing that the service code requirement is continuous.
8. The system according to claim 7, wherein the code segment list further includes a constant field and an expression field, the constant field is used for specifying a constant string in the service code, the expression field is used for specifying a generation manner of at least one preset variable in the service code, and the setting parameters include a start number and a step size;
the coding server is further configured to: under the condition that the continuous identification is the first value, if a disconnected number is not found, searching the current maximum sequence number under the rule ID in the coding library, generating a new maximum sequence number according to the step length and the current maximum sequence number, storing the new maximum sequence number in the coding library, and returning the new maximum sequence number to the coding client; the coding client takes the new maximum sequence number as a value corresponding to the sequence number field, generates a value corresponding to the constant field and a value corresponding to the expression field according to the service data corresponding to the coding generation requirement and the coding rule, generates a corresponding service code according to the value corresponding to each field, and returns the service code to the service system; the code library stores the break number and the sequence number generated by the code server.
9. The system of claim 8, wherein the encoding server is further configured to: and under the condition that the continuous identifier is the first value, if the sequence number under the rule ID is not found, storing the starting number into the coding library, and returning the starting number serving as the current maximum sequence number to the coding client.
10. The system of claim 8, wherein the encoding server is further configured to: when the continuous identification is a second value, searching the current maximum sequence number under the rule ID in the coding library, generating a new maximum sequence number by using the maximum sequence number and the step length in the setting parameter, generating a new maximum sequence number according to the step length and the current maximum sequence number, storing the new maximum sequence number into the coding library, and returning the new maximum sequence number to the coding client; the coding client takes the new maximum sequence number as a value corresponding to the sequence number field, generates a value corresponding to the constant field and a value corresponding to the expression field according to the service data corresponding to the coding generation requirement and the coding rule, generates a corresponding service code according to the value corresponding to each field, and returns the service code to the service system; the code library stores the break number and the sequence number generated by the code server; the second value is used to characterize that the traffic coding does not require continuity.
CN202111065892.XA 2021-09-13 2021-09-13 Service code generation method and system Pending CN113935285A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111065892.XA CN113935285A (en) 2021-09-13 2021-09-13 Service code generation method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111065892.XA CN113935285A (en) 2021-09-13 2021-09-13 Service code generation method and system

Publications (1)

Publication Number Publication Date
CN113935285A true CN113935285A (en) 2022-01-14

Family

ID=79275539

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111065892.XA Pending CN113935285A (en) 2021-09-13 2021-09-13 Service code generation method and system

Country Status (1)

Country Link
CN (1) CN113935285A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115757413A (en) * 2022-11-23 2023-03-07 中电金信软件有限公司 Data encoding method and device and electronic equipment
CN116306503A (en) * 2023-05-16 2023-06-23 中科科界(北京)科技有限公司 Member number generation method and device and computer equipment

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115757413A (en) * 2022-11-23 2023-03-07 中电金信软件有限公司 Data encoding method and device and electronic equipment
CN115757413B (en) * 2022-11-23 2024-01-19 中电金信软件有限公司 Data coding method and device and electronic equipment
CN116306503A (en) * 2023-05-16 2023-06-23 中科科界(北京)科技有限公司 Member number generation method and device and computer equipment

Similar Documents

Publication Publication Date Title
CN110119292B (en) System operation parameter query method, matching method, device and node equipment
US8706857B2 (en) Information processing apparatus, information processing method, data management server and data synchronization system
CN113935285A (en) Service code generation method and system
US20170031948A1 (en) File synchronization method, server, and terminal
CN102769640B (en) The update method of user profile, server and system
CN110046062B (en) Distributed data processing method and system
US8719357B2 (en) Method and apparatus for managing message
CN109145060B (en) Data processing method and device
CN112363845A (en) Data synchronization method of system integration middling station and integration middling station system
CN113835369A (en) Edge terminal scene management method, device and system
CN104967653A (en) Data synchronous drawing and issuing method and apparatus
CN114020840A (en) Data processing method, device, server, storage medium and product
CN111061745A (en) Data synchronization system and method
US20180302404A1 (en) Method for processing data request and system therefor, access device, and storage device
CN110045983B (en) Version library management method and device and server
CN110798358B (en) Distributed service identification method and device, computer readable medium and electronic equipment
CN104717280A (en) Data synchronism marking method and device
CN103034632A (en) Information transmitting method and a system
CN114996361B (en) Data processing method and system
CN110865973B (en) Data processing method and equipment and related device
CN105657444A (en) Query and search method, device and system for business data
CN109325057B (en) Middleware management method, device, computer equipment and storage medium
KR101298852B1 (en) Method of restoring file and system for the same
CN114567644B (en) Data synchronization method and device and electronic equipment
CN113821704B (en) Method, device, electronic equipment and storage medium for constructing index

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