CN115632815A - Data updating method and device, electronic equipment and storage medium - Google Patents

Data updating method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115632815A
CN115632815A CN202211124874.9A CN202211124874A CN115632815A CN 115632815 A CN115632815 A CN 115632815A CN 202211124874 A CN202211124874 A CN 202211124874A CN 115632815 A CN115632815 A CN 115632815A
Authority
CN
China
Prior art keywords
data
server
login end
enterprise
changed
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
CN202211124874.9A
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.)
Visionvera Information Technology Co Ltd
Original Assignee
Visionvera Information Technology 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 Visionvera Information Technology Co Ltd filed Critical Visionvera Information Technology Co Ltd
Priority to CN202211124874.9A priority Critical patent/CN115632815A/en
Publication of CN115632815A publication Critical patent/CN115632815A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes

Abstract

The embodiment of the invention provides a data updating method, a data updating device, electronic equipment and a storage medium; the method can comprise the following steps: the login end sends a target request to the server so as to establish a target channel based on a specified communication protocol between the login end and the server; the login end responds to the updating mechanism, and when the stored first enterprise related data is detected to be changed, the changed first data is sent to the server through the target channel; the login end receives second data sent by the server through the target channel, and data synchronization is carried out based on the second data; the second data comprises changed data which is sent to the login end by the server when the server detects that the stored second enterprise related data is changed; therefore, real-time data synchronization between the login end and the server is realized.

Description

