fix
Helius
2021-09-15 7ab7943de217a9e5d4a489c22c7ae27a29692d55
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.xzx.gc.system.runner;
 
 
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import com.xzx.gc.common.constant.Constants;
import com.xzx.gc.common.constant.OrderEnum;
import com.xzx.gc.common.constant.SysConfigConstant;
import com.xzx.gc.common.utils.BusinessUtil;
import com.xzx.gc.entity.ConfigInfo;
import com.xzx.gc.entity.PlatformReport;
import com.xzx.gc.system.service.ConfigService;
import com.xzx.gc.system.service.PlatformReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
 
import java.util.List;
 
 
/**
 * 获取系统信息
 */
@Component
@Order(1)
@Slf4j
public class SystemInfoRunner implements CommandLineRunner {
 
    @Autowired
    private BusinessUtil businessUtil;
 
    @Autowired
    private ConfigService configService;
 
    @Autowired
    private PlatformReportService platformReportService;
 
 
    @Override
    public void run(String... args) throws Exception {
        log.info(businessUtil.repeatService("消息服务启动完成"));
 
        ConfigInfo configInfo = configService.findByCode(SysConfigConstant.PLATFORM_REPORT);
        if(Constants.OPEN_FLAG.equals(configInfo.getConfigValue())){
            //取出所有未提现总额的数据
            List<PlatformReport> byReportType = platformReportService.findByReportTypeLessThanTime(OrderEnum.未提现总额.getValue(),DateUtil.today());
            //删除所有报表数据
            platformReportService.deleteAll();
            //初始化
            platformReportService.init();
            //插入未提现总额的报表数据
            if(CollUtil.isNotEmpty(byReportType)) {
                platformReportService.batchAdd(byReportType);
            }
            //关闭统计开关
            configInfo.setConfigValue(Constants.CLOSE_FLAG);
            configService.update(configInfo);
        }
    }
}