WO2019041707A1 - 大批量业务数据导出方法及系统 - Google Patents

大批量业务数据导出方法及系统 Download PDF

Info

Publication number
WO2019041707A1
WO2019041707A1 PCT/CN2017/120157 CN2017120157W WO2019041707A1 WO 2019041707 A1 WO2019041707 A1 WO 2019041707A1 CN 2017120157 W CN2017120157 W CN 2017120157W WO 2019041707 A1 WO2019041707 A1 WO 2019041707A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
target
service
export
request
Prior art date
Application number
PCT/CN2017/120157
Other languages
English (en)
French (fr)
Inventor
郝梦茹
陈少杰
张文明
Original Assignee
武汉斗鱼网络科技有限公司
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 武汉斗鱼网络科技有限公司 filed Critical 武汉斗鱼网络科技有限公司
Publication of WO2019041707A1 publication Critical patent/WO2019041707A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/254Extract, transform and load [ETL] procedures, e.g. ETL data flows in data warehouses

Definitions

  • the present invention relates to the field of Internet storage technologies, and more particularly to a method and system for deriving large-scale service data.
  • the present invention provides a method for deriving a large volume of business data in order to overcome the above problems or at least partially solve the above problems.
  • a method for exporting large-volume service data includes:
  • Step 1 Obtain a service data export request, where the service data export request includes a target service ID of the export request and a start time of the target data in the target service; and the export file request is stored in the same form of the MYSQL database. in;
  • Step 2 Timely obtain a file export request in the MYSQL database, and determine whether the target service and the number of data in the start time segment of the target data exceed a preset threshold m; if yes, obtain m pieces of data each time until obtaining All data of the target business at the start time of the target data.
  • the step 1 includes obtaining a service data export request, where the step of including the target service ID of the export request and the start time of the target data in the target service in the service data export request further includes:
  • step of storing the export file request in the same form of the MYSQL database in the step 1 further includes:
  • config represents the configuration information of the connection database
  • the start time and target business ID are stored in the same form in the MYSQL database.
  • step of periodically acquiring the file export request in the MYSQL database in the step 2 further includes:
  • connection (config) function is used to connect to the MYSQL database, and after the connection is successful, the service data export request is obtained.
  • the method further includes:
  • Step 3 Using the saveFileInfo($data) function in the PHPExcel class library, the obtained target data is stored in the excel file, the storage path of the file is set, and the excel file written to the target data is stored in the fixed server folder, and at the same time The exported excel file name and the path of the excel file storage are saved to the new MYSQL database.
  • the method further includes:
  • connection (config) function is used to connect to the database, and the excel file name is read and visualized by the select(where) function, so that the user can obtain the excel file by clicking the file name.
  • target service ID in the service data export request and the start time of the target data in the target service are set by a user
  • the setting of the target service ID and the start time of the target data in the target service can set different condition limits for users with different rights.
  • a high volume business data export system including:
  • a request obtaining module configured to obtain a service data export request, where the service data export request includes a target service ID of the export request and a start time of the target data in the target service; and the export file request is stored in the MYSQL database In the same form;
  • a data obtaining module configured to periodically obtain a file export request in the MYSQL database, and determine whether the number of data of the target service in the start time segment of the target data exceeds a preset threshold m; if yes, each time the m data is acquired, Until all data of the target business in the start time period of the target data is obtained.
  • an apparatus for exporting a large-volume service data includes:
  • At least one processor At least one processor
  • At least one memory communicatively coupled to the processor, wherein:
  • the memory stores program instructions executable by the processor, the processor invoking the program instructions to perform the method of any of the above.
  • a non-transitory computer readable storage medium stores computer instructions that cause the computer to perform any of the above Said method.
  • the present application proposes a method and system for deriving a large-volume service data.
  • the method first saves a request for acquiring service data, periodically obtains the request for acquiring service data, and performs batch read of a large amount of service data.
  • the solution described in the present application has the beneficial effect of reducing the risk of delay and failure when performing bulk business data export.
  • FIG. 1 is a schematic overall flow chart of a method for deriving a large-volume service data according to an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of a method for deriving a large-volume service data according to an embodiment of the present invention
  • FIG. 3 is a schematic diagram of an overall framework of a high-volume service data exporting system according to an embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of a device of a method for deriving a large-scale service data according to an embodiment of the present invention.
  • PHPExcel is a PHP class library for working with Office Excel documents. It is based on Microsoft's OpenXML standard and PHP language. It can be used to read and write spreadsheets in different formats.
  • MYSQL database is an associated database management system, the associated database saves the data in different tables, instead of putting all the data in a large warehouse, which increases the speed and flexibility.
  • WEB management is more A commonly used data management system.
  • the present invention aims to solve the problem of timeout that may occur when a large amount of service data is exported.
  • the business data export with low real-time performance it can be performed by asynchronous export, and the exported data is stored in the server and provided to the administrator for downloading.
  • the core of this technology is that after the administrator triggers the export operation, the export behavior will be performed in the background and processed in batches according to the amount of data and processed into corresponding files, which are then stored in server-specific files for real-time download.
  • the invention provides service to the file export, provides an interface to each platform, and implements the file asynchronous export interface service.
  • the asynchronous technology will provide the data manager with a better file exporting experience and a faster export service.
  • FIG. 1 is a general flow chart showing a method for deriving a large-scale business data in a specific embodiment of the present invention.
  • FIG. 1 is a general flow chart showing a method for deriving a large-scale business data in a specific embodiment of the present invention.
  • Step 1 Obtain a service data export request, where the service data export request includes a target service ID of the export request and a start time of the target data in the target service; and the export file request is stored in the same form of the MYSQL database. in;
  • Step 2 Timely obtain a file export request in the MYSQL database, and determine whether the number of data of the target service in the start time segment of the target data exceeds a preset threshold m; if it exceeds, obtain m pieces of data each time until the target is acquired. All data for the business at the start time of the target data.
  • a method for deriving a large-volume service data wherein the step 1 acquires a service data export request, where the service data export request includes a target service ID of the export request and The step of starting the target data in the target service further includes:
  • a method for exporting a large quantity of business data the step of storing the export file request in the same form of the MYSQL database in the step 1 further includes:
  • config represents the configuration information of the connection database
  • the start time and target business ID are stored in the same form in the MYSQL database.
  • a method for exporting a large-volume service data the step of periodically acquiring the file export request in the MYSQL database in the step 2 further includes:
  • connection (config) function is used to connect to the MYSQL database, and after the connection is successful, the service data export request is obtained.
  • a method for exporting large-scale service data the step 2 further includes:
  • Step 3 Using the saveFileInfo($data) function in the PHPExcel class library, the obtained target data is stored in the excel file, the storage path of the file is set, and the excel file written to the target data is stored in the fixed server folder, and at the same time The exported excel file name and the path of the excel file storage are saved to the new MYSQL database.
  • a method for exporting large-scale service data the step 3 further includes:
  • connection (config) function is used to connect to the database, and the excel file name is read and visualized by the select(where) function, so that the user can obtain the excel file by clicking the file name.
  • a method for deriving a large-volume service data where a target service ID in the service data export request and a start time of the target data in the target service are set by a user;
  • the setting of the target service ID and the start time of the target data in the target service can set different condition limits for users with different rights.
  • the manager business data export request is triggered.
  • the manager's export conditions are not limited.
  • different users export different business data they can independently select the export condition, the export behavior and the export condition are stored by the save (time, ident) function, and the time represents the start time of the target data in the target service, and is transmitted as an array to In the save function; ident identifies the industry target service ID to distinguish the exported service.
  • the manager business data export request is stored in the MYSQL database.
  • the config parameter represents the relevant configuration information of the connected database;
  • the parameters in the save (time, ident) function are received, because the time parameter In the form of an array, this time extracts the start time and end time of the export from the array as start_time and end_time and uses the strtotime() function to cast to the timestamp type, where the target is converted into a timestamp target.
  • the start time of the data is written to the database, because the timestamp is int, the query speed is faster than the character type and takes up less memory.
  • the unique identifier of ident as the business identifier is stored in the same table as the time in the database.
  • the exporter information is stored in the table, that is, the exporter's behavior storage is completed.
  • connection (config) function uses the connection (config) function to connect to the database storing the service data export request information, after the link is successful, the information of the service data export request is read.
  • step b) By using the information obtained in step a), it can be obtained which target service to which the derived behavior information belongs and the target time period in which the service data is derived.
  • step b) has obtained the database page form stored by the information of the business data export request, and according to the target time period acquired in step b), the business data of the time period is taken out. Since the export time period is randomly selected by the manager, the amount of data that is exported each time cannot be controlled; if the data is large, the one-time reading of the target data may cause the export operation to time out, which is very large. It may cause the database to which the target business data is queried to crash and affect the processing of other services. In the specific embodiment of the present invention, the method of cyclic reading is used to derive the bulk service data.
  • the loop reading mode is implemented by the method for deriving the large-volume service data: first, how many target service data are in the target time period, and if the data amount exceeds the preset threshold m in the time period, each time the data is taken 5000 pieces of data, which are sequentially cycled until all the data in the time period is taken out.
  • this step stores the target data obtained in step c) into an excel file.
  • this step sets the storage path of the file, store the excel file of the written data in the fixed server folder, and export the exported file.
  • the file name and the path where the file is stored are saved to the new MYSQL database.
  • the export of the target file is achieved.
  • the above steps have completed the export of the target data file, but the administrator can not see through the visual interface whether the file has been exported; in this step, the exported file will be visualized.
  • the file has been stored in the folder accessible by the server, and the file name has been stored in the MYSQL database through the above steps.
  • the connection (config) is also used to link the database, and the file name is displayed and displayed by the select(where) function.
  • the administrator can click the file name to realize the instant download function of the file.
  • the asynchronous idea is mainly highlighted in the process that the manager data export behavior and the file export process are not performed at the same time.
  • the advantage of adopting the asynchronous is that the real file export behavior is performed in the background queue, and the target data export is in progress.
  • This technology solves the problem of large data export timeouts.
  • the first two steps are designed to handle the storage of the manager's exported behavior, and then the behavior of the file export is started.
  • the first two steps are the manager's operation time, and the subsequent steps are executed in the background queue for a certain period of time. As the queue consumes, this execution completes the target data export.
  • the final step is to present the exported file to the manager in a visual way.
  • the request obtaining module A1 is configured to obtain a service data export request, where the service data export request includes a target service ID of the export request and a start time of the target data in the target service; and the export file request is stored in the MYSQL database.
  • the service data export request includes a target service ID of the export request and a start time of the target data in the target service; and the export file request is stored in the MYSQL database.
  • the data obtaining module A2 is configured to periodically obtain a file export request in the MYSQL database, and determine whether the number of data of the target service in the start time segment of the target data exceeds a preset threshold m; if yes, acquire m data each time. Until all data of the target business in the start time period of the target data is obtained.
  • the request obtaining module A1 is further configured to obtain a save (time, ident) function for storing a service data export request, ident
  • time is the start time of the target data in the target service of the export request, and is stored in an array form.
  • the request obtaining module A1 is further configured to:
  • config represents the configuration information of the connection database
  • the start time and target business ID are stored in the same form in the MYSQL database.
  • the data acquiring module A2 is further configured to:
  • connection (config) function is used to connect to the MYSQL database, and after the connection is successful, the service data export request is obtained.
  • a large-volume service data exporting system further includes a storage module, configured to:
  • a large-volume service data exporting system further includes a visual display module for:
  • connection (config) function is used to connect to the database, and the excel file name is read and visualized by the select(where) function, so that the user can obtain the excel file by clicking the file name.
  • a high-volume service data exporting system the target service ID in the service data export request and the start time of the target data in the target service are set by the user;
  • the setting of the target service ID and the start time of the target data in the target service can set different condition limits for users with different rights.
  • FIG. 4 is a structural block diagram of an apparatus for a method for deriving a large-volume service data according to an embodiment of the present application.
  • the device of the mass service data export method includes: a processor 401, a memory 402, and a bus 403;
  • the processor 401 and the memory 402 complete communication with each other through the bus 403;
  • the processor 401 is configured to invoke the program instructions in the memory 402 to perform the method provided by the foregoing method embodiments, for example, including: acquiring a service data export request, where the service data export request includes the export request The target service ID and the start time of the target data in the target service; storing the export file request in the same form of the MYSQL database; periodically acquiring the file export request in the MYSQL database, and determining the target service in the target data Whether the number of data in the start time period exceeds the preset threshold m; if it exceeds, m pieces of data are acquired each time until all data of the target service in the start time period of the target data is acquired.
  • the embodiment discloses a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer, the computer
  • the method provided in each of the foregoing method embodiments includes: acquiring a service data export request, where the service data export request includes a target service ID of the export request and a start time of the target data in the target service;
  • the export file request is stored in the same form of the MYSQL database; the file export request in the MYSQL database is periodically obtained, and it is determined whether the number of data of the target service in the start time period of the target data exceeds a preset threshold m; Then, m pieces of data are acquired each time until all the data of the target service in the start time period of the target data is acquired.
  • the embodiment provides a non-transitory computer readable storage medium, the non-transitory computer readable storage medium storing computer instructions, the computer instructions causing the computer to perform the methods provided by the foregoing method embodiments, including, for example, Obtaining a service data export request, where the service data export request includes a target service ID of the export request and a start time of the target data in the target service; and the export file request is stored in a same form in the MYSQL database; Obtaining a file export request in the MYSQL database periodically, and determining whether the number of data of the target service in the start time period of the target data exceeds a preset threshold m; if yes, acquiring m pieces of data each time until the target service is obtained at the target All data for the start time period of the data.
  • the foregoing program may be stored in a computer readable storage medium, and the program is executed when executed.
  • the foregoing steps include the steps of the foregoing method embodiments; and the foregoing storage medium includes: a medium that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.
  • the embodiments of the apparatus and the like for the mass service data derivation method described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may be or It may not be a physical unit, that is, it may be located in one place, or it may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment. Those of ordinary skill in the art can understand and implement without deliberate labor.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

大批量业务数据导出方法及系统,其中所述方法包括:步骤1,获取业务数据导出请求,所述业务数据导出请求中包含所述导出请求的目标业务ID和目标业务中目标数据的起始时间;将所述导出文件请求存储在MYSQL数据库的同一个表单中;步骤2,定时获取所述MYSQL数据库中的文件导出请求,判断目标业务在目标数据的起始时间段的数据条数是否超过预设阈值m;超过,则每次获取m条数据,直至获取目标业务在目标数据的起始时间段的所有数据。该方法具有在进行大批量业务数据导出时,降低时延和失败风险的有益效果。

Description

大批量业务数据导出方法及系统
交叉引用
本申请引用于2017年08月31日提交的专利名称为“大批量业务数据导出方法及系统”的第2017107734565号中国专利申请,其通过引用被全部并入本申请。
技术领域
本发明涉及互联网存储技术领域,更具体地,涉及大批量业务数据导出方法及系统。
背景技术
随着移动互联网技术的不断发展,互联网上展示的绝大多数业务数据都存储在数据库中,当用户需要调用某些业务数据时,需要向目标所述的数据库发送数据导出请求。
当用户请求导出的业务数据数量巨大时,通常会造成目标业务数据的导出时延甚至失败,同时也会导致目标业务数据所述数据库的服务器的查询慢、进而影响到所述服务器运行其他任务的效率。
亟待提供一种能够解决大批量业务数据导出可能引发的一系列问题的方法及系统。
发明内容
本发明为克服上述问题或者至少部分地解决上述问题,提供大批量业务数据导出方法。
根据本发明的一个方面,提供一种大批量业务数据导出方法,包括:
步骤1,获取业务数据导出请求,所述业务数据导出请求中包含所述导出请求的目标业务ID和目标业务中目标数据的起始时间;将所述导出文件请求存储在MYSQL数据库的同一个表单中;
步骤2,定时获取所述MYSQL数据库中的文件导出请求,判断目标业务和在目标数据的起始时间段的数据条数是否超过预设阈值m;超过,则每次获取m条数据,直至获取目标业务在目标数据的起始时间段的所有数据。
进一步,所述步骤1中获取业务数据导出请求,所述业务数据导出请求中包含所述导出请求的目标业务ID和目标业务中目标数据的起始时间的步骤进一步包括:
获取用于存储业务数据导出请求的save(time,ident)函数,ident为所述导出请求的目标业务ID,time为所述导出请求的目标业务中目标数据的起始时间,以数组形式存储。
进一步,所述步骤1中将所述导出文件请求存储在MYSQL数据库的同一个表单中的步骤进一步包括:
利用connection(config)方法连接MYSQL数据库,config表示连接数据库的相关配置信息;
获取所述save(time,ident)函数中的参数,利用strtotime()函数将所述time参数的开始时间点和结束时间点转化为时间戳,将所述转化为时间戳的目标业务中目标数据的起始时间和目标业务ID存储在MYSQL数据库中的同一个表单中。
进一步,所述步骤2中定时获取所述MYSQL数据库中的文件导出请求的步骤进一步包括:
通过设定接口函数的形式定时获取所述MYSQL数据库中的文件导出请求;
利用connection(config)函数连接所述MYSQL数据库,连接成功后,获取所述业务数据导出请求。
进一步,所述步骤2后还包括:
步骤3,利用PHPExcel类库中saveFileInfo($data)函数将获取到的目标数据存储到excel文件中,设置文件的存储路径,把写入目标数据的excel文件存入固定服务器文件夹中,同时把导出的excel文件名及excel文件存储的路径保存至新的MYSQL数据库中。
进一步,所述步骤3后还包括:
利用connection(config)函数连接数据库,利用select(where)函数读取出所述excel文件名并进行可视化展示,以供用户通过点击文件名获取所述excel文件。
进一步,所述业务数据导出请求中的目标业务ID和目标业务中目标数据的起始时间由用户设定;
所述目标业务ID和目标业务中目标数据的起始时间的设定能够为不同权限的用户设定不同的条件限制。
根据本发明另一方面,提供一种大批量业务数据导出系统,包括:
请求获取模块,用于获取业务数据导出请求,所述业务数据导出请求中包含所述导出请求的目标业务ID和目标业务中目标数据的起始时间;将所述导出文件请求存储在MYSQL数据库的同一个表单中;
数据获取模块,用于定时获取所述MYSQL数据库中的文件导出请求,判断目标业务在目标数据的起始时间段的数据条数是否超过预设阈值m;超过,则每次获取m条数据,直至获取目标业务在目标数据的起始时间段的所有数据。
根据本发明另一方面,提供一种大批量业务数据导出方法的设备,包括:
至少一个处理器;以及
与所述处理器通信连接的至少一个存储器,其中:
所述存储器存储有可被所述处理器执行的程序指令,所述处理器调用所述程序指令能够执行如上述任一所述的方法。
根据本发明另一方面,提供一种非暂态计算机可读存储介质,其特征在于,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令使所述计算机执行如上述任一所述的方法。
本申请提出大批量业务数据导出方法及系统,所述方法首先对获取业务数据的请求进行保存,定时获取所述获取业务数据的请求,对大批量的业务数据进行分批读取。本申请所述方案具有在进行大批量业务数据导出时,降低时延和失败风险的有益效果。
附图说明
图1为根据本发明实施例一种大批量业务数据导出方法的整体流程示意图;
图2为根据本发明实施例一种大批量业务数据导出方法的流程示意图;
图3为根据本发明实施例又一种大批量业务数据导出系统的整体框架示意图;
图4为根据本发明实施例一种大批量业务数据导出方法的设备的结构框架示意图。
具体实施方式
下面结合附图和实施例,对本发明的具体实施方式作进一步详细描述。以下实施例用于说明本发明,但不用来限制本发明的范围。
名词解释
PHPExcel:是用来操作Office Excel文档的一个PHP类库,它基于微软的OpenXML标准和PHP语言。可以使用它来读取、写入不同格式的电子表格。
MYSQL数据库:是一种关联数据库管理系统,关联数据库将数据保存在不同的表中,而不是将所有数据放在一个大仓库内,这样就增加了速度并提高了灵活性,目前是WEB管理较为常用的数据管理系统。
本发明旨在解决大量业务数据进行导出可能出现的超时问题;对于实时性不高的业务数据导出,可以采取异步导出的方式进行,并把导出的数据存储于服务器中,提供给管理员下载。该技术核心在于管理员触发导出操作后,导出行为将在后台进行并且根据数据量进行分批读取并处理成相应的文件,之后该文件存储于服务器特定的文件中供实时下载。本发明对文件导出进行服务化,提供接口给各个平台使用,实现文件异步导出接口服务化。本发明相对于一般的即时数据导出技术,异步技术将会为数据管理者提供更好的文件导出体验及更快速的导出服务。
如图1,示出本发明的一个具体实施例中,一种大批量业务数据导出方法的整体流程图。总体上,包括:
步骤1,获取业务数据导出请求,所述业务数据导出请求中包含所述导出请求的目标业务ID和目标业务中目标数据的起始时间;将所述导出文件请求存储在MYSQL数据库的同一个表单中;
步骤2,定时获取所述MYSQL数据库中的文件导出请求,判断目标业务在目标数据的起始时间段的数据条数是否超过预设阈值m;超过,则每次获取m条数据,直至获取目标业务在目标数据的起始时间段的所有数据。
在本发明任一上述具体实施例的基础上,一种大批量业务数据导 出方法,所述步骤1中获取业务数据导出请求,所述业务数据导出请求中包含所述导出请求的目标业务ID和目标业务中目标数据的起始时间的步骤进一步包括:
获取用于存储业务数据导出请求的save(time,ident)函数,ident为所述导出请求的目标业务ID,time为所述导出请求的目标业务中目标数据的起始时间,以数组形式存储。
在本发明任一上述具体实施例的基础上,一种大批量业务数据导出方法,所述步骤1中将所述导出文件请求存储在MYSQL数据库的同一个表单中的步骤进一步包括:
利用connection(config)方法连接MYSQL数据库,config表示连接数据库的相关配置信息;
获取所述save(time,ident)函数中的参数,利用strtotime()函数将所述time参数的开始时间点和结束时间点转化为时间戳,将所述转化为时间戳的目标业务中目标数据的起始时间和目标业务ID存储在MYSQL数据库中的同一个表单中。
在本发明任一上述具体实施例的基础上,一种大批量业务数据导出方法,所述步骤2中定时获取所述MYSQL数据库中的文件导出请求的步骤进一步包括:
通过设定接口函数的形式定时获取所述MYSQL数据库中的文件导出请求;
利用connection(config)函数连接所述MYSQL数据库,连接成功后,获取所述业务数据导出请求。
在本发明任一上述具体实施例的基础上,一种大批量业务数据导出方法,所述步骤2后还包括:
步骤3,利用PHPExcel类库中saveFileInfo($data)函数将获取到的 目标数据存储到excel文件中,设置文件的存储路径,把写入目标数据的excel文件存入固定服务器文件夹中,同时把导出的excel文件名及excel文件存储的路径保存至新的MYSQL数据库中。
在本发明任一上述具体实施例的基础上,一种大批量业务数据导出方法,所述步骤3后还包括:
利用connection(config)函数连接数据库,利用select(where)函数读取出所述excel文件名并进行可视化展示,以供用户通过点击文件名获取所述excel文件。
在本发明任一上述具体实施例的基础上,一种大批量业务数据导出方法,所述业务数据导出请求中的目标业务ID和目标业务中目标数据的起始时间由用户设定;
所述目标业务ID和目标业务中目标数据的起始时间的设定能够为不同权限的用户设定不同的条件限制。
如图2,在本发明任一上述具体实施例的基础上,一种大批量业务数据导出方法,接下来对本具体实施例进行进一步说明。
首先,管理者业务数据导出请求触发。管理者操作大批量业务数据导出时,不限制管理者的导出条件。不同的用户导出不同的业务数据时,能够自主选择导出条件,导出行为及导出条件通过save(time,ident)函数进行存储,time代表选择目标业务中目标数据的起始时间,以数组形式传递至save函数中;ident标识业目标业务ID用于区分导出的业务。
其次,业务数据导出请求的存储。管理者业务数据导出请求被存储于MYSQL数据库中。在写入数据库中之前,首先利用通用的connection(config)方法连接MYSQL数据库,config参数表示所连接数据库的相关配置信息;其次,接收所述save(time,ident)函数中的参数,因time参数为数组形式,此次从数组中分别提取出导出的开始时间以 及结束时间作为start_time和end_time并采用strtotime()函数强制转换为时间戳型,此处将所述转化为时间戳的目标业务中目标数据的起始时间写入数据库,因为时间戳为int型,查询速度比字符型要快且占用内存较少。ident作为业务标识的唯一标识与时间存入数据库的同一张表中。同时导出者信息一并存入该表中,即完成导出者的行为存储。
再次,业务数据导出请求的执行。基于上述存储在MYSQL数据库表单中的业务数据导出请求信息为基础,设置新的类库,以此类库作为定时任务系统执行的接口,设定定时任务将每n分钟执行一次,定时任务每执行一次将会执行一次该接口函数。在接口函数中将执行管理者的业务数据导出请求信息,接口函数执行流程如下:
a)、利用connection(config)函数连接所述保存业务数据导出请求信息的数据库,链接成功后,则读取业务数据导出请求的信息。
b)、通过步骤a)中的得到的信息,即可以得出该导出行为信息属于哪一个目标业务以及业务数据导出的目标时间段。
c)、步骤b)已经获取业务数据导出请求的信息所存储的数据库页表单,根据步骤b)获取的目标时间段,则取出该时间段的业务数据。由于导出时间段由管理者随机选择,则不能控制每次导出的数据量的大小;若数据量很大的时候进行目标数据的一次性读取,会造成导出操作超时的情况,该情况很大可能会使所查询目标业务数据所属的数据库崩溃并影响其他业务的处理。所述,本发明该具体实施例中利用循环读取的方式进行大批量业务数据的导出。
所述循环读取的方式进行大批量业务数据的导出技术实现为:首先查询目标时间段内有多少条目标业务数据,若该时间段内数据量超过预设阈值m条时,则每次取5000条数据,依次循环直至取出所在时间段内的所有的数据为止。
d)、该步骤将步骤c)中获取的目标数据存储到excel文件中。利用 PHPExcel第三方类库,并采用saveFileInfo($data)函数将所述目标数据存储excel表中,设置文件的存储路径,把写入数据的excel文件存入固定服务器文件夹中,同时把导出的文件名及文件存储的路径保存至新的MYSQL数据库中。通过以上流程,则执行完成导出行为。
最后,实现目标文件的导出。上述步骤已经完成了目标数据文件的导出,但管理者并不能通过可视化界面查看到文件是否已经导出;该步骤中将实现已导出的文件可视化。到此文件已经存储于服务器可访问的文件夹中,同时文件名已通过上述步骤存储于MYSQL数据库中,同样采用connection(config)链接数据库,并采用select(where)函数读取出文件名并展示到可视化页面上,及完成了异步文件的可视化,管理者点击文件名即可实现文件的即时下载功能。
本具体实施例中,异步的思想主要突出在管理者数据导出行为与文件导出的过程并不在同一时间进行,采用异步的优势在于真正文件导出行为在后台的队列中进行,目标数据导出正在进行,该技术可解决大量数据导出超时的问题。前两个步骤中旨在处理管理者导出行为的存储,之后开始进行文件导出的行为。前两个步骤正是管理者进行操作时间,随后的步骤则是在后台队列中延后一定时间执行,随着队列的消耗,这执行完成目标数据的导出。通过最后一个步骤把导出的文件已可视化的方式展示给管理者。通过以上整体流程,该技术完全实现不可控制数据量的异步文件导出行为。
如图3,示出本发明的一个具体实施例中,一种大批量业务数据导出系统的整体框架图。总体上,包括:
请求获取模块A1,用于获取业务数据导出请求,所述业务数据导出请求中包含所述导出请求的目标业务ID和目标业务中目标数据的起始时间;将所述导出文件请求存储在MYSQL数据库的同一个表单中;
数据获取模块A2,用于定时获取所述MYSQL数据库中的文件导 出请求,判断目标业务在目标数据的起始时间段的数据条数是否超过预设阈值m;超过,则每次获取m条数据,直至获取目标业务在目标数据的起始时间段的所有数据。
在本发明任一上述具体实施例的基础上,一种大批量业务数据导出系统,所述请求获取模块A1,进一步用于获取用于存储业务数据导出请求的save(time,ident)函数,ident为所述导出请求的目标业务ID,time为所述导出请求的目标业务中目标数据的起始时间,以数组形式存储。
在本发明任一上述具体实施例的基础上,一种大批量业务数据导出系统,所述请求获取模块A1进一步用于:
利用connection(config)方法连接MYSQL数据库,config表示连接数据库的相关配置信息;
获取所述save(time,ident)函数中的参数,利用strtotime()函数将所述time参数的开始时间点和结束时间点转化为时间戳,将所述转化为时间戳的目标业务中目标数据的起始时间和目标业务ID存储在MYSQL数据库中的同一个表单中。
在本发明任一上述具体实施例的基础上,一种大批量业务数据导出系统,所述数据获取模块A2,进一步用于:
通过设定接口函数的形式定时获取所述MYSQL数据库中的文件导出请求;
利用connection(config)函数连接所述MYSQL数据库,连接成功后,获取所述业务数据导出请求。
在本发明任一上述具体实施例的基础上,一种大批量业务数据导出系统,还包括存储模块,用于:
利用PHPExcel类库中saveFileInfo($data)函数将获取到的目标数 据存储到excel文件中,设置文件的存储路径,把写入目标数据的excel文件存入固定服务器文件夹中,同时把导出的excel文件名及excel文件存储的路径保存至新的MYSQL数据库中。
在本发明任一上述具体实施例的基础上,一种大批量业务数据导出系统,还包括可视化展示模块,用于:
利用connection(config)函数连接数据库,利用select(where)函数读取出所述excel文件名并进行可视化展示,以供用户通过点击文件名获取所述excel文件。
在本发明任一上述具体实施例的基础上,一种大批量业务数据导出系统,所述业务数据导出请求中的目标业务ID和目标业务中目标数据的起始时间由用户设定;
所述目标业务ID和目标业务中目标数据的起始时间的设定能够为不同权限的用户设定不同的条件限制。
图4示出本申请实施例的大批量业务数据导出方法的设备的结构框图。
参照图4,所述大批量业务数据导出方法的设备,包括:处理器(processor)401、存储器(memory)402和总线403;
其中,
所述处理器401和存储器402通过所述总线403完成相互间的通信;
所述处理器401用于调用所述存储器402中的程序指令,以执行上述各方法实施例所提供的方法,例如包括:获取业务数据导出请求,所述业务数据导出请求中包含所述导出请求的目标业务ID和目标业务中目标数据的起始时间;将所述导出文件请求存储在MYSQL数据库的同一个表单中;定时获取所述MYSQL数据库中的文件导出请求, 判断目标业务在目标数据的起始时间段的数据条数是否超过预设阈值m;超过,则每次获取m条数据,直至获取目标业务在目标数据的起始时间段的所有数据。
本实施例公开一种计算机程序产品,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,计算机能够执行上述各方法实施例所提供的方法,例如包括:获取业务数据导出请求,所述业务数据导出请求中包含所述导出请求的目标业务ID和目标业务中目标数据的起始时间;将所述导出文件请求存储在MYSQL数据库的同一个表单中;定时获取所述MYSQL数据库中的文件导出请求,判断目标业务在目标数据的起始时间段的数据条数是否超过预设阈值m;超过,则每次获取m条数据,直至获取目标业务在目标数据的起始时间段的所有数据。
本实施例提供一种非暂态计算机可读存储介质,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令使所述计算机执行上述各方法实施例所提供的方法,例如包括:获取业务数据导出请求,所述业务数据导出请求中包含所述导出请求的目标业务ID和目标业务中目标数据的起始时间;将所述导出文件请求存储在MYSQL数据库的同一个表单中;定时获取所述MYSQL数据库中的文件导出请求,判断目标业务在目标数据的起始时间段的数据条数是否超过预设阈值m;超过,则每次获取m条数据,直至获取目标业务在目标数据的起始时间段的所有数据。
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
以上所描述的大批量业务数据导出方法的设备等实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行各个实施例或者实施例的某些部分所述的方法。
最后,本申请的方法仅为较佳的实施方案,并非用于限定本发明的保护范围。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。

Claims (11)

  1. 一种大批量业务数据导出方法,其特征在于,包括:
    步骤1,获取业务数据导出请求,所述业务数据导出请求中包含所述导出请求的目标业务ID和目标业务中目标数据的起始时间;将所述导出文件请求存储在MYSQL数据库的同一个表单中;
    步骤2,定时获取所述MYSQL数据库中的文件导出请求,判断目标业务在目标数据的起始时间段的数据条数是否超过预设阈值m;超过,则每次获取m条数据,直至获取目标业务在目标数据的起始时间段的所有数据。
  2. 如权利要求1的方法,其特征在于,所述步骤1中获取业务数据导出请求,所述业务数据导出请求中包含所述导出请求的目标业务ID和目标业务中目标数据的起始时间的步骤进一步包括:
    获取用于存储业务数据导出请求的save(time,ident)函数,ident为所述导出请求的目标业务ID,time为所述导出请求的目标业务中目标数据的起始时间,以数组形式存储。
  3. 如权利要求2所述的方法,其特征在于,所述步骤1中将所述导出文件请求存储在MYSQL数据库的同一个表单中的步骤进一步包括:
    利用connection(config)方法连接MYSQL数据库,config表示连接数据库的相关配置信息;
    获取所述save(time,ident)函数中的参数,利用strtotime()函数将所述time参数的开始时间点和结束时间点转化为时间戳,将所述转化为时间戳的目标业务中目标数据的起始时间和目标业务ID存储在 MYSQL数据库中的同一个表单中。
  4. 如权利要求1所述的方法,其特征在于,所述步骤2中定时获取所述MYSQL数据库中的文件导出请求的步骤进一步包括:
    通过设定接口函数的形式定时获取所述MYSQL数据库中的文件导出请求;
    利用connection(config)函数连接所述MYSQL数据库,连接成功后,获取所述业务数据导出请求。
  5. 如权利要求1所述的方法,其特征在于,所述步骤2后还包括:
    步骤3,利用PHPExcel类库中saveFileInfo($data)函数将获取到的目标数据存储到excel文件中,设置文件的存储路径,把写入目标数据的excel文件存入固定服务器文件夹中,同时把导出的excel文件名及excel文件存储的路径保存至新的MYSQL数据库中。
  6. 如权利要求5所述的方法,其特征在于,所述步骤3后还包括:
    利用connection(config)函数连接数据库,利用select(where)函数读取出所述excel文件名并进行可视化展示,以供用户通过点击文件名获取所述excel文件。
  7. 如权利要求1所述的方法,其特征在于,所述业务数据导出请求中的目标业务ID和目标业务中目标数据的起始时间由用户设定;
    所述目标业务ID和目标业务中目标数据的起始时间的设定能够为不同权限的用户设定不同的条件限制。
  8. 一种大批量业务数据导出系统,其特征在于,包括:
    请求获取模块,用于获取业务数据导出请求,所述业务数据导出请求中包含所述导出请求的目标业务ID和目标业务中目标数据的起始时间;将所述导出文件请求存储在MYSQL数据库的同一个表单中;
    数据获取模块,用于定时获取所述MYSQL数据库中的文件导出请求,判断目标业务在目标数据的起始时间段的数据条数是否超过预设阈值m;超过,则每次获取m条数据,直至获取目标业务在目标数据的起始时间段的所有数据。
  9. 一种大批量业务数据导出方法的设备,其特征在于,包括:
    至少一个处理器;以及
    与所述处理器通信连接的至少一个存储器,其中:
    所述存储器存储有可被所述处理器执行的程序指令,所述处理器调用所述程序指令能够执行如权利要求1至7任一所述的方法。
  10. 一种非暂态计算机可读存储介质,其特征在于,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令使所述计算机执行如权利要求1至7任一所述的方法。
  11. 一种计算机程序产品,其特征在于,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行如权利要求1至7任一所述的方法。
PCT/CN2017/120157 2017-08-31 2017-12-29 大批量业务数据导出方法及系统 WO2019041707A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710773456.5A CN107656968B (zh) 2017-08-31 2017-08-31 大批量业务数据导出方法及系统
CN201710773456.5 2017-08-31

Publications (1)

Publication Number Publication Date
WO2019041707A1 true WO2019041707A1 (zh) 2019-03-07

Family

ID=61128776

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/120157 WO2019041707A1 (zh) 2017-08-31 2017-12-29 大批量业务数据导出方法及系统

Country Status (2)

Country Link
CN (1) CN107656968B (zh)
WO (1) WO2019041707A1 (zh)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108696568B (zh) * 2018-02-23 2021-07-06 福建天泉教育科技有限公司 一种请求批量处理方法及终端
CN108399259A (zh) * 2018-03-09 2018-08-14 深圳市汗青文化传媒有限公司 一种数据处理方法及系统
CN108536839A (zh) * 2018-04-13 2018-09-14 郑州云海信息技术有限公司 数据库数据导出方法、装置、设备及计算机可读存储介质
CN110263307A (zh) * 2019-04-15 2019-09-20 重庆金融资产交易所有限责任公司 报表生成方法、服务器及计算机可读存储介质
CN112559118A (zh) * 2019-09-25 2021-03-26 北京国双科技有限公司 应用数据迁移方法、装置、电子设备及存储介质
CN110633266B (zh) * 2019-09-26 2022-03-29 中国银行股份有限公司 业务系统的版本生成方法及系统
CN110781387B (zh) * 2019-10-10 2022-11-04 深圳证券交易所 证券行情快照的推送方法、证券交易系统及存储介质
CN112100245B (zh) * 2020-09-18 2024-05-31 咪咕文化科技有限公司 数据导出方法、装置、电子设备和存储介质
CN112650805A (zh) * 2020-12-30 2021-04-13 杭州贝嘟科技有限公司 数据导出方法、装置、计算机设备和可读存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103902702A (zh) * 2014-03-31 2014-07-02 北京车商汇软件有限公司 一种数据存储系统和存储方法
CN103942287A (zh) * 2014-04-10 2014-07-23 大唐移动通信设备有限公司 海量数据处理方法、数据库服务器及应用服务器
CN106547614A (zh) * 2016-11-01 2017-03-29 山东浪潮商用系统有限公司 一种基于消息队列的海量数据延迟导出方法

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103500196B (zh) * 2013-09-22 2016-09-14 成都交大光芒科技股份有限公司 多并发大数据量环境下excel数据导出方法及其导出装置
CN103810238A (zh) * 2013-11-20 2014-05-21 国家电网公司 一种基于异步处理的大数据量Excel文件导出方法
CN104657123B (zh) * 2013-11-21 2018-09-11 航天信息股份有限公司 一种动态导出文件的方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103902702A (zh) * 2014-03-31 2014-07-02 北京车商汇软件有限公司 一种数据存储系统和存储方法
CN103942287A (zh) * 2014-04-10 2014-07-23 大唐移动通信设备有限公司 海量数据处理方法、数据库服务器及应用服务器
CN106547614A (zh) * 2016-11-01 2017-03-29 山东浪潮商用系统有限公司 一种基于消息队列的海量数据延迟导出方法

Also Published As

Publication number Publication date
CN107656968A (zh) 2018-02-02
CN107656968B (zh) 2021-04-23

Similar Documents

Publication Publication Date Title
WO2019041707A1 (zh) 大批量业务数据导出方法及系统
CN108536761B (zh) 报表数据查询方法及服务器
US20170364697A1 (en) Data interworking method and data interworking device
JP6348937B2 (ja) オブジェクト記憶システムにおけるオブジェクトデータの更新方法及び更新装置
US11139993B2 (en) Method, apparatus, and computer program product for generating a predicted channel add object in a group-based communication system
CN110321273B (zh) 一种业务统计方法及装置
WO2018098429A1 (en) Event driven extract, transform, load (etl) processing
EP3759611A1 (en) Data retention handling for data object stores
CN107844698B (zh) 金融app的权限设置方法、装置、设备及存储介质
WO2016123042A1 (en) Data factory platform and operating system
US20160182314A1 (en) Streamlined provisioning system and method
CN111651405A (zh) 配置文件管理方法、装置、设备及存储介质
CN107273369B (zh) 一种表数据修改方法和装置
US11055454B1 (en) Configuring and deploying Monte Carlo simulation pipelines
US20200278975A1 (en) Searching data on a synchronization data stream
AU2015316450A1 (en) Method for updating data table of KeyValue database and apparatus for updating table data
CN108228875A (zh) 基于完美哈希的日志解析方法及装置
TW202018637A (zh) 資料處理方法及裝置、計算設備及儲存媒體
WO2019000897A1 (zh) 一种数据获取方法及设备
CN110727523A (zh) 业务请求的处理方法、处理装置及可读存储介质
WO2018188607A1 (zh) 流处理方法及装置
US12019647B2 (en) Accessing application services from forms
CN111078418B (zh) 操作同步方法、装置、电子设备及计算机可读存储介质
CN112948467A (zh) 数据处理方法及装置、计算机设备和存储介质
CN113157480A (zh) 错误信息处理方法、装置、存储介质以及终端

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17923646

Country of ref document: EP

Kind code of ref document: A1