395e025e
张志伟
|
1
2
|
package cn.fw.valhalla.controller.task;
|
daa62266
张志伟
|
3
|
import cn.fw.valhalla.common.utils.DateUtil;
|
c3b33c0a
张志伟
|
4
5
6
7
|
import cn.fw.valhalla.rpc.oop.OopService;
import cn.fw.valhalla.rpc.oop.dto.GroupDTO;
import cn.fw.valhalla.service.report.CustomerRetentionRatioBizService;
import cn.fw.valhalla.service.report.PublicReportBizService;
|
395e025e
张志伟
|
8
9
10
11
|
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
|
395e025e
张志伟
|
12
|
|
c3b33c0a
张志伟
|
13
|
import java.time.LocalDate;
|
395e025e
张志伟
|
14
|
import java.util.Date;
|
c3b33c0a
张志伟
|
15
|
import java.util.List;
|
395e025e
张志伟
|
16
17
18
19
20
21
22
23
24
25
26
|
/**
* @author : kurisu
* @className : ReportPrepareTask
* @description : 报表准备任务
* @date: 2020-11-24 15:52
*/
@RequiredArgsConstructor
@Component
@Slf4j
public class ReportPrepareTask {
|
c3b33c0a
张志伟
|
27
|
private final OopService oopService;
|
395e025e
张志伟
|
28
|
private final CustomerRetentionRatioBizService retentionRatioBizService;
|
c3b33c0a
张志伟
|
29
|
private final PublicReportBizService publicReportBizService;
|
395e025e
张志伟
|
30
|
|
c3b33c0a
张志伟
|
31
32
33
|
/**
* 保持率进站率报表数据准备
*/
|
b085dca5
张志伟
|
34
|
@Scheduled(cron = "30 0 0 ? * * ")
|
395e025e
张志伟
|
35
|
public void extractingData() {
|
c3b33c0a
张志伟
|
36
37
38
39
|
retentionRatioBizService.extracting(DateUtil.startDate(new Date()));
}
/**
|
bfac3874
xianpengcheng
public_report_dat...
|
40
|
* 公共池报表数据准备,0点30分抽取
|
c3b33c0a
张志伟
|
41
42
43
44
|
*/
@Scheduled(cron = "0 30 0 ? * * ")
public void extractingPublicData() {
final List<GroupDTO> groupList = oopService.allGroup();
|
bfac3874
xianpengcheng
public_report_dat...
|
45
|
final LocalDate now = LocalDate.now().minusDays(1);
|
c3b33c0a
张志伟
|
46
47
48
49
50
51
52
|
for (GroupDTO group : groupList) {
try {
publicReportBizService.extracting(now, group.getId());
} catch (Exception e) {
log.warn("准备公共池报表数据失败[groupId: {} data: {}]", group.getId(), now, e);
}
}
|
395e025e
张志伟
|
53
54
|
}
}
|