|
@@ -1,4 +1,4 @@
|
|
-package com.persagy.apm.energy.report.monthly.outline.service.builder.impl;
|
|
+package com.persagy.apm.energy.report.monthly.outline.service.builder.business.impl;
|
|
|
|
|
|
import com.persagy.apm.energy.report.monthly.detail.business.model.Platform;
|
|
import com.persagy.apm.energy.report.monthly.detail.business.model.Platform;
|
|
import com.persagy.apm.energy.report.monthly.detail.business.model.dto.AddReportBusinessDetailDTO;
|
|
import com.persagy.apm.energy.report.monthly.detail.business.model.dto.AddReportBusinessDetailDTO;
|
|
@@ -7,13 +7,11 @@ import com.persagy.apm.energy.report.monthly.detail.common.model.vo.PowerVO;
|
|
import com.persagy.apm.energy.report.monthly.detail.business.service.IReportBusinessDetailService;
|
|
import com.persagy.apm.energy.report.monthly.detail.business.service.IReportBusinessDetailService;
|
|
import com.persagy.apm.energy.report.monthly.detail.common.service.IReportDetailService;
|
|
import com.persagy.apm.energy.report.monthly.detail.common.service.IReportDetailService;
|
|
import com.persagy.apm.energy.report.monthly.outline.constants.BusinessReportParagraphs;
|
|
import com.persagy.apm.energy.report.monthly.outline.constants.BusinessReportParagraphs;
|
|
-import com.persagy.apm.energy.report.monthly.outline.constants.enums.ReportStateEnum;
|
|
|
|
import com.persagy.apm.energy.report.monthly.outline.model.ReportOutline;
|
|
import com.persagy.apm.energy.report.monthly.outline.model.ReportOutline;
|
|
import com.persagy.apm.energy.report.monthly.outline.service.IBusinessReportCostInfoService;
|
|
import com.persagy.apm.energy.report.monthly.outline.service.IBusinessReportCostInfoService;
|
|
import com.persagy.apm.energy.report.monthly.outline.service.IBusinessReportPlatformInfoService;
|
|
import com.persagy.apm.energy.report.monthly.outline.service.IBusinessReportPlatformInfoService;
|
|
import com.persagy.apm.energy.report.monthly.outline.service.IBusinessReportPowerInfoService;
|
|
import com.persagy.apm.energy.report.monthly.outline.service.IBusinessReportPowerInfoService;
|
|
-import com.persagy.apm.energy.report.monthly.outline.service.IReportOutlineService;
|
|
+import com.persagy.apm.energy.report.monthly.outline.service.builder.business.IBusinessReportBuilder;
|
|
-import com.persagy.apm.energy.report.monthly.outline.service.builder.IBusinessReportBuilder;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
@@ -41,16 +39,11 @@ public class BusinessReportBuilder implements IBusinessReportBuilder {
|
|
private IBusinessReportCostInfoService businessReportCostInfoService;
|
|
private IBusinessReportCostInfoService businessReportCostInfoService;
|
|
@Autowired
|
|
@Autowired
|
|
private IBusinessReportPlatformInfoService businessReportPlatformInfoService;
|
|
private IBusinessReportPlatformInfoService businessReportPlatformInfoService;
|
|
- @Autowired
|
|
|
|
- private IReportOutlineService reportOutlineService;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public boolean generateNewReportDetail(ReportOutline reportOutline) {
|
|
public boolean generateNewReportDetail(ReportOutline reportOutline) {
|
|
try {
|
|
try {
|
|
-
|
|
|
|
- deletePreviousReportDetail(reportOutline.getDetailId());
|
|
|
|
-
|
|
|
|
AddReportBusinessDetailDTO addReportBusinessDetailDTO = new AddReportBusinessDetailDTO();
|
|
AddReportBusinessDetailDTO addReportBusinessDetailDTO = new AddReportBusinessDetailDTO();
|
|
|
|
|
|
addReportBusinessDetailDTO.setOpenPower(getOpenPowerInfo(reportOutline));
|
|
addReportBusinessDetailDTO.setOpenPower(getOpenPowerInfo(reportOutline));
|
|
@@ -64,7 +57,6 @@ public class BusinessReportBuilder implements IBusinessReportBuilder {
|
|
|
|
|
|
String detailId = businessDetailService.createReportBusinessDetail(addReportBusinessDetailDTO);
|
|
String detailId = businessDetailService.createReportBusinessDetail(addReportBusinessDetailDTO);
|
|
reportOutline.setDetailId(detailId);
|
|
reportOutline.setDetailId(detailId);
|
|
- updateReportOutlineInfoWhenSuccess(reportOutline);
|
|
|
|
return true;
|
|
return true;
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error("生成报告失败", e);
|
|
log.error("生成报告失败", e);
|
|
@@ -73,11 +65,6 @@ public class BusinessReportBuilder implements IBusinessReportBuilder {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
- public void deletePreviousReportDetail(String detailId) {
|
|
|
|
- businessDetailService.deleteReportBusinessDetail(detailId);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
|
|
* 获取段落包含的分组列表
|
|
* 获取段落包含的分组列表
|
|
*
|
|
*
|
|
@@ -144,16 +131,4 @@ public class BusinessReportBuilder implements IBusinessReportBuilder {
|
|
public List<Platform> getPlatforms(ReportOutline reportOutline) {
|
|
public List<Platform> getPlatforms(ReportOutline reportOutline) {
|
|
return businessReportPlatformInfoService.getPlatforms(reportOutline);
|
|
return businessReportPlatformInfoService.getPlatforms(reportOutline);
|
|
}
|
|
}
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void updateReportOutlineInfoWhenSuccess(ReportOutline reportOutline) {
|
|
|
|
- reportOutline.setStatus(ReportStateEnum.GENERATED.getType());
|
|
|
|
- reportOutlineService.updateReportOutline(reportOutline);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void updateReportOutlineInfoWhenFailure(ReportOutline reportOutline) {
|
|
|
|
- reportOutline.setStatus(ReportStateEnum.BUILD_FAILED.getType());
|
|
|
|
- reportOutlineService.updateReportOutline(reportOutline);
|
|
|
|
- }
|
|
|
|
}
|
|
}
|