| 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);  | 
|         }  | 
|     }  | 
| }  |