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

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

Info

Publication number
CN111061678B
CN111061678B CN201911258724.5A CN201911258724A CN111061678B CN 111061678 B CN111061678 B CN 111061678B CN 201911258724 A CN201911258724 A CN 201911258724A CN 111061678 B CN111061678 B CN 111061678B
Authority
CN
China
Prior art keywords
target
data
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.)
Active
Application number
CN201911258724.5A
Other languages
Chinese (zh)
Other versions
CN111061678A (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.)
Shenzhen Miracle Intelligent Network Co Ltd
Original Assignee
Shenzhen 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 Shenzhen Miracle Intelligent Network Co Ltd filed Critical Shenzhen 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, computer equipment and a storage medium. The method comprises the following steps: receiving a data transmission request sent by a first service end to a second service end, wherein the data transmission 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 the corresponding values; and sending the target service data to the second service end. The method can improve the data conversion efficiency.

Description

Service data processing method, device, computer equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a service data processing method, apparatus, computer device, and 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 a network. For example, one service end may be utilized to receive data transmitted by a plurality of devices.
However, because the data formats sent by different devices are different, and the data format requirements corresponding to different service ends are often different, when the different service ends perform data interaction, the received data cannot be directly identified, and the received data can be identified and used after being subjected to data conversion.
At present, the data conversion method is completed manually, and the data conversion efficiency is low.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a service data processing method, apparatus, computer device, and storage medium capable of improving data conversion efficiency, in response to the above-described technical problem of low data conversion efficiency.
A business data processing method, the method comprising: receiving a data transmission request sent by a first service end to a second service end, wherein the data transmission 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 end.
In some embodiments, the obtaining the target data conversion rule corresponding to the initial service data includes: acquiring rule keywords 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 key words, acquiring candidate data conversion rules corresponding to the rule key words from the candidate data conversion rule set, and taking the candidate data conversion rules as target data conversion rules corresponding to the initial service data.
In some embodiments, the 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 includes: acquiring target keys corresponding to a plurality of initial keys in the target data conversion rule, wherein the target keys comprise parent keys and corresponding child keys; forming a first key value pair according to the sub key and the value corresponding to 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 business data.
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 obtaining target keys corresponding to 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; the first key value pair is formed according to the sub key and the value corresponding to the initial key, and comprises; forming a first key value pair according to the sub key and attribute data corresponding to the attribute; combining the same first key values of a plurality of corresponding father keys together to serve as values, and taking the father key representing the attribute type corresponding to the attribute as a key to obtain a second key value pair; and obtaining the target business 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 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 includes: acquiring a target key corresponding to the initial key in the target data conversion rule; combining the values corresponding to the initial keys into an array; and taking the target key as a key, taking the array as a value, combining 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: the data transmission request receiving module is used for receiving a data transmission request sent by a first service end to a second service end, wherein the data transmission 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; the target data conversion rule acquisition module is used for 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; the target service data obtaining module is used for carrying out 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 the corresponding values; 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 key, and the target data conversion rule acquisition 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 the target data conversion rule obtaining unit is used for obtaining the candidate data conversion rule corresponding to the rule key word from the candidate data conversion rule set according to the rule key word, and taking the candidate data conversion rule as the target data conversion rule corresponding to the initial service data.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the business data processing method described above when the computer program is executed.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the business data processing method described above.
The service data processing method, the device, the computer equipment and the storage medium are used for receiving a data transmission request sent by a first service end to a second service end, wherein the data transmission 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, acquiring a target data conversion rule corresponding to the initial service data, carrying out data conversion on at least one of the initial keys and the corresponding values according to the target data conversion rule to obtain target service data, the target service data comprises a plurality of target service text objects, the target service text objects comprise target keys and corresponding values, and sending the target service data to the second service end. Because the target data conversion rule comprises at least one of key corresponding relation and value corresponding relation, data conversion can be automatically completed according to the target data conversion rule, and data conversion efficiency is improved.
Drawings
FIG. 1 is an application scenario diagram of a business data processing method in some embodiments;
FIG. 2 is a flow chart of a business data processing method in some embodiments;
FIG. 3 is a flowchart illustrating a target data transformation rule acquisition step in some embodiments;
FIG. 4 is a flowchart illustrating a target service data obtaining step in some embodiments;
FIG. 5 is a flowchart illustrating a target service data obtaining step in some embodiments;
FIG. 6 is a schematic diagram of the execution of a business data processing method in some embodiments;
FIG. 7 is a block diagram of a business data processing device in some embodiments;
FIG. 8 is an internal block diagram 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 will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The service data processing method provided by the application can be applied to an application environment shown in fig. 1. The environment includes a first service 102, a data conversion module 104, and a second service 106. The first service end 102 communicates with the data conversion module 104 through a wired or wireless communication manner, and the data conversion module 104 communicates with the second service end 106 through a wired or wireless communication manner.
Specifically, the first service end 102 may receive and send data through the data conversion module 104 and the second service end 106, where the data conversion module 104 is configured to convert 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 required service data, the data conversion module 104 may receive the data sending request, obtain a data conversion rule identifier carried in the initial service data, and obtain a corresponding data conversion rule from the 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 convert the initial service data according to the obtained key or value correspondence relationship in the data conversion rule, obtain converted service data, and send the converted service data to the second service end.
The first service end 102 may be various monitored devices, for example, may be monitored devices such as a display screen, an air conditioner, and a street lamp. The second service 106 may be a monitoring device, such as, but not limited to, various personal computers, notebook computers, smartphones, tablet computers, and portable wearable devices, and of course, the second service 106 may also be implemented by a separate server or a server cluster formed by a plurality of servers. There may be a plurality of first service terminals 102 and a plurality of second service terminals 106.
It may be appreciated that the above application scenario is only an example, and does not constitute a limitation of the method provided by the embodiments of the present application, and the method provided by the embodiments 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, and the method is applied to the data conversion module 104 in fig. 1 for illustration, and includes the following steps:
s202, receiving a data transmission request sent by a first service end to a second service end, wherein the data transmission 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 transmitted through the initial key, namely a value corresponding to the initial key. For example, the first service side may define a field "LD" and use the field "LD" to identify data that needs to be sent to indicate the on or off state of the street lamp. The initial business text object includes an initial key and a corresponding value, which may be expressed as an initial key: the value form, for example, the initial business text object may be "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 in the initial business text object and the corresponding value are modifiable.
In some embodiments, there may be multiple first service terminals, for example, the smart street lamp manufactured by manufacturer a may be used as the first service terminal, and the smart street lamp manufactured by manufacturer B may be used as the first service terminal. The initial keys corresponding to different first service ends may be different, and the physical meaning represented by the values corresponding to the initial keys is different. For example, the data transmitted by the smart street lamp manufactured by the a manufacturer may include road surface conditions, pedestrian conditions, and traffic conditions, and the initial keys employed may be "a1", "B1", and "c1", and the data transmitted by the street lamp manufactured by the B manufacturer may include road surface conditions, traffic conditions, and weather conditions, and the initial keys employed may be "a2", "B2", and "c2".
S204, acquiring a target data conversion rule corresponding to the initial service data, wherein the target data conversion rule comprises at least one of key corresponding relation and 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 and used for identifying data in the initial service data. The data conversion rule may use the initial key as a key and the target key as a value to form a key-value pair. The data transformation rules may be expressed as: "initial key: target key). The target key may include a plurality of target keys, and there may be a hierarchical relationship between the plurality of target keys. A hierarchical relationship between a plurality of target keys may be established using a preset symbol, which may be, for example, ", etc., and the target keys may be expressed as: "first target key, second target key". The value correspondence refers to processing data in the initial service data to obtain processed data. For example, 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, 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 can carry the identifier corresponding to the target data conversion rule, and the data conversion module can acquire the identifier in the initial service data, so as to obtain the target data conversion rule.
In some embodiments, the key correspondence may further include a value-assigning key and a value-assigning key, where the value-assigning key is an initial key, and the value-assigning key is used to obtain a value corresponding to the value-assigning key, and the obtained value is used as a value corresponding to the target key. The assignment key may be represented by a VALUE, and the assignment key may be associated with the assignment key and the target key by using a preset symbol, where the symbol may be "," for example. Taking initial traffic data { "a":1, "b":2, "c":3} as an example, the corresponding target data transformation rule may be expressed as "a": VALUE, b, where VALUE is an assignment key, b is an assignment key, par represents a first target key, and d represents a second target key. The target data conversion rule indicates that an initial key "a" in the initial service data is represented by target keys "par" and "d", and a value corresponding to an initial key b is taken as a value corresponding to the target key "d". Wherein, the keyword refers to a character string having a special meaning.
In some embodiments, the target data transformation rules may also include other types of keywords, such as a NEW keyword (NEW), a MODULE keyword (MODULE), a METHOD keyword (METHOD), a PARAMETER keyword (PARAMETER), an ARRAY type keyword (ARRAY), a DICTIONARY type keyword (DICTIONARY), and so on. 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, and there can be input parameters and output results. The modules and the methods 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 use the array type key and the parameter key to combine the value corresponding to the initial key into an array, and the array is used as the value corresponding to the target key by assigning the key, and the corresponding data conversion rule can be expressed as follows: initial key: the data conversion rule indicates 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 key, and the corresponding data conversion rule may be: "": the new keyword, the target key, the assigned keyword and the assigned key. 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 key, the assigned key may correspond to a module key, the module key may correspond to a method key, the method key 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 keywords, target keys, assigned keywords, module names, method keywords, method names, parameter keywords and parameter keys. The data conversion rule may represent that all initial keys and corresponding values in the initial service data are removed, a target key is newly added, and a result obtained by calculating the value corresponding to the parameter key according to the method is used as a value corresponding to the target key. The method comprises the steps of calling a corresponding method in a module, wherein the method comprises a module keyword, a module name, a method keyword and a method name.
In some embodiments, a plurality of data conversion rules and the identifiers corresponding to the respective data conversion rules may be preset. The data conversion module may obtain, according to the identification of the data conversion rule, a corresponding data conversion rule from a plurality of preset data conversion rules. The preset data conversion rules may be stored in the data conversion module or may be stored in other places, for example, may be stored in a database.
In some embodiments, the data conversion module specifies a format of the received data, and when the format of the received data does not meet the specification of the data conversion module, an error message may be returned to the service end that sends the data, so as to notify the service end of the data format error sent by the service end.
S206, carrying out 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 the corresponding values.
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 target service data according to the target key and a value of the corresponding initial key. Taking initial service data s= { "a":1, "b":2, "c":3} as an example, if the target data conversion rule is: "a": "par.d1" and "b": "par.d2", the target service data may be: { "par": { "d1":1, "d2":2 }. Wherein, "d1" and "d2" 1 and "1" in "d1" are the target business text object, and "d1" and 1 in "d1" 1 are the target key and the corresponding value, respectively.
In some embodiments, the data conversion module may obtain the target service data by using the value corresponding to the assignment key as the 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 traffic 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 use a value corresponding to the assignment key as a value corresponding to the target key according to the assignment keyword, to obtain the target service data. 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}}. The absence of a value in the "", i.e., double-quoted, indicates that the original key in the original service data needs to be cleared.
In some embodiments, the data conversion module may input the value in the initial service data into the function corresponding to the parameter key in the target data conversion rule, to obtain the output value of the function, and use the output value of the function as the value of the new added key through the assignment key, and use the key value pair formed by the new added 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.method.sum.parameter.a.parameter.b.parameter.c., the target traffic data is: { "sum_all":6}.
In some embodiments, the data conversion module may form a dictionary from values in the initial service data according to parameter keywords and dictionary type keywords in the target data conversion rule, and may use the formed dictionary as a target key value by assigning keywords, and use a key value pair obtained from the target key and the formed 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": "dic.value.DICTIONARY.PARAMETER.a.PARAMETER.b.PARAMETER.c", the target traffic data is: { "dic": {1,2, 3}.
And S208, the target service data is sent to the second service end.
Specifically, the data sending request may include an identifier of the second service end, and the data conversion module may acquire the identifier of the second service end from the data sending request, and after the data conversion module obtains the target service data, the data conversion module may send the obtained target service data to the second service end.
In the service data processing method, a data transmission request sent by a first service end to a second service end is received, the data transmission 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, the target service text objects comprise target keys and corresponding values, and the target service data is sent to the second service end. Because the target data conversion rule comprises at least one of key corresponding relation and value corresponding relation, data conversion can be automatically completed according to the target data conversion rule, and data conversion efficiency is improved.
In some embodiments, the initial service data carries a rule keyword, as shown in fig. 3, and the acquiring the target data conversion rule corresponding to the initial service data in step S204 includes:
s302, acquiring rule keywords in 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 keywords, acquiring candidate data conversion rules corresponding to the rule keywords from the candidate data conversion rule set, and taking the candidate data conversion rules as target data conversion rules corresponding to the initial service data.
Specifically, the rule key refers to a key associated with the data conversion rule for uniquely identifying the data conversion rule. The rule key may be a specific service type, for example, a display screen service, a street lamp service, etc. 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 obtained through the rule keywords in the initial service data, so that the data conversion rule obtaining 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 target service data, including:
s402, obtaining target keys respectively corresponding to a plurality of initial keys in a target data conversion rule, wherein the target keys comprise parent keys and corresponding child keys.
S404, according to the sub-key and the corresponding value of the initial key, a first key value pair is formed.
And S406, 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 business data.
Specifically, the target data conversion rule may include a plurality of initial keys and corresponding target keys, and the target keys may include parent keys and corresponding child keys. Wherein the parent key represents a first target key and the child key represents a second target key. Taking initial service data { "a":1, "b":2, "c":3} as an example, the corresponding target data conversion rule may be expressed as "a": "par.d", "b": "par.e", where 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, so that the parent keys corresponding to the child keys d and e are the same, so that a first key value pair { "d":1} may be formed according to the value 1 of the initial key "a" and the child key d, and a first key value pair { "e":2} may be formed according to the value 2 of the initial key "b" and the child key e, and { d ":1} and {" e ":2} are used as values, and the key value pair {" d ":1 }" e ":2} may be obtained, and the value 1 {" d ":2} may be used as the value of the initial key value": 1} and the target data { "c": 2 }.
In the embodiment of the application, the initial service data can be identified by the same father key, so that the second service end can obtain a plurality of data according to the father key, and the data acquisition efficiency is improved.
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 obtaining, in step S402, the target keys corresponding to 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; step S404, namely, forming a first key value pair according to the sub-key and the value corresponding to the initial key, including; forming a first key value pair according to the sub key and attribute data corresponding to the attribute; step S406, that is, the step of obtaining the target service data by using the same first key value pair of the corresponding parent keys as a value and using the corresponding parent key as a key includes: combining the same first key values of a plurality of corresponding father keys together to serve as values, and taking the father key representing the attribute type corresponding to the attribute as a key to obtain a second key value pair; and obtaining the target business data according to the second key value pair.
Specifically, the target device in the internet of things may be each device in the internet of things, for example, an intelligent lamp, a display screen, an air conditioner, and the like. The attribute data of the target device may be attribute data of the target device itself or attribute data corresponding to other things acquired by the target device, for example, attribute data of the target device itself may be brightness data, temperature data of a display screen, and the like, and attribute data corresponding to other things acquired by the target device may be, for example, road surface data acquired by an intelligent lamp. The attribute type corresponding to the attribute indicates the type to which the attribute belongs.
In the embodiment of the application, according to the data conversion rule, the data of the device in the internet of things is converted into the target service data, so when the second service end receives the initial service data from the plurality of display screens which are the same in type but different in 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 produced by the display screens produced by different manufacturers are generally different), the plurality of different initial service data can be converted into the same target service data, and therefore the second service end does not need to separately perform data conversion on each initial service data, 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 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 performing data conversion on at least one of the initial key and the corresponding value 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, combining the values corresponding to the initial keys into an array.
S506, taking the target key as a key, taking the array as a value, combining to obtain a key value pair, and obtaining the target service data according to the key value pair.
Specifically, the data conversion module may form an array from values in the initial service data according to the parameter keywords and the array type keywords in the target data conversion rule, and may use the formed array as a value of the target key by assigning the keywords, and use a key value pair obtained from the target key and the formed array as the target service data. For example, if the target data conversion rule corresponding to the initial service data S is: "a": "a.value.aray.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 formed 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, a schematic diagram of the execution of a business 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 encapsulation format. The database may be a structured database, a database type stored for the database. The database stores conversion rules, and the conversion module can convert business input data with one Json format into business output data with another Json format through the conversion rules in the database. When the conversion module recognizes that the service input data is not in the Json format, error information can be returned to the service end corresponding to the service input data to inform of format errors.
The conversion module needs to interactively query the conversion rules with the database. When the conversion module judges that the service input data is in the Json format, the conversion module can query a digital conversion rule corresponding to the service input data from the database, and convert the service input data into service output data meeting the conversion rule according to the queried conversion rule, 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, so that the automatic conversion of the Json format of the service data of the type can be performed, 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 format conversion flexibility is high. The conversion module can be a micro-service and can be deployed independently, so long as data communication can be completed.
In the embodiment of the application, for places with more services using Json format data or non-uniform formats, the development amount of users is reduced by a database and an analysis method, any new format and service can be added by only updating the database or writing a small number 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 business of data separation of the front end and the rear end of the middle stage control, the middle stage can rapidly complete the business requirement of the middle stage on the frame only by configuring the database according to the corresponding rule, so that the development time of middle stage personnel is saved, namely the development time of the data conversion business requirement is saved.
The embodiment of the application can be used for occasions of front-end and back-end data separation, namely, the front end has a front-end structure format, and the background has a background data format, 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 the format information of the screen when the information is reported comprises the information of the brightness, the sound, the position and the like which are inconsistent with the format required by the front end, and the information needs to be converted.
At present, in the prior art, the json format data is parsed and packaged, and the conversion from the format a to the format B after parsing is added by the user himself, and because of different json formats of the services, a parsing and converting method needs to be added every time a programmer needs to add one service, which results in a great workload and redundancy. The json format is numerous, each service corresponds to a data structure, if the service is newly added or the format is modified, the workload of personnel is numerous and redundant, wherein much effort belongs to physical labor rather than mental labor, the time for doing more work is wasted on the same matters, and non-technical personnel cannot take over the work, and the related technical personnel are required to modify the work. 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 be only required to modify database rules, and the labor and time cost are saved; 2. the database rule indicates how the data a is converted into the data b, the rule corresponding relation is required to be simple, the field correspondence is completed, and the rule data is usually only required to be written into the database, so that the labor and time cost are saved; 3. the configuration is flexible and simple, and the method can be delivered to non-technicians for use, and only the opponent needs to be informed of how to define the new rules and modify the rules, 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 order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts of the above embodiments may include a plurality of sub-steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of execution of the sub-steps or stages is not necessarily sequential, but may be performed alternately or alternately with at least some of the other steps or sub-steps of other steps.
In some embodiments, as shown in fig. 7, there is provided a service data processing apparatus, including: a data transmission request receiving module 702, a target data conversion rule obtaining module 704, a target service data obtaining module 706, and a target service data transmitting module 708, wherein:
the data transmission request receiving module 702 is configured to receive a data transmission request sent by a first service end to a second service end, where the data transmission request carries initial service data, where the initial service data includes a plurality of initial service text objects, and the initial service text objects include an initial key and a corresponding value.
And 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 corresponding relationship and a value corresponding relationship.
And the target service data obtaining module 706 is 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 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 key, and the target data conversion rule acquisition module includes:
and the rule keyword acquisition unit is used for acquiring the rule keywords in the initial service data.
And the candidate data conversion rule set acquisition unit is used for acquiring a candidate data conversion rule set, wherein the candidate data conversion rule set comprises a plurality of candidate data conversion rules.
And the target data conversion rule obtaining unit is used for obtaining the candidate data conversion rule corresponding to the rule key word from the candidate data conversion rule set according to the rule key word, and taking 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 respectively corresponding to the plurality of initial keys in the target data conversion rule, wherein the target keys comprise parent keys and corresponding child keys.
And the first key value pair forming unit is used for forming a first key value pair according to the sub-key and the value corresponding to the initial key.
And the target service data obtaining unit is used for taking the first key value pairs with the same corresponding father keys as values and taking the corresponding father keys as keys to obtain the target service data.
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 further used for forming a first key value pair according to the sub-keys and attribute data corresponding to the attribute; the target service data obtaining unit is further used for combining the same first key values of the corresponding parent keys together to serve 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 business 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 taking the target key as a key, taking the array as a value, combining 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 limitation of the service data processing method, and no further description is given here. The various modules in the service data processing device described above may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above 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 includes a non-volatile 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 the operating system and computer programs in the non-volatile storage media. 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.
It will be appreciated by those skilled in the art that the structure shown in fig. 8 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In some embodiments, a computer device is provided that includes a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the business data processing method described above when executing the computer program.
In some embodiments, a computer readable storage medium is provided, on which a computer program is stored which, when executed by a processor, implements the steps of the business data processing method described above.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the various embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile 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), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples merely represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.

