Supervision data reporting, electronic device, equipment and computer readable storage medium

文档序号:1641624 发布日期:2019-12-20 浏览:13次 中文

阅读说明:本技术 监管数据上报、电子装置、设备及计算机可读存储介质 (Supervision data reporting, electronic device, equipment and computer readable storage medium ) 是由 赵成龙 于 2019-08-30 设计创作,主要内容包括:本发明公开了监管数据上报方法,包括:基于与每一交易方的交易行为存储交易数据,并为每一个交易数据设定标志码;将多个交易数据确定为待发送数据,并判断待发送数据的大小是否大于第一预设值;如果是,对待发送数据包进行分包处理,得到多个子数据包,任意一个子数据包的大小均小于第二预设值;为多个子数据包中的每一个数据包分配一个解码标签;确定发送线程;基于所确定的线程发送所述子数据包、解码标签以及标志码。应用本发明实施例,通过限制每个数据包的大小,便于网络传输,分包后,再使用多线程上报数据,比之前单一线程大幅节约了时间,满足了监管的时效性要求。(The invention discloses a supervision data reporting method, which comprises the following steps: storing transaction data based on transaction behaviors with each transaction party, and setting a flag code for each transaction data; determining a plurality of transaction data as data to be sent, and judging whether the size of the data to be sent is larger than a first preset value; if so, performing packet processing on the data packet to be sent to obtain a plurality of sub data packets, wherein the size of any sub data packet is smaller than a second preset value; assigning a decoding label to each data packet in the plurality of sub-data packets; determining a sending thread; and sending the sub data packet, the decoding label and the mark code based on the determined thread. By applying the embodiment of the invention, the size of each data packet is limited, the network transmission is convenient, and after the data packets are subpackaged, the data is reported by using multiple threads, so that the time is greatly saved compared with the previous single thread, and the monitoring timeliness requirement is met.)

1. A supervision data reporting method is characterized by comprising the following steps:

storing transaction data based on transaction behaviors with each transaction party, and setting a flag code for each transaction data;

determining a plurality of transaction data as data to be sent, and judging whether the size of the data to be sent is larger than a first preset value;

if so, performing packet processing on the data packet to be sent to obtain a plurality of sub data packets, wherein the size of any sub data packet is smaller than a second preset value;

assigning a decoding tag to each of the plurality of subpackets;

determining a sending thread;

and sending the sub data packet, the decoding label and the mark code based on the determined thread.

2. The supervision data reporting method according to claim 1, wherein the step of performing packet processing on the data packet to be sent to obtain a plurality of subpackets comprises:

calculating a multiple value of the size of the data packet to be sent and the first preset value;

determining the number of data packets corresponding to the calculated multiple according to the relation between the preset multiple value and the data packet value;

dividing the data packets to be sent according to the determined number of the data packets;

judging whether the size of the divided sub data packet is not smaller than the second preset value or not;

if so, the sub-packet is divided again.

3. The supervision data reporting method of claim 2, wherein the step of determining a sending thread comprises:

determining a current idle thread according to the size of the sub data packet to be sent;

determining the number of sending threads based on the current idle threads.

4. The supervision data reporting method of claim 3, wherein the step of determining the number of sending threads based on the current idle threads comprises:

determining the number of current idle threads;

judging whether the number of the idle threads is not greater than the multiple value or not;

and if so, determining the current idle thread as a sending thread.

5. The method of reporting regulatory data of claim 4, wherein the method further comprises:

when the number of the idle threads is larger than the multiple value, determining an integer closest to the multiple;

determining the determined integer number of threads as sending threads.

6. The supervisory data reporting method of claim 1, wherein the step of sending the sub-packets, the decoding tags, and the flag codes based on the determined threads comprises:

the sub data packets are subjected to priority sequencing;

storing the sub data packets, the corresponding decoding labels and the corresponding mark codes into a data sending queue according to the priority;

and sequentially taking out and sending the data in the data sending queue through the determined thread.

7. An electronic device, the device comprising: a supervision data reporting end module;

wherein, the supervision data reporting end module comprises:

the setting module is used for storing transaction data based on the transaction behavior of each transaction party and setting a mark code for each transaction data;

the judging module is used for determining a plurality of transaction data as data to be sent and judging whether the size of the data to be sent is larger than a first preset value or not;

