Operation note system, method and operation object modification information querying method
Technical field
Field is recorded the present invention relates to website operation, and in particular to a kind of operation note system, method and operation object become
More information query method.
Background technology
Current website operation recording mode typically has three kinds:
1. individually write code to assemble corresponding Operation Log for every kind of operation.It is caused in order to record operation in detail
Influence, this scheme needs to write substantial amounts of daily record assembling code, and can not be multiplexed, and causes code to be difficult to safeguard.For big
For type project, different people is responsible for the assembling of different operating daily record, standard be difficult to it is unified, it is extra to add coding and safeguard
Cost.
2. the change that comparison entity object occurs afterwards before operation, Operation Log is used as using changed content.Due to being record
Entity object (correspond to a table in database) changed content, thus when once-through operation is related to multiple entity objects
When, this daily record can not describe the contact between entity object.
3. the change that contrast domain object occurs afterwards before operation, Operation Log is used as using changed content.Have the disadvantage field
There is nest relation in object, the daily record of this schemes generation is readable poor so that the daily record indigestion of generation, it is impossible to directly carry
Supply operation personnel uses.
The content of the invention
The present invention provides a kind of operation note system, method and operation object modification information querying method, can fast simultaneously
And the operation of accurate recording operation personnel is to the influence produced by website.
In order to realize foregoing invention purpose, the technical scheme that the present invention takes is as follows:
A kind of operation note system, including:Application programming interfaces API module, comparison module, configuration module and record mould
Block;
The API module, for recording Operation Log when being called by service code, the Operation Log includes operation
Object is by the data content before and after modification;
The comparison module, for comparing the operation object of the API module record by the data before and after modification
Tolerance is different, obtains operation object changed content;
The configuration module, the metadata for configuring the domain object involved by the Operation Log, obtains metadata
Configuration information;
The logging modle, for after the comparison module obtains the operation object changed content, based on the member
The metadata configurations information that data configuration module is provided, the operation object changed content is recorded with tree.
Preferably, the system also includes:Query processing module, for receiving the inquiry request of the Operation Log
Afterwards, the corresponding operation object changed content of the Operation Log and metadata configurations information are obtained, according to the metadata configurations
Information, generates the change tree of the operation object, the field repairing of the node correspondence operation object of the change tree
Change front and rear data content.
Preferably, the system also includes:Memory module, for storing the operation object change that the comparison module is obtained
The metadata configurations information of content and the configuration module.
Preferably, the query processing module obtains the corresponding operation object changed content of the Operation Log and metadata
Configuration information includes:
The query processing module obtains operator, operating time, operation object changed content from the memory module
With metadata configurations information.
Preferably, the operation object of the comparison module API module record is by the data before and after modification
Content deltas includes:
The comparison module is based on the corresponding domain model of operation object, each category of the operation object before and after contrast operation
Property type and value, obtain the operation object by the data content difference before and after modification.
Preferably, the API module records Operation Log when being called by service code and included:
The API module receives the call request of service code, obtains the operation object modification that the service code is preserved
Front and rear copy, based on the corresponding domain model of the operation object, determines the operation object by the data before and after modification
Hold.
Preferably, the system also includes:Display module, for after the inquiry request of the Operation Log is received,
The operation object changed content is shown with tree.
The embodiment of the present invention also provides a kind of operation note method, including:
The metadata of the domain object involved by the Operation Log is configured, metadata configurations information is obtained;
Operation Log is recorded when being called by service code, the Operation Log includes operation object by before and after modification
Data content;
Compare the operation object by the data content difference before and after modification, obtain operation object changed content;
According to the operation object changed content, based on the metadata configurations information, the behaviour is recorded with tree
Make object changed content.
Preferably, described method, in addition to:
After the inquiry request of the Operation Log is received, obtain in the corresponding operation object change of the Operation Log
Hold and metadata configurations information;
According to the metadata configurations information, the change tree of the operation object, a node for the change tree are generated
The field of the correspondence operation object before a modification after data content.
Preferably, the metadata includes:Class name, object factory expression formula and attribute list, the entitled member of class
Domain model type corresponding to data, the object factory expression formula is the description of object, and the attribute list is field mould
The attribute description of type.
Preferably, it is described to obtain the corresponding operation object changed content of the Operation Log and metadata configurations packet
Include:
Obtain operator, operating time, operation object changed content and metadata configurations information.
Preferably, the comparison operation object is included by the data content difference before and after modification:
Based on the corresponding domain model of operation object, before and after contrast operation the type of each attribute of operation object and
Value, obtains the operation object by the data content difference before and after modification.
Preferably, Operation Log is recorded when being called by service code includes:
The call request of service code is received, the copy before and after the operation object modification that the service code is preserved is obtained,
Based on the corresponding domain model of the operation object, determine the operation object by the data content before and after modification.
Preferably, described method also includes:After the inquiry request of the Operation Log is received, with tree exhibition
Show the operation object changed content.
The embodiment of the present invention also provides a kind of operation object modification information querying method, applied to client, including:
Receive the Operation Log inquiry operation of user;
The inquiry request of Operation Log is sent to server;
The change tree for the operation object that the reception server is returned, the node correspondence operation object of the change tree
Field before a modification after data content.
Preferably, also include before the Operation Log inquiry operation for receiving user:
Modification of the user to the operation object is received to operate;
The amended data content of the operation object is sent to the server.
Preferably, also include before the Operation Log inquiry operation for receiving user:
Receive the metadata of the domain object involved by the Operation Log of user configuring.
The embodiment of the present invention also provides a kind of operation object modification information querying method, applied to server end, including:
Receive the inquiry request for the Operation Log that client is sent;
Obtain the corresponding operation object changed content of the Operation Log and metadata configurations information;
According to the metadata configurations information, the change tree of the operation object, a node for the change tree are generated
The field of the correspondence operation object before a modification after data content;
The change tree of the operation object is sent to client.
Preferably, obtaining the corresponding operation object changed content of the Operation Log includes:
Compare the operation object recorded in Operation Log by the data content difference before and after modification, obtain operation object change
Content.
Compared to the prior art the present invention, has the advantages that:
Scheme proposed by the present invention reduces coding work amount and maintenance cost there is provided unified Operation Log interface,
Record be domain object changed content, thus the contact that can be gone out with accurate response between entity, based on domain model member number
According to configuration information, to show the changed content of domain object, so that the problem of solving readable difference.
Brief description of the drawings
Fig. 1 is the flow chart of the operation note method of the embodiment of the present invention;
Fig. 2 is the structural representation of the operation recording device of transit of the embodiment of the present invention;
Fig. 3 is the flow chart of operation object modification information querying method of the embodiment of the present invention;
Fig. 4 is the flow chart of operation object modification information querying method of the embodiment of the present invention;
Fig. 5 is the flow chart of the operation note method based on object disparity and metadata configurations of the embodiment of the present invention 1;
Fig. 6 is the graphical interfaces effect diagram of the embodiment of the present invention 4.
Embodiment
To make the goal of the invention, technical scheme and beneficial effect of the present invention of greater clarity, below in conjunction with the accompanying drawings to this
The embodiment of invention is illustrated, it is necessary to illustrate, in the case where not conflicting, in the embodiment and embodiment in the application
Feature can mutually be combined.
As shown in figure 1, the embodiment of the present invention provides a kind of operation note method, including:
S101, Operation Log is recorded when being called by service code, the Operation Log, which includes operation object, to be changed
Front and rear data content;
Operation object described in S102, comparison obtains operation object changed content by the data content difference before and after modification;
The metadata of domain object involved by S103, the configuration Operation Log, obtains metadata configurations information;
S104, according to the operation object changed content, based on the metadata configurations information, institute is recorded with tree
State operation object changed content.
Operation note method provided in an embodiment of the present invention is by the data content of the amended operation object and in advance
The operation object data content before the modification of preservation compares;Obtain operation object changed content and record and preserve the behaviour
Make object changed content.
Step S103 execution opportunity, can be in step S101 and step before step S104 in the embodiment of the present invention
Before or after S102.
Wherein, the domain object is the division of service layer, and for being distinguished with entity object, (entity object is data
The division of aspect, it is believed that the table in entity object and memory module is one-to-one).One domain object can be corresponded to
Multiple entity objects.Such as user is exactly a domain object, can be multiple comprising user login information, subscriber identity information etc.
Entity object.Illustrated with user, there can be the operations such as login, cancellation, modification identity information.
Wherein, the Operation Log includes operator, operating time, operation object by the data content before and after modification.
The metadata includes:Class name, object factory expression formula and attribute list, the field corresponding to the entitled metadata of class
Types of models, the object factory expression formula is the description of object, and the attribute list is the attribute description of domain model.
For example:Metadata is described with json forms, and structure is as follows:
{ " class name ":“com.demo.Project”,
" object factory expression formula ":" project:$projectName$”,
" attribute list ":[{“projectName”:" project name " }, { " designPlan ":" design " ...].
Described method also includes:
After the inquiry request of the Operation Log is received, obtain in the corresponding operation object change of the Operation Log
Hold and metadata configurations information;
According to the metadata configurations information, the change tree of the operation object, a node for the change tree are generated
The field of the correspondence operation object before a modification after data content.
Described method also includes:It is described with tree displaying after the inquiry request of the Operation Log is received
Operation object changed content.
When user inquires about, read operation people, operating time, operation object changed content, metadata from memory module
Configuration information, one operation object change tree of generation, changes the field of each node respective operations object of tree before a modification
Data content afterwards, is then returned to web front-end and is shown with the mode of graphical interfaces.
Obtaining the corresponding operation object changed content of the Operation Log and metadata configurations information includes:
Obtain operator, operating time, operation object changed content and metadata configurations information.
Compare the operation object is included by the data content difference before and after modification:
Based on the corresponding domain model of operation object, before and after contrast operation the type of each attribute of operation object and
Value, obtains the operation object by the data content difference before and after modification.
The embodiment of the present invention is by described in before the data content of the amended operation object and the modification that pre-saves
Operation object data content compares;Contrast after difference, the metadata information based on domain object, it is described with tree record
Operation object changed content.
The present invention by the way of recurrence compares, is passed in the data content before and after the operation object is changed
That returns compares the difference of operation object, wherein, the process that recurrence compares is as follows:
If the operation object compared is free of sub- attribute, directly compare, otherwise, obtain the sub- attribute list of operation object,
The sub- attribute in the sub- attribute list is traveled through, every sub- attribute is compared.
For the attribute of fundamental type, the difference of the value before and after the property operations is recorded;
For the attribute of compound type, the type and value of each attribute of the recursive acquisition attributes object simultaneously record difference
It is different.
Wherein, fundamental type refers to the built-in type that programming language is defined, such as int, float, char etc.;Compound type refers to
User-defined type, such as class, structure etc..
Operation Log is recorded when being called by service code to be included:
The call request of service code is received, the copy before and after the operation object modification that the service code is preserved is obtained,
Based on the corresponding domain model of the operation object, determine the operation object by the data content before and after modification.
Metadata can also include following one or more:The description method of domain object, domain object field
The nest relation of description method, domain object.
Metadata configurations information can also include following one or more:
Operating personnel role, operation entry.
Wherein, the embodiment of the present invention records variance data with tree, can also be preserved and be recorded using other modes
The operation object changed content.
As shown in Fig. 2 the embodiment of the present invention also provides a kind of operation note system, including:Application programming interfaces API module
110th, comparison module 120, configuration module 130 and logging modle 140;
The API module 110, for recording Operation Log when being called by service code, the Operation Log includes
Operation object is by the data content before and after modification;
The comparison module 120, for comparing the operation object of the record of API module 110 by before and after modification
Data content difference, obtains operation object changed content;
The configuration module 130, the metadata for configuring the domain object involved by the Operation Log, obtains first number
According to configuration information;
The logging modle 140, for after the comparison module 120 obtains the operation object changed content, being based on
The metadata configurations information that the metadata configurations module 130 is provided, records the operation object with tree and changes
Content.
Wherein, configuration module 130 can configure the metadata of the object of different field model.The API module 110 is note
The interface of Operation Log is recorded, various types of service codes are by calling interface (function that the API module 110 is provided) record to grasp
Make daily record, obtain various types of Operation Logs.
Preferably, described system also includes:Query processing module, for being asked in the inquiry for receiving the Operation Log
After asking, the corresponding operation object changed content of the Operation Log and metadata configurations information are obtained, is matched somebody with somebody according to the metadata
Confidence ceases, and generates the change tree of the operation object, and the field of the node correspondence operation object of the change tree exists
Data content before and after modification.
Described system also includes memory module, for storing in the operation object change that the comparison module 120 is obtained
Hold the metadata configurations information with the configuration module 130.
The query processing module obtains the corresponding operation object changed content of the Operation Log and metadata configurations letter
Breath includes:
The query processing module obtains operator, operating time, operation object changed content from the memory module
With metadata configurations information.
The comparison module 120 compares the operation object of the record of API module 110 by the data before and after modification
Tolerance it is different including:
The comparison module is based on the corresponding domain model of operation object, each category of the operation object before and after contrast operation
Property type and value, obtain the operation object by the data content difference before and after modification.
The API module 110, which records Operation Log when being called by service code, to be included:
The API module receives the call request of service code, obtains the operation object modification that the service code is preserved
Front and rear copy, based on the corresponding domain model of the operation object, determines the operation object by the data before and after modification
Hold.
Described system also includes:Display module, for after the inquiry request of the Operation Log is received, with tree-shaped
Operation object changed content described in configuration shows.
In actual applications, operation note system can include client and server, wherein, server provides operation note
The function of record, there is provided inquiry, the function of setting with user mutual for client.As shown in figure 3, the embodiment of the present invention also provides one
Operation object modification information querying method is planted, applied to client, including:
S201, the Operation Log inquiry operation for receiving user;
S202, the inquiry request to server transmission Operation Log;
The change tree for the operation object that S203, the reception server are returned, the node correspondence behaviour of the change tree
Data content after making the field of object before a modification.
Operation object modification information querying method provided in an embodiment of the present invention is applied to client, and user enters in client
Row is logged in, and inquiry operation is carried out after login.
Wherein, also include before the Operation Log inquiry operation for receiving user:
Modification of the user to the operation object is received to operate;
The amended data content of the operation object is sent to the server;
And/or, receive the metadata of the domain object involved by the Operation Log of user configuring.
After User logs in of the embodiment of the present invention, modified, inquired about according to the corresponding authority of user or role, set
Operation, wherein either role limits or changed in use by keeper the corresponding authority of user in initial registration
The corresponding authority of user, when receiving the inquiry operation of user, the inquiry request of Operation Log is sent to server, clothes are received
The operation object change tree that business device is returned, can be shown with the mode of graphical interfaces.
As shown in figure 4, the embodiment of the present invention also provides a kind of operation object modification information querying method, it is applied to service
Device end, including:
S301, the inquiry request for receiving the Operation Log that client is sent;
S302, the corresponding operation object changed content of the acquisition Operation Log and metadata configurations information;
S303, according to the metadata configurations information, generate the change tree of the operation object, set one of the change
The field of the node correspondence operation object before a modification after data content;
S304, the change tree of the operation object sent to client.
When user inquires about, obtain in operator, operating time, operation object changed content, metadata configurations information etc.
Hold, generation one operation object change tree, change tree each node respective operations object field before a modification after number
According to content, client is then back to so that client is shown with the mode of graphical interfaces.
Wherein, obtaining the corresponding operation object changed content of the Operation Log includes:
Compare the operation object recorded in Operation Log by the data content difference before and after modification, obtain operation object change
Content.
Specifically, obtain being based on before and after the corresponding domain model of operation object, contrast operation during operation object changed content
The type and value of each attribute of operation object, obtain the operation object by the data content difference before and after modification.Can be with
By the way of recurrence compares, the recursive difference for comparing operation object, wherein, the process that recurrence compares is as follows:
If the operation object compared is free of sub- attribute, directly compare, otherwise, obtain the sub- attribute list of operation object,
The sub- attribute in the sub- attribute list is traveled through, every sub- attribute is compared
The embodiment of the present invention also provides a kind of operation recording device of transit, including:Memory and processor,
The memory is used to store the program for operation note;The program for operation note is by the place
When managing device reading execution, following operation is performed:
Operation Log is recorded when being called by service code, the Operation Log includes operation object by before and after modification
Data content;
Compare the operation object by the data content difference before and after modification, obtain operation object changed content;
The metadata of the domain object involved by the Operation Log is configured, metadata configurations information is obtained;
According to the operation object changed content, based on the metadata configurations information, the behaviour is recorded with tree
Make object changed content.
Embodiment 1
As shown in figure 5, this example demonstrates that operation note of the operation note system based on object disparity and metadata configurations
Process:
By calling application programming interface API module, record in various types of Operation Logs, the Operation Log
Including operation object by the data content before and after modification.
Comparison module is responsible for contrasting the operation object that passes over of API module by the data content difference before and after modification, carries
Take out operation object changed content.
Configuration module is responsible for the metadata of typing domain object, includes description method, the description of each field of domain object
Method, nest relation of domain object etc..
Logging modle is responsible for that operation object changed content is depicted to come with tree.
The modules provided using the present embodiment, realize the changed content of record operation object, based on domain model member
Data configuration information, accurate response goes out the changed content of operation object.
Embodiment 2
The present embodiment illustrates the process of operation note method sequentially in time:
1. the metadata of the domain object involved by Operation Log has been configured by configuration module.
2. preserving the copy of the operation object to be changed of the operation first, normal business processing is then carried out, is located
The amended copy of the operation object is obtained after the completion of reason, is finally compared the related datas such as the two copies and operating personnel
Compared with.
3. the recursive difference for comparing domain object and the nested subobject of the domain object, then these differences
The data such as data and operating personnel, operating time are saved in memory module.
4. when user inquires about in domain object read operation personnel, operating time, operation object changed content, first number
According to configuration information, one operation object change tree of generation, the field of each node respective operations object of tree before a modification after
Data content, be then returned to web front-end and shown with the mode of graphical interfaces.
The present embodiment is in the data content before and after the operation object is changed, by the way of recurrence compares,
Difference for each property value of operation object is compared, and obtains operation object by the data content difference before and after modification.
Embodiment 3
After project is reached the standard grade, operation personnel or attendant have configured the field involved by Operation Log by configuration module
The metadata of object.
Platform carries out certain type of operation to operation personnel after the activation, is generated according to service code before an operation modification
Operation object copy, then carry out obtaining the amended copy of the operation object after the completion of normal business processing, processing,
The related datas such as the two copies and operator are finally passed into API module.
Comparison module is recursive to compare operation object and the nested subobject of the operation object by way of reflection
Difference, then the data such as these variance datas and operator, operating time are saved in memory module.
When user inquires about, read operation people, operating time, operation object changed content, metadata are matched somebody with somebody in memory module
Confidence ceases, and preserving module generates an operation object change tree, and the field of each node respective operations object of tree is in modification
Front and rear data content, is then returned to web front-end and is shown with the mode of graphical interfaces.
Embodiment 4
With reference to Fig. 6, by taking keeper A, A building construction projects as an example, illustrate that operation note system is based on object disparity and member
The operation note process of data configuration:
1.API modules
Api modules are provided in the form of function, directly invoke function record operation note.
2. configuration module
Metadata is described with json forms, and structure is as follows:
{ " class name ":“com.demo.Project”,
" object factory expression formula ":" project:$projectName$”,
" attribute list ":[{“projectName”:" project name " }, { " designPlan ":" design " ...]
Metadata mainly includes:Class name, object factory expression formula, attribute list.Class name be used for should metadata retouched
The domain model type stated;Object expression is used for the expression way for defining an object itself, and expression formula can be a mould
Plate, the description of object is obtained by the calculating of template;Attribute list then defines the description of each attribute of domain model.If
Each attribute of finer description domain model is needed, attribute list can be designed to attribute description template list.
By the element evidence pre-defined, system can determine the describing mode of domain model.
3. comparison module
Object module is responsible for the change that contrast operation's object is sent afterwards before operation.The module is obtained by reflection technology
The type and value of each attribute of operation object, for the attribute of fundamental type, directly record the value before and after the property operations;
For the attribute of compound type, then the type and value of recursive each attribute for obtaining the attributes object and difference is recorded.
Contrast after difference, the domain model metadata information provided based on metadata configurations module, by variance data
Data content is recorded with tree.
4. logging modle
Logging modle is responsible for reading variance data content, and tree is recorded, as shown in Figure 6.In figure " item
Mesh:Build project in A buildings " operation object changed is operated for certain, " address ", " Party A ", " cost ", " design " are
The attribute of the operation object, wherein " address ", " cost " and based on type attribute, " Party A ", " design " be compound type
Description.In attribute description, ︱ previous contents represent preoperative data, and ︱ content behind represents the data after operation.Pass through Fig. 6
As can be seen that the address properties of operation object have been modified as in " B streets 1 " by specifically operating from " A sends it to No. 1 "." design side
Case " attribute itself is also a compound type, as seen in Figure 6, and " state " attribute of " design " is one basic
Type, is become " approved " by specifically operating from " issued for approval "." designing unit " attribute itself of " design " is also
One complex attribute." phone " attribute of " designing unit " becomes " 1333333333 " from " 138111111111 "." address "
Attribute is then from without " Hangzhou C streets 1 " is become, and " grade " attribute then becomes nothing from " one-level ".
In the present embodiment, the field of each node respective operations object of the operation object change tree of generation is before a modification
Data content afterwards, is then shown with the mode of graphical interfaces, and personnel query is intuitively obtained in the data of each attribute
Tolerance is different, and the content before and after can more modifying compares.
Embodiment 5
The present embodiment is applied to the field of record website operation, is particularly suitable for use on website to be related at present and is grasped in many ways
Make to track the situation that each side operates, it is necessary to record, operated the issue, modification such as the financing project on website, financier should
When being financed with the method issue project of the offer of the embodiment of the present invention;
First, the metadata of the domain object involved by Operation Log has been configured;
Then, method provided in an embodiment of the present invention obtains the copy of operation object and the preceding operation of modification after modification
The copy of object;
Subsequently, nested sub right of the operation object and the operation object is obtained by comparing above-mentioned two copy
The variance data and peration data of elephant;
Finally inquiry content and changed content are returned to web front-end and shown with the mode of graphical interfaces.
Project is issued on this platform to be financed, and is terminated from issue project to financing, is had various rolls to this
Project is operated, such as uploaded material, is audited, paid in, selecting investment priority people etc., and daily records of these operations are carried out
Visual presentation.Terminate from financing issue project to financing, various rolls are operated to this project, such as uploaded material,
Audited, paid in, selecting investment priority people etc., the daily record of these operations can all carry out visual presentation.Can fast simultaneously
And the operation of all kinds of personnel of accurate recording shows these to the influence produced by website, and in the way of operation personnel is readily appreciated that
Influence.
Although disclosed embodiment is as above, its content is only to facilitate understand the technical side of the present invention
Case and the embodiment used, are not intended to limit the present invention.Any those skilled in the art to which this invention pertains, not
On the premise of departing from disclosed core technology scheme, any modification can be made in the form and details of implementation with becoming
Change, but the protection domain that the present invention is limited, the scope that must be still limited by appended claims are defined.