CN109242682B - Currency exchange rate conversion method, currency exchange rate conversion device, computer equipment and storage medium - Google Patents

Currency exchange rate conversion method, currency exchange rate conversion device, computer equipment and storage medium Download PDF

Info

Publication number
CN109242682B
CN109242682B CN201810965512.XA CN201810965512A CN109242682B CN 109242682 B CN109242682 B CN 109242682B CN 201810965512 A CN201810965512 A CN 201810965512A CN 109242682 B CN109242682 B CN 109242682B
Authority
CN
China
Prior art keywords
time
data
pieces
field
time interval
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810965512.XA
Other languages
Chinese (zh)
Other versions
CN109242682A (en
Inventor
刘骏锐
曾德志
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN201810965512.XA priority Critical patent/CN109242682B/en
Publication of CN109242682A publication Critical patent/CN109242682A/en
Application granted granted Critical
Publication of CN109242682B publication Critical patent/CN109242682B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Engineering & Computer Science (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the application provides a currency exchange rate conversion method, a currency exchange rate conversion device, computer equipment and a storage medium. The method comprises the following steps: according to the embodiment of the application, the regular time corresponding to the data in the collection rate table is analyzed and counted; modifying a time interval field in the sink table into a time field; if a conversion instruction is received, converting the conversion time included in the conversion instruction into a matching time matched with the value of the time field according to the regular time; searching the exchange rate in the exchange rate table according to the matching time; and calculating the target amount data according to the exchange rate. According to the embodiment of the application, the exchange rate is searched according to the matching time without non-equivalent judgment, so that the efficiency of inquiring the exchange rate and the efficiency of converting currency in the Hive data warehouse are improved, and the experience of a user is improved.

Description

Currency exchange rate conversion method, currency exchange rate conversion device, computer equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a currency exchange rate conversion method, a currency exchange rate conversion device, a computer device, and a storage medium.
Background
And saving the exchange rate between different currencies in an exchange rate table. Such as the original currency type, the target currency type, the time interval, the exchange rate (the exchange rate between the original currency type and the target currency type in the time interval), and the like, are stored in the exchange rate table. One piece of data stored in the exchange rate table is: harbor note, renmins, 2018.5-2018.6,0.8234, means that the exchange rate between harbor note and renmins is 0.8234 during 2018.5 months to 2018.6 months. When the exchange rate of the 2018.5 month harbor coin and the rmb is to be queried, it is required to determine whether the time= 2018.5 is within a certain section in the exchange rate table, if so, it is required to determine each time section in the exchange rate table, for example, it is determined that 2018.5< = time < = 2018.6, and thus, it is related to the determination of the non-equal value (greater than, less than, etc.) in the data table. The exchange rate table is stored in the oracle database in the past, and obvious problems do not occur when the non-equivalent judgment is carried out in the oracle database. But today in large data environments data warehouses are used, such as Hive data warehouse tools. Under the Hive data warehouse tool, if a plurality of pieces of data need to be queried for exchange rate, namely, when the plurality of pieces of data need to be subjected to non-equivalent judgment, the performance is very poor, a large amount of system resources need to be occupied, and the query efficiency and the conversion target currency efficiency are greatly reduced.
Disclosure of Invention
The embodiment of the application provides a currency exchange rate conversion method, a currency exchange rate conversion device, computer equipment and a storage medium, which can improve the efficiency of exchange rate inquiry and currency exchange rate conversion.
In a first aspect, embodiments of the present application provide a currency exchange rate conversion method, including:
acquiring a plurality of pieces of data in a sink rate table, and analyzing and counting time interval fields in the plurality of pieces of data to obtain regular time of the plurality of pieces of data; acquiring a first time in a time interval field corresponding to each piece of data in the exchange rate table; modifying the time interval field into a time field, and taking the first time in each piece of data as the value of the time field in the piece of data; if a conversion instruction is received, obtaining data to be converted, wherein the data to be converted comprises original amount data, an original currency type corresponding to the original amount data, a target currency type and conversion time; converting the conversion time into a matching time matched with the first time according to the regular time; inquiring in the exchange rate table according to the matching time, the original currency type and the target currency type to obtain an exchange rate value corresponding to the original currency type relative to the target currency type under the matching time; and according to the sink value, converting and calculating the original amount data to obtain target amount data.
In a second aspect, embodiments of the present application provide a currency exchange rate conversion device, which includes a unit configured to perform a method according to the first aspect.
In a third aspect, embodiments of the present application provide a computer device including a memory, and a processor coupled to the memory;
the memory is configured to store a computer program, and the processor is configured to execute the computer program stored in the memory, so as to perform the method according to the first aspect.
In a fourth aspect, embodiments of the present application provide a storage medium storing a computer program, where the computer program is executed by a processor to implement the method of the first aspect.
According to the embodiment of the application, the regular time corresponding to the data in the collection rate table is analyzed and counted; modifying a time interval field in the sink table into a time field; if a conversion instruction is received, converting the conversion time included in the conversion instruction into a matching time matched with the value of the time field according to the regular time; searching the exchange rate in the exchange rate table according to the matching time; and calculating the target amount data according to the exchange rate. According to the embodiment of the invention, the exchange rate is searched according to the matching time without non-equivalent judgment, so that the exchange rate searching efficiency and the currency conversion efficiency are improved, and the user experience is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a currency exchange rate conversion method provided in an embodiment of the present application;
FIG. 2 is a schematic flow chart illustrating a method for converting currency exchange rates according to an embodiment of the present application;
FIG. 3 is a schematic flow chart illustrating a method for converting currency exchange rates according to an embodiment of the present application;
FIG. 4 is a schematic block diagram of a currency conversion machine according to an embodiment of the present application;
FIG. 5 is a schematic block diagram of an analysis statistics unit provided by an embodiment of the present application;
FIG. 6 is a schematic block diagram of an analysis statistics unit provided by another embodiment of the present application;
fig. 7 is a schematic block diagram of a computer device provided in an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
Fig. 1 is a flow chart of a currency exchange rate conversion method according to an embodiment of the present application. As shown in FIG. 1, the method includes S101-S107.
S101, acquiring a plurality of pieces of data in a sink rate table, and analyzing and counting time interval fields in the plurality of pieces of data to obtain regular time corresponding to the plurality of pieces of data.
The exchange rate table stores exchange rates between different currencies, such as the original currency type, the target currency type, the time interval, and the exchange rate between the original currency type and the target currency type. There is very much data in the sink table. The purpose of acquiring the plurality of data in the sink table is to obtain the rule in the time interval field corresponding to the plurality of data, that is, update the rule of the sink table, so that the plurality of data with different values in the corresponding time interval field needs to be acquired. Specifically, the acquiring the pieces of data in the sink table may be acquiring the pieces of data corresponding to the same original currency type and the same target currency type in the sink table. The acquired pieces of data may be all data in all data corresponding to the same original currency type and the same target currency type in the exchange rate table, or may be part of the data. In order to make the rule time obtained by the analysis statistics more accurate, if the partial data in all the data corresponding to the same original currency type and the same target currency type are acquired, the acquired partial data needs to reach a preset proportion, such as a preset proportion of 5%, of all the data in all the data corresponding to the same original currency type and the same target currency type. After a plurality of pieces of data are acquired, time interval fields in the plurality of pieces of data are analyzed and counted to obtain regular time corresponding to the plurality of pieces of data. It should be noted that the time interval field in the plurality of pieces of data has regular time, that is, the update of the sink table is regular, which is a precondition for solving the technical problem.
In one embodiment, as shown in FIG. 2, step S101 includes the following steps S201-S202.
S201, acquiring a plurality of pieces of data in a sink rate table, and inputting values of time interval fields in the plurality of pieces of data into a pre-trained analysis statistical model.
S202, according to the analysis statistical model, analyzing and counting time interval fields in the plurality of pieces of data to obtain regular time corresponding to the plurality of pieces of data.
The analysis statistical model can be any deep learning model. The deep learning model is trained with time data that has been set with a time law. Such as 2018.11.1-2018.11.30;2017.12.1-2017.12.31;2018.1.1-2018.1.31;2018.2.1-2018.2.28;2018.3.1-2018.3.31;2018.4.1-2018.4.30; .. the time law among the data is one month; such as 2017.11-2017.12;2017.12-2018.1;2018.1-2018.2;2018.2-2018.3; .. the time law between the data is one month; such as 2017.11.1-2017.11.7;2017.11.8-2017.11.14;2017.11.15-2017.11.21;2017.11.22-2017.11.28;2017.11.29-2017.12.3; .. the time law between these data is one week. This data is merely exemplary, and there are many more different training data in the actual training process. And then analyzing and counting the values of the time interval fields in the data by using the trained deep learning model to obtain the regular time corresponding to the time interval fields in the data, wherein the regular time is one month. The embodiment utilizes the analysis statistical model to obtain the regular time, so that the obtained regular time is more accurate.
In one embodiment, as shown in FIG. 3, step S101 includes the following steps S301-S303.
S301, acquiring a plurality of pieces of data in a sink rate table, subtracting the front time and the rear time in a time interval field in the plurality of pieces of data, and taking absolute values to obtain a plurality of absolute values. The absolute value comprises a value corresponding to the absolute value and a time unit corresponding to the absolute value.
S302, judging whether the absolute values are equal. It should be noted that it is necessary to determine whether or not the values corresponding to the absolute values are equal, and also whether or not the time units corresponding to the absolute values are equal. Ending if the absolute values are not equal; if the absolute values are equal, step S303 is performed.
And S303, taking the time corresponding to the absolute value as regular time. The regular time may include a value corresponding to the regular time and a time unit corresponding to the regular time.
The absolute value is determined to be equal or not, so as to determine whether the update in the sink table is regular or not. If the absolute values are equal, it means that the update of the exchange rate table is regular; if the absolute values are not equal, this means that the update of the exchange rate table is not regularly available. The update of the sink rate table is a precondition that the technical scheme of the application can solve the technical problem. In the embodiment, the absolute value is taken by subtracting the front time and the rear time so as to obtain the regular time, and the regular time is simpler and quicker.
In one embodiment, the step S301 includes: acquiring a first time and a second time in a time interval field corresponding to each piece of data in the plurality of pieces of data; and subtracting the first time and the second time corresponding to each piece of data in the plurality of pieces of data, and taking the absolute value to obtain a plurality of absolute values.
Values corresponding to the data time interval fields are 2017.11-2017.12 respectively; 2017.12-2018.1;2018.1-2018.2;2018.2-2018.3; .., etc. The first time (the previous time) in the time interval field is taken as the first time, and the second time (the next time) in the time interval field is taken as the second time, such as 2017.11-2017.12, the first time is 2017.11, and the second time is 2017.12 months. Subtracting the first time from the second time, and removing absolute values, namely |2017.12-2017.11|; 2018.1-2017.12; 2018.2-2018.1; 2018.3-2018.2; .. it is obtained that the absolute value corresponds to 1. And taking the smallest time unit in the first time and the second time in the time interval field, wherein the smallest time unit is used as the time unit corresponding to the absolute value, and if the time unit corresponding to the absolute value is month. It is understood that the sink table is updated once a month. In other embodiments, the latter time in the time interval field may also be referred to as the first time, and the former time may be referred to as the second time.
Values corresponding to the data time interval fields are 2018.1.1-2018.1.5 respectively; 2018.1.6-2018.1.10;2018.1.11-2018.1.15;2018.1.16-2018.1.20, then subtracting the first time and the second time of the time interval field, and taking the absolute value, i.e., |2018.1.5-2018.1.1|; 2018.1.10-2018.1.6; 2018.1.15-2018.1.11; and 2018.1.20-2018.1.16, 4 absolute values are obtained, and the values corresponding to the 4 absolute values are all 4. And acquiring the smallest time unit in the first time and the second time in the time interval field, and taking the smallest time unit as the time unit corresponding to the absolute value. The smallest unit of time of the two front and rear times in the time interval field is day/day. It is understood that the sink table is updated every 4 days/day, or every 5 days/day. The subtraction of the front and rear times in the "time interval" field can be implemented using a function.
In an embodiment, if the plurality of data are consecutive data, that is, the plurality of data are consecutive data in all data corresponding to the same original currency type and the same target currency type, the step S301 includes: acquiring the first time of a time interval field corresponding to the next data in the continuous multiple data and the first time of a time interval field corresponding to the adjacent previous data; subtracting the first time of the time interval field corresponding to the next piece of data from the first time of the time interval field corresponding to the adjacent previous piece of data, and taking the absolute value to obtain a plurality of absolute values.
Values corresponding to the data time interval fields are 2018.1.1-2018.1.5 respectively; 2018.1.6-2018.1.10;2018.1.11-2018.1.15;2018.1.16-2018.1.20, subtracting the first time of the time interval field corresponding to the next piece of data from the first time of the time interval field corresponding to the adjacent previous piece of data, and taking an absolute value, namely |2018.1.6-2018.1.1|; 2018.1.11-2018.1.6; 2018.1.16-2018.1.11; 3 absolute values are obtained, and the values corresponding to the 3 absolute values are all 5. The minimum time unit in the first time in the 'time interval' field is acquired, and the minimum time unit is taken as the time unit corresponding to the absolute value. The time unit corresponding to the first time is day/day, and the time unit corresponding to the absolute value is day/day, namely, the sink table is updated every 4 days/day, or the sink table is updated every 5 days/day. If the values corresponding to the continuous 4-row time interval fields in the sink rate table are respectively: 2018.1-2018.2;2018.2-2018.3;2018.3-2018.4;208.4-2018.5, then the first time of the "time interval" field corresponding to the next data in the continuous multiple data is subtracted from the first time of the "time interval" field corresponding to the previous data, and the absolute value is taken to be 1. And acquiring a month as a minimum time unit in the first time in the 'time interval' field, wherein the month is a time unit corresponding to the absolute value, namely updating the sink rate table once in one month.
S102, acquiring the first time in a time interval field corresponding to each piece of data in the exchange rate table.
If the previous time in the time interval field is the first time, the values corresponding to the time interval fields corresponding to the 4 pieces of data are respectively: 2018.1.1-2018.1.5;2018.1.6-2018.1.10;2018.1.11-2018.1.15;2018.1.16-2018.1.20, obtaining the first time of the value corresponding to the "time interval" field corresponding to each line of data in the sink rate table, if the obtained values are 2018.1.1 respectively; 2018.1.6;2018.1.11;2018.1.16. in other embodiments, the latter time in the time interval field may also be taken as the first time.
S103, modifying the time interval field into a time field, and taking the first time in each piece of data as the value of the time field in the piece of data.
The step specifically realizes the modification of the value in the sink rate table, specifically, the modification of the time interval field into the time field and the modification of the value of the time field in each piece of data into the first time in the piece of data. The modification mode can be specifically modified by calling a preset script, and if the data volume is small, the modification mode can also be modified manually. The preset script comprises an SQL script. Preferably, the modification is performed by executing a preset script, so that on one hand, errors are prevented, and on the other hand, the modification speed is increased.
In one embodiment, step S103 includes: if a modification instruction is received, calling a preset script, wherein the preset script is used for modifying a time interval field into a time field, and taking the first time in each piece of data as the value of the time field in the piece of data; and executing the preset script, specifically executing the preset script in a database where the exchange rate table is located. Wherein, the modification instruction refers to an instruction for modifying the sink table. The preset script comprises an SQL script, wherein the SQL script is preset and stored. The SQL script can be written by a user according to actual requirements, or can be automatically generated according to fields selected by the user, selected grammar and the like. The SQL script comprises a modification statement, a query statement and an assignment statement, wherein the modification statement corresponds to an alter table grammar, such as alter table rate rename column timeZones to time, rate is a sink table name, timeZones is a time zone field name, and time is a time field name. The first time in each piece of data is used as the value of the time field in the piece of data and is an assignment statement, and the assignment statement can be in the grammar of update. Specifically, if update rate set time = 2018.1.16where timeZones = 2018.1.16-2018.1.20, the 2018.1.16-2018.1.20 values in the rate table rate are changed to 2018.1.16.
The steps S101-S103 modify the exchange rate table to modify the time interval field in the exchange rate table into a time field, and take the first time in the original time interval field as the value corresponding to the time field. When inquiring, the data corresponding to the time interval fields in the exchange rate table do not need to be calculated in a non-equivalent way according to the inquiring time when inquiring the exchange rate corresponding to the inquiring time.
And S104, if a conversion instruction is received, obtaining data to be converted, wherein the data to be converted comprises original amount data, an original currency type corresponding to the original amount data, a target currency type and conversion time.
If a button operation such as "switch" is detected, a switch instruction is generated and received. And if a conversion instruction is received, obtaining the data to be converted. The data to be converted can be uploaded to the system in the form of a file, and correspondingly, the data to be converted is obtained by obtaining the data in the file. Corresponding data to be converted can also be input in the corresponding interface. The data to be converted can be multiple pieces or one piece. Each piece of data comprises original amount data, an original currency type corresponding to the original amount data, a target currency type to be converted and conversion time. The transition time is understood to be the specific time corresponding to the generation of the service.
S105, converting the conversion time into a matching time matched with the value of the time field according to the regular time.
And converting the conversion time into the matching time according to the values of the regular time and the time field. The converted matching time is a certain value corresponding to a time field which can be queried in the exchange rate table. According to the matching time, a piece of data corresponding to the matching time can be queried in the rate table, so that the inequality query is not involved in the query, but the inequality query is directly performed, and the query efficiency is improved.
Specifically, step S105 includes: acquiring a value of a time field in the sink table; and converting the conversion time into a matching time matched with the first time according to the acquired value of the time field and the regular time.
The value of the time field obtained may be a value corresponding to a recently updated time field in the exchange rate table, for example 2018.3. If the conversion time is 2018.1.20, the value of the obtained time field is 2018.3, the value corresponding to the regular time is 1, and the time unit corresponding to the regular time is month. Judging whether the time unit corresponding to the regular time is the same as the time unit corresponding to the conversion time; if the time units are different, converting the conversion time into the time with the same time unit corresponding to the regular time, if the time unit of the conversion time 2018.1.20 is day/day and the time unit corresponding to the regular time is month, converting the conversion time into the time with the same time unit corresponding to the regular time, namely converting 2018.1.20 into 2018.1; taking the conversion time after the time unit is converted as the matching time; if the time unit corresponding to the regular time is the same as the time unit corresponding to the conversion time, two times which are near the conversion time and are matched with the value of the obtained time field are found according to the regular time and the value of the obtained time field, if the conversion time is 2018.1.20 days, the value of the obtained time field is 2018.3.1, the value corresponding to the regular time is 6 (the regular time is obtained by subtracting the first time and the second time of the time interval field and taking the absolute value, and the current collection table is updated once every week), the time unit included in the regular time is day/day, and then two times which are near the conversion time and are matched with the value of the obtained time field are obtained according to the regular time and the value of the obtained time field, namely 2018.1.18 and 2018.1.25 respectively; judging whether the two matched times are the same as the conversion time or not; if the time is the same, taking one of the same time as the matching time; if the two time intervals are different, the time which is far from the current time interval in the two matched time intervals is taken as the matched time, namely the matched time is 2018.1.18 days. It will be appreciated that the matching time that matches the first time is the time that has been saved in the rate table, i.e., the result may be queried by querying the rate table according to the matching time.
S106, inquiring the exchange rate table according to the matching time, the original currency type and the target currency type to obtain an exchange rate value corresponding to the original currency type relative to the target currency type under the matching time.
The exchange rate value corresponding to the original currency type relative to the target currency type includes two cases: the exchange rate value of the original currency type relative to the target currency type, or the exchange rate value of the target currency type relative to the original currency type. The data stored in the sink table correspondingly includes both cases.
And S107, converting and calculating the original amount data according to the sink value to obtain target amount data.
If the exchange rate value of the original currency type relative to the target currency type obtained by inquiry is m, the original amount data is A, and then the target amount data is A/m. If the value of the pooling rate of the target currency type relative to the original currency type is n and the original amount data is B, the target amount data is b×n.
The steps S104-S107 query the exchange rate in the exchange rate table according to the data to be converted, and then convert the data to be converted according to the queried exchange rate to obtain the target amount data. The conversion time in the data to be converted is converted into the matching time, and the matching time is the time stored in the exchange rate table, so that when the exchange rate table is queried, the query can be performed according to the judgment of the equation. Therefore, the method avoids that the conversion time corresponding to the data to be converted and the data corresponding to the time interval fields in the sink table are subjected to non-equivalent calculation to query. The efficiency of exchange rate inquiry is greatly improved, the time for converting the target amount data is saved, and the efficiency for converting the target amount data is improved.
Fig. 4 is a schematic block diagram of a currency exchange rate conversion device provided in an embodiment of the present application. The apparatus includes means for performing the currency conversion method as described above. As shown in fig. 4, the apparatus 40 includes an analysis statistics unit 401, a time acquisition unit 402, a modification unit 403, a conversion data acquisition unit 404, a matching conversion unit 405, a query unit 406, and an amount conversion unit 407.
The analysis and statistics unit 401 is configured to obtain a plurality of pieces of data in the summary table, and analyze and count time interval fields in the plurality of pieces of data to obtain regular time corresponding to the plurality of pieces of data.
In an embodiment, as shown in fig. 5, the analysis statistics unit 401 includes an acquisition input unit 501, a first rule determining unit 502. The acquiring and inputting unit 501 is configured to acquire a plurality of pieces of data in the rate table, and input values of time interval fields in the plurality of pieces of data into a pre-trained analysis statistical model. The first rule determining unit 502 is configured to analyze and count time interval fields in the plurality of pieces of data according to the analysis statistical model to obtain a rule time corresponding to the plurality of pieces of data.
In an embodiment, as shown in fig. 6, the analysis statistics unit 401 includes an absolute value calculation unit 601, an equality judgment unit 602, and a second rule determination unit 603. The absolute value calculating unit 601 is configured to obtain a plurality of pieces of data in the sink rate table, subtract the front time and the rear time in the time interval field in the plurality of pieces of data, and take an absolute value to obtain a plurality of absolute values. And an equality judging unit 602, configured to judge whether the absolute values are equal. The second rule determining unit 603 is configured to take, as a rule time, a time corresponding to the absolute value if the absolute values are equal.
In one embodiment, the absolute value calculation unit 601 includes: the device comprises a first time interval acquisition unit and a first absolute value calculation unit. The first time acquisition unit is used for acquiring first time and second time in a time interval field corresponding to each piece of data in the plurality of pieces of data. And the first absolute value calculating unit is used for subtracting the first time and the second time corresponding to each piece of data in the plurality of pieces of data and taking the absolute value to obtain a plurality of absolute values.
In one embodiment, the absolute value calculation unit 601 includes: a second time acquisition unit and a second absolute value calculation unit. The second time acquiring unit is configured to acquire a first time of a time interval field corresponding to a next piece of data in the continuous multiple pieces of data and a first time of a time interval field corresponding to an adjacent previous piece of data. The second absolute value calculating unit is used for subtracting the first time of the time interval field corresponding to the next piece of data from the first time of the time interval field corresponding to the adjacent previous piece of data, and taking the absolute values to obtain a plurality of absolute values.
The time obtaining unit 402 is configured to obtain a first time in a time interval field corresponding to each piece of data in the exchange rate table.
A modifying unit 403, configured to modify the time interval field into a time field, and take the first time in each piece of data as the value of the time field in the piece of data.
In an embodiment, the modification unit 403 includes a script acquisition unit and a script execution unit. The script acquisition unit is used for calling a preset script if a modification instruction is received, wherein the preset script is used for modifying a time interval field into a time field, and the first time in each piece of data is used as the value of the time field in the piece of data. And the script execution unit is used for executing the preset script. The preset scripts comprise SQL scripts, and the SQL scripts are preset and stored.
The conversion data obtaining unit 404 is configured to obtain, if a conversion instruction is received, data to be converted, where the data to be converted includes original amount data, an original currency type corresponding to the original amount data, a target currency type, and a conversion time.
And a matching conversion unit 405, configured to convert the conversion time into a matching time that matches the first time according to the regular time.
In an embodiment, the matching conversion unit 405 includes: a time value acquisition unit and a matching time conversion unit. And the time value acquisition unit is used for acquiring the value of one time field in the sink table. And the matching time conversion unit is used for converting the conversion time into the matching time matched with the first time according to the acquired value of the time field and the regular time.
And a query unit 406, configured to query the rate table according to the matching time, the original currency type, and the target currency type, so as to obtain a rate value corresponding to the original currency type relative to the target currency type in the matching time.
The amount conversion unit 407 performs conversion calculation on the original amount data according to the sink value to obtain target amount data.
It should be noted that, as those skilled in the art can clearly understand the specific implementation process of the foregoing apparatus and each unit, reference may be made to the corresponding description in the foregoing method embodiment, and for convenience and brevity of description, no further description is provided herein.
The above-described apparatus may be implemented in the form of a computer program which is executable on a computer device as shown in fig. 7.
Fig. 7 is a schematic block diagram of a computer device according to an embodiment of the present application. The device 70 includes a processor 702, a memory and a network interface 703 connected by a system bus 701, wherein the memory may include a non-volatile storage medium 704 and an internal memory 705.
The non-volatile storage medium 704 may store an operating system 7041 and computer programs 7042. The above-described currency conversion method may be implemented when the computer program 7042 stored in the nonvolatile storage medium is executed by the processor 702. The processor 702 is used to provide computing and control capabilities to support the operation of the overall device 70. The internal memory 705 provides an environment for the execution of a computer program in a non-volatile storage medium that, when executed by the processor 702, causes the processor 702 to perform the currency conversion method described above. The network interface 703 is used for network communication. It will be appreciated by those skilled in the art that the structure shown in fig. 7 is merely a block diagram of a portion of the structure associated with the present application and does not constitute a limitation of the apparatus 70 to which the present application is applied, and that a particular apparatus 70 may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
Wherein the processor 702 is configured to execute a computer program stored in the memory, so as to implement the following steps:
acquiring a plurality of pieces of data in a sink rate table, and analyzing and counting time interval fields in the plurality of pieces of data to obtain regular time of the plurality of pieces of data; acquiring a first time in a time interval field corresponding to each piece of data in the exchange rate table; modifying the time interval field into a time field, and taking the first time in each piece of data as the value of the time field in the piece of data; if a conversion instruction is received, obtaining data to be converted, wherein the data to be converted comprises original amount data, an original currency type corresponding to the original amount data, a target currency type and conversion time; converting the conversion time into a matching time matched with the first time according to the regular time; inquiring in the exchange rate table according to the matching time, the original currency type and the target currency type to obtain an exchange rate value corresponding to the original currency type relative to the target currency type under the matching time; and according to the sink value, converting and calculating the original amount data to obtain target amount data.
In one embodiment, when executing the plurality of pieces of data in the acquisition rate table, the processor 702 analyzes and counts a time interval field in the plurality of pieces of data to obtain a regular time of the plurality of pieces of data, specifically performs:
acquiring a plurality of pieces of data in a sink rate table, and inputting values of time interval fields in the plurality of pieces of data into a pre-trained analysis statistical model; and according to the analysis statistical model, analyzing and counting time interval fields in the plurality of pieces of data to obtain the regular time of the plurality of pieces of data.
In one embodiment, when executing the plurality of pieces of data in the acquisition rate table, the processor 702 analyzes and counts a time interval field in the plurality of pieces of data to obtain a regular time of the plurality of pieces of data, specifically performs:
acquiring a plurality of pieces of data in a sink rate table, subtracting front and rear time in a time interval field in the plurality of pieces of data, and taking absolute values to obtain a plurality of absolute values; judging whether the absolute values are equal or not; and if the absolute values are equal, taking the time corresponding to the absolute values as regular time.
In an embodiment, the processor 702 performs subtraction on the front and rear times in the time interval field in the plurality of pieces of data to obtain a plurality of absolute values, and specifically performs:
Acquiring a first time and a second time in a time interval field corresponding to each piece of data in the plurality of pieces of data; and subtracting the first time and the second time corresponding to each piece of data in the plurality of pieces of data, and taking the absolute value to obtain a plurality of absolute values.
In an embodiment, when the processor 702 performs the subtraction between the front and rear times in the time interval field of the plurality of pieces of data to obtain a plurality of absolute values, the method specifically includes:
acquiring the first time of a time interval field corresponding to the next data in the continuous multiple data and the first time of a time interval field corresponding to the adjacent previous data; subtracting the first time of the time interval field corresponding to the next piece of data from the first time of the time interval field corresponding to the adjacent previous piece of data, and taking the absolute value to obtain a plurality of absolute values.
In one embodiment, when the processor 702 performs the modifying the time interval field to be a time field and uses the first time in each piece of data as the value of the time field in the piece of data, the specific steps are as follows:
if a modification instruction is received, calling a preset script, wherein the preset script is used for modifying a time interval field into a time field, and taking the first time in each piece of data as the value of the time field in the piece of data; and executing the preset script.
In one embodiment, when executing the converting the conversion time into the matching time matching the first time according to the regular time, the processor 702 specifically executes:
acquiring a value of a time field in the sink table; and converting the conversion time into a matching time matched with the first time according to the acquired value of the time field and the regular time.
It should be appreciated that in embodiments of the present application, the processor 702 may be a central processing unit (Central Processing Unit, CPU), which may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSPs), application specific integrated circuits (application lication Specific Integrated Circuit, ASICs), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
In another embodiment of the present application, there is provided a storage medium storing a computer program which, when executed by a processor, performs the steps of:
Acquiring a plurality of pieces of data in a sink rate table, and analyzing and counting time interval fields in the plurality of pieces of data to obtain regular time of the plurality of pieces of data; acquiring a first time in a time interval field corresponding to each piece of data in the exchange rate table; modifying the time interval field into a time field, and taking the first time in each piece of data as the value of the time field in the piece of data; if a conversion instruction is received, obtaining data to be converted, wherein the data to be converted comprises original amount data, an original currency type corresponding to the original amount data, a target currency type and conversion time; converting the conversion time into a matching time matched with the first time according to the regular time; inquiring in the exchange rate table according to the matching time, the original currency type and the target currency type to obtain an exchange rate value corresponding to the original currency type relative to the target currency type under the matching time; and according to the sink value, converting and calculating the original amount data to obtain target amount data.
In an embodiment, when the processor performs the obtaining of the plurality of pieces of data in the sink table, and analyzes and counts a time interval field in the plurality of pieces of data to obtain a regular time of the plurality of pieces of data, the method specifically includes:
Acquiring a plurality of pieces of data in a sink rate table, and inputting values of time interval fields in the plurality of pieces of data into a pre-trained analysis statistical model; and according to the analysis statistical model, analyzing and counting time interval fields in the plurality of pieces of data to obtain the regular time of the plurality of pieces of data.
In an embodiment, when the processor performs the obtaining of the plurality of pieces of data in the sink table, and analyzes and counts a time interval field in the plurality of pieces of data to obtain a regular time of the plurality of pieces of data, the method specifically includes:
acquiring a plurality of pieces of data in a sink rate table, subtracting front and rear time in a time interval field in the plurality of pieces of data, and taking absolute values to obtain a plurality of absolute values; judging whether the absolute values are equal or not; and if the absolute values are equal, taking the time corresponding to the absolute values as regular time.
In an embodiment, when the processor performs the subtracting the front and rear time in the time interval field in the plurality of pieces of data to obtain the plurality of absolute values, the method specifically includes:
acquiring a first time and a second time in a time interval field corresponding to each piece of data in the plurality of pieces of data; and subtracting the first time and the second time corresponding to each piece of data in the plurality of pieces of data, and taking the absolute value to obtain a plurality of absolute values.
In an embodiment, when the processor performs the subtracting the front and rear time in the time interval field in the plurality of pieces of data to obtain the plurality of absolute values, the method specifically includes:
acquiring the first time of a time interval field corresponding to the next data in the continuous multiple data and the first time of a time interval field corresponding to the adjacent previous data; subtracting the first time of the time interval field corresponding to the next piece of data from the first time of the time interval field corresponding to the adjacent previous piece of data, and taking the absolute value to obtain a plurality of absolute values.
In an embodiment, when the processor performs the modifying the time interval field to be a time field and takes the first time in each piece of data as a value of the time field in the piece of data, the specific implementation is as follows:
if a modification instruction is received, calling a preset script, wherein the preset script is used for modifying a time interval field into a time field, and taking the first time in each piece of data as the value of the time field in the piece of data; and executing the preset script.
In an embodiment, when the processor performs the converting the conversion time into the matching time matching the first time according to the regular time, the specific implementation is:
Acquiring a value of a time field in the sink table; and converting the conversion time into a matching time matched with the first time according to the acquired value of the time field and the regular time. The storage medium includes a computer readable storage medium, and the storage medium may be an internal storage unit of the terminal according to any one of the foregoing embodiments, for example, a hard disk or a memory of the terminal. The storage medium may also be an external storage device of the terminal, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, or the like, which is provided on the terminal. Further, the storage medium may also include both an internal storage unit and an external storage device of the terminal.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus, device, and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and the division of the units is merely a logical function division, and other divisions may be implemented in practice. It will be clearly understood by those skilled in the art that, for convenience and brevity of description, specific working procedures of the apparatus, device and unit described above may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein. While the invention has been described with reference to certain preferred embodiments, it will be understood by those skilled in the art that various changes and substitutions of equivalents may be made and equivalents will be apparent to those skilled in the art without departing from the scope of the invention. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (8)

1. A method of currency exchange rate conversion, the method comprising: acquiring a plurality of pieces of data in a sink rate table, and analyzing and counting time interval fields in the plurality of pieces of data to obtain regular time of the plurality of pieces of data;
acquiring a first time in a time interval field corresponding to each piece of data in the exchange rate table;
modifying the time interval field into a time field, and taking the first time in each piece of data as the value of the time field in the piece of data;
if a conversion instruction is received, obtaining data to be converted, wherein the data to be converted comprises original amount data, an original currency type corresponding to the original amount data, a target currency type and conversion time;
converting the conversion time into a matching time matched with the first time according to the regular time;
inquiring in the exchange rate table according to the matching time, the original currency type and the target currency type to obtain an exchange rate value corresponding to the original currency type relative to the target currency type under the matching time;
according to the sink value, converting and calculating the original amount data to obtain target amount data;
The obtaining the plurality of data in the sink rate table, analyzing and counting time interval fields in the plurality of data to obtain regular time of the plurality of data, includes:
acquiring a plurality of pieces of data in a sink rate table, and inputting values of time interval fields in the plurality of pieces of data into a pre-trained analysis statistical model;
according to the analysis statistical model, analyzing and counting time interval fields in the plurality of pieces of data to obtain regular time of the plurality of pieces of data;
or the acquiring a plurality of pieces of data in the sink rate table, analyzing and counting time interval fields in the plurality of pieces of data to obtain regular time of the plurality of pieces of data, including:
acquiring a plurality of pieces of data in a sink rate table, subtracting front and rear time in a time interval field in the plurality of pieces of data, and taking absolute values to obtain a plurality of absolute values;
judging whether the absolute values are equal or not;
and if the absolute values are equal, taking the time corresponding to the absolute values as regular time.
2. The method of claim 1, wherein subtracting the front and rear times in the time interval field in the plurality of pieces of data to obtain absolute values includes:
Acquiring a first time and a second time in a time interval field corresponding to each piece of data in the plurality of pieces of data;
and subtracting the first time and the second time corresponding to each piece of data in the plurality of pieces of data, and taking the absolute value to obtain a plurality of absolute values.
3. The method of claim 1, wherein, if the values of the time interval fields corresponding to the plurality of pieces of data are consecutive, subtracting the front and rear times in the time interval fields in the plurality of pieces of data from each other to obtain a plurality of absolute values, comprises:
acquiring the first time of a time interval field corresponding to the next data in the continuous multiple data and the first time of a time interval field corresponding to the adjacent previous data;
subtracting the first time of the time interval field corresponding to the next piece of data from the first time of the time interval field corresponding to the adjacent previous piece of data, and taking the absolute value to obtain a plurality of absolute values.
4. The method of claim 1, wherein modifying the time interval field to be a time field and wherein the first time in each piece of data is taken as the value of the time field in the piece of data comprises:
If a modification instruction is received, calling a preset script, wherein the preset script is used for modifying a time interval field into a time field, and taking the first time in each piece of data as the value of the time field in the piece of data; and executing the preset script.
5. The method of claim 1, wherein said converting said transition time to a matching time that matches said first time according to said regular time comprises:
acquiring a value of a time field in the sink table;
and converting the conversion time into a matching time matched with the first time according to the acquired value of the time field and the regular time.
6. A currency conversion machine, characterized in that it comprises means for performing the method according to any one of claims 1-5.
7. A computer device comprising a memory, and a processor coupled to the memory; the memory is used for storing a computer program; the processor is configured to execute a computer program stored in the memory to perform the method of any one of claims 1-5.
8. A storage medium storing a computer program which, when executed by a processor, implements the method of any one of claims 1-5.
CN201810965512.XA 2018-08-23 2018-08-23 Currency exchange rate conversion method, currency exchange rate conversion device, computer equipment and storage medium Active CN109242682B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810965512.XA CN109242682B (en) 2018-08-23 2018-08-23 Currency exchange rate conversion method, currency exchange rate conversion device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810965512.XA CN109242682B (en) 2018-08-23 2018-08-23 Currency exchange rate conversion method, currency exchange rate conversion device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109242682A CN109242682A (en) 2019-01-18
CN109242682B true CN109242682B (en) 2023-05-02

Family

ID=65068398

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810965512.XA Active CN109242682B (en) 2018-08-23 2018-08-23 Currency exchange rate conversion method, currency exchange rate conversion device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109242682B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111125134A (en) * 2019-12-19 2020-05-08 金蝶蝶金云计算有限公司 Foreign currency business statistical form generation method, system and related equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7328188B1 (en) * 1999-07-12 2008-02-05 Mainline Corporate Holdings Limited Dynamic currency conversion for card payment systems
US8121923B1 (en) * 2010-03-11 2012-02-21 Ruccolo Michael A Automated fulfilling of currency exchange requests over a computer network
CN105427161A (en) * 2015-11-20 2016-03-23 小米科技有限责任公司 Monetary exchange rate exchange method and device
CN105787789A (en) * 2015-12-23 2016-07-20 魅族科技(中国)有限公司 Method and apparatus for displaying currency exchange rate

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6721715B2 (en) * 1998-03-30 2004-04-13 Martin A. Nemzow Method and apparatus for localizing currency valuation independent of the original and objective currencies

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7328188B1 (en) * 1999-07-12 2008-02-05 Mainline Corporate Holdings Limited Dynamic currency conversion for card payment systems
US8121923B1 (en) * 2010-03-11 2012-02-21 Ruccolo Michael A Automated fulfilling of currency exchange requests over a computer network
CN105427161A (en) * 2015-11-20 2016-03-23 小米科技有限责任公司 Monetary exchange rate exchange method and device
CN105787789A (en) * 2015-12-23 2016-07-20 魅族科技(中国)有限公司 Method and apparatus for displaying currency exchange rate

Also Published As

Publication number Publication date
CN109242682A (en) 2019-01-18

Similar Documents

Publication Publication Date Title
CN106909495B (en) Data window statistical method, device and system
CN104778185B (en) Anomaly sxtructure query language SQL statement determines method and server
CN107357764B (en) Data analysis method, electronic device, and computer storage medium
CN108234293B (en) Expression management method, expression management device and intelligent terminal
CN106997394B (en) A kind of data random ordering arrival processing method and system
US20210233027A1 (en) Method for conducting statistics on insurance type state information of policy, terminal device and storage medium
WO2019052162A1 (en) Method, apparatus and device for improving data cleaning efficiency, and readable storage medium
CN110828017A (en) Information processing method and information processing system for nuclear power plant
CN105574032A (en) Rule matching operation method and device
CN109242682B (en) Currency exchange rate conversion method, currency exchange rate conversion device, computer equipment and storage medium
CN110990350A (en) Log analysis method and device
CN109117467A (en) Generation method, system, equipment and the medium of configurable dynamic data report
CN110876072A (en) Batch registered user identification method, storage medium, electronic device and system
CN108733799A (en) A kind of method for processing report data, device and terminal
CN111966712A (en) Data processing method, device, server and storage medium
CN108304303A (en) A kind of method and system of the script runnability of statistics frame sync server
CN109241511B (en) Electronic report generation method and equipment
CN113190576B (en) Data processing method, apparatus, computer device and readable storage medium
CN108170292B (en) Expression management method, expression management device and intelligent terminal
CN107330031B (en) Data storage method and device and electronic equipment
CN109933771B (en) Report automatic merging method, device, equipment and storage medium
CN106294457B (en) Network information pushing method and device
CN109408035B (en) Flow configuration method, storage medium and server of business system
CN110020166B (en) Data analysis method and related equipment
CN115858719A (en) SIM card activity prediction method and system based on big data analysis

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant