Commit 369eb3d4 by shenjunjie

Merge branch 'feature' into 'release'

Feature

See merge request !231
parents dfa35ea2 160bf8c5
...@@ -93,7 +93,7 @@ public class Report extends AbstractBaseMongo { ...@@ -93,7 +93,7 @@ public class Report extends AbstractBaseMongo {
case MONTH: case MONTH:
report.setTitle(project.getBrandName() + Constant.DAY_FORMAT.format(now) + reportSettings.getType()); report.setTitle(project.getBrandName() + Constant.DAY_FORMAT.format(now) + reportSettings.getType());
now = Tools.truncDate(new Date(), Constant.DAY_PATTERN); now = Tools.truncDate(new Date(), Constant.DAY_PATTERN);
report.setStartTime(DateUtils.addMonths(now, 1).getTime()); report.setStartTime(DateUtils.addMonths(now, -1).getTime());
report.setEndTime(now.getTime()); report.setEndTime(now.getTime());
break; break;
case CUSTOM: case CUSTOM:
......
...@@ -29,7 +29,7 @@ public interface ReportService { ...@@ -29,7 +29,7 @@ public interface ReportService {
*/ */
Map<String, ReportSettingsDTO> getReportSettings(); Map<String, ReportSettingsDTO> getReportSettings();
List<Report> getCustomReportByStatus(String projectId,boolean status); List<Report> getReportByStatus(String projectId,boolean status);
/** /**
* 保存报告配置 * 保存报告配置
......
...@@ -118,8 +118,8 @@ public class ReportServiceImpl implements ReportService { ...@@ -118,8 +118,8 @@ public class ReportServiceImpl implements ReportService {
} }
@Override @Override
public List<Report> getCustomReportByStatus(String projectId, boolean status) { public List<Report> getReportByStatus(String projectId, boolean status) {
Criteria criteria = Criteria.where("projectId").is(projectId).and("status").is(status).and("type").is(ReportTypeEnum.CUSTOM.getState()); Criteria criteria = Criteria.where("projectId").is(projectId).and("status").is(status);
return reportDao.findList(Query.query(criteria)); return reportDao.findList(Query.query(criteria));
} }
......
...@@ -315,23 +315,23 @@ public class TaskServiceImpl implements TaskService { ...@@ -315,23 +315,23 @@ public class TaskServiceImpl implements TaskService {
private boolean reportSendByProject(Project project) { private boolean reportSendByProject(Project project) {
boolean flag = false; boolean flag = false;
// 扫描setting信息 // 扫描setting信息并生成对应报告
for (ReportSettings reportSettings : reportSettingsDao.getReportSettingByProjectWithUsed(project.getId())) { for (ReportSettings reportSettings : reportSettingsDao.getReportSettingByProjectWithUsed(project.getId())) {
ReportTypeEnum reportType = ReportTypeEnum.getInstanceByState(reportSettings.getType()); ReportTypeEnum reportType = ReportTypeEnum.getInstanceByState(reportSettings.getType());
if (ReportTypeEnum.canPublishNow(reportType)) { if (ReportTypeEnum.canPublishNow(reportType)) {
Pair<Boolean, Report> booleanReportPair = reportService.generateReportBySettings(reportSettings, project); Pair<Boolean, Report> booleanReportPair = reportService.generateReportBySettings(reportSettings, project);
// 生成新的简报之后的处理 // 生成新的简报之后的处理
if (booleanReportPair.getLeft()) { // if (booleanReportPair.getLeft()) {
Report report = booleanReportPair.getRight(); // Report report = booleanReportPair.getRight();
// 用作生成缓存 // // 用作生成缓存
reportService.getPcReportAnalyze(report.getId(), false); // reportService.getPcReportAnalyze(report.getId(), false);
reportService.switchReportStatus(report.getId(), true); // reportService.switchReportStatus(report.getId(), true);
} // }
flag = true; flag = true;
} }
} }
// 自定义简报不通过setting生效 // 生成对应报告
for (Report report : reportService.getCustomReportByStatus(project.getId(), false)) { for (Report report : reportService.getReportByStatus(project.getId(), false)) {
// 用作生成缓存 // 用作生成缓存
reportService.getPcReportAnalyze(report.getId(), false); reportService.getPcReportAnalyze(report.getId(), false);
reportService.switchReportStatus(report.getId(), true); reportService.switchReportStatus(report.getId(), true);
......
...@@ -32,7 +32,7 @@ public class ReportServiceTest { ...@@ -32,7 +32,7 @@ public class ReportServiceTest {
@Test @Test
public void getCustomReportByStatusTest(){ public void getCustomReportByStatusTest(){
List<Report> customReportByStatus = reportService.getCustomReportByStatus(UserThreadLocal.getProjectId(), false); List<Report> customReportByStatus = reportService.getReportByStatus(UserThreadLocal.getProjectId(), false);
for (Report reportByStatus : customReportByStatus) { for (Report reportByStatus : customReportByStatus) {
System.out.println(reportByStatus); System.out.println(reportByStatus);
} }
......
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