[go: up one dir, main page]

CN112860755A - Service identifier generation method, device, computer equipment and medium - Google Patents

Service identifier generation method, device, computer equipment and medium Download PDF

Info

Publication number
CN112860755A
CN112860755A CN202110303355.8A CN202110303355A CN112860755A CN 112860755 A CN112860755 A CN 112860755A CN 202110303355 A CN202110303355 A CN 202110303355A CN 112860755 A CN112860755 A CN 112860755A
Authority
CN
China
Prior art keywords
service
identifier
generated
configuration data
prefix
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
CN202110303355.8A
Other languages
Chinese (zh)
Other versions
CN112860755B (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.)
Ping An Commercial Factoring Co ltd
Original Assignee
Ping An Commercial Factoring 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 Ping An Commercial Factoring Co ltd filed Critical Ping An Commercial Factoring Co ltd
Priority to CN202110303355.8A priority Critical patent/CN112860755B/en
Publication of CN112860755A publication Critical patent/CN112860755A/en
Application granted granted Critical
Publication of CN112860755B publication Critical patent/CN112860755B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2457Query processing with adaptation to user needs
    • G06F16/24573Query processing with adaptation to user needs using data annotations, e.g. user-defined metadata
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Library & Information Science (AREA)
  • Computational Linguistics (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present application relates to the field of big data technologies, and in particular, to a method and an apparatus for generating a service identifier, a computer device, and a storage medium. The method comprises the following steps: receiving a generation request for generating a service identifier, wherein the generation request carries a service name corresponding to a service corresponding to the service identifier to be generated; acquiring corresponding configuration data and the generated number of generated service identifiers based on the service name; generating a prefix identifier and a suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the generation quantity; and combining the prefix identification and the suffix identification to obtain the service identification. By adopting the method, the generation efficiency and accuracy of the service identifier can be improved. The application also relates to the technical field of block chains, and the data such as a request for generation, configuration data, the count number of generated service identifiers, a prefix identifier, a suffix identifier, a service identifier and the like can be uploaded to a block chain node.

Description

Service identifier generation method, device, computer equipment and medium
Technical Field
The present application relates to the field of big data technologies, and in particular, to a method, an apparatus, a computer device, and a medium for generating a service identifier.
Background
In complex business systems, it is often necessary to identify each business using a meaningful and ordered serial number to identify the uniqueness of each business, e.g., for identifying a large number of orders, accounts, etc.
In a traditional manner, a service identifier is generated based on a service system parameter, such as a database ID or a machine clock, which has a high requirement on a service system and a strong coupling, and when the database is abnormal or the machine clock is changed, the generation of the service identifier is easily abnormal.
Disclosure of Invention
In view of the foregoing, it is necessary to provide a service identifier generating method, a device, a computer device, and a medium, which can improve the generating efficiency and accuracy of the service identifier.
A method for generating service identification, the method comprising:
receiving a generation request for generating a service identifier, wherein the generation request carries a service name corresponding to a service corresponding to the service identifier to be generated;
acquiring corresponding configuration data and the generated number of generated service identifiers based on the service name;
generating a prefix identifier and a suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the generation quantity;
and combining the prefix identification and the suffix identification to obtain the service identification.
In one embodiment, generating a prefix identifier and a suffix identifier of a service identifier to be generated corresponding to a generation request according to configuration data and a generation number includes:
determining a prefix generation requirement of the service identifier to be generated corresponding to the generation request according to the configuration data, and generating the prefix identifier of the service identifier to be generated based on the prefix generation requirement;
determining the suffix length of the service identifier to be generated based on the configuration data;
and generating the suffix identifier of the service identifier to be generated according to the suffix length and the generation number.
In one embodiment, the obtaining of the corresponding configuration data and the generated number of the generated service identifiers includes:
acquiring corresponding configuration data from a distributed system and the generation quantity of generated service identifiers corresponding to the generation request;
before generating a prefix identifier and a suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the generation quantity, the method further comprises the following steps:
acquiring an update count for updating the local database according to the configuration data;
judging whether the generated number is smaller than the update count;
and when the generated number is smaller than the update count, updating the generated number in the distributed system, and continuously generating a prefix identifier and a suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the updated generated number.
In one embodiment, the method further includes:
and storing the service identification in the distributed system.
In one embodiment, after determining whether the generation number is smaller than the update count, the method further includes:
when the generated number is determined to be larger than or equal to the updating count, acquiring the generated service identifier stored in the distributed system, and writing the generated service identifier into a local database;
and updating the generated number in the distributed system according to the updated count, and generating a prefix identifier and a suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the updated generated number.
In one embodiment, before obtaining the corresponding configuration data and the generated number of the generated service identifiers based on the service name, the method further includes:
inquiring whether a corresponding target name exists in the distributed system or not according to the business name;
and when the corresponding target name does not exist in the distributed system, creating the target name corresponding to the business name, and setting an initial value of the generation quantity of the generated business identification corresponding to the target name.
In one embodiment, the method further includes:
and uploading at least one of the generation request, the configuration data, the count number of the generated service identifiers, the prefix identifiers, the suffix identifiers and the service identifiers to the blockchain node for storage.
A service invocation monitoring apparatus, said apparatus comprising:
the receiving module is used for receiving a generation request for generating a service identifier, wherein the generation request carries a service name corresponding to a service corresponding to the service identifier to be generated;
the acquisition module is used for acquiring corresponding configuration data and the generated number of the generated service identifiers based on the service name;
the generating module is used for generating a prefix identifier and a suffix identifier of the service identifier to be generated corresponding to the generating request according to the configuration data and the generating quantity;
and the combination module is used for combining the prefix identifier and the suffix identifier to obtain the service identifier.
A computer device comprising a memory storing a computer program and a processor executing the steps of the method of any preceding claim.
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 of any of the above.
The service identifier generation method, the device, the computer equipment and the medium receive a generation request for generating the service identifier, the generation request carries a service name corresponding to a service corresponding to the service identifier to be generated, corresponding configuration data and the generated number of the generated service identifiers are obtained based on the service name, a prefix identifier and a suffix identifier corresponding to the service identifier to be generated are generated according to the configuration data and the generated number, and the prefix identifier and the suffix identifier are combined to obtain the service identifier. Therefore, the prefix identification and the suffix identification can be generated according to the acquired corresponding configuration data and the counting number, and then the service identification is generated.
Drawings
Fig. 1 is an application scenario diagram of a service identifier generation method in an embodiment;
fig. 2 is a schematic flow chart of a service identifier generation method in an embodiment;
fig. 3 is a block diagram showing a structure of a service identifier generating apparatus according to an embodiment;
FIG. 4 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail 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.
The service identifier generation method provided by the application can be applied to the application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. A user generates a request for generating a service identifier through the terminal 102, and then sends the request to the server 104, where the request carries a service name corresponding to a service corresponding to the service identifier to be generated. After receiving the generation request, the server 104 may obtain the corresponding configuration data and the generated number of the generated service identifiers based on the service name, and then generate the prefix identifier and the suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the generated number. Further, the server 104 may combine the prefix identifier and the suffix identifier to obtain the service identifier. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented by an independent server or a server cluster formed by a plurality of servers.
In an embodiment, as shown in fig. 2, a service identifier generating method is provided, which is described by taking the application of the method to the server in fig. 1 as an example, and includes the following steps:
step S202, receiving a generation request for generating a service identifier, wherein the generation request carries a service name of a service corresponding to the service identifier to be generated.
The generation request refers to a request for generating a service identifier, and the request may carry a service name of a service corresponding to the service identifier to be generated.
In this embodiment, the service may refer to various order services or account services, for example, an online shopping order, an insurance order, and the like, and the request refers to a request for generating an order identifier or an account identifier.
In this embodiment, a user may input request information through service terminals corresponding to different service systems, and then generate a corresponding generation request, and send the corresponding generation request to a server, so that the server may perform subsequent data.
Step S204, based on the service name, acquiring the corresponding configuration data and the generated number of the generated service identifier.
The configuration data refers to data which is configured in advance and has a one-to-one correspondence relationship with each service. The configuration data may include a specific generation rule or a generation requirement of the service identifier of the corresponding service.
The generated quantity refers to the quantity of the service identifiers generated by the service corresponding to the service name, for example, if the quantity of the generated service identifiers is 5 for a certain insurance order, the corresponding generated quantity is 5.
In this embodiment, the server may parse the service generation request to obtain the service name from the service generation request. For example, the server may parse the service generation request through a regular expression or a parsing template, etc.
In this embodiment, after the server obtains the service name through parsing, the server may query, according to the service name, the configuration data corresponding to the service generation request and the generated number of the generated service identifier, so as to obtain the queried configuration data and the generated number.
Step S206, generating a prefix mark and a suffix mark of the service mark to be generated corresponding to the generation request according to the configuration data and the generation quantity.
The prefix identifier is a first half identifier of the service data to be generated, and the suffix identifier represents a second half identifier of the service identifier to be generated, for example, for a service identifier "LA 2020092700000001", "LA 20200927" is a prefix identifier corresponding thereto, and "00000001" is a suffix identifier corresponding thereto.
In this embodiment, the server may determine, through the configuration data, a prefix identifier of the service identifier to be generated and a generation requirement corresponding to the suffix identifier, for example, a character length, a character composition, and the like, so that a corresponding task identifier may be generated subsequently according to a corresponding generation request.
In this embodiment, the server may determine and generate a prefix identifier and a suffix identifier corresponding to the generation request according to the acquired configuration data and the generation number.
And step S208, combining the prefix identification and the suffix identification to obtain the service identification.
Specifically, the server may combine the prefix identifier and the suffix identifier to obtain the service identifier corresponding to the generation request.
In this embodiment, the combination order of the prefix tag and the suffix tag is not limited, and the prefix tag may be preceded and the suffix tag may be preceded, or vice versa.
In the method for generating the service identifier, the generation request is received, the generation request carries the service name corresponding to the service identifier to be generated, the corresponding configuration data and the generated number of the generated service identifiers are obtained based on the service name, the prefix identifier and the suffix identifier corresponding to the service identifier to be generated are generated according to the configuration data and the generated number, and the prefix identifier and the suffix identifier are combined to obtain the service identifier. Therefore, the prefix identification and the suffix identification can be generated according to the acquired corresponding configuration data and the counting number, and then the service identification is generated.
In one embodiment, generating a prefix identifier and a suffix identifier of a service identifier to be generated corresponding to the generation request according to the configuration data and the generation number may include: determining a prefix generation requirement of the service identifier to be generated corresponding to the generation request according to the configuration data, and generating the prefix identifier of the service identifier to be generated based on the prefix generation requirement; determining the suffix length of the service identifier to be generated based on the configuration data; and generating the suffix identifier of the service identifier to be generated according to the suffix length and the generation number.
In this embodiment, the configuration data may include a service name key _ name, a service identifier length key _ length, a prefix rule key _ prefix, a suffix rule key _ suffix, and the like.
In this embodiment, the service name key _ name is used to distinguish services, such as "key _ name: the LA "service name is" LA ", different services use different key _ names, the ID of each key _ name is isolated from each other, and the ID does not influence each other. The service identifier length key _ length is used to determine the character length of the generated service identifier, for example, "key _ length: 18 "indicates that the service identification has a length of 18 characters. The prefix rule key _ prefix is used to generate a prefix of the service identification, for example, LA20$ { date6}, "LA" represents the service name, "20" represents the year "20 years", and "$ { date6 }" represents the date format yyMMdd. The suffix rule key _ suffix is used to generate a suffix of the service identification.
In this embodiment, the server may determine, according to the configuration data, a prefix generation requirement, that is, a prefix rule key _ prefix, for generating the service identifier to be generated corresponding to the generation request, and then generate, according to the prefix rule key _ prefix, a prefix identifier for generating the service identifier to be generated, for example, "key _ prefix: LA20$ { date6} ", i.e., name +20+ current date, a prefix tag of" LA20200927 "may be generated.
Further, the server may determine, according to the configuration data, a total length of the service identifier to be generated, that is, a key _ length, such as "key _ length: 18 ", then, based on the prefix tag and the total length key _ length, the length of the suffix tag is determined, for example, if the total length is 18 and the prefix tag is" LA20200927 ", that is, the prefix length is 10, then the suffix length is determined to be 8.
Further, the server may generate a suffix identifier corresponding to the suffix length according to the acquired generation number of the generated service identifiers of the service, that is, the value of key _ value, where the suffix length is 8, and the acquired generation number is 2, and then the server may add 1 to the generation number and determine that the suffix identifier is "00000003" by complementing 0.
Those skilled in the art will appreciate that the foregoing is merely exemplary, and in other embodiments, the server may generate different prefix identifiers and suffix identifiers according to different prefix rules and suffix rules, and generate service identifiers corresponding to different configuration data.
In one embodiment, the obtaining of the corresponding configuration data and the generated number of the generated service identifiers may include: and acquiring corresponding configuration data from the distributed system and the generation quantity of the generated service identification corresponding to the generation request.
Wherein, the distributed system can be a Redis system and the like.
In this embodiment, the server may store the generated service identifier and the corresponding generation number thereof in the distributed system, and when corresponding data needs to be acquired, acquire the corresponding generation number from the distributed system based on the service name key _ name.
In this embodiment, before generating the prefix identifier and the suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the generation number, the method may further include: acquiring an update count for updating the local database according to the configuration data; judging whether the generated number is smaller than the update count; and when the generated number is smaller than the update count, updating the generated number in the distributed system, and continuously generating a prefix identifier and a suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the updated generated number.
In this embodiment, the server may determine, according to the configuration data, a total count, that is, key _ cache, corresponding to updating of the local database, that is, the server may determine, by setting the configuration data, that the local database is updated after a certain amount of task identifiers are generated, for example, setting "key _ cache: and 5 'when the counting number is less than 5', generating a prefix mark and a suffix mark corresponding to the generation request according to the configuration data and the generation number, and generating a corresponding service mark according to the prefix mark and the suffix mark.
In one embodiment, after the combining the prefix identifier and the suffix identifier to obtain the service identifier, the method may further include: and storing the service identification in the distributed system.
In this embodiment, after the server generates the service identifier each time, the server may store the generated service identifier in the distributed system, so as to facilitate subsequent use.
In the above embodiment, whether the generated number is smaller than the total count number is determined by obtaining the generated number from the distributed system, and when the count number is smaller than the total count number, the service identifier is created and stored in the distributed system, so that the generated service identifier can be directly stored in the distributed system.
In one embodiment, after determining whether the generation number is smaller than the update count, the method may further include: when the generated number is determined to be larger than or equal to the updating count, acquiring the generated service identifier stored in the distributed system, and writing the generated service identifier into a local database; and updating the generated number in the distributed system according to the updated count, and generating a prefix identifier and a suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the updated generated number.
In this embodiment, after determining that the generation number is greater than or equal to the update count, the server may obtain the generated service identifier stored in the distributed system, and store the generated service identifier in the server local database.
Further, the server may adjust the update count, for example, from 5 to 10, and continue to generate the prefix identifier and the suffix identifier corresponding to the generation request according to the configuration data and the generation number, and when the next generation number reaches the adjusted update count, write the generated service identifier stored in the distributed system into the local database, thereby reducing the number of times of reading and writing the server database, reducing the reading and writing pressure of the database, and improving the stability of the database.
In this embodiment, for the service identifier stored in the local database, the server may delete the corresponding service identifier in the distributed system, so as to reduce the occupation of the service identifier stored to the local database on the distributed system, and improve the operation stability of the distributed system.
In the above embodiment, by setting the update count, when the generated number reaches the update count, the generated service identifier is obtained from the distributed system and stored in the local database, so that the read-write frequency of the local database can be reduced, the read-write pressure of the database is reduced, and the stability of the database can be further improved.
In one embodiment, before obtaining the corresponding configuration data and the generated number of the generated service identifiers based on the service name, the method may further include: inquiring whether a corresponding target name exists in the distributed system or not according to the business name; and when the corresponding target name does not exist in the distributed system, creating the target name corresponding to the business name, and setting an initial value of the generation quantity of the generated business identification corresponding to the target name.
In this embodiment, the server may add the configuration to the local database in advance, that is, "id: 1, key _ name: 'LA', key _ value: 0, key _ length: 18, key _ cache: 5, key _ prefix: 'LA 20$ { date6 }'. When the service is started, the server may acquire all configured data from the local database, and may specifically be implemented by map mapping of mybatis. The server may place the retrieved data in the ConcurrentHashMap instance.
Further, when the server receives the generation request, it may determine whether a corresponding target name exists in the redis, and when the corresponding target name does not exist in the distributed system, it may generate a record, set the key to "LA", and set the value to the initial value 0.
Then, the server may increase the value corresponding to the key "LA" in the distributed system by 1 to obtain a new value 1, and then, with "LA" as a key, find a corresponding configuration object from the ConcurrentHashMap instance, that is, obtain corresponding configuration data, and further generate a corresponding service identifier according to the configuration data and the generated number 1.
In the above embodiment, by determining whether the corresponding target name exists in the distributed system, and when it is determined that the corresponding target name does not exist, creating the target name corresponding to the service name, and setting the generated number of the corresponding generated service identifiers as an initial value, the number of the generated service identifiers corresponding to the service can be counted, and the generated service identifiers are stored, so that the read-write frequency of the database can be reduced, the processing pressure of the database can be reduced, and the stability can be improved.
In one embodiment, the method may further include: and uploading at least one of the generation request, the configuration data, the count number of the generated service identifiers, the prefix identifiers, the suffix identifiers and the service identifiers to the blockchain node for storage.
The blockchain refers to a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A Block chain (Block chain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data Block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next Block.
Specifically, the blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
In this embodiment, the server may upload and store one or more data of the generation request, the configuration data, the count number of the generated service identifiers, the prefix identifier, the suffix identifier, and the service identifier in a node of the block chain, so as to ensure privacy and security of the data.
In the above embodiment, at least one of the generation request, the configuration data, the count number of the generated service identifiers, the prefix identifier, the suffix identifier, and the service identifier is uploaded to the block chain and stored in a node of the block chain, so that the privacy of data stored in a node of the block chain can be guaranteed, and the security of the data can be improved.
It should be understood that, although the steps in the flowchart of fig. 2 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a portion of the steps in fig. 2 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 3, there is provided a service identifier generating apparatus, including: a receiving module 100, an obtaining module 200, a prefix and suffix identifier generating module 300, and a combining module 400, wherein:
the receiving module 100 is configured to receive a generation request for generating a service identifier, where the generation request carries a service name corresponding to a service corresponding to the service identifier to be generated.
An obtaining module 200, configured to obtain, based on the service name, corresponding configuration data and a generated number of the generated service identifiers.
The generating module 300 is configured to generate a prefix identifier and a suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the generation quantity.
And the combining module 400 is configured to combine the prefix identifier and the suffix identifier to obtain a service identifier.
In one embodiment, the generating module 300 may include:
and the prefix identification generation submodule is used for determining a prefix generation requirement of the service identification to be generated corresponding to the generation request according to the configuration data and generating the prefix identification of the service identification to be generated based on the prefix generation requirement.
And the suffix length determining submodule is used for determining the suffix length of the service identifier to be generated based on the configuration data.
And the suffix identifier generation submodule is used for generating the suffix identifier of the service identifier to be generated according to the suffix length and the generation quantity.
In one embodiment, the obtaining module 200 is configured to obtain the corresponding configuration data and the generated number of the generated service identifiers corresponding to the generation request from the distributed system.
In this embodiment, the apparatus may further include:
and the update count acquisition module is used for acquiring an update count for updating the local database according to the configuration data before generating the prefix identifier and the suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the generation quantity.
And the judging module is used for judging whether the generated number is smaller than the update count.
And the first generation quantity updating module is used for updating the generation quantity in the distributed system when the generation quantity is determined to be smaller than the update count, and generating the prefix identifier and the suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the updated generation quantity.
In one embodiment, the apparatus may further include:
and the first storage module is used for combining the prefix identifier and the suffix identifier to obtain a service identifier, and then storing the service identifier into the distributed system.
In one embodiment, the apparatus may further include:
and the read-write module is used for acquiring the generated service identifier stored in the distributed system and writing the generated service identifier into the local database after judging whether the generated number is less than the update count and when the generated number is determined to be greater than or equal to the update count.
And the second generation quantity updating module is used for updating the generation quantity in the distributed system according to the update count, and generating the prefix identifier and the suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the updated generation quantity.
In one embodiment, the apparatus may further include:
and the query module is used for querying whether a corresponding target name exists in the distributed system according to the business name before acquiring the corresponding configuration data and the generated number of the generated business identifiers based on the business name.
And the configuration module is used for creating the target name corresponding to the business name and setting the initial value of the generated number of the business identifiers corresponding to the target name when the corresponding target name does not exist in the distributed system.
In one embodiment, the apparatus may further include:
and the second storage module is used for uploading at least one of the generation request, the configuration data, the count number of the generated service identifiers, the prefix identifiers, the suffix identifiers and the service identifiers to the block chain node for storage.
For specific limitations of the service identifier generating apparatus, reference may be made to the above limitations of the service identifier generating method, which is not described herein again. The modules in the service identifier generating apparatus may be implemented wholly or partially by software, hardware, or a combination 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, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 4. The computer device includes a processor, a memory, a network interface, and a database 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, 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. The database of the computer device is used for storing data such as a generation request, configuration data, the number of counts of generated service identifiers, a prefix identifier, a suffix identifier, a service identifier and the like. 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 service identification generation method.
Those skilled in the art will appreciate that the architecture shown in fig. 4 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, there is provided a computer device comprising a memory storing a computer program and a processor implementing the following steps when the processor executes the computer program: receiving a generation request for generating a service identifier, wherein the generation request carries a service name corresponding to a service corresponding to the service identifier to be generated; acquiring corresponding configuration data and the generated number of generated service identifiers based on the service name; generating a prefix identifier and a suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the generation quantity; and combining the prefix identification and the suffix identification to obtain the service identification.
In one embodiment, when the processor executes the computer program, the generating of the prefix identifier and the suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the generation number may include: determining a prefix generation requirement of the service identifier to be generated corresponding to the generation request according to the configuration data, and generating the prefix identifier of the service identifier to be generated based on the prefix generation requirement; determining the suffix length of the service identifier to be generated based on the configuration data; and generating the suffix identifier of the service identifier to be generated according to the suffix length and the generation number.
In one embodiment, the obtaining of the corresponding configuration data and the generated number of the generated service identifiers when the processor executes the computer program may include: and acquiring corresponding configuration data from the distributed system and the generation quantity of the generated service identification corresponding to the generation request.
In this embodiment, before the processor executes the computer program to generate the prefix identifier and the suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the generation number, the following steps may be further implemented: acquiring an update count for updating the local database according to the configuration data; judging whether the generated number is smaller than the update count; and when the generated number is smaller than the update count, updating the generated number in the distributed system, and continuously generating a prefix identifier and a suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the updated generated number.
In one embodiment, when the processor executes the computer program, the processor combines the prefix identifier and the suffix identifier to obtain the service identifier, and then may further implement the following steps: and storing the service identification in the distributed system.
In one embodiment, after the processor executes the computer program to determine whether the generated number is smaller than the update count, the following steps may be further implemented: when the generated number is determined to be larger than or equal to the updating count, acquiring the generated service identifier stored in the distributed system, and writing the generated service identifier into a local database; and updating the generated number in the distributed system according to the updated count, and generating a prefix identifier and a suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the updated generated number.
In one embodiment, before the processor executes the computer program to obtain the corresponding configuration data and the generated number of the generated service identifiers based on the service name, the following steps may be further implemented: inquiring whether a corresponding target name exists in the distributed system or not according to the business name; and when the corresponding target name does not exist in the distributed system, creating the target name corresponding to the business name, and setting an initial value of the generation quantity of the generated business identification corresponding to the target name.
In one embodiment, the processor when executing the computer program may further implement the following steps: and uploading at least one of the generation request, the configuration data, the count number of the generated service identifiers, the prefix identifiers, the suffix identifiers and the service identifiers to the blockchain node for storage.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of: receiving a generation request for generating a service identifier, wherein the generation request carries a service name corresponding to a service corresponding to the service identifier to be generated; acquiring corresponding configuration data and the generated number of generated service identifiers based on the service name; generating a prefix identifier and a suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the generation quantity; and combining the prefix identification and the suffix identification to obtain the service identification.
In one embodiment, when executed by a processor, the generating a prefix identifier and a suffix identifier of a service identifier to be generated corresponding to a generation request according to configuration data and a generation number may include: determining a prefix generation requirement of the service identifier to be generated corresponding to the generation request according to the configuration data, and generating the prefix identifier of the service identifier to be generated based on the prefix generation requirement; determining the suffix length of the service identifier to be generated based on the configuration data; and generating the suffix identifier of the service identifier to be generated according to the suffix length and the generation number.
In one embodiment, the computer program, when executed by the processor, implements obtaining corresponding configuration data and the generated number of generated service identifiers, and may include: and acquiring corresponding configuration data from the distributed system and the generation quantity of the generated service identification corresponding to the generation request.
In this embodiment, when the computer program is executed by the processor, before generating the prefix identifier and the suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the generation number, the following steps may be further implemented: acquiring an update count for updating the local database according to the configuration data; judging whether the generated number is smaller than the update count; and when the generated number is smaller than the update count, updating the generated number in the distributed system, and continuously generating a prefix identifier and a suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the updated generated number.
In one embodiment, when executed by a processor, the computer program implements the combination of the prefix identifier and the suffix identifier, and after obtaining the service identifier, further implements the following steps: and storing the service identification in the distributed system.
In one embodiment, after the computer program is executed by the processor to determine whether the generated number is less than the update count, the following steps may be further implemented: when the generated number is determined to be larger than or equal to the updating count, acquiring the generated service identifier stored in the distributed system, and writing the generated service identifier into a local database; and updating the generated number in the distributed system according to the updated count, and generating a prefix identifier and a suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the updated generated number.
In one embodiment, before the computer program is executed by the processor to obtain the corresponding configuration data and the generated number of the generated service identifiers based on the service name, the following steps may be further implemented: inquiring whether a corresponding target name exists in the distributed system or not according to the business name; and when the corresponding target name does not exist in the distributed system, creating the target name corresponding to the business name, and setting an initial value of the generation quantity of the generated business identification corresponding to the target name.
In one embodiment, the computer program when executed by the processor further performs the steps of: and uploading at least one of the generation request, the configuration data, the count number of the generated service identifiers, the prefix identifiers, the suffix identifiers and the service identifiers to the blockchain node for storage.
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 instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, 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 (10)

1. A method for generating service identification, the method comprising:
receiving a generation request for generating a service identifier, wherein the generation request carries a service name of a service corresponding to the service identifier to be generated;
acquiring corresponding configuration data and the generated number of generated service identifiers based on the service name;
generating a prefix identifier and a suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the generation quantity;
and combining the prefix identification and the suffix identification to obtain a service identification.
2. The method according to claim 1, wherein the generating a prefix identifier and a suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the generation number includes:
determining a prefix generation requirement of the service identifier to be generated corresponding to the generation request according to the configuration data, and generating the prefix identifier of the service identifier to be generated based on the prefix generation requirement;
determining the suffix length of the service identifier to be generated based on the configuration data;
and generating the suffix identifier of the service identifier to be generated according to the suffix length and the generated number.
3. The method of claim 1, wherein the obtaining of the corresponding configuration data and the generated number of the generated service identifiers comprises:
acquiring corresponding configuration data from a distributed system and the generation quantity of generated service identifications corresponding to the generation request;
before generating the prefix identifier and the suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the generation number, the method further includes:
acquiring an update count for updating a local database according to the configuration data;
judging whether the generation number is smaller than the update count;
and when the generated number is smaller than the update count, updating the generated number in the distributed system, and continuously generating a prefix identifier and a suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the updated generated number.
4. The method of claim 3, wherein after the combining the prefix tag and the suffix tag to obtain the service tag, the method further comprises:
and storing the service identification into the distributed system.
5. The method of claim 3, wherein after determining whether the generation number is less than the update count, further comprising:
when the generated number is determined to be greater than or equal to the update count, acquiring the generated service identifier stored in the distributed system, and writing the generated service identifier into a local database;
and updating the generated number in the distributed system according to the updating count, and continuously generating a prefix identifier and a suffix identifier of the service identifier to be generated corresponding to the generation request according to the configuration data and the updated generated number.
6. The method according to claim 1, wherein before obtaining the corresponding configuration data and the generated number of generated service identifiers based on the service name, the method further comprises:
inquiring whether a corresponding target name exists in the distributed system or not according to the business name;
and when the corresponding target name does not exist in the distributed system, creating the target name corresponding to the business name, and setting an initial value of the generation quantity of the generated business identification corresponding to the target name.
7. The method according to any one of claims 1 to 6, further comprising:
uploading at least one of the generation request, the configuration data, the count number of the generated service identifiers, the prefix identifier, the suffix identifier and the service identifier to a blockchain node for storage.
8. A service invocation monitoring device, characterized in that said device comprises:
the system comprises a receiving module, a generating module and a sending module, wherein the receiving module is used for receiving a generating request for generating a service identifier, and the generating request carries a service name corresponding to a service corresponding to the service identifier to be generated;
the acquisition module is used for acquiring corresponding configuration data and the generated number of the generated service identifiers based on the service name;
a generating module, configured to generate a prefix identifier and a suffix identifier of a service identifier to be generated, which correspond to the generation request, according to the configuration data and the generation number;
and the combination module is used for combining the prefix identification and the suffix identification to obtain the service identification.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor when executing the computer program implements the steps of the method of any one of claims 1 to 6 or 7.
10. 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 of any one of claims 1 to 6 or 7.
CN202110303355.8A 2021-03-22 2021-03-22 Service identifier generation method, device, computer equipment and medium Active CN112860755B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110303355.8A CN112860755B (en) 2021-03-22 2021-03-22 Service identifier generation method, device, computer equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110303355.8A CN112860755B (en) 2021-03-22 2021-03-22 Service identifier generation method, device, computer equipment and medium

Publications (2)

Publication Number Publication Date
CN112860755A true CN112860755A (en) 2021-05-28
CN112860755B CN112860755B (en) 2024-04-05

Family

ID=75991877

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110303355.8A Active CN112860755B (en) 2021-03-22 2021-03-22 Service identifier generation method, device, computer equipment and medium

Country Status (1)

Country Link
CN (1) CN112860755B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114281409A (en) * 2021-11-23 2022-04-05 招银云创信息技术有限公司 Counting method, apparatus, computer device, storage medium and program product
CN114896282A (en) * 2022-05-12 2022-08-12 明珠数字科技股份有限公司 A method, system and storage medium for generating periodic ID sequence for microservice system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101452387A (en) * 2008-12-09 2009-06-10 山东浪潮齐鲁软件产业股份有限公司 Service flow management method
CN104113435A (en) * 2014-07-04 2014-10-22 广州华多网络科技有限公司 Method and device for generating identifier
CN106412866A (en) * 2015-07-30 2017-02-15 三亚中兴软件有限责任公司 Phone bill generation method and apparatus
CN110750506A (en) * 2019-09-17 2020-02-04 苏宁云计算有限公司 Data object identification generation method and device, computer equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101452387A (en) * 2008-12-09 2009-06-10 山东浪潮齐鲁软件产业股份有限公司 Service flow management method
CN104113435A (en) * 2014-07-04 2014-10-22 广州华多网络科技有限公司 Method and device for generating identifier
CN106412866A (en) * 2015-07-30 2017-02-15 三亚中兴软件有限责任公司 Phone bill generation method and apparatus
CN110750506A (en) * 2019-09-17 2020-02-04 苏宁云计算有限公司 Data object identification generation method and device, computer equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114281409A (en) * 2021-11-23 2022-04-05 招银云创信息技术有限公司 Counting method, apparatus, computer device, storage medium and program product
CN114896282A (en) * 2022-05-12 2022-08-12 明珠数字科技股份有限公司 A method, system and storage medium for generating periodic ID sequence for microservice system

Also Published As

Publication number Publication date
CN112860755B (en) 2024-04-05

Similar Documents

Publication Publication Date Title
CN109474578B (en) Message checking method, device, computer equipment and storage medium
CN108573371B (en) Data approval method, device, computer equipment and storage medium
CN110647582B (en) Method, device, storage medium and computer equipment for block chain network consensus verification
CN108829781B (en) Client information query method, device, computer equipment and storage medium
WO2020186786A1 (en) File processing method and apparatus, computer device and storage medium
CN108491450B (en) Data caching method, device, server and storage medium
CN109816331B (en) Audit task processing method, audit task processing device, computer equipment and storage medium
CN110245505B (en) Data table access method, device, computer equipment and storage medium
CN111177302A (en) Business document processing method and device, computer equipment and storage medium
CN109740137B (en) Name card generation method, device, computer equipment and storage medium
CN109597571B (en) Data storage method, data reading method, data storage device, data reading device and computer equipment
CN111865691B (en) Alarm file distribution method, device, equipment and medium based on artificial intelligence
CN109597979B (en) List table generation method and device, computer equipment and storage medium
CN108717426B (en) Enterprise data updating method and device, computer equipment and storage medium
CN110213392B (en) Data distribution method and device, computer equipment and storage medium
CN111858467B (en) File data processing method, device, equipment and medium based on artificial intelligence
CN111580965A (en) Data request processing method and system
CN112783866B (en) Data reading method, device, computer equipment and storage medium
CN111177121A (en) Order data feedback method, device, computer equipment and storage medium
CN110378723B (en) Product combination relation determining method, device, computer equipment and storage medium
CN108389124B (en) Data processing method, data processing device, computer equipment and storage medium
CN112860755A (en) Service identifier generation method, device, computer equipment and medium
CN112862449A (en) Structural chemical industry bill generation method and device, computer equipment and storage medium
CN110336786B (en) Message sending method, device, computer equipment and storage medium
CN113515322A (en) Application program loading method and device, computer equipment and readable storage medium

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