Organization management method and equipment based on graph structure storage and medium
By adopting a graph-based organizational structure storage method and utilizing the Neo4j and Spring-boot framework, the problem of low query efficiency in existing technologies is solved, and the intuitiveness and efficient synchronization of organizational structure management are achieved. Convenient change maintenance and historical restoration functions are also provided.
Patent Information
- Application Number
- CN202511492924.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-20
- Publication Date
- 2026-01-30
AI Technical Summary
Existing organizational structure management methods utilize (entity-relational) databases, resulting in low query efficiency, especially complex and inefficient multi-level recursive queries, making it difficult to conveniently and quickly maintain and synchronize organizational structure changes.
A graph-based storage method is adopted, using the Neo4j graph data structure, which is decomposed into a three-level data model of organization, personnel, and tags. A graphical operation interface is provided through JavaFX, and a REST interface and event mechanism are built using the Spring-boot framework to achieve rapid maintenance and synchronization of organizational structure.
It enhances the intuitiveness and efficiency of organizational structure management, supports fast and flexible data synchronization and retrieval, can easily save and restore the organizational structure change history, and provides an efficient and convenient interface for adjusting organizational structure.
Smart Images

Figure CN121436362A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of graph structure, in particular to a management method, device and medium for organization based on graph structure storage. BACKGROUND
[0002] The existing organization management generally uses a (entity-relation) type database to identify the organization level by the parent-child relationship of table data, and to identify the attributes of the organization and personnel by special tables such as attribute table, label table and change table. This method is complex and not intuitive in describing the relationship. The query efficiency is low, especially for multi-layer recursive query, which needs to constantly search for the same data, and the implementation method is complex and inefficient.
[0003] Therefore, how to realize the convenient and efficient maintenance of the change of the organization and the synchronization of the change is a technical problem to be solved at present. SUMMARY
[0004] The technical task of the present application is to provide a management method, device and medium for organization based on graph structure storage to solve the problem of how to realize the convenient and efficient maintenance of the change of the organization and the synchronization of the change.
[0005] The technical task of the present application is achieved in the following way, a management method for organization based on graph structure storage, which stores data in the form of graph as data structure, supports the historical version transition management of the organization, provides an interface for external support of the organization, and conveniently maintains the change of the organization and the synchronization of the change. Specifically as follows:
[0006] Based on the graph data structure of neo4j, the management and operation of the organization are refined and decomposed, and the organization management content is decomposed into a three-level data model of organization-personnel-label.
[0007] The specific operation interface of the graphical organization structure is provided through the front-end interface of javaFx.
[0008] The web diagram of the three-level data model of organization-personnel-label is provided by mermaid.
[0009] As a preferred, the graph data structure is a neo4j basic structure composed of nodes and attributes.
[0010] Among them, the nodes include three types of nodes of organization, personnel and label, each type of node carries attributes and the attribute values of each type of node are different.
[0011] More preferably, the operation management of the three-level data model of organization-personnel-label is realized through the back-end REST interface built by Spring-boot framework.
[0012] The relationship types of the organization-person-tag three-level data model are as follows:
[0013] Hierarchy: The strict order is that the first parameter is the child node and the second is the parent node;
[0014] Association relationship:
[0015] Inhibition relationship:
[0016] The REST interface has the functions of adding nodes and relationships and deleting nodes and relationships; when adding a node, the node attribute is specified; when adding a relationship, the relationship type and parameter order are specified; when deleting a node, only the current node is deleted by default, and additional design is cascaded; when deleting a relationship, the relationship ID is specified or is located through a condition.
[0017] As a preferred, the method also completes the linkage processing of messages based on the event mechanism provided by the spring framework, that is, the loose-coupled business logic processing is realized through the combination of a generic base class, a specific event class, an event trigger and an event processor;
[0018] The generic base class is used as an abstract base class of all events, and the EventBase <t>The generic structure encapsulates business data (T data), supports arbitrary type of event payload, and dynamically resolves the generic actual type (e.g. EventBase <eventdecrypt>), to ensure that the Spring event mechanism can accurately identify the event type; the generic base class is constructed in a way that forces parameterized initialization, ensuring that valid data must be carried when the event is created;
[0019] Specific event classes include decryption events, check receipt events, and WebSocket response events; decryption events include two string fields, decryptingMsg and decryptedMsg, to record the processing of encrypted data; check receipt events only include the outId identifier field to track the unique identifier of the business operation; WebSocket response events include the rsp response string field to record the server response obtained by the WebSocket client through HTTP communication;
[0020] The event trigger provides a static method popup(EventBase eb) as the event publishing entry, which internally calls the Spring's ApplicationContext.publishEvent() method to broadcast the event to the Spring event listening system, and hides the Spring specific API. Business code only needs to call EventZing.popup() to trigger the event, reducing the coupling with the framework;
[0021] The event handler declares the event listening method through the @EventListener annotation, and Spring will automatically route events of the corresponding type to the matching method; the business processing logic is: receipt event processing: check whether there is a call object corresponding to outId, if there is, trigger signal transmission through SignalOperator; debug / budget event processing: directly record event logs and trigger signals through SignalOperator (the logic of the handleEventCallDebug and handleEventCallBugde methods in the example is similar); each processing method includes debug level logs to record key information of event processing (such as whether outId exists, event content, etc.).
[0022] As preferred, the triggering condition of the WebSocket response event is that an event containing EventWSCli entGotResp data is created by EventZing.popup(new EventWSClientGotResp(message)) and published to the Spring event bus, and the WebSocket response event is captured and processed by the method marked @EventListener in EventZone and with the parameter type of EventBase<EventWSClientGotResp>.
[0023] As preferred, the method also implements the driving communication between different systems based on the web interface and the lock synchronization technology, that is, the cross-thread communication tool class SignalOperator based on the thread signal mechanism, which realizes the synchronization between threads and the data transmission through the "wait-trigger" model.
[0024] The "wait-trigger" model includes a double Map storage structure and a signal life cycle management unit. The double Map storage structure includes signalMap and dataMap. The signalMap is used to store the mapping relationship of "signal key->lock+condition", and the Object[] array contains ReentrantLock (reentrant lock) and Condition (condition variable) for controlling thread waiting and awakening. The dataMap is used to store the mapping relationship of "signal key->business data" for transmitting specific data (such as WebSocket response content) when triggering the signal. The signal life cycle management unit includes the waiting party and the triggering party. The waiting party registers the signal key, sets the timeout time, and specifies the callback function dealer to handle the result (success / timeout) through the waitSignal method. The triggering party wakes up the waiting thread according to the signal key and stores the business data into the dataMap for the callback function to read through the triggerSignal method.
[0025] More preferably, the waiting party registers the signal key, sets the timeout time, and specifies the callback function dealer to handle the result through the waitSignal method as follows:
[0026] (1) Initialize the lock and the condition: create ReentrantLock and Condition for the current signal key and store them in signalMap;
[0027] (2) The thread enters the waiting state: call condition.await(timeout, unit) to suspend the current thread, and wait for the signal trigger or timeout;
[0028] (3) Result processing, as follows:
[0029] ① Signal triggering: the condition variable is woken up, and the success flag and business data are passed to the callback function through dealer.accept(true, dataMap.get(key));
[0030] ② Timeout triggering: the waiting time is exhausted, and the failure flag is passed through dealer.accept(false, null);
[0031] ③ Exception handling: InterruptedException is caught (such as thread interruption), but no special processing is performed to ensure that the lock is released in the finally block;
[0032] The trigger side wakes up the waiting thread according to the signal key through the triggerSignal method and stores the business data in dataMap for the callback function to read as follows:
[0033] (1) Check the validity of the signal key: check whether the lock and condition corresponding to the signal key exist in signalMap;
[0034] (2) Locking and data storage: after obtaining the lock, the business data is stored in dataMap (overwriting the old data);
[0035] (3) Wake up the waiting thread: call condition.signal() to wake up a thread that is waiting for the signal (randomly wake up one when multiple waiting threads);
[0036] (4) Unlock: ensure that the lock is released in the finally block to avoid deadlock.
[0037] More preferably, the signal call in the REST interface is as follows:
[0038] The waiting signal scenario, i.e., WebSocket response processing: the thread calls SignalOperator.waitSignal("transfer websocket complete http communication", wsSignalKey, 15, TimeUnit.SECONDS, dealer) to set a 15-second timeout to wait for the WebSocket response; if a signal is received within 15 seconds, the dealer callback parses the response data into a BaseResult object and returns it; if the timeout is exceeded, a failure result is returned;
[0039] Send signal scenario, that is, event trigger: trigger a signal in the event handler (such as handleEventCallBugde) through SignalOperator.triggerSignal(uniqId, data), and pass the event data data to the waiting thread.
[0040] An electronic device, characterized by comprising a memory and at least one processor;
[0041] Wherein, the memory has stored a computer program;
[0042] The at least one processor executes the computer program stored in the memory, so that the at least one processor executes the organization management method based on graph structure storage as described above.
[0043] A computer readable storage medium, the computer readable storage medium has stored a computer program, the computer program can be executed by a processor to realize the organization management method based on graph structure storage as described above.
[0044] The organization management method based on graph structure storage, device and medium of the application have the following advantages:
[0045] (I) The application is based on a graph data structure similar to neo4j, which refines and disassembles the management and operation of the organization, solves the difficulties in the organization management process, and realizes intuitive serialization, convenient data synchronization, fast and flexible traversal and retrieval.
[0046] (II) The application is based on the existing graph data structure as the storage mode, which avoids a series of complex logic of loading (entity-relation) type data into memory, establishing relationship and providing interface, shields the complexity and inefficiency of organizational relationship, and focuses on the establishment and improvement of business.
[0047] (III) The application can conveniently save, restore and demonstrate the change and evolution history of the organization, can store any changes in a small space, can ensure that the data of the synchronous organization is one-to-one restored to the data source of the organization change, can cut into the organization version of a certain time node, branch a new organization change, and provide an efficient and convenient organization adjustment interface. BRIEF DESCRIPTION OF DRAWINGS
[0048] The application will be further described below with reference to the drawings.
[0049] ATTACHMENT Figure 1 is a schematic diagram of a graph data structure;
[0050] ATTACHMENT Figure 2 is a schematic diagram of organizational structure transition. DETAILED DESCRIPTION
[0051] The organization management method, device and medium based on graph structure storage will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0052] Embodiment 1
[0053] The embodiment provides an organization management method based on graph structure storage. The method stores data structure with graphs, supports historical version transition management of organizations, provides interfaces for external support of organizations, and facilitates maintenance of changes in organizations and synchronization of changes. Specifically, the method comprises the following steps:
[0054] S1, based on the graph data structure of neo4j, the management and operation of the organization are refined and decomposed, and the organization management content is decomposed into a three-level data model of organization-personnel-tag;
[0055] S2, a graphical organization structure operation interface is provided through the front-end interface of javaFx;
[0056] S3, a web diagram of the three-level data model of organization-personnel-tag is provided through mermaid.
[0057] As shown in the accompanying Figure 1 The graph data structure in step S1 of the embodiment is a neo4j basic structure composed of nodes and attributes.
[0058] The nodes include three types of nodes, i.e., organization, personnel and tag, each type of node carries attributes and the attribute values of each type of node are different.
[0059] The encapsulation with neo4j has the following effects:
[0060] ①The speed of querying nodes associated with nodes, nodes with certain attribute values, etc. is fast, no secondary query is generated, and it is easy to understand and one-to-one corresponding to the real world.
[0061] ②The tags can be infinitely extended (by adding different tag types), i.e., the business undertaken by the organization can be infinitely extended, and there is no need to construct a complex hierarchical structure.
[0062] ③The changes in the organization are decomposed into changes in nodes and attributes, which improves the degree of abstraction, makes it easy to take snapshots of the time nodes, easy to compare the differences between two snapshots, and thus can realize the replay, distribution, etc. of the organization transition.
[0063] Neo4j provides encapsulation that naturally objectifies the ER (Enterprise Relationship) relationships provided by ordinary databases: node instances are instances of E, and relationships are instances of R. Maintaining ER relationships (CRUD operations) is translated into Neo4j's query language (CQL), which is largely consistent with real-world query languages. For example, to find personnel nodes with attribute (job level) of level 13 that have an "own" relationship with "Performance Manager" and an "belong to" relationship with the second-level organizational node under the "Company Headquarters" node, this can be implemented as a CQL statement:
[0064] MATCH(person:Person{job level:'level 13'})
[0065] MATCH(person) - [:owner] -> (:performance manager)
[0066] MATCH(person) - [belongs to] -> (org: organization)
[0067] MATCH(company: organization {name: 'Headquarters'})
[0068] MATCH path = (company) - [:contains*2] -> (org)
[0069] RETURN person,org,nodes(path)as organizational path.
[0070] This embodiment uses a backend REST interface built with the Spring-boot framework to manage and operate a three-tiered data model of organization, personnel, and tags.
[0071] The specific relationship types of the three-tiered data model of organization-personnel-tag are as follows:
[0072] Hierarchical structure: The strict order is that the first parameter is the child node, and the second is the parent node;
[0073] Relationship:
[0074] Prohibited Relationships:
[0075] The REST interface in this embodiment has the functions of adding nodes and relationships, and deleting nodes and relationships. When adding a node, the node attributes are specified; when adding a relationship, the relationship type and parameter order are specified; when deleting a node, only the current node is deleted by default, and cascading deletion is additionally designed; when deleting a relationship, the relationship ID is specified or it is located by meeting certain conditions.
[0076] In this embodiment, the spring-boot provides the function of converting query into rest interface, including:
[0077] Add:
[0078] The node (organization, personnel, label) is added
[0079] The relationship is added
[0080] Association:
[0081] The organization and the organization are, the parent-child relationship, the first is the child, and the second is the parent
[0082] The label and the label are, the parent-child relationship, the first is the child, and the second is the parent
[0083] Personnel and personnel cannot be associated, and an error is reported
[0084] Organization-personnel is, an association relationship, without order requirement
[0085] Personnel-label is, an association relationship, without order requirement
[0086] Organization-label is, an association relationship, without order requirement
[0087] Delete:
[0088] The node (organization, personnel, label) is deleted
[0089] The relationship is deleted
[0090] The above rest interface is maintained by spring-boot as a backend service for front-end page calling.
[0091] The JavaFx in step S2 of the embodiment provides the front-end page to provide the corresponding relationship between the organization and the personnel, the historical transition of the organization structure, the association relationship between the node and the label, and various practical application operation capabilities, which can solve the difficulties and pain points of the organization structure change in a more targeted manner.
[0092] As shown in the accompanying Figure 2 The Mermaid in step S3 of the embodiment provides quick display and scripting of the organization structure diagram:
[0093] The script is:
[0094] Journey
[0095] Title Organization Structure Transition
[0096] Section Company Headquarters (Old)
[0097] Organization Department: 5: Me
[0098] Marketing: 3: Me
[0099] R&D: 1: Me, Cat
[0100] Section Company Headquarters (New)
[0101] Technology: 5: Me
[0102] Management: 3: Me.
[0103] This embodiment also completes the linkage processing of messages based on the event mechanism provided by the spring framework, that is, through the combination of generic base class, specific event class, event trigger and event processor to realize the loose coupling of business logic processing;
[0104] Among them, the generic base class is used as the abstract base class of all events, using EventBase <t>The generic structure encapsulates business data (T data), supports arbitrary type of event payload, and dynamically resolves the generic actual type (e.g. EventBase <eventdecrypt>), to ensure that the Spring event mechanism can accurately identify the event type; the generic base class is constructed in a way that forces parameterized initialization, ensuring that valid data must be carried when the event is created;
[0105] Specific event classes include decryption events, check receipt events, and WebSocket response events; decryption events contain two string fields, decryptingMsg and decryptedMsg, which record the processing of encrypted data; check receipt events only contain the outId identifier field, which is used to track the unique identifier of the business operation; WebSocket response events contain the rsp response string field, which records the server response obtained by the WebSocket client through HTTP communication;
[0106] Event triggers provide a static method popup(EventBase eb) as an event publishing entry, which internally calls the Spring ApplicationContext.publishEvent() method to broadcast events to the Spring event listening system, and hides the Spring specific API. Business code only needs to call EventZing.popup() to trigger events, reducing the coupling with the framework;
[0107] Event handlers declare event handling methods through the @EventListener annotation, and Spring will automatically route events of the corresponding type to the matching method; the business processing logic is: receipt event processing: check if there is a call object corresponding to outId, if there is, trigger signal transmission through SignalOperator; debug / budget event processing: directly record event logs and trigger signals through SignalOperator (the logic of the handleEventCallDebug and handleEventCallBugde methods in the example is similar); each processing method contains a debug level log that records key information such as whether outId exists, event content, etc.
[0108] As preferred, the trigger condition of the WebSocket response event is that an event containing EventWSCli entGotResp data is created by EventZing.popup(new EventBase<>(new EventWSClientGotResp(message))) and is published to the Spring event bus; the WebSocket response event is captured and processed by the method marked @EventListener in EventZone and the parameter type is EventBase<EventWSClientGotResp>.
[0109] Based on the event mechanism provided by the spring framework, the linkage processing of the message is completed, and the key code is as follows:
[0110] EventBase base class:
[0111]
[0112]
[0113]
[0114]
[0115]
[0116] Trigger event:
[0117] EventZing.popup(new EventBase<>(new EventWSClientGotResp(message))).
[0118] The embodiment is based on the web interface and the lock synchronization technology to realize the driving communication between different systems, and the specific implementation is that,
[0119] A system calls the "wait signal" interface of the signal class, and the thread starts waiting (assuming that the rest interface of the B system has been asynchronously called before)
[0120] At this time, the B system is processed after a long time, and the rest interface of the A system is called
[0121] The corresponding new thread of the A system starts processing, and after it is processed, the "send signal" interface of the signal class is called, and then it exits itself, at this time, the waiting thread receives the signal and continues the processing after the breakpoint.
[0122] The specific code is as follows:
[0123] Signal class, waiting signal, sending signal:
[0124]
[0125]
[0126]
[0127]
[0128] Rest interface call to signal class _ waiting signal:
[0129]
[0130]
[0131] Rest interface call to signal class _ sending signal:
[0132] EventCallBugde data = eventCallBugde.getData();
[0133] String uniqId = data.getUniqId();
[0134] SignalOperator.triggerSignal(uniqId, data).
[0135] This embodiment is based on the cross-thread communication tool class SignalOperator of thread signal mechanism, and realizes the synchronization and data transmission between threads through the "waiting-trigger" model;
[0136] The "wait-trigger" model includes a double Map storage structure and a signal life cycle management unit; the double Map storage structure includes a signalMap and a dataMap; the signalMap is used for storing a mapping relationship of "signal key->lock+condition", and an Object[] array in the signalMap includes a ReentrantLock (reentrant lock) and a Condition (condition variable) for controlling thread waiting and awakening; the dataMap is used for storing a mapping relationship of "signal key->business data", and is used for delivering specific data (such as WebSocket response content) when a signal is triggered; the signal life cycle management unit includes a waiting party and a triggering party; the waiting party registers a signal key, sets a timeout time, and specifies a callback function dealer to handle a result (success / timeout) through a waitSignal method; the triggering party awakens a waiting thread according to a signal key and stores business data into the dataMap for the callback function to read through a triggerSignal method.
[0137] In the embodiment, the waiting party registers a signal key, sets a timeout time, and specifies a callback function dealer to handle a result through a waitSignal method, and the specific process is as follows:
[0138] (1) Initialize the lock and the condition: create a ReentrantLock and a Condition for a current signal key, and store the ReentrantLock and the Condition into the signalMap;
[0139] (2) The thread enters a waiting state: call condition.await(timeout, unit) to suspend the current thread, and wait for a signal trigger or a timeout;
[0140] (3) Result processing, and the specific process is as follows:
[0141] ① Signal trigger: the condition variable is awakened, and a success flag and business data are delivered to the callback function through dealer.accept(true, dataMap.get(key));
[0142] ② Timeout trigger: the waiting time is exhausted, and a failure flag is delivered through dealer.accept(false, null);
[0143] ③ Exception processing: capture an InterruptedException (such as thread interruption), but do not do special processing, and ensure that the lock is released in a finally block.
[0144] In the embodiment, the triggering party awakens a waiting thread according to a signal key and stores business data into the dataMap for the callback function to read through a triggerSignal method, and the specific process is as follows:
[0145] (1) Verify the validity of the signal key: Check whether there is a lock and condition for the corresponding signal key in the signalMap;
[0146] (2) Locking and data storage: After acquiring the lock, store the business data in the dataMap (overwriting the old data);
[0147] (3) Wake up waiting threads: Call condition.signal() to wake up a thread that is waiting for the signal (if there are multiple waiting threads, one will be woken up randomly);
[0148] (4) Unlock: Ensure that the lock is released in the finally block to avoid deadlock.
[0149] The signal calls in the REST interface in this embodiment are as follows:
[0150] In the scenario of waiting for a signal, i.e., WebSocket response handling: the thread calls SignalOperator.waitSignal("Handing over websocket to complete HTTP communication", wsSignalKey, 15, TimeUnit.SECON DS, dealer), setting a 15-second timeout to wait for a WebSocket response; if a signal is received within 15 seconds, the dealer callback parses the response data into a BaseResult object and returns it; if the timeout occurs, a failure result is returned.
[0151] In the scenario of sending signals, i.e. event triggering: In the event handler (such as handleEventCallBugde), a signal is triggered by SignalOperator.triggerSignal(uniqId, data), and the event data data is passed to the waiting thread.
[0152] In this embodiment, 8) Description of organizational synchronization (changes in organizational structure) data:
[0153] {"datas":[{"id":"5313251011000000015"}],"type":"uc_employee"}
[0154] That is: what type of node, what is the node ID, and what are the specific changes: omitted.
[0155] Example 2:
[0156] This embodiment also provides an electronic device, including: a memory and a processor;
[0157] The memory stores the instructions executed by the computer.
[0158] The processor executes computer-executable instructions stored in the memory such that the processor performs the organization management method based on graph structure storage in any embodiment of the present application.
[0159] The processor can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), programmable logic devices (PLD) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor can be a microprocessor or any conventional processor.
[0160] The memory can be used to store computer programs and / or modules, and the processor can realize various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory, and calling data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application program required for a function, etc.; and the data storage area can store data created according to the use of the terminal, etc. In addition, the memory can also include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a secure digital (SD) card, a flash memory card, at least one disk storage period, a flash memory device, or other volatile solid-state memory device.
[0161] Embodiment 3:
[0162] The embodiment also provides a computer-readable storage medium, in which a plurality of instructions are stored, the instructions are loaded by a processor to make the processor execute the organization management method based on graph structure storage in any embodiment of the present application. Specifically, a system or device provided with a storage medium can be provided, and the storage medium stores software program codes for realizing the functions of any one of the above embodiments, and the computer (or CPU or MPU) of the system or device reads and executes the program codes stored in the storage medium.
[0163] In this case, the program codes read from the storage medium can realize the functions of any one of the above embodiments, and therefore the program codes and the storage medium storing the program codes constitute a part of the present application.
[0164] The storage medium for providing the program codes includes a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RYM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program codes can be downloaded from a server computer via a communication network.
[0165] Furthermore, it should be understood that, not only the program codes read by the computer can be executed to complete the actual operation, but also the operating system and the like operating on the computer can be instructed based on the program codes to complete part or all of the actual operation, thereby realizing the function of any one of the above embodiments.
[0166] Furthermore, it should be understood that, not only the program codes read by the computer can be executed to complete the actual operation, but also the operating system and the like operating on the computer can be instructed based on the program codes to complete part or all of the actual operation, thereby realizing the function of any one of the above embodiments.
[0167] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the above embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.< / eventdecrypt> < / t> < / eventdecrypt> < / t>
Claims
1. An organization management method based on a graph structure storage, characterized by, The method is to store the graph as a data structure, support the historical version transition management of the organization, provide an interface for external support of the organization, and conveniently maintain the changes and synchronization of the organization; the specific implementation is as follows: Based on the graph data structure of neo4j, the management and operation of the organization are refined and decomposed, and the organization management content is decomposed into a three-level data model of organization-personnel-tag; A graphical organization structure operation interface is provided through the front-end interface of javaFx; A web diagram of the three-level data model of organization-personnel-tag is provided through mermaid.
2. The organization management method based on graph structure storage according to claim 1, characterized in that, The graph data structure is a neo4j infrastructure composed of nodes and attributes; The nodes include three types of nodes: organization, personnel, and tag, each type of node carries attributes and the attribute values of each type of node are different.
3. The organization management method based on graph structure storage according to claim 1 or 2, characterized by, The backend REST interface built by the Spring-boot framework realizes the operation management of the three-level data model of organization-personnel-tag; The relationship types of the three-level data model of organization-personnel-tag are as follows: Hierarchy: Organization Organization, Tag Tag; strict order with first parameter as child and second as parent; Relationship: Organization Person, Person Tag, Organization Tag; Prohibition relationship: Person Person; The REST interface has the functions of adding nodes and relationships and deleting nodes and relationships; when adding nodes, specify node attributes; when adding relationships, specify relationship types and parameter orders; when deleting nodes, only delete the current node by default, and additional design is required for cascade deletion; when deleting relationships, specify relationship IDs or locate through conditions.
4. The organization management method based on graph structure storage according to claim 1, characterized in that, The method also completes the linkage processing of messages based on the event mechanism provided by the spring framework, that is, through the combination of generic base class, specific event class, event trigger, and event processor, the loosely coupled business logic processing is realized; Wherein, the generic base class is used as an abstract base class for all events, using EventBase <t>The generic structure encapsulates business data, supports any type of event load, and dynamically analyzes the actual type of the generic through the getResolvableType() method of the ResolvableTypeProvider interface, to ensure that the Spring event mechanism can accurately identify the event type; the construction method of the generic base class is to force initialization with parameters, to ensure that valid data must be carried when the time is created;< / t> The specific event class includes decryption event, check receipt event, and WebSocket response event; the decryption event includes two string fields of decrypted message and decrypted message, which are used to record the processing process of encrypted data; the check receipt event only includes an outId identifier field, which is used to track the unique identifier of the business operation; the WebSocket response event includes an rsp response string field, which records the server response obtained by the WebSocket client through HTTP communication; The event trigger provides a static method popup as an event publishing entrance, internally calls the Spring's ApplicationContext.publishEvent() method to broadcast the event to the Spring event listening system, and hides the Spring specific API, so that the business code only needs to call EventZing.popup() to trigger the event, to reduce the coupling degree with the framework; The event processor declares event listener methods through the @EventListener annotation, and Spring automatically routes events of the corresponding type to the matching methods. The business processing logic is as follows: the reply event processing: check whether there is a call object corresponding to the outId, and if so, trigger signal transmission through the SignalOperator; the debugging / budget event processing: directly record event logs and trigger signals through the SignalOperator; each processing method contains a debug level log to record the key information of event processing.
5. The organization management method based on graph structure storage according to claim 4, characterized in that, WebSocket response event trigger condition: create an event containing EventWSClientGotResp data through EventZing.popup(new EventBase<>(new EventWSClientGotResp(message))) and publish to the Spring event bus; WebSocket response event is annotated with @EventListener in EventZone and the parameter type is EventBase <eventwsclientgotresp>The method captures the processing.< / eventwsclientgotresp> 6. The organization management method based on graph structure storage according to claim 1, characterized in that, The method also realizes driving communication between different systems based on a web interface and lock synchronization technology, that is, a cross-thread communication tool class SignalOperator based on a thread signal mechanism, which realizes thread synchronization and data transmission through a "waiting-triggering" model. The "waiting-triggering" model includes a double Map storage structure and a signal life cycle management unit. The double Map storage structure includes a signalMap and a dataMap. The signalMap is used to store the mapping relationship of "signal key->lock+condition", and the Object[] array in the signalMap includes a ReentrantLock and a Condition, which are used to control thread waiting and awakening. The dataMap is used to store the mapping relationship of "signal key->business data", and is used to transmit specific data when triggering a signal. The signal life cycle management unit includes a waiting party and a triggering party. The waiting party registers a signal key, sets a timeout time, and specifies a callback function dealer to process the result through the waitSignal method. The triggering party awakens the waiting thread according to the signal key through the triggerSignal method, and stores the business data into the dataMap for the callback function to read.
7. The organization management method based on graph structure storage according to claim 6, characterized in that, The waiting party registers a signal key, sets a timeout time, and specifies a callback function dealer to process the result through the waitSignal method, and the specific process is as follows: (1) Initialize the lock and the condition: create a ReentrantLock and a Condition for the current signal key, and store them in the signalMap; (2) The thread enters a waiting state: call condition.await(timeout, unit) to suspend the current thread, and wait for signal triggering or timeout; (3) Result processing, and the specific process is as follows: ① Signal triggering: the condition variable is awakened, and the success flag and the business data are transmitted to the callback function through dealer.accept(true, dataMap.get(key)); ② Timeout triggering: the waiting time is exhausted, and the failure flag is transmitted through dealer.accept(false, null); ③ Exception handling: capture InterruptedException, but do not do special processing, and ensure that the lock is released in the finally block; The trigger party wakes up the waiting thread by the triggerSignal method according to the signal key, and stores the business data into the dataMap for the callback function to read as follows: (1) Check the validity of the signal key: check whether the lock and condition corresponding to the signal key exist in the signalMap; (2) Locking and data storage: after obtaining the lock, the business data is stored into the dataMap; (3) Wake up the waiting thread: call condition.signal() to wake up a thread waiting for the signal; (4) Unlock: ensure that the lock is released in the finally block to avoid deadlock.
8. The organization management method based on graph structure storage according to claim 7, characterized in that, The signal call in the REST interface is as follows: The waiting signal scenario, that is, the WebSocket response processing: the thread calls SignalOperator.waitSignal to set a 15-second timeout to wait for the WebSocket response; if the signal is received within 15 seconds, the dealer callback parses the response data into a BaseResult object and returns; if it times out, a failure result is returned; The signal sending scenario, that is, event triggering: in the event processor, SignalOperator.triggerSignal(uniqId, data) is called to trigger the signal, and the event data data is transmitted to the waiting thread.
9. An electronic device, comprising: It comprises: a memory and at least one processor; wherein the memory has stored thereon a computer program; the at least one processor executes the computer program stored in the memory, so that the at least one processor executes the organization management method based on the graph structure storage according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium has stored therein a computer program, which can be executed by the processor to implement the organization management method based on the graph structure storage according to any one of claims 1 to 8.