Data updating method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of data transmission technologies, and in particular, to a method and an apparatus for updating data, an electronic device, and a storage medium.
Background
Enterprise management systems are often used as a primary tool for enterprise management, and include a large amount of data about the enterprise and associated enterprises, such as: customer information, enterprise information, reporting information, subsidy information, and the like.
In the prior art, an enterprise management system may include a login end and a server, where data of the enterprise and data of associated enterprises may be stored in the login end and the server, respectively. In order to ensure that data in a login end and a server in an enterprise management system are synchronous, a user needs to initiate a request actively to update the data, which may cause that if the data in the login end/the server is not updated in time and the request is not initiated actively, the data synchronization between the login end and the server in the enterprise management system may be out of time, and further an enterprise may not obtain the latest data from the login end, or the server may not provide services to the enterprise based on the latest data.
Disclosure of Invention
In view of the above problems, embodiments of the present invention are provided to provide a data updating method and a corresponding data updating apparatus, an electronic device, and a computer-readable storage medium that overcome or at least partially solve the above problems.
A method of updating data, the method comprising:
sending a target request to a server so as to establish a target channel based on a specified communication protocol between a login end and the server;
the login end responds to the updating mechanism, and when the stored first enterprise related data is detected to be changed, the changed first data is sent to the server through the target channel;
the login end receives second data sent by the server through the target channel, and performs data synchronization based on the second data; the second data comprises changed data which is sent to the login end by the server when the server detects that the stored second enterprise related data changes.
Optionally, the login end deploys a plurality of programs for processing data, each program corresponds to a different data tag, and after receiving the second data, the method further includes:
determining a first data tag corresponding to the second data;
and calling a first program corresponding to the first data label to process the second data.
Optionally, the sending, through the target channel, the changed first data to the server includes:
determining a second data tag corresponding to the first data;
calling a second program corresponding to the second data label, and packaging the first data to obtain a first data packet to be sent;
and when the generation of a first data packet to be sent is detected, sending the first data packet obtained based on the first data to the server through the target channel.
Optionally, the first enterprise-related data is structured data, and the method further includes:
configuring the first enterprise-related data into structured data that conforms to a first data model according to the update mechanism;
when a change in an attribute parameter of the first data model is detected, it is determined that a change in the stored first enterprise-related data has been detected.
The embodiment of the invention also discloses a data updating method, which comprises the following steps:
receiving a target request sent by a login end, and responding to the target request, and establishing a target channel based on a specified communication protocol between a server and the login end;
the server responds to the updating mechanism, and when the stored second enterprise related data is detected to be changed, the changed second data is sent to the login end through the target channel;
the server receives first data sent by the login end through the target channel, and performs data synchronization based on the first data; the first data is the changed data sent to the server by the login end when the login end detects that the stored first enterprise-related data is changed.
Optionally, the method further comprises:
judging whether the target request meets a preset requirement or not;
when the target request meets a preset requirement, executing a step of establishing a target channel based on a specified communication protocol between the server and the login terminal in response to the target request;
and when the target request does not meet the preset requirement, returning a connection refusing message to the login end.
Optionally, the second enterprise-related data is structured data, and the method further includes:
configuring the second enterprise-related data into structured data that conforms to a second data model according to the update mechanism;
determining that the stored second enterprise-related data has changed when the change in the attribute parameters of the second data model is detected.
The embodiment of the invention also discloses a data updating device, which comprises:
the request sending module is used for sending a target request to the server so as to establish a target channel based on a specified communication protocol between the login end and the server;
the first sending module is used for responding to an updating mechanism and sending the changed first data to the server through the target channel when the stored first enterprise related data is detected to be changed;
the first receiving module is used for receiving second data sent by the server through the target channel and carrying out data synchronization based on the second data; the second data comprises changed data sent to the login terminal by the server when the server detects that the stored second enterprise-related data is changed.
Optionally, the login end deploys a plurality of programs for processing data, each program corresponding to a different data tag, and the apparatus further includes:
the data processing module is used for determining a first data label corresponding to second data after the second data are received; and calling a first program corresponding to the first data label to process the second data.
Optionally, the first sending module includes:
the tag determining submodule is used for determining a second data tag corresponding to the first data;
the packaging submodule is used for calling a second program corresponding to the second data tag, packaging the first data and obtaining a first data packet to be sent;
and the sending submodule is used for sending a first data packet obtained based on the first data to the server through the target channel when the first data packet to be sent is detected to be generated.
Optionally, the first enterprise-related data is structured data, and the apparatus further includes:
a first detection module to configure the first enterprise-related data as structured data that is applicable to a first data model in accordance with the update mechanism; determining that the stored first enterprise-related data has changed when the change in the attribute parameters of the first data model is detected.
The embodiment of the invention also discloses a data updating device, which comprises:
the channel establishing module is used for receiving a target request sent by a login end and responding to the target request to establish a target channel based on a specified communication protocol between a server and the login end;
the second sending module is used for responding to the updating mechanism and sending the changed second data to the login end through the target channel when the stored second enterprise related data is detected to be changed;
the second receiving module is used for receiving first data sent by the login end through the target channel and synchronizing the data based on the first data; the first data is data which is sent to the server by the login end when the login end detects that the stored first enterprise-related data changes.
Optionally, the apparatus further comprises:
the judging module is used for judging whether the target request meets a preset requirement or not; when the target request meets a preset requirement, responding to the target request, and establishing a target channel based on a specified communication protocol between the server and the login terminal; and when the target request does not meet the preset requirement, returning a connection refusing message to the login end.
Optionally, the second enterprise-related data is structured data, and the apparatus further includes:
a second detection module to configure the first enterprise-related data as applicable to the first data model according to the update mechanism and to configure the second enterprise-related data as structured data applicable to the second data model according to the update mechanism; determining that the stored second enterprise-related data has changed when the change in the attribute parameters of the second data model is detected.
The embodiment of the invention also discloses an electronic device, which comprises:
one or more processors; and
one or more machine readable media having instructions stored thereon that, when executed by the one or more processors, cause the apparatus to perform a method of updating data as described above.
The embodiment of the invention also discloses a computer readable storage medium, which stores a computer program for enabling a processor to execute the data updating method.
The embodiment of the invention has the following advantages:
in the embodiment of the invention, a channel based on a specified communication protocol can be established between a login end of an enterprise management system and a server; then, the login end can respond to an updating mechanism, and when the stored first enterprise related data is detected to be changed, the changed first data is sent to the server through the target channel; when detecting that the stored second enterprise related data changes, the receiving server sends the changed data; therefore, when the data in the login end is updated, the updated data can be automatically sent to the server for synchronization, and when the data in the server is updated, the updated data can also be automatically sent to the login end, so that the data can be synchronized between the login end and the server in the enterprise management system in real time.
Drawings
FIG. 1 is a flow diagram of data interaction for a long poll;
FIG. 2 is a flow diagram of data interaction for a long poll;
FIG. 3 is a flow chart of steps of a method embodiment of the present invention for updating data;
FIG. 4 is a flow chart of steps in another embodiment of a method for updating data in accordance with the present invention;
FIG. 5 is a schematic diagram of an application scenario of the present invention;
FIG. 6 is a flow diagram of a data interaction of the present invention;
FIG. 7 is a block diagram of an embodiment of a data updating apparatus according to the present invention;
fig. 8 is a block diagram showing another embodiment of the data update apparatus according to the present invention.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
In practical application, data interaction is mostly performed between a login end of an enterprise management system and a server by adopting a Hyper Text Transfer Protocol (HTTP); if a login end using an HTTP protocol wants to realize a push technology to a server, the used technology is a polling mode; polling refers to sending HTTP requests to the server at intervals by the HTTP login end, and then the server returns the latest data to the login end.
Common polling methods are divided into short polling and long polling, such as fig. 1, which shows a flow chart of data interaction of short polling, and fig. 2, which shows a flow chart of data interaction of long polling.
In the short polling mode, if the login end wants to realize the push technology to the server, the login end can sequentially send polling requests (GET/poll) to the server according to polling intervals; if the data update of the server happens between two polling and the last polling server has returned a response message to the login end, the server needs to wait for the next polling and then sends the updated data to the login end.
In the long polling mode, the login end sends a polling request (GET/poll) to the server, and can keep a long-time connection; during the connection process, if the data of the server is updated, the updated data can be returned to the login terminal.
Because HTTP request and response messages may contain long headers, the actual valid data may be only a small portion; therefore, whether short polling or long polling is performed, excessive bandwidth resources may be consumed when data interaction between the login end and the server is realized; the real-time performance of data interaction depends on the sending of a login end request, and the real-time performance is poor.
In order to avoid excessive consumption of bandwidth resources for data interaction between a login end and a server in the enterprise management system and ensure timeliness of the data interaction between the login end and the server; the embodiment of the invention can firstly establish a channel based on a specified communication protocol between the login end and the server; then, the login end can respond to an updating mechanism, and when the stored first enterprise related data is detected to be changed, the changed first data is sent to the server through the target channel; when detecting that the stored second enterprise related data changes, the receiving server sends the changed data; therefore, when the data in the login end is updated, the updated data can be automatically sent to the server for synchronization, and when the data in the server is updated, the updated data can also be automatically sent to the login end, so that the data can be synchronized between the login end and the server in the enterprise management system in real time.
Referring to fig. 3, a flowchart illustrating steps of an embodiment of a data updating method of the present invention is shown, and specifically, the method may include the following steps:
step 301, a target request is sent to the server to establish a target channel based on a specified communication protocol between the login end and the server.
The login end may refer to a client end that logs in the enterprise management system, for example: mobile phones, computers, and the like; the server may refer to a server deployed to the enterprise management system, and the server may be configured to provide a service to the login terminal and may also be configured to provide data to the login terminal.
In practical application, a login end and a server in the enterprise management system are in a disconnected state by default; when it is required to ensure that the data between the login end and the server can be kept synchronous in real time, the connection between the login end and the server can be established first.
Specifically, the login end may send a target request to the server; the target request may be for requesting the server to establish a target channel based on a specified communication protocol with the login end. Wherein, the specified communication protocol can be a WebSocket protocol; compared with the HTTP-based protocol, the WebSocket protocol can effectively reduce the bandwidth resources occupied by the login end and the server during data interaction.
As an example, the target request may be generated at the login end automatically at a preset time; or after the user executes a preset user operation on the login end, the login end responds to the preset user operation to generate the operation, which is not limited in the embodiment of the present invention.
After receiving the target request, the server may first determine whether the target request meets a preset requirement; the preset requirement may be used to determine whether the login end generating the target request is legal, for example: the predetermined requirement may be that a connectable terminal identity is included; when the login end corresponding to the target request does not have the terminal identifier, it can be determined that the target request does not meet the preset requirement.
When the target request meets the preset requirement, the server can respond to the target request and establish a target channel based on a specified communication protocol between the server and the login end, so that data interaction can be carried out between the login end of the enterprise management system and the server through the target channel in real time.
When the target request does not meet the preset requirement, the server does not respond to the target request and establishes a target channel with the login end; meanwhile, a connection refusing message can be returned to the login end to inform a user corresponding to the login end that the target request for establishing the connection does not meet the preset requirement and the connection with the server cannot be established.
Step 302, the login end responds to the update mechanism, and when the stored first enterprise related data is detected to be changed, the changed first data is sent to the server through the target channel.
The update mechanism may be configured to detect whether the data changes, where the change may be determined directly based on the detection of the data, or may be determined based on the detection of other information associated with the data, and this is not limited in this embodiment of the present invention.
The first enterprise-related data may include enterprise data such as: basic enterprise information (enterprise name, enterprise code), basic regional information (administrative regional name, administrative regional code), basic enterprise personnel information (contact name, contact address), financial management information (enterprise bank account), etc., and may also include business data for handling business, such as: tax information to be declared, etc., which are not limited in this embodiment of the present invention.
The first data may refer to data that has changed in the first enterprise-related data; for example: when the name of the business in the first business-related data is changed from "company a" to "company B," the name of the business may be "changed from" company a: company B "as the first data.
The login end, in response to the update mechanism, may detect a change in one of the stored first enterprise-related data, for example: when the value changes, the name changes, other information related to the data changes, and the like, the first data that has changed is determined from the first enterprise-related data.
Then, in order to ensure that the server and the login end can achieve real-time synchronization of data, the login end may send the first data to the server based on a target channel with the server.
After receiving the first data, the server may synchronize data based on the first data, so as to ensure data synchronization with the login end.
For example: when the business name of the login end is changed from "company a" to "company B", the login end may store the first data "business name: company B "sends to the server through the target channel; the server may modify the stored business name from "company a" to "company B" based on the first data, so as to complete synchronization with the business name stored in the login end, which is not limited in this embodiment of the present invention.
In an embodiment of the present invention, in order to meet the requirements of high-speed storage application, data backup, data sharing, data disaster tolerance, and the like, the first enterprise data stored in the login end may be structured data; structured data, also called row data, is data logically represented and implemented by a two-dimensional table structure, strictly following the data format and length specifications, and mainly stored and managed by a relational database.
An example of structured first enterprise data is shown below in accordance with an embodiment of the present invention:
public class Enterprise{
/**
* < p > Enterprise information ID-Primary Key >
*/
private String id;/**
* < p > Enterprise name >
*/
private String name;
/**
* < p > Enterprise code >
*/
private string code;
/**
* < p > administrative area code </p >
*/
private String regioncode;
/**
* < p > administrative district name </p >
*/
private StringregionName;
/**
* < p > complete area code |110000000000 gaming 110100000000 gaming 110102000000| </p >
*/
private string regionFul1Code;
/**
* < P > complete area name | A City | A district | </P >
*/
private StringregionFullName;
/**
* < p > division of contact person's mobile phone number and multiple mobile phone commas >
*/
private string contactsPhonenums;
/**
* < contact name, multiple name comma division >
*/
private String contactsNames;
/**
* < time of creation >
*/
private Calendar createtime=Calendar.getInstance();
/**
* < p > modification time >
*/
private calendarupdatetime;
/**
* < p > deletion marker >
*/
private Boolean deleted=false;
/**
* < deletion time >
*/
private Calendar deletetime;
}
For the structured first enterprise-related data, whether the first enterprise-related data stored in the login end changes or not can be detected by the following means:
configuring the first enterprise-related data into structured data that is applicable to the first data model according to an update mechanism; when a change in an attribute parameter of the first data model is detected, it is determined that a change in the stored first enterprise-related data has been detected.
The first data model can be an abstraction of data features, which describes static features, dynamic behaviors and constraints of the structured data from an abstraction level, and provides an abstract framework for information representation and operation of the structured data.
In practical applications, the first enterprise-related data may be configured into structured data suitable for the first data model according to an update mechanism; initial attribute parameters of the first data model may be set based on the first enterprise-related data; when the first enterprise related data changes, the related attribute parameters of the first data model also change; thus, by comparing the current attribute parameters of the first data model with the initial attribute parameters, it is determined whether the first enterprise-related data has changed and synchronization of the data with the server is required.
Then, the login end can monitor the attribute parameters of the first data model to judge whether the first enterprise related data changes; when the attribute parameters of the first data model change, it may be determined that the first enterprise-related data also changes. At this time, the login end may send the changed first data in the first enterprise-related data to the server through the target channel for data synchronization.
When the attribute parameters of the first data model are not changed, the first enterprise-related data can be determined to be unchanged; at this point, monitoring may continue for the attribute parameters of the first data model.
When a user imports data into a login end, the login end may configure the imported data into structured data suitable for the first data model according to an update mechanism, which is not limited in the embodiment of the present invention.
As an example, when the attribute parameter of the first data model has changed, the monitoring for the changed attribute parameter may be continued to monitor whether the changed attribute parameter changes again.
303, receiving second data sent by the server through the target channel by the login end, and synchronizing data based on the second data; the second data is the changed data sent to the login end by the server when the server detects that the stored second enterprise related data is changed.
Wherein the second enterprise-related data may include enterprise data such as: basic enterprise information (enterprise name, enterprise code), basic regional information (administrative regional name, administrative regional code), basic enterprise personnel information (contact name, contact address), financial management information (enterprise bank account), etc., and may also include business data for handling business, such as: tax information to be declared, and the like, which are not limited in this embodiment of the present invention.
The second data may refer to data that has changed in the second enterprise-related data; for example: when the business name in the second business-related data is changed from "company a" to "company B", the "business name: company B "as the second data.
In practical applications, the server may also detect the second enterprise-related data stored therein in real time, and when it is detected that the second enterprise-related data stored therein changes, the changed second data may be determined from the second enterprise-related data.
Then, in order to ensure that the login end can realize real-time synchronization of data with the server, the server can send the second data to the login end through the target channel.
After receiving the first data, the login terminal may synchronize data based on the second data to ensure data synchronization with the server.
In an embodiment of the present invention, the login end may be deployed with a plurality of programs for processing data, each program corresponds to a different data tag, and after receiving the second data, the login end may further include the following steps:
determining a first data tag corresponding to the second data; and calling a first program corresponding to the first data label to process the second data.
In practical applications, different data may correspond to different processing modes, for example: may correspond to different analysis methods, processing methods, etc. Therefore, corresponding data tags can be set for different data in advance, and the corresponding relation between the different data tags and the program deployed in the login end is established; the data tag may be used to identify a type of data, identify a service type corresponding to the data, and identify an operation to be performed on the data, for example: storing and sending to a server, etc., which is not limited in this embodiment of the present invention.
After receiving the second data sent by the server, the login end may first determine a first data tag corresponding to the second data. Then, according to the preset corresponding relation between the data tags and the programs, determining one or more first programs corresponding to the first data tags; the first program may include: unpacking program, analyzing program, processing program, packing program, etc.
After determining the one or more first programs corresponding to the first data tag, the one or more first programs may be invoked to process the second data, for example: the second data may be split using an unpacking program; analyzing the split data by adopting an analysis program; and performing corresponding data processing on the continued data by adopting a processing program, and packaging the processed data by adopting a packaging program.
It should be noted that, in the embodiment of the present invention, the program included in the first program is not limited, and may be set according to an actual second data condition; for example: when the second data is used for showing to the user, the first program can comprise an unpacking program, a parsing program and a processing program; and outputting corresponding data for display after the data is processed by the processing program. When the second data needs to feed back data to the server, the first program may include an unpacking program, an analyzing program, a processing program, and a packing program; after the processing program finishes processing the data, the data obtained by processing can be packaged, and then the data package obtained by packaging is sent to be returned to the server through the target channel.
As an example, based on a plurality of programs deployed in the login end, the step of sending the changed first data to the server may be implemented by the following sub-steps:
and a substep 11 of determining a second data label corresponding to the first data.
When the login end needs to send the first data, the login end may first determine a second data tag corresponding to the first data. Meanwhile, a second program corresponding to the second data tag can be determined again; the second program may include a packaging program, and may also include other programs, such as: processing procedures, etc., which are not limited in this respect.
And a substep 12 of calling a second program corresponding to the second data tag, and packaging the first data to obtain a first data packet to be sent.
After the second program is determined, the login end can call the second program to perform packet processing on the first data so as to perform packet processing on the first data according to a specified communication protocol to obtain a first data packet which can be transmitted in a target channel; the first data packet may be data to be sent to the server in the login end.
And a substep 13, when detecting that the first data packet to be sent is generated, sending the first data packet obtained based on the first data to the server through the target channel.
After detecting that the first data packet to be sent is generated, the login end can send the first data packet obtained based on the first data to the server through a target channel which is established with the server in advance, so that the server can update the data based on the first data packet.
In an embodiment of the present invention, one or more events may be created in advance, and the events may be events corresponding to different data at different stages of a lifecycle; for example: the event corresponding to the first data may be data thrown to the server, and the event corresponding to the second data may be data sent by the server, a program corresponding to the first data tag is called to process the second data, and the data of the login end is updated.
Corresponding hook functions can be set for different events; when the login end triggers an event, the corresponding hook function can be called to correspondingly process the data; for example: and sending the data to a server through a target channel, and calling a corresponding program to unpack, analyze and the like.
As an example, an event monitor may be deployed in the login end, and the event monitor may be configured to monitor whether an event occurs in the login end, and what event occurs in the login end; and the hook function can be used for determining the corresponding hook function, so that the login end can determine how to process the current data subsequently. The event can be registered in the event listener in advance, so that the event listener can determine the event currently triggered by the login terminal.
In the embodiment of the invention, a channel based on a specified communication protocol can be established between a login end of an enterprise management system and a server; then, the login end can respond to an updating mechanism, and when the stored first enterprise related data is detected to be changed, the changed first data is sent to the server through the target channel; when detecting that the stored second enterprise related data changes, the receiving server sends the changed data; therefore, when the data in the login end is updated, the updated data can be automatically sent to the server for synchronization, and when the data in the server is updated, the updated data can also be automatically sent to the login end, so that the data can be synchronized between the login end and the server in the enterprise management system in real time.
Referring to fig. 4, a flow chart of steps of another embodiment of a data updating method of the present invention is shown, the method may be applied to a server of an enterprise management system, and the enterprise management system may further include a login end; specifically, the method may include the steps of:
step 401, receiving a target request sent by a login end, and in response to the target request, establishing a target channel based on a specified communication protocol between a server and the login end.
In practical application, a login end and a server in the enterprise management system are in a disconnected state by default; when it is required to ensure that the data between the login end and the server can be kept synchronous in real time, the connection between the login end and the server can be established first. Specifically, the login end may send a target request to the server; the target request may be for requesting the server to establish a target channel based on a specified communication protocol with the login end.
In an embodiment of the present invention, in order to avoid establishing a connection with a login end of an illegal request, before the server establishes a target channel with the login end, the following steps may be further included:
judging whether the target request meets a preset requirement or not; when the target request meets the preset requirement, executing a step of responding to the target request and establishing a target channel based on a specified communication protocol between the server and the login end; and when the target request does not meet the preset requirement, returning a connection refusing message to the login end.
After receiving the target request, the server can first judge whether the target request meets a preset requirement; the preset requirement may be used to determine whether the login end generating the target request is legal, for example: the preset requirement can be that a connectable terminal identification is included; when the login end corresponding to the target request does not have the terminal identifier, it can be determined that the target request does not meet the preset requirement.
When the target request meets the preset requirement, the server can respond to the target request and establish a target channel based on a specified communication protocol between the server and the login end, so that data interaction can be carried out between the login end of the enterprise management system and the server through the target channel in real time.
When the target request does not meet the preset requirement, the server does not respond to the target request and establishes a target channel with the login end; meanwhile, a connection refusing message can be returned to the login end to inform a user corresponding to the login end that the target request for establishing the connection does not meet the preset requirement and the connection with the server cannot be established.
Step 402, the server responds to the update mechanism, and when detecting that the stored second enterprise related data changes, sends the changed second data to the login end through the target channel.
In practice, the server may be responsive to the update mechanism to determine, when a change is detected in one of the stored second enterprise-related data, the changed second data from the second enterprise-related data.
Then, in order to ensure that real-time synchronization of data can be achieved between the login end and the server in the enterprise management system, the server can send the second data to the login end through a target channel between the server and the login end.
After receiving the first data, the login terminal can perform data synchronization with the server based on the second data.
In an embodiment of the present invention, in order to meet the requirements of high-speed storage applications, data backup, data sharing, data disaster tolerance, and the like, the second enterprise data stored in the server may also be structured data.
For the structured second enterprise data, whether a change occurs can be detected by:
configuring the second enterprise-related data into structured data that is applicable to the second data model according to an update mechanism; when a change in an attribute parameter of the second data model is detected, it is determined that a change in the stored second enterprise-related data has been detected.
The second data model can be an abstraction of data features, which describes static features, dynamic behaviors and constraints of the structured data from an abstraction level, and provides an abstract framework for information representation and operation of the structured data.
In practical applications, the second enterprise-related data may be configured into structured data suitable for the second data model according to the update mechanism; initial attribute parameters of the second data model may be set based on the second enterprise-related data; when the related data of the second enterprise changes, the related attribute parameters of the second data model also change; therefore, whether the second enterprise related data changes or not and whether the data synchronization with the login end is needed or not are determined by comparing the difference between the current attribute parameters and the initial attribute parameters of the second data model.
Then, the server can monitor the attribute parameters of the second data model to judge whether the second enterprise related data changes; when the attribute parameters of the second data model change, it can be determined that the second enterprise-related data also changes. At this time, the server may send the changed second data in the second enterprise-related data to the login end through the target channel to synchronize the data.
When the attribute parameters of the second data model do not change, it can be determined that the second enterprise-related data does not change; at this point, monitoring may continue for the attribute parameters of the second data model.
When importing data into the server, the server may configure the imported data as structured data applicable to the second data model according to the update mechanism, which is not limited in this embodiment of the present invention.
As an example, when the attribute parameter of the second data model has changed, the monitoring for the changed attribute parameter may be continued to monitor whether the changed attribute parameter changes again.
Step 403, the server receives first data sent by the login end through the target channel, and performs data synchronization based on the first data; the first data is the changed data sent to the server by the login end when the login end detects that the stored first enterprise related data is changed.
When the login end detects that a change occurs in the stored first enterprise-related data, for example: when the value changes, the name changes, and the like, the first data that has changed may be determined from the first enterprise-related data.
Then, in order to ensure that the server and the login end can realize real-time synchronization of data, the login end can send the first data to the server through the target channel.
After receiving the first data, the server may synchronize data based on the first data to ensure data synchronization with the login end.
In practical application, the corresponding relationship between different data tags and programs deployed in the server can also be established.
After receiving the first data sent by the login end, the server may first determine a second data tag corresponding to the first data. And then, determining one or more programs corresponding to the second data tag according to the preset corresponding relation between the data tag and the programs.
After determining the one or more programs corresponding to the second data tag, the one or more programs may be invoked to process the first data, for example: the first data may be split using a unpacking procedure; analyzing the split data by adopting an analysis program; the processing program is used to perform corresponding data processing on the data that is continued, and the packaging program is used to package the data that is obtained through processing.
When the server needs to send the second data, the server may also determine the first data tag corresponding to the second data first. Meanwhile, a program corresponding to the first data tag may be determined again, and the program may be called to encapsulate the first data, so as to obtain a second data packet.
Then, the server can send a second data packet obtained based on the second data to the login end through the target channel, so that the login end can synchronize data based on the second data packet.
In an embodiment of the present invention, the server may also create one or more events in advance, and the events may be events corresponding to different data at different stages of the lifecycle; for example: the event corresponding to the second data may be data thrown to the login end, and the event corresponding to the first data may be data sent by the login end, a program corresponding to the second data tag is called to process the first data, and the data of the server is updated.
Corresponding hook functions can be set for different events; when the server triggers an event, the corresponding hook function can be called to correspondingly process the data; for example: and sending the data to a login end through a target channel, and calling a corresponding program to unpack, analyze and the like.
As an example, an event listener may also be deployed in the server, and the event listener may be used to listen to whether an event occurs in the server, what event occurs in the server; and, it can also be used to determine the corresponding hook function, so that the server can determine how to process the current data subsequently
In the embodiment of the invention, a channel based on a specified communication protocol can be established between a login end of an enterprise management system and a server; then, the login end can respond to the updating mechanism, and when the stored first enterprise related data is detected to be changed, the changed first data is sent to the server through the target channel; when the server detects that the stored second enterprise related data changes, the server receives the changed data; therefore, when the data in the login end is updated, the updated data can be automatically sent to the server for synchronization, and when the data in the server is updated, the updated data can also be automatically sent to the login end, so that the data can be synchronized between the login end and the server in the enterprise management system in real time.
For a more detailed description of the present invention, the following describes an application scenario and a data interaction flow of the present invention with reference to fig. 5 and fig. 6.
As fig. 5, a schematic diagram of an application scenario of the present invention is shown:
in order to realize real-time data update between the login end and the server, a request for establishing connection can be sent to the server, and the request is forwarded to the server at the rear end through the proxy gateway; after the server at the back end verifies the legal identity of the login end, the appointed communication connection can be established between the login end and the server. Wherein, the server can provide application service for the login end.
And then, the server can create a data model and bind the event, and the login end can also create the data model and bind the event.
When the attribute parameters of the data model of the login end change, the changed data in the stored data can be sent to the server through the specified communication connection between the login end and the server.
When the attribute parameters of the data model of the server change, the changed data in the stored data can also be sent to the login end through the specified communication connection between the login end and the server.
When data interaction is carried out between the login end and the server, different notification mechanisms (namely the events) can be corresponding to different data; different data can bind different events due to different business processing logics, and the events can be registered in an event monitoring program in advance; the event listener may be responsible for determining whether an event is triggered and which event is triggered, so that the server/login end performs corresponding business processing on the current data.
As shown in FIG. 6, a flow chart of data interaction of the present invention is shown:
a request for establishing connection can be sent to a server through a login end; after receiving the request, the server may first determine whether to allow the login terminal to establish a connection with the server based on the request.
If not, a message of refusing the connection can be returned to the login terminal. If the connection is allowed, the connection can be established between the login end and the server; the connection may be a designated communication connection.
After the connection is established between the login end and the server, initialization can be respectively carried out; specifically, the attribute parameters may be initialized for the data model of the respective stored structured data to bind the respective stored data with the data model, so that when the attribute parameters of the data model change, the stored data can be known to have changed in time.
In addition, the login end and the server can also initialize unpacking programs, analyzing programs, processing programs, packaging programs and event monitoring programs.
For the login end, when the data stored in the login end changes, a packaging program can be called to package the changed data, and a data packet obtained by packaging is sent. After the event monitoring program detects that the data packet is sent, the login end can send the data packet to the server through the designated communication connection between the login end and the server.
When the login end receives data sent by the server, the event monitoring program can monitor a corresponding event; at this time, the received data may be sent to an unpacking program for processing; the unpacking program may be sent to the parsing program for parsing after unpacking, and may be sent to the processing program for processing after parsing is completed.
For the server, when the data stored in the server changes, a packaging program may be called to package the changed data, and send a data packet obtained by packaging. After the event monitoring program detects that the data packet is sent, the server can send the data packet to the login end through the designated communication connection between the login end and the server.
When the server receives data sent by the login end, the event monitoring program can monitor a corresponding event; at this time, the received data may be sent to an unpacking program for processing; the unpacking program may send an analysis program for analysis after unpacking, and may send a processing program for processing after the analysis is completed.
It should be noted that for simplicity of description, the method embodiments are shown as a series of combinations of acts, but those skilled in the art will recognize that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those of skill in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the embodiments of the invention.
Referring to fig. 7, a block diagram of an embodiment of a data updating apparatus according to the present invention is shown, and specifically includes the following modules:
a request sending module 701, configured to send a target request to a server, so as to establish a target channel based on a specified communication protocol between a login end and the server;
a first sending module 702, configured to, in response to the update mechanism, send, when detecting that the stored first enterprise-related data changes, the changed first data to the server through the target channel;
a first receiving module 703, configured to receive second data sent by the server through the target channel, and perform data synchronization based on the second data; the second data comprises changed data which is sent to the login end by the server when the server detects that the stored second enterprise related data is changed.
In a preferred embodiment of the present invention, the login end is deployed with a plurality of programs for processing data, each program corresponding to a different data tag, and the apparatus further includes:
the data processing module is used for determining a first data label corresponding to the second data after receiving the second data; and calling a first program corresponding to the first data label to process the second data.
In a preferred embodiment of the present invention, the first transmitting module 702 includes:
the label determining submodule is used for determining a second data label corresponding to the first data;
the packaging sub-module is used for calling a second program corresponding to the second data label, packaging the first data and obtaining a first data packet to be sent;
and the sending submodule is used for sending the first data packet obtained based on the first data to the server through the target channel when the first data packet to be sent is detected to be generated.
In a preferred embodiment of the present invention, the first enterprise-related data is structured data, and the apparatus further comprises:
a first detection module to configure the first enterprise-related data as structured data applicable to the first data model according to an update mechanism; when a change in an attribute parameter of the first data model is detected, it is determined that a change in the stored first enterprise-related data has been detected.
Referring to fig. 8, a block diagram of another embodiment of the data updating apparatus of the present invention is shown, which may specifically include the following modules:
a channel establishing module 801, configured to receive a target request sent by a login end, and in response to the target request, establish a target channel based on a specified communication protocol between a server and the login end;
a second sending module 802, configured to respond to the update mechanism, and send the changed second data to the login end through the target channel when detecting that the stored second enterprise-related data changes;
a second receiving module 803, configured to receive first data sent by the login end through the target channel, and perform data synchronization based on the first data; the first data is data which is sent to the server by the login end when the login end detects that the stored first enterprise-related data changes.
In a preferred embodiment of the invention, the apparatus further comprises:
the judging module is used for judging whether the target request meets the preset requirement or not; when the target request meets the preset requirement, responding to the target request, and establishing a target channel based on a specified communication protocol between the server and the login end; and when the target request does not meet the preset requirement, returning a connection refusing message to the login end.
In a preferred embodiment of the present invention, the second enterprise-related data is structured data, and the apparatus further comprises:
a second detection module to configure the first enterprise-related data as structured data applicable to the second data model according to the update mechanism; when a change in an attribute parameter of the second data model is detected, it is determined that a change in the stored second enterprise-related data has been detected.
The embodiment of the invention also discloses an electronic device, which comprises:
one or more processors; and
one or more machine-readable media having instructions stored thereon that, when executed by the one or more processors, cause the apparatus to perform a method of updating data as described above.
The embodiment of the invention also discloses a computer readable storage medium, and a stored computer program enables a processor to execute the data updating method.
For the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and reference may be made to the partial description of the method embodiment for relevant points.
The embodiments in the present specification are all described in a progressive manner, and each embodiment focuses on differences from other embodiments, and portions that are the same and similar between the embodiments may be referred to each other.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrases "comprising one of \ 8230; \8230;" does not exclude the presence of additional like elements in a process, method, article, or terminal device that comprises the element.
The above method, apparatus, electronic device and storage medium for updating data provided by the present invention are described in detail, and a specific example is applied in the present document to explain the principle and the implementation of the present invention, and the description of the above embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (11)

