Commit de0f6192 authored by neo's avatar neo

[Bugfix] fixed status

parent eb762354
...@@ -248,22 +248,16 @@ public class ReportServiceImpl { ...@@ -248,22 +248,16 @@ 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 { setStatus(job, STATUS_BEGIN);
job.setStatus(WrapPeriodJobDto.STATUS_BEGIN); periodJobMapper.updateByPrimaryKey(job);
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) { setStatus(job, STATUS_END);
job.setStatus(WrapPeriodJobDto.STATUS_ERROR);
job.setErrorMsg("error update config with projectId " + projectId + " period" + period);
logger.error(ex.getMessage(), ex);
} finally {
periodJobMapper.updateByPrimaryKey(job); periodJobMapper.updateByPrimaryKey(job);
} }
}
private List<Template> getTemplatesByProjectId(String projectId) { private List<Template> getTemplatesByProjectId(String projectId) {
MyAsserts.assertNotEmpty(projectId, Exceptions.PROJECT_PROJECT_EXCEPTION); MyAsserts.assertNotEmpty(projectId, Exceptions.PROJECT_PROJECT_EXCEPTION);
...@@ -478,7 +472,6 @@ public class ReportServiceImpl { ...@@ -478,7 +472,6 @@ public class ReportServiceImpl {
try { try {
updateConfig(projectId, periodParam, isMergeManualData, templates, genJob); updateConfig(projectId, periodParam, isMergeManualData, templates, genJob);
setStatus(genJob,STEP_UPDATE_CONFIG,STATUS_END);
PeriodResources resources = reportGenerator.getPeriodResources(projectId, periodParam, PeriodResources resources = reportGenerator.getPeriodResources(projectId, periodParam,
templates.stream().map(Template::getId).collect(Collectors.toList())); templates.stream().map(Template::getId).collect(Collectors.toList()));
...@@ -493,8 +486,8 @@ public class ReportServiceImpl { ...@@ -493,8 +486,8 @@ public class ReportServiceImpl {
reportGenerator.updateWorkbookCaclsValueToDb(projectId, periodParam, workbook, resources, isMergeManualData, genJob); reportGenerator.updateWorkbookCaclsValueToDb(projectId, periodParam, workbook, resources, isMergeManualData, genJob);
} catch (Exception e) { } catch (Exception e) {
setStatus(genJob,STATUS_ERROR); setStatus(genJob, STATUS_ERROR);
genJob.setErrorMsg("Sever error "+e.getMessage()); genJob.setErrorMsg("Sever error " + e.getMessage());
periodJobMapper.updateByPrimaryKey(genJob); periodJobMapper.updateByPrimaryKey(genJob);
e.printStackTrace(); e.printStackTrace();
} }
......
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