the sub-packaging module is used for sub-packaging the data packet to be sent to obtain a plurality of sub-data packets under the condition that the judgment result of the judgment module is yes, wherein the size of any one sub-data packet is smaller than a second preset value;

a decoding module, configured to assign a decoding tag to each of the plurality of subpackets;

a determining module for determining a sending thread;

and the sending module is used for sending the sub data packet based on the determined number of the threads.

8. An apparatus comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the supervision data reporting method according to any of claims 1 to 6 when executing the computer program.

9. A computer-readable storage medium having stored thereon a computer program, characterized in that: the computer program, when executed by a processor, implements the steps of the method for reporting supervision data according to any of claims 1 to 6.

Technical Field

The present invention relates to the field of supervisory data uploading technologies, and in particular, to a supervisory data reporting device, an electronic apparatus, a device, and a computer-readable storage medium.

Background

The amount of data acquired by financial institutions is increasing, and particularly, due to the need to maintain the order of financial markets, the financial institutions need to send the supervision data generated by corresponding transactions and the like to the supervision department for recording, especially for a large amount of high-frequency unstructured data.

Because there are many financial institutions, there are many financial institutions reporting the supervision data to the supervision department at the same time, and the existing supervision data reporting supervision institution reports the supervision data in a large amount of data, and if the amount of data is large, the report message corresponding to the supervision data is large, and if the network is unstable, the transmission of the supervision data is interrupted. Because the supervision department has higher timeliness for uploading the supervision data, once the terminal is generated by uploading the supervision data, the requirement of supervision timeliness is difficult to meet.

Therefore, it is an urgent technical problem to provide an effective method for reporting supervision data.

Disclosure of Invention

In view of the above, the present invention provides a supervision data reporting method, an electronic apparatus, a device, and a computer readable storage medium, which are used for solving the problem that the timeliness cannot be met in the supervision data uploading in the prior art.

Firstly, in order to achieve the above object, the present invention provides a method for reporting supervision data, wherein the method comprises the following steps:

storing transaction data based on transaction behaviors with each transaction party, and setting a flag code for each transaction data;

determining a plurality of transaction data as data to be sent, and judging whether the size of the data to be sent is larger than a first preset value;

if so, performing packet processing on the data packet to be sent to obtain a plurality of sub data packets, wherein the size of any sub data packet is smaller than a second preset value;

assigning a decoding tag to each of the plurality of subpackets;

determining a sending thread;

and sending the sub data packet, the decoding label and the mark code based on the determined thread.

Further, the step of performing packet processing on the data packet to be sent to obtain a plurality of sub data packets includes:

calculating a multiple value of the size of the data packet to be sent and the first preset value;

determining the number of data packets corresponding to the calculated multiple according to the relation between the preset multiple value and the data packet value;

dividing the data packets to be sent according to the determined number of the data packets;

judging whether the size of the divided sub data packet is not smaller than the second preset value or not;

if so, the sub-packet is divided again.

Further, the step of determining a sending thread includes:

determining a current idle thread according to the size of the sub data packet to be sent;

determining the number of sending threads based on the current idle threads.

Further, determining the number of sending threads based on the current idle threads; the method comprises the following steps:

determining the number of current idle threads;

judging whether the number of the idle threads is not greater than the multiple value or not;

if yes, determining the number of sending threads based on the current idle threads.

Further, the step of determining the number of sending threads based on the current idle thread includes:

the number of the idle threads is larger than the multiple value;

determining an integer closest to the multiple;

determining the determined integer number of threads as sending threads.

Further, the step of sending the sub-data packet, the decoding tag and the flag code based on the determined thread includes:

the sub data packets are subjected to priority sequencing;

storing the sub data packets, the corresponding decoding labels and the corresponding mark codes into a data sending queue according to the priority;

and sequentially taking out and sending the data in the data sending queue through the determined thread.

Further, to achieve the above object, the present invention also provides an electronic apparatus, comprising: a supervision data reporting end module;

wherein, the supervision data reporting end module comprises:

the setting module is used for storing transaction data based on the transaction behavior of each transaction party and setting a mark code for each transaction data;

the judging module is used for determining a plurality of transaction data as data to be sent and judging whether the size of the data to be sent is larger than a first preset value or not;