Claims (10)

1. A business data processing method, the method comprising:
receiving a data transmission request sent by a first service end to a second service end, wherein the data transmission 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; the data conversion of at least one of the initial key and the corresponding value according to the target data conversion rule to obtain target service data comprises the following steps: acquiring a target key corresponding to the initial key in the target data conversion rule; combining the values corresponding to the initial keys into an array; taking the target key as a key, taking the array as a value, combining to obtain a key value pair, and obtaining the target service data according to the key value pair;
and sending the target service data to the second service end.
2. The method of claim 1, wherein the initial service data carries a rule key, and the obtaining the target data conversion rule corresponding to the initial service data includes:
acquiring rule keywords 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 key words, acquiring candidate data conversion rules corresponding to the rule key words from the candidate data conversion rule set, and taking the candidate data conversion rules as target data conversion rules corresponding to the initial service data.
3. The method according to claim 1, wherein the 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 includes:
acquiring target keys corresponding to a plurality of initial keys in the target data conversion rule, wherein the target keys comprise parent keys and corresponding child keys;
forming a first key value pair according to the sub key and the value corresponding to 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 business data.
4. The method of 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 target keys respectively corresponding to a 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;
the first key value pair is formed according to the sub key and the value corresponding to the initial key, and comprises;
forming a first key value pair according to the sub key and attribute data corresponding to the attribute;
the obtaining the target service data by taking the first key value pairs with the same corresponding parent keys as values and the corresponding parent keys as keys includes:
combining the same first key values of a plurality of corresponding father keys together to serve as values, and taking the father key representing the attribute type corresponding to the attribute as a key to obtain a second key value pair;
and obtaining the target business data according to the second key value pair.
5. The method of claim 4, wherein 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 a parent key corresponding to a target key corresponding to the brightness and a parent key corresponding to a target key corresponding to the temperature are identifiers of the data of the display screen defined by the second service side.
6. A traffic data processing apparatus, the apparatus comprising:
the data transmission request receiving module is used for receiving a data transmission request sent by a first service end to a second service end, wherein the data transmission 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;
the target data conversion rule acquisition module is used for 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;
the target service data obtaining module is used for carrying out 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 the corresponding values; the data conversion of at least one of the initial key and the corresponding value according to the target data conversion rule to obtain target service data comprises the following steps: acquiring a target key corresponding to the initial key in the target data conversion rule; combining the values corresponding to the initial keys into an array; taking the target key as a key, taking the array as a value, combining to obtain a key value pair, and obtaining the target service data according to the key value pair;
And the target service data sending module is used for sending the target service data to the second service end.
7. The apparatus of claim 6, wherein the initial traffic data carries a rule key, and wherein the target data transformation rule acquisition 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 the target data conversion rule obtaining unit is used for obtaining the candidate data conversion rule corresponding to the rule key word from the candidate data conversion rule set according to the rule key word, and taking the candidate data conversion rule as the target data conversion rule corresponding to the initial service data.
8. The apparatus of claim 6, wherein the target traffic data obtaining module comprises:
a target key obtaining unit, configured to obtain target keys corresponding to the plurality of initial keys in the target data conversion rule, where the target keys include a parent key and a corresponding child key;
A first key value pair forming unit, configured to form a first key value pair according to the sub key and a value corresponding to the initial key;
and the target service data obtaining unit is used for taking the first key value pairs with the same corresponding father keys as values and taking the corresponding father keys as keys to obtain the target service data.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the traffic data processing method according to any one of claims 1 to 5 when the computer program is executed by the processor.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the business data processing method of any of claims 1 to 5.
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 CN111061678A (en) 2020-04-24
CN111061678B true 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)