1. A method for updating data, the method comprising:
sending a target request to a server so as to establish a target channel based on a specified communication protocol between a login end and the server;
the login end responds to the updating mechanism, and when the stored first enterprise related data is detected to be changed, the changed first data is sent to the server through the target channel;
the login end receives second data sent by the server through the target channel, and performs data synchronization based on the second data; the second data comprises changed data which is sent to the login end by the server when the server detects that the stored second enterprise related data changes.
2. The method of claim 1, wherein the logon client deploys a plurality of programs for processing data, each program corresponding to a different data tag, the method further comprising, upon receipt of the second data by the logon client:
determining a first data label corresponding to the second data;
and calling a first program corresponding to the first data label to process the second data.
3. The method of claim 2, wherein sending the changed first data to the server through the target channel comprises:
determining a second data tag corresponding to the first data;
calling a second program corresponding to the second data label, and packaging the first data to obtain a first data packet to be sent;
and when the generation of a first data packet to be sent is detected, sending the first data packet obtained based on the first data to the server through the target channel.
4. The method of any of claims 1-3, wherein the first enterprise-related data is structured data, the method further comprising:
configuring the first enterprise-related data into structured data that conforms to a first data model according to the update mechanism;
when a change in an attribute parameter of the first data model is detected, it is determined that a change in the stored first enterprise-related data has been detected.
5. A method for updating data, the method comprising:
receiving a target request sent by a login end, responding to the target request, and establishing a target channel based on a specified communication protocol between a server and the login end;
the server responds to the updating mechanism, and when the stored second enterprise related data is detected to be changed, the changed second data is sent to the login end through the target channel;
the server receives first data sent by the login end through the target channel, and performs data synchronization based on the first data; the first data is the changed data sent to the server by the login end when the login end detects that the stored first enterprise-related data is changed.
6. The method of claim 5, further comprising:
judging whether the target request meets a preset requirement or not;
when the target request meets a preset requirement, executing a step of establishing a target channel based on a specified communication protocol between the server and the login terminal in response to the target request;
and when the target request does not meet the preset requirement, returning a connection refusing message to the login end.
7. The method of any of claims 5-6, wherein the second enterprise-related data is structured data, the method further comprising:
configuring the second enterprise-related data into structured data that conforms to a second data model according to the update mechanism;
determining that the stored second enterprise-related data is changed when a change in an attribute parameter of the second data model is detected.
8. An apparatus for updating data, the apparatus comprising:
the request sending module is used for sending a target request to the server so as to establish a target channel based on a specified communication protocol between the login end and the server;
the first sending module is used for responding to an updating mechanism and sending the changed first data to the server through the target channel when detecting that the stored first enterprise related data is changed;
the first receiving module is used for receiving second data sent by the server through the target channel and carrying out data synchronization based on the second data; the second data comprises changed data sent to the login terminal by the server when the server detects that the stored second enterprise-related data is changed.
9. An apparatus for updating data, applied to a server of an enterprise management system, the enterprise management system further including a login end, the apparatus comprising:
the channel establishing module is used for receiving a target request sent by a login end and responding to the target request sent by the login end to establish a target channel based on a specified communication protocol between a server and the login end;
the second sending module is used for responding to the updating mechanism and sending the changed second data to the login end through the target channel when the stored second enterprise related data is detected to be changed;
the second receiving module is used for receiving first data sent by the login end through the target channel and synchronizing the data based on the first data; the first data is the changed data sent to the server by the login end when the login end detects that the stored first enterprise-related data is changed.
10. An electronic device, comprising:
one or more processors; and
one or more machine-readable media having instructions stored thereon that, when executed by the one or more processors, cause the apparatus to perform a method of updating data according to any of claims 1 to 7.
11. A computer-readable storage medium storing a computer program for causing a processor to execute a method of updating data according to any one of claims 1 to 7.
CN202211124874.9A 2022-09-15 2022-09-15 Data updating method and device, electronic equipment and storage medium Pending CN115632815A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211124874.9A CN115632815A (en) 2022-09-15 2022-09-15 Data updating method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211124874.9A CN115632815A (en) 2022-09-15 2022-09-15 Data updating method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115632815A true CN115632815A (en) 2023-01-20

Family

ID=84902749

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211124874.9A Pending CN115632815A (en) 2022-09-15 2022-09-15 Data updating method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115632815A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116233122A (en) * 2023-05-06 2023-06-06 上海观安信息技术股份有限公司 Heterogeneous server login method, device, equipment and medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116233122A (en) * 2023-05-06 2023-06-06 上海观安信息技术股份有限公司 Heterogeneous server login method, device, equipment and medium
CN116233122B (en) * 2023-05-06 2023-07-04 上海观安信息技术股份有限公司 Heterogeneous server login method, device, equipment and medium

Similar Documents

Publication Publication Date Title
CA2943128C (en) Computer system to support failover in an event stream processing system
CN110311983B (en) Service request processing method, device and system, electronic equipment and storage medium
CN108989189B (en) Message pushing method based on enterprise WeChat
CN109639782A (en) Message sends platform, method
CN104184756A (en) Data synchronization method, device and system
CN106911666B (en) Wearable intelligent device and message processing method and system thereof
US8326913B2 (en) Method and system for service contract discovery
CN113157466A (en) Message pushing method, device, system, electronic equipment and storage medium
CN112733001B (en) Method and device for acquiring subscription information and electronic equipment
CN114024972A (en) Long connection communication method, system, device, equipment and storage medium
CN112769636A (en) Video short message link monitoring method and device, electronic equipment and storage medium
CN115632815A (en) Data updating method and device, electronic equipment and storage medium
CN114598749B (en) Service access method and device
CN114465867A (en) Server maintenance method and device, storage medium and processor
CN113765774B (en) Method, device, electronic equipment and medium for synchronizing messages in real time
CN111327680B (en) Authentication data synchronization method, device, system, computer equipment and storage medium
CN115951923B (en) Subscription event management method, display system, device and storage medium
CN112328413A (en) Application service calling method, device and system
CN112187916B (en) Cross-system data synchronization method and device
CN110535904B (en) Asynchronous pushing method, system and device
CN111596933A (en) File processing method and device, electronic equipment and computer readable storage medium
CN115297066B (en) Resource dynamic cooperation method, device, server and medium
CN112994894B (en) Gateway-based single-thread request processing method and information verification AGENT
CN110740151A (en) micro-service adjusting method, device, server and computer storage medium
TWI825660B (en) Method for building a web chat room and a chat room system

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