the sub-packaging module is used for sub-packaging the data packet to be sent to obtain a plurality of sub-data packets under the condition that the judgment result of the judgment module is yes, wherein the size of any one sub-data packet is smaller than a second preset value;

a decoding module, configured to assign a decoding tag to each of the plurality of subpackets;

a determining module for determining a sending thread;

and the sending module is used for sending the sub data packet based on the determined number of the threads.

Further, the packetization module includes:

the calculation submodule is used for calculating a multiple value of the size of the data packet to be sent and the first preset value;

the first determining submodule is used for determining the number of the data packets corresponding to the calculated multiple according to the relation between the preset multiple value and the data packet value;

the first dividing module is used for dividing the data packets to be sent according to the determined number of the data packets;

the judgment submodule is used for judging whether the size of the divided sub-data packet is not smaller than the second preset value or not;

and the dividing submodule is used for dividing the sub-data packet again under the condition that the judgment result of the judging submodule is yes.

Further, the determining module is specifically configured to: and determining a sending thread according to the size of the data to be sent.

Further, the determining module includes:

the second determining submodule is used for determining the current idle thread;

and the third determining submodule is used for determining the number of the sending threads based on the current idle threads.

Further, the second determination submodule includes:

the first determining unit is used for determining the number of the current idle threads;

the judging unit is used for judging whether the number of the idle threads is not greater than the multiple value or not;

and the second determining unit is used for determining the current idle thread as a sending thread under the condition that the judgment result of the judging unit is yes.

Further, the determining module further includes:

a third determining unit, configured to determine, when the number of idle threads is greater than the multiple value, an integer closest to the multiple;

a fourth determining unit configured to determine the determined integer number of threads as the sending thread.

Further, the sending module further includes:

the sequencing submodule is used for carrying out priority sequencing on the sub data packets;

the first sending submodule is used for storing the sub data packet, the corresponding decoding label and the corresponding mark code into a data sending queue according to the priority;

and the second sending submodule is used for sequentially taking out and sending the data in the data sending queue through the determined thread.

In addition, in order to achieve the above object, the present invention further provides a device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements any step of the supervision data reporting method when executing the computer program.

In addition, to achieve the above object, the present invention further provides a computer readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of any one of the supervision data reporting methods.

Compared with the prior art, the supervision data reporting method, the supervision data reporting device, the supervision data reporting equipment and the computer readable storage medium provided by the invention have the advantages that after the transaction data are acquired and stored by the transaction behavior of each transaction party, the flag code is set for each transaction data, then a plurality of transaction data are determined as data to be sent, and in the case that the size of the data to be sent is judged to be larger than a first preset value, the data packets to be sent are required to be subjected to sub-packet processing to obtain a plurality of sub-packets after sub-packet, the size of each sub-packet is smaller than a second preset value, and a decoding label is allocated to each data packet; and then sending the sub data packet, the decoding label and the mark code through the determined sending thread. The data packets to be sent are subjected to sub-packet processing, so that the sizes of the sub-data packets are smaller than the second preset value, the small data packets can still be normally transmitted under the condition of poor transmission rate, the problem that transmission failure is caused under the condition of poor network transmission conditions by directly sending supervision data in the prior art is avoided, the problem that supervision data uploading cannot meet timeliness in the prior art is solved, therefore, time is greatly saved compared with the prior single thread, the supervision timeliness requirement is met, corresponding sub-data packets can be quickly found and decoded when the supervision data is received by distributing decoding labels for the sub-data packets, each transaction data can be confirmed through a mark code after decoding, and data loss is avoided.

Drawings

Fig. 1 is a schematic flowchart of a supervision data reporting method according to a first embodiment of the present invention;

fig. 2 is a flowchart illustrating a supervision data reporting method according to a second embodiment of the present invention;

fig. 3 is a flowchart illustrating a method for reporting supervision data according to a third embodiment of the present invention;

fig. 4 is a schematic flowchart of a supervision data reporting method according to a fourth embodiment of the present invention;

FIG. 5 is a diagram of an alternative application environment of the electronic device according to the embodiment of the invention;

FIG. 6 is a diagram of a hardware architecture of an electronic device according to a first embodiment of the invention;

FIG. 7 is a block diagram of a first embodiment of an electronic device;

FIG. 8 is a block diagram of a second embodiment of an electronic device according to the present invention.

