Disclosure of Invention
The embodiment of the application provides a processing method of accounting data, electronic equipment and a readable storage medium, which are used for solving the problem that in the prior art, a business component may repeatedly send transaction data to be accounted, so that the accounting component repeatedly accounts.
In a first aspect, an embodiment of the present application provides a method for processing accounting data, where the method includes:
the business component sends accounting related data to the message service component, wherein the accounting related data comprises an accounting message, transaction data and accounting data;
the message service component performs pre-check on the received accounting related data;
and the message service component sends the accounting related data received for the first time to the accounting component according to the pre-check result.
In a possible implementation of the first aspect, the message service component performs pre-checking on the received accounting-related data, including:
and the message service component determines whether the accounting data belonging to the same group as the accounting message is repeatedly transmitted accounting data or not according to the characteristic character string in the accounting message, wherein the accounting data also comprises the characteristic character string.
In a possible implementation of the first aspect, the determining, by the message service component, whether accounting data belonging to the same group as the accounting message is repeatedly sent accounting data according to the feature character string in the accounting message includes:
the message service component inquires in a preset message mark information table according to the characteristic character string in the accounting message;
and under the condition that the characteristic character string can be inquired in the message mark information table, determining that the accounting data belonging to the same group with the accounting message is repeatedly transmitted accounting data, otherwise, determining that the accounting data is non-repeatedly transmitted accounting data.
In a possible implementation of the first aspect, the sending, by the business component, the accounting-related data to the message service component includes:
the business component will calculate the relevant data and send it to the message service component in the form of file.
In a possible implementation of the first aspect, the method further includes: the transaction data and the accounting data comprise data files and control information files; the data file and the control information file have the same file name.
In a possible implementation of the first aspect, the method further includes: the file name of the accounting message comprises a characteristic character string; the characteristic character string is included in a file name of a data file of the accounting data.
In a possible implementation of the first aspect, the method further includes: the message service component stores the received accounting-related data in an ordered, persistent manner.
In a second aspect, an embodiment of the present application provides an electronic device, including:
a memory for storing instructions for execution by one or more processors of the electronic device, an
The processor, which is one of the processors of the electronic device, is configured to perform the processing method for accounting data according to any one of the first aspect and various possible implementations of the first aspect.
In a third aspect, an embodiment of the present application provides a readable storage medium, where instructions are stored on the readable storage medium, and when the instructions are executed on an electronic device, the instructions cause the electronic device to perform the processing method for accounting data in any one of the first aspect and various possible implementations of the first aspect.
In a fourth aspect, the present application provides a computer program product, which includes computer programs/instructions, and is characterized in that when executed by a processor, the computer programs/instructions implement the processing method for accounting data in the first aspect and any one of various possible implementations of the first aspect.
The embodiment of the application provides a processing method of accounting data for electronic equipment, in the method, a business component sends accounting related data to a message service component, the message service component performs pre-check on the received accounting related data, and then sends the accounting related data received for the first time to an accounting component for accounting according to a pre-check result, so that the corresponding accounting data is pre-checked before accounting processing is performed on transaction data, accounting of the accounting component according to the repeatedly sent accounting data is avoided, database pressure caused by repeatedly storing the accounting data can be relieved, and meanwhile, alarm of an accounting system caused by repeatedly performing accounting is avoided.
Detailed Description
The illustrative embodiments of the present application include, but are not limited to, a processing method of accounting data, an electronic device, and a readable storage medium.
It is to be appreciated that as used herein, the term module may refer to or include an Application Specific Integrated Circuit (ASIC), an electronic circuit, a processor (shared, dedicated, or group) and/or memory that executes one or more software or firmware programs, a combinational logic circuit, and/or other suitable hardware components that provide the described functionality, or may be part of such hardware components.
It is to be appreciated that in various embodiments of the present application, the processor may be a microprocessor, a digital signal processor, a microcontroller, or the like, and/or any combination thereof. According to another aspect, the processor may be a single-core processor, a multi-core processor, the like, and/or any combination thereof.
It can be understood that the processing method of accounting data of the application is suitable for a scenario of accounting transaction data.
Embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
FIG. 1 provides a scenario in which transaction data is processed prior to accounting according to some embodiments of the present application. As shown in fig. 1, thebusiness component 100 sends the accounting message, the transaction data and the accounting data to the message service component, the message service component receives the accounting message, the transaction data and the accounting data through themessage receiving component 200, themessage receiving component 200 then transmits the accounting message, the transaction data and the accounting data to thepre-check component 300, thepre-check component 300 checks the accounting message, the transaction data and the accounting data, and in case that it is checked that the accounting data is not the received data, the message service component sends the transaction data and the accounting data to theaccounting component 400 for corresponding accounting.
Thebusiness component 100 is an accounting subsystem, such as a financial management subsystem, an accounts receivable subsystem, or the like, capable of generating transaction data and accounting data. Thebusiness component 100 continuously generates transaction data during operation, and generates accounting data at regular time according to preset accounting rules. The transaction data and the accounting data generated by thebusiness component 100 are sent to theaccounting component 400 for accounting, and theaccounting component 400 returns an accounting completion notification to thebusiness component 100 after accounting of the transaction data and the accounting data is completed, so that thebusiness component 100 knows that the sent transaction data and the sent accounting data have completed accounting.
The transaction data refers to the serial data generated during the transaction process, and is used for recording a transaction in a specific service, and the content of the transaction data may include, but is not limited to, a serial number, a transaction amount, a transaction date, and the like. The accounting data is data related to the accounting parameters and is used to describe the mapping relationship between thebusiness component 100 and the corresponding multiple accounting types, and theaccounting component 400 can complete accounting of the transaction data within a certain period according to the transaction data and the accounting data. Accounting types refer to different financial accounting services that may include, for example, marketable products, internal accounts, charged items, physical objects, accounting fees, and the like. The accounting message is a message corresponding to the transaction data and the accounting data, and is used for judging whether the accounting data is repeatedly transmitted accounting data.
The message service component receives and stores the data sent by thebusiness component 100, and then sends the stored data to theaccounting component 400. The message service component comprises amessage receiving component 200 and apreview component 300, wherein themessage receiving component 200 is used for specifically receiving data and transmitting the received data to thepreview component 300 for checking, and the data meeting the preset checking condition is sent to theaccounting component 400 by the message service component.
Thepre-check component 300 checks the transaction data and the accounting data according to the accounting message, and if it is checked that the accounting data is already received, the accounting data may be discarded or the message service component may be notified not to send the accounting data to theaccounting component 400.
Theaccounting component 400 is configured to perform accounting on the received transaction data and accounting data, and send an accounting completion notification to thebusiness component 100 after accounting is completed, and thebusiness component 100 does not send the transaction data and the accounting data indicated in the accounting completion notification to the message service component after receiving the accounting completion notification.
The method provided by the technical scheme of the application comprises the steps that the pre-check assembly is additionally arranged in the message service assembly, data pre-check is carried out after the message service assembly receives transaction data and accounting data, the repeatedly sent accounting data are found through the data pre-check and are not processed, accounting according to the repeatedly sent accounting data is avoided, the pressure of a database caused by repeatedly storing the accounting data can be relieved, and meanwhile, the alarm of an accounting system caused by repeatedly carrying out accounting is avoided.
Fig. 2 illustrates a block diagram of a hardware architecture of anelectronic device 20 for implementing a processing method of accounting data, according to some embodiments of the present application. In the embodiment shown in fig. 2,electronic device 20 may include one ormore processors 201,system control logic 202 coupled to at least one ofprocessors 201,system Memory 203 coupled tosystem control logic 202, Non-Volatile Memory (NVM) 204 coupled tosystem control logic 202, andnetwork interface 206 coupled tosystem control logic 202.
In some embodiments,processor 201 may include one or more single-core or multi-core processors. In some embodiments, theprocessor 201 may include any combination of general-purpose processors and special-purpose processors (e.g., graphics processors, application processors, baseband processors, etc.). In embodiments where theelectronic device 20 employs an enhanced Node B (eNB) or a Radio Access Network (RAN) controller, theprocessor 201 may be configured to perform various consistent embodiments. For example, theprocessor 201 may be used to implement a processing method of accounting data.
In some embodiments,system control logic 202 may include any suitable interface controllers to provide any suitable interface to any suitable device or component in communication withsystem control logic 202 by at least one ofprocessors 201.
In some embodiments,system control logic 202 may include one or more memory controllers to provide an interface tosystem memory 203.System memory 203 may be used to load and store data and/or instructions. For example, thesystem memory 203 may load an instruction for acquiring the preview rule in the embodiment of the present application, and may also store transaction data and accounting data sent by the business component.
In some embodiments,system Memory 203 ofelectronic device 20 may include any suitable volatile Memory, such as suitable Dynamic Random Access Memory (DRAM).
NVM memory 204 may include one or more tangible, non-transitory computer-readable media for storing data and/or instructions. In some embodiments, NVM memory 204 may include any suitable non-volatile memory such as flash memory and/or any suitable non-volatile storage device, such as at least one of a Hard Disk Drive (HDD), Compact Disc (CD) Drive, Digital Versatile Disc (DVD) Drive. In an embodiment of the present application, NVM memory 204 may be used to store message data received by a message service component.
NVM memory 204 may comprise a portion of a storage resource on the device on whichelectronic apparatus 20 is installed, or it may be accessible by, but not necessarily a part of, the apparatus. For example, NVM memory 204 may be accessed over a network vianetwork interface 206.
In particular,system memory 203 and NVM memory 204 may each include: a temporary copy and a permanent copy ofinstructions 205. Theinstructions 205 may include: instructions that, when executed by at least one of theprocessors 201, cause theelectronic device 20 to implement the method as shown in fig. 2. In some embodiments, theinstructions 205, hardware, firmware, and/or software components thereof may additionally/alternatively be disposed in thesystem control logic 202, thenetwork interface 206, and/or theprocessor 201.
Thenetwork interface 206 may include a transceiver to provide a radio interface for theelectronic device 20 to communicate with any other suitable device (e.g., front end module, antenna, etc.) over one or more networks. In some embodiments, thenetwork interface 206 may be integrated with other components of theelectronic device 20. For example,network interface 206 may be integrated with at least one ofprocessor 201,system memory 203, NVM memory 204, and a firmware device (not shown) having instructions that, when executed by at least one ofprocessors 201,electronic device 20 implements a method as shown in method embodiments. In an embodiment of the present application, thenetwork interface 206 may be used to receive transaction data and accounting data sent by the business component.
Thenetwork interface 206 may further include any suitable hardware and/or firmware to provide a multiple-input multiple-output radio interface. For example,network interface 206 may be a network adapter, a wireless network adapter, a telephone modem, and/or a wireless modem.
In some embodiments, at least one of theprocessors 201 may be packaged together with logic for one or more controllers of theSystem control logic 202 to form a System In a Package (SiP). In some embodiments, at least one of theprocessors 201 may be integrated on the same die with logic for one or more controllers of theSystem control logic 202 to form a System on Chip (SoC).
Theelectronic device 20 may further include: input/output (I/O)devices 207. The I/O device 207 may include a user interface to enable a user to interact with theelectronic device 20; the design of the peripheral component interface enables peripheral components to also interact with theelectronic device 20.
It is to be understood that the configuration illustrated in fig. 2 does not constitute a specific limitation of theelectronic device 20. In other embodiments of the present application, theelectronic device 20 may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented by hardware or software, or a combination of software and hardware.
The following describes the technical solution of the present application in detail with reference to fig. 3 and with reference to a specific scenario in combination with the structure shown in fig. 2. As shown in fig. 3, a processing scheme for accounting data in some embodiments of the present application includes:
s301:business component 100 sends accounting-related data to the message service component.
Here, theservice component 100 may be a subsystem for completing different financial accounting service functions, theservice component 100 continuously generates transaction data corresponding to a service transaction in the process of implementing the service function, and meanwhile, in order to complete accounting on the transaction data generated by theservice component 100, the service component also needs to send accounting data to a software module completing the transaction data accounting function, so that the software module completes accounting on the transaction data.
Theservice component 100 may be a software module for implementing a service function, or may be an electronic device for deploying a service function software module.
In some embodiments of the present application, accounting-related data may include, but is not limited to, accounting messages, transaction data, accounting data, and the like. Here, the accounting message, the transaction data, and the accounting data may be stored in a file form. Theservice component 100 sends the accounting message, the transaction data and the accounting data in a grouping manner, and each group may include two kinds of data, such as the accounting message and the transaction data, the accounting message and the accounting data, or may include three kinds of data at the same time. The accounting messages in the group have a corresponding relationship with the corresponding transaction data and the accounting data, and here, the corresponding relationship may be established by file names of the accounting messages, the transaction data and the accounting data, for example, the same identification character string is used in the file names of the three, thereby grouping the three into the same group.
In some embodiments of the present application, the transaction data and the accounting data are stored in the form of a data file and a control information file, respectively, i.e. the transaction data is stored in the data file and the corresponding control information file, and the accounting data is stored in another data file and the corresponding control information file. Here, the control information file stores the related control information using an XML format, and the control information may include, but is not limited to, a file name of the data file, a file size, a number of lines storing data, a creation time of the file, and the like. The data file stores specific data, for example, transaction running data is stored in the data file of the transaction data, and accounting parameter data is stored in the data file of the accounting data.
In addition, the data file can also store the file name of the corresponding control information file, so that the corresponding control information file can be obtained by analyzing the data file.
In some embodiments of the present application, the file name of the data file and the file name of the corresponding control information file are set to be the same file name, so that the correspondence relationship between the data file and the control information file can be known by the file names.
It is understood that, in order to facilitate the parsing of the data file and the control information file, extensions of the data file and the control information file may be set, and specifically, the extension of the data file is set to DAT and the extension of the control information file is set to XML.
In some embodiments of the present application, the data in the data files of the accounting message, the transaction data and the accounting data are organized into text data according to the code format of UTF-8, and the length of each necessary data field in the text data is a preset fixed length, for example, the maximum length defined by the data item in the data dictionary may be determined as the length of the data field. The optional data field needs to be supplemented with a space or 0 with a corresponding length according to the data type of the data field, so that the length of the optional data field is kept unchanged, and the subsequent processing can be directly performed according to the definition of the data dictionary.
S302: the message service component receives accounting-related data.
Here, the accounting-related data is not directly sent to theaccounting component 400 for processing, but is sent to the message service component for temporary storage and then forwarded to theaccounting component 400 by the message service component. By using the message service component to forward the accounting-related data, it is possible to prevent theaccounting component 400 from being crashed due to an excessive load when a plurality ofbusiness components 100 simultaneously transmit the accounting-related data to theaccounting component 400, and to improve the robustness of the entire accounting system.
In some embodiments of the present application, the message service component stores received messages in an ordered, persistent manner. The message may be a message in the memory or a message sent in a file form. In particular, the message service component may use the Kafka distributed message processing system for receiving and sending messages.
S303: the message service component performs pre-check on accounting related data.
In some embodiments of the present application, a function module for performing a pre-check on the accounting related data is added in the message service component, and after the message service component receives the accounting related data, the message service component does not directly forward the accounting related data to theaccounting component 400, but performs the pre-check first.
Here, the pre-checking of the accounting-related data may be a file name consistency check of the transaction data or the accounting data file and the control information file, that is, checking whether file names of the transaction data or the accounting data file and the control information file are consistent, if so, indicating that the data in the accounting-related data is correct, otherwise, indicating that the data in the accounting-related data is incorrect.
In addition, the pre-checking of the accounting-related data can also be a judgment of the state of the accounting data belonging to the same group as the accounting message according to the checking result of the accounting message. In some embodiments of the present application, the message service component checks the accounting message, and may query in a preset message tag information table according to a feature character string in a file name of the accounting message, where the feature character string is also included in the same group of accounting data, and if the feature character string can be queried, it indicates that the accounting data belonging to the same group as the accounting message has been received, and the accounting data is repeatedly sent accounting data; if the checking result cannot be obtained, the checking result shows that the checking data which belongs to the same group with the checking message is received for the first time, the checking data is the checking data which is not repeatedly sent, and the message service component writes the characteristic character string in the file name of the checking message into a preset message mark information table to show that the checking data is received.
S304: and the message service component determines whether the accounting related data is repeated according to the pre-detection result.
Here, after the message service component performs pre-check on the accounting related data, a corresponding pre-check result is obtained, the pre-check result is used to determine whether theservice component 100 repeatedly sends the accounting related data, and if the accounting related data is repeatedly sent, the message service component may directly discard the repeatedly sent accounting related data, and does not occupy the storage space of the database or waste the computing resources of theelectronic device 20 for accounting processing.
If the file names of the data file and the control information file in the accounting related data are inconsistent as a result of the pre-check, incorrect data exists in the accounting related data, the incorrect data is not necessary for subsequent processing, the message service component can be directly discarded, and then therelevant business component 100 is waited to send the correct accounting related data.
If the pre-check result is that the accounting data in the accounting-related data is repeatedly transmitted by thebusiness component 100, the message service component determines the accounting-related data as the repeated accounting-related data, and may directly discard the repeated accounting-related data.
S305: the message service component sends non-duplicate accounting related data.
The message service component, upon determining that the accounting-related data is non-duplicately sent data, sends the non-duplicately accounting-related data to theaccounting component 400. Here, the non-duplicated accounting-related data is the accounting-related data that is first received by the message service component, and is data that needs to be accounted, and therefore needs to be sent to theaccounting component 400 for processing.
S306: theaccounting component 400 accounts for the received accounting-related data.
Theaccounting component 400 completes accounting according to transaction data and accounting data in the accounting-related data after receiving the accounting-related data sent by the message service component. The transaction data is transaction flow data in a period of time, for example, the current day, and the accounting data is used for accounting the transaction data in the period of time, for example, accounting the transaction data in the current day.
S307:accounting component 400 sends an accounting complete notification.
After accounting of the accounting-related data is completed, theaccounting component 400 sends an accounting-complete notification to thecorresponding business component 100, informing that thebusiness component 100 has completed accounting of the accounting-related data, and thebusiness component 100 does not need to resend the accounting-related data.
Thebusiness component 100, upon receiving the accounting completion notification, may mark the accounting-related data that has completed accounting and no longer send the accounting-related data. If thebusiness component 100 does not receive the accounting completion notification due to unexpected factors such as a network failure, etc., thebusiness component 100 may repeatedly transmit the accounting-related data.
Fig. 4 is a schematic diagram illustrating a component structure of a data accounting processing system, where the data accounting processing system is used to implement the data accounting processing method in the embodiment of the present application. As shown in fig. 4, the processing system for accounting data includes a first device, a second device, and a third device, where the first device, the second device, and the third device are independent hardware devices, and different software applications run on the devices, respectively.
The first device is deployed with software applications for realizing different financial accounting service functions, can be realized as a server, a server cluster, a database server and the like, and can continuously send transaction data generated by the software applications to the second device. The second device is deployed with a software application for implementing a message service function, such as Kafka message middleware application, and receives the transaction data sent by the first device, stores the received transaction data in a message form, and performs corresponding pre-check on the stored transaction data, such as checking for consistency of file names, checking for state of accounting data, and the like. And after the second equipment performs pre-check on the transaction data, the transaction data meeting the non-repeated requirement is sent to the third equipment. The third equipment is deployed with software application for realizing the accounting function, receives the transaction data sent by the second equipment, performs accounting, and sends an accounting completion notification to the first equipment after accounting is completed, so that the first equipment is prevented from repeatedly sending the same transaction data.
In the embodiment of the application, through increase the preliminary examination subassembly in the message service subassembly, can carry out preliminary examination to the relevant data of accounting of the accounting that the message service subassembly received before carrying out the accounting processing, find out the relevant data of accounting of business subassembly resending through preliminary examination to abandon the relevant data of accounting of resending, thereby can avoid the repeated accounting of the relevant data of accounting, reduce in the whole accounting system because of the repeated accounting arouses the possibility of reporting to the police.
Embodiments of the mechanisms disclosed herein may be implemented in hardware, software, firmware, or a combination of these implementations. Embodiments of the application may be implemented as computer programs or program code executing on programmable systems comprising at least one processor, a storage system (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device.
Program code may be applied to input instructions to perform the functions described herein and generate output information. The output information may be applied to one or more output devices in a known manner. For purposes of this Application, a processing system includes any system having a Processor such as, for example, a Digital Signal Processor (DSP), a microcontroller, an Application Specific Integrated Circuit (ASIC), or a microprocessor.
The program code may be implemented in a high level procedural or object oriented programming language to communicate with a processing system. The program code can also be implemented in assembly or machine language, if desired. Indeed, the mechanisms described in this application are not limited in scope to any particular programming language. In any case, the language may be a compiled or interpreted language.
In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried by or stored on one or more transitory or non-transitory machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed via a network or via other computer readable media. Thus, a machine-readable medium may include any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer), including, but not limited to, floppy diskettes, optical disks, Read-Only memories (CD-ROMs), magneto-optical disks, Read-Only memories (ROMs), Random Access Memories (RAMs), Erasable Programmable Read-Only memories (EPROMs), Electrically Erasable Programmable Read-Only memories (EEPROMs), magnetic or optical cards, flash Memory, or tangible machine-readable memories for transmitting information (e.g., carrier waves, infrared digital signals, etc.) using the Internet to transmit information in an electrical, optical, acoustical or other form of propagated signals. Thus, a machine-readable medium includes any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a form readable by a machine (e.g., a computer).
In the drawings, some features of the structures or methods may be shown in a particular arrangement and/or order. However, it is to be understood that such specific arrangement and/or ordering may not be required. Rather, in some embodiments, the features may be arranged in a manner and/or order different from that shown in the illustrative figures. In addition, the inclusion of a structural or methodical feature in a particular figure is not meant to imply that such feature is required in all embodiments, and in some embodiments, may not be included or may be combined with other features.
It should be noted that, in the embodiments of the apparatuses in the present application, each unit/module is a logical unit/module, and physically, one logical unit/module may be one physical unit/module, or may be a part of one physical unit/module, and may also be implemented by a combination of multiple physical units/modules, where the physical implementation manner of the logical unit/module itself is not the most important, and the combination of the functions implemented by the logical unit/module is the key to solve the technical problem provided by the present application. Furthermore, in order to highlight the innovative part of the present application, the above-mentioned device embodiments of the present application do not introduce units/modules which are not so closely related to solve the technical problems presented in the present application, which does not indicate that no other units/modules exist in the above-mentioned device embodiments.
It is noted that, in the examples and descriptions of this patent, relational terms such as first and second, and the like are 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 apparatus 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 apparatus. Without further limitation, the use of the verb "comprise a" to define an element does not exclude the presence of another, same element in a process, method, article, or apparatus that comprises the element.
While the present application has been shown and described with reference to certain preferred embodiments thereof, it will be understood by those of ordinary skill in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present application.