Detailed Description
The following describes the scheme provided in the present specification with reference to the drawings.
The service data maintenance method provided in one or more embodiments of the present disclosure may be applied to a scenario as shown in fig. 1. In fig. 1, a service data processing system may receive service data input by a user through a man-machine interaction interface. The service data may refer to data having a corresponding validity period and validation status. After receiving the service data, the service data processing system can write the service data into a preset storage unit (such as a database) and can also perform asynchronous processing on the service data. For example, timing messages are generated based on the validity period of the traffic data. And then, when the timing message is triggered, carrying out validation marking and/or expiration marking on the service data matched with the service data in the preset storage unit.
The service processing system in fig. 1 may specifically include: a data entry module 102, a data parsing processing module 104, a timing message module 106, and a data post-processing module 108.
In particular, business data entered by a user through a human-machine interaction interface may be received by the data entry module 102. The business data may be, for example, price agreement data for the materials negotiated in advance for the business and the merchant. It should be noted that, the service data may have a specific format, for example, an excel format or a form format.
The data entry module 102, upon receiving the traffic data described above, may generate a corresponding traffic data ID for the traffic data. And then writing the service data ID and the service data into a preset storage unit. In addition, the service data ID may be submitted to the data parsing module 104.
The data parsing module 104 may parse the service data after receiving the service data. Taking service data in an excel format as an example, the service data can be parsed by a corresponding parsing rule to obtain a corresponding validity period. The validity period herein may include a start time and an end time. Thereafter, corresponding timing messages may be generated based on the start time and the end time, respectively, wherein the timing message generated based on the start time may be referred to as a first timing message and the timing message generated based on the end time may be referred to as a second timing message. For the first timing message described above, a corresponding message ID may be generated. In one example, the message ID of the first timing message may be: start_traffic data ID. Where "START" is used to indicate that the first timing message is triggered by a START time, the traffic data ID may be received from the data entry module 102. Similarly, the message ID of the second timing message may be: end_service data ID. Wherein "END" is used to indicate that the second timing message is triggered by an END time.
After generating the message ID, the data parsing module 104 may write the message ID corresponding to the first timing message into the message body of the first timing message. Similarly, a message ID corresponding to the second timing message may be written to the message body of the second timing message. The data parsing processing module 104 may then send the first timing message and the second timing message after writing the message ID to the timing message module 106.
The timing message module 106 may buffer the received first timing message and second timing message in a message buffer queue. For either the first timing message or the second timing message in the message cache queue, the timing message module 106 may detect whether it is triggered by a message timing trigger. In particular, the first timing message may be triggered when the start time arrives. When the end time arrives, a second timing message may be triggered.
After the first timing message or the second timing message is triggered, the timing message module 106 may send it to the data post-processing module 108 through a message sender.
The data post-processing module 108 may parse the corresponding message body after receiving the first timing message or the second timing message. In one example, the message ID in the message body may be parsed to obtain the service data ID and a "START" tag or an "END" tag.
When the "START" flag is parsed, it is explained that the first timing message is currently received, and the following business logic processing is performed: and determining corresponding service data in a preset storage unit according to the service data ID. And then, at least one candidate business data matched with the determined business data is obtained. Matching here may refer to having the same object identification as well as the object provider, etc. Taking the service data as price agreement data as an example, the matching may refer to the material number and the same vendor. It will be appreciated that the candidate service data includes the determined service data. And finally, selecting the service data to be validated, the starting time of which is closest to the current time and the ending time of which does not arrive yet, from at least one piece of candidate service data. And marking the service data to be validated. In addition, the service data which is effective before can be marked with expiration, so that only one piece of service data is effective for the same object.
When the "END" flag is resolved, it is indicated that the second timing message is currently received, and the following service logic processing is performed: and selecting the service data to be validated according to the selection method of the service data to be validated, and marking the service data to be validated. In addition, the read business data can be marked with expiration.
It should be noted that, the process of the data post-processing module 108 for marking the service data with the validation flag and/or the expiration flag may be understood as updating the validation status of the service data in the preset storage unit.
The service system in fig. 1 may read the validation status from the preset storage unit as follows: the service data which is effective currently can improve the reading efficiency of the service data.
Fig. 2 is a flowchart of a method for maintaining service data according to an embodiment of the present disclosure. The subject of execution of the method may be a device with processing capabilities: the server or system or device, for example, may be the business data processing system of fig. 1. As shown in fig. 2, the method specifically may include:
and 202, receiving target service data input by a user.
For example, it may be the target business data that is received by the data entry module 102 for user input. The target business data here may be data entered by the user with a corresponding validity period and validation status. In one example, the target business data may refer to price agreement data for the materials negotiated in advance by the business and the merchant, and the price agreement data may be as shown in table 1.
TABLE 1
In table 1, the price agreement data for the material has a corresponding expiration date, including a start time and an end time. In addition, the corresponding effective state is provided.
And 204, writing the target business data into a preset storage unit.
For example, the target business data may be written to a preset memory location by the data entry module 102.
Here, a plurality of pieces of service data having corresponding validity periods are recorded in a preset storage unit. Taking the target service data as price agreement data as an example, the service data in the preset storage unit may be as shown in table 1.
In one implementation, before writing the target service data into the preset storage unit, the service data ID corresponding to the target service data may be generated. And then, writing the target service data and the corresponding service data ID into a preset storage unit.
And step 206, analyzing the target service data to determine the validity period of the target service data.
For example, the data entry module 102 may submit the target service data and the corresponding service data ID to the data parsing module 104. The data parsing module 104 parses the target service data. The target service data in the present specification may have a specified format, such as an excel format or a form format. When the form is in the form format, the corresponding validity period can be directly determined; and when the service data is in the excel format, analyzing the target service data through a corresponding analysis rule to determine a corresponding validity period. The validity period may include a start time and an end time.
Step 208, a timing message triggered by the validity period of the target traffic data is generated.
When the validity period includes a start time and an end time, a first timing message triggered by the start time and a second timing message triggered by the end time may be generated by the data parsing processing module 104, respectively.
For the first timing message described above, a corresponding message ID may be generated. In one example, the message ID of the first timing message may be: start_traffic data ID. Where "START" is used to indicate that the first timing message is triggered by a START time, the traffic data ID may be received from the data entry module 102. Similarly, the message ID of the second timing message may be: end_service data ID. Wherein "END" is used to indicate that the second timing message is triggered by an END time.
After generating the message ID, the data parsing module 104 may write the message ID corresponding to the first timing message into the message body of the first timing message. Similarly, a message ID corresponding to the second timing message may be written to the message body of the second timing message. The data parsing processing module 104 may then send the first timing message and the second timing message after writing the message ID to the timing message module 106.
The timing message module 106 may buffer the received first timing message and second timing message in a message buffer queue. For either the first timing message or the second timing message in the message cache queue, the timing message module 106 may detect whether it is triggered by a message timing trigger. In particular, the first timing message may be triggered when the start time arrives. When the end time arrives, a second timing message may be triggered.
After the first timing message or the second timing message is triggered, the timing message module 106 may send it to the data post-processing module 108 through a message sender.
The data post-processing module 108 may parse the corresponding message body after receiving the first timing message or the second timing message. In one example, the message ID in the message body may be parsed to obtain the service data ID and a "START" tag or an "END" tag.
When the "START" flag is parsed, it is stated that the first timing message is currently received. When the "START" flag is parsed, it is interpreted that a second timing message is currently received.
And step 210, when the timing message is triggered, at least one candidate business data matched with the target business data is read from a preset storage unit.
And 212, marking the candidate service data to be effective and/or expire according to the validity period of the candidate service data.
It should be noted that, when the first timing message is triggered, the implementation process of the foregoing step 210 and the step 212 may be as follows: and determining corresponding target service data in a preset storage unit according to the service data ID. And then, at least one candidate business data matched with the target business data is obtained. Matching here may refer to having the same object identification as well as the object provider. Taking the service data as price agreement data as an example, the matching may refer to the material number and the same vendor. It will be appreciated that the candidate service data includes target service data. And finally, selecting the service data to be validated, the starting time of which is closest to the current time and the ending time of which does not arrive yet, from at least one piece of candidate service data. And marking the service data to be validated. In addition, the service data which is effective before can be marked for expiration.
Taking the price agreement data in table 1 as an example, assuming that the current time is 2018-04-01, a timing message generated based on the start time of the 5 th price agreement data in the message buffer queue is triggered. It can be understood that after the message body of the timing message is parsed, the following can be obtained: "START" flag and sequence number: 5, here sequence number: 5 can be understood as the service data ID of the price agreement data. From this sequence number, the 5 th price agreement data can be determined in table 1. The candidate service data that may be obtained from table 1 according to the 5 th price agreement data may then include: price agreement data 1, price agreement data 3, and price agreement data 5. Since the start time of the 5 th price agreement data is closest to the current time (i.e., 0 days) and the end time has not yet arrived, the 5 th price agreement data may be selected as the service data to be validated. Thus, the generation state thereof can be set as: "currently active". In addition, the validation state of the 4 th price agreement data that was previously validated may also be set to: "expired". The validation state in table 1 may be updated as shown in table 2.
TABLE 2
When the second timing message is triggered, the implementation process of the above step 210 and step 212 may be as follows: and selecting the service data to be validated according to the selection method of the service data to be validated, and marking the service data to be validated. In addition, expiration marking can be performed on the target business data.
Taking the price agreement data in table 1 as an example, assuming that the current time is 2018-02-28, a timing message generated based on the end time of the 6 th price agreement data in the message buffer queue is triggered. It can be understood that after the message body of the timing message is parsed, the following can be obtained: "END" flag and sequence number: 6, serial number here: 6 can be understood as the service data ID of the price agreement data. From this sequence number, the 6 th price agreement data can be determined in table 1. The candidate service data that may be obtained from table 1 according to the 6 th price agreement data may then include: price agreement data 2, price agreement data 4, price agreement data 6. Since the start time of the 4 th price agreement data is closest to the current time and the end time has not yet arrived, the 4 th price agreement data can be selected as the service data to be validated. Thus, its validation state can be set to: "currently active". In addition, the validation state of the 6 th price agreement data may be set to: "expired". The validation state in table 1 may be updated as shown in table 3.
TABLE 3 Table 3
Although the above example has been described with reference to the candidate service data being marked with the validation flag and the expiration flag at the same time, only the validation flag or the expiration flag may be used in actual application, and this is not a limitation in the present specification. For example, only validation flags may be used to delete expired service data or dump it to other storage locations. For example, when a certain piece of service data is expired (i.e., when the end time is reached), only the expiration flag may be performed if the selected data to be validated is the currently validated service data.
For the service data in the preset storage unit, the service system can read the service data from the preset storage unit. The reading process can be as follows: a read data request of a business system is received, the read data request including an object identification. And reading a plurality of pieces of service data from a preset storage unit according to the object identification. And selecting the business data which is subjected to the validation marking from the plurality of business data. And returning the business data subjected to the validation marking to the business system.
Taking table 1 as an example, when the object is identified as a material number of the material: QO0201, 1 st, 3 rd and 5 th price agreement data can be read. And because the effective state of the 3 rd price agreement data is: "currently active", the 3 rd price agreement data may be returned to the business system.
Therefore, when the service system reads the service data, the service system can directly read the service data which is subjected to the effective marking without judging whether each piece of service data is effective according to the starting time and the ending time of the service data, so that the efficiency of the service system for reading the data can be greatly improved.
In summary, according to the service data maintenance method provided by the embodiment of the present disclosure, the valid state of the service data in the preset storage unit is automatically updated by generating the timing message, which can improve the service data maintenance efficiency, further save computer resources and reduce the performance overhead of the server. In addition, the efficiency of reading data by the service system can be improved.
The maintenance process will be described below by taking service data as price agreement data as an example.
Fig. 3 is a schematic diagram of a method for maintaining price agreement data provided in the present specification. As shown in fig. 3, the following four phases may be included: an initialization stage, an analysis stage, a to-be-triggered stage and a logic processing stage.
An initialization stage: price agreement data having a specified format may be received. The specified format may include, but is not limited to, an excel format or a form format, etc. In addition, the price agreement data may also be written into a database.
And a data analysis stage: and analyzing the price agreement data in the appointed format to obtain the corresponding starting time and ending time. A first timing message triggered by the start time and a second timing message triggered by the end time are generated, respectively. Further, the message ID of the first timing message or the second timing message may be generated, respectively. The message ID of the first timing message may be: the start_price agreement data ID, the message ID of the second timing message may be: end_price agreement data ID. And finally, sending the first timing message and the second timing message identified by the corresponding message IDs.
A stage to be triggered: the first timing message and the second timing message are processed through the distributed timing message middleware. It will be appreciated that when a plurality of price agreement data is received in the above described initialisation phase, this phase may process a plurality of first timing messages and a plurality of second timing messages. When the start time or the end time of a certain piece of price protocol data arrives, the distributed timing message middleware can send the triggered first timing message or second timing message to the message subscription terminal.
Logic processing stage: after receiving the first timing message or the second timing message, the message subscription terminal analyzes the message body to obtain the price protocol data ID and the mark of "START" or "END", and performs corresponding service logic processing. Specifically, if the "START" flag is parsed, the price agreement data is read according to the price agreement data ID, and the price agreement data of the same vendor and the same material as the price agreement data is determined. From the price agreement data decided, selecting price agreement data with the latest starting time to the current time and still in the validity period, and setting the effective state as follows: "currently active". In addition, the previous validation state may also be: the validation state of the "currently valid" price agreement data is set to: "expired". If the "END" flag is resolved, the corresponding price agreement data is read according to the price agreement data ID, and the validation state is set as: "expired". In addition, price agreement data of the same supplier and the same material as the price agreement data can be determined. From the price agreement data decided, selecting price agreement data with the latest starting time to the current time and still in the validity period, and setting the effective state as follows: "currently active".
By the price agreement data maintenance method, enterprises can be helped to take effect in real time and price agreement data between suppliers, so that a service system can efficiently decide effective price agreement data when reading the price agreement data. Therefore, the service system only pays attention to the use of price agreement data, and does not need to process the validation logic of the price agreement data.
Corresponding to the service data maintenance method, an embodiment of the present disclosure further provides a service data maintenance device, as shown in fig. 4, where the device may include:
a receiving unit 402, configured to receive target service data input by a user.
A writing unit 404, configured to write the target service data received by the receiving unit 402 into a preset storage unit. The preset storage unit records a plurality of pieces of service data, and the plurality of pieces of service data have corresponding validity periods.
The functionality of the receiving unit 402 and the writing unit 404 here may be implemented by the data entry module 102 in fig. 1 described above.
And the parsing unit 406 is configured to parse the target service data to determine a validity period of the target service data.
A generating unit 408, configured to generate a timing message triggered by the validity period of the target service data obtained by parsing by the parsing unit 406.
The generating unit 408 may specifically be configured to:
a first timing message triggered by a start time of the target traffic data is generated and a second timing message triggered by an end time of the target traffic data is generated.
The functions of the parsing unit 406 and the generating unit 408 herein may be implemented by the data parsing processing module 104 in fig. 1 described above.
And a reading unit 410, configured to read, when the timing message generated by the generating unit 408 is triggered, at least one candidate service data matched with the target service data from a preset storage unit.
A marking unit 412, configured to mark the candidate service data for validation and/or expiration according to the validity period of the candidate service data read by the reading unit 410.
The functions of the reading unit 410 and the marking unit 412 may be implemented by the data post-processing module 108 in fig. 1 described above.
The marking unit 412 may specifically be configured to:
and selecting the service data to be validated, wherein the starting time of the service data is closest to the current time and the ending time of the service data does not arrive.
And marking the service data to be validated. And/or the number of the groups of groups,
and carrying out expiration marking on the service data which is validated before.
The marking unit 412 may also be specifically configured to:
and selecting the service data to be validated, wherein the starting time of the service data is closest to the current time and the ending time of the service data does not arrive.
And marking the service data to be validated. And/or the number of the groups of groups,
and performing expiration marking on the target service data.
Optionally, the apparatus may further include: a pick unit 414 and a send unit 416.
The receiving unit 402 is further configured to receive a read data request of the service system, where the read data request includes the object identifier.
The reading unit 410 is further configured to read a plurality of pieces of service data from a preset storage unit according to the object identifier.
A selecting unit 414, configured to select service data that has been subjected to validation marking from the plurality of service data read by the reading unit 410.
And a sending unit 416, configured to return the service data that has been subjected to the validation token and is selected by the selecting unit 414 to the service system.
Alternatively, the target service data may be price agreement data of the material. The price agreement data may include one or more of the following: serial number, material name, material number, vendor, price, start time, end time, and validation status.
The marking unit 412 may specifically be configured to:
the validation state of the price agreement data is set to currently valid and/or expired.
The functions of the functional modules of the apparatus in the foregoing embodiments of the present disclosure may be implemented by the steps of the foregoing method embodiments, so that the specific working process of the apparatus provided in one embodiment of the present disclosure is not repeated herein.
In the service data maintenance device provided in one embodiment of the present disclosure, the receiving unit 402 receives target service data input by a user. The writing unit 404 writes the target service data into a preset storage unit. The parsing unit 406 parses the target service data to determine the validity period of the target service data. The generation unit 408 generates a timing message triggered by the validity period of the target traffic data. When the timing message is triggered, the reading unit 410 reads at least one candidate service data matched with the target service data from a preset storage unit. The tagging unit 412 validates and/or tags the candidate traffic data with expiration according to the validity period of the candidate traffic data. Thus, the maintenance efficiency of the service data can be improved.
The service data maintenance device provided in the foregoing embodiments of the present disclosure may be a module or unit of a service data processing system.
Corresponding to the above service data maintenance method, the embodiment of the present disclosure further provides a server, as shown in fig. 5, where the server may include:
a receiver 502, configured to receive target service data input by a user.
The memory 504 is configured to store a plurality of pieces of service data, where the plurality of pieces of service data have corresponding validity periods.
At least one processor 506 for writing the target traffic data to the memory 504. And analyzing the target service data to determine the validity period of the target service data. A timing message triggered by the validity period of the target traffic data is generated. When the timing message is triggered, at least one candidate traffic data matching the target traffic data is read from the memory 504. And marking the candidate business data in effect and/or marking the expiration according to the validity period of the candidate business data.
The server provided by the embodiment of the specification can improve the maintenance efficiency of service data.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for the server embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and reference is made to the description of the method embodiment for relevant points.
The steps of a method or algorithm described in connection with the disclosure herein may be embodied in hardware, or may be embodied in software instructions executed by a processor. The software instructions may be comprised of corresponding software modules that may be stored in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an ASIC. In addition, the ASIC may reside in a server. The processor and the storage medium may reside as discrete components in a server.
Those skilled in the art will appreciate that in one or more of the examples described above, the functions described in the present invention may be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, these functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
The foregoing describes specific embodiments of the present disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
The foregoing detailed description of the embodiments has further described the objects, technical solutions and advantages of the present specification, and it should be understood that the foregoing description is only a detailed description of the embodiments of the present specification, and is not intended to limit the scope of the present specification, but any modifications, equivalents, improvements, etc. made on the basis of the technical solutions of the present specification should be included in the scope of the present specification.