FIG. 9 is a schematic diagram of a program module of an electronic device according to a third embodiment of the invention;

FIG. 10 is a schematic diagram of a program module of an electronic device according to a fourth embodiment of the invention;

fig. 11 is a schematic diagram of a program module of an electronic device according to a fifth embodiment of the invention.

Reference numerals:

the implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.

Detailed Description

In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

It should be noted that the description relating to "first", "second", etc. in the present invention is for descriptive purposes only and is not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present invention.

It should be noted that, in the embodiment of the present invention, an execution main body of the supervision data reporting method may be a supervision data reporting end module, or other terminals or devices including the processor of the supervision data reporting method, and other devices including the supervision data reporting end module.

In order to solve the problem in the prior art, as shown in fig. 1, an embodiment of the present invention provides a method for reporting supervision data, including the following steps:

s101, transaction data are stored based on transaction behaviors of each transaction party, and a mark code is set for each transaction data.

It should be noted that, taking a transaction platform as an example, when the transaction platform generates transactions, each transaction generates data information with the payment mechanism, and then the information of each participant is generated for the payment mechanism for the transaction, so that there is transaction data for the sequential transactions generated for one transaction party.

For each transaction, there is generally a transaction number, such as an order number, which is a unique mark and may be used as a mark code, or a new number is additionally set for each transaction as a mark code, and each mark code is non-repeating, so that each transaction can be identified conveniently.

The identifier may also be a payment transaction number for the transaction, for example, a payment transaction number formed by a third party or a transaction platform at the time of payment.

It should be noted that the mark code may also be generated by other manners, as long as it is a unique designated mark generated for each transaction, and the embodiment of the present invention is not limited in detail herein.

S102, determining a plurality of transaction data as data to be sent, and judging whether the size of the data to be sent is larger than a first preset value; if so, step 103 is performed.

It will be appreciated that transaction data is increasing and that multiple transaction data may be presented at the same time and then processed against the transaction data.

In one implementation of the present invention, the generated transaction data is used as data to be sent in a time period for the transaction data of each type of article.

In another embodiment of the invention, a shorter time range is set in which all transaction information is used as data to be sent.

It will be appreciated that when a transaction is generated, the transaction platform will communicate with the financial institution to share data related to the transaction, including but not limited to: product specific information, transaction link, transaction amount detail, order time and information of the payment and receipt party. Therefore, the supervision data reporting end corresponding to the embodiment of the invention obtains and stores the transaction after each transaction. Taking the existing credit card as an example, after the user consumes on the platform, the bank obtains the transaction data of the consumption and records the transaction data in the bill.

It should be noted that the data generated by the financial institution is sent to the supervising entity periodically, and the specific sending time may be set periodically or according to the size of the generated data. Therefore, in the embodiment of the present invention, the data to be sent may be determined according to a preset data sending period or a generated data size, and data generated by the target folder.

In one specific implementation, a target area is set, data generated for the financial institution is stored in the target area, and then the data newly generated in the target area is determined as data to be transmitted.

In another specific implementation manner, data generated in a fixed time unit is determined as data to be transmitted, for example, data generated in 1s is determined as data to be transmitted in 1 s.

As can be understood by those skilled in the art, in the embodiment of the present invention, a comparison object regarding the size of the data to be sent, that is, a first preset value, is preset, the data to be sent is compared with the first preset value, and step S302 is executed when the data to be sent is greater than the first preset value, otherwise, the data packet is directly sent. Illustratively, if the first preset value is 500M and the data to be transmitted is 600M, step S302 needs to be executed, and if the data to be transmitted is 450M, the data packet to be transmitted is directly transmitted.

It can be understood that, by comparing the data to be sent with the first preset value, it can be determined whether the data to be sent is too large, so as to avoid the problem of data sending failure caused by direct sending.

S103, performing packet processing on the data packet to be sent to obtain a plurality of sub data packets, wherein the size of any sub data packet is smaller than a second preset value.

It should be noted that the first preset value is a threshold value representing network transmission capability. It can be understood that, when the data to be sent is smaller than the first preset value, the data can be subjected to the packetization processing, or can be directly sent without the packetization processing, so that when the data to be sent is not larger than the comparison object, the packetization processing can be not carried out, the effective transmission can be realized, the time for the packetization processing can be saved, and the balance between the packetization processing and the direct transmission can be achieved.

The second preset value is a sub-packet threshold value which is set when the size of each sub-packet is limited so as to facilitate the rapid transmission of the network and is also set according to the transmission capability of the network and the transmission efficiency of the data.

Therefore, the data transmission method is set for different data transmission networks and different transmission efficiency requirements (for example, when data needs to be obtained timely, the data needs to be divided into smaller data packets so as to achieve the purpose of faster transmission and reduction of transmission time). The second preset value and the first preset value in the embodiment of the present invention may be equal or unequal.

For example, the first preset value is equal to the second preset value, which are both 500M, and the data to be sent is 600M, so that the sub-packets of the data packet to be sent need to be divided, specifically, the divided sub-packets are limited by the second preset value, and each divided sub-packet cannot be greater than the second preset value, that is, not greater than 500M.

Then, a 600M data packet to be sent may be divided into 2 data packets to be sent, for example, the data packet to be sent is divided into 2 data packets, one is 400M, and the other is 200M; or one is 300M and one is 300M; or one 250M and one 350M; or one 150M and one 450M. For example, the data is divided into 3 data packets, one is 200M, and one is 200M; or one is 300M, one is 200M, one is 100M; or one 250M, one 150M, one 200M; or one is 250M, and one is 100M, and may also be divided into 3 data packets, 4 data packets, 10 data packets, and the like, which is not specifically limited herein in the embodiments of the present invention.

In another embodiment of the present invention, the first preset value is not equal to the second preset value, and it is assumed that the first preset value is 500M, and the second preset value may be 400M, 450M, or 300M, and so on.

S104, allocating a decoding label to each data packet in the plurality of sub data packets.

It should be noted that all the sub-packets form a complete whole of the data to be transmitted, so in order to facilitate the data to be transmitted to form a whole for storage at the receiving end, a decoding tag is assigned to each sub-packet. It is understood that data is required to be encoded and compressed before being transmitted, for example, by using compressed packets, each sub-packet may be a sub-compressed packet, and all sub-compressed packets are put together and decompressed to form a complete data packet. Therefore, after the corresponding decoding labels are distributed, the corresponding sub-data packets are convenient to find, and the decoding efficiency is improved.

S105, determining a sending thread.

It is understood that a thread is also called a Lightweight Process (LWP), which is the smallest unit of a program execution flow. A thread is an entity in a process and is the basic unit that is independently scheduled and dispatched by the system.

In an embodiment of the present invention, determining the sending thread may determine the sending thread according to the size of the data to be sent. It can be understood that if the data to be sent is large, more threads are needed to send the sub-packets, and therefore, the number of sending threads can be determined according to the size of the data packet to be sent in the embodiment of the present invention.

In another implementation manner of the present invention, the method may further include: determining a current idle thread; determining the number of sending threads based on the current idle threads. The idle line may be a line which is not currently in an operating state, or may be a line whose load is lower than a threshold value. Specifically, the load threshold of the line may obtain a transmission data amount of each of the plurality of timing units, obtain a total data transmission amount of the plurality of timing units, and determine that the line is an idle thread if the total data transmission amount is lower than a total data transmission amount value.

And S106, sending the sub data packet, the decoding label and the mark code based on the determined thread.

It can be understood that the thread is a relatively independent and schedulable execution unit, and the execution unit directly sends the sub-packets to implement the data sending process.

It should be noted that, the decoding tag corresponding to each sub-packet is communicated with the flag code corresponding to each transaction data, so that the receiving end can perform fast decoding through the decoding tag and the sub-packet to obtain the corresponding data packet, and then check each transaction data in the data packet through the flag code to determine whether a data error or loss occurs, thereby improving the accuracy of data transmission.

It is understood that the general data transmission environment is: the number of threads is multiple, the number of sub packets is multiple, and the sub packets can be sequentially transmitted according to the generation time of the sub packets, for example, the number of threads is thread a, thread B, and thread C3, the transmission capacity is the same, the number of sub packets is 10, and the sub packets are sequentially transmitted according to the generation time of the sub packets through thread a, thread B, and thread C3.

If the transmission capacities of the threads are different, the threads can be distributed, the threads with strong transmission capacities transmit larger sub data packets, and otherwise, the threads transmit smaller sub data packets; or the thread with strong transmission capability transmits more sub-data packets, otherwise, the thread with strong transmission capability transmits less sub-data packets.

