CN110221858A - Analogue data generation method, device, equipment and computer readable storage medium - Google Patents

Analogue data generation method, device, equipment and computer readable storage medium Download PDF

Info

Publication number
CN110221858A
CN110221858A CN201910529582.5A CN201910529582A CN110221858A CN 110221858 A CN110221858 A CN 110221858A CN 201910529582 A CN201910529582 A CN 201910529582A CN 110221858 A CN110221858 A CN 110221858A
Authority
CN
China
Prior art keywords
node
analogue data
type
multiway tree
current traverse
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910529582.5A
Other languages
Chinese (zh)
Inventor
余珍
史斌
殷凇
李毅
万磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WeBank Co Ltd
Original Assignee
WeBank 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 WeBank Co Ltd filed Critical WeBank Co Ltd
Priority to CN201910529582.5A priority Critical patent/CN110221858A/en
Publication of CN110221858A publication Critical patent/CN110221858A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management

Abstract

The present invention relates to financial technology technical field, a kind of analogue data generation method, device, equipment and computer readable storage medium are disclosed.The analogue data generation method includes: acquisition interface document, and the interface document includes the attribute information of data element;Each data element in the interface document is traversed using recursive fashion, and multiway tree is constructed according to the sequence number in the attribute information;Each node in the multiway tree is traversed, and default create-rule is pressed according to the type of current traverse node and generates corresponding analogue data.The present invention is able to solve the problem that artificial hand-coding analogue data is time-consuming and laborious, efficiency is lower in the prior art.

Description

Analogue data generation method, device, equipment and computer readable storage medium
Technical field
The present invention relates to financial technology (Fintech) technical field more particularly to a kind of analogue data generation methods, dress It sets, equipment and computer readable storage medium.
Background technique
With the development of computer technology, more and more technology (big data, distribution, block chain Blockchain, people Work intelligence etc.) it applies in financial field, traditional financial industry gradually changes to financial technology (Fintech), but due to finance The safety of industry, requirement of real-time, also to technology, more stringent requirements are proposed.
In project development process, due to the exploitation of front-end and back-end be it is parallel, in the development process of front end usually It needs to wait the interface of rear end to complete, just can be carried out relevant exploitation test, it is lower so as to cause the development efficiency of front end.To mention The development efficiency of high front end, before exploitation carries out, front and back end personnel can arrange corresponding interface document according to project demands, Wherein, the structure and type of data have been arranged in the interface document, front end developer can be according to interface document mock (mould It is quasi-) data of rear end, to carry out exploitation test.Currently, front-end person who is usually according to interface document come hand-coding mock number According to time-consuming and laborious, efficiency is lower.
Summary of the invention
The main purpose of the present invention is to provide a kind of analogue data generation method, device, equipment and computer-readable deposit Storage media, it is intended to solve the problems, such as that artificial hand-coding analogue data is time-consuming and laborious in the prior art, efficiency is lower.
To achieve the above object, the present invention provides a kind of analogue data generation method, the analogue data generation method packet It includes:
Interface document is obtained, the interface document includes the attribute information of data element;
Each data element in the interface document is traversed using recursive fashion, and according to the sequence in the attribute information Row number constructs multiway tree;
Each node in the multiway tree is traversed, and default create-rule is pressed according to the type of current traverse node and is generated Corresponding analogue data.
Optionally, each node in the multiway tree includes corresponding data attribute of an element information, described in the traversal Each node in multiway tree, and default create-rule is pressed according to the type of the first current traverse node and generates corresponding simulation number According to the step of include:
Each node in the multiway tree is traversed, the first current traverse node is obtained and corresponds to the response in attribute information Type, and according to the type for responding Value Types and determining the described first current traverse node;
If the type of the first current traverse node is nonleaf node, empty array is generated, the sky array definition is returned The analogue data returned is the analogue data of the branch node of the described first current traverse node;
If the type of the first current traverse node is leaf node, detect whether the response Value Types are first Preset kind;
If the response Value Types are the first preset kind, obtain the described first current traverse node and correspond to attribute information In response title, and generate according to the response title analogue data of corresponding types at random;
If the response Value Types are not the first preset kind, corresponding types are generated at random according to the response Value Types Analogue data.
Optionally, before the step of whether the detection response Value Types are the first preset kind, further includes:
It detects whether to receive the customized canonical that user terminal is sent;
If not receiving the customized canonical of user terminal transmission, then follow the steps: the detection response Value Types whether be First preset kind;
If receiving the customized canonical of user terminal transmission, the customized canonical, the customized envelope of holomorphy are obtained Include User- defined Node canonical and customized analogue data canonical;
Whether accorded with according to the described first current corresponding attribute information detection of traverse node first current traverse node Close the User- defined Node canonical;
If the first current traverse node meets the User- defined Node canonical, according to the customized analogue data Canonical generates corresponding analogue data;
If the first current traverse node does not meet the User- defined Node canonical, thens follow the steps: detecting the sound Answer whether Value Types are the first preset kind.
Optionally, the step of determining the type of the described first current traverse node according to response Value Types packet It includes:
Detect whether the response Value Types are the second preset kind;
If the response Value Types are the second preset kind, it is determined that the type of the first current traverse node is n omicronn-leaf Node;
If the response Value Types are not the second preset kind, it is determined that the type of the first current traverse node is leaf Child node.
Optionally, the analogue data generation method further include:
When receiving analogue data modification instruction, the type of the analogue data modification instruction is determined;
It is still interface document modification class that the type for judging the analogue data modification instruction, which is analogue data modification type, Type;
If the type of the analogue data modification instruction is that analogue data modifies type, modified according to the analogue data Instruction obtains target modification node and target modification analogue data;
The target modification node is inquired in the multiway tree, and the analogue data of the target modification node is updated For the target modification analogue data.
Optionally, it is still interface that the type of the judgement analogue data modification instruction, which is analogue data modification type, Document was modified after the step of type, further includes:
If the type of the analogue data modification instruction is that interface document modifies type, modified according to the analogue data Instruction obtains modified interface document;
New multiway tree is constructed based on the modified interface document, and generates corresponding new analogue data;
A upper multiway tree and its corresponding analogue data are obtained, based on the default rule that merges to the mould of a upper multiway tree Quasi- data and the new analogue data of the new multiway tree merge.
Optionally, described based on the default analogue data for merging rule to a upper multiway tree and the new multiway tree New analogue data the step of merging include:
Each node of a upper multiway tree is traversed, and detects and whether there is in the new multiway tree with second currently The identical node of traverse node;
If there is no nodes identical with the second current traverse node in the new multiway tree, in the new multi-fork The described second current traverse node and its analogue data are added in tree;
If there is node identical with the second current traverse node in the new multiway tree, by the new multiway tree In the presence of node identical with the described second current traverse node be denoted as target same node point, and it is current to detect described second Whether the corresponding analogue data V1 of the traverse node and corresponding analogue data V2 of the target same node point is array object;
If the V1 and the V2 are not array object, by target same node point pair described in the new multiway tree The analogue data V2 answered is updated to the corresponding analogue data V1 of the described second current traverse node;
If the V1 and the V2 are array object, the number of the branch node of the described second current traverse node is obtained Amount, and the branch node of the target same node point is replicated under the target same node point, so that after replicated Target same node point under branch node quantity it is identical as the quantity of branch node of the described second current traverse node;
Detect the described second current traverse node the corresponding analogue data V3 of branch node and it is described it is replicated after mesh Whether the corresponding analogue data V4 of branch node marked under same node point is array object;
If the V3 and the V4 are not array object, loop through, it is multiple by being passed through described in the new multiway tree The corresponding analogue data V4 correspondence of the branch node under target same node point after system is updated to the described second current traverse node The corresponding analogue data V3 of branch node;
If the V3 and the V4 are array object, the described second current traverse node is divided using recursive fashion The corresponding analogue data V3 of Zhi Jiedian and it is described it is replicated after target same node point under the corresponding analogue data of branch node V4 is merged.
In addition, to achieve the above object, the present invention also provides a kind of analogue data generating means, the analogue data is generated Device includes:
First obtains module, and for obtaining interface document, the interface document includes the attribute information of data element;
First building module, for traversing each data element in the interface document using recursive fashion, and according to Sequence number in the attribute information constructs multiway tree;
Data generation module, for traversing each node in the multiway tree, and according to the type of current traverse node Corresponding analogue data is generated by default create-rule.
In addition, to achieve the above object, the present invention also provides a kind of analogue data generating device, the analogue data is generated Equipment includes: that the analogue data that can run on the memory and on the processor of memory, processor and being stored in is raw At program, the analogue data generates when program is executed by the processor and realizes analogue data generation method as described above Step.
In addition, to achieve the above object, it is described computer-readable the present invention also provides a kind of computer readable storage medium It is stored with analogue data on storage medium and generates program, the analogue data generates when program is executed by processor and realizes institute as above The step of analogue data generation method stated.
The present invention provides a kind of analogue data generation method, device, equipment and computer readable storage medium, passes through acquisition Interface document, interface document include the attribute information of data element;Each number in the interface document is traversed using recursive fashion Multiway tree is constructed according to element, and according to the sequence number in the attribute information of data element;Each node in multiway tree is traversed, and Default create-rule, which is pressed, according to the type of current traverse node generates corresponding analogue data.By the above-mentioned means, the present invention is first Multiway tree is intelligently generated according to interface document, and then generates corresponding analogue data, to realize automatic according to interface document It generates analogue data and development efficiency can be improved without developer's hand-coding analogue data.
Detailed description of the invention
Fig. 1 is the device structure schematic diagram for the hardware running environment that the embodiment of the present invention is related to;
Fig. 2 is the flow diagram of analogue data generation method first embodiment of the present invention;
Fig. 3 is description scheme schematic diagram of the interface document that is related to of first embodiment of the invention for an interface;
Fig. 4 is the flow diagram of analogue data generation method second embodiment of the present invention;
Fig. 5 is the functional block diagram of analogue data generating means first embodiment of the present invention.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
Referring to Fig.1, Fig. 1 is the device structure schematic diagram for the hardware running environment that the embodiment of the present invention is related to.
Analogue data generating device of the embodiment of the present invention can be smart phone, be also possible to PC (Personal Computer, personal computer), tablet computer, the terminal devices such as portable computer.
As shown in Figure 1, the analogue data generating device may include: processor 1001, such as CPU, communication bus 1002, User interface 1003, network interface 1004, memory 1005.Wherein, communication bus 1002 is for realizing between these components Connection communication.User interface 1003 may include display screen (Display), input unit such as keyboard (Keyboard), optional User interface 1003 can also include standard wireline interface and wireless interface.Network interface 1004 optionally may include standard Wireline interface, wireless interface (such as Wi-Fi interface).Memory 1005 can be high speed RAM memory, be also possible to stable Memory (non-volatile memory), such as magnetic disk storage.Memory 1005 optionally can also be independently of aforementioned The storage device of processor 1001.
It will be understood by those skilled in the art that analogue data generating device structure shown in Fig. 1 is not constituted to simulation The restriction of data generating apparatus may include perhaps combining certain components or different than illustrating more or fewer components Component layout.
As shown in Figure 1, as may include that operating system, network are logical in a kind of memory 1005 of computer storage medium Believe that module, Subscriber Interface Module SIM and analogue data generate program.
In terminal shown in Fig. 1, network interface 1004 is mainly used for connecting background server, carries out with background server Data communication;User interface 1003 is mainly used for connecting client, carries out data communication with client;And processor 1001 can be with For calling the analogue data stored in memory 1005 to generate program, and execute each step of following analogue data generation method Suddenly.
Based on above-mentioned hardware configuration, each embodiment of analogue data generation method of the present invention is proposed.
The present invention provides a kind of analogue data generation method.
It is the flow diagram of analogue data generation method first embodiment of the present invention referring to Fig. 2, Fig. 2.
In the present embodiment, which includes:
Step S10 obtains interface document, and the interface document includes the attribute information of data element;
The analogue data generation method of the present embodiment is realized by analogue data generating device, which is with server Example is illustrated.In the present embodiment, server first obtains interface document, and interface document includes the attribute information of data element, Wherein, attribute information includes sequence number, response title and response Value Types.It should be noted that due in the prior art Interface document is usually have swagger (an open source software frame produces interface document) to generate or rear end staff It writes, there is no the nested layer level relationship between maintenance parameters due to the interface document generated by swagger, it is difficult to construct multilayer The analogue data (mock data) of grade nest relation, therefore, the interface document used in the present embodiment is flat hierarchical structure Interface document, to generate the analogue data of multi-layer nest relation, wherein the interface document of the flat hierarchical structure can be by rear end Staff writes, and can also be automatically generated with relevant software, the interface document of flat hierarchical structure can provide multiple The metadata of interface, the description scheme of each interface can be reduced to (description scheme that Fig. 3 only shows an interface) as shown in Figure 3, It include the attribute information of multiple data elements, such as sequence referring to Fig. 3, RspFields (Response Fields, response field) Number seq, response title name and response Value Types FieldType, sequence number seq are used to show the pass between each data element System, who is whose daughter element, the Serial No. 1.2 of the data element 2 in order to subsequent builds multiway tree, such as in Fig. 3, data The Serial No. 1 of element 1, then data element 2 is the daughter element of data element 1, and when constructing multiway tree, data element 2 is corresponding Node should be the child node of 1 corresponding node of data element.
Step S20 traverses each data element in the interface document using recursive fashion, and is believed according to the attribute Sequence number in breath constructs multiway tree;
After getting interface document, each data element in the interface document, and root are traversed using recursive fashion Multiway tree is constructed according to the sequence number in the attribute information of data element, wherein, can be by the category of each data element after the completion of building Property information is assigned to data (data) attribute of each node, and corresponding, each node in multiway tree includes corresponding data element Attribute information.For the building process of multiway tree, specifically, root node can be initialized first, then since root node, traversal is each A data element, successively to find the ancestor node of destination node according to the sequence number of each data element, if the ancestor node It is not present, then generates the ancestor node.Otherwise, next ancestor node is continually looked for.Recurrence executes, until destination node, most Throughout one's life at obtaining multiway tree.
It should be noted that in a particular embodiment, can also be traversed, but be compared by the way of if-else It is traversed in if-else, multiway tree is generated using recursive fashion, algorithm complexity can be reduced, improved efficiency, in addition, recursive fashion Sequence no requirement (NR) to data field, more flexibly.
Step S30 traverses each node in the multiway tree, and is generated according to the type of current traverse node by default Rule generates corresponding analogue data.
After building obtains multiway tree, each node in multiway tree is traversed, and press according to the type of current traverse node Default create-rule generates corresponding analogue data.Specifically, each node in multiway tree includes the category of corresponding data element Property information, step S30 include:
Step a1 traverses each node in the multiway tree, obtains the first current traverse node and corresponds in attribute information Response Value Types, and determine the type of the described first current traverse node according to the response Value Types;
Each node in the multiway tree that above-mentioned building obtains first is traversed, the first current traverse node is obtained and corresponds to attribute letter Response Value Types in breath, and Value Types determine the type of the first current traverse node according to response.Wherein, leaf node is There is no the node of branch node in multiway tree, nonleaf node is the node for having branch node in multiway tree, and step is " according to described Response Value Types determine the type of the described first current traverse node " include:
Step a11, detects whether the response Value Types are the second preset kind;
Step a12, if the response Value Types are the second preset kind, it is determined that the class of the first current traverse node Type is nonleaf node;
Step a13, if the response Value Types are not the second preset kind, it is determined that the first current traverse node Type is leaf node.
Whether detection response Value Types are the second preset kind, wherein the second preset kind is that List (is used for table in programming Show list type);If response Value Types are the second preset kind, when as List, it is determined that the class of the first current traverse node Type is nonleaf node;If responding Value Types is not the second preset kind, i.e., when not being List, it is determined that the first current traverse node Type be leaf node.
If the type of the first current traverse node is nonleaf node, a2 is thened follow the steps: generating empty array, the sky Array defines the analogue data of return as the analogue data of the branch node of the described first current traverse node;
If the type of the first current traverse node is nonleaf node, empty array is generated, wherein sky array definition returns Analogue data be the first current traverse node branch node analogue data, the analogue data of return can for original value or Array object.
If the type of the first current traverse node is leaf node, thens follow the steps a3: detecting the response class Whether type is the first preset kind;
If the type of the first current traverse node is leaf node, detect whether response Value Types are the first default class Type, wherein the first preset kind is String (identifier of definition character string type variable is used in programming).
It is corresponding to obtain the described first current traverse node if the response Value Types are the first preset kind by step a4 Response title in attribute information, and the analogue data of corresponding types is generated according to the response title at random;
If response Value Types are the first preset kind, i.e., when not being String, can continue to be worth title progress according to response carefully Point, specifically, obtaining the first current traverse node corresponds to the response title in attribute information, and value title is random according to response The analogue data of corresponding types is generated, for example, including email (mailbox) in response title, then generates random mailbox as mould Quasi- data;Include mobile (mobile phone) in response title, then generates random cell-phone number as analogue data;Response name Include id (coding) in title, then generates random coded as analogue data;It include (the city city name in response title Name), then random city name is generated as analogue data.
Step a5 is generated if the response Value Types are not the first preset kind according to the response Value Types at random The analogue data of corresponding types.
If response Value Types are not the first preset kind, when as String, then Value Types generate pair at random according to response Answer the analogue data of type.For example, then being given birth to when response Value Types are bool (boolean, for indicating Boolean type variable in programming) At random boolean value as analogue data;When response Value Types are date (in programming for indicate date type), then generate with The machine date is as analogue data;When response Value Types are Int (for indicating integer type variable in programming), then generate random whole Number is used as analogue data;When response Value Types are BigDecimal (for indicating big several classes of types in programming), then generate random floating Points are used as analogue data.
Further, before above-mentioned steps a3, can also include:
Step a6 detects whether the customized canonical for receiving user terminal transmission;
If not receiving the customized canonical of user terminal transmission, then follow the steps a3: whether the detection response Value Types For the first preset kind;
In the present embodiment, it is the actual needs for meeting user, the flexibility that analogue data generates is improved, in the present embodiment User can pass through the create-rule of user terminal customized analogue data in configuration file, i.e., customized canonical, Jin Erfa in advance Server is given, server can be generated preferentially using the customized canonical that user formulates when generating random data.Cause This, detects that the type of the first current traverse node is leaf node, when need to correspond to generation analogue data, can first detect whether to connect Receive the customized canonical of user terminal transmission.
If receiving the customized canonical of user terminal transmission, then follow the steps a7: obtaining the customized canonical, it is described from Defining canonical includes User- defined Node canonical and customized analogue data canonical;
If detecting the customized canonical for receiving user terminal transmission, at this point, preferentially using the generation pair of customized canonical The analogue data answered, specifically, first obtaining the customized canonical, wherein customized canonical includes User- defined Node canonical and oneself Analogue data canonical is defined, User- defined Node canonical and customized analogue data canonical respectively indicate user's customized needle in advance To the regular expression of node and analogue data, regular expression is exactly acted a kind of logical formula of string operation The combination of some specific characters and these specific characters that first define forms one " regular character string ", this " regular word Symbol string " is used to express a kind of filter logic to character string.
Step a8, according to the described first current corresponding attribute information detection of traverse node first current traverse node Whether the User- defined Node canonical is met;
If the first current traverse node meets the User- defined Node canonical, then follow the steps a9: according to it is described from Analogue data canonical is defined, corresponding analogue data is generated;
After getting User- defined Node canonical and customized analogue data canonical, first according to the first current traverse node pair The attribute information answered detects whether the first current traverse node meets User- defined Node canonical, if the first current traverse node symbol It closes User- defined Node canonical and generates corresponding analogue data then according to customized analogue data canonical.It should be noted that from Definition node canonical and customized analogue data canonical can be one-to-one or many-to-one relationship, when the two is one-to-one pass System and User- defined Node canonical and customized analogue data are when being one, or, when both be many-to-one relationship and make by oneself Adopted node canonical is multiple, customized analogue data when being one, illustrates only one group of User- defined Node canonical and customized mould Quasi- data, at this point, if the first current traverse node meets User- defined Node canonical, it is raw according to customized analogue data canonical At corresponding analogue data.When User- defined Node canonical and customized analogue data are multiple, regardless of the two is one-to-one Relationship or many-to-one relationship, have multiple groups User- defined Node canonical and customized analogue data at this time, at this point, if detection Meet a certain User- defined Node canonical to the first current traverse node, at this point, then met according to the first current traverse node Customized analogue data canonical corresponding to User- defined Node canonical, to generate corresponding analogue data.
If the first current traverse node does not meet the User- defined Node canonical, a3 is thened follow the steps: described in detection Respond whether Value Types are the first preset kind.
If the first current traverse node does not meet User- defined Node canonical, at this point, needing to generate using default canonical Analogue data specifically, whether first detection response Value Types are the first preset kind, and then executes subsequent step according to detection, Subsequent execution process can refer to above embodiment, not repeat herein.
In addition, it should be noted that, in the generating process of above-mentioned analogue data, it is preferable that can be by calling mock.js Tool generates corresponding analogue data, certainly, in a particular embodiment, other tools or customized random letter also can be used Number generates random analogue data.It is primary included that Javascript (a kind of literal translation formula scripting language) can be used for example Math.random method, which generates, makes the random digit of range by oneself, using as analogue data.
The present invention is in the project development process of bank and other financial mechanism, after getting interface document, first uses recurrence Mode traverses each data element in the interface document, and constructs multi-fork according to the sequence number in the attribute information of data element Tree;And then each node in multiway tree is traversed, and corresponding mould is generated by the above process according to the type of current traverse node Quasi- data generate analogue data automatically according to interface document so as to realize, and avoid developer's hand-coding simulation number According to the human cost of bank and other financial mechanism can be saved, at the same time it can also improve the exploitation of bank and other financial mechanism application and development Efficiency.
The embodiment of the present invention provides a kind of analogue data generation method, and by obtaining interface document, interface document includes number According to attribute of an element information;Each data element in the interface document is traversed using recursive fashion, and according to data element Sequence number in attribute information constructs multiway tree;Each node in multiway tree is traversed, and according to the type of current traverse node Corresponding analogue data is generated by default create-rule.By the above-mentioned means, first according to interface document intelligence in the embodiment of the present invention Multiway tree can be generated, and then generates corresponding analogue data, analogue data is automatically generated according to interface document to realize, from Without developer's hand-coding analogue data, development efficiency can be improved.
It further, is the flow diagram of analogue data generation method second embodiment of the present invention referring to Fig. 4, Fig. 4.
Based on first embodiment shown in Fig. 2, after step S30, the analogue data generation method further include:
Step S40 determines the type of the analogue data modification instruction when receiving analogue data modification instruction;
In project development process, front-end and back-end developer can carry out debugging modification to analogue data, it is general and Speech, front end developer be directly modify to analogue data, and rear end developer be by modifying to interface document, into And update analogue data.Corresponding, server first determines that analogue data modification refers to when receiving analogue data modification instruction The type of order.
Step S50, it is still interface text that the type for judging the analogue data modification instruction, which is analogue data modification type, Shelves modification type;
After the type for determining analogue data modification instruction, the type of analogue data modification instruction is judged to simulate number It is still interface document modification type according to modification type.
If the type of the analogue data modification instruction is that analogue data modifies type, S61 is thened follow the steps: according to described Analogue data modification instruction obtains target modification node and target modification analogue data;
Step S62, inquires the target modification node in the multiway tree, and by the simulation of the target modification node Data are updated to the target modification analogue data.
If the type of analogue data modification instruction is that analogue data modifies type, at this point, simulation number can be modified directly According to specifically, first modifying instruction according to analogue data obtains target modification node and target modification analogue data, then, more The target modification node is inquired in fork tree, and then the analogue data of target modification node is updated to target modification analogue data.
If the type of the analogue data modification instruction is that interface document modifies type, S63 is thened follow the steps: according to described Analogue data modification instruction obtains modified interface document;
Step S64 constructs new multiway tree based on the modified interface document, and generates corresponding new simulation number According to;
If the type of analogue data modification instruction is that interface document modifies type, at this point, needing first to be connect according to modified Mouth document regenerates new multiway tree and corresponding analogue data, then the simulation number to avoid overriding a upper multiway tree According to the analogue data of the analogue data of new multiway tree and a upper multiway tree need to being merged processing, specifically, elder generation is according to mould Quasi- data modification instruction obtains modified interface document, is then based on modified interface document and constructs new multiway tree, and Generate corresponding new analogue data, wherein the generation method of the construction method of new multiway tree and new analogue data can join According to above-mentioned first embodiment, do not repeat herein.
Step S65 obtains a upper multiway tree and its corresponding analogue data, based on the default rule that merges to more than described upper one The new analogue data of the analogue data and the new multiway tree of pitching tree merges.
Obtain new multiway tree in building, and after generating corresponding new analogue data, obtain a upper multiway tree and its Corresponding analogue data is then based on the default rule that merges to the analogue data of a upper multiway tree and the new mould of new multiway tree Quasi- data merge.
Wherein, step is " based on the default analogue data for merging rule to a upper multiway tree and the new multiway tree New analogue data merge " include:
Step b1, traverses each node of the upper multiway tree, and detect whether there is in the new multiway tree with The identical node of second current traverse node;
In merging process, first traverse each node of a upper multiway tree, and detect whether there is in new multiway tree with The identical node of second current traverse node.It should be noted that the response in attribute information can be corresponded to by detection node Whether title is identical, to detect whether that there are same node points.
If thening follow the steps b2 there is no node identical with the second current traverse node in the new multiway tree: The described second current traverse node and its analogue data are added in the new multiway tree;
If need to add in new multiway tree in new multiway tree there is no node identical with the second current traverse node Add the second current traverse node and its analogue data.
If there is node identical with the second current traverse node in the new multiway tree, b3 is thened follow the steps: by institute It states the node identical with the described second current traverse node in the presence of new multiway tree and is denoted as target same node point, and detect Whether the corresponding analogue data V1 and corresponding analogue data V2 of the target same node point of the second current traverse node is equal For array object;
It, can will be new more for convenience of stating if there is node identical with the second current traverse node in new multiway tree Node identical with the second current traverse node in the presence of fork tree is denoted as target same node point, then detects second current time Whether the corresponding analogue data of joint-running point (being denoted as V1) and the corresponding analogue data of target same node point (being denoted as V2) are array Object.It is appreciated that in the specific implementation process, without by the presence of new multiway tree with the second current traverse node phase Same node is denoted as target same node point, and subsequent statement is merely for convenience of in the present embodiment.
If the V1 and the V2 are not array object, b4 is thened follow the steps: by mesh described in the new multiway tree The corresponding analogue data V2 of mark same node point is updated to the corresponding analogue data V1 of the described second current traverse node;
If V1 and V2 are not at least one in array object, i.e. V1 and V2 when being original value, at this point, then will be new more The corresponding analogue data V2 of target same node point is updated to the corresponding analogue data V1 of the second current traverse node in fork tree, that is, uses V1 covers V2.
If the V1 and the V2 are array object, b5 is thened follow the steps: obtaining the second current traverse node The quantity of branch node, and the branch node of the target same node point is replicated under the target same node point, with So that the quantity of the branch node under target same node point after replicated and the branch node of the described second current traverse node Quantity it is identical;
Step b6, detect the corresponding analogue data V3 of branch node of the second current traverse node with it is described replicated Whether the corresponding analogue data V4 of the branch node under target same node point afterwards is array object;
If V1 and V2 are array object, at this point, the quantity of the branch node of the second current traverse node is obtained, and The branch node of the target same node point is replicated under target same node point, so that the target same node point after replicated Under branch node quantity it is identical as the quantity of branch node of the second current traverse node.Then, it traverses second current time Joint-running point and it is replicated after target same node point under each branch node, with detect the second current traverse node branch node Corresponding analogue data (being denoted as V3) with it is replicated after target same node point under the corresponding analogue data of branch node (be denoted as It V4 whether is) array object.
If the V3 and the V4 are not array object, b7 is thened follow the steps: looping through, by the new multiway tree Described in it is replicated after target same node point under the corresponding analogue data V4 of branch node corresponding be updated to described second and work as The corresponding analogue data V3 of the branch node of preceding traverse node;
If the V3 and the V4 are array object, b8 is thened follow the steps: current to described second using recursive fashion The corresponding analogue data V3 of the branch node of traverse node and it is described it is replicated after target same node point under branch node pair The analogue data V4 answered is merged.
If V3 and V4 be not at least one in array object, i.e. V3 and V4 be original value when, at this point, then circulation time Go through, will be replicated in new multiway tree after target same node point under branch node corresponding analogue data V4 correspondence be updated to The corresponding analogue data V3 of the branch node of second current traverse node covers V4 with V3.If V3 and V4 are array object, At this point, then using recursive fashion analogue data V3 corresponding to the branch node of the second current traverse node and it is replicated after mesh The corresponding analogue data V4 of branch node under mark same node point is merged.
It is directed to two different modification types in the present embodiment, is modified using distinct methods to analogue data, realizes The automatic modification of analogue data is updated, searches by hand without developer and updates analogue data, so as to further mention High development efficiency.
The present invention also provides a kind of analogue data generating means.
It is the functional block diagram of analogue data generating means first embodiment of the present invention referring to Fig. 5, Fig. 5.
As shown in figure 5, the analogue data generating means include:
First obtains module 10, and for obtaining interface document, the interface document includes the attribute information of data element;
First building module 20, for traversing each data element in the interface document, and root using recursive fashion Multiway tree is constructed according to the sequence number in the attribute information;
Data generation module 30, for traversing each node in the multiway tree, and according to the class of current traverse node Type presses default create-rule and generates corresponding analogue data.
Further, each node in the multiway tree includes corresponding data attribute of an element information, and the data are raw Include: at module 30
It is corresponding to obtain the first current traverse node for traversing each node in the multiway tree for type determining units Response Value Types in attribute information, and according to the type for responding Value Types and determining the described first current traverse node;
First generation unit generates empty array if the type for the described first current traverse node is nonleaf node, The analogue data that the sky array defines return is the analogue data of the branch node of the described first current traverse node;
First detection unit detects the sound if the type for the described first current traverse node is leaf node Answer whether Value Types are the first preset kind;
Second generation unit obtains described first current time if being the first preset kind for the response Value Types Joint-running point corresponds to the response title in attribute information, and generates the simulation number of corresponding types at random according to the response title According to;
Third generation unit, if not being the first preset kind for the response Value Types, according to the response class Type generates the analogue data of corresponding types at random.
Further, the generation module 30 further include:
Second detection unit, for detecting whether receiving the customized canonical of user terminal transmission;
The first detection unit, if being thened follow the steps specifically for the customized canonical for not receiving user terminal transmission: Detect whether the response Value Types are the first preset kind;
First acquisition unit, if the customized canonical for receiving user terminal transmission, obtains the customized canonical, The customized canonical includes User- defined Node canonical and customized analogue data canonical;
Third detection unit, for being worked as according to the corresponding attribute information detection described first of the described first current traverse node Whether preceding traverse node meets the User- defined Node canonical;
4th generation unit, if meeting the User- defined Node canonical, basis for the described first current traverse node The customized analogue data canonical, generates corresponding analogue data;
The first detection unit, if not meeting the User- defined Node also particularly useful for the described first current traverse node Canonical thens follow the steps: whether the detection response Value Types are the first preset kind.
Further, the type determining units, are specifically used for:
Detect whether the response Value Types are the second preset kind;
If the response Value Types are the second preset kind, it is determined that the type of the first current traverse node is n omicronn-leaf Node;
If the response Value Types are not the second preset kind, it is determined that the type of the first current traverse node is leaf Child node.
Further, the analogue data generating means further include:
Determination type module, for determining the analogue data modification instruction when receiving analogue data modification instruction Type;
Type judging module, for judging that the type of the analogue data modification instruction modifies type still for analogue data Type is modified for interface document;
Second obtains module, if the type for analogue data modification instruction is that analogue data modifies type, root Instruction, which is modified, according to the analogue data obtains target modification node and target modification analogue data;
Data update module, for inquiring the target modification node in the multiway tree, and by the target modification The analogue data of node is updated to the target modification analogue data.
Further, the analogue data generating means further include:
Third obtains module, if the type for analogue data modification instruction is that interface document modifies type, root Instruction, which is modified, according to the analogue data obtains modified interface document;
Second building module, for constructing new multiway tree based on the modified interface document, and generates corresponding New analogue data;
Data combiners block, it is right based on default merging rule for obtaining a upper multiway tree and its corresponding analogue data The analogue data of a upper multiway tree and the new analogue data of the new multiway tree merge.
Further, the data combiners block includes:
4th detection unit for traversing each node of a upper multiway tree, and detects in the new multiway tree With the presence or absence of node identical with the second current traverse node;
Node adding unit, if for there is no sections identical with the second current traverse node in the new multiway tree Point then adds the described second current traverse node and its analogue data in the new multiway tree;
5th detection unit, if for there is node identical with the second current traverse node in the new multiway tree, Node identical with the described second current traverse node in the presence of the new multiway tree is then denoted as target same node point, And detect the described second current corresponding analogue data V1 of the traverse node and corresponding analogue data V2 of the target same node point It whether is array object;
First updating unit will be in the new multiway tree if not being array object for the V1 and the V2 The corresponding analogue data V2 of the target same node point is updated to the corresponding analogue data V1 of the described second current traverse node;
Node copied cells obtain the described second current traversal if being array object for the V1 and the V2 The quantity of node branch node, and the branch node of the target same node point is answered under the target same node point It makes, so that the branch of the quantity of the branch node under the target same node point after replicated and the described second current traverse node The quantity of node is identical;
6th detection unit, the corresponding analogue data V3 of branch node for detecting the described second current traverse node with It is described it is replicated after target same node point under the corresponding analogue data V4 of branch node whether be array object;
Second updating unit loops through if not being array object for the V3 and the V4, will be described new Described in multiway tree it is replicated after target same node point under the corresponding analogue data V4 of branch node it is corresponding be updated to it is described The corresponding analogue data V3 of the branch node of second current traverse node;
Data combination unit, if being array object for the V3 and the V4, using recursive fashion to described the The corresponding analogue data V3 of the branch node of two current traverse nodes and it is described it is replicated after target same node point under branch The corresponding analogue data V4 of node is merged.
Wherein, the function of modules is realized and above-mentioned analogue data generation method reality in above-mentioned analogue data generating means It is corresponding to apply each step in example, function and realization process no longer repeat one by one here.
The present invention also provides a kind of computer readable storage medium, simulation number is stored on the computer readable storage medium According to program is generated, the analogue data generates the simulation realized as described in any of the above item embodiment when program is executed by processor The step of data creation method.
The specific embodiment of computer readable storage medium of the present invention and each embodiment base of above-mentioned analogue data generation method This is identical, and therefore not to repeat here.
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-row His property includes, so that the process, method, article or the system that include a series of elements not only include those elements, and And further include other elements that are not explicitly listed, or further include for this process, method, article or system institute it is intrinsic Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including being somebody's turn to do There is also other identical elements in the process, method of element, article or system.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art The part contributed out can be embodied in the form of software products, which is stored in one as described above In storage medium (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that terminal device (it can be mobile phone, Computer, server, air conditioner or network equipment etc.) execute method described in each embodiment of the present invention.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills Art field, is included within the scope of the present invention.

