CN111061678A - Service data processing method and device, computer equipment and storage medium - Google Patents

Service data processing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN111061678A
CN111061678A CN201911258724.5A CN201911258724A CN111061678A CN 111061678 A CN111061678 A CN 111061678A CN 201911258724 A CN201911258724 A CN 201911258724A CN 111061678 A CN111061678 A CN 111061678A
Authority
CN
China
Prior art keywords
data
target
key
initial
service
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
CN201911258724.5A
Other languages
Chinese (zh)
Other versions
CN111061678B (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.)
Miracle Intelligent Network Co ltd
Original Assignee
Miracle Intelligent Network 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 Miracle Intelligent Network Co ltd filed Critical Miracle Intelligent Network Co ltd
Priority to CN201911258724.5A priority Critical patent/CN111061678B/en
Publication of CN111061678A publication Critical patent/CN111061678A/en
Application granted granted Critical
Publication of CN111061678B publication Critical patent/CN111061678B/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/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/116Details of conversion of file system types or formats
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Abstract

The application relates to a business data processing method, a business data processing device, a computer device and a storage medium. The method comprises the following steps: receiving a data sending request sent by a first service end to a second service end, wherein the data sending request carries initial service data, the initial service data comprises a plurality of initial service text objects, and the initial service text objects comprise initial keys and corresponding values; acquiring a target data conversion rule corresponding to the initial service data, wherein the target data conversion rule comprises at least one of a key corresponding relation and a value corresponding relation; performing data conversion on at least one of the initial key and the corresponding value according to a target data conversion rule to obtain target service data, wherein the target service data comprises a plurality of target service text objects, and the target service text objects comprise target keys and corresponding values; and sending the target service data to the second service end. By adopting the method, the data conversion efficiency can be improved.

Description

Service data processing method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a method and an apparatus for processing service data, a computer device, and a storage medium.
Background
With the increasing development of computer technology and the internet, more and more devices can communicate with each other through communication modes such as networks. For example, data transmitted by multiple devices may be received by one service terminal.
However, because the data formats sent by different devices are different and the data format requirements corresponding to different service terminals are often different, the received data cannot be directly identified when the different service terminals perform data interaction, and the received data usually needs to be identified and used after being subjected to data conversion.
At present, the data conversion method is manually completed, and the data conversion efficiency is low.
Disclosure of Invention
In view of the above, it is necessary to provide a business data processing method, a business data processing apparatus, a computer device, and a storage medium, which can improve data conversion efficiency, in order to solve the technical problem of low data conversion efficiency.
A method for processing service data, the method comprising: receiving a data sending request sent by a first service end to a second service end, wherein the data sending request carries initial service data, the initial service data comprises a plurality of initial service text objects, and the initial service text objects comprise initial keys and corresponding values; acquiring a target data conversion rule corresponding to the initial service data, wherein the target data conversion rule comprises at least one of a key corresponding relation and a value corresponding relation; performing data conversion on at least one of the initial key and the corresponding value according to the target data conversion rule to obtain target service data, wherein the target service data comprises a plurality of target service text objects, and the target service text objects comprise target keys and corresponding values; and sending the target service data to the second service terminal.
In some embodiments, the obtaining of the target data conversion rule corresponding to the initial service data includes: acquiring a rule keyword in the initial service data; acquiring a candidate data conversion rule set, wherein the candidate data conversion rule set comprises a plurality of candidate data conversion rules; and according to the rule keyword, acquiring a candidate data conversion rule corresponding to the rule keyword from the candidate data conversion rule set, and using the candidate data conversion rule as a target data conversion rule corresponding to the initial service data.
In some embodiments, the data converting at least one of the initial key and the corresponding value according to the target data conversion rule to obtain the target service data includes: acquiring target keys corresponding to the plurality of initial keys in the target data conversion rule respectively, wherein the target keys comprise father keys and corresponding son keys; forming a first key value pair according to the values corresponding to the sub-keys and the initial key; and taking the first key value pairs with the same corresponding parent keys as values, and taking the corresponding parent keys as keys to obtain the target service data.
In some embodiments, the obtaining of the target key corresponding to each of the plurality of initial keys in the target data conversion rule includes: acquiring target keys corresponding to a plurality of attributes in the target data conversion rule respectively; forming a first key-value pair according to the values corresponding to the sub-keys and the initial key, including; forming a first key-value pair according to the sub-keys and attribute data corresponding to the attributes; combining first key values which are the same with a plurality of corresponding parent keys to serve as values, and taking the parent key which represents the attribute type corresponding to the attribute as a key to obtain a second key value pair; and obtaining the target service data according to the second key value pair.
In some embodiments, the target device is a display screen, the attribute of the target device includes brightness and temperature of the display screen, the attribute data of the target device includes brightness data corresponding to the brightness and temperature data corresponding to the temperature, and the target key corresponding to the brightness and the parent key corresponding to the target key corresponding to the temperature are identifiers of the data of the display screen defined by the second service end.
In some embodiments, the data converting at least one of the initial key and the corresponding value according to the target data conversion rule to obtain the target service data includes: acquiring a target key corresponding to the initial key in the target data conversion rule; combining values corresponding to a plurality of the initial keys into an array; and combining the target key as a key and the array as values to obtain a key value pair, and obtaining the target service data according to the key value pair.
A traffic data processing apparatus, the apparatus comprising: a data sending request receiving module, configured to receive a data sending request sent by a first service end to a second service end, where the data sending request carries initial service data, the initial service data includes multiple initial service text objects, and each initial service text object includes an initial key and a corresponding value; a target data conversion rule obtaining module, configured to obtain a target data conversion rule corresponding to the initial service data, where the target data conversion rule includes at least one of a key correspondence relationship and a value correspondence relationship; a target service data obtaining module, configured to perform data conversion on at least one of the initial key and the corresponding value according to the target data conversion rule to obtain target service data, where the target service data includes a plurality of target service text objects, and the target service text objects include a target key and a corresponding value; and the target service data sending module is used for sending the target service data to the second service end.
In some embodiments, the initial service data carries a rule keyword, and the target data conversion rule obtaining module includes: a rule keyword obtaining unit, configured to obtain a rule keyword in the initial service data; a candidate data conversion rule set obtaining unit, configured to obtain a candidate data conversion rule set, where the candidate data conversion rule set includes a plurality of candidate data conversion rules; and a target data conversion rule obtaining unit, configured to obtain, according to the rule keyword, a candidate data conversion rule corresponding to the rule keyword from the candidate data conversion rule set, and use the candidate data conversion rule as the target data conversion rule corresponding to the initial service data.
A computer device comprises a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the service data processing method when executing the computer program.
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 above-mentioned service data processing method.
The service data processing method, the device, the computer equipment and the storage medium receive a data sending request sent by a first service end to a second service end, the data sending request carries initial service data, the initial service data comprises a plurality of initial service text objects, the initial service text objects comprise initial keys and corresponding values, a target data conversion rule corresponding to the initial service data is obtained, at least one of the initial keys and the corresponding values is subjected to data conversion according to the target data conversion rule, target service data is obtained, the target service data comprises a plurality of target service text objects, the target service text objects comprise target keys and corresponding values, and the target service data is sent to the second service end. The target data conversion rule comprises at least one of the key corresponding relation and the value corresponding relation, so that data conversion can be automatically completed according to the target data conversion rule, and the data conversion efficiency is improved.
Drawings
Fig. 1 is an application scenario diagram of a service data processing method in some embodiments;
FIG. 2 is a flow diagram of a method for processing service data in some embodiments;
FIG. 3 is a schematic flow chart of a target data transformation rule obtaining step in some embodiments;
FIG. 4 is a schematic flow chart of a target service data obtaining step in some embodiments;
FIG. 5 is a schematic flow chart of a target service data obtaining step in some embodiments;
FIG. 6 is a schematic diagram of a business data processing method in some embodiments;
FIG. 7 is a block diagram of a business data processing apparatus in some embodiments;
FIG. 8 is a diagram of the internal structure of a computer device in some embodiments.
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 data processing method provided by the application can be applied to the application environment shown in fig. 1. The environment includes a first service end 102, a data conversion module 104, and a second service end 106. The first service end 102 communicates with the data conversion module 104 through a wired or wireless communication mode, and the data conversion module 104 communicates with the second service end 106 through a wired or wireless communication mode.
Specifically, the first service end 102 may perform data receiving and sending with the second service end 106 through the data conversion module 104, where the data conversion module 104 is configured to convert the service data sent by the first service end 102 or the second service end 106 to obtain converted service data, and then output the converted service data. When the first service end 102 needs to send data to the second service end 106, the first service end 102 may send a data sending request carrying initial service data to the data conversion module 104, where the initial service data includes a plurality of initial service text objects, the initial service text objects may include an initial key and a corresponding value, the initial service data may carry a data conversion rule identifier to instruct the data conversion module 104 to convert the initial service data into the required service data, the data conversion module 104 may receive the data sending request and obtain the data conversion rule identifier carried in the initial service data, and obtain a corresponding data conversion rule from an existing data conversion rule according to the data conversion rule identifier, where the data conversion rule may include at least one of a key correspondence relationship and a value correspondence relationship, and the data conversion module 104 may obtain a key or value correspondence relationship in the obtained data conversion rule, and converting the initial service data to obtain converted service data, and sending the converted service data to a second service end.
The first service end 102 may be various monitored devices, such as a display screen, an air conditioner, a street lamp, and the like. The second service end 106 may be a monitoring device, and may be but is not limited to various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and of course, the second service end 106 may also be implemented by an independent server or a server cluster formed by a plurality of servers. There may be more than one first service end 102 and more than one second service end 106.
It is to be understood that the above application scenario is only an example, and does not constitute a limitation to the method provided in the embodiment of the present application, and the method provided in the embodiment of the present application may also be applied in other scenarios, for example, the data conversion module may be a part of the second service end, or the data conversion module may be a part of the first service end.
In some embodiments, as shown in fig. 2, a service data processing method is provided, which is described by taking the method as an example applied to the data conversion module 104 in fig. 1, and includes the following steps:
s202, receiving a data sending request sent by a first service end to a second service end, wherein the data sending request carries initial service data, the initial service data comprises a plurality of initial service text objects, and the initial service text objects comprise initial keys and corresponding values.
Specifically, the data sending request is used for triggering the data conversion module to convert the initial service data carried in the request, and sending the converted data to the second service end. The initial key is a field defined by the first service end, and the first service end identifies data to be sent, namely a value corresponding to the initial key, through the initial key. For example, the first service end may define a field "LD" to identify data to be transmitted for indicating the on or off state of the street lamp. The initial business text object includes an initial key and corresponding values, which may be expressed as the initial key: the value may be in the form of, for example, an initial business text object of "a": 1, where "a" represents the initial key and 1 represents the corresponding value. The initial business data may include a plurality of initial business text objects, for example, the initial business data may be { "a": 1, "b": 2, "c": 3 }. The initial key and corresponding value in the initial business text object are modifiable.
In some embodiments, there may be a plurality of first service terminals, for example, the intelligent street lamp manufactured by manufacturer a may be used as the first service terminal, and the intelligent street lamp manufactured by manufacturer B may also be used as the first service terminal. The initial keys corresponding to different first service terminals may be different, and the physical meanings represented by the values corresponding to the initial keys are different. For example, the data transmitted from the smart street lamps manufactured by a manufacturer a may include road surface conditions, pedestrian conditions, and traffic conditions, and the initial keys used may be "a 1", "B1", and "c 1", the data transmitted from the street lamps manufactured by B manufacturer may include road surface conditions, traffic conditions, and weather conditions, and the initial keys used are "a 2", "B2", and "c 2".
S204, acquiring a target data conversion rule corresponding to the initial service data, wherein the target data conversion rule comprises at least one of a key corresponding relation and a value corresponding relation.
Specifically, the key correspondence may be a correspondence between an initial key and a target key, where the target key may be a field defined by the second service end for identifying data in the initial service data. The data conversion rules may be organized into key-value pairs with the initial key as the key and the target key as the value. The data transformation rules may be expressed as: "initial bond: target key ". The target key may include a plurality, and there may be a hierarchical relationship between the plurality of target keys. Preset symbols may be used to establish a hierarchical relationship between a plurality of target keys, where a symbol may be, for example, ", and the target key may be represented as: "first target key. second target key". The value corresponding relation refers to processing data in the initial service data to obtain processed data. For example, the specified data in the initial service data may be acquired and other data in the initial service data may be deleted. The data conversion rule may be a preset rule, and may be set according to a service, and different services may correspond to different data conversion rules. The target data conversion rule is a conversion rule corresponding to the initial service data, and the data conversion module can convert the initial service data according to the target data conversion rule. The initial service data may carry an identifier corresponding to the target data conversion rule, and the data conversion module may obtain the identifier in the initial service data, thereby obtaining the target data conversion rule.
In some embodiments, the key correspondence relationship may further include an assignment key and an assignment key, where the assignment key is an initial key, the assignment key is used to obtain a value corresponding to the assignment key, and the obtained value is used as a value corresponding to the target key. The assignment key may be represented by VALUE, and the assignment key, the assignment key and the target key may be associated by using a preset symbol, for example, the symbol may be ". multidot.. Taking initial service data { "a": 1, "b": 2, "c": 3} as an example, the corresponding target data conversion rule can be expressed as "a": value.b ", where VALUE is the assignment key," b "is the assignment key, par denotes the first target key, and d denotes the second target key. The target data conversion rule indicates that the initial key "a" in the initial service data is represented by target keys "par" and "d", and the value corresponding to the initial key b is taken as the value corresponding to the target key "d". Here, the keyword refers to a character string having a special meaning.
In some embodiments, the target data conversion rules may also include other types of keywords, such as NEW keywords (NEW), MODULE keywords (MODULE), METHOD keywords (METHOD), PARAMETER keywords (PARAMETER), ARRAY type keywords (ARRAY), and DICTIONARY type keywords (DICTIONARY), among others. The module keywords are used for calling the module, and the method keywords are used for calling the method. One module may include multiple methods. The method can be understood as a function, which can have input parameters and output results. The modules and the method can be realized according to the service, different modules can realize different functions, and different methods can realize different functions. The parameter key corresponds to a parameter key, the parameter key can be an initial key, the data conversion module can combine values corresponding to the initial key into an array by using an array type key and the parameter key, and the array is used as a value corresponding to a target key by assigning the key, and the corresponding data conversion rule can be expressed as follows: initial bond: the data conversion rule shows that the value corresponding to the parameter key 1 and the value corresponding to the parameter key 2 are combined into an array, and the array is used as the value corresponding to the target key.
In some embodiments, the initial key in the key correspondence may be null, the target key may be generated by adding a new keyword, and the corresponding data conversion rule may be: "": new keywords, target keys, assignment keywords and assignment keys. The data conversion rule may indicate that all initial keys in the initial service data are removed, a target key is newly added, and a value corresponding to the assignment key is used as a value of the target key.
In some embodiments, the initial key in the key correspondence may be null, the target key may be generated by adding a keyword, the assignment keyword may correspond to a module keyword, the module keyword may correspond to a method keyword, the method keyword may correspond to a specific method, the method may correspond to a parameter key, and the data conversion rule may be expressed as: "": the method comprises the steps of adding new keywords, target keys, assignment keywords, module names, method keywords, parameter keywords and parameter keys. The data conversion rule can indicate that all initial keys and corresponding values in the initial service data are removed, a target key is added, and a result obtained by the method according to the value corresponding to the parameter key is used as a value corresponding to the target key. The method comprises a module keyword, a module name, a method keyword and a method name, wherein the module keyword, the module name, the method keyword and the method name represent corresponding methods in a calling module.
In some embodiments, a plurality of data conversion rules and the corresponding identifier of each data conversion rule may be preset. The data conversion module may obtain the corresponding data conversion rule from a plurality of preset data conversion rules according to the identifier of the data conversion rule. The preset data conversion rules may be stored in the data conversion module, or may be stored in other places, for example, in a database.
In some embodiments, the data conversion module specifies the format of the received data, and when the format of the received data does not conform to the specification of the data conversion module, an error message may be returned to the service end that sent the data, so as to notify that the format of the data sent by the service end is incorrect.
And S206, performing data conversion on at least one of the initial key and the corresponding value according to a target data conversion rule to obtain target service data, wherein the target service data comprises a plurality of target service text objects, and the target service text objects comprise the target key and the corresponding value.
Specifically, the data conversion module may obtain a corresponding target key according to an initial key in the target data conversion rule, replace the initial key with the target key, and obtain the target service data according to the target key and a value corresponding to the initial key. Taking initial service data S { "a": 1, "b": 2, "c": 3} as an example, if the target data transformation rule is: "a": par.d1 "and" b ": par.d 2", the target service data may be: { "par": { "d 1": 1, { "d 2": 2} }. Wherein, the'd 1': 1 and the'd 2': 2 are target business text objects, and the'd 1' and 1 in the'd 1': 1 are target keys and corresponding values respectively.
In some embodiments, the data conversion module may obtain the target service data by taking a value corresponding to the assignment key as a value corresponding to the target key according to the assignment key in the target data conversion rule, for example, if the target data conversion rule corresponding to the initial service data S is: "a": "par.d.value.b", the target service data is: { "par": a ": 2} }.
In some embodiments, the data conversion module may generate a target key according to the newly added keyword in the target data conversion rule, and obtain the target service data by using a value corresponding to the assignment key as a value corresponding to the target key according to the assignment keyword. For example, if the target data conversion rule corresponding to the initial service data S is: ": new.par.d.value.a", the target traffic data is: { "par": { "d": 1}}. "i.e. no value in the double quote indicates that the initial key in the initial traffic data needs to be cleared.
In some embodiments, the data conversion module may input a value in the initial service data into a corresponding function according to a parameter keyword in the target data conversion rule to obtain an output value of the function, use the output value of the function as a value of a new key by using an assignment key, and use a key value pair consisting of the new key and the output value as the target service data. For example, if the target data conversion rule corresponding to the initial service data S is: ": new.sum _ all.value.module.global.method.sum.parameter.parameter.a.parameter.b.parameter.c", the target traffic data is: { "sum _ all": 6 }.
In some embodiments, the data conversion module may combine values in the initial service data into a dictionary according to the parameter keywords and the dictionary type keywords in the target data conversion rule, may use the combined dictionary as values of the target keys by assigning the keywords, and may use the target keys and key value pairs obtained by the combined dictionary as the target service data. The dictionary is a data structure, and the corresponding representation method can be { data 1, data 2, data 3 }. For example, if the target data conversion rule corresponding to the initial service data S is: "a" is di.value.DICTIONARY.PARAMETER.a.PARAMETER.b.PARAMETER.c ", the target service data is: { "dic": 1,2,3} }.
And S208, sending the target service data to the second service terminal.
Specifically, the data sending request may include an identifier of the second service end, the data conversion module may obtain the identifier of the second service end from the data sending request, and after the data conversion module obtains the target service data, the obtained target service data may be sent to the second service end.
In the service data processing method, a data sending request sent by a first service end to a second service end is received, the data sending request carries initial service data, the initial service data comprises a plurality of initial service text objects, the initial service text objects comprise initial keys and corresponding values, a target data conversion rule corresponding to the initial service data is obtained, at least one of the initial keys and the corresponding values is subjected to data conversion according to the target data conversion rule to obtain target service data, the target service data comprises a plurality of target service text objects, and the target service text objects comprise target keys and corresponding values, and the target service data is sent to the second service end. The target data conversion rule comprises at least one of the key corresponding relation and the value corresponding relation, so that data conversion can be automatically completed according to the target data conversion rule, and the data conversion efficiency is improved.
In some embodiments, the initial service data carries a rule key, as shown in fig. 3, the obtaining of the target data conversion rule corresponding to the initial service data in step S204 includes:
s302, obtaining the rule key words in the initial service data.
S304, a candidate data conversion rule set is obtained, wherein the candidate data conversion rule set comprises a plurality of candidate data conversion rules.
S306, according to the rule key words, candidate data conversion rules corresponding to the rule key words are obtained from the candidate data conversion rule set and serve as target data conversion rules corresponding to the initial business data.
Specifically, a rule key refers to a key associated with a data transformation rule for uniquely identifying the data transformation rule. The rule keywords may be specific traffic types, such as display screen traffic, street light traffic, and the like. The candidate data conversion rule may be a preset rule, and may be set according to a specific service. Different services may correspond to different data conversion rules.
In the embodiment of the application, the corresponding data conversion rule can be conveniently acquired through the rule keyword in the initial service data, so that the data conversion rule acquisition efficiency is high.
In some embodiments, as shown in fig. 4, performing data conversion on at least one of the initial key and the corresponding value according to the target data conversion rule to obtain the target service data includes:
s402, acquiring target keys corresponding to the plurality of initial keys in the target data conversion rule, wherein the target keys comprise a father key and corresponding son keys.
S404, forming a first key value pair according to the values corresponding to the sub-keys and the initial key.
S406, the first key value pairs with the same corresponding parent keys are used as values, the corresponding parent keys are used as keys, and the target business data are obtained.
Specifically, the target data conversion rule may include a plurality of initial keys and corresponding target keys, and the target keys may include a parent key and corresponding child keys. Wherein the parent key represents the first target key and the child key represents the second target key. Taking initial business data { "a": 1, "b": 2, "c": 3} as an example, the corresponding target data transformation rule can be expressed as "a": par.d "," b ": par.e", wherein par in the target key "par.d" is a parent key, d is a child key, par in the target key "par.e" is a parent key, e is a child key, and thus the parent keys corresponding to the child keys d and e are the same, so that the first key value pair { "d": 1} can be composed according to the value 1 of the initial key "a" and the child key d, and the first key value pair { "e": 2} can be composed according to the value 2 of the initial key "b" and the child key e, then { "d": 1} and { "e": 2} can be used as the key, the key "par" { "d": 1 ": 2} can be used as the key, the key pair" { "d": 2, and "e } can be used as the initial business data a" { "d": 1}, target service data corresponding to "b": 2, "c": 3.
In the embodiment of the present application, the initial service data may be identified by using the same parent key, so that the second service end may obtain a plurality of data according to the parent key, and the data obtaining efficiency is improved.
In some embodiments, the acquiring of the target key corresponding to each of the plurality of initial keys in the target data conversion rule in step S402 includes: acquiring target keys corresponding to a plurality of attributes in the target data conversion rule respectively; step S404, forming a first key value pair according to the values corresponding to the sub-keys and the initial key, including; forming a first key-value pair according to the sub-keys and attribute data corresponding to the attributes; step S406, namely, taking the first key value pair with the same parent keys as a value and the corresponding parent key as a key to obtain the target service data, includes: combining first key values which are the same with a plurality of corresponding parent keys to serve as values, and taking the parent key which represents the attribute type corresponding to the attribute as a key to obtain a second key value pair; and obtaining the target service data according to the second key value pair.
Specifically, target device can be each equipment in the thing networking, for example, can wisdom lamp, display screen and air conditioner etc.. The attribute data of the target device may be attribute data of the target device itself or attribute data corresponding to other objects acquired by the target device, where the attribute data of the target device itself may be, for example, brightness and temperature data of a display screen, and the attribute data corresponding to other objects acquired by the target device may be, for example, road surface data acquired by an intelligent lamp. The attribute type corresponding to the attribute represents the type to which the attribute belongs.
In the embodiment of the application, data of the device in the internet of things is converted into target service data according to the data conversion rule, so that when the second service end receives the data from multiple display screens of the same type but different initial service data, for example, the second service end receives the initial service data of the display screens produced by different manufacturers (the initial keys and the corresponding values corresponding to the initial service data of the display screens produced by different manufacturers are usually different), the multiple different initial service data can be converted into the same target service data, so that the second service end does not need to perform data conversion on each initial service data independently, the workload of the second service end is reduced, and the data processing speed of the second service end is improved.
In some embodiments, the target device is a display screen, the attribute of the target device includes brightness and temperature of the display screen, the attribute data of the target device includes brightness data corresponding to the brightness and temperature data corresponding to the temperature, and the target key corresponding to the brightness and the parent key corresponding to the target key corresponding to the temperature are identifiers of the data of the display screen defined by the second service end.
In the embodiment of the present application, the identifier of the data of the display screen defined by the second service end is used as the target key, so that the second service end can identify the target service data.
In some embodiments, as shown in fig. 5, the data converting the initial key and at least one of the corresponding values according to the target data conversion rule in step S206 to obtain target service data includes:
s502, acquiring a target key corresponding to the initial key in the target data conversion rule.
S504, the values corresponding to the initial keys are combined into an array.
S506, combining the target key as a key and the array as values to obtain a key value pair, and obtaining the target service data according to the key value pair.
Specifically, the data conversion module may compose an array of values in the initial service data according to a parameter keyword and an array type keyword in the target data conversion rule, may use the composed array as a value of a target key by assigning the keyword, and uses a key value pair obtained by the target key and the composed array as the target service data. For example, if the target data conversion rule corresponding to the initial service data S is: "a.value.array.parameter.a.parameter.b", the target traffic data is: { "a": 1,2 }.
In the embodiment of the application, the data in the initial service data are combined into the array through the target data conversion rule, so that the second service end can directly acquire the array to obtain the service data, and the data acquisition efficiency of the second service end is improved.
In some embodiments, as shown in fig. 6, an execution schematic diagram of a service data processing method is provided. The service data processing method is implemented by a module (hereinafter referred to as a conversion module) corresponding to the Json format automatic identification conversion format in fig. 6. Wherein, Json is a data packaging format. The database may be a structured database, which is a type of database stored by the database. The conversion module can convert the business input data with one Json format into business output data with another Json format through the conversion rules in the database. The service input data which can be processed by the conversion module must be in a Json format, and when the conversion module identifies that the service input data is not in the Json format, error information can be returned to a service end corresponding to the service input data to inform that the format is wrong.
The conversion module needs to interact with the database to inquire the conversion rules. When the conversion module determines that the service input data is in the Json format, the service input data may be converted into service output data meeting the conversion rule according to a number conversion rule corresponding to the service input data, which is queried from the database, for example, the service input data is in the Json format a, and the corresponding service output data is in the Json format B.
The service input data corresponding to different services can have different Json formats, when the service input data is in the Json format corresponding to the newly added service, the corresponding conversion rule can be newly added in the conversion rule in the data, the Json format of the service data of the type can be automatically converted, when the Json format corresponding to the service input data is converted, the corresponding conversion rule stored in the database can be correspondingly modified, and the flexibility of format conversion is high. The conversion module can be a micro-service and can be deployed independently as long as data communication can be completed.
In the embodiment of the application, for places with more services or non-uniform formats using data in the Json format, the development amount of users is reduced through the database and the analysis method, and any new format and service can be added quickly only by updating the database or writing a small amount of codes while updating the database, so that the workload of personnel is reduced, and the method is flexible and practical. For example, in the service of separating the front-end data and the back-end data of the middle station control, the middle station can quickly complete the service requirement of the middle station on the framework only by configuring the database according to the corresponding rule, thereby saving the development time of middle station personnel, namely saving the development time of the data conversion service requirement.
The embodiment of the application can be used in the occasion of front-end and back-end data separation, namely, the front end has a structure format of the front end, and the back end has a data format of the back end, for example: the front end controls the brightness and the sound of the large screen, namely the front end only needs to know two variables of the brightness and the sound, and format information of the screen when the information is reported contains brightness, sound, position and the like which are inconsistent with the format required by the front end, conversion is needed.
At present, in the prior art, json format data is analyzed and encapsulated, and the conversion from format a to format B after analysis is added by a user, and since different json formats are different, a programmer needs to add one analysis and conversion method every time a service is added, which results in a large amount of workload and redundancy. The json format is various, each service corresponds to a data structure, and if a new service is added or the format is modified, the workload of personnel is various and redundant, wherein much energy belongs to physical labor rather than mental labor, the time which can be used for doing more work is wasted on the same thing, and non-technical personnel can not take over, and the related technical personnel is required to modify the data structure. The method of the embodiment of the application has the following advantages: 1. the workload of service developers can be reduced, namely the time for writing various format conversion codes is shortened to only need to modify the database rules, so that the labor and time cost are saved; 2. the database rule shows how the data a is converted into the data b, the rule corresponding relation is simple, the field correspondence is completed, the rule data is usually written into the database, and labor and time cost are saved; 3. the configuration is flexible and simple, the method can be delivered to non-technical personnel for use, and only the opposite side needs to be informed how to define the new rule and modify the rule, so that the operation and maintenance cost is saved.
It should be understood that, although the steps in the flowcharts of the above embodiments are shown in sequence as indicated by the arrows, the steps are not necessarily executed in sequence 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 part of the steps in the flowcharts of the above embodiments may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or the stages is not necessarily sequential, but may be performed alternately or alternatingly with other steps or at least a part of the sub-steps or the stages of other steps.
In some embodiments, as shown in fig. 7, there is provided a service data processing apparatus, including: a data sending request receiving module 702, a target data conversion rule obtaining module 704, a target service data obtaining module 706 and a target service data sending module 708, wherein:
a data sending request receiving module 702, configured to receive a data sending request sent by a first service end to a second service end, where the data sending request carries initial service data, the initial service data includes multiple initial service text objects, and the initial service text objects include initial keys and corresponding values.
A target data conversion rule obtaining module 704, configured to obtain a target data conversion rule corresponding to the initial service data, where the target data conversion rule includes at least one of a key correspondence relationship and a value correspondence relationship.
A target service data obtaining module 706, configured to perform data conversion on at least one of the initial key and the corresponding value according to the target data conversion rule to obtain target service data, where the target service data includes a plurality of target service text objects, and the target service text object includes a target key and a corresponding value.
A target service data sending module 708, configured to send the target service data to the second service end.
In some embodiments, the initial service data carries a rule keyword, and the target data conversion rule obtaining module includes:
and the rule keyword acquisition unit is used for acquiring the rule keywords in the initial service data.
A candidate data conversion rule set obtaining unit, configured to obtain a candidate data conversion rule set, where the candidate data conversion rule set includes multiple candidate data conversion rules.
And a target data conversion rule obtaining unit, configured to obtain, according to the rule keyword, a candidate data conversion rule corresponding to the rule keyword from the candidate data conversion rule set, and use the candidate data conversion rule as the target data conversion rule corresponding to the initial service data.
In some embodiments, the target business data obtaining module 706 includes:
and the target key acquisition unit is used for acquiring target keys corresponding to the plurality of initial keys in the target data conversion rule respectively, wherein the target keys comprise a father key and a corresponding son key.
And the first key-value pair forming unit is used for forming a first key-value pair according to the sub-keys and the values corresponding to the initial key.
And the target service data obtaining unit is used for obtaining the target service data by taking the same first key value pairs of the corresponding parent keys as values and taking the corresponding parent keys as keys.
In some embodiments, the initial service data is data of a target device in the internet of things, the initial key is an attribute of the target device, a value corresponding to the initial key is attribute data of the target device, and the target key obtaining unit is further configured to obtain target keys corresponding to a plurality of attributes in the target data conversion rule, respectively; the first key-value pair forming unit is also used for forming a first key-value pair according to the sub-keys and the attribute data corresponding to the attributes; the target business data obtaining unit is also used for combining the first key values with the same corresponding parent keys as values, and taking the parent key representing the attribute type corresponding to the attribute as a key to obtain a second key value pair; and obtaining the target service data according to the second key value pair.
In some embodiments, the target device is a display screen, the attribute of the target device includes brightness and temperature of the display screen, the attribute data of the target device includes brightness data corresponding to the brightness and temperature data corresponding to the temperature, and the target key corresponding to the brightness and the parent key corresponding to the target key corresponding to the temperature are identifiers of the data of the display screen defined by the second service end.
In some embodiments, the target business data obtaining module 706 further comprises:
and the target key acquisition unit is used for acquiring a target key corresponding to the initial key in the target data conversion rule.
And the array combination unit is used for combining the values corresponding to the initial keys into an array.
And the target service data obtaining unit is used for combining the target key as a key and the array as values to obtain a key value pair, and obtaining the target service data according to the key value pair.
For specific limitations of the service data processing apparatus, reference may be made to the above limitations of the service data processing method, which is not described herein again. The modules in the business data processing device can be wholly or partially implemented by software, hardware and 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 some embodiments, a computer device is provided, which may be a data conversion module, the internal structure of which may be as shown in fig. 8. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a business data processing method.
Those skilled in the art will appreciate that the architecture shown in fig. 8 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 some embodiments, a computer device is provided, which includes a memory, a processor and a computer program stored on the memory and executable on the processor, and the processor implements the steps of the above-mentioned service data processing method when executing the computer program.
In some embodiments, a computer-readable storage medium is provided, on which a computer program is stored, which computer program, when being executed by a processor, realizes the steps of the above-mentioned business data processing method.
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 processing service data, the method comprising:
receiving a data sending request sent by a first service end to a second service end, wherein the data sending request carries initial service data, the initial service data comprises a plurality of initial service text objects, and the initial service text objects comprise initial keys and corresponding values;
acquiring a target data conversion rule corresponding to the initial service data, wherein the target data conversion rule comprises at least one of a key corresponding relation and a value corresponding relation;
performing data conversion on at least one of the initial key and the corresponding value according to the target data conversion rule to obtain target service data, wherein the target service data comprises a plurality of target service text objects, and the target service text objects comprise target keys and corresponding values;
and sending the target service data to the second service terminal.
2. The method according to claim 1, wherein the initial service data carries a rule keyword, and the obtaining of the target data conversion rule corresponding to the initial service data comprises:
acquiring a rule keyword in the initial service data;
acquiring a candidate data conversion rule set, wherein the candidate data conversion rule set comprises a plurality of candidate data conversion rules;
and according to the rule keyword, acquiring a candidate data conversion rule corresponding to the rule keyword from the candidate data conversion rule set, and using the candidate data conversion rule as a target data conversion rule corresponding to the initial service data.
3. The method of claim 1, wherein the performing data transformation on at least one of the initial key and the corresponding value according to the target data transformation rule to obtain target service data comprises:
acquiring target keys corresponding to the plurality of initial keys in the target data conversion rule respectively, wherein the target keys comprise father keys and corresponding son keys;
forming a first key value pair according to the values corresponding to the sub-keys and the initial key;
and taking the first key value pairs with the same corresponding parent keys as values, and taking the corresponding parent keys as keys to obtain the target service data.
4. The method according to claim 3, wherein the initial service data is data of a target device in the internet of things, the initial key is an attribute of the target device, a value corresponding to the initial key is attribute data of the target device, and the obtaining of the target key corresponding to each of the plurality of initial keys in the target data conversion rule includes:
acquiring target keys corresponding to a plurality of attributes in the target data conversion rule respectively;
forming a first key-value pair according to the values corresponding to the sub-keys and the initial key, including;
forming a first key-value pair according to the sub-keys and attribute data corresponding to the attributes;
the obtaining the target service data by using the same first key value pairs of the corresponding parent keys as values and the corresponding parent keys as keys comprises:
combining first key values which are the same with a plurality of corresponding parent keys to serve as values, and taking the parent key which represents the attribute type corresponding to the attribute as a key to obtain a second key value pair;
and obtaining the target service data according to the second key value pair.
5. The method according to claim 4, wherein the target device is a display screen, the attributes of the target device include brightness and temperature of the display screen, the attribute data of the target device include brightness data corresponding to the brightness and temperature data corresponding to the temperature, and the target key corresponding to the brightness and the parent key corresponding to the target key corresponding to the temperature are identifiers of data of the display screen defined by the second service end.
6. The method of claim 1, wherein the performing data transformation on at least one of the initial key and the corresponding value according to the target data transformation rule to obtain target service data comprises:
acquiring a target key corresponding to the initial key in the target data conversion rule;
combining values corresponding to a plurality of the initial keys into an array;
and combining the target key as a key and the array as values to obtain a key value pair, and obtaining the target service data according to the key value pair.
7. A service data processing apparatus, characterized in that the apparatus comprises:
a data sending request receiving module, configured to receive a data sending request sent by a first service end to a second service end, where the data sending request carries initial service data, the initial service data includes multiple initial service text objects, and each initial service text object includes an initial key and a corresponding value;
a target data conversion rule obtaining module, configured to obtain a target data conversion rule corresponding to the initial service data, where the target data conversion rule includes at least one of a key correspondence relationship and a value correspondence relationship;
a target service data obtaining module, configured to perform data conversion on at least one of the initial key and the corresponding value according to the target data conversion rule to obtain target service data, where the target service data includes a plurality of target service text objects, and the target service text objects include a target key and a corresponding value;
and the target service data sending module is used for sending the target service data to the second service end.
8. The apparatus of claim 7, wherein the initial service data carries a rule key, and the target data conversion rule obtaining module comprises:
a rule keyword obtaining unit, configured to obtain a rule keyword in the initial service data;
a candidate data conversion rule set obtaining unit, configured to obtain a candidate data conversion rule set, where the candidate data conversion rule set includes a plurality of candidate data conversion rules;
and a target data conversion rule obtaining unit, configured to obtain, according to the rule keyword, a candidate data conversion rule corresponding to the rule keyword from the candidate data conversion rule set, and use the candidate data conversion rule as the target data conversion rule corresponding to the initial service data.
9. A computer arrangement comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the business data processing method according to any one of claims 1 to 6 when executing the computer program.
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 business data processing method of any one of claims 1 to 6.
CN201911258724.5A 2019-12-10 2019-12-10 Service data processing method, device, computer equipment and storage medium Active CN111061678B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911258724.5A CN111061678B (en) 2019-12-10 2019-12-10 Service data processing method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911258724.5A CN111061678B (en) 2019-12-10 2019-12-10 Service data processing method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111061678A true CN111061678A (en) 2020-04-24
CN111061678B CN111061678B (en) 2023-05-23

Family

ID=70300348

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911258724.5A Active CN111061678B (en) 2019-12-10 2019-12-10 Service data processing method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111061678B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112307735A (en) * 2020-11-03 2021-02-02 平安普惠企业管理有限公司 Method, device and equipment for generating service text and storage medium
CN112800095A (en) * 2021-04-13 2021-05-14 腾讯科技(深圳)有限公司 Data processing method, device, equipment and storage medium
CN113535857A (en) * 2021-08-04 2021-10-22 阿波罗智联(北京)科技有限公司 Data synchronization method and device
CN113590719A (en) * 2021-09-27 2021-11-02 北京奇虎科技有限公司 Data synchronization method, device, equipment and storage medium
CN115600560A (en) * 2022-09-28 2023-01-13 中电金信软件有限公司(Cn) Data conversion method, device, system, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140156709A1 (en) * 2012-12-04 2014-06-05 Ca, Inc. Aggregating keys of dependent objects for a given primary object
CN109636607A (en) * 2018-12-18 2019-04-16 平安科技(深圳)有限公司 Business data processing method, device and computer equipment based on model deployment
CN110275703A (en) * 2019-06-27 2019-09-24 浙江大搜车软件技术有限公司 Assignment method, device, computer equipment and the storage medium of key-value pair data
CN110427538A (en) * 2019-07-30 2019-11-08 北京奇艺世纪科技有限公司 A kind of data query method, storage method, device and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140156709A1 (en) * 2012-12-04 2014-06-05 Ca, Inc. Aggregating keys of dependent objects for a given primary object
CN109636607A (en) * 2018-12-18 2019-04-16 平安科技(深圳)有限公司 Business data processing method, device and computer equipment based on model deployment
CN110275703A (en) * 2019-06-27 2019-09-24 浙江大搜车软件技术有限公司 Assignment method, device, computer equipment and the storage medium of key-value pair data
CN110427538A (en) * 2019-07-30 2019-11-08 北京奇艺世纪科技有限公司 A kind of data query method, storage method, device and electronic equipment

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112307735A (en) * 2020-11-03 2021-02-02 平安普惠企业管理有限公司 Method, device and equipment for generating service text and storage medium
CN112800095A (en) * 2021-04-13 2021-05-14 腾讯科技(深圳)有限公司 Data processing method, device, equipment and storage medium
CN113535857A (en) * 2021-08-04 2021-10-22 阿波罗智联(北京)科技有限公司 Data synchronization method and device
CN113590719A (en) * 2021-09-27 2021-11-02 北京奇虎科技有限公司 Data synchronization method, device, equipment and storage medium
CN113590719B (en) * 2021-09-27 2022-03-22 北京奇虎科技有限公司 Data synchronization method, device, equipment and storage medium
CN115600560A (en) * 2022-09-28 2023-01-13 中电金信软件有限公司(Cn) Data conversion method, device, system, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN111061678B (en) 2023-05-23

Similar Documents

Publication Publication Date Title
CN111061678A (en) Service data processing method and device, computer equipment and storage medium
CN108804618B (en) Database configuration method, device, computer equipment and storage medium
CN107896162B (en) Deployment method and device of monitoring system, computer equipment and storage medium
CN111683066B (en) Heterogeneous system integration method, heterogeneous system integration device, computer equipment and storage medium
CN111580884B (en) Configuration updating method, device, server and electronic equipment
CN107800565B (en) Inspection method, inspection device, inspection system, computer equipment and storage medium
CN110716989A (en) Dimension data processing method and device, computer equipment and storage medium
WO2020132870A1 (en) File update method, file update apparatus and terminal device
CN110286939A (en) Development approach, device, equipment and the storage medium of Software Development Kit
CN114169536B (en) Data management and control method and related device
US10715628B2 (en) Attribute operating method and device
CN111369237B (en) Data processing method and device and computer storage medium
CN112527397A (en) Method and device for modifying basic input output system options and computer equipment
CN110275703B (en) Method and device for assigning key value to data, computer equipment and storage medium
CN113568925B (en) Message data conversion method and device, electronic equipment and storage medium
CN110995521A (en) Service providing method, device, equipment and system
CN111949529B (en) System debugging method, device, computer equipment and storage medium
CN111338717B (en) Interface calling method, application program upgrading method, server and client
CN113467832A (en) Equipment control processing method, device, storage medium and electronic device
CN113986312B (en) Software upgrading method and device, electronic equipment and computer readable storage medium
CN112448909A (en) Electronic lock management method, device, system and storage medium
CN113220759A (en) Big data storage service sharing method and device, computer equipment and storage medium
CN112380828A (en) PDF document generation method and device, storage medium and electronic equipment
CN111061795B (en) Data processing method and device, intelligent terminal and storage medium
CN113434190B (en) Data processing method and device, storage medium and electronic equipment

Legal Events

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