Compared with the prior art, the supervision data reporting method provided by the invention sets a mark code for each transaction data after acquiring the transaction data stored with the transaction behavior of each transaction party, then determines a plurality of transaction data as data to be sent, and needs to perform sub-packet processing on the data packet to be sent under the condition that the size of the data to be sent is judged to be larger than a first preset value, so as to obtain a plurality of sub-packets after sub-packet processing, wherein the size of each sub-packet is smaller than a second preset value, and a decoding label is allocated to each data packet; and then sending the sub data packet, the decoding label and the mark code through the determined sending thread. The data packets to be sent are subjected to sub-packet processing, so that the sizes of the sub-data packets are smaller than the second preset value, the small data packets can still be normally transmitted under the condition of poor transmission rate, the problem that transmission failure is caused under the condition of poor network transmission conditions by directly sending supervision data in the prior art is avoided, and the problem that supervision data uploading cannot meet timeliness in the prior art is solved.

As shown in fig. 2, the step of performing packet processing on the data packet to be sent to obtain a plurality of sub data packets includes:

s201, calculating a multiple value of the size of the data packet to be sent and the first preset value.

If the data packet to be transmitted is 600M and the first preset value is 500M, the ratio of the data packet to be transmitted to the first preset value is 1.2.

S202, determining the number of the data packets corresponding to the calculated multiple according to the preset relationship between the multiple value and the data packet value.

The preset relation table of the multiple value and the data packet value in the embodiment of the invention is that each data packet value has a corresponding relation with the multiple value, the corresponding relation can be set to be various choices, each choice corresponds to a network condition, and different corresponding relations can be selected under different network conditions.

In an implementation manner of the present invention, the number of the data packets is set to be not less than the certificate corresponding to the multiple value, for example, the multiple value is 1.2, and the corresponding data packets are set to be not less than: the multiple value corresponds to a predetermined integer multiple of the minimum integer, for example, the predetermined integer is 2, then the minimum integer corresponding to 1.2 is 2, then the single digit of the data packet is not less than: 2 x 2-4.

In another implementation manner of the present invention, the setting is performed according to the bandwidth of the data transmission local area network, and the ethernet bandwidth may be divided into: the 10Mbps ethernet, 100Mbps ethernet, 1Gbps ethernet, 10Gbps ethernet, 100Gbps ethernet, when the transmission capacity is stronger as the bandwidth is wider, and the bandwidth can be set to be greater than 100Mbps ethernet, it is sufficient to set the number of data packets to be the same as the integer corresponding to the multiplier value (the integer is the smallest integer not less than the multiplier value), for example, if the calculated multiplier value is 2.1, the number of data packets is 3.

S203, dividing the data packets to be sent according to the determined number of the data packets.

Dividing the data packets to be sent according to the determined data packets, for example, the data packets to be sent are 600M, the first preset value is 500M, the ratio of the data packets to be sent to the first preset value is 1.2, and the corresponding data packets are 3 to 5, so that the number of the data packets can be 3, 4, or 5, and thus the divided sub data packets can be 3, 4, or 5.

It should be understood that the size of each sub-packet may be evenly distributed or unevenly distributed as long as the size of each sub-packet does not exceed the second preset value, and the embodiment of the present invention is not particularly limited.

S204, judging whether the size of the divided sub-data packet is not smaller than a second preset value or not; if so, S205 is performed.

Specifically, the size of each sub-packet may be the same or different, and if the size of each sub-packet is not equal, it must be ensured that the size of each sub-packet cannot exceed the second preset value, otherwise, the step of continuing the partitioning step of step S205 is performed.

S205, the sub-packets are divided again.

As shown in fig. 3, in another implementation manner of the present invention, the step of determining the number of sending threads based on the current idle thread includes:

s301, determining the number of the current idle threads.

The determination of the number of idle threads in the embodiment of the present invention may be the same as the above process of determining the current idle thread, and is not described herein again in the embodiment of the present invention.

S302, judging whether the number of the idle threads is not more than the multiple value or not; if so, step S303 is performed.

The embodiment of the invention provides a scheme which is the most thread resource saving scheme by corresponding one thread to one sub data packet in order to save data threads when the current data transmission is tense.

S303, determining the current idle thread as a sending thread.

In the embodiment of the invention, if the number of the current idle threads is not more than a multiple value, all the idle threads are used for data transmission, otherwise, when the number of the idle threads is more than the multiple value, an integer which is closest to the multiple is determined; determining the determined integer number of threads as sending threads.

In an embodiment of the present invention, as shown in fig. 4, a specific implementation manner for sending the sub data packet, the decoding tag, and the flag code based on the determined thread is provided, which includes the steps of:

s401, the sub data packets are subjected to priority sequencing.

It can be understood that the setting of the priority may be an artificial setting, or may be a setting of a certain rule so that the supervisory data reporting end automatically generates the priority of the sub-packet.

In one implementation, the automatic generation of the priority may be set to be high when the self-packet is shopping data containing VIP users.

In another implementation manner, if a packet loss occurs in a previously transmitted data packet, priority transmission may be performed when the data packet is transmitted again, so that a sub-packet with a high transmission priority may be manually set.

S402, storing the sub-data packet, the corresponding decoding label and the corresponding mark code into a data sending queue according to the priority.

Each sub-packet and its corresponding decoding tag and flag are transmitted simultaneously, so that they need to be put into the data transmission queue at the same time. The data transmission queue is a first-in first-out (FIFO) memory and is used for caching data to be sent.

And S403, sequentially taking out and sending the data in the data sending queue through the determined thread.

Specifically, the idle thread may take corresponding data from the data sending queue one by one, and then send the data, where the state of the thread changes from idle to busy, and after the sending is finished, the state of the thread changes from busy to idle, and queue again to take the data in the data sending queue, so as to implement sending the data one by one.

Therefore, by applying the embodiment shown in fig. 4 of the present invention, the priority setting of the sub-packets can ensure that the data packets with high priority are preferentially sent, thereby improving the sending efficiency of the data to be sent.

Referring to fig. 5 and 6, an alternative application environment of the electronic device 50 of the present invention is shown.

In this embodiment, the electronic device 50 may communicate with the supervisory data reporting terminal module 10 and the data receiving terminal 40 in a wired or wireless manner. In the electronic device 50, the data of the supervision data reporting end module 10 is sent to the data receiving end 40 through the network interface 53, and the data information can also be sent to the display interface of the data receiving end 40 through the network interface 53, so that the transmission of the data after the supervision data is reported is realized.

Fig. 5 is a schematic diagram of an alternative hardware architecture of the electronic device 50 according to the present invention. Electronic device 50 includes, but is not limited to, a memory 51, a processor 52, and a network interface 53 communicatively coupled to each other via a system bus, and FIG. 5 illustrates only electronic device 50 having components 51-53, although it is to be understood that not all of the illustrated components are required and that more or fewer components may alternatively be implemented.

The memory 51 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the storage 51 may be an internal storage unit of the electronic device 50, such as a hard disk or a memory of the electronic device 50. In other embodiments, the memory may also be an external storage device of the electronic apparatus 50, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like, provided on the electronic apparatus 50. Of course, the memory 51 may also include both an internal storage unit and an external storage device of the electronic apparatus 50. In this embodiment, the memory 51 is generally used for storing an operating system and various application software installed in the electronic device 50, such as program codes of the supervisory data reporting terminal module 10. Further, the memory 51 may also be used to temporarily store various types of data that have been output or are to be output.

The processor 52 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 52 is generally used to control the overall operation of the electronic device 50. In this embodiment, the processor 52 is configured to run the program code stored in the memory 51 or process data, for example, run the supervision data reporting end module 10.

The network interface 53 may include a wireless network interface or a wired network interface, and the network interface 53 is generally used for establishing a communication connection between the electronic apparatus 50 and other electronic devices.

The hardware structure and functions of the related devices of the present invention have been described in detail so far. Various embodiments of the present invention will be presented based on the above description.

First, the present invention provides an electronic device 50.

Fig. 5 is a schematic diagram showing program modules of an electronic device 50 according to a first embodiment of the invention.

In this embodiment, the electronic device 50 includes a series of computer program instructions stored in the memory 51, and when the computer program instructions are executed by the processor 52, the supervision data reporting operation according to the embodiments of the present invention can be implemented. In some embodiments, electronic device 50 may be divided into one or more modules based on the particular operations implemented by the portions of the computer program instructions. For example, in fig. 7, the supervision data reporting side module 10 in the electronic device may be divided into: a setting module 501, a judging module 502, a sub-packaging module 503, an allocating module 504, a determining module 505 and a sending module 506. Wherein:

a setting module 501, configured to store transaction data based on a transaction behavior with each transaction party, and set a flag code for each transaction data;

a determining module 502, configured to determine data to be sent, and determine whether the size of the data to be sent is greater than a first preset value;

a sub-packet module 503, configured to perform sub-packet processing on the data packet to be sent to obtain multiple sub-packets, where a determination result of the determination module is yes, and a size of any sub-packet is smaller than a second preset value;

an assigning module 504, configured to assign a decoding tag to each of the plurality of subpackets;

a determining module 505, configured to determine a sending thread;

a sending module 506, configured to send the sub data packet based on the determined number of threads.

Further, as shown in fig. 8, the packetizing module 503 includes:

a calculating submodule 601, configured to calculate a multiple value between the size of the data packet to be sent and the first preset value;

a first determining submodule 602, configured to determine, according to a relationship between a preset multiple value and a data packet value, the number of data packets corresponding to the calculated multiple;

a first dividing module 603, configured to divide the data packets to be sent according to the determined number of the data packets;

a judging submodule 604, configured to judge whether the size of the divided sub data packet is not smaller than a second preset value;

the second partitioning sub-module 605 is configured to, if the determination result of the determining sub-module is yes, partition the sub-packet again.

Further, the determining module 505 is specifically configured to: and determining a sending thread according to the size of the data to be sent.

Further, as shown in fig. 9, the determining module 505 includes:

a second determining submodule 701, configured to determine a current idle thread;

a third determining submodule 702, configured to determine the number of sending threads based on the current idle thread.

Further, as shown in fig. 10, the third determining sub-module 702 includes:

a first determining unit 801, configured to determine the number of idle threads currently;

a determining unit 802, configured to determine whether the number of idle threads is not greater than the multiplier;

a second determining unit 803, configured to determine the currently idle thread as a sending thread if the determination result of the determining unit is yes.

Further, as shown in fig. 11, the determining module 505 further includes:

a fourth determining submodule 901, configured to determine, when the number of idle threads is greater than the multiple value, an integer closest to the multiple;

a fifth determining submodule 902 configured to determine the determined integer number of threads as sending threads.

Further, the sending module 506 further includes:

the sequencing submodule is used for carrying out priority sequencing on the sub data packets;

the first sending submodule is used for storing the sub data packet, the corresponding decoding label and the corresponding mark code into a data sending queue according to the priority;

and the second sending submodule is used for sequentially taking out and sending the data in the data sending queue through the determined thread.

Compared with the prior art, in the electronic device provided by the embodiment of the invention, after the transaction data stored with the transaction behavior of each transaction party is acquired, the flag code is set for each transaction data, then the transaction data are determined to be data to be sent, and in the case that the size of the data to be sent is judged to be larger than a first preset value, the data packet to be sent needs to be subjected to sub-packet processing to obtain a plurality of sub-packets after sub-packet processing, the size of each sub-packet is smaller than a second preset value, and a decoding label is allocated to each data packet; and then sending the sub data packet, the decoding tag and the mark through the determined sending thread. The data packets to be sent are subjected to sub-packet processing, so that the sizes of the sub-data packets are smaller than the second preset value, the small data packets can still be normally transmitted under the condition of poor transmission rate, the problem that transmission failure is caused under the condition of poor network transmission conditions by directly sending supervision data in the prior art is avoided, and the problem that supervision data uploading cannot meet timeliness in the prior art is solved.

The present invention also provides a computer device, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server or a rack server (including an independent server or a server cluster composed of a plurality of servers) capable of executing programs, and the like. The computer device of the embodiment at least includes but is not limited to: memory, processor, etc. communicatively coupled to each other via a system bus.

The present embodiment also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App application mall, etc., on which a computer program is stored, which when executed by a processor implements corresponding functions. The computer-readable storage medium of this embodiment is used for storing the electronic device 20, and when being executed by the processor, the computer-readable storage medium implements the method for reporting supervision data according to the present invention.

The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.

Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.

The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

20页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:两时域分量等功率加权变换实现信号时频域能量平均化的方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!