| 
					
				 | 
			
			
				@@ -7,6 +7,7 @@ import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.common.utils.DateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.course.param.FsCourseTrafficLogParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.course.vo.FsCourseTrafficLogListVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.course.mapper.FsCourseTrafficLogMapper; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -20,6 +21,7 @@ import com.fs.course.service.IFsCourseTrafficLogService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * @date 2024-10-31 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Service 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@Slf4j 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class FsCourseTrafficLogServiceImpl implements IFsCourseTrafficLogService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -108,23 +110,23 @@ public class FsCourseTrafficLogServiceImpl implements IFsCourseTrafficLogService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void saveCourseTrafficLog() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Integer count = fsCourseTrafficLogMapper.saveCourseTrafficLogByTwoDaysLaterCount(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Integer limit = 1000; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        System.out.println("总数:" + count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log.info("总数: {}", count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // Start timing 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         long startTime = System.currentTimeMillis(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        System.out.println("开始处理,时间: " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log.info("开始处理,时间: {}", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 计算需要查询的次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int totalPages = (count + limit - 1) / limit; // 向上取整 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (int page = 0; page < totalPages; page++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             int offset = page * limit; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            System.out.println("开始查询"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.info("开始查询"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<FsCourseTrafficLog> redPacketLogs = fsCourseTrafficLogMapper.selectCourseTrafficLogByTwoDaysLater(0,limit); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            System.out.println(redPacketLogs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.info("查询结果: {}", redPacketLogs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 处理当前批次的1000条数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (redPacketLogs==null ||redPacketLogs.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                System.out.println("没有数据"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                log.info("没有数据"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             fsCourseTrafficLogMapper.insertCourseTrafficLogByTwoDaysLaterBatch(redPacketLogs); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -134,7 +136,7 @@ public class FsCourseTrafficLogServiceImpl implements IFsCourseTrafficLogService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             fsCourseTrafficLogMapper.deleteFsCourseTrafficLogByLogIds(delArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 打印进度 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            System.out.printf("已处理: %d/%d (%.2f%%)%n", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.info("已处理: {}/{} ({:.2f}%)", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     Math.min(offset + limit, count), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     count, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     (double)(offset + limit) / count * 100); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -145,15 +147,15 @@ public class FsCourseTrafficLogServiceImpl implements IFsCourseTrafficLogService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             double timePerBatch = (double)elapsedTime / (page + 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             long estimatedRemaining = (long)(timePerBatch * (totalPages - page - 1)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            System.out.printf("当前批次耗时: %.2fs, 预计剩余时间: %s%n", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.info("当前批次耗时: {:.2f}s, 预计剩余时间: {}", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     timePerBatch / 1000, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     formatDuration(estimatedRemaining)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// End timing 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // End timing 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         long endTime = System.currentTimeMillis(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        System.out.println("处理完成,时间: " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        System.out.printf("总耗时: %s%n", formatDuration(endTime - startTime)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log.info("处理完成,时间: {}", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log.info("总耗时: {}", formatDuration(endTime - startTime)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private static String formatDuration(long millis) { 
			 |