|
@@ -48,7 +48,9 @@ public class ReportJob implements Job {
|
|
|
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
|
|
log.info(" Job Execution key:"+jobExecutionContext.getJobDetail().getKey());
|
|
|
|
|
|
+ String separator = "/";
|
|
|
String filePrex = this.parameter;
|
|
|
+ String reportType = "";
|
|
|
|
|
|
InterlockHistoryQueryDTO dto = new InterlockHistoryQueryDTO();
|
|
|
Calendar start = Calendar.getInstance();
|
|
@@ -67,6 +69,8 @@ public class ReportJob implements Job {
|
|
|
// 昨天晚上23:59:59
|
|
|
end.add(Calendar.DAY_OF_MONTH, -1);
|
|
|
|
|
|
+ reportType = "0";
|
|
|
+
|
|
|
}else if(this.parameter.equals("month")){
|
|
|
// 上个月的第一天凌晨00:00:00
|
|
|
start.add(Calendar.MONTH, -1);
|
|
@@ -75,6 +79,8 @@ public class ReportJob implements Job {
|
|
|
end.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
end.add(Calendar.DAY_OF_MONTH, -1);
|
|
|
|
|
|
+ reportType = "1";
|
|
|
+
|
|
|
}else if(this.parameter.equals("year")){
|
|
|
// 去年的第一天凌晨00:00:00
|
|
|
start.add(Calendar.YEAR, -1);
|
|
@@ -84,6 +90,8 @@ public class ReportJob implements Job {
|
|
|
end.set(Calendar.MONTH, 0);
|
|
|
end.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
end.add(Calendar.DAY_OF_MONTH, -1);
|
|
|
+
|
|
|
+ reportType = "2";
|
|
|
}
|
|
|
|
|
|
Date beginTime = start.getTime();
|
|
@@ -95,7 +103,7 @@ public class ReportJob implements Job {
|
|
|
dto.setEndTime(endTime);
|
|
|
|
|
|
// 文件路径,如"D:/ttt/opt/upFiles/"
|
|
|
- String fileUrlPrex = upLoadPath + File.separator + filePrex + File.separator;
|
|
|
+ String fileUrlPrex = upLoadPath + separator + filePrex + separator;
|
|
|
File saveFile = new File(fileUrlPrex);
|
|
|
if (!saveFile.exists()) {
|
|
|
saveFile.mkdirs();
|
|
@@ -108,7 +116,7 @@ public class ReportJob implements Job {
|
|
|
String filePath = fileUrlPrex + fileName;
|
|
|
|
|
|
try {
|
|
|
- if(1 == interlockDetailHistoryService.exportXlsToFile(dto, InterlockSummaryHistoryVO.class, "联锁历史数据", filePath)) return;
|
|
|
+ if(0 == interlockDetailHistoryService.exportXlsToFile(dto, InterlockSummaryHistoryVO.class, "联锁历史数据", filePath)) return;
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -116,7 +124,7 @@ public class ReportJob implements Job {
|
|
|
//新增报表记录
|
|
|
InterlockDataReport report = new InterlockDataReport();
|
|
|
report.setReportName(fileName);
|
|
|
- report.setReportType("0"); // 0日报表1月报表2年报表
|
|
|
+ report.setReportType(reportType); // 0日报表1月报表2年报表
|
|
|
report.setReportUrl(filePath);
|
|
|
reportService.save(report);
|
|
|
}
|