Families Citing this family (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
CN112800095B (en) * 2021-04-13 2021-07-13 腾讯科技(深圳)有限公司 Data processing method, device, equipment and storage medium
CN113535857A (en) * 2021-08-04 2021-10-22 阿波罗智联(北京)科技有限公司 Data synchronization method and device
CN113590719B (en) * 2021-09-27 2022-03-22 北京奇虎科技有限公司 Data synchronization method, device, equipment and storage medium
CN115600560B (en) * 2022-09-28 2023-06-20 中电金信软件有限公司 Data conversion method, device and system, electronic equipment and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109636607A (en) * 2018-12-18 2019-04-16 平安科技(深圳)有限公司 Business data processing method, device and computer equipment based on model deployment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8914343B2 (en) * 2012-12-04 2014-12-16 Ca, Inc. Aggregating keys of dependent objects for a given primary object
CN110275703B (en) * 2019-06-27 2023-06-06 浙江大搜车软件技术有限公司 Method and device for assigning key value to data, computer equipment and storage medium
CN110427538B (en) * 2019-07-30 2023-01-20 北京奇艺世纪科技有限公司 Data query method, data storage method, data query device, data storage device and electronic equipment

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109636607A (en) * 2018-12-18 2019-04-16 平安科技(深圳)有限公司 Business data processing method, device and computer equipment based on model deployment

Also Published As

Publication number Publication date
CN111061678A (en) 2020-04-24

Similar Documents

Publication Publication Date Title
CN111061678B (en) Service data processing method, device, computer equipment and storage medium
CN109474578B (en) Message checking method, device, computer equipment and storage medium
CN110209652B (en) Data table migration method, device, 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
CN111859470B (en) Business data chaining method and device
WO2019061991A1 (en) Multi-element universal model platform modeling method, electronic device, and computer readable storage medium
CN112882974B (en) JSON data conversion method and device, computer equipment and storage medium
CN110888842A (en) File storage method, file query method, file storage device, file query device and file query equipment
WO2020132870A1 (en) File update method, file update apparatus and terminal device
CN110688598A (en) Service parameter acquisition method and device, computer equipment and storage medium
CN111369237B (en) Data processing method and device and computer storage medium
CN112988770A (en) Method and device for updating serial number, electronic equipment and storage medium
CN110990008B (en) Page updating method and device, storage medium and electronic equipment
CN113568925B (en) Message data conversion method and device, electronic equipment and storage medium
CN110275703B (en) Method and device for assigning key value to data, computer equipment and storage medium
CN110995521A (en) Service providing method, device, equipment and system
CN111338717B (en) Interface calling method, application program upgrading method, server and client
CN113792008A (en) Method and device for acquiring network topology structure, electronic equipment and storage medium
CN103561113A (en) Web Service interface generating method and device
CN111324645B (en) Block chain data processing method and device
CN112380828A (en) PDF document generation method and device, storage medium and electronic equipment
CN111538651A (en) Interface testing method, device, server and storage medium
CN112445811A (en) Data service method, device, storage medium and component based on SQL configuration
KR20210128096A (en) Apparatus and method for interworking among internet of things platforms

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