|
|
@@ -139,20 +139,27 @@ public class FsCourseRedPacketLogController extends BaseController
|
|
|
@GetMapping("/export")
|
|
|
public AjaxResult export(FsCourseRedPacketLogParam fsCourseRedPacketLog)
|
|
|
{
|
|
|
-// LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
-// fsCourseRedPacketLog.setCompanyId( loginUser.getCompany().getCompanyId());
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ fsCourseRedPacketLog.setCompanyId( loginUser.getCompany().getCompanyId());
|
|
|
|
|
|
if (fsCourseRedPacketLog.getPhoneMk()!=null&&fsCourseRedPacketLog.getPhoneMk()!=""){
|
|
|
fsCourseRedPacketLog.setPhone(encryptPhone(fsCourseRedPacketLog.getPhoneMk()));
|
|
|
}
|
|
|
- List<FsCourseRedPacketLogListPVO> list = fsCourseRedPacketLogService.selectFsCourseRedPacketLogListVO(fsCourseRedPacketLog);
|
|
|
- for (FsCourseRedPacketLogListPVO fsCourseRedPacketLogListPVO : list) {
|
|
|
- if (ObjectUtil.isNotEmpty(fsCourseRedPacketLogListPVO.getPeriodId())){
|
|
|
- FsUserCoursePeriod fsUserCoursePeriod = fsUserCoursePeriodService.selectFsUserCoursePeriodById(fsCourseRedPacketLogListPVO.getPeriodId().longValue());
|
|
|
- fsCourseRedPacketLogListPVO.setPeriodName(fsUserCoursePeriod.getPeriodName());
|
|
|
- }
|
|
|
- fsCourseRedPacketLogListPVO.setPhone(PhoneUtil.decryptAutoPhoneMk(fsCourseRedPacketLogListPVO.getPhone()));
|
|
|
+
|
|
|
+ // 先查询符合条件的总数量
|
|
|
+ long totalCount = fsCourseRedPacketLogService.selectFsCourseRedPacketLogListVOCount(fsCourseRedPacketLog);
|
|
|
+
|
|
|
+ // 设置最大导出数量限制
|
|
|
+ int maxExportCount = 10000;
|
|
|
+ if (totalCount > maxExportCount) {
|
|
|
+ return AjaxResult.error("导出数据量过大,当前共有 " + totalCount + " 条记录,超过最大限制 " + maxExportCount + " 条。请缩小查询范围后重试。");
|
|
|
}
|
|
|
+
|
|
|
+ List<FsCourseRedPacketLogListPVO> list = fsCourseRedPacketLogService.selectFsCourseRedPacketLogListVO(fsCourseRedPacketLog);
|
|
|
+
|
|
|
+ // 已通过 SQL LEFT JOIN 获取 period_name,无需循环查询
|
|
|
+ // 手机号解密已在 Service 层批量处理
|
|
|
+
|
|
|
ExcelUtil<FsCourseRedPacketLogListPVO> util = new ExcelUtil<FsCourseRedPacketLogListPVO>(FsCourseRedPacketLogListPVO.class);
|
|
|
return util.exportExcel(list, "短链课程看课记录数据");
|
|
|
}
|
|
|
@@ -170,14 +177,21 @@ public class FsCourseRedPacketLogController extends BaseController
|
|
|
if (fsCourseRedPacketLog.getPhoneMk()!=null&&fsCourseRedPacketLog.getPhoneMk()!=""){
|
|
|
fsCourseRedPacketLog.setPhone(encryptPhone(fsCourseRedPacketLog.getPhoneMk()));
|
|
|
}
|
|
|
- List<FsCourseRedPacketLogListPVO> list = fsCourseRedPacketLogService.selectFsCourseRedPacketLogListVO(fsCourseRedPacketLog);
|
|
|
- for (FsCourseRedPacketLogListPVO fsCourseRedPacketLogListPVO : list) {
|
|
|
- if (ObjectUtil.isNotEmpty(fsCourseRedPacketLogListPVO.getPeriodId())){
|
|
|
- FsUserCoursePeriod fsUserCoursePeriod = fsUserCoursePeriodService.selectFsUserCoursePeriodById(fsCourseRedPacketLogListPVO.getPeriodId().longValue());
|
|
|
- fsCourseRedPacketLogListPVO.setPeriodName(fsUserCoursePeriod.getPeriodName());
|
|
|
- }
|
|
|
- fsCourseRedPacketLogListPVO.setPhone(PhoneUtil.decryptAutoPhoneMk(fsCourseRedPacketLogListPVO.getPhone()));
|
|
|
+
|
|
|
+ // 先查询符合条件的总数量
|
|
|
+ long totalCount = fsCourseRedPacketLogService.selectFsCourseRedPacketLogListVOCount(fsCourseRedPacketLog);
|
|
|
+
|
|
|
+ // 设置最大导出数量限制
|
|
|
+ int maxExportCount = 10000;
|
|
|
+ if (totalCount > maxExportCount) {
|
|
|
+ return AjaxResult.error("导出数据量过大,当前共有 " + totalCount + " 条记录,超过最大限制 " + maxExportCount + " 条。请缩小查询范围后重试。");
|
|
|
}
|
|
|
+
|
|
|
+ List<FsCourseRedPacketLogListPVO> list = fsCourseRedPacketLogService.selectFsCourseRedPacketLogListVO(fsCourseRedPacketLog);
|
|
|
+
|
|
|
+ // 已通过 SQL LEFT JOIN 获取 period_name,无需循环查询
|
|
|
+ // 手机号解密已在 Service 层批量处理
|
|
|
+
|
|
|
ExcelUtil<FsCourseRedPacketLogListPVO> util = new ExcelUtil<FsCourseRedPacketLogListPVO>(FsCourseRedPacketLogListPVO.class);
|
|
|
return util.exportExcel(list, "短链课程看课记录数据");
|
|
|
}
|