Sfoglia il codice sorgente

1、优化红包导出问题
2、注释im拉黑问题

yys 2 settimane fa
parent
commit
a5bf461247

+ 13 - 13
fs-admin/src/main/java/com/fs/course/controller/FsCourseRedPacketLogController.java

@@ -7,15 +7,12 @@ import com.fs.common.core.domain.R;
 import com.fs.common.core.domain.model.LoginUser;
 import com.fs.common.utils.ServletUtils;
 import com.fs.course.config.CourseConfig;
-import com.fs.course.domain.FsUserCoursePeriod;
 import com.fs.course.mapper.FsUserCourseMapper;
 import com.fs.course.mapper.FsUserCourseVideoMapper;
 import com.fs.course.param.FsCourseRedPacketLogParam;
-import com.fs.course.service.IFsUserCoursePeriodService;
 import com.fs.course.vo.FsCourseRedPacketLogListPVO;
 import com.fs.course.vo.FsCourseRedPacketLogListVO;
 import com.fs.framework.web.service.TokenService;
-import com.fs.his.utils.PhoneUtil;
 import com.fs.his.vo.OptionsVO;
 import com.fs.system.service.ISysConfigService;
 import com.github.pagehelper.PageHelper;
@@ -30,7 +27,6 @@ import com.fs.common.enums.BusinessType;
 import com.fs.course.domain.FsCourseRedPacketLog;
 import com.fs.course.service.IFsCourseRedPacketLogService;
 import com.fs.common.utils.poi.ExcelUtil;
-import com.fs.common.core.page.TableDataInfo;
 
 import static com.fs.his.utils.PhoneUtil.encryptPhone;
 
@@ -47,8 +43,6 @@ public class FsCourseRedPacketLogController extends BaseController
     @Autowired
     private IFsCourseRedPacketLogService fsCourseRedPacketLogService;
 
-    @Autowired
-    private IFsUserCoursePeriodService fsUserCoursePeriodService;
     @Autowired
     FsUserCourseMapper fsUserCourseMapper;
     @Autowired
@@ -111,14 +105,20 @@ public class FsCourseRedPacketLogController extends BaseController
         if (fsCourseRedPacketLog.getPhoneMk()!=null&&fsCourseRedPacketLog.getPhoneMk()!=""){
             fsCourseRedPacketLog.setPhone(encryptPhone(fsCourseRedPacketLog.getPhoneMk()));
         }
+        
+        // 先查询符合条件的总数量
+        long totalCount = fsCourseRedPacketLogService.selectFsCourseRedPacketLogListVOCount(fsCourseRedPacketLog);
+        
+        // 设置最大导出数量限制
+        int maxExportCount = 10000;
+        if (totalCount > maxExportCount) {
+            return AjaxResult.error("导出数据量过大,当前共有 " + totalCount + " 条记录,超过最大限制 " + maxExportCount + " 条。请缩小查询范围后重试。");
+        }
+        
         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()));
-//        }
+        
+        // 手机号解密已在 Service 层批量处理
+        
         ExcelUtil<FsCourseRedPacketLogListPVO> util = new ExcelUtil<FsCourseRedPacketLogListPVO>(FsCourseRedPacketLogListPVO.class);
         return util.exportExcel(list, "短链课程看课记录数据");
     }

+ 1 - 1
fs-company-app/src/main/java/com/fs/app/controller/FsUserCourseVideoController.java

@@ -305,7 +305,7 @@ public class FsUserCourseVideoController extends AppBaseController {
     /**
      * 获取跳转微信小程序的链接地址
      */
-//    @Login
+    @Login
     @GetMapping("/getGotoWxAppLink")
     @ApiOperation("获取跳转微信小程序的链接地址")
     public ResponseResult<String> getGotoWxAppLink(String linkStr,String appid) {

+ 30 - 16
fs-company/src/main/java/com/fs/company/controller/course/FsCourseRedPacketLogController.java

@@ -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, "短链课程看课记录数据");
     }

+ 7 - 0
fs-service/src/main/java/com/fs/course/service/IFsCourseRedPacketLogService.java

@@ -108,4 +108,11 @@ public interface IFsCourseRedPacketLogService
     BigDecimal getTodaySumAmountByCompanyUserId(Long userId);
 
     PageInfo<FsCourseRedPacketLogListPVO> selectFsCourseRedPacketLogListVOPage(FsCourseRedPacketLogParam fsCourseRedPacketLog);
+    
+    /**
+     * 查询符合条件的记录总数(用于导出前校验)
+     * @param fsCourseRedPacketLog 查询参数
+     * @return 总数
+     */
+    long selectFsCourseRedPacketLogListVOCount(FsCourseRedPacketLogParam fsCourseRedPacketLog);
 }

+ 5 - 0
fs-service/src/main/java/com/fs/course/service/impl/FsCourseRedPacketLogServiceImpl.java

@@ -210,6 +210,11 @@ public class FsCourseRedPacketLogServiceImpl implements IFsCourseRedPacketLogSer
         return pageInfo;
     }
 
+    @Override
+    public long selectFsCourseRedPacketLogListVOCount(FsCourseRedPacketLogParam fsCourseRedPacketLog) {
+        return fsCourseRedPacketLogMapper.selectFsCourseRedPacketLogListVOCount(fsCourseRedPacketLog);
+    }
+
     @Override
     public List<FsCourseRedPacketLogListPVO> selectFsCourseRedPacketLogListVONew(FsCourseRedPacketLogParam fsCourseRedPacketLog) {
         return fsCourseRedPacketLogMapper.selectFsCourseRedPacketLogListVONew(fsCourseRedPacketLog);

+ 3 - 3
fs-service/src/main/java/com/fs/im/service/impl/OpenIMServiceImpl.java

@@ -492,7 +492,7 @@ public class OpenIMServiceImpl implements OpenIMService {
                 .execute()
                 .body();
 
-        //增加黑名单
+      /*  //增加黑名单
         Map<String, Object> bodyMap1 = new HashMap<>();
         bodyMap1.put("ownerUserID", ownerUserID);
         bodyMap1.put("blackUserID", friendUserID);
@@ -502,8 +502,8 @@ public class OpenIMServiceImpl implements OpenIMService {
                 .header("token", adminToken)
                 .body(jsonBody2)
                 .execute()
-                .body();
-        responseDTO= JSONUtil.toBean(result2,OpenImResponseDTO.class);
+                .body();*/
+        responseDTO= JSONUtil.toBean(result1,OpenImResponseDTO.class);
         return responseDTO;
     }