[go: up one dir, main page]

CN107085605A - Method, device and electronic equipment for data packaging - Google Patents

Method, device and electronic equipment for data packaging Download PDF

Info

Publication number
CN107085605A
CN107085605A CN201710235637.2A CN201710235637A CN107085605A CN 107085605 A CN107085605 A CN 107085605A CN 201710235637 A CN201710235637 A CN 201710235637A CN 107085605 A CN107085605 A CN 107085605A
Authority
CN
China
Prior art keywords
packing
data
strategy
packed
packaging
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.)
Granted
Application number
CN201710235637.2A
Other languages
Chinese (zh)
Other versions
CN107085605B (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.)
Taikang Insurance Group Co Ltd
Original Assignee
Taikang Insurance Group Co 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 Taikang Insurance Group Co Ltd filed Critical Taikang Insurance Group Co Ltd
Priority to CN201710235637.2A priority Critical patent/CN107085605B/en
Publication of CN107085605A publication Critical patent/CN107085605A/en
Application granted granted Critical
Publication of CN107085605B publication Critical patent/CN107085605B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The disclosure provides a method and a device for data packaging and an electronic device. The method comprises the following steps: triggering a corresponding timing task according to the last triggering time and frequency; extracting a data set to be packaged corresponding to the timing task from a database; acquiring a corresponding packaging strategy according to the strategy parameters of the timing task; and executing a packing scheduling operation on the data set to be packed according to the packing strategy to complete the packing of the data set to be packed. According to the data packaging method and device, the timing task is triggered through the last time and the last time, the data set to be packaged of the timing task is obtained, and the data set to be packaged is packaged according to the preset packaging strategy, so that configurable packaging of data can be achieved.

Description

用于数据打包的方法、装置及电子设备Method, device and electronic equipment for data packaging

技术领域technical field

本公开涉及计算机技术领域,尤其涉及一种用于数据打包的方法、装置及电子设备。The present disclosure relates to the field of computer technology, in particular to a method, device and electronic equipment for data packaging.

背景技术Background technique

现有的资金平台(例如,公司针对财务交易处理、财务核对,使得交易透明化、自动化的平台,有效缩短了公司的资金交易处理时间及成本,同时经过该系统也加强了资金的监管)与各银行及第三方支付进行交易传输(包括实时、批处理的收付款交易,异步的交易结果查询等)时,至少存在以下问题:The existing capital platform (for example, the company's financial transaction processing and financial verification platform makes the transaction transparent and automated, which effectively shortens the company's capital transaction processing time and cost, and at the same time strengthens capital supervision through this system) and When banks and third-party payments conduct transaction transmission (including real-time, batch-processing receipt and payment transactions, asynchronous transaction result queries, etc.), there are at least the following problems:

1、使用TaskTimer创建的任务对象,由于任务的频度及触发时间固定配置在XML文件中,只能配置简单的周期任务。当项目实施中新建任务时,需更改任务周期、更改XML配置、重新加载服务,此类工作非常繁琐且不利于项目长期运维及实施支持。1. For the task object created by TaskTimer, since the frequency and trigger time of the task are fixed and configured in the XML file, only simple periodic tasks can be configured. When a new task is created during project implementation, it is necessary to change the task cycle, change the XML configuration, and reload the service. Such work is very cumbersome and is not conducive to long-term operation and maintenance of the project and implementation support.

2、数据分类的策略组是全数据共享的,不能为指定的数据集合单独配置策略组,如有数据集合要用不同的策略组,只能在代码里增加特殊规则。2. The policy group for data classification is shared by all data. You cannot configure a separate policy group for a specified data collection. If you need to use a different policy group for a data collection, you can only add special rules in the code.

3、数据首次分包后,后续的工作,都是放在KEY命名的流程处理类中完成的。每个流程类都配置了处理该包所需的自定义参数,这种面向过程式的写法,如新增渠道都是把原有的流程类COPY一份,涂涂改改,积累了大量冗余的代码,非常不方便维护。3. After the data is subcontracted for the first time, the subsequent work is done in the process processing class named by KEY. Each process class is configured with the custom parameters required to process the package. This process-oriented writing method, such as adding a new channel, is to copy the original process class, alter it, and accumulate a lot of redundancy. The code is very inconvenient to maintain.

因此,需要一种改进的用于数据打包的方法、装置及电子设备。Therefore, there is a need for an improved method, apparatus and electronic device for data packaging.

发明内容Contents of the invention

为克服相关技术中存在的问题,本公开提供一种用于数据打包的方法、装置及电子设备,实现对定时任务指定范围内的数据集进行打包。In order to overcome the problems existing in related technologies, the present disclosure provides a method, device and electronic equipment for data packaging, so as to realize the packaging of data sets within the specified range of timing tasks.

根据本公开实施例的第一方面,提供一种用于数据打包的方法,包括:According to a first aspect of an embodiment of the present disclosure, a method for data packaging is provided, including:

根据上一次触发时间和频度触发相应的定时任务;Trigger the corresponding scheduled task according to the last trigger time and frequency;

从数据库中抽取所述定时任务对应的待打包数据集;Extracting the data set to be packaged corresponding to the timing task from the database;

根据所述定时任务的策略参数获取相应的打包策略;Obtaining a corresponding packaging policy according to the policy parameters of the timing task;

根据所述打包策略对所述待打包数据集执行打包调度作业,完成所述待打包数据集的打包。Executing a packaging scheduling job on the data set to be packaged according to the packaging policy to complete the packaging of the data set to be packaged.

在本公开的一种示例性实施例中,根据上一次触发时间和频度触发相应的定时任务包括:In an exemplary embodiment of the present disclosure, triggering a corresponding timed task according to the last trigger time and frequency includes:

将所述定时任务的上一次触发时间和频度存储于所述数据库中;storing the last trigger time and frequency of the timing task in the database;

根据所述上一次触发时间和所述频度获得所述定时任务的下一次触发时间;Obtaining the next trigger time of the scheduled task according to the last trigger time and the frequency;

进行时间监控,当当前时间等于所述下一次触发时间时,触发所述定时任务。Time monitoring is performed, and when the current time is equal to the next trigger time, the timing task is triggered.

在本公开的一种示例性实施例中,所述方法还包括:In an exemplary embodiment of the present disclosure, the method further includes:

根据业务需求,为所述待打包数据集创建打包调度器;According to business requirements, create a packaging scheduler for the data set to be packaged;

通过所述打包调度器的页面创建所述定时任务及其打包分组策略参数、初始触发时间和频度并保存于所述数据库中。The timed task and its packaging and grouping policy parameters, initial trigger time and frequency are created through the page of the packaging scheduler and stored in the database.

在本公开的一种示例性实施例中,所述打包调度器为QuartzJob打包调度器。In an exemplary embodiment of the present disclosure, the package scheduler is a QuartzJob package scheduler.

在本公开的一种示例性实施例中,所述打包策略包括分包策略、拆包策略和包命名策略。In an exemplary embodiment of the present disclosure, the packaging policy includes a subpackaging policy, an unpacking policy and a package naming policy.

在本公开的一种示例性实施例中,所述包命名策略包括序列重置策略。In an exemplary embodiment of the present disclosure, the package naming policy includes a sequence reset policy.

在本公开的一种示例性实施例中,根据所述打包策略对所述待打包数据集执行打包调度作业,完成所述待打包数据集的打包包括:In an exemplary embodiment of the present disclosure, performing a packaging scheduling job on the data set to be packaged according to the packaging strategy, and completing the packaging of the data set to be packaged includes:

根据所述打包分组策略参数,将具有相同分包策略的所述待打包数据集中的数据分配至同一数据包中;According to the packing and grouping policy parameters, allocating the data in the data set to be packed with the same packing policy into the same data package;

遍历所述待打包数据集完成所述待打包数据集的分包。Traverse the data set to be packaged to complete the subpackage of the data set to be packaged.

在本公开的一种示例性实施例中,根据所述打包分组策略参数,将具有相同分包策略的所述待打包数据集中的数据分配至同一数据包中包括:In an exemplary embodiment of the present disclosure, according to the packing and grouping policy parameters, allocating the data in the data set to be packaged with the same packing policy into the same data package includes:

将所述打包分组策略参数封装在HashMap中,并传递至所述定时任务;Encapsulating the packaging and grouping strategy parameters in a HashMap, and delivering to the timing task;

将所述打包分组策略参数组成分包策略key;Composing the packetization strategy parameters into a packetization strategy key;

将具有相同分包策略key的所述待打包数据集中的数据放在同一数据包中。Put the data in the data set to be packaged with the same subpackage policy key into the same data package.

在本公开的一种示例性实施例中,根据所述打包策略对所述待打包数据集执行打包调度作业,完成所述待打包数据集的打包还包括:In an exemplary embodiment of the present disclosure, performing a packaging scheduling job on the data set to be packaged according to the packaging strategy, and completing the packaging of the data set to be packaged further includes:

根据所述拆包策略对分包后的数据包进行拆包。The packetized data packets are unpacked according to the unpacking strategy.

在本公开的一种示例性实施例中,根据所述拆包策略对分包后的数据包进行拆包包括:In an exemplary embodiment of the present disclosure, unpacking the packetized data packets according to the unpacking strategy includes:

根据待发送渠道要求,将数据包的最大笔数限制配置在所述数据库中;Configure the maximum number of data packets in the database according to the requirements of the channel to be sent;

初始化时将配置在所述数据库中的数据包的最大笔数限制加载在缓存中;Loading the maximum number of data packets configured in the database into the cache during initialization;

拆包时根据所述打包分组策略参数,在所述缓存中取出相应数据包的最大笔数限制,对所述数据包进行拆包处理。When unpacking, according to the packing and grouping policy parameters, the maximum number of corresponding data packets is taken out from the cache, and the data packets are unpacked.

在本公开的一种示例性实施例中,根据所述打包策略对所述待打包数据集执行打包调度作业,完成所述待打包数据集的打包还包括:In an exemplary embodiment of the present disclosure, performing a packaging scheduling job on the data set to be packaged according to the packaging strategy, and completing the packaging of the data set to be packaged further includes:

根据所述包命名策略对拆包后的数据包创建包号。Create a package number for the unpacked data package according to the package naming strategy.

在本公开的一种示例性实施例中,根据所述包命名策略对拆包后的数据包创建包号包括:In an exemplary embodiment of the present disclosure, creating a package number for the unpacked data package according to the package naming strategy includes:

根据所述打包分组策略参数,在所述数据库中配置命名策略参数、输出规则、拼接顺序以及序列重置策略;According to the packaging and grouping strategy parameters, configure naming strategy parameters, output rules, splicing order and sequence reset strategy in the database;

读取所述序列重置策略,判断自定义序列是否需要重置;Read the sequence reset policy to determine whether the custom sequence needs to be reset;

根据所述拼接顺序,依次读取命名规则,将各命名规则输出字符串拼接成完整的包号。According to the splicing sequence, the naming rules are read sequentially, and the output strings of each naming rule are spliced into a complete package number.

在本公开的一种示例性实施例中,所述包号的命名规则根据待发送渠道要求制定,其包括文件名和/或报文的流水号。In an exemplary embodiment of the present disclosure, the naming rule of the packet number is formulated according to the requirements of the channel to be sent, and includes the file name and/or the serial number of the message.

在本公开的一种示例性实施例中,将打包完成的数据包返回至所述数据库中进行存储。In an exemplary embodiment of the present disclosure, the packaged data package is returned to the database for storage.

根据本公开实施例的第二方面,提供一种用于数据打包的装置,包括:According to a second aspect of an embodiment of the present disclosure, a device for packaging data is provided, including:

任务触发模块,用于根据上一次触发时间和频度触发相应的定时任务;The task trigger module is used to trigger the corresponding timing task according to the last trigger time and frequency;

数据抽取模块,用于从数据库中抽取所述定时任务对应的待打包数据集;A data extraction module, configured to extract the data set to be packaged corresponding to the timing task from the database;

打包策略获取模块,用于根据所述定时任务的策略参数获取相应的打包策略;A packaging policy acquisition module, configured to acquire a corresponding packaging policy according to the policy parameters of the timing task;

打包调度模块,用于根据所述打包策略对所述待打包数据集执行打包调度作业,完成所述待打包数据集的打包。A packaging scheduling module, configured to execute a packaging scheduling job on the data set to be packaged according to the packaging strategy, and complete the packaging of the data set to be packaged.

根据本公开实施例的第三方面,提供一种电子设备,包括:According to a third aspect of the embodiments of the present disclosure, there is provided an electronic device, including:

处理器;以及processor; and

存储器,用于存储所述处理器的可执行指令;a memory for storing executable instructions of the processor;

其中,所述处理器被配置为执行上述任意一项所述的用于数据打包的方法。Wherein, the processor is configured to execute any one of the methods for data packaging described above.

本公开示例实施方式中的用于数据打包的方法、装置及电子设备,通过上一次触发时间和频度触发定时任务,获取定时任务的待打包数据集,根据预设的打包策略对该待打包数据集进行打包,从而可以实现数据的可配置化打包。The method, device, and electronic device for data packaging in the example implementations of the present disclosure trigger the timing task through the last trigger time and frequency, obtain the data set to be packaged for the timing task, and the data set to be packaged according to the preset packaging strategy Data sets are packaged, so that configurable packaging of data can be achieved.

附图说明Description of drawings

此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本发明的实施例,并与说明书一起用于解释本发明的原理。显而易见地,下面描述中的附图仅仅是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description serve to explain the principles of the invention. Apparently, the drawings in the following description are only some embodiments of the present disclosure, and those skilled in the art can obtain other drawings according to these drawings without creative efforts.

图1是根据一示例性实施例示出的一种用于数据打包的方法的流程示意图。Fig. 1 is a schematic flowchart of a method for data packaging according to an exemplary embodiment.

图2是根据一示例性实施例示出的一种用于数据打包的方法的系统架构示意图。Fig. 2 is a schematic diagram of a system architecture showing a method for data packaging according to an exemplary embodiment.

图3是根据一示例性实施例示出的一种打包调度器的页面示意图。Fig. 3 is a schematic diagram of a page of a packaging scheduler according to an exemplary embodiment.

图4是根据图3所示的打包调度器输入执行周期表达式的页面示意图。Fig. 4 is a schematic diagram of a page for inputting an execution cycle expression according to the packaging scheduler shown in Fig. 3 .

图5是根据一示例性实施例示出的一种作业列表的页面示意图。Fig. 5 is a schematic diagram of a job list page according to an exemplary embodiment.

图6是根据一示例性实施例示出的一种用于数据打包的装置的模块示意图。Fig. 6 is a schematic block diagram of a device for packing data according to an exemplary embodiment.

具体实施方式detailed description

现在将参考附图更全面地描述示例性实施例。然而,示例性实施例能够以多种形式实施,且不应被理解为限于在此阐述的实施方式;相反,提供这些实施方式使得本公开将全面和完整,并将示例性实施例的构思全面地传达给本领域的技术人员。在图中,相同的附图标记表示相同或类似的结构,因而将省略它们的详细描述。Exemplary embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete and will fully convey the concept of example embodiments. communicated to those skilled in the art. In the drawings, the same reference numerals denote the same or similar structures, and thus their detailed descriptions will be omitted.

此外,所描述的特征、结构或特性可以以任何合适的方式结合在一个或更多实施例中。在下面的描述中,提供许多具体细节从而给出对本公开的实施例的充分理解。然而,本领域技术人员将意识到,可以实践本公开的技术方案而没有所述特定细节中的一个或更多,或者可以采用其它的模块、步骤等。在其它情况下,不详细示出或描述公知结构以避免模糊本公开的各方面。Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided in order to give a thorough understanding of embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or other modules, steps, etc. may be employed. In other instances, well-known structures are not shown or described in detail to avoid obscuring aspects of the disclosure.

图1是根据一示例性实施例示出的一种用于数据打包的方法的流程示意图。Fig. 1 is a schematic flowchart of a method for data packaging according to an exemplary embodiment.

参考图1中所示,本示例实施方式中首先提供了一种用于数据打包的方法,可以包括以下步骤。Referring to FIG. 1 , this example embodiment firstly provides a method for data packaging, which may include the following steps.

在步骤S100中,根据上一次触发时间和频度触发相应的定时任务。In step S100, a corresponding timed task is triggered according to the last trigger time and frequency.

在示例性实施例中,所述方法还可以包括:根据业务需求,为所述待打包数据集创建打包调度器;通过所述打包调度器的页面创建所述定时任务及其打包分组策略参数、初始触发时间和频度并保存于所述数据库中。In an exemplary embodiment, the method may further include: according to business requirements, creating a packaging scheduler for the data set to be packaged; creating the timed task and its packaging and grouping policy parameters through the page of the packaging scheduler, The initial trigger time and frequency are also stored in the database.

在示例性实施例中,所述打包调度器可以为QuartzJob打包调度器。但本公开并不限定于此,这里仅是一个举例说明。In an exemplary embodiment, the packing scheduler may be a QuartzJob packing scheduler. However, the present disclosure is not limited thereto, and this is only an example for illustration.

QuartzJob是一个纯Java实现的作业调度工具,相当于数据库中的Job、Windows的计划任务、Unix/Linux下的Cron,但Quartz可以把排程控制的更精细,比起项目改版前的TaskTimer灵活方便了很多。QuartzJob is a job scheduling tool implemented in pure Java, which is equivalent to Job in the database, scheduled tasks in Windows, and Cron under Unix/Linux, but Quartz can control the scheduling more finely, which is more flexible and convenient than TaskTimer before the project revision a lot.

图3是根据一示例性实施例示出的一种打包调度器的页面示意图。图4是根据图3所示的打包调度器输入执行周期表达式的页面示意图。图3中以创建交行银保通的QuartzJob打包调度器为例进行说明,在该打包调度器的页面中可以输入打包分组策略参数及如图4所示的执行周期表达式(初始触发时间及频度)。如上图4所示,就创建了一个永久的交保通集合打包调度,分配了分包策略组,并且每隔5分钟执行一次。Fig. 3 is a schematic diagram of a page of a packaging scheduler according to an exemplary embodiment. Fig. 4 is a schematic diagram of a page for inputting an execution cycle expression according to the packaging scheduler shown in Fig. 3 . In Figure 3, the QuartzJob packaging scheduler created by Bank of Communications is used as an example to illustrate. On the page of the packaging scheduler, you can enter the packaging and grouping strategy parameters and the execution cycle expression (initial trigger time and frequency) as shown in Figure 4. Spend). As shown in Figure 4 above, a permanent traffic collection package scheduling is created, a subpackage strategy group is assigned, and it is executed every 5 minutes.

本发明实施例中,根据业务提出的需求,为指定范围内的待打包数据集合创建QuartzJob打包调度器(例如,可以通过页面化创建,类似填写表单),输入打包分组策略参数(现有一般是需要银行或第三方支付机构代码、收/付方向、时效、每包数量、频度等,当然本公开不限定于此),根据QuartzTrigger表达式定制调度器的执行时间(触发时间)及周期(频度)。打包调度器创建后,除非后期业务有变更,否则不需人工干涉程序,会一直周期执行。In the embodiment of the present invention, according to the requirements proposed by the business, a QuartzJob packaging scheduler is created for a set of data to be packaged within a specified range (for example, it can be created through pagination, similar to filling in a form), and the packaging and grouping strategy parameters are input (the existing ones are generally Require bank or third-party payment institution code, receipt/payment direction, timeliness, quantity per package, frequency, etc., of course, this disclosure is not limited to this), customize the execution time (trigger time) and period of the scheduler according to the QuartzTrigger expression ( Frequency). After the package scheduler is created, unless there is a later business change, it will be executed periodically without manual intervention.

在示例性实施例中,根据上一次触发时间和频度触发相应的定时任务包括:将所述定时任务的上一次触发时间和频度存储于所述数据库中;根据所述上一次触发时间和所述频度获得所述定时任务的下一次触发时间;进行时间监控,当当前时间等于所述下一次触发时间时,触发所述定时任务。即本发明实施例中,各任务的触发时间和频度的配置不是固定放在XML文件中的,而是将各任务的上一次触发时间和配置的频度存储到数据库中,进行时间监控时,从数据库中读取该任务的上一次触发时间和配置的频度,从而可以计算出下一次触发时间,并根据该下一次触发时间判断当前时间是否触发该任务。且QuartzJob新建任务可以通过页面完成,类似于填写普通表单,不在后台进行代码的编写。这样,就可以克服现有技术中新建任务时则需更改任务周期、更改XML配置、重新加载服务诸如此类的繁琐工作,并克服了现有技术中不利于项目长期运维及实施支持的技术问题。In an exemplary embodiment, triggering the corresponding timed task according to the last trigger time and frequency includes: storing the last trigger time and frequency of the timed task in the database; The frequency obtains the next trigger time of the scheduled task; time monitoring is performed, and when the current time is equal to the next trigger time, the scheduled task is triggered. That is, in the embodiment of the present invention, the configuration of the trigger time and frequency of each task is not fixed in the XML file, but the last trigger time of each task and the frequency of configuration are stored in the database. , read the last trigger time and configured frequency of the task from the database, so as to calculate the next trigger time, and judge whether the task is triggered at the current time according to the next trigger time. And the new task of QuartzJob can be completed through the page, similar to filling in a common form, without writing code in the background. In this way, it is possible to overcome the tedious work of changing the task cycle, changing the XML configuration, and reloading the service when creating a new task in the prior art, and overcome the technical problems in the prior art that are not conducive to long-term operation and maintenance of the project and implementation support.

图5是根据一示例性实施例示出的一种作业列表的页面示意图。如图5所示,上一次触发时间和下一次触发时间之差表示该定时任务(调度任务)自动触发的频度。在其他实施例中,也可以选中其中一条定时任务,点击执行就可以手动触发该任务。因此,本发明实施例使用QuartzJob调度器比起TaskTimer更加灵活,可以自由选择手动执行或自动执行。Fig. 5 is a schematic diagram of a job list page according to an exemplary embodiment. As shown in FIG. 5 , the difference between the last trigger time and the next trigger time indicates the frequency of automatic triggering of the scheduled task (scheduled task). In other embodiments, one of the scheduled tasks can also be selected, and the task can be manually triggered by clicking Execute. Therefore, the embodiment of the present invention uses the QuartzJob scheduler to be more flexible than the TaskTimer, and can freely choose manual execution or automatic execution.

本发明实施例中可以实现可配置化调整定时任务的频度、数量及任务流程。In the embodiment of the present invention, configurable adjustment of frequency, quantity and task flow of timing tasks can be realized.

在步骤S110中,从数据库中抽取所述定时任务对应的待打包数据集。In step S110, the data set to be packaged corresponding to the timed task is extracted from the database.

在步骤S120中,根据所述定时任务的策略参数获取相应的打包策略。In step S120, a corresponding packaging policy is obtained according to the policy parameters of the timed task.

打包策略是资金平台打包的一个总体抽象流程,作用是提高代码复用行、降低冗余和耦合。每一个调度作业都是打包策略的具体实现。The packaging strategy is an overall abstract process for the packaging of the fund platform, and its function is to improve code reuse and reduce redundancy and coupling. Each scheduling job is a concrete implementation of a packaging strategy.

在示例性实施例中,所述打包策略包括分包策略、拆包策略和包命名策略。In an exemplary embodiment, the packaging policy includes a subpackaging policy, an unpacking policy, and a package naming policy.

在示例性实施例中,所述包命名策略包括序列重置策略。In an exemplary embodiment, the package naming policy includes a sequence reset policy.

本发明实施例的设计模式如下:代码层面上引用了策略模式、工厂模式以及单例模式,把冗余的业务代码全部去除了,只保留分包策略、拆包策略、包命名策略及序列重置策略。各业务处理类都用接口的形式,把类名配置在数据库中,在项目首次引用时用工厂+懒加载的模式获取类对象,首次加载后,用单例模式+spring的事物保障打包工作的原子性。即将业务流程配置在数据库中,将类似的处理流程抽象成抽象处理流程,当来源数据调用策略组时,系统会加载该来源数据所对应的策略组并实例化,进而处理来源数据。当该组来源数据被实例了的策略组处理时,不会被其他策略组调用处理,各个处理组都是相对独立的。The design pattern of the embodiment of the present invention is as follows: the strategy pattern, the factory pattern and the singleton pattern are referenced on the code level, all the redundant business codes are removed, and only the subpackage strategy, unpacking strategy, package naming strategy and sequence repetition are retained. configuration strategy. Each business processing class uses the form of an interface, configures the class name in the database, and uses the factory + lazy loading mode to obtain the class object when the project is first referenced. After the first loading, use the singleton mode + spring to ensure the packaging work atomicity. That is to configure the business process in the database, and abstract similar processing processes into abstract processing processes. When the source data calls the policy group, the system will load and instantiate the policy group corresponding to the source data, and then process the source data. When the source data of this group is processed by the instanced policy group, it will not be called for processing by other policy groups, and each processing group is relatively independent.

其中,上述的策略模式是指定义一系列的算法,把每一个算法封装起来,并且使它们可相互替换。本模式使得算法可独立于使用它的客户而变化。将多个不同的数据操作抽象出多个流程。Among them, the above-mentioned strategy mode refers to defining a series of algorithms, encapsulating each algorithm, and making them interchangeable. This mode enables the algorithm to vary independently of the clients using it. Abstract multiple different data operations into multiple processes.

上述的工厂模式是指根据来源数据创建后续流程。The aforementioned factory pattern refers to the creation of subsequent processes based on source data.

上述的单例模式是指同一时间,只能运行一个该流程被创建和使用。The above-mentioned singleton mode means that only one process can be created and used at the same time.

上述的分包策略是把业务允许放在一个批处理的数据根据规定的策略抽取出来。分包策略是指按照业务系统的要求对来源数据进行第一步的筛选。The above-mentioned subcontracting strategy is to extract the data allowed by the business in a batch according to the specified strategy. The subcontracting strategy refers to the first step of screening the source data according to the requirements of the business system.

上述的拆包策略是指分包策略后抽取的数据再根据银行或第三方支付机构的要求(及策略)拆分成符合对端每次请求所要求的数据格式。The above-mentioned unpacking strategy means that the data extracted after the subpackaging strategy is split into a data format that meets the requirements of each request of the peer end according to the requirements (and strategies) of the bank or third-party payment institution.

上述的包命名策略是根据资金平台与银行和/或第三方支付机构的约定,每发给银行或第三方支付机构的数据都含有包名,这些包名就是区分、表明资金平台上每笔交易的唯一流水号。The above-mentioned package naming strategy is based on the agreement between the fund platform and the bank and/or third-party payment institution. Every data sent to the bank or third-party payment institution contains a package name. These package names are used to distinguish and indicate that each transaction on the fund platform unique serial number.

上述的序列重置策略是指根据包命名策略命名后的包名,其自定义序列部分可以有重复,因此,需要对其进行检查,当重复时,将其进行重置。The above-mentioned sequence reset strategy refers to the package name named according to the package naming strategy, and its custom sequence part may be repeated. Therefore, it needs to be checked, and if it is repeated, it will be reset.

在步骤S130中,根据所述打包策略对所述待打包数据集执行打包调度作业,完成所述待打包数据集的打包。In step S130, a packaging scheduling job is executed on the data set to be packaged according to the packaging policy, and the packaging of the data set to be packaged is completed.

整个打包调度作业可以分为三步骤完成:分包、拆包、包命名。下面分别对其进行说明。The entire packaging and scheduling job can be divided into three steps: subpackaging, unpacking, and package naming. Each of them will be described below.

在示例性实施例中,根据所述打包策略对所述待打包数据集执行打包调度作业,完成所述待打包数据集的打包包括:根据所述打包分组策略参数,将具有相同分包策略的所述待打包数据集中的数据分配至同一数据包中;遍历所述待打包数据集完成所述待打包数据集的分包。In an exemplary embodiment, according to the packaging policy, the package scheduling job is executed on the data set to be packaged, and completing the packaging of the data set to be packaged includes: according to the packaging and grouping policy parameters, grouping the data sets with the same package policy The data in the data set to be packaged is allocated to the same data package; the data set to be packaged is traversed to complete the subpackaging of the data set to be packaged.

当数据由其他渠道(例如各业务系统)进入资金平台时,第一次落地(存储到数据库中)会根据数据的来源、金额、收/付交易等属性去匹配策略组。策略组类似于工作流的流程,为根据已知的业务场景提炼到的规则,当新数据匹配到策略组,这笔数据所要流转的流程已经确定。本发明实施例中可以采用面向对象的写法。新增渠道把需要的数据配置写在数据库中,代码中用适配器模式去实现。When data enters the fund platform from other channels (such as various business systems), the first landing (stored in the database) will match the strategy group according to the source, amount, receipt/payment transaction and other attributes of the data. The policy group is similar to the workflow process, which is based on the rules extracted from known business scenarios. When new data matches the policy group, the flow of this data has been determined. The object-oriented writing method can be adopted in the embodiment of the present invention. The new channel writes the required data configuration in the database, and uses the adapter mode in the code to realize it.

在示例性实施例中,根据所述打包分组策略参数,将具有相同分包策略的所述待打包数据集中的数据分配至同一数据包中包括:将所述打包分组策略参数封装在HashMap中,并传递至所述定时任务;将所述打包分组策略参数组成分包策略key;将具有相同分包策略key的所述待打包数据集中的数据放在同一数据包中。In an exemplary embodiment, according to the packaging and grouping strategy parameters, allocating the data in the data set to be packaged with the same subpackaging strategy into the same data package includes: encapsulating the packaging and grouping strategy parameters in a HashMap, and passed to the timing task; the packaging and grouping strategy parameters are combined into a packetization strategy key; and the data in the data set to be packaged with the same packetization strategy key are placed in the same data packet.

在示例性实施例中,根据所述打包策略对所述待打包数据集执行打包调度作业,完成所述待打包数据集的打包还包括:根据所述拆包策略对分包后的数据包进行拆包。In an exemplary embodiment, performing a packing scheduling job on the data set to be packed according to the packing strategy, and completing the packing of the data set to be packed further includes: performing the packetizing on the data packets after packing according to the unpacking policy unpacking.

在示例性实施例中,根据所述拆包策略对分包后的数据包进行拆包包括:根据待发送渠道要求,将数据包的最大笔数限制配置在所述数据库中;初始化时将配置在所述数据库中的数据包的最大笔数限制加载在缓存中;拆包时根据所述打包分组策略参数,在所述缓存中取出相应数据包的最大笔数限制,对所述数据包进行拆包处理。In an exemplary embodiment, unpacking the subpackaged data packets according to the unpacking strategy includes: configuring the maximum number of data packets in the database according to the requirements of the channel to be sent; The maximum number of data packets in the database is limited and loaded in the cache; according to the packaging and grouping strategy parameters when unpacking, the maximum number of corresponding data packets is taken out from the cache, and the data packets are processed Unpacking process.

对分包后的每个包进行二次拆包。每个数据包都有最大笔数的限制,根据待发送的渠道要求都不一样,最大笔数限制配置在数据库中,项目初始化时加载到缓存里,拆包时会根据分包策略key,在缓存里取出最大笔数限制,进行二次拆包处理。例如渤海银行每包最大数量是2000,而保融每包最大数量是10000,渤海银行和保融都是第三方支付机构。在其他实施例中,可以根据第三方的报文及盘文件限制每隔数据包的最大笔数数量,从而根据各数据包的最大笔数限制进行二次拆包。Perform secondary unpacking for each package after subpackaging. Each data packet has a maximum number limit, which varies according to the channel requirements to be sent. The maximum number limit is configured in the database, loaded into the cache when the project is initialized, and will be unpacked according to the subpackage policy key. The maximum number of transactions is taken out of the cache, and the second unpacking process is performed. For example, the maximum quantity per package of Bohai Bank is 2,000, while the maximum quantity per package of Baorong is 10,000. Both Bohai Bank and Baorong are third-party payment institutions. In other embodiments, the maximum number of transactions per data packet may be limited according to the third-party message and disk file, so that secondary unpacking is performed according to the maximum number of transactions in each data packet.

在示例性实施例中,根据所述打包策略对所述待打包数据集执行打包调度作业,完成所述待打包数据集的打包还包括:根据所述包命名策略对拆包后的数据包创建包号。In an exemplary embodiment, executing a package scheduling job on the data set to be packaged according to the package policy, and completing the package of the data set to be packaged further includes: creating an unpacked data package according to the package naming policy package number.

在示例性实施例中,根据所述包命名策略对拆包后的数据包创建包号包括:根据所述打包分组策略参数,在所述数据库中配置命名策略参数、输出规则、拼接顺序以及序列重置策略;读取所述序列重置策略,判断自定义序列是否需要重置;根据所述拼接顺序,依次读取命名规则,将各命名规则输出字符串拼接成完整的包号。In an exemplary embodiment, creating a packet number for the unpacked data packet according to the packet naming strategy includes: configuring naming strategy parameters, output rules, splicing order and sequence in the database according to the packaging and grouping strategy parameters Reset strategy; read the sequence reset strategy to determine whether the custom sequence needs to be reset; read the naming rules sequentially according to the splicing sequence, and splice the output strings of each naming rule into a complete package number.

在示例性实施例中,所述包号的命名规则根据待发送渠道要求制定,其包括文件名和/或报文的流水号。In an exemplary embodiment, the naming rule of the packet number is formulated according to the requirements of the channel to be sent, which includes the file name and/or the serial number of the message.

每个数据包(二次拆包之后的数据包)都需要创建包号,包号的命名规则主要以待发送渠道的要求为主。可以为文件名,或者是报文的流水号(例如,通联渠道的包名与FTP文件名相同,工商银行的单笔实时交易的包名就是报文的流水号)。根据每个分包策略key,在数据库配置了完整的命名策略参数(不同命名策略对应的包命名方法,命名策略是各渠道要求包命名规则的策略集合)、输出规则、拼接顺序以及序列重置策略等。先读取序列重置策略,决定自定义序列是否重置。然后根据拼接顺序,依次读取命令规则,将各规则输出字符串拼接成完整的包名。其中,这个包名经过资金平台和银行或第三方支付机构讨论过后的包名命名标准,作用是为了保证包号的独一无二(全局绝对独立)和银行或第三方支付机构和资金平台处理方便。Each data packet (the data packet after the second unpacking) needs to create a packet number, and the naming rules of the packet number are mainly based on the requirements of the channel to be sent. It can be the file name, or the serial number of the message (for example, the package name of the communication channel is the same as the FTP file name, and the package name of a single real-time transaction of Industrial and Commercial Bank of China is the serial number of the message). According to each subpackage policy key, complete naming strategy parameters (package naming methods corresponding to different naming strategies, naming strategy is a set of policies requiring package naming rules for each channel), output rules, splicing order and sequence reset are configured in the database strategy etc. First read the sequence reset policy to determine whether the custom sequence is reset. Then read the command rules sequentially according to the splicing sequence, and splice the output strings of each rule into a complete package name. Among them, this package name is a package name naming standard after discussion between the funding platform and the bank or third-party payment institution.

还是以图3为参考,在示例的招行银保通渠道的开发中,服务方规定发盘文件命名:类型标识_机构代码(4位)_日期(8位)_自定义序号(5位),根据资金平台的业务架构,需要把该数据集合包(即数据包,待发送的业务数据集合)命名为文件名。Still referring to Figure 3, in the example development of China Merchants Bank’s Bank-Insurance-Pass channel, the service provider stipulates the name of the offer file: type identification_organization code (4 digits)_date (8 digits)_custom serial number (5 digits) , according to the business structure of the fund platform, it is necessary to name the data collection package (that is, the data package, the business data collection to be sent) as the file name.

其中,上述的类型标识可以有4种业务类型,例如101-对公付款,102-对私付款,103-对公收款,104-对私收款。但本公开不限定于此。Wherein, the above-mentioned type identification can have 4 business types, for example, 101-public payment, 102-private payment, 103-public collection, 104-private collection. However, the present disclosure is not limited thereto.

分析需要调用的打包命名策略。命名策略可以配置在BE_SEQRULE表(打包策略表,保存在数据库中)中,如下表一所示。Analyze the packaging naming strategy that needs to be invoked. The naming strategy can be configured in the BE_SEQRULE table (packaging strategy table, stored in the database), as shown in Table 1 below.

表一Table I

其中,表一中的PART_NUM表示拼接顺序;PART_CLASS表示需要调用的命名策略序号;PART_VALUE表示命名策略方法调用参数;Among them, PART_NUM in Table 1 indicates the splicing sequence; PART_CLASS indicates the serial number of the naming strategy that needs to be called; PART_VALUE indicates the calling parameter of the naming strategy method;

PART_LENGTH表示命名参数返回串长度,字符串不够补_,数字不够补0。PART_LENGTH indicates the length of the returned string of the named parameter, if the string is not enough, add _, and if the number is not enough, add 0.

下面以一段示例性程序为例进行说明:Let's take a sample program as an example to illustrate:

例如,PART_CLASS=2,调用Case 2:获取当前八位日期partValue=ToolUtil.getNowDate();PART_CLASS=5是读取序列表,获取当前序列。最终的输出包号:101_110Z_20161014_000001(示例)。For example, PART_CLASS=2, call Case 2: obtain the current eight-digit date partValue=ToolUtil.getNowDate(); PART_CLASS=5 read the sequence table and obtain the current sequence. The final output package number: 101_110Z_20161014_000001 (example).

现有的包命名策略已经很完善了,满足绝大部分渠道的打包需求,如遇上特殊的需求,代码层面只需要新增命名策略以及序列重置策略,就是增加抽象策略的配置。业务参数(一般包括银行或第三方支付机构代码、收付方向、时效、每包数量、频度等,但不限于这些,具体情况有时还需具体分析)的配置信息由运维团队完成即可。The existing package naming strategy is already perfect, meeting the packaging needs of most channels. If special needs are encountered, the code level only needs to add a naming strategy and a sequence reset strategy, which is to increase the configuration of an abstract strategy. The configuration information of business parameters (generally including bank or third-party payment institution code, payment direction, timeliness, quantity per package, frequency, etc., but not limited to these, and specific situations need to be analyzed in detail) can be completed by the operation and maintenance team .

在示例性实施例中,将打包完成的数据包返回至所述数据库中进行存储。In an exemplary embodiment, the packaged data package is returned to the database for storage.

本发明实施方式提供的用于数据打包的方法,代码专注写各种策略(分包策略、拆包策略、包命名策略及序列重置策略),业务参数(来源系统、收/付方向,去向的银行或第三方支付机构等)都配置在数据库中,实现了功能模块与业务的低耦合,可以扩展更多的业务。后期策略完善后,新增业务只需交给运维团队在数据库中做配置即可(可手工干预数据库,也可以页面化新增策略组)。一方面,解决了资金平台与银行及第三方支付公司交易打包差异性(包括包命名规则、每包数量、收付方向等第三方支付机构和银行所要求的包号命名规范,以及资金平台对包名的命名标准等)、开发过程中代码冗余性、可扩展性及兼容性比较弱的问题;另一方面,提升了开发效率、代码重复率及后期项目运维成本并且降低了开发风险。In the method for data packaging provided by the embodiment of the present invention, the code focuses on writing various strategies (subpackage strategy, unpacking strategy, package naming strategy and sequence reset strategy), business parameters (source system, receipt/payment direction, destination) Banks or third-party payment institutions, etc.) are configured in the database, which realizes the low coupling between functional modules and services, and can expand more services. After the strategy is perfected in the later period, the new business only needs to be handed over to the operation and maintenance team for configuration in the database (the database can be manually intervened, or a new strategy group can be added in a page). On the one hand, it solves the difference in transaction packaging between the fund platform and banks and third-party payment companies (including package naming rules, quantity per package, payment direction, etc. Package name naming standards, etc.), code redundancy, scalability and compatibility problems in the development process are relatively weak; on the other hand, it improves development efficiency, code repetition rate and post-project operation and maintenance costs and reduces development risks .

图2是根据一示例性实施例示出的一种用于数据打包的方法的系统架构示意图。Fig. 2 is a schematic diagram of a system architecture showing a method for data packaging according to an exemplary embodiment.

打包调度器进行时间监听,查找当前时间点有触发任务的触发器。The package scheduler monitors the time and finds the trigger that triggers the task at the current time point.

其中,调度器Scheduler在启动的时候会开启一个线程Thread,Thread会不停循环的根据当前时间到数据库查询该时间点会触发作业的活动的触发器Trigger。任务调度是指设置固定的时间点、时间间隔或者执行次数自动执行任务。定时任务是在指定时间点或一个日期范围内以指定的周期按指定的频率自动被调起的任务,它的调度执行无需人工干预,按来源主要分为两类,一类是联机交易时根据交易环境预约的任务,一类是项目上线时直接预埋在数据库的任务。Among them, the scheduler Scheduler will open a thread Thread when it is started, and the Thread will continuously loop to the database according to the current time to query the trigger that will trigger the activity of the job at that time point. Task scheduling refers to setting a fixed time point, time interval or number of executions to automatically execute tasks. A scheduled task is a task that is automatically called up at a specified period and frequency at a specified time point or within a date range. Its scheduling execution does not require manual intervention. It is mainly divided into two categories according to the source. One is based on online transactions. The task reserved in the trading environment, one type is the task that is directly embedded in the database when the project goes online.

响应触发指令,将数据库中待实例化的定时任务数据实例化为定时任务实例,并存储至数据库。Responding to the trigger instruction, the scheduled task data to be instantiated in the database is instantiated as a scheduled task instance, and stored in the database.

具体地,这里的触发条件可以为:按照预设的扫描周期,扫描数据库中是否存在定时任务数据,若发现存在定时任务数据,则确定满足触发指令。Specifically, the trigger condition here may be: according to the preset scan cycle, scan whether there is scheduled task data in the database, and if it is found that the scheduled task data exists, then determine that the trigger instruction is satisfied.

定时任务数据只有被实例化为具体的定时任务实例支行才能够进行后续的处理。定时任务实例化的过程中,需要参考任务周期数据及系统当前时间,生成一条定时任务实例,并将生成的定时任务实例存储至数据库中。例如一个周期任务为每天17点批量付款,当前时间为11月1日8点,则生成一条执行时间为11月1日17点的定时任务实例。Timed task data can only be processed later if it is instantiated into a specific timed task instance branch. During the instantiation of a scheduled task, it is necessary to refer to the task cycle data and the current system time to generate a scheduled task instance and store the generated scheduled task instance in the database. For example, a periodic task is batch payment at 17:00 every day, and the current time is 8:00 on November 1st, then a scheduled task instance with execution time at 17:00 on November 1st will be generated.

然后,调起数据库中待执行的定时任务实例。Then, invoke the scheduled task instance to be executed in the database.

具体地,与上述触发指令相似的,按照预设的扫描周期,扫描数据库中是否存在定时任务实例,若发现存在定时任务实例,则调用Spring-batch框架的JOB执行所述待执行的定时任务实例。Specifically, similar to the trigger instruction above, scan the database for a scheduled task instance according to the preset scan cycle, and if it finds that there is a scheduled task instance, call the JOB of the Spring-batch framework to execute the scheduled task instance to be executed .

定时任务实例开始执行后,资金平台从数据库(例如,db2)中获取待打包数据集。After the scheduled task instance starts to execute, the capital platform obtains the data set to be packaged from the database (for example, db2).

接着,从分包调度作业缓存中获取相应的打包策略,对所述待打包数据集执行分包调度作业。Next, obtain the corresponding packaging strategy from the subpackage scheduling job cache, and execute the subpackage scheduling job on the data set to be packaged.

QuartzJob调度器创建的打包分组策略参数可以封装在HashMap(但本公开并不限定于此)里,传递到JOB(实例后的任务,也就是需要执行的任务)中。通过SpringJdbc(可以理解为数据库交互,从数据库中获取待打包数据集)获取待打包数据集,业务层将策略参数组成key(例如,一种分包策略一个编号,方便系统快速获取),具有相同key的数据集合放到一个list(一个带序号的集合)里面。遍历全部业务数据(全部业务数据等于所有待打包数据)完成第一次分包(即图2中的分组,将使用相同分包策略的数据分在同一组)。The packaging and grouping policy parameters created by the QuartzJob scheduler can be encapsulated in a HashMap (but the present disclosure is not limited thereto) and passed to the JOB (the task behind the instance, that is, the task to be executed). The data set to be packaged is obtained through SpringJdbc (which can be understood as database interaction, and the data set to be packaged is obtained from the database). The business layer forms the policy parameters into a key (for example, a subpackage strategy with a number, which is convenient for the system to quickly obtain), with the same The data collection of the key is placed in a list (a collection with serial numbers). Traverse all business data (all business data is equal to all data to be packaged) to complete the first subpackage (that is, grouping in Figure 2, grouping data using the same subpackaging strategy into the same group).

接着,根据第三方(银行或第三方支付机构)的限制,对分包后的数据包进行二次拆包。这里二次拆包后的包的数量不会小于1。其中每个包中1条指令就是一笔待转账的交易明细。Then, according to the restriction of the third party (bank or third-party payment institution), the subpackaged data package is unpacked for the second time. Here, the number of packages after the second unpacking will not be less than 1. One instruction in each package is the transaction details to be transferred.

其次,对拆包后的数据包进行数据落地。其中数据落地就是数据存储到db2数据库的指令表。Second, perform data landing on the unpacked data packets. Among them, the data landing is the instruction table for data storage to the db2 database.

在图2所示的实施例中,还可以包括:将指令(例如,业务系统发出的业务指令)与包信息落地,且使本包处于待发送状态。In the embodiment shown in FIG. 2 , it may further include: landing the instruction (for example, a service instruction issued by the service system) and the package information, and making the package in a state to be sent.

目前开发完的各种策略很完善,足以满足绝大部分的渠道需求。如果有特殊需求,开发团队只需增加对应的策略即可。整个模块变得很清爽,扩展性非常的强。对于亲上手同事在不接触代码的情况下,理解各种策略,即能通过页面化操作独立完成新增渠道的打包调度作业或修改原有的打包调度作业,极大缩短了后期的开发及维护工作。The various strategies that have been developed so far are perfect and sufficient to meet most of the channel needs. If there are special needs, the development team only needs to add corresponding strategies. The whole module becomes very refreshing, and the scalability is very strong. For hands-on colleagues who understand various strategies without touching the code, they can independently complete the packaging and scheduling operations of the new channel or modify the original packaging and scheduling operations through page-based operations, which greatly shortens the later development and maintenance. Work.

图6是根据一示例性实施例示出的一种用于数据打包的装置的模块示意图。Fig. 6 is a schematic block diagram of a device for packing data according to an exemplary embodiment.

本示例实施方式中还提供了一种用于数据打包的装置10,可以包括:任务触发模块100、数据抽取模块110、打包策略获取模块120以及打包调度模块130。This example implementation also provides an apparatus 10 for data packaging, which may include: a task trigger module 100 , a data extraction module 110 , a packaging policy acquisition module 120 and a packaging scheduling module 130 .

其中任务触发模块100可以用于根据上一次触发时间和频度触发相应的定时任务。The task triggering module 100 can be used to trigger corresponding timed tasks according to the last trigger time and frequency.

数据抽取模块110可以用于从数据库中抽取所述定时任务对应的待打包数据集。The data extraction module 110 may be configured to extract the data set to be packaged corresponding to the scheduled task from the database.

打包策略获取模块120可以用于根据所述定时任务的策略参数获取相应的打包策略。The packaging policy acquisition module 120 may be configured to acquire a corresponding packaging policy according to the policy parameters of the timed task.

打包调度模块130可以用于根据所述打包策略对所述待打包数据集执行打包调度作业,完成所述待打包数据集的打包。The packaging scheduling module 130 may be configured to execute a packaging scheduling job on the data set to be packaged according to the packaging strategy, and complete the packaging of the data set to be packaged.

关于上述用于数据打包的装置,其中各个模块执行操作的具体方式已经在有关用于数据打包的方法的示例性实施例中进行了详细描述,此处将不做详细阐述说明。Regarding the above-mentioned apparatus for data packaging, the specific manner in which each module performs operations has been described in detail in the exemplary embodiment of the method for data packaging, and will not be described in detail here.

本示例实施方式中还提供了一种电子设备,包括:处理器;以及存储器,用于存储所述处理器的可执行指令。其中,所述处理器可以被配置为执行上述任意实施例中所述的用于数据打包的方法。This exemplary embodiment also provides an electronic device, including: a processor; and a memory, configured to store executable instructions of the processor. Wherein, the processor may be configured to execute the method for packing data described in any of the above embodiments.

以上所述仅为本公开的部分示例性实施例,并不用以限制本公开,凡在本公开的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本公开的保护范围之内。The above descriptions are only some exemplary embodiments of the present disclosure, and are not intended to limit the present disclosure. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present disclosure shall be included in the present disclosure. within the scope of protection.

Claims (16)

1. a kind of method packed for data, it is characterised in that including:
Corresponding timed task is triggered according to last triggered time and frequency;
Extract that the timed task is corresponding to treat packing data collection from database;
Corresponding packing strategy is obtained according to the policing parameter of the timed task;
According to it is described packing strategy to it is described treat packing data collection perform packing schedule job, complete described in treat packing data collection Packing.
2. the method according to claim 1 packed for data, it is characterised in that according to last triggered time and frequency The corresponding timed task of degree triggering includes:
The last triggered time of the timed task and frequency are stored in the database;
The triggered time next time of the timed task is obtained according to the last triggered time and the frequency;
Time monitoring is carried out, when current time is equal to the triggered time next time, the timed task is triggered.
3. the method according to claim 1 packed for data, it is characterised in that methods described also includes:
It is described to treat that packing data collection creates packing scheduler according to business demand;
Pass through timed task and its packing grouping strategy parameter, initial trigger time described in the page creation of the packing scheduler With frequency and be stored in the database.
4. the method according to claim 3 packed for data, it is characterised in that the packing scheduler is QuartzJob packing schedulers.
5. the method according to claim 3 packed for data, it is characterised in that the packing strategy includes subpackage plan Summary, unpack strategy and bag naming policy.
6. the method according to claim 5 packed for data, it is characterised in that the bag naming policy includes sequence Reset strategy.
7. the method according to claim 5 packed for data, it is characterised in that according to the packing strategy to described Treat packing data collection perform packing schedule job, complete described in treat that the packing of packing data collection includes:
According to the packing grouping strategy parameter, by with the data distribution that packing data concentration is treated described in identical subpackage strategy Into same packet;
The traversal subpackage for treating to treat packing data collection described in the completion of packing data collection.
8. the method according to claim 7 packed for data, it is characterised in that according to the packing grouping strategy ginseng Number, will include with data distribution to the same packet that packing data concentration is treated described in identical subpackage strategy:
The packing grouping strategy parameter is encapsulated in HashMap, and is transferred to the timed task;
By the packing grouping strategy parameter group into subpackage strategy key;
It will be placed on the data that packing data concentration is treated described in identical subpackage strategy key in same packet.
9. the method according to claim 7 packed for data, it is characterised in that according to the packing strategy to described Treat packing data collection perform packing schedule job, complete described in treat that the packing of packing data collection also includes:
The packet after subpackage is unpacked according to the strategy of unpacking.
10. the method according to claim 9 packed for data, it is characterised in that according to the strategy of unpacking to dividing Packet after bag unpacked including:
Required according to channel to be sent, by the maximum stroke count limitation arrangement of packet in the database;
The maximum stroke count limitation loading of packet during initialization by configuration in the database is in the buffer;
According to the packing grouping strategy parameter when unpacking, the maximum stroke count limitation of corresponding data bag is taken out in the caching, Processing of unpacking is carried out to the packet.
11. the method according to claim 9 packed for data, it is characterised in that according to the packing strategy to institute State and treat the execution packing schedule job of packing data collection, treat that the packing of packing data collection also includes described in completion:
According to the bag naming policy to unpacking after packet create Bale No..
12. the method according to claim 11 packed for data, it is characterised in that according to the bag naming policy pair Packet after unpacking, which creates Bale No., to be included:
According to the packing grouping strategy parameter, naming policy parameter, output rule, splicing order are configured in the database And sequence resets strategy;
Read the sequence and reset strategy, judge whether custom list needs replacement;
According to splicing order, naming rule is successively read, each naming rule output string is spliced into complete Bale No..
13. the method according to claim 12 packed for data, it is characterised in that the naming rule root of the Bale No. Require to formulate according to channel to be sent, it includes the serial number of filename and/or message.
14. the method according to claim 11 packed for data, it is characterised in that return the packet for completion of packing It is back in the database and is stored.
15. a kind of device packed for data, it is characterised in that including:
Task trigger module, for triggering corresponding timed task according to last triggered time and frequency;
Data extraction module, for being extracted from database, the timed task is corresponding to treat packing data collection;
The tactful acquisition module of packing, for obtaining corresponding packing strategy according to the policing parameter of the timed task;
Packing scheduler module, for treating that packing data collection performs packing schedule job, completion to described according to the packing strategy The packing for treating packing data collection.
16. a kind of electronic equipment, it is characterised in that including:
Processor;And
Memory, the executable instruction for storing the processor;
Wherein, the processor, which is configured as performing in the claims 1-14 described in any one, is used for what data were packed Method.
CN201710235637.2A 2017-04-12 2017-04-12 Method, device and electronic device for data packaging Active CN107085605B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710235637.2A CN107085605B (en) 2017-04-12 2017-04-12 Method, device and electronic device for data packaging

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710235637.2A CN107085605B (en) 2017-04-12 2017-04-12 Method, device and electronic device for data packaging

Publications (2)

Publication Number Publication Date
CN107085605A true CN107085605A (en) 2017-08-22
CN107085605B CN107085605B (en) 2020-06-09

Family

ID=59612632

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710235637.2A Active CN107085605B (en) 2017-04-12 2017-04-12 Method, device and electronic device for data packaging

Country Status (1)

Country Link
CN (1) CN107085605B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109254835A (en) * 2018-06-27 2019-01-22 阿里巴巴集团控股有限公司 Processing method, device, server and the readable storage medium storing program for executing of batch processing task
CN109683945A (en) * 2018-12-12 2019-04-26 泰康保险集团股份有限公司 Routine interface processing method and system, its computer-readable medium and electronic equipment
CN109828955A (en) * 2019-01-10 2019-05-31 浙江数链科技有限公司 Document processing method, device, computer equipment and storage medium
CN110968401A (en) * 2018-09-28 2020-04-07 北京国双科技有限公司 Task scheduling method and device based on Quartz
CN111125168A (en) * 2019-11-07 2020-05-08 网银在线(北京)科技有限公司 Data processing method and device, electronic equipment and storage medium
CN115348217A (en) * 2022-08-16 2022-11-15 青岛海信智慧生活科技股份有限公司 Method for packaging data and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101887381A (en) * 2010-06-22 2010-11-17 北京伟库电子商务科技有限公司 Method and device for configuring timing tasks based on Quartz frame
CN103390041A (en) * 2013-07-18 2013-11-13 杭州东信北邮信息技术有限公司 Method and system for providing data service based on middleware
CN104063273A (en) * 2014-06-13 2014-09-24 航天恒星科技有限公司 Center control type business process dispatching management system and realizing method
CN105138598A (en) * 2015-08-05 2015-12-09 深圳联友科技有限公司 Method and system for remotely timing task
CN105426238A (en) * 2016-01-17 2016-03-23 浙江维融电子科技股份有限公司 Control method of equipment background instruction management system based on memory

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101887381A (en) * 2010-06-22 2010-11-17 北京伟库电子商务科技有限公司 Method and device for configuring timing tasks based on Quartz frame
CN103390041A (en) * 2013-07-18 2013-11-13 杭州东信北邮信息技术有限公司 Method and system for providing data service based on middleware
CN104063273A (en) * 2014-06-13 2014-09-24 航天恒星科技有限公司 Center control type business process dispatching management system and realizing method
CN105138598A (en) * 2015-08-05 2015-12-09 深圳联友科技有限公司 Method and system for remotely timing task
CN105426238A (en) * 2016-01-17 2016-03-23 浙江维融电子科技股份有限公司 Control method of equipment background instruction management system based on memory

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109254835A (en) * 2018-06-27 2019-01-22 阿里巴巴集团控股有限公司 Processing method, device, server and the readable storage medium storing program for executing of batch processing task
CN110968401A (en) * 2018-09-28 2020-04-07 北京国双科技有限公司 Task scheduling method and device based on Quartz
CN109683945A (en) * 2018-12-12 2019-04-26 泰康保险集团股份有限公司 Routine interface processing method and system, its computer-readable medium and electronic equipment
CN109828955A (en) * 2019-01-10 2019-05-31 浙江数链科技有限公司 Document processing method, device, computer equipment and storage medium
CN111125168A (en) * 2019-11-07 2020-05-08 网银在线(北京)科技有限公司 Data processing method and device, electronic equipment and storage medium
CN111125168B (en) * 2019-11-07 2023-11-03 网银在线(北京)科技有限公司 Data processing method and device, electronic equipment and storage medium
CN115348217A (en) * 2022-08-16 2022-11-15 青岛海信智慧生活科技股份有限公司 Method for packaging data and electronic equipment
CN115348217B (en) * 2022-08-16 2024-03-22 青岛海信智慧生活科技股份有限公司 Method for packaging data and electronic equipment

Also Published As

Publication number Publication date
CN107085605B (en) 2020-06-09

Similar Documents

Publication Publication Date Title
CN107085605A (en) Method, device and electronic equipment for data packaging
CN104216912B (en) The implementation method and device of a kind of business form work fluidisation without intrusive mood
CN110147990B (en) Payment withholding subscription method and device based on block chain and electronic equipment
CN109285071B (en) Data processing platform and data processing method based on block chain
CN109240900A (en) Block chain network service platform and its intelligent contract detection method, storage medium
US10296297B2 (en) Execution semantics for sub-processes in BPEL
WO2021031472A1 (en) Intelligent contract processing method and device, computer device and storage medium
CN112612624B (en) Method, device, computer equipment and storage medium for data interaction between systems
CN112351076B (en) Recommendation system API generation method, device, electronic device and storage medium
WO2021139778A1 (en) System scheduling workflow generation method, system, apparatus, and computer readable storage medium
CN111338604A (en) Service generation method, apparatus, device, and computer-readable storage medium
CN109740765A (en) A kind of machine learning system building method based on Amazon server
WO2023098041A1 (en) Method and apparatus for executing blockchain transaction
CN108243012A (en) Billing application processing system, method and device in online billing system OCS
US9552239B2 (en) Using sub-processes across business processes in different composites
CN115328457A (en) Method and device for realizing form page based on parameter configuration
CN110175119A (en) A kind of test method of interface, calculates equipment and storage medium at device
CN110941422B (en) Code automatic generation method, code generator and readable storage medium
CN111309378A (en) Machine learning model life cycle management system and method
US9632763B2 (en) Sharing of flows in a stream processing system
CN113626510A (en) Transaction checking method, device, electronic equipment and storage medium
CN109933325A (en) A kind of dex file construction method, apparatus and system
CN118014567A (en) Intelligent contract calling method and device
US9141383B2 (en) Subprocess definition and visualization in BPEL
CN115033290B (en) A microservice splitting method, device and terminal device based on instruction set

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