Commit 02949c4b authored by neo's avatar neo

[bugfix] fixed update jo status

parent e28290f5
......@@ -103,6 +103,7 @@ public class ReportGeneratorImpl {
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
Sheet sheet = workbook.getSheetAt(i);
String code = sheet.getSheetName();
job.setCurrentStep(code);
Optional<PeriodTemplate> periodTemplate = resources.getPeriodTemplates().stream()
.filter(a -> a.getCode().equals(code))
.findFirst();
......@@ -353,9 +354,7 @@ public class ReportGeneratorImpl {
e.printStackTrace();
job.setStatus(WrapPeriodJobDto.STATUS_ERROR);
job.setErrorMsg("cacals report for code " + code + " failed");
} finally {
job.setCurrentStep(code);
periodJobMapper.updateByPrimaryKey(job);
}
}
......
......@@ -245,15 +245,19 @@ public class ReportServiceImpl {
@Transactional
private void updateConfig(String projectId, Integer period, Boolean isMergeManualData, List<Template> templates, PeriodJob job) {
try {
job.setStatus(WrapPeriodJobDto.STATUS_BEGIN);
List<Long> exceptTemplateIds = templateMapper.getIdsForExceptTemplate();
clearPeriodData(projectId, period, exceptTemplateIds, isMergeManualData);
copyTemplateAndConfigFromAdmin(projectId, templates, period);
} catch (Exception ex) {
job.setStatus(WrapPeriodJobDto.STATUS_ERROR);
job.setErrorMsg("error update config with projectId " + projectId + " period" + period);
periodJobMapper.updateByPrimaryKey(job);
logger.error(ex.getMessage(), ex);
}finally {
periodJobMapper.updateByPrimaryKey(job);
}
}
......@@ -484,13 +488,13 @@ public class ReportServiceImpl {
reportGenerator.updateWorkbookCaclsValueToDb(projectId, periodParam, workbook, resources, genJob);
genJob.setStatus(WrapPeriodJobDto.STATUS_END);
periodJobMapper.updateByPrimaryKey(genJob);
}catch (Exception e){
e.printStackTrace();
genJob.setStatus(WrapPeriodJobDto.STATUS_ERROR);
genJob.setErrorMsg("Server error");
}finally {
genJob.setErrorMsg("Sever error");
periodJobMapper.updateByPrimaryKey(genJob);
e.printStackTrace();
}
}
}).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