Commit 02949c4b authored by neo's avatar neo

[bugfix] fixed update jo status

parent e28290f5
...@@ -103,6 +103,7 @@ public class ReportGeneratorImpl { ...@@ -103,6 +103,7 @@ public class ReportGeneratorImpl {
for (int i = 0; i < workbook.getNumberOfSheets(); i++) { for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
Sheet sheet = workbook.getSheetAt(i); Sheet sheet = workbook.getSheetAt(i);
String code = sheet.getSheetName(); String code = sheet.getSheetName();
job.setCurrentStep(code);
Optional<PeriodTemplate> periodTemplate = resources.getPeriodTemplates().stream() Optional<PeriodTemplate> periodTemplate = resources.getPeriodTemplates().stream()
.filter(a -> a.getCode().equals(code)) .filter(a -> a.getCode().equals(code))
.findFirst(); .findFirst();
...@@ -353,9 +354,7 @@ public class ReportGeneratorImpl { ...@@ -353,9 +354,7 @@ public class ReportGeneratorImpl {
e.printStackTrace(); e.printStackTrace();
job.setStatus(WrapPeriodJobDto.STATUS_ERROR); job.setStatus(WrapPeriodJobDto.STATUS_ERROR);
job.setErrorMsg("cacals report for code " + code + " failed"); job.setErrorMsg("cacals report for code " + code + " failed");
} finally { } finally {
job.setCurrentStep(code);
periodJobMapper.updateByPrimaryKey(job); periodJobMapper.updateByPrimaryKey(job);
} }
} }
......
...@@ -245,15 +245,19 @@ public class ReportServiceImpl { ...@@ -245,15 +245,19 @@ public class ReportServiceImpl {
@Transactional @Transactional
private void updateConfig(String projectId, Integer period, Boolean isMergeManualData, List<Template> templates, PeriodJob job) { private void updateConfig(String projectId, Integer period, Boolean isMergeManualData, List<Template> templates, PeriodJob job) {
try { try {
job.setStatus(WrapPeriodJobDto.STATUS_BEGIN);
List<Long> exceptTemplateIds = templateMapper.getIdsForExceptTemplate(); List<Long> exceptTemplateIds = templateMapper.getIdsForExceptTemplate();
clearPeriodData(projectId, period, exceptTemplateIds, isMergeManualData); clearPeriodData(projectId, period, exceptTemplateIds, isMergeManualData);
copyTemplateAndConfigFromAdmin(projectId, templates, period); copyTemplateAndConfigFromAdmin(projectId, templates, period);
} catch (Exception ex) { } catch (Exception ex) {
job.setStatus(WrapPeriodJobDto.STATUS_ERROR); job.setStatus(WrapPeriodJobDto.STATUS_ERROR);
job.setErrorMsg("error update config with projectId " + projectId + " period" + period); job.setErrorMsg("error update config with projectId " + projectId + " period" + period);
periodJobMapper.updateByPrimaryKey(job);
logger.error(ex.getMessage(), ex); logger.error(ex.getMessage(), ex);
}finally {
periodJobMapper.updateByPrimaryKey(job);
} }
} }
...@@ -484,13 +488,13 @@ public class ReportServiceImpl { ...@@ -484,13 +488,13 @@ public class ReportServiceImpl {
reportGenerator.updateWorkbookCaclsValueToDb(projectId, periodParam, workbook, resources, genJob); reportGenerator.updateWorkbookCaclsValueToDb(projectId, periodParam, workbook, resources, genJob);
genJob.setStatus(WrapPeriodJobDto.STATUS_END); genJob.setStatus(WrapPeriodJobDto.STATUS_END);
periodJobMapper.updateByPrimaryKey(genJob);
}catch (Exception e){ }catch (Exception e){
e.printStackTrace();
genJob.setStatus(WrapPeriodJobDto.STATUS_ERROR); genJob.setStatus(WrapPeriodJobDto.STATUS_ERROR);
genJob.setErrorMsg("Server error"); genJob.setErrorMsg("Sever error");
}finally {
periodJobMapper.updateByPrimaryKey(genJob); periodJobMapper.updateByPrimaryKey(genJob);
e.printStackTrace();
} }
} }
}).start(); }).start();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment