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