123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- package com.gyee.main;
- import java.util.Calendar;
- import java.util.List;
- import org.springframework.context.ApplicationContext;
- import org.springframework.context.support.ClassPathXmlApplicationContext;
- import com.gyee.model.Wttragetreport3;
- import com.gyee.model.Wttragetreportfnlyl3;
- import com.gyee.model.Wttragetreportkkxfx3;
- import com.gyee.model.Wttragetreportmain3;
- import com.gyee.model.Wttragetreportnhyd3;
- import com.gyee.model.Wttragetreportpart3;
- import com.gyee.model.Wttragetreportxndjpj3;
- import com.gyee.service.WtReportService;
- import com.gyee.service.WttragetreportService;
- import com.gyee.service.WttragetreportchartService;
- import com.gyee.service.WttragetreportfnlylService;
- import com.gyee.service.WttragetreportkkxfxService;
- import com.gyee.service.WttragetreportmainService;
- import com.gyee.service.WttragetreportnhydService;
- import com.gyee.service.WttragetreportpartService;
- import com.gyee.service.WttragetreportxndjpjService;
- import com.gyee.util.StringUtils;
- public class StartUp {
- public static void main(String[] args) throws Exception {
- ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath*:applicationContext.xml");
-
- WttragetreportService wttragetreportService = (WttragetreportService) ctx.getBean("wttragetreportService");
- WttragetreportchartService wttragetreportchartService = (WttragetreportchartService) ctx.getBean("wttragetreportchartService");
-
- WttragetreportpartService wttragetreportpartService = (WttragetreportpartService) ctx.getBean("wttragetreportpartService");
-
- WttragetreportmainService wttragetreportmainService = (WttragetreportmainService) ctx.getBean("wttragetreportmainService");
- WttragetreportfnlylService wttragetreportfnlylService = (WttragetreportfnlylService) ctx.getBean("wttragetreportfnlylService");
- WttragetreportkkxfxService wttragetreportkkxfxService = (WttragetreportkkxfxService) ctx.getBean("wttragetreportkkxfxService");
-
- WttragetreportnhydService wttragetreportnhydService = (WttragetreportnhydService) ctx.getBean("wttragetreportnhydService");
- WttragetreportxndjpjService wttragetreportxndjpjService = (WttragetreportxndjpjService) ctx.getBean("wttragetreportxndjpjService");
- WtReportService wtReportService = (WtReportService) ctx.getBean("wtReportService");
-
-
- System.out.println("风机健康报告调度程序执行开始!........");
- try {
- Calendar cal = Calendar.getInstance();
- cal.set(Calendar.HOUR_OF_DAY, 0);
- cal.set(Calendar.MINUTE, 0);
- cal.set(Calendar.SECOND, 0);
- //Wttragetreport3 wtr = wttragetreportService.findTargetReportByDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH) + 1);
- Wttragetreport3 wtr = wttragetreportService.findTargetReportByDate(cal.getTime());
- if (StringUtils.notEmp(wtr)) {
- wttragetreportService.deleteWttragetreport(wtr.getId());
- wttragetreportmainService.deleteWttragetreportmain(wtr.getId());
- wttragetreportchartService.deleteWttragetreportchart(wtr.getId());
- wttragetreportfnlylService.deleteWttragetreportfnlyl(wtr.getId());
- wttragetreportpartService.deleteWttragetreportpart(wtr.getId());
- wttragetreportkkxfxService.deleteWttragetreportkkxfx(wtr.getId());
- wttragetreportnhydService.deleteWttragetreportnhyd(wtr.getId());
- wttragetreportxndjpjService.deleteWttragetreportxndjpj(wtr.getId());
- wttragetreportService.deleteWttragetreport(wtr.getId());
- }
- // }
- Wttragetreport3 ls0 = wttragetreportService.inistalWttragetreport();
- System.out.println("主表数据初始化完成");
- wttragetreportService.insertWttragetreport(ls0);
- System.out.println("主表数据保存完成");
- List<Wttragetreportmain3> ls1 = wttragetreportmainService.inistalWttragetreportmain(ls0.getId());
-
- System.out.println("重要指标表数据初始化完成");
- if (!ls1.isEmpty()) {
- for (Wttragetreportmain3 po : ls1) {
- wttragetreportmainService.insertWttragetreportmain(po);
- }
- }
- System.out.println("重要指标表数据保存完成");
- // List<Wttragetreportchart3> ls2 = wttragetreportchartService.inistalWttragetreportchart(ls0.getId());
- // System.out.println("图表数据初始化完成");
- // if (!ls2.isEmpty()) {
- // for (Wttragetreportchart3 po : ls2) {
- // wttragetreportchartService.insertWttragetreportchart(po);
- // }
- // }
- wttragetreportchartService.inistalWttragetreportchart(ls0.getId(),wttragetreportchartService);
- System.out.println("图表数据保存完成");
- List<Wttragetreportfnlyl3> ls3 = wttragetreportfnlylService.inistalWttragetreportfnlyl(ls0.getId());
- System.out.println("风能利用率数据初始化完成");
- if (!ls3.isEmpty()) {
- for (Wttragetreportfnlyl3 po : ls3) {
- wttragetreportfnlylService.insertWttragetreportfnlyl(po);
- }
- }
- System.out.println("风能利用率数据保存完成");
- List<Wttragetreportpart3> ls4 = wttragetreportpartService.inistalWttragetreportpart(ls0.getId());
- System.out.println("部件数据数据初始化完成");
- if (!ls4.isEmpty()) {
- for (Wttragetreportpart3 po : ls4) {
- wttragetreportpartService.insertWttragetreportpart(po);
- }
- }
- System.out.println("部件数据数据保存完成");
- List<Wttragetreportkkxfx3> ls5 = wttragetreportkkxfxService.inistalWttragetreportkkxfx(ls0.getId());
- System.out.println("可靠性数据初始化完成");
- if (!ls5.isEmpty()) {
- for (Wttragetreportkkxfx3 po : ls5) {
- wttragetreportkkxfxService.insertWttragetreportkkxfx(po);
- }
- }
- System.out.println("可靠性数据保存完成");
- List<Wttragetreportxndjpj3> ls7 = wttragetreportxndjpjService.inistalWttragetreportxndjpj(ls0.getId());
- System.out.println("性能等级评级数据初始化完成");
- if (!ls7.isEmpty()) {
- for (Wttragetreportxndjpj3 po : ls7) {
- wttragetreportxndjpjService.insertWttragetreportxndjpj(po);
- }
- }
- System.out.println("性能等级评级数据保存完成");
-
- wtReportService.createWtReport(ls0.getId());;
- System.out.println("存储故障检修完成");
- System.out.println("/*************************************************************************************************************/");
- } catch (Exception e) {
- e.printStackTrace();
- }
- System.out.println("进行风机健康报告处理完成!........");
- //
-
- // System.out.println("风机健康报告调度程序执行开始!........");
- //
- // WtReportService wtReportService = (WtReportService) ctx.getBean("wtReportService"); wtReportService.createWtReport();
- //
- // System.out.println("进行风机健康报告处理完成!........");
-
-
-
- }
- }
|