Claims (10)

1. a kind of analogue data generation method, which is characterized in that the analogue data generation method includes:
Interface document is obtained, the interface document includes the attribute information of data element;
Each data element in the interface document is traversed using recursive fashion, and according to the sequence number in the attribute information Construct multiway tree;
Each node in the multiway tree is traversed, and default create-rule is pressed according to the type of current traverse node and generates correspondence Analogue data.
2. analogue data generation method as described in claim 1, which is characterized in that each node in the multiway tree includes Corresponding data attribute of an element information, each node traversed in the multiway tree, and according to the first current traverse node Type by default create-rule generate corresponding analogue data the step of include:
Each node in the multiway tree is traversed, the first current traverse node is obtained and corresponds to the response class in attribute information Type, and according to the type for responding Value Types and determining the described first current traverse node;
If the type of the first current traverse node is nonleaf node, empty array is generated, the sky array defines return Analogue data is the analogue data of the branch node of the described first current traverse node;
If the type of the first current traverse node is leaf node, detect whether the response Value Types are first default Type;
If the response Value Types are the first preset kind, obtain the described first current traverse node and correspond in attribute information Response title, and the analogue data of corresponding types is generated according to the response title at random;
If the response Value Types are not the first preset kind, the mould of corresponding types is generated at random according to the response Value Types Quasi- data.
3. analogue data generation method as claimed in claim 2, which is characterized in that whether the detection response Value Types Before the step of for the first preset kind, further includes:
It detects whether to receive the customized canonical that user terminal is sent;
If not receiving the customized canonical of user terminal transmission, then follow the steps: whether the detection response Value Types are first Preset kind;
If receiving the customized canonical of user terminal transmission, the customized canonical is obtained, the customized canonical includes certainly Definition node canonical and customized analogue data canonical;
Whether meet institute according to the described first current corresponding attribute information detection of traverse node first current traverse node State User- defined Node canonical;
If the first current traverse node meets the User- defined Node canonical, just according to the customized analogue data Then, corresponding analogue data is generated;
If the first current traverse node does not meet the User- defined Node canonical, thens follow the steps: detecting the response Whether type is the first preset kind.
4. analogue data generation method as claimed in claim 2, which is characterized in that described to be determined according to the response Value Types The step of type of the first current traverse node includes:
Detect whether the response Value Types are the second preset kind;
If the response Value Types are the second preset kind, it is determined that the type of the first current traverse node is non-leaf segment Point;
If the response Value Types are not the second preset kind, it is determined that the type of the first current traverse node is leaf section Point.
5. analogue data generation method as described in claim 1, which is characterized in that the analogue data generation method is also wrapped It includes:
When receiving analogue data modification instruction, the type of the analogue data modification instruction is determined;
It is still interface document modification type that the type for judging the analogue data modification instruction, which is analogue data modification type,;
If the type of the analogue data modification instruction is that analogue data modifies type, is modified and instructed according to the analogue data Obtain target modification node and target modification analogue data;
The target modification node is inquired in the multiway tree, and the analogue data of the target modification node is updated to institute State target modification analogue data.
6. analogue data generation method as claimed in claim 5, which is characterized in that the judgement analogue data modification refers to The type of order be analogue data modification type be still interface document modification type the step of after, further includes:
If the type of the analogue data modification instruction is that interface document modifies type, is modified and instructed according to the analogue data Obtain modified interface document;
New multiway tree is constructed based on the modified interface document, and generates corresponding new analogue data;
A upper multiway tree and its corresponding analogue data are obtained, based on the default rule that merges to the simulation number of a upper multiway tree It is merged according to the new analogue data with the new multiway tree.
7. analogue data generation method as claimed in claim 6, which is characterized in that described regular to described based on default merging The step of analogue data of a upper multiway tree and the new analogue data of the new multiway tree merge include:
Each node of a upper multiway tree is traversed, and detects in the new multiway tree and is currently traversed with the presence or absence of with second The identical node of node;
If there is no nodes identical with the second current traverse node in the new multiway tree, in the new multiway tree Add the described second current traverse node and its analogue data;
If there is node identical with the second current traverse node in the new multiway tree, by institute in the new multiway tree Existing node identical with the described second current traverse node is denoted as target same node point, and detects the described second current traversal Whether the corresponding analogue data V1 of the node and corresponding analogue data V2 of the target same node point is array object;
It is if the V1 and the V2 are not array object, target same node point described in the new multiway tree is corresponding Analogue data V2 is updated to the corresponding analogue data V1 of the described second current traverse node;
If the V1 and the V2 are array object, the quantity of the branch node of the described second current traverse node is obtained, And the branch node of the target same node point is replicated under the target same node point, so that the mesh after replicated The quantity for marking the branch node under same node point is identical as the quantity of branch node of the described second current traverse node;
Detect the corresponding analogue data V3 of branch node of the described second current traverse node with it is described it is replicated after target phase It whether is array object with the corresponding analogue data V4 of branch node under node;
If the V3 and the V4 are not array object, loop through, after replicated described in the new multiway tree Target same node point under corresponding point for being updated to the described second current traverse node of the corresponding analogue data V4 of branch node The corresponding analogue data V3 of Zhi Jiedian;
If the V3 and the V4 are array object, saved using branch of the recursive fashion to the described second current traverse node The corresponding analogue data V3 of point and it is described it is replicated after target same node point under the corresponding analogue data V4 of branch node into Row merges.
8. a kind of analogue data generating means, which is characterized in that the analogue data generating means include:
First obtains module, and for obtaining interface document, the interface document includes the attribute information of data element;
First building module, for traversing each data element in the interface document using recursive fashion, and according to described Sequence number in attribute information constructs multiway tree;
Data generation module, for traversing each node in the multiway tree, and according to the type of current traverse node by pre- If create-rule generates corresponding analogue data.
9. a kind of analogue data generating device, which is characterized in that the analogue data generating device includes: memory, processor And be stored in the analogue data that can be run on the memory and on the processor and generate program, the analogue data generates The step of analogue data generation method as described in any one of claims 1 to 7 is realized when program is executed by the processor.
10. a kind of computer readable storage medium, which is characterized in that be stored with simulation number on the computer readable storage medium According to program is generated, the analogue data is generated when program is executed by processor and is realized as described in any one of claims 1 to 7 The step of analogue data generation method.
CN201910529582.5A 2019-06-17 2019-06-17 Analogue data generation method, device, equipment and computer readable storage medium Pending CN110221858A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910529582.5A CN110221858A (en) 2019-06-17 2019-06-17 Analogue data generation method, device, equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910529582.5A CN110221858A (en) 2019-06-17 2019-06-17 Analogue data generation method, device, equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN110221858A true CN110221858A (en) 2019-09-10

Family

ID=67817782

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910529582.5A Pending CN110221858A (en) 2019-06-17 2019-06-17 Analogue data generation method, device, equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN110221858A (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111400178A (en) * 2020-03-13 2020-07-10 深圳前海环融联易信息科技服务有限公司 Automatic interface number making method and device, computer equipment and storage medium
CN111459484A (en) * 2020-03-30 2020-07-28 星辰天合(北京)数据科技有限公司 Method for simulating back-end data during separate development of front end and back end of webpage
CN111563033A (en) * 2020-04-02 2020-08-21 北京明略软件系统有限公司 Method and device for generating simulation data
CN112199112A (en) * 2020-09-30 2021-01-08 京东数字科技控股股份有限公司 Method, device, terminal equipment and storage medium for automatically configuring simulation service
CN112650533A (en) * 2020-12-22 2021-04-13 深圳前海微众银行股份有限公司 Interface document generation method and device and terminal equipment
CN112784552A (en) * 2020-06-05 2021-05-11 珠海金山办公软件有限公司 Table editing method and device
CN113467780A (en) * 2021-06-30 2021-10-01 北京达佳互联信息技术有限公司 Data acquisition method and device, electronic equipment and storage medium
CN116861161A (en) * 2023-09-05 2023-10-10 中国西安卫星测控中心 Real-time space measurement data statistics method based on multi-tree structure

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111400178A (en) * 2020-03-13 2020-07-10 深圳前海环融联易信息科技服务有限公司 Automatic interface number making method and device, computer equipment and storage medium
CN111459484A (en) * 2020-03-30 2020-07-28 星辰天合(北京)数据科技有限公司 Method for simulating back-end data during separate development of front end and back end of webpage
CN111459484B (en) * 2020-03-30 2022-11-29 北京星辰天合科技股份有限公司 Method for simulating back-end data during separate development of front end and back end of webpage
CN111563033A (en) * 2020-04-02 2020-08-21 北京明略软件系统有限公司 Method and device for generating simulation data
CN111563033B (en) * 2020-04-02 2023-06-02 北京明略软件系统有限公司 Simulation data generation method and device
CN112784552B (en) * 2020-06-05 2023-10-27 珠海金山办公软件有限公司 Table editing method and apparatus
CN112784552A (en) * 2020-06-05 2021-05-11 珠海金山办公软件有限公司 Table editing method and device
CN112199112A (en) * 2020-09-30 2021-01-08 京东数字科技控股股份有限公司 Method, device, terminal equipment and storage medium for automatically configuring simulation service
CN112650533A (en) * 2020-12-22 2021-04-13 深圳前海微众银行股份有限公司 Interface document generation method and device and terminal equipment
CN112650533B (en) * 2020-12-22 2024-03-19 深圳前海微众银行股份有限公司 Interface document generation method and device and terminal equipment
CN113467780A (en) * 2021-06-30 2021-10-01 北京达佳互联信息技术有限公司 Data acquisition method and device, electronic equipment and storage medium
CN116861161B (en) * 2023-09-05 2023-11-17 中国西安卫星测控中心 Real-time space measurement data statistics method based on multi-tree structure
CN116861161A (en) * 2023-09-05 2023-10-10 中国西安卫星测控中心 Real-time space measurement data statistics method based on multi-tree structure

Similar Documents

Publication Publication Date Title
CN110221858A (en) Analogue data generation method, device, equipment and computer readable storage medium
Billington et al. PROTEAN: a high-level Petri net tool for the specification and verification of communication protocols
CN109358851A (en) Creation method, device and the computer readable storage medium of chart components
CN104407863B (en) Abstract control model programmer and method
Diaz et al. RMC: A tool to design WWW applications
CN109918499A (en) A kind of file classification method, device, computer equipment and storage medium
CN107203424A (en) A kind of method and apparatus that deep learning operation is dispatched in distributed type assemblies
CN108153853A (en) Chinese Concept Vectors generation method and device based on Wikipedia link structures
CN109564588A (en) Learning data filtering
CN108121742A (en) The generation method and device of user's disaggregated model
CN111782637A (en) Model construction method, device and equipment
CN108460056A (en) Method for converting effective graphic elements of DXF file into JSON data
CN107463935A (en) Application class methods and applications sorter
US20210318947A1 (en) Methods and apparatuses for generating smart contract test case
CN105989067A (en) Method for generating text abstract from image, user equipment and training server
CN113010612A (en) Visual construction method, query method and device for graph data
Cunha et al. Emojinating: Evolving emoji blends
CN109189941A (en) For updating the method, apparatus, equipment and medium of model parameter
CN110442803A (en) Data processing method, device, medium and the calculating equipment executed by calculating equipment
CN110362792A (en) RN file is converted to the method, apparatus and conversion equipment of small routine file
CN110134646A (en) The storage of knowledge platform service data and integrated approach and system
Lane et al. A theory-based dynamical model of innovation processes
CN111159424B (en) Method and device for labeling knowledge graph entity, storage medium and electronic equipment
Seda et al. The minimization of public facilities with enhanced genetic algorithms using war elimination
CN117236624A (en) Issue repairer recommendation method and apparatus based on dynamic graph

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