|
@@ -160,33 +160,6 @@ public class TaskExportCommon {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 换算进度
|
|
|
|
- *
|
|
|
|
- * @param max
|
|
|
|
- * @param min
|
|
|
|
- * @param size
|
|
|
|
- * @param txtList
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- public List<String> progress(int max, int min, int size, List<String> txtList) {
|
|
|
|
- BigDecimal bigDecimal = new BigDecimal(100);
|
|
|
|
- BigDecimal progress = new BigDecimal(Double.valueOf(new BigDecimal(max).divide(new BigDecimal(size), 2, BigDecimal.ROUND_HALF_UP).multiply(bigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue())).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- if (progress.intValue() == 100) {
|
|
|
|
- this.tbTaskHistory.setStatus(TaskStatusEnum.FINISH);
|
|
|
|
- this.tbTaskHistory.setSummary("共导出了" + size + "条数据");
|
|
|
|
- this.tbTaskHistory.setFinishTime(new Date());
|
|
|
|
- txtList.add(DateUtil.format(new Date(), this.timeFormat) + "->数据导出完毕," + this.tbTaskHistory.getSummary());
|
|
|
|
- } else {
|
|
|
|
- this.tbTaskHistory.setStatus(TaskStatusEnum.RUNNING);
|
|
|
|
- this.tbTaskHistory.setSummary("正在导出第" + min + "条至" + max + "条数据");
|
|
|
|
- txtList.add(DateUtil.format(new Date(), this.timeFormat) + "->数据导出中," + this.tbTaskHistory.getSummary());
|
|
|
|
- }
|
|
|
|
- this.tbTaskHistory.setProgress(progress.doubleValue());
|
|
|
|
- this.tbTaskHistoryService.updateById(this.tbTaskHistory);
|
|
|
|
- return txtList;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 异常处理
|
|
* 异常处理
|
|
*
|
|
*
|
|
@@ -201,7 +174,7 @@ public class TaskExportCommon {
|
|
String exceptionStr = "数据导出到第" + (y == 0 ? y + 1 : y) + "条时发生异常:" + e.getMessage();
|
|
String exceptionStr = "数据导出到第" + (y == 0 ? y + 1 : y) + "条时发生异常:" + e.getMessage();
|
|
txtList.add(DateUtil.format(new Date(), this.timeFormat) + "->" + exceptionStr);
|
|
txtList.add(DateUtil.format(new Date(), this.timeFormat) + "->" + exceptionStr);
|
|
this.tbTaskHistory.setSummary(exceptionStr);
|
|
this.tbTaskHistory.setSummary(exceptionStr);
|
|
- this.tbTaskHistoryService.updateById(this.tbTaskHistory);
|
|
|
|
|
|
+// this.tbTaskHistoryService.updateById(this.tbTaskHistory);
|
|
return txtList;
|
|
return txtList;
|
|
}
|
|
}
|
|
|
|
|