StartUp.java 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. package com.gyee.main;
  2. import java.util.Calendar;
  3. import java.util.List;
  4. import org.springframework.context.ApplicationContext;
  5. import org.springframework.context.support.ClassPathXmlApplicationContext;
  6. import com.gyee.model.Wttragetreport3;
  7. import com.gyee.model.Wttragetreportfnlyl3;
  8. import com.gyee.model.Wttragetreportkkxfx3;
  9. import com.gyee.model.Wttragetreportmain3;
  10. import com.gyee.model.Wttragetreportnhyd3;
  11. import com.gyee.model.Wttragetreportpart3;
  12. import com.gyee.model.Wttragetreportxndjpj3;
  13. import com.gyee.service.WtReportService;
  14. import com.gyee.service.WttragetreportService;
  15. import com.gyee.service.WttragetreportchartService;
  16. import com.gyee.service.WttragetreportfnlylService;
  17. import com.gyee.service.WttragetreportkkxfxService;
  18. import com.gyee.service.WttragetreportmainService;
  19. import com.gyee.service.WttragetreportnhydService;
  20. import com.gyee.service.WttragetreportpartService;
  21. import com.gyee.service.WttragetreportxndjpjService;
  22. import com.gyee.util.StringUtils;
  23. public class StartUp {
  24. public static void main(String[] args) throws Exception {
  25. ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath*:applicationContext.xml");
  26. WttragetreportService wttragetreportService = (WttragetreportService) ctx.getBean("wttragetreportService");
  27. WttragetreportchartService wttragetreportchartService = (WttragetreportchartService) ctx.getBean("wttragetreportchartService");
  28. WttragetreportpartService wttragetreportpartService = (WttragetreportpartService) ctx.getBean("wttragetreportpartService");
  29. WttragetreportmainService wttragetreportmainService = (WttragetreportmainService) ctx.getBean("wttragetreportmainService");
  30. WttragetreportfnlylService wttragetreportfnlylService = (WttragetreportfnlylService) ctx.getBean("wttragetreportfnlylService");
  31. WttragetreportkkxfxService wttragetreportkkxfxService = (WttragetreportkkxfxService) ctx.getBean("wttragetreportkkxfxService");
  32. WttragetreportnhydService wttragetreportnhydService = (WttragetreportnhydService) ctx.getBean("wttragetreportnhydService");
  33. WttragetreportxndjpjService wttragetreportxndjpjService = (WttragetreportxndjpjService) ctx.getBean("wttragetreportxndjpjService");
  34. WtReportService wtReportService = (WtReportService) ctx.getBean("wtReportService");
  35. System.out.println("风机健康报告调度程序执行开始!........");
  36. try {
  37. Calendar cal = Calendar.getInstance();
  38. cal.set(Calendar.HOUR_OF_DAY, 0);
  39. cal.set(Calendar.MINUTE, 0);
  40. cal.set(Calendar.SECOND, 0);
  41. //Wttragetreport3 wtr = wttragetreportService.findTargetReportByDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH) + 1);
  42. Wttragetreport3 wtr = wttragetreportService.findTargetReportByDate(cal.getTime());
  43. if (StringUtils.notEmp(wtr)) {
  44. wttragetreportService.deleteWttragetreport(wtr.getId());
  45. wttragetreportmainService.deleteWttragetreportmain(wtr.getId());
  46. wttragetreportchartService.deleteWttragetreportchart(wtr.getId());
  47. wttragetreportfnlylService.deleteWttragetreportfnlyl(wtr.getId());
  48. wttragetreportpartService.deleteWttragetreportpart(wtr.getId());
  49. wttragetreportkkxfxService.deleteWttragetreportkkxfx(wtr.getId());
  50. wttragetreportnhydService.deleteWttragetreportnhyd(wtr.getId());
  51. wttragetreportxndjpjService.deleteWttragetreportxndjpj(wtr.getId());
  52. wttragetreportService.deleteWttragetreport(wtr.getId());
  53. }
  54. // }
  55. Wttragetreport3 ls0 = wttragetreportService.inistalWttragetreport();
  56. System.out.println("主表数据初始化完成");
  57. wttragetreportService.insertWttragetreport(ls0);
  58. System.out.println("主表数据保存完成");
  59. List<Wttragetreportmain3> ls1 = wttragetreportmainService.inistalWttragetreportmain(ls0.getId());
  60. System.out.println("重要指标表数据初始化完成");
  61. if (!ls1.isEmpty()) {
  62. for (Wttragetreportmain3 po : ls1) {
  63. wttragetreportmainService.insertWttragetreportmain(po);
  64. }
  65. }
  66. System.out.println("重要指标表数据保存完成");
  67. // List<Wttragetreportchart3> ls2 = wttragetreportchartService.inistalWttragetreportchart(ls0.getId());
  68. // System.out.println("图表数据初始化完成");
  69. // if (!ls2.isEmpty()) {
  70. // for (Wttragetreportchart3 po : ls2) {
  71. // wttragetreportchartService.insertWttragetreportchart(po);
  72. // }
  73. // }
  74. wttragetreportchartService.inistalWttragetreportchart(ls0.getId(),wttragetreportchartService);
  75. System.out.println("图表数据保存完成");
  76. List<Wttragetreportfnlyl3> ls3 = wttragetreportfnlylService.inistalWttragetreportfnlyl(ls0.getId());
  77. System.out.println("风能利用率数据初始化完成");
  78. if (!ls3.isEmpty()) {
  79. for (Wttragetreportfnlyl3 po : ls3) {
  80. wttragetreportfnlylService.insertWttragetreportfnlyl(po);
  81. }
  82. }
  83. System.out.println("风能利用率数据保存完成");
  84. List<Wttragetreportpart3> ls4 = wttragetreportpartService.inistalWttragetreportpart(ls0.getId());
  85. System.out.println("部件数据数据初始化完成");
  86. if (!ls4.isEmpty()) {
  87. for (Wttragetreportpart3 po : ls4) {
  88. wttragetreportpartService.insertWttragetreportpart(po);
  89. }
  90. }
  91. System.out.println("部件数据数据保存完成");
  92. List<Wttragetreportkkxfx3> ls5 = wttragetreportkkxfxService.inistalWttragetreportkkxfx(ls0.getId());
  93. System.out.println("可靠性数据初始化完成");
  94. if (!ls5.isEmpty()) {
  95. for (Wttragetreportkkxfx3 po : ls5) {
  96. wttragetreportkkxfxService.insertWttragetreportkkxfx(po);
  97. }
  98. }
  99. System.out.println("可靠性数据保存完成");
  100. List<Wttragetreportxndjpj3> ls7 = wttragetreportxndjpjService.inistalWttragetreportxndjpj(ls0.getId());
  101. System.out.println("性能等级评级数据初始化完成");
  102. if (!ls7.isEmpty()) {
  103. for (Wttragetreportxndjpj3 po : ls7) {
  104. wttragetreportxndjpjService.insertWttragetreportxndjpj(po);
  105. }
  106. }
  107. System.out.println("性能等级评级数据保存完成");
  108. wtReportService.createWtReport(ls0.getId());;
  109. System.out.println("存储故障检修完成");
  110. System.out.println("/*************************************************************************************************************/");
  111. } catch (Exception e) {
  112. e.printStackTrace();
  113. }
  114. System.out.println("进行风机健康报告处理完成!........");
  115. //
  116. // System.out.println("风机健康报告调度程序执行开始!........");
  117. //
  118. // WtReportService wtReportService = (WtReportService) ctx.getBean("wtReportService"); wtReportService.createWtReport();
  119. //
  120. // System.out.println("进行风机健康报告处理完成!........");
  121. }
  122. }