简体   繁体   English

如何运行每月发送一次账单给客户的程序?

[英]How to run program that sends bills to customers once a month?

I have a table in database with users and their expenses for traveling. 我在数据库中有一张表,其中包含用户及其出行费用。 I am using GWT and want to run a code once a month, that would query the database and send bills as PDFs to customers. 我正在使用GWT,并且希望每月运行一次代码,这将查询数据库并将账单作为PDF发送给客户。 I know how to create PDFs and send emails from servlet. 我知道如何从servlet创建PDF和发送电子邮件。 How to run a program in java (or some other script if it isn't possible with java) that would run once a month? 如何使用每月运行一次的Java(如果无法使用Java,则运行其他脚本)程序?

Tnx 特纳克斯

Unix and derivatives: use cron -> http://en.wikipedia.org/wiki/Cron Unix及其衍生版本:使用cron-> http://en.wikipedia.org/wiki/Cron

Windows: use task scheduler -> http://support.microsoft.com/kb/308569 Windows:使用任务计划程序-> http://support.microsoft.com/kb/308569

If you want to get fancy and do it purely in java: -> http://www.quartz-scheduler.org/ , but do consider OS scheduler first. 如果您想花哨并仅在java中进行操作:-> http://www.quartz-scheduler.org/ ,但请首先考虑使用OS调度程序。

you have many choices. 您有很多选择。

If you are under Unix, the simpliest solution is a batch scheduled with a crontab . 如果您使用的是Unix,最简单的解决方案是使用crontab调度的批处理。

If you prefer a 100% java solution, the Quartz framework is a robust a easy to setup solution. 如果您更喜欢100%java解决方案,那么Quartz框架是一个健壮且易于设置的解决方案。

To avoid "re-inventing the wheel" I suggest using http://www.freshbooks.com/ and tying your app into their API to send your bills. 为了避免“重新发明轮子”,我建议使用http://www.freshbooks.com/并将您的应用程序绑定到其API中以发送帐单。 You can easily set up recurrence as a billing option so that the bills get re-sent (along with reminders) each month. 您可以轻松地将循环设置为计费选项,以便每月重新发送帐单(以及提醒)。 The user can then grab the PDF version of their bill. 然后,用户可以获取其账单的PDF版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM